From 433a2955b5dc2704267868c040a81923327ad9cc Mon Sep 17 00:00:00 2001 From: Nick Shirokov Date: Fri, 1 May 2026 19:32:53 +0300 Subject: [PATCH] =?UTF-8?q?fix(form-compile):=20=D0=BB=D0=BE=D1=8F=D0=BB?= =?UTF-8?q?=D1=8C=D0=BD=D0=BE=20=D1=81=D1=82=D1=80=D0=B8=D0=BF=D0=B0=D1=82?= =?UTF-8?q?=D1=8C=20cfg:=20=D0=BF=D1=80=D0=B5=D1=84=D0=B8=D0=BA=D1=81=20?= =?UTF-8?q?=D0=B3=D0=BB=D0=B0=D0=B2=D0=BD=D0=BE=D0=B3=D0=BE=20=D1=80=D0=B5?= =?UTF-8?q?=D0=BA=D0=B2=D0=B8=D0=B7=D0=B8=D1=82=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Раньше тип `cfg:CatalogObject.X` мимо regex попадал в fallback и получал второй `cfg:` поверх → `cfg:cfg:...`, db-load-xml падал. Теперь Resolve-TypeStr срезает ведущий `cfg:` сразу, обе формы записи валидны. Заодно сообщение об ошибке FormDataStructure согласовано с примером — без префикса. Co-Authored-By: Claude Opus 4.7 (1M context) --- .claude/skills/form-compile/scripts/form-compile.ps1 | 6 ++++-- .claude/skills/form-compile/scripts/form-compile.py | 7 +++++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/.claude/skills/form-compile/scripts/form-compile.ps1 b/.claude/skills/form-compile/scripts/form-compile.ps1 index 266ea320..7b009c08 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.6 — Compile 1C managed form from JSON or object metadata +# form-compile v1.7 — Compile 1C managed form from JSON or object metadata # Source: https://github.com/Nikolay-Shirokov/cc-1c-skills param( [string]$JsonPath, @@ -1554,7 +1554,7 @@ $script:formTypeSynonyms["определяемыйтип"] = "Define # Known invalid types (runtime/UI types that don't exist in XDTO schema) $script:knownInvalidTypes = @{ - "FormDataStructure" = "Runtime type. Use cfg:*Object.XXX (e.g. CatalogObject.XXX)" + "FormDataStructure" = "Runtime type. Use object type without cfg: prefix (e.g. CatalogObject.Контрагенты, DocumentObject.Приход)" "FormDataCollection" = "Runtime type. Use ValueTable" "FormDataTree" = "Runtime type. Use ValueTree" "FormDataTreeItem" = "Runtime type, not valid in XML" @@ -1569,6 +1569,8 @@ $script:knownInvalidTypes = @{ function Resolve-TypeStr { param([string]$typeStr) if (-not $typeStr) { return $typeStr } + # Lenient: strip leading cfg: prefix if user passed it (canonical form is without prefix) + if ($typeStr -match '^cfg:(.+)$') { $typeStr = $Matches[1] } if ($typeStr -match '^([^(]+)\((.+)\)$') { $base = $Matches[1].Trim(); $params = $Matches[2] $r = $script:formTypeSynonyms[$base.ToLower()] diff --git a/.claude/skills/form-compile/scripts/form-compile.py b/.claude/skills/form-compile/scripts/form-compile.py index 08d71528..8ff4085f 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.6 — Compile 1C managed form from JSON or object metadata +# form-compile v1.7 — Compile 1C managed form from JSON or object metadata # Source: https://github.com/Nikolay-Shirokov/cc-1c-skills import argparse import copy @@ -1455,7 +1455,7 @@ CFG_REF_PATTERN = re.compile( ) KNOWN_INVALID_TYPES = { - 'FormDataStructure': 'Runtime type. Use cfg:*Object.XXX (e.g. CatalogObject.XXX)', + 'FormDataStructure': 'Runtime type. Use object type without cfg: prefix (e.g. CatalogObject.Контрагенты, DocumentObject.Приход)', 'FormDataCollection': 'Runtime type. Use ValueTable', 'FormDataTree': 'Runtime type. Use ValueTree', 'FormDataTreeItem': 'Runtime type, not valid in XML', @@ -1489,6 +1489,9 @@ _FORM_TYPE_SYNONYMS = { def resolve_type_str(type_str): if not type_str: return type_str + # Lenient: strip leading cfg: prefix if user passed it (canonical form is without prefix) + if type_str.startswith('cfg:'): + type_str = type_str[4:] m = re.match(r'^([^(]+)\((.+)\)$', type_str) if m: base, params = m.group(1).strip(), m.group(2)