feat(mirror_export): switch mirror file extension to .st
Match the de-facto community convention. .st (IEC 61131-3 Structured
Text) is what the existing PLC tooling around forge.codesys.com,
ArthurkaX/cds-text-sync, and the VS Code "IEC Structured Text"
extension already syntax-highlight by default. The previous .iecst
was specific but unhelpful: nothing else in the toolchain knew what
to do with it.
User asked for the switch right after Phase 1 landed (commit 7a6e725).
Re-ran the export against MRCodesysX33_0021 (X33) on disk: 91 files
re-emitted as .st, identical content + tree shape, total 254 KB.
This commit is contained in:
parent
7a6e7254a6
commit
76b7cf485a
2 changed files with 3 additions and 3 deletions
|
|
@ -5,7 +5,7 @@ import sys, scriptengine as script_engine, os, traceback, time, codecs
|
|||
#
|
||||
# - Structural nodes (Device, Application, Folder, ...) become directories.
|
||||
# - Code-bearing nodes (Program, FB, Function, Method, Property, DUT, GVL,
|
||||
# Interface, ...) become .iecst files in their parent directory.
|
||||
# Interface, ...) become .st files in their parent directory.
|
||||
# - If a code-bearing node has child code objects (e.g. an FB with methods)
|
||||
# those children land in a sibling subdirectory with the parent's name.
|
||||
# - Filesystem-illegal characters in CODESYS object names are replaced with
|
||||
|
|
@ -95,7 +95,7 @@ def write_one(parent_dir, name, decl, impl, project_path):
|
|||
if not os.path.exists(parent_dir):
|
||||
os.makedirs(parent_dir)
|
||||
kind = classify(decl)
|
||||
fname = sanitise(name) + '.iecst'
|
||||
fname = sanitise(name) + '.st'
|
||||
fpath = os.path.join(parent_dir, fname)
|
||||
|
||||
lines = []
|
||||
|
|
|
|||
|
|
@ -1350,7 +1350,7 @@ export async function startMcpServer(config: ServerConfig): Promise<void> {
|
|||
|
||||
s.tool(
|
||||
'mirror_export',
|
||||
"Walks the CODESYS project tree and writes one .iecst file per code-bearing object into a filesystem mirror, preserving the project tree as nested directories. Programs / Function Blocks / Functions / Methods / Properties / DUTs / GVLs / Interfaces all become text files; structural nodes (Devices, Applications, Folders) become directories. Each file carries a header comment with its original CODESYS project path so a future write-back tool can map it back to set_pou_code's pouPath. Read-only -- does NOT modify the CODESYS project. UTF-8 output. If mirrorRoot is omitted, defaults to '<projectDir>/MCP/mirror'.",
|
||||
"Walks the CODESYS project tree and writes one .st file per code-bearing object into a filesystem mirror, preserving the project tree as nested directories. Programs / Function Blocks / Functions / Methods / Properties / DUTs / GVLs / Interfaces all become text files; structural nodes (Devices, Applications, Folders) become directories. Each file carries a header comment with its original CODESYS project path so a future write-back tool can map it back to set_pou_code's pouPath. Read-only -- does NOT modify the CODESYS project. UTF-8 output. If mirrorRoot is omitted, defaults to '<projectDir>/MCP/mirror'.",
|
||||
{
|
||||
projectFilePath: z.string().describe("Path to the project file."),
|
||||
mirrorRoot: z.string().optional().describe("Filesystem path where the mirror tree gets written. If omitted, defaults to '<projectDir>/MCP/mirror'. Created automatically if missing; existing files at the same paths are overwritten."),
|
||||
|
|
|
|||
Loading…
Reference in a new issue