From 639568c0394f266d3f9f073829647ff1875ee129 Mon Sep 17 00:00:00 2001 From: Nick Shirokov Date: Sat, 23 May 2026 20:24:46 +0300 Subject: [PATCH] =?UTF-8?q?feat(skd):=20=D0=BA=D0=B0=D1=81=D1=82=D0=BE?= =?UTF-8?q?=D0=BC=D0=BD=D1=8B=D0=B5=20xsi:type=20=D1=81=20=D0=BB=D0=BE?= =?UTF-8?q?=D0=BA=D0=B0=D0=BB=D1=8C=D0=BD=D1=8B=D0=BC=20xmlns=20=D0=B2=20i?= =?UTF-8?q?nputParameters=20values?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Параметр ВыборГруппИЭлементов имеет значение типа FoldersAndItemsUse: Items Decompile теряла xsi:type → compile эмитил xs:string. Теперь сохраняем {uri, name} в valueType wrapper'е, compile воспроизводит локальный xmlns:dN="..." prefix и правильный xsi:type. GetNamespaceOfPrefix извлекает URI из контекста элемента, что работает для всех 7 известных xmlns URI (enterprise, current-config, ui/style, chart, types и т.п.). sample30: −8 строк (1556 → 1548). --- .../skd-compile/scripts/skd-compile.ps1 | 20 +++++++++++++++++-- .../skills/skd-compile/scripts/skd-compile.py | 12 +++++++++-- .../skd-decompile/scripts/skd-decompile.ps1 | 13 +++++++++++- 3 files changed, 40 insertions(+), 5 deletions(-) diff --git a/.claude/skills/skd-compile/scripts/skd-compile.ps1 b/.claude/skills/skd-compile/scripts/skd-compile.ps1 index fbdfd3d4..025a82e9 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.79 — Compile 1C DCS from JSON +# skd-compile v1.80 — Compile 1C DCS from JSON # Source: https://github.com/Nikolay-Shirokov/cc-1c-skills param( [string]$DefinitionFile, @@ -799,7 +799,23 @@ function Emit-InputParameters { } elseif (Has-JsonProp $item 'value') { # Simple typed value — определяем xsi:type из JSON-типа $val = $item.value - if ($val -is [bool]) { + # Явный кастомный type из decompile: {uri, name} → + $customType = $null + if (Has-JsonProp $item 'valueType') { + $vtSrc = $item.valueType + $uri = $null; $tName = $null + if ($vtSrc -is [PSCustomObject]) { + if ($vtSrc.PSObject.Properties['uri']) { $uri = "$($vtSrc.uri)" } + if ($vtSrc.PSObject.Properties['name']) { $tName = "$($vtSrc.name)" } + } elseif ($vtSrc -is [System.Collections.IDictionary]) { + if ($vtSrc.Contains('uri')) { $uri = "$($vtSrc['uri'])" } + if ($vtSrc.Contains('name')) { $tName = "$($vtSrc['name'])" } + } + if ($uri -and $tName) { $customType = @{ uri = $uri; name = $tName } } + } + if ($customType) { + X "$indent`t`t$(Esc-Xml "$val")" + } elseif ($val -is [bool]) { $vStr = if ($val) { 'true' } else { 'false' } X "$indent`t`t$vStr" } elseif ($val -is [int] -or $val -is [long] -or $val -is [double] -or $val -is [decimal]) { diff --git a/.claude/skills/skd-compile/scripts/skd-compile.py b/.claude/skills/skd-compile/scripts/skd-compile.py index 1e14ee17..7fcbe6cb 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.79 — Compile 1C DCS from JSON +# skd-compile v1.80 — Compile 1C DCS from JSON # Source: https://github.com/Nikolay-Shirokov/cc-1c-skills import argparse import json @@ -605,7 +605,15 @@ def emit_input_parameters(lines, ip, indent): lines.append(f'{indent}\t\t') elif 'value' in item: val = item['value'] - if isinstance(val, bool): + # Явный кастомный type из decompile: {uri, name} + vt_src = item.get('valueType') + custom_uri = None; custom_name = None + if isinstance(vt_src, dict): + custom_uri = vt_src.get('uri') + custom_name = vt_src.get('name') + if custom_uri and custom_name: + lines.append(f'{indent}\t\t{esc_xml(str(val))}') + elif isinstance(val, bool): vstr = 'true' if val else 'false' lines.append(f'{indent}\t\t{vstr}') elif isinstance(val, (int, float)): diff --git a/.claude/skills/skd-decompile/scripts/skd-decompile.ps1 b/.claude/skills/skd-decompile/scripts/skd-decompile.ps1 index 01c38e98..9be547f6 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.65 — Decompile 1C DCS Template.xml to JSON DSL (draft) +# skd-decompile v0.66 — Decompile 1C DCS Template.xml to JSON DSL (draft) # Source: https://github.com/Nikolay-Shirokov/cc-1c-skills param( [Parameter(Mandatory)] @@ -523,6 +523,17 @@ function Read-InputParameters { else { $entry['value'] = [double]$txt } } else { $entry['value'] = $txt + # Сохраняем кастомный xsi:type (например, "d6p1:FoldersAndItemsUse" с локальным xmlns). + # Не сохраняем xs:* (string/dateTime/etc) — compile auto-detect. + $ta = $val.Attributes['xsi:type'] + if ($ta -and $ta.Value -notmatch '^xs:') { + $prefix = ($ta.Value -split ':', 2)[0] + $localName = ($ta.Value -split ':', 2)[1] + $uri = $val.GetNamespaceOfPrefix($prefix) + if ($uri) { + $entry['valueType'] = [ordered]@{ uri = $uri; name = $localName } + } + } } } }