Files
typescript-decompiler/docs/phase-docs/phase-8-deterministic-codebase-regularization.md
T
2026-05-24 23:54:48 -06:00

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

  1. take the post-relabel recovered source from earlier phases
  2. split coarse recovered units into smaller files or modules only where deterministic boundaries can be proven
  3. assign deterministic file and folder placement
  4. reconstruct deterministic import and export boundaries between split files
  5. emit the canonical editable tree and regularization manifests
  6. preserve stable placement for unchanged areas across runs when lineage and structure still match
  7. 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