Skip to content

[Story] Clean the module layering in preparation for the IDE (no host abstraction yet) #42

Done

Description

@aMonteSl

As the developer who will later extract a host-agnostic core (#13, epic #11),
I want the extension's folders to depend on each other in one direction and pure logic to be free of incidental vscode imports,
so that extracting packages/core later is a move, not a rewrite.

Context (docs/cleanup/host-boundary.md)

179 of 369 files import vscode; only 101 are vscode-free transitively. 9 two-way folder cycles (e.g. code_analysis ↔ servers 6/13 edges, babia_templates ↔ code_analysis 2/21). 22 files build template paths by hand; there is no central resolver, and four server files fall back to a __dirname path that is wrong from the bundle.

Scope (plain cleanup only; anything that introduces host ports belongs to #13)

  1. Import model/security files directly instead of the remote_access/collaboration barrels in servers/runtime/* (≈ 6 files become vscode-free).
  2. activeServerRegistry uses a Node emitter instead of vscode.EventEmitter (event contract unchanged).
  3. One resolveTemplatePath() used by the 22 call sites; remove or fix the __dirname fallback; a templatesRoot() test helper for the 38 tests.
  4. Move UI side effects out of sessionRegistry.ts (return a status, caller notifies) and the handleServerActions import out of multiServerLauncher.ts (coordinated with the server-split story).
  5. Move the pure commandRegistry to core/ so feature folders stop importing commands/shared.
  6. A dependency-direction test (folder import matrix) that pins the remaining allowed edges and fails on a new cycle.

Acceptance criteria

  • Two-way folder cycles 9 → ≤ 2 (each remaining one documented).
  • Transitively vscode-free files 101 → measured increase, recorded in docs/cleanup/host-boundary.md.
  • Production bundle behaviour unchanged: npm test, test:analysis green; manual F5 analysis + server start recorded.
  • No new interface or package is created (that is [Story] Extract a host-agnostic Code-XR core from the VS Code extension #13).

Activity

  1. self-assigned this
    on Nov 25, 2026
  2. added
    tfm
    user-story
    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

    Done in #60, merged into v1.2.1 with CI green on Linux, macOS and Windows.

    The dependency-direction test now guards against new cycles.


    Generated by Claude Code

  5. added
    area: extension
    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

area: extensionstream: cleanup-refactortfmuser-story

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions