From d8689b36742689821b3e85af795309b62a93d7a9 Mon Sep 17 00:00:00 2001 From: Nick Shirokov Date: Wed, 10 Jun 2026 21:41:43 +0300 Subject: [PATCH] =?UTF-8?q?feat(form-decompile,form-compile):=20CommandSet?= =?UTF-8?q?=20(=D0=BE=D1=82=D0=BA=D0=BB=D1=8E=D1=87=D1=91=D0=BD=D0=BD?= =?UTF-8?q?=D1=8B=D0=B5=20=D0=BA=D0=BE=D0=BC=D0=B0=D0=BD=D0=B4=D1=8B)=20?= =?UTF-8?q?=E2=80=94=20=D0=BE=D0=B1=D1=89=D0=B5=D0=B5=20=D1=81=D0=B2=D0=BE?= =?UTF-8?q?=D0=B9=D1=81=D1=82=D0=B2=D0=BE=20=D0=BF=D0=BE=D0=BB=D1=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Ранее excludedCommands обрабатывался только для Table-элемента и форм-уровня. Обычные поля (InputField/LabelField/CheckBoxField/SpreadSheetDocumentField/HTML/ Formatted/Picture) идут через Emit-SimpleField и др. — CommandSet там терялся (кластер SpreadSheetDocumentField>CommandSet, baseline impact ~1443). Централизовал: захват в Add-CommonProps (декомпилятор, общий для всех полей), эмит в Emit-Layout (компилятор ps1+py), убрал дубль из Table-эмиттера. CommandSet — дочерний элемент базового FormField в схеме, позиция фиксирована независимо от подтипа → ранняя (после TitleLocation, перед скалярами/Height), как у spreadsheet. Таргет-верификация (новый цикл category-forms.py): 43 формы корпуса с CommandSet → после фикса 0 остатка (CommandSet + ExcludedCommand cascade), 26 стали match. Кейс table пере-сертифицирован в 1С (ранняя позиция грузится), ps1==py, регресс 43/43. Co-Authored-By: Claude Opus 4.8 (1M context) --- .../skills/form-compile/scripts/form-compile.ps1 | 15 +++++++++------ .../skills/form-compile/scripts/form-compile.py | 14 ++++++++------ .../form-decompile/scripts/form-decompile.ps1 | 10 +++++++++- .../Таблица/Forms/Форма/Ext/Form.xml | 10 +++++----- 4 files changed, 31 insertions(+), 18 deletions(-) diff --git a/.claude/skills/form-compile/scripts/form-compile.ps1 b/.claude/skills/form-compile/scripts/form-compile.ps1 index e17ec49e..2f614b77 100644 --- a/.claude/skills/form-compile/scripts/form-compile.ps1 +++ b/.claude/skills/form-compile/scripts/form-compile.ps1 @@ -1,4 +1,4 @@ -# form-compile v1.108 — Compile 1C managed form from JSON or object metadata +# form-compile v1.109 — Compile 1C managed form from JSON or object metadata # Source: https://github.com/Nikolay-Shirokov/cc-1c-skills param( [string]$JsonPath, @@ -3326,6 +3326,13 @@ function Emit-Appearance { function Emit-Layout { param($el, [string]$indent, [switch]$skipHeight, [bool]$multiLineDefault = $false) + # CommandSet (отключённые команды редактора) — общее свойство поля (input/label/check/ + # spreadsheet/html/formatted/picture); в схеме рано (после TitleLocation, перед скалярами). + if ($el.excludedCommands -and @($el.excludedCommands).Count -gt 0) { + X "$indent" + foreach ($cmd in $el.excludedCommands) { X "$indent`t$cmd" } + X "$indent" + } Emit-CommonElementProps -el $el -indent $indent $amwExplicit = ($el.PSObject.Properties.Name -contains 'autoMaxWidth') if ($amwExplicit) { @@ -4235,11 +4242,7 @@ function Emit-Table { if ($el.searchControlLocation) { X "$inner$($el.searchControlLocation)" } Emit-Layout -el $el -indent $inner - if ($el.excludedCommands -and $el.excludedCommands.Count -gt 0) { - X "$inner" - foreach ($cmd in $el.excludedCommands) { X "$inner`t$cmd" } - X "$inner" - } + # CommandSet таблицы эмитится через Emit-Layout (общий механизм поля) # Оформление (цвета/граница таблицы) — перед компаньонами Emit-Appearance -el $el -indent $inner -profile 'field' diff --git a/.claude/skills/form-compile/scripts/form-compile.py b/.claude/skills/form-compile/scripts/form-compile.py index 3ed8cf4a..2d3c6fd3 100644 --- a/.claude/skills/form-compile/scripts/form-compile.py +++ b/.claude/skills/form-compile/scripts/form-compile.py @@ -1,5 +1,5 @@ #!/usr/bin/env python3 -# form-compile v1.108 — Compile 1C managed form from JSON or object metadata +# form-compile v1.109 — Compile 1C managed form from JSON or object metadata # Source: https://github.com/Nikolay-Shirokov/cc-1c-skills import argparse import copy @@ -3100,6 +3100,12 @@ def emit_layout(lines, el, indent, skip_height=False, multi_line_default=False): # с историческим выводом input/label, чтобы не сдвигать существующие снапшоты. # skip_height: подавить (зарезервирован; Table теперь эмитит generic-ом + свой ). # multi_line_default: input без явного autoMaxWidth при multiLine → AutoMaxWidth=false. + # CommandSet (отключённые команды редактора) — общее свойство поля; в схеме рано (после TitleLocation). + if el.get('excludedCommands') and len(el['excludedCommands']) > 0: + lines.append(f'{indent}') + for cmd in el['excludedCommands']: + lines.append(f'{indent}\t{cmd}') + lines.append(f'{indent}') emit_common_element_props(lines, el, indent) if 'autoMaxWidth' in el: if el.get('autoMaxWidth') is False: @@ -3965,11 +3971,7 @@ def emit_table(lines, el, name, eid, indent): lines.append(f'{inner}{el["searchControlLocation"]}') emit_layout(lines, el, inner) - if el.get('excludedCommands'): - lines.append(f'{inner}') - for cmd in el['excludedCommands']: - lines.append(f'{inner}\t{cmd}') - lines.append(f'{inner}') + # CommandSet таблицы эмитится через emit_layout (общий механизм поля) # Оформление (цвета/граница таблицы) — перед компаньонами emit_appearance(lines, el, inner, 'field') diff --git a/.claude/skills/form-decompile/scripts/form-decompile.ps1 b/.claude/skills/form-decompile/scripts/form-decompile.ps1 index 38f7e9e7..25459527 100644 --- a/.claude/skills/form-decompile/scripts/form-decompile.ps1 +++ b/.claude/skills/form-decompile/scripts/form-decompile.ps1 @@ -1,4 +1,4 @@ -# form-decompile v0.84 — Decompile 1C managed Form.xml to JSON DSL (draft) +# form-decompile v0.85 — Decompile 1C managed Form.xml to JSON DSL (draft) # Source: https://github.com/Nikolay-Shirokov/cc-1c-skills # ВНИМАНИЕ: раундтрип не гарантируется. Навык исключён из авто-использования моделью. param( @@ -1027,6 +1027,14 @@ function Add-CommonProps { $fp = Get-PictureRef $node 'FooterPicture'; if ($null -ne $fp) { $obj['footerPicture'] = $fp } $ev = Get-Events $node $elName if ($ev) { $obj['events'] = $ev } + # CommandSet — общий для полей (input/label/check/spreadsheet/html/formatted/picture): + # список отключённых команд редактора. Только , пустого не бывает. + $csNode = $node.SelectSingleNode("lf:CommandSet", $ns) + if ($csNode) { + $exc = New-Object System.Collections.ArrayList + foreach ($ec in @($csNode.SelectNodes("lf:ExcludedCommand", $ns))) { [void]$exc.Add($ec.InnerText) } + if ($exc.Count -gt 0) { $obj['excludedCommands'] = @($exc) } + } } # --- 3. Type decompile (inverse of Emit-Type) --- diff --git a/tests/skills/cases/form-compile/snapshots/table/DataProcessors/Таблица/Forms/Форма/Ext/Form.xml b/tests/skills/cases/form-compile/snapshots/table/DataProcessors/Таблица/Forms/Форма/Ext/Form.xml index 152be30b..f4aebfd8 100644 --- a/tests/skills/cases/form-compile/snapshots/table/DataProcessors/Таблица/Forms/Форма/Ext/Form.xml +++ b/tests/skills/cases/form-compile/snapshots/table/DataProcessors/Таблица/Forms/Форма/Ext/Form.xml @@ -20,17 +20,17 @@ true None None - 80 - false - 5 - false - UseHeightInTableRows Add Delete MoveUp MoveDown + 80 + false + 5 + false + UseHeightInTableRows