mirror of
https://github.com/Nikolay-Shirokov/cc-1c-skills.git
synced 2026-07-26 14:41:02 +03:00
feat(db): тиражирование ibcmd на create/cf/update/xml (по имени exe в -V8Path)
Распространение пилота 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) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.8
parent
11bab7669d
commit
4102b7005a
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user