# Generation Kernel And Legacy RuoYi Adapter Plan **Goal:** Separate deterministic ProjectSpec orchestration from the current RuoYi projection/template implementation and give the first Adapter a versioned, fingerprinted capability contract. **Architecture:** `ProjectSpecGenerationService` remains the authenticated version orchestrator. It delegates source production to `DeterministicGenerationKernel`, which resolves a `GeneratorAdapter`, validates the returned target set, inspects archives, and builds stable manifests. `LegacyRuoYiGeneratorAdapter` owns `LegacyProjectProjection` and `IFrontProjectPreviewService`. Its Template Pack descriptor fingerprints effective database template files plus bundled classpath template resources. ## Task 1: Adapter SPI - [x] Add adapter ID/version selection to ProjectSpec deliverables without invalidating older V1 snapshots. - [x] Define `GeneratorAdapter`, request/result, capability, Adapter descriptor, Template Pack descriptor, and raw archive contracts. - [x] Add a registry that rejects unknown adapters, version mismatches, and unsupported schema versions. ## Task 2: Legacy Adapter - [x] Wrap LegacyProjectProjection and the current preview renderer in `LegacyRuoYiGeneratorAdapter`. - [x] Declare supported schema, output targets, and runtime capabilities. - [x] Fingerprint selected database template files and bundled qing/VM/business-block resources using stable resource paths. ## Task 3: Deterministic Kernel - [x] Move ZIP safety checks and stable manifest construction out of `ProjectSpecGenerationService`. - [x] Require the Adapter to return every selected target exactly once. - [x] Keep file count, uncompressed byte, duplicate path, and traversal limits in the target-independent kernel. ## Task 4: Run Identity And UI - [x] Build Generation Run Adapter and Template fingerprints from formal descriptors. - [x] Expose Adapter capability and Template resource identity in existing run responses. - [x] Update Factory source contracts and labels where needed. ## Task 5: Verification - [x] Run Adapter, Kernel, Factory generation, run persistence, controller, and frontend regression tests. - [x] Run the Vite build and `git diff --check`. - [x] Record P2-A completion and remaining Prompt/Stage Pipeline work in the roadmap. ## Boundaries - This phase keeps the existing templates and Legacy projection behavior intact. - It does not yet implement Prompt Registry, Model Gateway, Stage Handler checkpoints, Plugin resolution, or a second technology Adapter. - Template Pack version is a Legacy contract label plus a real content fingerprint; a publishable Template Pack version entity remains future work.