From 1563973636f185ee6463995c98a133571d0f7eea Mon Sep 17 00:00:00 2001 From: Nick Shirokov Date: Thu, 30 Jul 2026 10:56:07 +0300 Subject: [PATCH] =?UTF-8?q?fix(db-run,stub-db-create):=20=D0=BD=D0=BE?= =?UTF-8?q?=D1=80=D0=BC=D0=B0=D0=BB=D0=B8=D0=B7=D0=B0=D1=86=D0=B8=D1=8F=20?= =?UTF-8?q?=D0=BF=D1=83=D1=82=D0=B5=D0=B9=20=D0=B8=20=D0=BF=D1=80=D0=BE?= =?UTF-8?q?=D0=BF=D1=83=D1=89=D0=B5=D0=BD=D0=BD=D1=8B=D0=B5=20=D0=B1=D0=B0?= =?UTF-8?q?=D0=BC=D0=BF=D1=8B=20=D0=B2=D0=B5=D1=80=D1=81=D0=B8=D0=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Хвосты после разбора: db-run и stub-db-create остались единственными, кто не прощал обрамляющие кавычки и хвостовой разделитель в путях. Плюс db-create правился в коммите паритета без бампа версии, а раннер — без бампа своего заголовка. Co-Authored-By: Claude Opus 5 (1M context) --- .../skills/db-create/scripts/db-create.ps1 | 2 +- .claude/skills/db-create/scripts/db-create.py | 2 +- .claude/skills/db-run/scripts/db-run.ps1 | 25 ++++++++++++++++++- .claude/skills/db-run/scripts/db-run.py | 24 +++++++++++++++++- .../epf-build/scripts/stub-db-create.ps1 | 25 ++++++++++++++++++- .../epf-build/scripts/stub-db-create.py | 6 ++++- tests/skills/runner.mjs | 2 +- 7 files changed, 79 insertions(+), 7 deletions(-) diff --git a/.claude/skills/db-create/scripts/db-create.ps1 b/.claude/skills/db-create/scripts/db-create.ps1 index 36dc448c..b730eabe 100644 --- a/.claude/skills/db-create/scripts/db-create.ps1 +++ b/.claude/skills/db-create/scripts/db-create.ps1 @@ -1,4 +1,4 @@ -# db-create v1.9 — Create 1C information base +# db-create v1.10 — Create 1C information base # Source: https://github.com/Nikolay-Shirokov/cc-1c-skills # NB: *nix-раскладку платформы (/opt/1cv8//1cv8, без .exe) знает только .py-порт — PS на *nix не исполняется. <# diff --git a/.claude/skills/db-create/scripts/db-create.py b/.claude/skills/db-create/scripts/db-create.py index 77bf2b06..83b2d16c 100644 --- a/.claude/skills/db-create/scripts/db-create.py +++ b/.claude/skills/db-create/scripts/db-create.py @@ -1,5 +1,5 @@ #!/usr/bin/env python3 -# db-create v1.9 — Create 1C information base +# db-create v1.10 — Create 1C information base # Source: https://github.com/Nikolay-Shirokov/cc-1c-skills import argparse diff --git a/.claude/skills/db-run/scripts/db-run.ps1 b/.claude/skills/db-run/scripts/db-run.ps1 index 1080e4b0..c809cb0d 100644 --- a/.claude/skills/db-run/scripts/db-run.ps1 +++ b/.claude/skills/db-run/scripts/db-run.ps1 @@ -1,4 +1,4 @@ -# db-run v1.6 — Launch 1C:Enterprise +# db-run v1.7 — Launch 1C:Enterprise # Source: https://github.com/Nikolay-Shirokov/cc-1c-skills # NB: *nix-раскладку платформы (/opt/1cv8//1cv8, без .exe) знает только .py-порт — PS на *nix не исполняется. <# @@ -220,6 +220,29 @@ function Format-ArgsForDisplay { return ,$res } +function ConvertTo-CleanPath { + # Forgive what is unambiguous in a path the caller passed: surrounding whitespace, + # surrounding quotes that survived shell parsing, a trailing separator. A quote left + # inside afterwards cannot be part of a real path — reject it by name instead of letting + # 1C answer with its opaque "Неверные или отсутствующие параметры соединения". + param([string]$Value, [string]$ParamName) + if (-not $Value) { return $Value } + $v = $Value.Trim() + if ($v.Length -ge 2 -and $v[0] -eq $v[-1] -and ($v[0] -eq '"' -or $v[0] -eq "'")) { + $v = $v.Substring(1, $v.Length - 2).Trim() + } + if ($v.Length -gt 3 -and ($v[-1] -eq '\' -or $v[-1] -eq '/')) { $v = $v.Substring(0, $v.Length - 1) } + if ($v.Contains('"')) { + Write-Host "Error: $ParamName contains a quote character: $Value" -ForegroundColor Red + exit 1 + } + return $v +} + +$V8Path = ConvertTo-CleanPath $V8Path '-V8Path' +$InfoBasePath = ConvertTo-CleanPath $InfoBasePath '-InfoBasePath' +$Execute = ConvertTo-CleanPath $Execute '-Execute' + # --- Resolve V8Path --- function Find-ProjectV8Path { $dir = (Get-Location).Path diff --git a/.claude/skills/db-run/scripts/db-run.py b/.claude/skills/db-run/scripts/db-run.py index 2bf44a69..b1ceadd6 100644 --- a/.claude/skills/db-run/scripts/db-run.py +++ b/.claude/skills/db-run/scripts/db-run.py @@ -1,5 +1,5 @@ #!/usr/bin/env python3 -# db-run v1.6 — Launch 1C:Enterprise +# db-run v1.7 — Launch 1C:Enterprise # Source: https://github.com/Nikolay-Shirokov/cc-1c-skills import argparse @@ -190,6 +190,24 @@ def resolve_extra_args(engine, v8_extra, ibcmd_extra, hints): return extra +def clean_path(value, param=""): + """Forgive what is unambiguous in a path the caller passed: surrounding whitespace, + surrounding quotes that survived shell parsing, a trailing separator. A quote left + inside afterwards cannot be part of a real path — reject it by name instead of letting + 1C answer with its opaque "Неверные или отсутствующие параметры соединения".""" + if not value: + return value + v = value.strip() + if len(v) >= 2 and v[0] == v[-1] and v[0] in "\"'": + v = v[1:-1].strip() + if len(v) > 3 and v[-1] in "\\/": + v = v[:-1] + if '"' in v: + print(f"Error: {param or 'path'} contains a quote character: {value}", file=sys.stderr) + sys.exit(1) + return v + + def _version_dir(p): """Version dir for both Windows (.../1cv8//bin/1cv8.exe) and *nix (.../1cv8//1cv8).""" parent = os.path.dirname(p) @@ -265,6 +283,10 @@ def main(): argv, v8_extra, ibcmd_extra = extract_extra_args(sys.argv[1:], known_opts) args = parser.parse_args(argv) + args.V8Path = clean_path(args.V8Path, "-V8Path") + args.InfoBasePath = clean_path(args.InfoBasePath, "-InfoBasePath") + args.Execute = clean_path(args.Execute, "-Execute") + v8path = resolve_v8path(args.V8Path) # --- Resolve additional arguments --- diff --git a/.claude/skills/epf-build/scripts/stub-db-create.ps1 b/.claude/skills/epf-build/scripts/stub-db-create.ps1 index fb0760e7..cf5ee404 100644 --- a/.claude/skills/epf-build/scripts/stub-db-create.ps1 +++ b/.claude/skills/epf-build/scripts/stub-db-create.ps1 @@ -1,4 +1,4 @@ -# stub-db-create v1.6 — Create temp 1C infobase with metadata stubs for EPF/ERF build +# stub-db-create v1.7 — Create temp 1C infobase with metadata stubs for EPF/ERF build # Source: https://github.com/Nikolay-Shirokov/cc-1c-skills param( [Parameter(Mandatory)] @@ -17,6 +17,29 @@ param( $ErrorActionPreference = "Stop" [Console]::OutputEncoding = [System.Text.Encoding]::UTF8 +function ConvertTo-CleanPath { + # Forgive what is unambiguous in a path the caller passed: surrounding whitespace, + # surrounding quotes that survived shell parsing, a trailing separator. A quote left + # inside afterwards cannot be part of a real path — reject it by name instead of letting + # 1C answer with its opaque "Неверные или отсутствующие параметры соединения". + param([string]$Value, [string]$ParamName) + if (-not $Value) { return $Value } + $v = $Value.Trim() + if ($v.Length -ge 2 -and $v[0] -eq $v[-1] -and ($v[0] -eq '"' -or $v[0] -eq "'")) { + $v = $v.Substring(1, $v.Length - 2).Trim() + } + if ($v.Length -gt 3 -and ($v[-1] -eq '\' -or $v[-1] -eq '/')) { $v = $v.Substring(0, $v.Length - 1) } + if ($v.Contains('"')) { + Write-Host "Error: $ParamName contains a quote character: $Value" -ForegroundColor Red + exit 1 + } + return $v +} + +$SourceDir = ConvertTo-CleanPath $SourceDir '-SourceDir' +$V8Path = ConvertTo-CleanPath $V8Path '-V8Path' +$TempBasePath = ConvertTo-CleanPath $TempBasePath '-TempBasePath' + # --- Additional platform arguments --- $script:V8OwnedKeys = @( 'DESIGNER', 'ENTERPRISE', 'CREATEINFOBASE', 'CONFIG', diff --git a/.claude/skills/epf-build/scripts/stub-db-create.py b/.claude/skills/epf-build/scripts/stub-db-create.py index b8a0392c..6ae4c9a1 100644 --- a/.claude/skills/epf-build/scripts/stub-db-create.py +++ b/.claude/skills/epf-build/scripts/stub-db-create.py @@ -1,5 +1,5 @@ #!/usr/bin/env python3 -# stub-db-create v1.6 — Create temp 1C infobase with metadata stubs for EPF/ERF build +# stub-db-create v1.7 — Create temp 1C infobase with metadata stubs for EPF/ERF build # Source: https://github.com/Nikolay-Shirokov/cc-1c-skills import argparse @@ -1039,6 +1039,10 @@ def main(): argv, v8_extra, ibcmd_extra = extract_extra_args(sys.argv[1:], known_opts) args = parser.parse_args(argv) + args.SourceDir = clean_path(args.SourceDir, "-SourceDir") + args.V8Path = clean_path(args.V8Path, "-V8Path") + args.TempBasePath = clean_path(args.TempBasePath, "-TempBasePath") + type_map = scan_ref_types(args.SourceDir) register_columns = scan_register_columns(args.SourceDir) has_ref_types = len(type_map) > 0 diff --git a/tests/skills/runner.mjs b/tests/skills/runner.mjs index b1994f47..6996634f 100644 --- a/tests/skills/runner.mjs +++ b/tests/skills/runner.mjs @@ -1,5 +1,5 @@ #!/usr/bin/env node -// skill-test-runner v0.5 — Snapshot-based regression tests for 1C skill scripts +// skill-test-runner v0.6 — Snapshot-based regression tests for 1C skill scripts // Usage: node tests/skills/runner.mjs [filter] [--update-snapshots] [--runtime python] [--json report.json] [--concurrency N] [--with-validation] import { execFileSync, execFile } from 'child_process';