From db6a1f2212e2600b4faa7cd6e811839c22a80ca6 Mon Sep 17 00:00:00 2001 From: Nick Shirokov Date: Sun, 24 May 2026 15:37:07 +0300 Subject: [PATCH] =?UTF-8?q?feat(skd):=20bool/numeric=20values=20=D0=B2=20i?= =?UTF-8?q?nputParameters=20choiceParameters?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Раньше все values в эмитились как DesignTimeValue. Оригинал использует xs:boolean для bool-флагов (пример: Отбор.ОбособленноеПодразделение=false в ChoiceParameters элементе inputParameters поля ДанныеОрганизации). decompile: читает тип xsi из и конвертит в JSON-native (true/false для boolean, int/double для decimal, иначе строка). compile: при эмите inputParameters → choiceParameters → values детектирует тип значения и эмитит соответствующий xsi:type. PS и Py синхронизированы. --- .../skills/skd-compile/scripts/skd-compile.ps1 | 11 +++++++++-- .claude/skills/skd-compile/scripts/skd-compile.py | 10 ++++++++-- .../skd-decompile/scripts/skd-decompile.ps1 | 15 +++++++++++++-- 3 files changed, 30 insertions(+), 6 deletions(-) diff --git a/.claude/skills/skd-compile/scripts/skd-compile.ps1 b/.claude/skills/skd-compile/scripts/skd-compile.ps1 index b250b641..c25cdf5d 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.86 — Compile 1C DCS from JSON +# skd-compile v1.87 — Compile 1C DCS from JSON # Source: https://github.com/Nikolay-Shirokov/cc-1c-skills param( [string]$DefinitionFile, @@ -773,7 +773,14 @@ function Emit-InputParameters { X "$indent`t`t`t" X "$indent`t`t`t`t$(Esc-Xml "$($cpItem.name)")" foreach ($v in @($cpItem.values)) { - X "$indent`t`t`t`t$(Esc-Xml "$v")" + if ($v -is [bool]) { + $vStr = if ($v) { 'true' } else { 'false' } + X "$indent`t`t`t`t$vStr" + } elseif ($v -is [int] -or $v -is [long] -or $v -is [double] -or $v -is [decimal]) { + X "$indent`t`t`t`t$v" + } else { + X "$indent`t`t`t`t$(Esc-Xml "$v")" + } } X "$indent`t`t`t" } diff --git a/.claude/skills/skd-compile/scripts/skd-compile.py b/.claude/skills/skd-compile/scripts/skd-compile.py index 8228d019..b8f5ea43 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.86 — Compile 1C DCS from JSON +# skd-compile v1.87 — Compile 1C DCS from JSON # Source: https://github.com/Nikolay-Shirokov/cc-1c-skills import argparse import json @@ -586,7 +586,13 @@ def emit_input_parameters(lines, ip, indent): lines.append(f'{indent}\t\t\t') lines.append(f'{indent}\t\t\t\t{esc_xml(str(cp.get("name", "")))}') for v in cp.get('values', []) or []: - lines.append(f'{indent}\t\t\t\t{esc_xml(str(v))}') + if isinstance(v, bool): + vs = 'true' if v else 'false' + lines.append(f'{indent}\t\t\t\t{vs}') + elif isinstance(v, (int, float)): + lines.append(f'{indent}\t\t\t\t{v}') + else: + lines.append(f'{indent}\t\t\t\t{esc_xml(str(v))}') lines.append(f'{indent}\t\t\t') lines.append(f'{indent}\t\t') elif 'choiceParameterLinks' in item: diff --git a/.claude/skills/skd-decompile/scripts/skd-decompile.ps1 b/.claude/skills/skd-decompile/scripts/skd-decompile.ps1 index ddfec202..cdf2a584 100644 --- a/.claude/skills/skd-decompile/scripts/skd-decompile.ps1 +++ b/.claude/skills/skd-decompile/scripts/skd-decompile.ps1 @@ -1,4 +1,4 @@ -# skd-decompile v0.69 — Decompile 1C DCS Template.xml to JSON DSL (draft) +# skd-decompile v0.70 — Decompile 1C DCS Template.xml to JSON DSL (draft) # Source: https://github.com/Nikolay-Shirokov/cc-1c-skills param( [Parameter(Mandatory)] @@ -492,7 +492,18 @@ function Read-InputParameters { foreach ($cpItem in $val.SelectNodes("dcscor:item", $ns)) { $cpEntry = [ordered]@{ name = Get-Text $cpItem "dcscor:choiceParameter" } $values = @() - foreach ($v in $cpItem.SelectNodes("dcscor:value", $ns)) { $values += $v.InnerText } + foreach ($v in $cpItem.SelectNodes("dcscor:value", $ns)) { + $vXsi = Get-LocalXsiType $v + $vTxt = $v.InnerText + if ($vXsi -eq 'boolean') { + $values += ($vTxt -eq 'true') + } elseif ($vXsi -eq 'decimal') { + if ($vTxt -match '^-?\d+$') { $values += [int]$vTxt } + else { $values += [double]$vTxt } + } else { + $values += $vTxt + } + } $cpEntry['values'] = $values $cp += $cpEntry }