From 73242ee60e87854b97ef39095c988a41ad25d763 Mon Sep 17 00:00:00 2001 From: Nick Shirokov Date: Tue, 7 Apr 2026 17:33:36 +0300 Subject: [PATCH] fix(skd-compile): identity totalField shorthand treated as aggregation function MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When totalField shorthand right-hand side is not a known aggregate function (e.g. "Проверка: Проверка"), emit expression as-is instead of wrapping it as Проверка(Проверка). Known aggregates (Сумма, Количество, etc.) still wrap. Co-Authored-By: Claude Opus 4.6 (1M context) --- .claude/skills/skd-compile/scripts/skd-compile.ps1 | 12 ++++++++++-- .claude/skills/skd-compile/scripts/skd-compile.py | 12 ++++++++++-- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/.claude/skills/skd-compile/scripts/skd-compile.ps1 b/.claude/skills/skd-compile/scripts/skd-compile.ps1 index fd77ceb4..97efe5f9 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.8 — Compile 1C DCS from JSON +# skd-compile v1.9 — Compile 1C DCS from JSON # Source: https://github.com/Nikolay-Shirokov/cc-1c-skills param( [string]$DefinitionFile, @@ -300,12 +300,20 @@ function Parse-TotalShorthand { $dataPath = $parts[0].Trim() $funcPart = $parts[1].Trim() + # Known DCS aggregate functions (ru + en) + $aggFuncs = @('Сумма','Количество','Минимум','Максимум','Среднее', + 'Sum','Count','Min','Max','Avg', + 'Minimum','Maximum','Average') + if ($funcPart -match '^\w+\(') { # Already has expression form: Func(expr) return @{ dataPath = $dataPath; expression = $funcPart } - } else { + } elseif ($funcPart -in $aggFuncs) { # Short: Func → Func(DataPath) return @{ dataPath = $dataPath; expression = "$funcPart($dataPath)" } + } else { + # Identity or custom expression — use as-is + return @{ dataPath = $dataPath; expression = $funcPart } } } diff --git a/.claude/skills/skd-compile/scripts/skd-compile.py b/.claude/skills/skd-compile/scripts/skd-compile.py index c415519f..eeaf0c95 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.8 — Compile 1C DCS from JSON +# skd-compile v1.9 — Compile 1C DCS from JSON # Source: https://github.com/Nikolay-Shirokov/cc-1c-skills import argparse import json @@ -221,10 +221,18 @@ def parse_total_shorthand(s): data_path = parts[0].strip() func_part = parts[1].strip() + # Known DCS aggregate functions (ru + en) + _agg_funcs = {'Сумма','Количество','Минимум','Максимум','Среднее', + 'Sum','Count','Min','Max','Avg', + 'Minimum','Maximum','Average'} + if re.match(r'^\w+\(', func_part): return {'dataPath': data_path, 'expression': func_part} - else: + elif func_part in _agg_funcs: return {'dataPath': data_path, 'expression': f'{func_part}({data_path})'} + else: + # Identity or custom expression — use as-is + return {'dataPath': data_path, 'expression': func_part} # --- Parameter shorthand parser ---