1.5 KiB
1.5 KiB
Phase 8 — deterministic codebase regularization
Goal
Deterministically convert the recovered post-relabel source into a conventional, significantly more navigable editable tree that humans and LLMs can explore and modify more effectively without guessing original repository structure.
Script
scripts/regularize-codebase.js
Workflow
- take the post-relabel recovered source from earlier phases
- split coarse recovered units into smaller files or modules only where deterministic boundaries can be proven
- assign deterministic file and folder placement
- reconstruct deterministic import and export boundaries between split files
- emit the canonical editable tree and regularization manifests
- preserve stable placement for unchanged areas across runs when lineage and structure still match
- use wrappers only as a last resort and mark them as recovery scaffolding
Outputs
- canonical editable source tree at repo root
- regularization manifest and lineage mappings under
runs/<run-id>/ - reusable stable placement metadata under
stable/when helpful
Verification
- confirm deterministic reruns produce the same regularized tree and manifest from identical inputs
- confirm the regularized tree parses after structural transformations
- confirm import/export graph consistency is preserved after splitting
- confirm unchanged modules preserve stable placement across runs when lineage matches
- confirm wrapper use remains exceptional and is surfaced in manifests or summary counts