diff --git a/.claude/skills/skd-compile/scripts/skd-compile.ps1 b/.claude/skills/skd-compile/scripts/skd-compile.ps1 index d39d2dd3..9e89acc7 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.42 — Compile 1C DCS from JSON +# skd-compile v1.44 — Compile 1C DCS from JSON # Source: https://github.com/Nikolay-Shirokov/cc-1c-skills param( [string]$DefinitionFile, @@ -1954,6 +1954,21 @@ function Emit-FilterItem { Emit-FilterItem -item $sub -indent "$indent`t" } } + if ($item.presentation) { + Emit-MLText -tag "dcsset:presentation" -text $item.presentation -indent "$indent`t" + } + # Platform always emits viewMode when userSettingID is present (implicit Normal). + if ($item.viewMode -or $item.userSettingID) { + $gvm = if ($item.viewMode) { "$($item.viewMode)" } else { 'Normal' } + X "$indent`t$(Esc-Xml $gvm)" + } + if ($item.userSettingID) { + $guid = if ("$($item.userSettingID)" -eq "auto") { New-Guid-String } else { "$($item.userSettingID)" } + X "$indent`t$(Esc-Xml $guid)" + } + if ($item.userSettingPresentation) { + Emit-MLText -tag "dcsset:userSettingPresentation" -text $item.userSettingPresentation -indent "$indent`t" + } X "$indent" return } @@ -1994,8 +2009,10 @@ function Emit-FilterItem { Emit-MLText -tag "dcsset:presentation" -text $item.presentation -indent "$indent`t" } - if ($item.viewMode) { - X "$indent`t$(Esc-Xml "$($item.viewMode)")" + # Platform always emits viewMode when userSettingID is present (implicit Normal). + if ($item.viewMode -or $item.userSettingID) { + $vm = if ($item.viewMode) { "$($item.viewMode)" } else { 'Normal' } + X "$indent`t$(Esc-Xml $vm)" } if ($item.userSettingID) { @@ -2174,9 +2191,10 @@ function Emit-ConditionalAppearance { X "$indent`t`t$(Esc-Xml "$($ca.presentation)")" } - # ViewMode - if ($ca.viewMode) { - X "$indent`t`t$(Esc-Xml "$($ca.viewMode)")" + # Platform always emits viewMode when userSettingID is present (implicit Normal). + if ($ca.viewMode -or $ca.userSettingID) { + $cvm = if ($ca.viewMode) { "$($ca.viewMode)" } else { 'Normal' } + X "$indent`t`t$(Esc-Xml $cvm)" } # UserSettingID @@ -2296,8 +2314,10 @@ function Emit-DataParameters { } } - if ($dp.viewMode) { - X "$indent`t`t$(Esc-Xml "$($dp.viewMode)")" + # Platform always emits viewMode when userSettingID is present (implicit Normal). + if ($dp.viewMode -or $dp.userSettingID) { + $dvm = if ($dp.viewMode) { "$($dp.viewMode)" } else { 'Normal' } + X "$indent`t`t$(Esc-Xml $dvm)" } if ($dp.userSettingID) { @@ -2448,9 +2468,15 @@ function Emit-UserFields { } # Shared emitter for table column/row and chart point/series. -# Emits groupItems, filter, order, selection, outputParameters — each conditional on JSON presence. +# Emits name?, groupItems, filter, order, selection, outputParameters, viewMode?, +# userSettingID?, userSettingPresentation? — каждое условно по присутствию в JSON. +# Параметр $emitName управляет тем, эмитить ли внутри блока: для row caller +# уже эмитит name отдельно (исторический порядок), для остальных — здесь. function Emit-TableAxisBlock { - param($block, [string]$indent) + param($block, [string]$indent, [bool]$emitName = $true) + if ($emitName -and $block.name) { + X "$indent$(Esc-Xml "$($block.name)")" + } $gb = if ($block.groupBy) { $block.groupBy } else { $block.groupFields } Emit-GroupItems -groupBy $gb -indent $indent if ($block.filter) { @@ -2465,6 +2491,16 @@ function Emit-TableAxisBlock { if ($block.outputParameters) { Emit-OutputParameters -params $block.outputParameters -indent $indent } + if ($block.viewMode) { + X "$indent$(Esc-Xml "$($block.viewMode)")" + } + if ($block.userSettingID) { + $uid = if ("$($block.userSettingID)" -eq "auto") { New-Guid-String } else { "$($block.userSettingID)" } + X "$indent$(Esc-Xml $uid)" + } + if ($block.userSettingPresentation) { + Emit-MLText -tag "dcsset:userSettingPresentation" -text $block.userSettingPresentation -indent $indent + } } function Emit-StructureItem { @@ -2539,9 +2575,6 @@ function Emit-StructureItem { if ($item.rows) { foreach ($row in $item.rows) { X "$indent`t" - if ($row.name) { - X "$indent`t`t$(Esc-Xml "$($row.name)")" - } Emit-TableAxisBlock -block $row -indent "$indent`t`t" X "$indent`t" } diff --git a/.claude/skills/skd-compile/scripts/skd-compile.py b/.claude/skills/skd-compile/scripts/skd-compile.py index 252606b6..97f6e267 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.42 — Compile 1C DCS from JSON +# skd-compile v1.44 — Compile 1C DCS from JSON # Source: https://github.com/Nikolay-Shirokov/cc-1c-skills import argparse import json @@ -1626,6 +1626,17 @@ def emit_filter_item(lines, item, indent): if parsed.get('viewMode'): sub['viewMode'] = parsed['viewMode'] emit_filter_item(lines, sub, f'{indent}\t') + if item.get('presentation'): + emit_mltext(lines, f'{indent}\t', 'dcsset:presentation', item['presentation']) + # Platform always emits viewMode when userSettingID is present (implicit Normal). + if item.get('viewMode') or item.get('userSettingID'): + gvm = str(item['viewMode']) if item.get('viewMode') else 'Normal' + lines.append(f'{indent}\t{esc_xml(gvm)}') + if item.get('userSettingID'): + guid = new_uuid() if str(item['userSettingID']) == 'auto' else str(item['userSettingID']) + lines.append(f'{indent}\t{esc_xml(guid)}') + if item.get('userSettingPresentation'): + emit_mltext(lines, f'{indent}\t', 'dcsset:userSettingPresentation', item['userSettingPresentation']) lines.append(f'{indent}') return @@ -1662,8 +1673,10 @@ def emit_filter_item(lines, item, indent): if item.get('presentation'): emit_mltext(lines, f'{indent}\t', 'dcsset:presentation', item["presentation"]) - if item.get('viewMode'): - lines.append(f'{indent}\t{esc_xml(str(item["viewMode"]))}') + # Platform always emits viewMode when userSettingID is present (implicit Normal). + if item.get('viewMode') or item.get('userSettingID'): + vm = str(item['viewMode']) if item.get('viewMode') else 'Normal' + lines.append(f'{indent}\t{esc_xml(vm)}') if item.get('userSettingID'): uid = new_uuid() if str(item['userSettingID']) == 'auto' else str(item['userSettingID']) @@ -1814,9 +1827,10 @@ def emit_conditional_appearance(lines, items, indent, block_view_mode=None): if ca.get('presentation'): lines.append(f'{indent}\t\t{esc_xml(str(ca["presentation"]))}') - # ViewMode - if ca.get('viewMode'): - lines.append(f'{indent}\t\t{esc_xml(str(ca["viewMode"]))}') + # Platform always emits viewMode when userSettingID is present (implicit Normal). + if ca.get('viewMode') or ca.get('userSettingID'): + cvm = str(ca['viewMode']) if ca.get('viewMode') else 'Normal' + lines.append(f'{indent}\t\t{esc_xml(cvm)}') # UserSettingID if ca.get('userSettingID'): @@ -1907,8 +1921,10 @@ def emit_data_parameters(lines, items, indent): else: lines.append(f'{indent}\t\t{esc_xml(str(val))}') - if dp.get('viewMode'): - lines.append(f'{indent}\t\t{esc_xml(str(dp["viewMode"]))}') + # Platform always emits viewMode when userSettingID is present (implicit Normal). + if dp.get('viewMode') or dp.get('userSettingID'): + dvm = str(dp['viewMode']) if dp.get('viewMode') else 'Normal' + lines.append(f'{indent}\t\t{esc_xml(dvm)}') if dp.get('userSettingID'): uid = new_uuid() if str(dp['userSettingID']) == 'auto' else str(dp['userSettingID']) @@ -2028,8 +2044,15 @@ def emit_user_fields(lines, items, indent): lines.append(f'{indent}') -def emit_table_axis_block(lines, block, indent): - """Shared emitter for table column/row and chart point/series.""" +def emit_table_axis_block(lines, block, indent, emit_name=True): + """Shared emitter for table column/row and chart point/series. + + Emits name?, groupItems, filter, order, selection, outputParameters, + viewMode?, userSettingID?, userSettingPresentation? — each conditional on + presence in JSON. + """ + if emit_name and block.get('name'): + lines.append(f'{indent}{esc_xml(str(block["name"]))}') gb = block.get('groupBy') or block.get('groupFields') emit_group_items(lines, gb, indent) if block.get('filter'): @@ -2040,6 +2063,13 @@ def emit_table_axis_block(lines, block, indent): emit_selection(lines, block['selection'], indent) if block.get('outputParameters'): emit_output_parameters(lines, block['outputParameters'], indent) + if block.get('viewMode'): + lines.append(f'{indent}{esc_xml(str(block["viewMode"]))}') + if block.get('userSettingID'): + uid = new_uuid() if str(block['userSettingID']) == 'auto' else str(block['userSettingID']) + lines.append(f'{indent}{esc_xml(uid)}') + if block.get('userSettingPresentation'): + emit_mltext(lines, indent, 'dcsset:userSettingPresentation', block['userSettingPresentation']) def emit_structure_item(lines, item, indent): @@ -2097,8 +2127,6 @@ def emit_structure_item(lines, item, indent): if item.get('rows'): for row in item['rows']: lines.append(f'{indent}\t') - if row.get('name'): - lines.append(f'{indent}\t\t{esc_xml(str(row["name"]))}') emit_table_axis_block(lines, row, f'{indent}\t\t') lines.append(f'{indent}\t') diff --git a/tests/skills/cases/skd-compile/snapshots/auto-data-parameters/Template.xml b/tests/skills/cases/skd-compile/snapshots/auto-data-parameters/Template.xml index f2fcec94..65aafe37 100644 --- a/tests/skills/cases/skd-compile/snapshots/auto-data-parameters/Template.xml +++ b/tests/skills/cases/skd-compile/snapshots/auto-data-parameters/Template.xml @@ -165,6 +165,7 @@ 0001-01-01T00:00:00 0001-01-01T00:00:00 + Normal UUID-001 @@ -175,37 +176,44 @@ 0001-01-01T00:00:00 0001-01-01T00:00:00 + Normal UUID-002 Флаг true + Normal UUID-003 Сумма 0 + Normal UUID-004 Ставка 13.5 + Normal UUID-005 Метка ТестовоеЗначение + Normal UUID-006 false ПустаяСтрока + Normal UUID-007 Валюта Справочник.Валюты.EmptyRef + Normal UUID-008 diff --git a/tests/skills/cases/skd-compile/snapshots/full-example/Template.xml b/tests/skills/cases/skd-compile/snapshots/full-example/Template.xml index 3e9f5d4b..e4e6409f 100644 --- a/tests/skills/cases/skd-compile/snapshots/full-example/Template.xml +++ b/tests/skills/cases/skd-compile/snapshots/full-example/Template.xml @@ -132,6 +132,7 @@ false Организация Equal + Normal UUID-001 @@ -143,6 +144,7 @@ 0001-01-01T00:00:00 0001-01-01T00:00:00 + Normal UUID-002 diff --git a/tests/skills/cases/skd-compile/snapshots/with-filters/Template.xml b/tests/skills/cases/skd-compile/snapshots/with-filters/Template.xml index 69d27f95..f8d8ead5 100644 --- a/tests/skills/cases/skd-compile/snapshots/with-filters/Template.xml +++ b/tests/skills/cases/skd-compile/snapshots/with-filters/Template.xml @@ -130,6 +130,7 @@ false Организация Equal + Normal UUID-001 @@ -150,6 +151,7 @@ 0001-01-01T00:00:00 0001-01-01T00:00:00 + Normal UUID-002 diff --git a/tests/skills/cases/skd-decompile/snapshots/variant-full/Template.xml b/tests/skills/cases/skd-decompile/snapshots/variant-full/Template.xml index 331424d5..fbbe0ab1 100644 --- a/tests/skills/cases/skd-decompile/snapshots/variant-full/Template.xml +++ b/tests/skills/cases/skd-decompile/snapshots/variant-full/Template.xml @@ -297,6 +297,7 @@ false Организация Equal + Normal UUID-001 @@ -359,11 +360,13 @@ 0001-01-01T00:00:00 0001-01-01T00:00:00 + Normal UUID-003 Активные true + Normal UUID-004