feat(epf-build): auto-create stub database for EPF/ERF with reference types

Add stub-db-create script (.ps1/.py) that scans EPF XML sources for
reference types (CatalogRef, DocumentRef, EnumRef, etc.) and generates
a minimal 1C configuration with metadata stubs. Supports 14 metadata
types including registers, charts, defined types.

epf-build/erf-build: if no database specified, auto-create stub DB
with matching metadata, build EPF, then cleanup temp DB.

epf-dump/erf-dump: if no database specified, create empty DB with
warning that reference types will be converted to strings.

SKILL.md updated: prefer real database from .v8-project.json first,
fall back to auto-created stub only when unavailable.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Nick Shirokov
2026-03-07 18:27:38 +03:00
co-authored by Claude Opus 4.6
parent 0a1f8888dc
commit f01f9d6ae8
10 changed files with 2261 additions and 52 deletions
+16 -3
View File
@@ -58,10 +58,21 @@ def main():
# --- Resolve V8Path ---
v8path = resolve_v8path(args.V8Path)
# --- Validate connection ---
# --- Auto-create empty database if no connection specified ---
auto_created_base = None
if not args.InfoBasePath and (not args.InfoBaseServer or not args.InfoBaseRef):
print("Error: specify -InfoBasePath or -InfoBaseServer + -InfoBaseRef", file=sys.stderr)
sys.exit(1)
auto_base_path = os.path.join(tempfile.gettempdir(), f"epf_dump_db_{random.randint(0, 999999)}")
print("No database specified. Creating temporary empty database...")
print("WARNING: Reference types (CatalogRef, DocumentRef, etc.) will be lost - converted to strings. Use a real database to preserve types.")
result = subprocess.run(
[v8path, "CREATEINFOBASE", f'File={auto_base_path}', "/DisableStartupDialogs"],
capture_output=True, text=True,
)
if result.returncode != 0:
print("Error: failed to create temporary database", file=sys.stderr)
sys.exit(1)
args.InfoBasePath = auto_base_path
auto_created_base = auto_base_path
# --- Validate input file ---
if not os.path.isfile(args.InputFile):
@@ -129,6 +140,8 @@ def main():
finally:
if os.path.exists(temp_dir):
shutil.rmtree(temp_dir, ignore_errors=True)
if auto_created_base and os.path.exists(auto_created_base):
shutil.rmtree(auto_created_base, ignore_errors=True)
if __name__ == "__main__":