mirror of
https://github.com/Nikolay-Shirokov/cc-1c-skills.git
synced 2026-09-23 10:45:52 +03:00
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:
co-authored by
Claude Opus 4.6
parent
0d116863ec
commit
28b2765f68
@@ -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
|
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
|
||||||
param(
|
param(
|
||||||
[Parameter(Mandatory)][string]$CIPath,
|
[Parameter(Mandatory)][string]$CIPath,
|
||||||
@@ -436,7 +436,9 @@ if ($DefinitionFile) {
|
|||||||
|
|
||||||
foreach ($op in $operations) {
|
foreach ($op in $operations) {
|
||||||
$opName = if ($op.operation) { "$($op.operation)" } else { "$Operation" }
|
$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) {
|
switch ($opName) {
|
||||||
"hide" { Do-Hide (Parse-ValueList $opValue) }
|
"hide" { Do-Hide (Parse-ValueList $opValue) }
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
#!/usr/bin/env python3
|
#!/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
|
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
|
||||||
|
|
||||||
import argparse
|
import argparse
|
||||||
@@ -276,7 +276,7 @@ def main():
|
|||||||
|
|
||||||
def do_place(json_val):
|
def do_place(json_val):
|
||||||
nonlocal add_count, modify_count
|
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"])
|
cmd_name = str(defn["command"])
|
||||||
group_name = str(defn["group"])
|
group_name = str(defn["group"])
|
||||||
if not cmd_name or not group_name:
|
if not cmd_name or not group_name:
|
||||||
@@ -304,7 +304,7 @@ def main():
|
|||||||
|
|
||||||
def do_order(json_val):
|
def do_order(json_val):
|
||||||
nonlocal add_count, remove_count
|
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"])
|
group_name = str(defn["group"])
|
||||||
commands = [str(c) for c in defn["commands"]]
|
commands = [str(c) for c in defn["commands"]]
|
||||||
if not group_name or not commands:
|
if not group_name or not commands:
|
||||||
@@ -338,7 +338,7 @@ def main():
|
|||||||
|
|
||||||
def do_subsystem_order(json_val):
|
def do_subsystem_order(json_val):
|
||||||
nonlocal add_count, remove_count
|
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]
|
subsystems = [str(s) for s in parsed]
|
||||||
if not subsystems:
|
if not subsystems:
|
||||||
print("subsystem-order requires array of subsystem paths", file=sys.stderr)
|
print("subsystem-order requires array of subsystem paths", file=sys.stderr)
|
||||||
@@ -363,7 +363,7 @@ def main():
|
|||||||
|
|
||||||
def do_group_order(json_val):
|
def do_group_order(json_val):
|
||||||
nonlocal add_count, remove_count
|
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]
|
groups = [str(g) for g in parsed]
|
||||||
if not groups:
|
if not groups:
|
||||||
print("group-order requires array of group names", file=sys.stderr)
|
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
|
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
|
||||||
param(
|
param(
|
||||||
[string]$DefinitionFile,
|
[string]$DefinitionFile,
|
||||||
@@ -724,10 +724,14 @@ function Emit-DataSetLinks {
|
|||||||
if (-not $def.dataSetLinks) { return }
|
if (-not $def.dataSetLinks) { return }
|
||||||
foreach ($link in $def.dataSetLinks) {
|
foreach ($link in $def.dataSetLinks) {
|
||||||
X "`t<dataSetLink>"
|
X "`t<dataSetLink>"
|
||||||
X "`t`t<sourceDataSet>$(Esc-Xml "$($link.source)")</sourceDataSet>"
|
$srcDS = if ($link.source) { "$($link.source)" } elseif ($link.sourceDataSet) { "$($link.sourceDataSet)" } else { "" }
|
||||||
X "`t`t<destinationDataSet>$(Esc-Xml "$($link.dest)")</destinationDataSet>"
|
$dstDS = if ($link.dest) { "$($link.dest)" } elseif ($link.destinationDataSet) { "$($link.destinationDataSet)" } else { "" }
|
||||||
X "`t`t<sourceExpression>$(Esc-Xml "$($link.sourceExpr)")</sourceExpression>"
|
$srcEx = if ($link.sourceExpr) { "$($link.sourceExpr)" } elseif ($link.sourceExpression) { "$($link.sourceExpression)" } else { "" }
|
||||||
X "`t`t<destinationExpression>$(Esc-Xml "$($link.destExpr)")</destinationExpression>"
|
$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) {
|
if ($link.parameter) {
|
||||||
X "`t`t<parameter>$(Esc-Xml "$($link.parameter)")</parameter>"
|
X "`t`t<parameter>$(Esc-Xml "$($link.parameter)")</parameter>"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
#!/usr/bin/env python3
|
#!/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
|
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
|
||||||
import argparse
|
import argparse
|
||||||
import json
|
import json
|
||||||
@@ -574,10 +574,14 @@ def emit_data_set_links(lines, defn):
|
|||||||
return
|
return
|
||||||
for link in defn['dataSetLinks']:
|
for link in defn['dataSetLinks']:
|
||||||
lines.append('\t<dataSetLink>')
|
lines.append('\t<dataSetLink>')
|
||||||
lines.append(f'\t\t<sourceDataSet>{esc_xml(str(link["source"]))}</sourceDataSet>')
|
src_ds = str(link.get('source') or link.get('sourceDataSet') or '')
|
||||||
lines.append(f'\t\t<destinationDataSet>{esc_xml(str(link["dest"]))}</destinationDataSet>')
|
dst_ds = str(link.get('dest') or link.get('destinationDataSet') or '')
|
||||||
lines.append(f'\t\t<sourceExpression>{esc_xml(str(link["sourceExpr"]))}</sourceExpression>')
|
src_ex = str(link.get('sourceExpr') or link.get('sourceExpression') or '')
|
||||||
lines.append(f'\t\t<destinationExpression>{esc_xml(str(link["destExpr"]))}</destinationExpression>')
|
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'):
|
if link.get('parameter'):
|
||||||
lines.append(f'\t\t<parameter>{esc_xml(str(link["parameter"]))}</parameter>')
|
lines.append(f'\t\t<parameter>{esc_xml(str(link["parameter"]))}</parameter>')
|
||||||
lines.append('\t</dataSetLink>')
|
lines.append('\t</dataSetLink>')
|
||||||
|
|||||||
Reference in New Issue
Block a user