diff --git a/.claude/skills/skd-compile/scripts/skd-compile.ps1 b/.claude/skills/skd-compile/scripts/skd-compile.ps1 index d484f0bd..fb258c67 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.96 — Compile 1C DCS from JSON +# skd-compile v1.97 — Compile 1C DCS from JSON # Source: https://github.com/Nikolay-Shirokov/cc-1c-skills param( [string]$DefinitionFile, @@ -1502,7 +1502,23 @@ function Emit-ParamValue { return } - $valStr = "$val" + # val может быть строкой (variant only) или объектом {variant, startDate?, endDate?}. + $valIsDict = ($val -is [hashtable]) -or ($val -is [System.Collections.IDictionary]) -or ($val -is [PSCustomObject]) + $variantStr = $null + $sdStr = $null + $edStr = $null + if ($valIsDict) { + if ($val -is [PSCustomObject]) { + if ($val.PSObject.Properties['variant']) { $variantStr = "$($val.variant)" } + if ($val.PSObject.Properties['startDate']) { $sdStr = "$($val.startDate)" } + if ($val.PSObject.Properties['endDate']) { $edStr = "$($val.endDate)" } + } else { + if ($val.Contains('variant')) { $variantStr = "$($val['variant'])" } + if ($val.Contains('startDate')) { $sdStr = "$($val['startDate'])" } + if ($val.Contains('endDate')) { $edStr = "$($val['endDate'])" } + } + } + $valStr = if ($variantStr) { $variantStr } else { "$val" } if ($type -eq "StandardPeriod") { # Platform-pattern: startDate/endDate эмитятся ТОЛЬКО для variant=Custom. @@ -1510,8 +1526,10 @@ function Emit-ParamValue { X "$indent" X "$indent`t$(Esc-Xml $valStr)" if ($valStr -eq 'Custom') { - X "$indent`t0001-01-01T00:00:00" - X "$indent`t0001-01-01T00:00:00" + $sdOut = if ($sdStr) { $sdStr } else { '0001-01-01T00:00:00' } + $edOut = if ($edStr) { $edStr } else { '0001-01-01T00:00:00' } + X "$indent`t$(Esc-Xml $sdOut)" + X "$indent`t$(Esc-Xml $edOut)" } X "$indent" } elseif ($type -match '^date') { diff --git a/.claude/skills/skd-compile/scripts/skd-compile.py b/.claude/skills/skd-compile/scripts/skd-compile.py index 7213089f..ad2cef33 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.96 — Compile 1C DCS from JSON +# skd-compile v1.97 — Compile 1C DCS from JSON # Source: https://github.com/Nikolay-Shirokov/cc-1c-skills import argparse import json @@ -1040,15 +1040,25 @@ def emit_param_value(lines, type_str, val, indent, value_list_allowed=False): emit_empty_value(lines, type_str, indent, '', value_list_allowed) return - val_str = str(val) + # val может быть строкой (variant only) или dict {variant, startDate?, endDate?}. + variant_str = None + sd_str = None + ed_str = None + if isinstance(val, dict): + variant_str = str(val.get('variant')) if val.get('variant') is not None else None + sd_str = str(val['startDate']) if 'startDate' in val else None + ed_str = str(val['endDate']) if 'endDate' in val else None + val_str = variant_str if variant_str else str(val) if type_str == 'StandardPeriod': # Platform-pattern: startDate/endDate ТОЛЬКО для variant=Custom. lines.append(f'{indent}') lines.append(f'{indent}\t{esc_xml(val_str)}') if val_str == 'Custom': - lines.append(f'{indent}\t0001-01-01T00:00:00') - lines.append(f'{indent}\t0001-01-01T00:00:00') + sd_out = sd_str if sd_str else '0001-01-01T00:00:00' + ed_out = ed_str if ed_str else '0001-01-01T00:00:00' + lines.append(f'{indent}\t{esc_xml(sd_out)}') + lines.append(f'{indent}\t{esc_xml(ed_out)}') lines.append(f'{indent}') elif type_str and re.match(r'^date', type_str): lines.append(f'{indent}{esc_xml(val_str)}') diff --git a/.claude/skills/skd-decompile/scripts/skd-decompile.ps1 b/.claude/skills/skd-decompile/scripts/skd-decompile.ps1 index 3393376f..6a5ab9bc 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.79 — Decompile 1C DCS Template.xml to JSON DSL (draft) +# skd-decompile v0.80 — Decompile 1C DCS Template.xml to JSON DSL (draft) # Source: https://github.com/Nikolay-Shirokov/cc-1c-skills param( [Parameter(Mandatory)] @@ -755,8 +755,18 @@ function Build-Parameter { $vType = Get-LocalXsiType $valueNode if ($vType -eq 'StandardPeriod') { $variant = Get-Text $valueNode "v8:variant" - if ($variant -and $variant -ne 'Custom') { $valueDisplay = $variant } - # Custom with explicit dates → object form (handled below via needsObject) + $sd = Get-Text $valueNode "v8:startDate" + $ed = Get-Text $valueNode "v8:endDate" + $hasExplicitDates = ($sd -and $sd -ne '0001-01-01T00:00:00') -or ($ed -and $ed -ne '0001-01-01T00:00:00') + if ($hasExplicitDates) { + # Custom с явными датами → object form {variant, startDate, endDate} + $valueDisplay = [ordered]@{ variant = $variant } + if ($sd) { $valueDisplay['startDate'] = $sd } + if ($ed) { $valueDisplay['endDate'] = $ed } + } elseif ($variant -and $variant -ne 'Custom') { + $valueDisplay = $variant + } + # Custom без явных дат — valueDisplay = null, compile подставит 0001-01-01. } elseif ($vType -eq 'DesignTimeValue') { $valueDisplay = $valueNode.InnerText } elseif ($vType -eq 'LocalStringType') {