Add portable Mentor schematic batch exporter

This commit is contained in:
阿白叔 committed 2026-11-06 14:51:19 +08:00
commit 40fbb1893a
26 files changed
+3622

No files matched your search

@@ -0,0 +1,57 @@
# Mentor Batch Export Implementation Plan
> For agentic workers: use superpowers:subagent-driven-development. Steps use checkbox syntax.
Goal: ship an offline portable, interactive Windows folder exporter for saved Mentor schematics, with tool provenance and recoverable results.
Architecture: a standalone Python package, bundled embedded Python and pywin32, vendor tools discovered locally. The CLI owns batching and reports; the exporter owns stable clones, isolated tool execution, validation and shared library reads.
Tech Stack: Python 3.12 x64, pywin32 312, x86 native library helper, 32-bit Windows cscript, stdlib HTML/JSON.
Spec: ../specs/2026-11-06-batch-export.md, approved by the user in chat.
## Global Constraints
- No Designer launch, no mutation of source projects/libraries or permanent environment/COM registration changes.
- Detailed schematic exports by default. Tool and mode provenance never merged away.
- Portable Python with preset dependencies; no user-side pip.
- Source copies exclude server address files. Owned native process cleanup is mandatory.
- Failure/partial/unavailable/cancelled must be visible; output validation required even with exit code zero.
- Retrying a changed source starts a complete new project attempt, never mixes source generations.
## Interfaces shared by tasks
core.read_project(path) returns a dict with string path, name, database, root_block, snapshot, library (str or None).
core.sha256(path), core.read_text(path), core.write_json(path, value) are stdlib utilities.
environment.discover_installations(explicit=None, cached=None) returns root/version/tools/native_compatible/com dicts.
tools keys are ascii, csv, keyin, rinf, edif, wir, pxr, constraints_xml; values are absolute EXE paths.
installation.com maps cms and central to dicts containing registered_path and matches.
exports.export_project(project, installation, project_dir, shared_dir, *, previous=None, stop_event=None, timeout=45, progress=print) returns a JSON-serializable record containing status, source_fingerprint, items, and source_hashes.
Each item has key, status (success/failed/unavailable/cancelled), reason, outputs (absolute file paths), and provenance.
previous is an earlier exporter result; project_dir is always a new attempt directory. Successful prior items are reused only when hashes, snapshot and tool identity still match.
exports.list_snapshots(project, installation, work_dir) may return names, without changing default selection.
## Task 1: export backend and helpers
- [x] Write behavioral tests for exit-zero/no-output, stable clones, cancellation, tool provenance and changed-input retries; run red.
- [x] Implement exports.py, helpers, and private process boundary by reusing verified research code; no fixed sample root/path.
- [x] Preserve ASCII flat/hier, CSV tables, WIR/OAT, KYN/RINF/PXR, EDIF net/schematic, CMS constraints with level identity.
- [x] Export associated library data for used parts/cells once per matching library fingerprint; native ABI guard and clear partial coverage.
- [x] Run tests green and report touched files and limitations.
## Task 2: environment, scanning, CLI, reporting
- [x] Write failing filesystem/behavior tests before implementation.
- [x] Implement core.py with project options, recursive discovery, collision-safe names, bounded identity and stable capture utilities.
- [x] Implement environment.py with explicit/cache/env/registry/limited conventional paths; same-install tools and COM matching.
- [x] Implement export.py interactive/noninteractive CLI, settings, per-batch and per-project manifests, cancellation, retries and HTML summaries.
- [x] Verify output-root recursion exclusion, duplicate names, invalid sources, changed sources and late interruption records.
## Task 3: portable package and acceptance
- [x] Build embedded Python 3.12.10 x64 from official distributable, preset locked pywin32 wheel, include runtime/third-party licenses.
- [x] Compile custom helper x86 with static CRT; include source, no Mentor binaries.
- [x] Create CMD entry using only relative bundled runtime; integrity validation and offline smoke check.
- [x] Run a real two-project export, compare source hashes, inspect provenance and required artifacts, retry selected failed/unavailable items.
- [x] Test moved folder with Python/PATH environment stripped; timeout/cancel/error tests; independent review.
- [x] Deliver folder and ZIP with README, dependency/compatibility manifest and validation report.