Skip to content

refactor: reorganize src/ from flat files into deep modules#29

Merged
mfaux merged 12 commits into
mainfrom
feat/refactor-reorganize-src-from-flat-files-into-deep-modules
Apr 4, 2026
Merged

refactor: reorganize src/ from flat files into deep modules#29
mfaux merged 12 commits into
mainfrom
feat/refactor-reorganize-src-from-flat-files-into-deep-modules

Conversation

@mfaux

@mfaux mfaux commented Apr 4, 2026

Copy link
Copy Markdown
Owner

Summary

Reorganizes src/ from a flat ~97-file structure into deep modules by feature. Each cluster of related files moves into its own directory with a barrel index.ts that re-exports only the public API. Shared code moves into src/lib/ organized by domain. Command modules each get their own directory.

Closes #28

Changes

  • src/lib/git/git.ts, gitignore.ts, github-trees.ts + tests
  • src/lib/lock/dotai-lock.ts, skill-lock.ts, local-lock.ts, lock-version-error.ts + tests
  • src/lib/parsers/ — source, prompt, agent, instruction, override parsers + tests
  • src/lib/transpilers/ — prompt, agent, instruction transpilers + tests
  • src/lib/discovery/ — context, skill, find discovery + tests
  • src/lib/install/ — context installer/add/check, skill installer, collisions, append markers + tests
  • src/lib/agents/agents.ts, target-agents.ts
  • src/lib/types.ts, utils.ts, constants.ts, validation.ts, model-aliases.ts, telemetry.ts, plugin-manifest.ts, command-result.ts, test-utils.ts, prompts/, providers/
  • src/add/ — add command and all sub-modules + tests
  • src/check/, src/find/, src/init/, src/list/, src/remove/, src/restore/, src/sync/ — each command in its own directory with barrel index
  • Normalized ~14 import statements from .js to .ts extensions
  • Updated all imports in tests/ directory for new module locations

Approach

  • Pure structural refactor: file moves and import updates only. No logic changes, no behavior changes.
  • Each commit is self-contained: move files, create barrel, update all imports.
  • pnpm build, pnpm test, pnpm type-check, and pnpm format:check all pass.

Resulting structure

src/
  cli.ts, cli-parse.ts          # entry point + arg parsing
  add/                           # add command
  check/ find/ init/ list/       # other commands
  remove/ restore/ sync/
  lib/
    agents/ discovery/ git/      # shared modules by domain
    install/ lock/ parsers/
    transpilers/ prompts/
    providers/
    types.ts utils.ts constants.ts ...

@mfaux mfaux merged commit 2aa9404 into main Apr 4, 2026
4 checks passed
@mfaux mfaux deleted the feat/refactor-reorganize-src-from-flat-files-into-deep-modules branch April 4, 2026 17:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

refactor: reorganize src/ from flat files into deep modules

1 participant