From 4102b7005afcc20f672252ca483b58e056691529 Mon Sep 17 00:00:00 2001 From: Nick Shirokov Date: Sun, 21 Jun 2026 15:37:19 +0300 Subject: [PATCH] =?UTF-8?q?feat(db):=20=D1=82=D0=B8=D1=80=D0=B0=D0=B6?= =?UTF-8?q?=D0=B8=D1=80=D0=BE=D0=B2=D0=B0=D0=BD=D0=B8=D0=B5=20ibcmd=20?= =?UTF-8?q?=D0=BD=D0=B0=20create/cf/update/xml=20(=D0=BF=D0=BE=20=D0=B8?= =?UTF-8?q?=D0=BC=D0=B5=D0=BD=D0=B8=20exe=20=D0=B2=20-V8Path)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Распространение пилота dt-пары на остальные применимые навыки. Если -V8Path указывает на ibcmd.exe — операция идёт через автономный сервер (offline, без запуска платформы), иначе как прежде через 1cv8 DESIGNER. Маппинг (только файловые базы --db-path): - db-create → infobase create --create-database [--restore=dt|--load=cf --apply] - db-dump-cf → infobase config save - db-load-cf → infobase config load - db-update → infobase config apply --force (--force обязателен: без него ibcmd уходит в интерактивный [y/n] и в неинтерактиве отменяет, exit 102) - db-dump-xml→ infobase config export (иерархический, Mode Full/Changes) - db-load-xml→ infobase config import (+цепочка config apply при -UpdateDB) Несовместимое под ibcmd даёт понятную ошибку с указанием на 1cv8: серверные базы, -AllExtensions, -Format Plain, Mode Partial/UpdateInfo, Files/ListFile. 1cv8-ветки без изменений. Версии 1.1→1.2 (xml-load 1.5→1.6). E2E цепочка через ibcmd: create→dump-cf→load-cf→update→dump-xml→ load-xml+UpdateDB — всё exit 0; 1cv8-регресс (create/load-cf/update) цел. Co-Authored-By: Claude Opus 4.8 (1M context) --- .claude/skills/db-create/SKILL.md | 4 +- .../skills/db-create/scripts/db-create.ps1 | 35 +++++++++++- .claude/skills/db-create/scripts/db-create.py | 29 +++++++++- .claude/skills/db-dump-cf/SKILL.md | 4 +- .../skills/db-dump-cf/scripts/db-dump-cf.ps1 | 34 ++++++++++- .../skills/db-dump-cf/scripts/db-dump-cf.py | 30 +++++++++- .claude/skills/db-dump-xml/SKILL.md | 4 +- .../db-dump-xml/scripts/db-dump-xml.ps1 | 42 +++++++++++++- .../skills/db-dump-xml/scripts/db-dump-xml.py | 36 +++++++++++- .claude/skills/db-load-cf/SKILL.md | 4 +- .../skills/db-load-cf/scripts/db-load-cf.ps1 | 34 ++++++++++- .../skills/db-load-cf/scripts/db-load-cf.py | 30 +++++++++- .claude/skills/db-load-xml/SKILL.md | 4 +- .../db-load-xml/scripts/db-load-xml.ps1 | 56 ++++++++++++++++++- .../skills/db-load-xml/scripts/db-load-xml.py | 53 +++++++++++++++++- .claude/skills/db-update/SKILL.md | 4 +- .../skills/db-update/scripts/db-update.ps1 | 35 +++++++++++- .claude/skills/db-update/scripts/db-update.py | 34 ++++++++++- 18 files changed, 442 insertions(+), 30 deletions(-) diff --git a/.claude/skills/db-create/SKILL.md b/.claude/skills/db-create/SKILL.md index f7678fb8..1667d9fd 100644 --- a/.claude/skills/db-create/SKILL.md +++ b/.claude/skills/db-create/SKILL.md @@ -38,7 +38,7 @@ powershell.exe -NoProfile -File "${CLAUDE_SKILL_DIR}/scripts/db-create.ps1" <п | Параметр | Обязательный | Описание | |----------|:------------:|----------| -| `-V8Path <путь>` | нет | Каталог bin платформы (или полный путь к 1cv8.exe) | +| `-V8Path <путь>` | нет | Каталог bin платформы, или полный путь к `1cv8.exe` / `ibcmd.exe` | | `-InfoBasePath <путь>` | * | Путь к файловой базе | | `-InfoBaseServer <сервер>` | * | Сервер 1С (для серверной базы) | | `-InfoBaseRef <имя>` | * | Имя базы на сервере | @@ -47,6 +47,8 @@ powershell.exe -NoProfile -File "${CLAUDE_SKILL_DIR}/scripts/db-create.ps1" <п | `-ListName <имя>` | нет | Имя базы в списке | > `*` — нужен либо `-InfoBasePath`, либо пара `-InfoBaseServer` + `-InfoBaseRef` +> +> Если `-V8Path` указывает на `ibcmd.exe` — операция идёт через автономный сервер (быстрее, без запуска платформы); поддерживаются **только файловые базы** (`-InfoBasePath`). ## После создания diff --git a/.claude/skills/db-create/scripts/db-create.ps1 b/.claude/skills/db-create/scripts/db-create.ps1 index 6d846d92..7078ab4f 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.1 — Create 1C information base +# db-create v1.2 — Create 1C information base # Source: https://github.com/Nikolay-Shirokov/cc-1c-skills <# .SYNOPSIS @@ -109,8 +109,16 @@ if (-not (Test-Path $V8Path)) { exit 1 } +# --- Detect engine (ibcmd vs 1cv8) by exe name --- +$engine = if ((Split-Path $V8Path -Leaf) -match '^ibcmd') { "ibcmd" } else { "1cv8" } + # --- Validate connection --- -if (-not $InfoBasePath -and (-not $InfoBaseServer -or -not $InfoBaseRef)) { +if ($engine -eq "ibcmd") { + if (-not $InfoBasePath) { + Write-Host "Error: ibcmd supports file infobases only (use -InfoBasePath)" -ForegroundColor Red + exit 1 + } +} elseif (-not $InfoBasePath -and (-not $InfoBaseServer -or -not $InfoBaseRef)) { Write-Host "Error: specify -InfoBasePath or -InfoBaseServer + -InfoBaseRef" -ForegroundColor Red exit 1 } @@ -126,6 +134,29 @@ $tempDir = Join-Path $env:TEMP "db_create_$(Get-Random)" New-Item -ItemType Directory -Path $tempDir -Force | Out-Null try { + if ($engine -eq "ibcmd") { + # --- ibcmd branch (file infobase only) --- + $arguments = @("infobase", "create", "--db-path=$InfoBasePath", "--create-database") + if ($UseTemplate) { + if ([System.IO.Path]::GetExtension($UseTemplate) -ieq ".dt") { + $arguments += "--restore=$UseTemplate" + } else { + $arguments += "--load=$UseTemplate", "--apply" + } + } + Write-Host "Running: ibcmd $($arguments -join ' ')" + $output = & $V8Path @arguments 2>&1 + $exitCode = $LASTEXITCODE + if ($exitCode -eq 0) { + Write-Host "Information base created successfully: $InfoBasePath" -ForegroundColor Green + } else { + Write-Host "Error creating information base (code: $exitCode)" -ForegroundColor Red + } + if ($output) { Write-Host ($output | Out-String) } + exit $exitCode + } + + # --- 1cv8 branch --- # --- Build arguments --- $arguments = @("CREATEINFOBASE") diff --git a/.claude/skills/db-create/scripts/db-create.py b/.claude/skills/db-create/scripts/db-create.py index 8424eb28..c2257157 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.1 — Create 1C information base +# db-create v1.2 — Create 1C information base # Source: https://github.com/Nikolay-Shirokov/cc-1c-skills import argparse @@ -82,9 +82,14 @@ def main(): args = parser.parse_args() v8path = resolve_v8path(args.V8Path) + engine = "ibcmd" if os.path.basename(v8path).lower().startswith("ibcmd") else "1cv8" # --- Validate connection --- - if not args.InfoBasePath and (not args.InfoBaseServer or not args.InfoBaseRef): + if engine == "ibcmd": + if not args.InfoBasePath: + print("Error: ibcmd supports file infobases only (use -InfoBasePath)", file=sys.stderr) + sys.exit(1) + elif not args.InfoBasePath and (not args.InfoBaseServer or not args.InfoBaseRef): print("Error: specify -InfoBasePath or -InfoBaseServer + -InfoBaseRef", file=sys.stderr) sys.exit(1) @@ -93,6 +98,26 @@ def main(): print(f"Error: template file not found: {args.UseTemplate}", file=sys.stderr) sys.exit(1) + # --- ibcmd branch (file infobase only) --- + if engine == "ibcmd": + arguments = ["infobase", "create", f"--db-path={args.InfoBasePath}", "--create-database"] + if args.UseTemplate: + if os.path.splitext(args.UseTemplate)[1].lower() == ".dt": + arguments.append(f"--restore={args.UseTemplate}") + else: + arguments.extend([f"--load={args.UseTemplate}", "--apply"]) + print(f"Running: ibcmd {' '.join(arguments)}") + result = subprocess.run([v8path] + arguments, capture_output=True, encoding="utf-8", errors="replace") + if result.returncode == 0: + print(f"Information base created successfully: {args.InfoBasePath}") + else: + print(f"Error creating information base (code: {result.returncode})", file=sys.stderr) + if result.stdout: + print(result.stdout) + if result.stderr: + print(result.stderr, file=sys.stderr) + sys.exit(result.returncode) + # --- Temp dir --- temp_dir = os.path.join(tempfile.gettempdir(), f"db_create_{random.randint(0, 999999)}") os.makedirs(temp_dir, exist_ok=True) diff --git a/.claude/skills/db-dump-cf/SKILL.md b/.claude/skills/db-dump-cf/SKILL.md index 84e3677a..60f853fe 100644 --- a/.claude/skills/db-dump-cf/SKILL.md +++ b/.claude/skills/db-dump-cf/SKILL.md @@ -42,7 +42,7 @@ powershell.exe -NoProfile -File "${CLAUDE_SKILL_DIR}/scripts/db-dump-cf.ps1" <п | Параметр | Обязательный | Описание | |----------|:------------:|----------| -| `-V8Path <путь>` | нет | Каталог bin платформы (или полный путь к 1cv8.exe) | +| `-V8Path <путь>` | нет | Каталог bin платформы, или полный путь к `1cv8.exe` / `ibcmd.exe` | | `-InfoBasePath <путь>` | * | Файловая база | | `-InfoBaseServer <сервер>` | * | Сервер 1С (для серверной базы) | | `-InfoBaseRef <имя>` | * | Имя базы на сервере | @@ -53,6 +53,8 @@ powershell.exe -NoProfile -File "${CLAUDE_SKILL_DIR}/scripts/db-dump-cf.ps1" <п | `-AllExtensions` | нет | Выгрузить все расширения | > `*` — нужен либо `-InfoBasePath`, либо пара `-InfoBaseServer` + `-InfoBaseRef` +> +> Если `-V8Path` указывает на `ibcmd.exe` — операция идёт через автономный сервер (быстрее, без запуска платформы); поддерживаются **только файловые базы** (`-InfoBasePath`). ## Примеры diff --git a/.claude/skills/db-dump-cf/scripts/db-dump-cf.ps1 b/.claude/skills/db-dump-cf/scripts/db-dump-cf.ps1 index 23ac9f41..f9e13e8d 100644 --- a/.claude/skills/db-dump-cf/scripts/db-dump-cf.ps1 +++ b/.claude/skills/db-dump-cf/scripts/db-dump-cf.ps1 @@ -1,4 +1,4 @@ -# db-dump-cf v1.1 — Dump 1C configuration to CF file +# db-dump-cf v1.2 — Dump 1C configuration to CF file # Source: https://github.com/Nikolay-Shirokov/cc-1c-skills <# .SYNOPSIS @@ -118,8 +118,16 @@ if (-not (Test-Path $V8Path)) { exit 1 } +# --- Detect engine (ibcmd vs 1cv8) by exe name --- +$engine = if ((Split-Path $V8Path -Leaf) -match '^ibcmd') { "ibcmd" } else { "1cv8" } + # --- Validate connection --- -if (-not $InfoBasePath -and (-not $InfoBaseServer -or -not $InfoBaseRef)) { +if ($engine -eq "ibcmd") { + if (-not $InfoBasePath) { + Write-Host "Error: ibcmd supports file infobases only (use -InfoBasePath)" -ForegroundColor Red + exit 1 + } +} elseif (-not $InfoBasePath -and (-not $InfoBaseServer -or -not $InfoBaseRef)) { Write-Host "Error: specify -InfoBasePath or -InfoBaseServer + -InfoBaseRef" -ForegroundColor Red exit 1 } @@ -135,6 +143,28 @@ $tempDir = Join-Path $env:TEMP "db_dump_cf_$(Get-Random)" New-Item -ItemType Directory -Path $tempDir -Force | Out-Null try { + if ($engine -eq "ibcmd") { + # --- ibcmd branch (file infobase only) --- + if ($AllExtensions) { + Write-Host "Error: ibcmd config save does not support -AllExtensions (use -Extension)" -ForegroundColor Red + exit 1 + } + $arguments = @("infobase", "config", "save", "--db-path=$InfoBasePath") + if ($Extension) { $arguments += "--extension=$Extension" } + $arguments += "$OutputFile" + Write-Host "Running: ibcmd $($arguments -join ' ')" + $output = & $V8Path @arguments 2>&1 + $exitCode = $LASTEXITCODE + if ($exitCode -eq 0) { + Write-Host "Configuration dumped successfully to: $OutputFile" -ForegroundColor Green + } else { + Write-Host "Error dumping configuration (code: $exitCode)" -ForegroundColor Red + } + if ($output) { Write-Host ($output | Out-String) } + exit $exitCode + } + + # --- 1cv8 branch --- # --- Build arguments --- $arguments = @("DESIGNER") diff --git a/.claude/skills/db-dump-cf/scripts/db-dump-cf.py b/.claude/skills/db-dump-cf/scripts/db-dump-cf.py index 5668e614..67ebc320 100644 --- a/.claude/skills/db-dump-cf/scripts/db-dump-cf.py +++ b/.claude/skills/db-dump-cf/scripts/db-dump-cf.py @@ -1,5 +1,5 @@ #!/usr/bin/env python3 -# db-dump-cf v1.1 — Dump 1C configuration to CF file +# db-dump-cf v1.2 — Dump 1C configuration to CF file # Source: https://github.com/Nikolay-Shirokov/cc-1c-skills import argparse @@ -84,9 +84,14 @@ def main(): args = parser.parse_args() v8path = resolve_v8path(args.V8Path) + engine = "ibcmd" if os.path.basename(v8path).lower().startswith("ibcmd") else "1cv8" # --- Validate connection --- - if not args.InfoBasePath and (not args.InfoBaseServer or not args.InfoBaseRef): + if engine == "ibcmd": + if not args.InfoBasePath: + print("Error: ibcmd supports file infobases only (use -InfoBasePath)", file=sys.stderr) + sys.exit(1) + elif not args.InfoBasePath and (not args.InfoBaseServer or not args.InfoBaseRef): print("Error: specify -InfoBasePath or -InfoBaseServer + -InfoBaseRef", file=sys.stderr) sys.exit(1) @@ -95,6 +100,27 @@ def main(): if out_dir and not os.path.isdir(out_dir): os.makedirs(out_dir, exist_ok=True) + # --- ibcmd branch (file infobase only) --- + if engine == "ibcmd": + if args.AllExtensions: + print("Error: ibcmd config save does not support -AllExtensions (use -Extension)", file=sys.stderr) + sys.exit(1) + arguments = ["infobase", "config", "save", f"--db-path={args.InfoBasePath}"] + if args.Extension: + arguments.append(f"--extension={args.Extension}") + arguments.append(args.OutputFile) + print(f"Running: ibcmd {' '.join(arguments)}") + result = subprocess.run([v8path] + arguments, capture_output=True, encoding="utf-8", errors="replace") + if result.returncode == 0: + print(f"Configuration dumped successfully to: {args.OutputFile}") + else: + print(f"Error dumping configuration (code: {result.returncode})", file=sys.stderr) + if result.stdout: + print(result.stdout) + if result.stderr: + print(result.stderr, file=sys.stderr) + sys.exit(result.returncode) + # --- Temp dir --- temp_dir = os.path.join(tempfile.gettempdir(), f"db_dump_cf_{random.randint(0, 999999)}") os.makedirs(temp_dir, exist_ok=True) diff --git a/.claude/skills/db-dump-xml/SKILL.md b/.claude/skills/db-dump-xml/SKILL.md index 12d44d2a..3199f5fa 100644 --- a/.claude/skills/db-dump-xml/SKILL.md +++ b/.claude/skills/db-dump-xml/SKILL.md @@ -44,7 +44,7 @@ powershell.exe -NoProfile -File "${CLAUDE_SKILL_DIR}/scripts/db-dump-xml.ps1" < | Параметр | Обязательный | Описание | |----------|:------------:|----------| -| `-V8Path <путь>` | нет | Каталог bin платформы (или полный путь к 1cv8.exe) | +| `-V8Path <путь>` | нет | Каталог bin платформы, или полный путь к `1cv8.exe` / `ibcmd.exe` | | `-InfoBasePath <путь>` | * | Файловая база | | `-InfoBaseServer <сервер>` | * | Сервер 1С (для серверной базы) | | `-InfoBaseRef <имя>` | * | Имя базы на сервере | @@ -58,6 +58,8 @@ powershell.exe -NoProfile -File "${CLAUDE_SKILL_DIR}/scripts/db-dump-xml.ps1" < | `-Format <формат>` | нет | `Hierarchical` (по умолч.) / `Plain` | > `*` — нужен либо `-InfoBasePath`, либо пара `-InfoBaseServer` + `-InfoBaseRef` +> +> Если `-V8Path` указывает на `ibcmd.exe` — операция идёт через автономный сервер (быстрее, без запуска платформы); поддерживаются **только файловые базы** (`-InfoBasePath`). ### Режимы выгрузки diff --git a/.claude/skills/db-dump-xml/scripts/db-dump-xml.ps1 b/.claude/skills/db-dump-xml/scripts/db-dump-xml.ps1 index ffc472d5..c6702713 100644 --- a/.claude/skills/db-dump-xml/scripts/db-dump-xml.ps1 +++ b/.claude/skills/db-dump-xml/scripts/db-dump-xml.ps1 @@ -1,4 +1,4 @@ -# db-dump-xml v1.1 — Dump 1C configuration to XML files +# db-dump-xml v1.2 — Dump 1C configuration to XML files # Source: https://github.com/Nikolay-Shirokov/cc-1c-skills <# .SYNOPSIS @@ -141,8 +141,16 @@ if (-not (Test-Path $V8Path)) { exit 1 } +# --- Detect engine (ibcmd vs 1cv8) by exe name --- +$engine = if ((Split-Path $V8Path -Leaf) -match '^ibcmd') { "ibcmd" } else { "1cv8" } + # --- Validate connection --- -if (-not $InfoBasePath -and (-not $InfoBaseServer -or -not $InfoBaseRef)) { +if ($engine -eq "ibcmd") { + if (-not $InfoBasePath) { + Write-Host "Error: ibcmd supports file infobases only (use -InfoBasePath)" -ForegroundColor Red + exit 1 + } +} elseif (-not $InfoBasePath -and (-not $InfoBaseServer -or -not $InfoBaseRef)) { Write-Host "Error: specify -InfoBasePath or -InfoBaseServer + -InfoBaseRef" -ForegroundColor Red exit 1 } @@ -164,6 +172,36 @@ $tempDir = Join-Path $env:TEMP "db_dump_xml_$(Get-Random)" New-Item -ItemType Directory -Path $tempDir -Force | Out-Null try { + if ($engine -eq "ibcmd") { + # --- ibcmd branch (file infobase only; hierarchical Full/Changes) --- + if ($Format -eq "Plain") { + Write-Host "Error: ibcmd config export supports hierarchical format only (use -Format Hierarchical or 1cv8)" -ForegroundColor Red + exit 1 + } + if ($AllExtensions) { + Write-Host "Error: ibcmd config export does not support -AllExtensions (use -Extension or 1cv8)" -ForegroundColor Red + exit 1 + } + if ($Mode -eq "Partial" -or $Mode -eq "UpdateInfo") { + Write-Host "Error: ibcmd config export supports Mode Full/Changes only; use 1cv8 for $Mode" -ForegroundColor Red + exit 1 + } + $arguments = @("infobase", "config", "export", "--db-path=$InfoBasePath") + if ($Extension) { $arguments += "--extension=$Extension" } + $arguments += "$ConfigDir" + Write-Host "Running: ibcmd $($arguments -join ' ')" + $output = & $V8Path @arguments 2>&1 + $exitCode = $LASTEXITCODE + if ($exitCode -eq 0) { + Write-Host "Configuration exported successfully to: $ConfigDir" -ForegroundColor Green + } else { + Write-Host "Error exporting configuration (code: $exitCode)" -ForegroundColor Red + } + if ($output) { Write-Host ($output | Out-String) } + exit $exitCode + } + + # --- 1cv8 branch --- # --- Build arguments --- $arguments = @("DESIGNER") diff --git a/.claude/skills/db-dump-xml/scripts/db-dump-xml.py b/.claude/skills/db-dump-xml/scripts/db-dump-xml.py index c8de84a5..cbb21d8d 100644 --- a/.claude/skills/db-dump-xml/scripts/db-dump-xml.py +++ b/.claude/skills/db-dump-xml/scripts/db-dump-xml.py @@ -1,5 +1,5 @@ #!/usr/bin/env python3 -# db-dump-xml v1.1 — Dump 1C configuration to XML files +# db-dump-xml v1.2 — Dump 1C configuration to XML files # Source: https://github.com/Nikolay-Shirokov/cc-1c-skills import argparse @@ -98,9 +98,14 @@ def main(): # --- Resolve V8Path --- v8path = resolve_v8path(args.V8Path) + engine = "ibcmd" if os.path.basename(v8path).lower().startswith("ibcmd") else "1cv8" # --- Validate connection --- - if not args.InfoBasePath and (not args.InfoBaseServer or not args.InfoBaseRef): + if engine == "ibcmd": + if not args.InfoBasePath: + print("Error: ibcmd supports file infobases only (use -InfoBasePath)", file=sys.stderr) + sys.exit(1) + elif not args.InfoBasePath and (not args.InfoBaseServer or not args.InfoBaseRef): print("Error: specify -InfoBasePath or -InfoBaseServer + -InfoBaseRef", file=sys.stderr) sys.exit(1) @@ -114,6 +119,33 @@ def main(): os.makedirs(args.ConfigDir, exist_ok=True) print(f"Created output directory: {args.ConfigDir}") + # --- ibcmd branch (file infobase only; hierarchical Full/Changes) --- + if engine == "ibcmd": + if args.Format == "Plain": + print("Error: ibcmd config export supports hierarchical format only (use -Format Hierarchical or 1cv8)", file=sys.stderr) + sys.exit(1) + if args.AllExtensions: + print("Error: ibcmd config export does not support -AllExtensions (use -Extension or 1cv8)", file=sys.stderr) + sys.exit(1) + if args.Mode in ("Partial", "UpdateInfo"): + print(f"Error: ibcmd config export supports Mode Full/Changes only; use 1cv8 for {args.Mode}", file=sys.stderr) + sys.exit(1) + arguments = ["infobase", "config", "export", f"--db-path={args.InfoBasePath}"] + if args.Extension: + arguments.append(f"--extension={args.Extension}") + arguments.append(args.ConfigDir) + print(f"Running: ibcmd {' '.join(arguments)}") + result = subprocess.run([v8path] + arguments, capture_output=True, encoding="utf-8", errors="replace") + if result.returncode == 0: + print(f"Configuration exported successfully to: {args.ConfigDir}") + else: + print(f"Error exporting configuration (code: {result.returncode})", file=sys.stderr) + if result.stdout: + print(result.stdout) + if result.stderr: + print(result.stderr, file=sys.stderr) + sys.exit(result.returncode) + # --- Temp dir --- temp_dir = os.path.join(tempfile.gettempdir(), f"db_dump_xml_{random.randint(0, 999999)}") os.makedirs(temp_dir, exist_ok=True) diff --git a/.claude/skills/db-load-cf/SKILL.md b/.claude/skills/db-load-cf/SKILL.md index ef9c7d48..53d056e2 100644 --- a/.claude/skills/db-load-cf/SKILL.md +++ b/.claude/skills/db-load-cf/SKILL.md @@ -43,7 +43,7 @@ powershell.exe -NoProfile -File "${CLAUDE_SKILL_DIR}/scripts/db-load-cf.ps1" <п | Параметр | Обязательный | Описание | |----------|:------------:|----------| -| `-V8Path <путь>` | нет | Каталог bin платформы (или полный путь к 1cv8.exe) | +| `-V8Path <путь>` | нет | Каталог bin платформы, или полный путь к `1cv8.exe` / `ibcmd.exe` | | `-InfoBasePath <путь>` | * | Файловая база | | `-InfoBaseServer <сервер>` | * | Сервер 1С (для серверной базы) | | `-InfoBaseRef <имя>` | * | Имя базы на сервере | @@ -54,6 +54,8 @@ powershell.exe -NoProfile -File "${CLAUDE_SKILL_DIR}/scripts/db-load-cf.ps1" <п | `-AllExtensions` | нет | Загрузить все расширения из архива | > `*` — нужен либо `-InfoBasePath`, либо пара `-InfoBaseServer` + `-InfoBaseRef` +> +> Если `-V8Path` указывает на `ibcmd.exe` — операция идёт через автономный сервер (быстрее, без запуска платформы); поддерживаются **только файловые базы** (`-InfoBasePath`). ## После выполнения diff --git a/.claude/skills/db-load-cf/scripts/db-load-cf.ps1 b/.claude/skills/db-load-cf/scripts/db-load-cf.ps1 index 5766214a..08398684 100644 --- a/.claude/skills/db-load-cf/scripts/db-load-cf.ps1 +++ b/.claude/skills/db-load-cf/scripts/db-load-cf.ps1 @@ -1,4 +1,4 @@ -# db-load-cf v1.1 — Load 1C configuration from CF file +# db-load-cf v1.2 — Load 1C configuration from CF file # Source: https://github.com/Nikolay-Shirokov/cc-1c-skills <# .SYNOPSIS @@ -118,8 +118,16 @@ if (-not (Test-Path $V8Path)) { exit 1 } +# --- Detect engine (ibcmd vs 1cv8) by exe name --- +$engine = if ((Split-Path $V8Path -Leaf) -match '^ibcmd') { "ibcmd" } else { "1cv8" } + # --- Validate connection --- -if (-not $InfoBasePath -and (-not $InfoBaseServer -or -not $InfoBaseRef)) { +if ($engine -eq "ibcmd") { + if (-not $InfoBasePath) { + Write-Host "Error: ibcmd supports file infobases only (use -InfoBasePath)" -ForegroundColor Red + exit 1 + } +} elseif (-not $InfoBasePath -and (-not $InfoBaseServer -or -not $InfoBaseRef)) { Write-Host "Error: specify -InfoBasePath or -InfoBaseServer + -InfoBaseRef" -ForegroundColor Red exit 1 } @@ -135,6 +143,28 @@ $tempDir = Join-Path $env:TEMP "db_load_cf_$(Get-Random)" New-Item -ItemType Directory -Path $tempDir -Force | Out-Null try { + if ($engine -eq "ibcmd") { + # --- ibcmd branch (file infobase only) --- + if ($AllExtensions) { + Write-Host "Error: ibcmd config load does not support -AllExtensions (use -Extension)" -ForegroundColor Red + exit 1 + } + $arguments = @("infobase", "config", "load", "--db-path=$InfoBasePath") + if ($Extension) { $arguments += "--extension=$Extension" } + $arguments += "$InputFile" + Write-Host "Running: ibcmd $($arguments -join ' ')" + $output = & $V8Path @arguments 2>&1 + $exitCode = $LASTEXITCODE + if ($exitCode -eq 0) { + Write-Host "Configuration loaded successfully from: $InputFile" -ForegroundColor Green + } else { + Write-Host "Error loading configuration (code: $exitCode)" -ForegroundColor Red + } + if ($output) { Write-Host ($output | Out-String) } + exit $exitCode + } + + # --- 1cv8 branch --- # --- Build arguments --- $arguments = @("DESIGNER") diff --git a/.claude/skills/db-load-cf/scripts/db-load-cf.py b/.claude/skills/db-load-cf/scripts/db-load-cf.py index e00a7c8d..003d26b4 100644 --- a/.claude/skills/db-load-cf/scripts/db-load-cf.py +++ b/.claude/skills/db-load-cf/scripts/db-load-cf.py @@ -1,5 +1,5 @@ #!/usr/bin/env python3 -# db-load-cf v1.1 — Load 1C configuration from CF file +# db-load-cf v1.2 — Load 1C configuration from CF file # Source: https://github.com/Nikolay-Shirokov/cc-1c-skills import argparse @@ -84,9 +84,14 @@ def main(): args = parser.parse_args() v8path = resolve_v8path(args.V8Path) + engine = "ibcmd" if os.path.basename(v8path).lower().startswith("ibcmd") else "1cv8" # --- Validate connection --- - if not args.InfoBasePath and (not args.InfoBaseServer or not args.InfoBaseRef): + if engine == "ibcmd": + if not args.InfoBasePath: + print("Error: ibcmd supports file infobases only (use -InfoBasePath)", file=sys.stderr) + sys.exit(1) + elif not args.InfoBasePath and (not args.InfoBaseServer or not args.InfoBaseRef): print("Error: specify -InfoBasePath or -InfoBaseServer + -InfoBaseRef", file=sys.stderr) sys.exit(1) @@ -95,6 +100,27 @@ def main(): print(f"Error: input file not found: {args.InputFile}", file=sys.stderr) sys.exit(1) + # --- ibcmd branch (file infobase only) --- + if engine == "ibcmd": + if args.AllExtensions: + print("Error: ibcmd config load does not support -AllExtensions (use -Extension)", file=sys.stderr) + sys.exit(1) + arguments = ["infobase", "config", "load", f"--db-path={args.InfoBasePath}"] + if args.Extension: + arguments.append(f"--extension={args.Extension}") + arguments.append(args.InputFile) + print(f"Running: ibcmd {' '.join(arguments)}") + result = subprocess.run([v8path] + arguments, capture_output=True, encoding="utf-8", errors="replace") + if result.returncode == 0: + print(f"Configuration loaded successfully from: {args.InputFile}") + else: + print(f"Error loading configuration (code: {result.returncode})", file=sys.stderr) + if result.stdout: + print(result.stdout) + if result.stderr: + print(result.stderr, file=sys.stderr) + sys.exit(result.returncode) + # --- Temp dir --- temp_dir = os.path.join(tempfile.gettempdir(), f"db_load_cf_{random.randint(0, 999999)}") os.makedirs(temp_dir, exist_ok=True) diff --git a/.claude/skills/db-load-xml/SKILL.md b/.claude/skills/db-load-xml/SKILL.md index 0d4e721b..ef054f2c 100644 --- a/.claude/skills/db-load-xml/SKILL.md +++ b/.claude/skills/db-load-xml/SKILL.md @@ -45,7 +45,7 @@ powershell.exe -NoProfile -File "${CLAUDE_SKILL_DIR}/scripts/db-load-xml.ps1" < | Параметр | Обязательный | Описание | |----------|:------------:|----------| -| `-V8Path <путь>` | нет | Каталог bin платформы (или полный путь к 1cv8.exe) | +| `-V8Path <путь>` | нет | Каталог bin платформы, или полный путь к `1cv8.exe` / `ibcmd.exe` | | `-InfoBasePath <путь>` | * | Файловая база | | `-InfoBaseServer <сервер>` | * | Сервер 1С (для серверной базы) | | `-InfoBaseRef <имя>` | * | Имя базы на сервере | @@ -61,6 +61,8 @@ powershell.exe -NoProfile -File "${CLAUDE_SKILL_DIR}/scripts/db-load-xml.ps1" < | `-UpdateDB` | нет | После загрузки сразу обновить конфигурацию БД (`/UpdateDBCfg`) | > `*` — нужен либо `-InfoBasePath`, либо пара `-InfoBaseServer` + `-InfoBaseRef` +> +> Если `-V8Path` указывает на `ibcmd.exe` — операция идёт через автономный сервер (быстрее, без запуска платформы); поддерживаются **только файловые базы** (`-InfoBasePath`). ### Режимы загрузки diff --git a/.claude/skills/db-load-xml/scripts/db-load-xml.ps1 b/.claude/skills/db-load-xml/scripts/db-load-xml.ps1 index c79945f2..ad7807de 100644 --- a/.claude/skills/db-load-xml/scripts/db-load-xml.ps1 +++ b/.claude/skills/db-load-xml/scripts/db-load-xml.ps1 @@ -1,4 +1,4 @@ -# db-load-xml v1.5 — Load 1C configuration from XML files +# db-load-xml v1.6 — Load 1C configuration from XML files # Source: https://github.com/Nikolay-Shirokov/cc-1c-skills <# .SYNOPSIS @@ -150,8 +150,16 @@ if (-not (Test-Path $V8Path)) { exit 1 } +# --- Detect engine (ibcmd vs 1cv8) by exe name --- +$engine = if ((Split-Path $V8Path -Leaf) -match '^ibcmd') { "ibcmd" } else { "1cv8" } + # --- Validate connection --- -if (-not $InfoBasePath -and (-not $InfoBaseServer -or -not $InfoBaseRef)) { +if ($engine -eq "ibcmd") { + if (-not $InfoBasePath) { + Write-Host "Error: ibcmd supports file infobases only (use -InfoBasePath)" -ForegroundColor Red + exit 1 + } +} elseif (-not $InfoBasePath -and (-not $InfoBaseServer -or -not $InfoBaseRef)) { Write-Host "Error: specify -InfoBasePath or -InfoBaseServer + -InfoBaseRef" -ForegroundColor Red exit 1 } @@ -173,6 +181,50 @@ $tempDir = Join-Path $env:TEMP "db_load_xml_$(Get-Random)" New-Item -ItemType Directory -Path $tempDir -Force | Out-Null try { + if ($engine -eq "ibcmd") { + # --- ibcmd branch (file infobase only; hierarchical full-directory import) --- + if ($Format -eq "Plain") { + Write-Host "Error: ibcmd config import supports hierarchical format only (use -Format Hierarchical or 1cv8)" -ForegroundColor Red + exit 1 + } + if ($AllExtensions) { + Write-Host "Error: ibcmd config import does not support -AllExtensions (use -Extension or 1cv8)" -ForegroundColor Red + exit 1 + } + if ($Mode -eq "Partial" -or $Files -or $ListFile) { + Write-Host "Error: ibcmd config import supports full-directory import only; use 1cv8 for partial/file lists" -ForegroundColor Red + exit 1 + } + $arguments = @("infobase", "config", "import", "--db-path=$InfoBasePath") + if ($Extension) { $arguments += "--extension=$Extension" } + $arguments += "$ConfigDir" + Write-Host "Running: ibcmd $($arguments -join ' ')" + $output = & $V8Path @arguments 2>&1 + $exitCode = $LASTEXITCODE + if ($exitCode -ne 0) { + Write-Host "Error loading configuration from files (code: $exitCode)" -ForegroundColor Red + if ($output) { Write-Host ($output | Out-String) } + exit $exitCode + } + Write-Host "Configuration loaded successfully from: $ConfigDir" -ForegroundColor Green + if ($output) { Write-Host ($output | Out-String) } + + if ($UpdateDB) { + $applyArgs = @("infobase", "config", "apply", "--db-path=$InfoBasePath", "--force") + Write-Host "Running: ibcmd $($applyArgs -join ' ')" + $applyOut = & $V8Path @applyArgs 2>&1 + $exitCode = $LASTEXITCODE + if ($exitCode -eq 0) { + Write-Host "Database configuration updated successfully" -ForegroundColor Green + } else { + Write-Host "Error updating database configuration (code: $exitCode)" -ForegroundColor Red + } + if ($applyOut) { Write-Host ($applyOut | Out-String) } + } + exit $exitCode + } + + # --- 1cv8 branch --- # --- Build arguments --- $arguments = @("DESIGNER") diff --git a/.claude/skills/db-load-xml/scripts/db-load-xml.py b/.claude/skills/db-load-xml/scripts/db-load-xml.py index dca6a724..ef9b7b9b 100644 --- a/.claude/skills/db-load-xml/scripts/db-load-xml.py +++ b/.claude/skills/db-load-xml/scripts/db-load-xml.py @@ -1,5 +1,5 @@ #!/usr/bin/env python3 -# db-load-xml v1.5 — Load 1C configuration from XML files +# db-load-xml v1.6 — Load 1C configuration from XML files # Source: https://github.com/Nikolay-Shirokov/cc-1c-skills import argparse @@ -106,8 +106,14 @@ def main(): # --- Resolve V8Path --- v8path = resolve_v8path(args.V8Path) + engine = "ibcmd" if os.path.basename(v8path).lower().startswith("ibcmd") else "1cv8" + # --- Validate connection --- - if not args.InfoBasePath and (not args.InfoBaseServer or not args.InfoBaseRef): + if engine == "ibcmd": + if not args.InfoBasePath: + print("Error: ibcmd supports file infobases only (use -InfoBasePath)", file=sys.stderr) + sys.exit(1) + elif not args.InfoBasePath and (not args.InfoBaseServer or not args.InfoBaseRef): print("Error: specify -InfoBasePath or -InfoBaseServer + -InfoBaseRef", file=sys.stderr) sys.exit(1) @@ -121,6 +127,49 @@ def main(): print("Error: -Files or -ListFile required for Partial mode", file=sys.stderr) sys.exit(1) + # --- ibcmd branch (file infobase only; hierarchical full-directory import) --- + if engine == "ibcmd": + if args.Format == "Plain": + print("Error: ibcmd config import supports hierarchical format only (use -Format Hierarchical or 1cv8)", file=sys.stderr) + sys.exit(1) + if args.AllExtensions: + print("Error: ibcmd config import does not support -AllExtensions (use -Extension or 1cv8)", file=sys.stderr) + sys.exit(1) + if args.Mode == "Partial" or args.Files or args.ListFile: + print("Error: ibcmd config import supports full-directory import only; use 1cv8 for partial/file lists", file=sys.stderr) + sys.exit(1) + arguments = ["infobase", "config", "import", f"--db-path={args.InfoBasePath}"] + if args.Extension: + arguments.append(f"--extension={args.Extension}") + arguments.append(args.ConfigDir) + print(f"Running: ibcmd {' '.join(arguments)}") + result = subprocess.run([v8path] + arguments, capture_output=True, encoding="utf-8", errors="replace") + if result.returncode != 0: + print(f"Error loading configuration from files (code: {result.returncode})", file=sys.stderr) + if result.stdout: + print(result.stdout) + if result.stderr: + print(result.stderr, file=sys.stderr) + sys.exit(result.returncode) + print(f"Configuration loaded successfully from: {args.ConfigDir}") + if result.stdout: + print(result.stdout) + exit_code = 0 + if args.UpdateDB: + apply_args = ["infobase", "config", "apply", f"--db-path={args.InfoBasePath}", "--force"] + print(f"Running: ibcmd {' '.join(apply_args)}") + ar = subprocess.run([v8path] + apply_args, capture_output=True, encoding="utf-8", errors="replace") + exit_code = ar.returncode + if exit_code == 0: + print("Database configuration updated successfully") + else: + print(f"Error updating database configuration (code: {exit_code})", file=sys.stderr) + if ar.stdout: + print(ar.stdout) + if ar.stderr: + print(ar.stderr, file=sys.stderr) + sys.exit(exit_code) + # --- Temp dir --- temp_dir = os.path.join(tempfile.gettempdir(), f"db_load_xml_{random.randint(0, 999999)}") os.makedirs(temp_dir, exist_ok=True) diff --git a/.claude/skills/db-update/SKILL.md b/.claude/skills/db-update/SKILL.md index 96c88624..4a874ef7 100644 --- a/.claude/skills/db-update/SKILL.md +++ b/.claude/skills/db-update/SKILL.md @@ -42,7 +42,7 @@ powershell.exe -NoProfile -File "${CLAUDE_SKILL_DIR}/scripts/db-update.ps1" <п | Параметр | Обязательный | Описание | |----------|:------------:|----------| -| `-V8Path <путь>` | нет | Каталог bin платформы (или полный путь к 1cv8.exe) | +| `-V8Path <путь>` | нет | Каталог bin платформы, или полный путь к `1cv8.exe` / `ibcmd.exe` | | `-InfoBasePath <путь>` | * | Файловая база | | `-InfoBaseServer <сервер>` | * | Сервер 1С (для серверной базы) | | `-InfoBaseRef <имя>` | * | Имя базы на сервере | @@ -55,6 +55,8 @@ powershell.exe -NoProfile -File "${CLAUDE_SKILL_DIR}/scripts/db-update.ps1" <п | `-WarningsAsErrors` | нет | Предупреждения считать ошибками | > `*` — нужен либо `-InfoBasePath`, либо пара `-InfoBaseServer` + `-InfoBaseRef` +> +> Если `-V8Path` указывает на `ibcmd.exe` — операция идёт через автономный сервер (быстрее, без запуска платформы); поддерживаются **только файловые базы** (`-InfoBasePath`). ### Фоновое обновление (серверная база) diff --git a/.claude/skills/db-update/scripts/db-update.ps1 b/.claude/skills/db-update/scripts/db-update.ps1 index 3279a33b..f95d9ced 100644 --- a/.claude/skills/db-update/scripts/db-update.ps1 +++ b/.claude/skills/db-update/scripts/db-update.ps1 @@ -1,4 +1,4 @@ -# db-update v1.1 — Update 1C database configuration +# db-update v1.2 — Update 1C database configuration # Source: https://github.com/Nikolay-Shirokov/cc-1c-skills <# .SYNOPSIS @@ -131,8 +131,16 @@ if (-not (Test-Path $V8Path)) { exit 1 } +# --- Detect engine (ibcmd vs 1cv8) by exe name --- +$engine = if ((Split-Path $V8Path -Leaf) -match '^ibcmd') { "ibcmd" } else { "1cv8" } + # --- Validate connection --- -if (-not $InfoBasePath -and (-not $InfoBaseServer -or -not $InfoBaseRef)) { +if ($engine -eq "ibcmd") { + if (-not $InfoBasePath) { + Write-Host "Error: ibcmd supports file infobases only (use -InfoBasePath)" -ForegroundColor Red + exit 1 + } +} elseif (-not $InfoBasePath -and (-not $InfoBaseServer -or -not $InfoBaseRef)) { Write-Host "Error: specify -InfoBasePath or -InfoBaseServer + -InfoBaseRef" -ForegroundColor Red exit 1 } @@ -142,6 +150,29 @@ $tempDir = Join-Path $env:TEMP "db_update_$(Get-Random)" New-Item -ItemType Directory -Path $tempDir -Force | Out-Null try { + if ($engine -eq "ibcmd") { + # --- ibcmd branch (file infobase only) --- + if ($AllExtensions) { + Write-Host "Error: ibcmd config apply does not support -AllExtensions (use -Extension)" -ForegroundColor Red + exit 1 + } + $arguments = @("infobase", "config", "apply", "--db-path=$InfoBasePath", "--force") + if ($Dynamic -eq "+") { $arguments += "--dynamic=auto" } + elseif ($Dynamic -eq "-") { $arguments += "--dynamic=disable" } + if ($Extension) { $arguments += "--extension=$Extension" } + Write-Host "Running: ibcmd $($arguments -join ' ')" + $output = & $V8Path @arguments 2>&1 + $exitCode = $LASTEXITCODE + if ($exitCode -eq 0) { + Write-Host "Database configuration updated successfully" -ForegroundColor Green + } else { + Write-Host "Error updating database configuration (code: $exitCode)" -ForegroundColor Red + } + if ($output) { Write-Host ($output | Out-String) } + exit $exitCode + } + + # --- 1cv8 branch --- # --- Build arguments --- $arguments = @("DESIGNER") diff --git a/.claude/skills/db-update/scripts/db-update.py b/.claude/skills/db-update/scripts/db-update.py index 3e66dad6..93918b31 100644 --- a/.claude/skills/db-update/scripts/db-update.py +++ b/.claude/skills/db-update/scripts/db-update.py @@ -1,5 +1,5 @@ #!/usr/bin/env python3 -# db-update v1.1 — Update 1C database configuration +# db-update v1.2 — Update 1C database configuration # Source: https://github.com/Nikolay-Shirokov/cc-1c-skills import argparse @@ -87,11 +87,41 @@ def main(): v8path = resolve_v8path(args.V8Path) + engine = "ibcmd" if os.path.basename(v8path).lower().startswith("ibcmd") else "1cv8" + # --- Validate connection --- - if not args.InfoBasePath and (not args.InfoBaseServer or not args.InfoBaseRef): + if engine == "ibcmd": + if not args.InfoBasePath: + print("Error: ibcmd supports file infobases only (use -InfoBasePath)", file=sys.stderr) + sys.exit(1) + elif not args.InfoBasePath and (not args.InfoBaseServer or not args.InfoBaseRef): print("Error: specify -InfoBasePath or -InfoBaseServer + -InfoBaseRef", file=sys.stderr) sys.exit(1) + # --- ibcmd branch (file infobase only) --- + if engine == "ibcmd": + if args.AllExtensions: + print("Error: ibcmd config apply does not support -AllExtensions (use -Extension)", file=sys.stderr) + sys.exit(1) + arguments = ["infobase", "config", "apply", f"--db-path={args.InfoBasePath}", "--force"] + if args.Dynamic == "+": + arguments.append("--dynamic=auto") + elif args.Dynamic == "-": + arguments.append("--dynamic=disable") + if args.Extension: + arguments.append(f"--extension={args.Extension}") + print(f"Running: ibcmd {' '.join(arguments)}") + result = subprocess.run([v8path] + arguments, capture_output=True, encoding="utf-8", errors="replace") + if result.returncode == 0: + print("Database configuration updated successfully") + else: + print(f"Error updating database configuration (code: {result.returncode})", file=sys.stderr) + if result.stdout: + print(result.stdout) + if result.stderr: + print(result.stderr, file=sys.stderr) + sys.exit(result.returncode) + # --- Temp dir --- temp_dir = os.path.join(tempfile.gettempdir(), f"db_update_{random.randint(0, 999999)}") os.makedirs(temp_dir, exist_ok=True)