Skip to content

[Epic] Deep cleanup and restructuring of the Code-XR extension, with no loss of functionality #26

In review
18 of 19 issues completed

Description

@aMonteSl

Goal

Leave the Code-XR VS Code extension as a spotless base for the TFM work and for the future Code-XR IDE (epic #11): no zombie code, no duplicated subsystems, low complexity, single-responsibility modules, guardrails that stop the rot from coming back, a smaller package, and a clean monorepo layout. Without losing any functionality.

This epic executes the v1.2.1 cleanup programme that was approved on 2026-09-18 (.claude/docs/v1.2.1/ROADMAP.md, waves W2–W5, ~235 bisectable commits), re-validated against the monorepo tree on 2026-11-25, and extends it with the findings of a new sweep of every directory of the repository.

Analysis (2026-11-25)

Documented in docs/cleanup/ (added by the first PR of this epic):

Document Content
docs/cleanup/README.md This plan, the story map and the execution order
docs/cleanup/feature-baseline.md Exhaustive inventory of everything the extension has and does, with a verification checklist
docs/cleanup/w2-revalidation.md Every W2 deletion row re-checked against the monorepo tree: 57 valid, 16 need amendments, 1 invalid (W2-29)
docs/cleanup/sweep-outside-src.md Sweep of root, media/, pages/, .claude/, adr/, scripts, fixtures and monorepo seams: 20 new findings
docs/cleanup/host-boundary.md How vscode coupling, template resolution and folder cycles shape the code for the IDE

Headline numbers today: 369 TS files / 52,988 lines; 54 modules unreachable from extension.ts (2,317 lines); 1,646 console.* calls; 219 any; 6 functions with CCN > 30 (worst 61); 19 files over 500 lines; 179 of 369 files import vscode; 9 two-way folder cycles; ~165 MB of unused media in the working tree. Test baseline: npm test 708/709 on Linux (1 known path-portability failure), Python 52/52.

Rules

  • Behaviour-neutral. The only user-visible changes allowed are the ones the maintainer authorized on 2026-09-18 (ROADMAP §B: remove Hello World and the 17 unreachable commands, hide the venv-deleting debug command, logging moves to the "CodeXR" output channel, delete the abandoned visual-style feature). Each one gets a CHANGELOG line.
  • Characterize before reshaping, prove before deleting (four-check deadness proof, H1 dist-identical / H2 reviewed shrink). One roadmap item = one bisectable commit; npm test green after every commit; the guardrail ratchet records each before/after.
  • One PR per story, against v1.2.1, never master. Must keep working on Linux, Windows and macOS.
  • Does not start the IDE ([Epic] Migrate Code-XR from a VS Code extension to its own IDE (Electron + Monaco) #11) nor story [Story] Extract a host-agnostic Code-XR core from the VS Code extension #13 (host-agnostic core); only the cleanup that makes it cheaper.

Definition of done

  • All sub-issues closed, CI green on the three OSes.
  • The roadmap exit criteria (ROADMAP §5) met or each deviation recorded.
  • The feature-baseline story verified item by item (automated checks + a manual end-to-end run) and closed.
  • A final report of everything found and changed.

Sub-issues

Sub-issues

18 of 19 Issues completed
Loading 19 sub-issues

Activity

  1. self-assigned this
    on Nov 25, 2026
  2. added
    tfm
    epic
    on Nov 25, 2026
  3. added a commit that references this issue on Nov 25, 2026
  4. aMonteSl commented on Nov 25, 2026

    @aMonteSl
    CollaboratorAuthor

    Scope extended on 2026-11-25 at the maintainer's request:

    Order: both run after #34, #35, #40 and #42, and before the final verification (#43). #56 goes first or alongside #55, so code is rewritten before it moves.


    Generated by Claude Code

  5. aMonteSl commented on Nov 25, 2026

    @aMonteSl
    CollaboratorAuthor

    Every story of this epic is merged into v1.2.1 (PRs #44–#66). The final report is docs/cleanup/REPORT.md.

    Measure Before (399494af) After (d89e08d4)
    src/ files 369 291
    src/ folders 179 98
    index.ts barrels 82 0
    Modules unreachable from extension.ts 54 0
    console.* calls in src/ 1,646 2
    any 219 84
    Functions over CCN 20 10 0
    Worst function CCN 61 20
    Extension tests 708 1,064
    Backend tests 52 73
    VSIX size 6.45 MB 4.20 MB
    Tracked working tree 313.5 MB 117.1 MB

    Two things remain before this epic closes. Both are for the maintainer:


    Generated by Claude Code

  6. added
    stream: cleanup-refactor
    on Nov 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

epicstream: cleanup-refactortfm

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions