From 28b2765f68f38d155fe6373d903b1b8a9f677902 Mon Sep 17 00:00:00 2001 From: Nick Shirokov Date: Sun, 29 Mar 2026 14:11:02 +0300 Subject: [PATCH] fix: accept XML-style synonyms in interface-edit and skd-compile DSL MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit interface-edit v1.1: place/order operations accept value as object (not just JSON string) from DefinitionFile — no more JSON-in-JSON. skd-compile v1.3: dataSetLinks accept both DSL names (sourceExpr, destExpr, source, dest) and XML names (sourceExpression, destinationExpression, sourceDataSet, destinationDataSet). Co-Authored-By: Claude Opus 4.6 (1M context) --- .../interface-edit/scripts/interface-edit.ps1 | 6 ++++-- .../interface-edit/scripts/interface-edit.py | 10 +++++----- .claude/skills/skd-compile/scripts/skd-compile.ps1 | 14 +++++++++----- .claude/skills/skd-compile/scripts/skd-compile.py | 14 +++++++++----- 4 files changed, 27 insertions(+), 17 deletions(-) diff --git a/.claude/skills/interface-edit/scripts/interface-edit.ps1 b/.claude/skills/interface-edit/scripts/interface-edit.ps1 index 5fc64f37..39e6b755 100644 --- a/.claude/skills/interface-edit/scripts/interface-edit.ps1 +++ b/.claude/skills/interface-edit/scripts/interface-edit.ps1 @@ -1,4 +1,4 @@ -# interface-edit v1.0 — Edit 1C CommandInterface.xml +# interface-edit v1.1 — Edit 1C CommandInterface.xml # Source: https://github.com/Nikolay-Shirokov/cc-1c-skills param( [Parameter(Mandatory)][string]$CIPath, @@ -436,7 +436,9 @@ if ($DefinitionFile) { foreach ($op in $operations) { $opName = if ($op.operation) { "$($op.operation)" } else { "$Operation" } - $opValue = if ($op.value) { "$($op.value)" } else { "$Value" } + $opValueRaw = if ($op.value) { $op.value } else { "$Value" } + # For operations expecting JSON (place, order, etc.): accept object or string + $opValue = if ($opValueRaw -is [string]) { $opValueRaw } else { $opValueRaw | ConvertTo-Json -Compress } switch ($opName) { "hide" { Do-Hide (Parse-ValueList $opValue) } diff --git a/.claude/skills/interface-edit/scripts/interface-edit.py b/.claude/skills/interface-edit/scripts/interface-edit.py index fbd2050f..04c69a20 100644 --- a/.claude/skills/interface-edit/scripts/interface-edit.py +++ b/.claude/skills/interface-edit/scripts/interface-edit.py @@ -1,5 +1,5 @@ #!/usr/bin/env python3 -# interface-edit v1.0 — Edit 1C CommandInterface.xml +# interface-edit v1.1 — Edit 1C CommandInterface.xml # Source: https://github.com/Nikolay-Shirokov/cc-1c-skills import argparse @@ -276,7 +276,7 @@ def main(): def do_place(json_val): nonlocal add_count, modify_count - defn = json.loads(json_val) + defn = json_val if isinstance(json_val, dict) else json.loads(json_val) cmd_name = str(defn["command"]) group_name = str(defn["group"]) if not cmd_name or not group_name: @@ -304,7 +304,7 @@ def main(): def do_order(json_val): nonlocal add_count, remove_count - defn = json.loads(json_val) + defn = json_val if isinstance(json_val, dict) else json.loads(json_val) group_name = str(defn["group"]) commands = [str(c) for c in defn["commands"]] if not group_name or not commands: @@ -338,7 +338,7 @@ def main(): def do_subsystem_order(json_val): nonlocal add_count, remove_count - parsed = json.loads(json_val) + parsed = json_val if isinstance(json_val, list) else json.loads(json_val) subsystems = [str(s) for s in parsed] if not subsystems: print("subsystem-order requires array of subsystem paths", file=sys.stderr) @@ -363,7 +363,7 @@ def main(): def do_group_order(json_val): nonlocal add_count, remove_count - parsed = json.loads(json_val) + parsed = json_val if isinstance(json_val, list) else json.loads(json_val) groups = [str(g) for g in parsed] if not groups: print("group-order requires array of group names", file=sys.stderr) diff --git a/.claude/skills/skd-compile/scripts/skd-compile.ps1 b/.claude/skills/skd-compile/scripts/skd-compile.ps1 index 918389e7..528c5916 100644 --- a/.claude/skills/skd-compile/scripts/skd-compile.ps1 +++ b/.claude/skills/skd-compile/scripts/skd-compile.ps1 @@ -1,4 +1,4 @@ -# skd-compile v1.2 — Compile 1C DCS from JSON +# skd-compile v1.3 — Compile 1C DCS from JSON # Source: https://github.com/Nikolay-Shirokov/cc-1c-skills param( [string]$DefinitionFile, @@ -724,10 +724,14 @@ function Emit-DataSetLinks { if (-not $def.dataSetLinks) { return } foreach ($link in $def.dataSetLinks) { X "`t" - X "`t`t$(Esc-Xml "$($link.source)")" - X "`t`t$(Esc-Xml "$($link.dest)")" - X "`t`t$(Esc-Xml "$($link.sourceExpr)")" - X "`t`t$(Esc-Xml "$($link.destExpr)")" + $srcDS = if ($link.source) { "$($link.source)" } elseif ($link.sourceDataSet) { "$($link.sourceDataSet)" } else { "" } + $dstDS = if ($link.dest) { "$($link.dest)" } elseif ($link.destinationDataSet) { "$($link.destinationDataSet)" } else { "" } + $srcEx = if ($link.sourceExpr) { "$($link.sourceExpr)" } elseif ($link.sourceExpression) { "$($link.sourceExpression)" } else { "" } + $dstEx = if ($link.destExpr) { "$($link.destExpr)" } elseif ($link.destinationExpression) { "$($link.destinationExpression)" } else { "" } + X "`t`t$(Esc-Xml $srcDS)" + X "`t`t$(Esc-Xml $dstDS)" + X "`t`t$(Esc-Xml $srcEx)" + X "`t`t$(Esc-Xml $dstEx)" if ($link.parameter) { X "`t`t$(Esc-Xml "$($link.parameter)")" } diff --git a/.claude/skills/skd-compile/scripts/skd-compile.py b/.claude/skills/skd-compile/scripts/skd-compile.py index ba2180bc..33198a0d 100644 --- a/.claude/skills/skd-compile/scripts/skd-compile.py +++ b/.claude/skills/skd-compile/scripts/skd-compile.py @@ -1,5 +1,5 @@ #!/usr/bin/env python3 -# skd-compile v1.2 — Compile 1C DCS from JSON +# skd-compile v1.3 — Compile 1C DCS from JSON # Source: https://github.com/Nikolay-Shirokov/cc-1c-skills import argparse import json @@ -574,10 +574,14 @@ def emit_data_set_links(lines, defn): return for link in defn['dataSetLinks']: lines.append('\t') - lines.append(f'\t\t{esc_xml(str(link["source"]))}') - lines.append(f'\t\t{esc_xml(str(link["dest"]))}') - lines.append(f'\t\t{esc_xml(str(link["sourceExpr"]))}') - lines.append(f'\t\t{esc_xml(str(link["destExpr"]))}') + src_ds = str(link.get('source') or link.get('sourceDataSet') or '') + dst_ds = str(link.get('dest') or link.get('destinationDataSet') or '') + src_ex = str(link.get('sourceExpr') or link.get('sourceExpression') or '') + dst_ex = str(link.get('destExpr') or link.get('destinationExpression') or '') + lines.append(f'\t\t{esc_xml(src_ds)}') + lines.append(f'\t\t{esc_xml(dst_ds)}') + lines.append(f'\t\t{esc_xml(src_ex)}') + lines.append(f'\t\t{esc_xml(dst_ex)}') if link.get('parameter'): lines.append(f'\t\t{esc_xml(str(link["parameter"]))}') lines.append('\t')