fix: accept XML-style synonyms in interface-edit and skd-compile DSL

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) <noreply@anthropic.com>
This commit is contained in:
Nick Shirokov
2026-03-29 14:11:02 +03:00
parent 0d116863ec
commit 28b2765f68
4 changed files with 27 additions and 17 deletions
@@ -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) }
@@ -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)
@@ -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<dataSetLink>"
X "`t`t<sourceDataSet>$(Esc-Xml "$($link.source)")</sourceDataSet>"
X "`t`t<destinationDataSet>$(Esc-Xml "$($link.dest)")</destinationDataSet>"
X "`t`t<sourceExpression>$(Esc-Xml "$($link.sourceExpr)")</sourceExpression>"
X "`t`t<destinationExpression>$(Esc-Xml "$($link.destExpr)")</destinationExpression>"
$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<sourceDataSet>$(Esc-Xml $srcDS)</sourceDataSet>"
X "`t`t<destinationDataSet>$(Esc-Xml $dstDS)</destinationDataSet>"
X "`t`t<sourceExpression>$(Esc-Xml $srcEx)</sourceExpression>"
X "`t`t<destinationExpression>$(Esc-Xml $dstEx)</destinationExpression>"
if ($link.parameter) {
X "`t`t<parameter>$(Esc-Xml "$($link.parameter)")</parameter>"
}
@@ -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<dataSetLink>')
lines.append(f'\t\t<sourceDataSet>{esc_xml(str(link["source"]))}</sourceDataSet>')
lines.append(f'\t\t<destinationDataSet>{esc_xml(str(link["dest"]))}</destinationDataSet>')
lines.append(f'\t\t<sourceExpression>{esc_xml(str(link["sourceExpr"]))}</sourceExpression>')
lines.append(f'\t\t<destinationExpression>{esc_xml(str(link["destExpr"]))}</destinationExpression>')
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<sourceDataSet>{esc_xml(src_ds)}</sourceDataSet>')
lines.append(f'\t\t<destinationDataSet>{esc_xml(dst_ds)}</destinationDataSet>')
lines.append(f'\t\t<sourceExpression>{esc_xml(src_ex)}</sourceExpression>')
lines.append(f'\t\t<destinationExpression>{esc_xml(dst_ex)}</destinationExpression>')
if link.get('parameter'):
lines.append(f'\t\t<parameter>{esc_xml(str(link["parameter"]))}</parameter>')
lines.append('\t</dataSetLink>')