From 330f52c6e63cef056dadd68c14dcc22f349950af Mon Sep 17 00:00:00 2001 From: Nick Shirokov Date: Tue, 23 Jun 2026 16:28:48 +0300 Subject: [PATCH] =?UTF-8?q?fix(cfe-init,cfe-borrow):=20=D0=BD=D0=B0=D1=81?= =?UTF-8?q?=D0=BB=D0=B5=D0=B4=D0=BE=D0=B2=D0=B0=D1=82=D1=8C=20=D1=84=D0=BE?= =?UTF-8?q?=D1=80=D0=BC=D0=B0=D1=82-=D0=B2=D0=B5=D1=80=D1=81=D0=B8=D1=8E?= =?UTF-8?q?=20MDClasses=20=D0=BE=D1=82=20=D0=B1=D0=B0=D0=B7=D0=BE=D0=B2?= =?UTF-8?q?=D0=BE=D0=B9=20=D0=BA=D0=BE=D0=BD=D1=84=D0=B8=D0=B3=D1=83=D1=80?= =?UTF-8?q?=D0=B0=D1=86=D0=B8=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit При заимствовании форм из конфигураций старого формата (напр. УТ, весь конфиг 2.13) расширение получалось разноверсийным: cfe-init хардкодил version="2.17", а cfe-borrow писал layout-форму версией исходника (2.13). Платформа на строгом импорте (ibcmd config import --extension) отвергала: «версия формата файла отличается» (Designer /LoadConfigFromFiles это пропускал — он лояльнее). Эталон Конфигуратора подтверждает: расширение должно быть ЕДИНОЙ формат-версии, а заимствованная форма поднимается до версии корня расширения. - cfe-init: формат-версия MDClasses теперь читается из базового Configuration.xml (root @version, дефолт 2.17), а не хардкодится. Формат-версия НЕ функция CompatibilityMode (УТ: Compat 8_3_17 + формат 2.13). Переиспользует паттерн Detect-FormatVersion, уже принятый в form-*/meta-*/role-*/subsystem-* навыках. - cfe-borrow: layout-форма (
/) пишется версией расширения ($script:formatVersion / format_version), а не версией исходной формы. Итог: всё расширение единой версией базы. E2E на свежей УТ-базе (2.13): borrow → ibcmd import чисто, PS и PY. acc (2.17) без изменений. cfe-init/cfe-borrow 6/6 ×2 рантайма. Co-Authored-By: Claude Opus 4.8 (1M context) --- .../skills/cfe-borrow/scripts/cfe-borrow.ps1 | 8 +++++--- .claude/skills/cfe-borrow/scripts/cfe-borrow.py | 7 +++++-- .claude/skills/cfe-init/scripts/cfe-init.ps1 | 17 +++++++++++++---- .claude/skills/cfe-init/scripts/cfe-init.py | 16 ++++++++++++---- 4 files changed, 35 insertions(+), 13 deletions(-) diff --git a/.claude/skills/cfe-borrow/scripts/cfe-borrow.ps1 b/.claude/skills/cfe-borrow/scripts/cfe-borrow.ps1 index e64bbae7..88a1cf6b 100644 --- a/.claude/skills/cfe-borrow/scripts/cfe-borrow.ps1 +++ b/.claude/skills/cfe-borrow/scripts/cfe-borrow.ps1 @@ -1,4 +1,4 @@ -# cfe-borrow v1.6 — Borrow objects from configuration into extension (CFE) +# cfe-borrow v1.7 — Borrow objects from configuration into extension (CFE) # Source: https://github.com/Nikolay-Shirokov/cc-1c-skills param( [Parameter(Mandatory)][string]$ExtensionPath, @@ -556,8 +556,10 @@ function Borrow-Form { $srcFormDoc.Load($srcFormXmlPath) $srcFormEl = $srcFormDoc.DocumentElement - $formVersion = $srcFormEl.GetAttribute("version") - if (-not $formVersion) { $formVersion = $script:formatVersion } + # Borrowed form must use the extension's format version (not the source form's), so the whole + # extension stays uniform — otherwise the platform rejects the import on a version mismatch + # (e.g. a 2.13 form inside a 2.17 extension). The platform itself upgrades the form to the root version. + $formVersion = $script:formatVersion # Find direct children: form properties, AutoCommandBar, ChildItems $srcAutoCmd = $null diff --git a/.claude/skills/cfe-borrow/scripts/cfe-borrow.py b/.claude/skills/cfe-borrow/scripts/cfe-borrow.py index 137dd561..5daf9713 100644 --- a/.claude/skills/cfe-borrow/scripts/cfe-borrow.py +++ b/.claude/skills/cfe-borrow/scripts/cfe-borrow.py @@ -1,5 +1,5 @@ #!/usr/bin/env python3 -# cfe-borrow v1.6 — Borrow objects from configuration into extension (CFE) +# cfe-borrow v1.7 — Borrow objects from configuration into extension (CFE) # Source: https://github.com/Nikolay-Shirokov/cc-1c-skills import argparse @@ -1198,7 +1198,10 @@ def main(): src_form_tree = etree.parse(src_form_xml_path, src_form_parser) src_form_el = src_form_tree.getroot() - form_version = src_form_el.get("version", format_version) + # Borrowed form uses the extension's format version (not the source form's) — keeps the + # extension uniform; otherwise the platform rejects the import on a version mismatch + # (e.g. a 2.13 form inside a 2.17 extension). The platform upgrades the form to the root version. + form_version = format_version src_auto_cmd = None form_props = [] diff --git a/.claude/skills/cfe-init/scripts/cfe-init.ps1 b/.claude/skills/cfe-init/scripts/cfe-init.ps1 index b131abe0..c9d22f64 100644 --- a/.claude/skills/cfe-init/scripts/cfe-init.ps1 +++ b/.claude/skills/cfe-init/scripts/cfe-init.ps1 @@ -1,4 +1,4 @@ -# cfe-init v1.1 — Create 1C configuration extension scaffold (CFE) +# cfe-init v1.2 — Create 1C configuration extension scaffold (CFE) # Source: https://github.com/Nikolay-Shirokov/cc-1c-skills param( [Parameter(Mandatory)] @@ -35,6 +35,10 @@ if (Test-Path $cfgFile) { exit 1 } +# MDClasses format version — inherited from the base config so the extension stays uniform +# with it (a 2.13 base must yield a 2.13 extension, else platform import rejects the mismatch). +$formatVersion = "2.17" + # --- Resolve ConfigPath --- $baseLangUuid = "00000000-0000-0000-0000-000000000000" if ($ConfigPath) { @@ -75,6 +79,11 @@ if ($ConfigPath) { $baseCfgDoc.Load((Resolve-Path $ConfigPath).Path) $baseCfgNs = New-Object System.Xml.XmlNamespaceManager($baseCfgDoc.NameTable) $baseCfgNs.AddNamespace("md", "http://v8.1c.ru/8.3/MDClasses") + $fmtVer = $baseCfgDoc.DocumentElement.GetAttribute("version") + if ($fmtVer) { + $formatVersion = $fmtVer + Write-Host "[INFO] Base config format version: $formatVersion" + } $compatNode = $baseCfgDoc.SelectSingleNode("//md:Configuration/md:Properties/md:CompatibilityMode", $baseCfgNs) if ($compatNode -and $compatNode.InnerText) { $CompatibilityMode = $compatNode.InnerText.Trim() @@ -138,7 +147,7 @@ $childObjectsXml += "`r`n`t`t" # --- Configuration.xml --- $cfgXml = @" - + @@ -203,7 +212,7 @@ $cfgXml = @" # --- Languages/Русский.xml (adopted format) --- $langXml = @" - + @@ -220,7 +229,7 @@ $langXml = @" # --- Role XML --- $roleXml = @" - + $([System.Security.SecurityElement]::Escape($roleName)) diff --git a/.claude/skills/cfe-init/scripts/cfe-init.py b/.claude/skills/cfe-init/scripts/cfe-init.py index a1245f97..f5aeb90b 100644 --- a/.claude/skills/cfe-init/scripts/cfe-init.py +++ b/.claude/skills/cfe-init/scripts/cfe-init.py @@ -1,5 +1,5 @@ #!/usr/bin/env python3 -# cfe-init v1.1 — Create 1C configuration extension scaffold (CFE) +# cfe-init v1.2 — Create 1C configuration extension scaffold (CFE) # Source: https://github.com/Nikolay-Shirokov/cc-1c-skills """Generates minimal XML source files for a 1C configuration extension.""" import sys, os, argparse, uuid @@ -50,6 +50,10 @@ def main(): print(f"Configuration.xml already exists: {cfg_file}", file=sys.stderr) sys.exit(1) + # MDClasses format version — inherited from the base config so the extension stays uniform + # with it (a 2.13 base must yield a 2.13 extension, else platform import rejects the mismatch). + format_version = "2.17" + # --- Resolve ConfigPath --- base_lang_uuid = "00000000-0000-0000-0000-000000000000" if args.ConfigPath: @@ -88,6 +92,10 @@ def main(): try: base_cfg_tree = ET.parse(os.path.abspath(config_path)) base_cfg_root = base_cfg_tree.getroot() + fmt_ver = base_cfg_root.get("version") + if fmt_ver: + format_version = fmt_ver + print(f"[INFO] Base config format version: {format_version}") ns = {'md': 'http://v8.1c.ru/8.3/MDClasses'} compat_node = base_cfg_root.find('.//md:Configuration/md:Properties/md:CompatibilityMode', ns) if compat_node is not None and compat_node.text: @@ -155,7 +163,7 @@ def main(): \t\t\t\n""" cfg_xml = f''' - + \t \t\t {contained_objects}\t\t @@ -190,7 +198,7 @@ def main(): # --- Languages/Русский.xml (adopted format) --- lang_xml = f''' - + \t \t\t \t\t @@ -205,7 +213,7 @@ def main(): # --- Role XML --- role_xml = f''' - + \t \t\t \t\t\t{esc_xml(role_name)}