From 7eb825b3a7665d89ab3408de43d5d1a5e02eba24 Mon Sep 17 00:00:00 2001 From: Nick Shirokov Date: Sat, 6 Jun 2026 22:18:41 +0300 Subject: [PATCH] =?UTF-8?q?feat(form-decompile,form-compile):=20commandSou?= =?UTF-8?q?rce=20=D1=83=20ButtonGroup/CommandBar?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ButtonGroup/CommandBar несут (источник команд группы): Form (2478), FormCommandPanelGlobalCommands (1267), Item.<ИмяЭлемента> (команды конкретного элемента-таблицы). Декомпилятор не захватывал → LOST в форменных/элементных панелях. Добавлен ключ commandSource (эмитится «как есть», после Title до Representation/Autofill). Декомпилятор захватывает у ButtonGroup и CommandBar. TOTAL diff lines выборки 2.17: 5189 → 5149 (-40). ButtonGroup/CommandBar CommandSource LOST → 0. Снапшот button-group (группа глобальных команд с commandSource) сертифицирован в 1С (8.3.24). Регресс form-compile 33/33 зелёный на ps + python. decompile v0.32, compile v1.50. Co-Authored-By: Claude Opus 4.8 --- .claude/skills/form-compile/scripts/form-compile.ps1 | 8 +++++++- .claude/skills/form-compile/scripts/form-compile.py | 10 ++++++++-- .../skills/form-decompile/scripts/form-decompile.ps1 | 4 +++- docs/form-dsl-spec.md | 1 + tests/skills/cases/form-compile/button-group.json | 3 ++- .../ГруппыКнопок/Forms/Форма/Ext/Form.xml | 12 ++++++++---- 6 files changed, 29 insertions(+), 9 deletions(-) diff --git a/.claude/skills/form-compile/scripts/form-compile.ps1 b/.claude/skills/form-compile/scripts/form-compile.ps1 index f2a08427..b3004d89 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.49 — Compile 1C managed form from JSON or object metadata +# form-compile v1.50 — Compile 1C managed form from JSON or object metadata # Source: https://github.com/Nikolay-Shirokov/cc-1c-skills param( [string]$JsonPath, @@ -2400,6 +2400,8 @@ function Emit-Element { "name"=1;"path"=1;"title"=1;"tooltip"=1;"tooltipRepresentation"=1;"extendedTooltip"=1 # companion-панели (свойства): командная панель + контекстное меню "commandBar"=1;"contextMenu"=1 + # источник команд группы/панели (ButtonGroup/CommandBar) + "commandSource"=1 # visibility & state "visible"=1;"hidden"=1;"enabled"=1;"disabled"=1;"readOnly"=1;"userVisible"=1 # events ("events" — основной формат; on/handlers — legacy, принимаются ради совместимости) @@ -3488,6 +3490,8 @@ function Emit-CommandBar { Emit-Title -el $el -name $name -indent $inner + if ($el.commandSource) { X "$inner$($el.commandSource)" } + if ($el.autofill -eq $true) { X "$innertrue" } Emit-CommonFlags -el $el -indent $inner @@ -3514,6 +3518,8 @@ function Emit-ButtonGroup { Emit-Title -el $el -name $name -indent $inner + if ($el.commandSource) { X "$inner$($el.commandSource)" } + if ($el.representation) { X "$inner$($el.representation)" } diff --git a/.claude/skills/form-compile/scripts/form-compile.py b/.claude/skills/form-compile/scripts/form-compile.py index 99ca2f81..62827f53 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.49 — Compile 1C managed form from JSON or object metadata +# form-compile v1.50 — Compile 1C managed form from JSON or object metadata # Source: https://github.com/Nikolay-Shirokov/cc-1c-skills import argparse import copy @@ -1780,7 +1780,7 @@ KNOWN_KEYS = { "excludedCommands", "pagesRepresentation", "type", "command", "commandName", "stdCommand", "defaultButton", "locationInCommandBar", - "commandBar", "contextMenu", + "commandBar", "contextMenu", "commandSource", "src", "valuesPicture", "loadTransparent", "autofill", "choiceMode", "initialTreeView", "enableDrag", "enableStartDrag", @@ -3173,6 +3173,9 @@ def emit_command_bar(lines, el, name, eid, indent): emit_title(lines, el, name, inner) + if el.get('commandSource'): + lines.append(f'{inner}{el["commandSource"]}') + if el.get('autofill') is True: lines.append(f'{inner}true') @@ -3224,6 +3227,9 @@ def emit_button_group(lines, el, name, eid, indent): emit_title(lines, el, name, inner) + if el.get('commandSource'): + lines.append(f'{inner}{el["commandSource"]}') + if el.get('representation'): lines.append(f'{inner}{el["representation"]}') diff --git a/.claude/skills/form-decompile/scripts/form-decompile.ps1 b/.claude/skills/form-decompile/scripts/form-decompile.ps1 index 2c5255ca..5f4dae89 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.31 — Decompile 1C managed Form.xml to JSON DSL (draft) +# form-decompile v0.32 — Decompile 1C managed Form.xml to JSON DSL (draft) # Source: https://github.com/Nikolay-Shirokov/cc-1c-skills # ВНИМАНИЕ: раундтрип не гарантируется. Навык исключён из авто-использования моделью. param( @@ -1130,6 +1130,7 @@ function Decompile-Element { 'ButtonGroup' { $obj[$key] = $name Add-CommonProps $obj $node $name + $cs = Get-Child $node 'CommandSource'; if ($cs) { $obj['commandSource'] = $cs } $rep = Get-Child $node 'Representation'; if ($rep) { $obj['representation'] = $rep } $kids = Decompile-Children $node if ($kids) { $obj['children'] = $kids } @@ -1137,6 +1138,7 @@ function Decompile-Element { 'CommandBar' { $obj[$key] = $name Add-CommonProps $obj $node $name + $cs = Get-Child $node 'CommandSource'; if ($cs) { $obj['commandSource'] = $cs } if ((Get-Child $node 'Autofill') -eq 'true') { $obj['autofill'] = $true } $kids = Decompile-Children $node if ($kids) { $obj['children'] = $kids } diff --git a/docs/form-dsl-spec.md b/docs/form-dsl-spec.md index 07cc3826..e1575940 100644 --- a/docs/form-dsl-spec.md +++ b/docs/form-dsl-spec.md @@ -565,6 +565,7 @@ Pages поддерживает `pagesRepresentation`: `None`, `TabsOnTop`, `Tabs |----------|-----|----------| | `buttonGroup` | string | Имя элемента | | `title` | string/object | Заголовок группы | +| `commandSource` | string | Источник команд группы (``): `Form`, `FormCommandPanelGlobalCommands`, `Item.<ИмяЭлемента>`. Также у `cmdBar`. Эмитится «как есть» | | `representation` | string | `Auto`, `Picture`, `Text`, `PictureAndText` | | `children` | array | Кнопки (`button`) внутри группы | diff --git a/tests/skills/cases/form-compile/button-group.json b/tests/skills/cases/form-compile/button-group.json index f15c09fb..80c0b00f 100644 --- a/tests/skills/cases/form-compile/button-group.json +++ b/tests/skills/cases/form-compile/button-group.json @@ -21,7 +21,8 @@ { "buttonGroup": "ГруппаПереместить", "title": "Переместить", "children": [ { "button": "Вверх", "command": "Вверх" }, { "button": "Вниз", "command": "Вниз" } - ]} + ]}, + { "buttonGroup": "ГруппаГлобальныеКоманды", "commandSource": "FormCommandPanelGlobalCommands" } ]} ], "attributes": [ diff --git a/tests/skills/cases/form-compile/snapshots/button-group/DataProcessors/ГруппыКнопок/Forms/Форма/Ext/Form.xml b/tests/skills/cases/form-compile/snapshots/button-group/DataProcessors/ГруппыКнопок/Forms/Форма/Ext/Form.xml index 0a1adefd..eac7521d 100644 --- a/tests/skills/cases/form-compile/snapshots/button-group/DataProcessors/ГруппыКнопок/Forms/Форма/Ext/Form.xml +++ b/tests/skills/cases/form-compile/snapshots/button-group/DataProcessors/ГруппыКнопок/Forms/Форма/Ext/Form.xml @@ -41,11 +41,15 @@ + + FormCommandPanelGlobalCommands + + - + cfg:DataProcessorObject.ГруппыКнопок @@ -53,7 +57,7 @@ - + <v8:item> <v8:lang>ru</v8:lang> @@ -69,7 +73,7 @@ <Action>ВыполнитьОбработка</Action> <Shortcut>Ctrl+Enter</Shortcut> </Command> - <Command name="Вверх" id="13"> + <Command name="Вверх" id="15"> <Title> <v8:item> <v8:lang>ru</v8:lang> @@ -79,7 +83,7 @@ <Action>ВверхОбработка</Action> <CurrentRowUse>DontUse</CurrentRowUse> </Command> - <Command name="Вниз" id="14"> + <Command name="Вниз" id="16"> <Title> <v8:item> <v8:lang>ru</v8:lang>