diff --git a/.claude/skills/meta-validate/scripts/meta-validate.ps1 b/.claude/skills/meta-validate/scripts/meta-validate.ps1 index 56adc65f..faa4afad 100644 --- a/.claude/skills/meta-validate/scripts/meta-validate.ps1 +++ b/.claude/skills/meta-validate/scripts/meta-validate.ps1 @@ -1,4 +1,4 @@ -# meta-validate v1.15 — Validate 1C metadata object structure (+ReuseSessions: Use) +# meta-validate v1.16 — Validate 1C metadata object structure (+format_rank: свести к общему эталону) # Source: https://github.com/Nikolay-Shirokov/cc-1c-skills param( [Parameter(Mandatory)] @@ -1509,8 +1509,8 @@ $versionedProps = @{ "UseInInterfaceCompatibilityMode" = "2.21" # использование общей формы в режиме совместимости интерфейса } # Версия формата как число: "2.20" → 220. Строковое сравнение неверно ("2.9" > "2.17"). -function Get-FormatRank([string]$v) { - if ($v -match '^(\d+)\.(\d+)$') { return [int]$Matches[1] * 100 + [int]$Matches[2] } +function Get-FormatRank([string]$ver) { + if ($ver -match '^(\d+)\.(\d+)$') { return [int]$Matches[1] * 100 + [int]$Matches[2] } return 0 } $fileRank = Get-FormatRank $version diff --git a/.claude/skills/meta-validate/scripts/meta-validate.py b/.claude/skills/meta-validate/scripts/meta-validate.py index cffc8df5..3803cf99 100644 --- a/.claude/skills/meta-validate/scripts/meta-validate.py +++ b/.claude/skills/meta-validate/scripts/meta-validate.py @@ -1,4 +1,4 @@ -# meta-validate v1.15 — Validate 1C metadata object structure (Python port) (+ReuseSessions: Use) +# meta-validate v1.16 — Validate 1C metadata object structure (Python port) (+format_rank: свести к общему эталону) # Source: https://github.com/Nikolay-Shirokov/cc-1c-skills import argparse import os @@ -1412,9 +1412,9 @@ versioned_props = { } -def format_rank(v): - """"2.20" → 220. Строковое сравнение неверно ("2.9" > "2.17").""" - m = re.match(r'^(\d+)\.(\d+)$', v or '') +def format_rank(ver): + """"2.20" → 220, "2.9" → 209. Строковое сравнение неверно ("2.9" > "2.17").""" + m = re.match(r'^(\d+)\.(\d+)$', ver or '') return int(m.group(1)) * 100 + int(m.group(2)) if m else 0 diff --git a/.claude/skills/web-publish/scripts/web-publish.ps1 b/.claude/skills/web-publish/scripts/web-publish.ps1 index 0a4165d3..1b11d424 100644 --- a/.claude/skills/web-publish/scripts/web-publish.ps1 +++ b/.claude/skills/web-publish/scripts/web-publish.ps1 @@ -1,4 +1,4 @@ -# web-publish v1.5 — Publish 1C infobase via Apache +# web-publish v1.6 — Publish 1C infobase via Apache (+_version_dir/_version_key: общий эталон db-семейства) # Source: https://github.com/Nikolay-Shirokov/cc-1c-skills <# .SYNOPSIS diff --git a/.claude/skills/web-publish/scripts/web-publish.py b/.claude/skills/web-publish/scripts/web-publish.py index 35a5826e..3ac4947a 100644 --- a/.claude/skills/web-publish/scripts/web-publish.py +++ b/.claude/skills/web-publish/scripts/web-publish.py @@ -1,5 +1,5 @@ #!/usr/bin/env python3 -# web-publish v1.5 — Publish 1C infobase via Apache +# web-publish v1.6 — Publish 1C infobase via Apache (+_version_dir/_version_key: общий эталон db-семейства) # Source: https://github.com/Nikolay-Shirokov/cc-1c-skills """ @@ -46,10 +46,17 @@ def _find_project_v8path(): d = parent +def _version_dir(p): + """Version dir for both Windows (.../1cv8//bin/1cv8.exe) and *nix (.../1cv8//1cv8).""" + parent = os.path.dirname(p) + if os.path.basename(parent).lower() == "bin": + parent = os.path.dirname(parent) + return os.path.basename(parent) + + def _version_key(p): - """Numeric sort key from version dir name (.../1cv8//bin/1cv8.exe).""" - ver = os.path.basename(os.path.dirname(os.path.dirname(p))) - return [int(x) for x in re.findall(r"\d+", ver)] + """Numeric sort key from version dir name.""" + return [int(x) for x in re.findall(r"\d+", _version_dir(p))] def get_our_httpd(httpd_exe_norm): diff --git a/tests/skills/check-inline-drift.mjs b/tests/skills/check-inline-drift.mjs index 2cf66913..17660a6b 100644 --- a/tests/skills/check-inline-drift.mjs +++ b/tests/skills/check-inline-drift.mjs @@ -104,10 +104,10 @@ const FAMILIES = [ name: 'format_rank', py: 'format_rank', ps1: 'Get-FormatRank', variants: [ { id: 'base', authority: 'meta-compile', - consumers: ['cfe-borrow', 'cfe-init', 'form-add', 'form-compile', 'mxl-compile', 'role-compile', - 'subsystem-compile', 'subsystem-edit', 'template-add', 'xdto-compile'], + consumers: ['cfe-borrow', 'cfe-init', 'form-add', 'form-compile', 'meta-validate', + 'mxl-compile', 'role-compile', 'subsystem-compile', 'subsystem-edit', 'template-add', + 'xdto-compile'], consumersPy: ['epf-init', 'erf-init'] }, - { id: 'meta-validate-own', authority: 'meta-validate', consumers: [] }, ], }, @@ -200,8 +200,23 @@ const FAMILIES = [ variants: [ { id: 'base', authority: 'db-create', consumers: ['db-dump-cf', 'db-dump-dt', 'db-dump-xml', 'db-load-cf', 'db-load-dt', 'db-load-git', - 'db-load-xml', 'db-run', 'db-update', 'epf-build', 'epf-dump'] }, - { id: 'web-publish-own', authority: 'web-publish', consumers: [] }, + 'db-load-xml', 'db-run', 'db-update', 'epf-build', 'epf-dump', 'web-publish'] }, + ], + }, + { + name: 'platform: version_dir', py: '_version_dir', ps1: null, + variants: [ + { id: 'base', authority: 'db-create', + consumers: ['db-dump-cf', 'db-dump-dt', 'db-dump-xml', 'db-load-cf', 'db-load-dt', 'db-load-git', + 'db-load-xml', 'db-run', 'db-update', 'epf-build', 'epf-dump', 'web-publish'] }, + ], + }, + { + name: 'platform: find_project_v8path', py: '_find_project_v8path', ps1: 'Find-ProjectV8Path', + variants: [ + { id: 'base', authority: 'db-create', + consumers: ['db-dump-cf', 'db-dump-dt', 'db-dump-xml', 'db-load-cf', 'db-load-dt', 'db-load-git', + 'db-load-xml', 'db-run', 'db-update', 'epf-build', 'epf-dump', 'web-publish'] }, ], }, @@ -251,15 +266,18 @@ function extractPs1(text) { const lines = text.split('\n'); const out = new Map(); for (let i = 0; i < lines.length; i++) { - const m = /^function\s+([A-Za-z][\w-]*)/.exec(lines[i]); + // Определение может быть вложенным (db-load-git объявляет Find-ProjectV8Path внутри if), + // поэтому конец ищем по закрывающей скобке НА ТОМ ЖЕ отступе, что и слово function. + const m = /^(\s*)function\s+([A-Za-z][\w-]*)/.exec(lines[i]); if (!m) continue; + const closing = m[1] + '}'; const body = [lines[i]]; let j = i + 1; for (; j < lines.length; j++) { body.push(lines[j]); - if (lines[j].replace(/\s+$/, '') === '}') break; + if (lines[j].replace(/\s+$/, '') === closing) break; } - out.set(m[1], body); + if (!out.has(m[2])) out.set(m[2], body); i = j; } return out;