Repository navigation
Split CLI into behavior-owned modules and close out cycle 0007 #4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
49ceb5f
cb6cbec
07b5f56
7b9e87c
b608496
ef94430
aaeade6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,141 @@ | ||
| # CLI Module Split | ||
|
|
||
| Source backlog item: `docs/method/backlog/asap/PROCESS_cli-module-split.md` | ||
| Legend: PROCESS | ||
|
|
||
| ## Sponsors | ||
|
|
||
| - Human: I can inspect the CLI and find command parsing, workspace | ||
| mutations, drift logic, and file-collection behavior in separate, | ||
| named modules instead of spelunking a 1,000-line monolith. | ||
| - Agent: I can change one CLI behavior with a narrow edit scope because | ||
| the code is split by owned behavior, not piled into a single entry | ||
| file or dissolved into vague utility soup. | ||
|
|
||
| ## Hill | ||
|
|
||
| METHOD keeps the current CLI command surface and behavior, but | ||
| reorganizes the implementation so `src/cli.ts` becomes a thin entry | ||
| point and runtime-owned modules carry argument parsing/help, workspace | ||
| operations, and drift detection in separate homes while workspace-local | ||
| document scaffolding stays with the workspace module unless it becomes | ||
| independently meaningful. | ||
|
|
||
| ## Playback Questions | ||
|
|
||
| ### Human | ||
|
|
||
| - [ ] Can I open the CLI code and identify where argument parsing ends | ||
| and workspace behavior begins without reading the whole command | ||
| stack top to bottom? | ||
| - [ ] If I need to review or change only drift behavior, can I find that | ||
| logic in one small module instead of tracing through unrelated | ||
| `init`, `pull`, `close`, and `status` code? | ||
|
|
||
| ### Agent | ||
|
|
||
| - [ ] Does `src/cli.ts` stay a thin entry point that wires command | ||
| parsing and execution together rather than owning most of the | ||
| runtime behavior itself? | ||
| - [ ] Are the resulting modules named by owned behavior, with stable | ||
| tests proving that the CLI still preserves its existing contract? | ||
|
|
||
| ## Accessibility and Assistive Reading | ||
|
|
||
| - Linear truth / reduced-complexity posture: the module layout should be | ||
| readable in a terminal or plain editor. File names should describe the | ||
| behavior they own so a reviewer can follow the CLI flow without IDE | ||
| indexing. | ||
| - Non-visual or alternate-reading expectations: this cycle should reduce | ||
| navigation burden for screen-reader users, terminal-only operators, | ||
| and agents by shortening files and making the seams more explicit in | ||
| committed paths and test names. | ||
|
|
||
| ## Localization and Directionality | ||
|
|
||
| - Locale / wording / formatting assumptions: internal symbol and module | ||
| names may remain English. No localization work is part of this cycle. | ||
| - Logical direction / layout assumptions: the split should improve code | ||
| navigation through textual structure, not left/right editor panes or | ||
| IDE-specific affordances. | ||
|
|
||
| ## Agent Inspectability and Explainability | ||
|
|
||
| - What must be explicit and deterministic for agents: the module | ||
| boundaries and moved responsibilities must be committed in the repo. | ||
| A reviewer should be able to point to a concrete file for CLI entry, | ||
| arg parsing/help text, workspace operations, drift behavior, and the | ||
| workspace-local scaffolding those behaviors still depend on. | ||
| - What must be attributable, evidenced, or governed: tests must prove | ||
| the CLI contract still holds after the split. This cycle should not | ||
| hide behavioral changes inside a refactor. If outputs or command | ||
| semantics change, that change needs an explicit test and design note. | ||
|
|
||
| ## Non-goals | ||
|
|
||
| - [ ] Adding new CLI commands or changing the current command surface. | ||
| - [ ] Introducing a large public library API for the internal modules. | ||
| - [ ] Converting the repo away from TypeScript or rewriting the CLI in | ||
| plain JavaScript as part of this cycle. | ||
| - [ ] Sneaking in drift-feature expansion such as near-miss hints, | ||
| witness packaging, or broader test discovery. | ||
| - [ ] Splitting the file into generic `utils` buckets that weaken | ||
| ownership instead of clarifying it. | ||
|
|
||
| ## Decisions To Make | ||
|
|
||
| - Which module boundaries are real enough to earn first-class files in | ||
| this cycle. | ||
| Final direction: split by owned behavior, not by syntactic category. | ||
| The first cut should likely separate: | ||
| - `src/cli.ts` as entry point plus exported `runCli` | ||
| - `src/cli-args.ts` for parse/help behavior | ||
| - `src/workspace.ts` for workspace mutation/query behavior | ||
| - `src/drift.ts` for playback-question extraction and drift matching | ||
| - `src/fs-helpers.ts` and/or `src/text-helpers.ts` only where a helper | ||
| is genuinely shared and still semantically coherent | ||
| - Whether `Workspace` should remain the primary runtime object. | ||
| Current bias: yes. Keep a real runtime-backed workspace type, but make | ||
| it smaller by moving drift-only logic out of the class first. | ||
| Workspace-local document scaffolding and markdown traversal may remain | ||
| in `src/workspace.ts` during this cycle if they stay internal to | ||
| workspace behavior. | ||
| - How far to take the split in one cycle. | ||
| Current bias: enough to remove the monolith risk now, not a full | ||
| architectural rewrite. | ||
|
|
||
| ## Backlog Context | ||
|
|
||
| `src/cli.ts` is carrying too many concerns at once: command parsing, | ||
| workspace logic, file discovery, markdown extraction, normalization, | ||
| and the drift algorithm all live together. Split the CLI into smaller | ||
| runtime-owned modules so the code shape matches the repo's own doctrine | ||
| about traceability and single responsibility. | ||
|
|
||
| Session context: | ||
|
|
||
| - The `method drift` PR shipped a useful feature, but review surfaced a | ||
| real structural problem: the CLI entry point is becoming a monolith. | ||
| - Current `src/cli.ts` is 1,056 lines and mixes: | ||
| - top-level command execution | ||
| - arg parsing and usage text | ||
| - workspace mutation/query behavior | ||
| - drift extraction and matching | ||
| - recursive file collection | ||
| - markdown parsing and text normalization helpers | ||
| - The repo's newer system-style JavaScript doctrine pushes toward | ||
| runtime-owned modules with clear responsibilities. A successful split | ||
| should make the code more honest, not just more fragmented. | ||
|
|
||
| What this surfaced: | ||
|
|
||
| - `cli.ts` should become a thin entry point that preserves the exported | ||
| CLI contract. | ||
| - `Workspace` is still probably the right runtime object, but it should | ||
| stop owning drift-only logic and helper grab-bags. | ||
| - The split should be behavior-centered. Replacing one monolith with a | ||
| handful of ambiguous helper files would be a lateral move, not an | ||
| improvement. | ||
| - Existing CLI tests give this cycle a strong safety rail: the refactor | ||
| can stay honest by preserving those contracts while tightening file | ||
| boundaries. | ||
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| # Cycle Witness Command | ||
|
|
||
| Explore a `method witness` command that can package the rerunnable | ||
| proof for a cycle close: commands run, artifacts produced, playback | ||
| answers, and file references. | ||
|
|
||
| Session context: | ||
|
|
||
| - External repos using METHOD are starting to want a cleaner way to | ||
| package what counted as the witness for a completed cycle. | ||
| - The need is broader than any one repo's local tooling. If METHOD | ||
| thinks witness packaging is a real pattern, it belongs here instead | ||
| of being rediscovered downstream. | ||
|
|
||
| What this surfaced: | ||
|
|
||
| - A witness command could reduce ad hoc closeout work while staying | ||
| faithful to METHOD's requirement that done-claims be reproducible. | ||
| - The command should package evidence, not invent it. It would point to | ||
| rerunnable proof rather than becoming a substitute for that proof. | ||
| - This still feels like a cool idea, not core doctrine, until METHOD | ||
| has clearer boundaries around artifact history, closeout flow, and | ||
| any future API surface. |
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,44 @@ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # Release shaping and user migration docs | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Filename prefix misleads about document type. The 📝 Suggested filename correction-# Release shaping and user migration docs
+# Release shaping and user migration docsAnd rename the file from: to: or 🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| METHOD needs a clearer way to shape releases, not just cycles. Alongside | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| `CHANGELOG.md`, the repo should have a structured, user-facing release | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| surface that explains what is new in a release, why it matters, and how | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| to migrate from previous versions when migration is required. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+3
to
+6
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Vague problem statement lacks evidence and specificity. The assertion that METHOD "needs a clearer way to shape releases" (line 3) provides no:
Add at least one concrete example of a release that failed to communicate effectively, or cite specific user feedback demonstrating the gap. Define measurable success criteria for what "structured" and "user-facing" actually mean in this context. 🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Session context: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - The current release doctrine is intentionally light: `release.md` | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| says releases happen when externally meaningful behavior changes and | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| points at `CHANGELOG.md` plus `README.md`. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - That is enough for honesty, but it is not enough for user-facing | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| release communication. Changelogs are ledger-like. Users often need a | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| more guided document: what changed, what to look at first, what might | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| break, and what to do next. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - The gap is especially visible for infrastructure repositories where a | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| release may change doctrine, CLI behavior, file layout, or expected | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| workflow. A terse changelog entry is not always the right surface for | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| helping a user adopt that release. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+10
to
+20
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Uncited claims undermine credibility. Multiple assertions lack supporting evidence:
🔍 Suggested improvement with citations-- The current release doctrine is intentionally light: `release.md`
- says releases happen when externally meaningful behavior changes and
- points at `CHANGELOG.md` plus `README.md`.
+- The current release doctrine is intentionally light. Per `release.md`
+ (lines X-Y): "[exact quote]" — releases happen when externally
+ meaningful behavior changes, with `CHANGELOG.md` and `README.md` as
+ primary communication surfaces.
-- That is enough for honesty, but it is not enough for user-facing
- release communication. Changelogs are ledger-like. Users often need a
- more guided document: what changed, what to look at first, what might
- break, and what to do next.
+- That is enough for honesty, but feedback from [cite source or issue]
+ indicates users need more guidance: what changed, what to prioritize,
+ what might break, and migration steps.🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Questions this should answer: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - What makes a release “shaped” rather than just tagged and logged? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - What artifact should accompany a real release besides | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| `CHANGELOG.md`? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - Should METHOD define a user-facing release note format such as: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| summary, what changed, why it matters, breaking changes, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| migration/upgrade steps, and links to deeper docs? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - When should a release include explicit migration guidance versus “no | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| migration required”? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - Where should these artifacts live: `docs/releases/`, a generated | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| release page, versioned markdown files, or something else? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - How should release shaping relate to cycle closeout and post-merge | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ship sync? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+22
to
+35
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion | 🟠 Major Unanswered questions without prioritization or ownership. The seven questions (lines 24-35) lack:
Either prioritize and propose answers to the top 2-3 questions, or explicitly state this document is a scratchpad for future scoping work. ♻️ Proposed structure with prioritization Questions this should answer:
+**Critical (must answer to proceed):**
+
- What makes a release "shaped" rather than just tagged and logged?
-- What artifact should accompany a real release besides
- `CHANGELOG.md`?
- Should METHOD define a user-facing release note format such as:
summary, what changed, why it matters, breaking changes,
migration/upgrade steps, and links to deeper docs?
+
+**Important (affects implementation):**
+
+- What artifact should accompany a real release besides
+ `CHANGELOG.md`?
- When should a release include explicit migration guidance versus "no
migration required"?
+
+**Nice-to-have (can defer):**
+
- Where should these artifacts live: `docs/releases/`, a generated
release page, versioned markdown files, or something else?
- How should release shaping relate to cycle closeout and post-merge
ship sync?
+
+**Proposed answers (working hypotheses):**
+
+- [Add at least one hypothesis here for the critical questions]📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| What this surfaced: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - METHOD currently knows how to close cycles honestly, but not yet how | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| to present releases coherently to users. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - `CHANGELOG.md` is necessary, but not always sufficient as the primary | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| user-facing release document. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - A structured release note / migration surface could become part of the | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| release method without turning every cycle into release theater. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+1
to
+44
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Missing critical backlog metadata and context. This backlog document lacks essential information for prioritization and execution: Missing metadata:
Missing content:
Add a metadata header block and at least two concrete examples of the problem this addresses. 📋 Proposed metadata header # Release shaping and user migration docs
+**Status:** Backlog inbox
+**Owner:** [TBD or propose]
+**Priority:** [P1/P2/P3]
+**Estimated scope:** [0.5 cycle / 1 cycle / 2+ cycles]
+**Target cycle:** [TBD or propose]
+**Dependencies:** None known
+**Related work:** [Links to similar efforts, if any]
+
METHOD needs a clearer way to shape releases, not just cycles. AlongsideAnd add a concrete examples section: to migrate from previous versions when migration is required.
+## Examples of the problem
+
+1. **[Specific release or repo]:** [Describe what went wrong, user
+ confusion, or missing guidance]
+2. **[Another example]:** [Additional evidence]
+
Session context:🤖 Prompt for AI Agents
Comment on lines
+37
to
+44
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Observations lack precision and actionable conclusions.
Most critically: this section identifies gaps but provides no actionable next steps. Add a "Proposed next steps" or "Recommended action" section that states who should do what by when. ♻️ Proposed rewrite with precision and next steps What this surfaced:
-- METHOD currently knows how to close cycles honestly, but not yet how
- to present releases coherently to users.
+- The current cycle closeout process captures work completed and
+ artifacts produced, but does not synthesize those into user-facing
+ release communication.
-- `CHANGELOG.md` is necessary, but not always sufficient as the primary
- user-facing release document.
+- `CHANGELOG.md` is necessary for tracking changes, but [cite specific
+ release or user feedback] showed users needed additional guidance on
+ migration steps and breaking changes.
-- A structured release note / migration surface could become part of the
- release method without turning every cycle into release theater.
+- A structured release note format (summary, migration steps, breaking
+ changes) could improve release communication while maintaining the
+ lightweight release doctrine.
+
+**Proposed next steps:**
+
+1. [Owner TBD] Draft a release note template with required and optional
+ sections (target: [date/cycle])
+2. [Owner TBD] Pilot the template on the next infrastructure release
+3. [Owner TBD] Gather user feedback and iterate📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,51 @@ | ||
| # CLI Module Split Retro | ||
|
|
||
| Design: `docs/design/0007-cli-module-split/cli-module-split.md` | ||
| Outcome: hill-met | ||
| Drift check: yes | ||
|
|
||
| ## Summary | ||
|
|
||
| This cycle split the CLI monolith into behavior-owned modules without | ||
| changing the command surface. `src/cli.ts` is now a thin 97-line entry | ||
| point that wires command execution together, while `src/cli-args.ts`, | ||
| `src/workspace.ts`, `src/drift.ts`, and `src/errors.ts` carry the | ||
| owned runtime behavior. This first cut moved argument parsing and | ||
| drift-specific behavior into dedicated modules while leaving | ||
| workspace-local document scaffolding inside `src/workspace.ts`. The | ||
| existing CLI contract stayed intact: | ||
| `npm test`, `npm run build`, and `npm run method -- status` all still | ||
| pass after the split. | ||
|
|
||
| ## Playback Witness | ||
|
|
||
| - [Witness Index](./witness/README.md) | ||
| - [Playback Witness](./witness/playback.md) | ||
| - [Verification Witness](./witness/verification.md) | ||
|
|
||
| ## Drift | ||
|
|
||
| - None recorded. | ||
|
|
||
| ## New Debt | ||
|
|
||
| - None recorded. | ||
|
|
||
| ## Cool Ideas | ||
|
|
||
| - None recorded. | ||
|
|
||
| ## Backlog Maintenance | ||
|
|
||
| - [x] Inbox processed during cycle closeout | ||
| - [x] Priorities reviewed | ||
| - [x] Dead work buried or merged | ||
| - Moved `PROCESS_retro-conversational-closeout` from `inbox/` to | ||
| `cool-ideas/`. | ||
| - Left `SYNTH_generated-signpost-provenance` as the sole `asap/` item. | ||
| - Left `PROCESS_git-branch-workflow-policy`, | ||
| `PROCESS_library-api-surface`, and | ||
| `PROCESS_system-style-javascript-adoption` in `up-next/` for later | ||
| cycle planning. | ||
| - Branch tip now also carries the later backlog capture | ||
| `PROCESS_release-shaping-and-user-migration-docs` in `inbox/`. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| # Witness Index | ||
|
|
||
| This cycle claims a structural refactor, not a new feature. The proof | ||
| rests on committed module boundaries plus rerunnable commands that show | ||
| the CLI contract still behaves the same after the split. | ||
|
|
||
| ## Artifacts | ||
|
|
||
| - [playback.md](./playback.md) | ||
| Human and agent playback answers for the CLI-module-split cycle. | ||
| - [verification.md](./verification.md) | ||
| Reproducible commands showing the new `src/` layout, the thinner | ||
| entry point, and the unchanged build/test/status truth surfaces. | ||
|
|
||
| ## Review Notes | ||
|
|
||
| - The done-claim is carried by committed source files and rerunnable | ||
| commands, not by review prose. | ||
| - This witness proves the split happened and that the current CLI | ||
| contract still holds. It does not claim a new public API or new CLI | ||
| behavior. | ||
| - The refactor stays aligned with the repo's system-style JavaScript | ||
| direction by keeping a real `Workspace` runtime object instead of | ||
| flattening everything into utility functions. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,64 @@ | ||
| # Playback Witness | ||
|
|
||
| Date: 2026-04-03 | ||
|
|
||
| This was a structural refactor cycle. The deliverable is a thinner CLI | ||
| entry point and clearer behavior-owned modules, with the existing | ||
| command surface preserved. | ||
|
|
||
| ## Human Playback | ||
|
|
||
| ### Can I open the CLI code and identify where argument parsing ends and workspace behavior begins without reading the whole command stack top to bottom? | ||
|
|
||
| Yes. | ||
|
|
||
| The boundaries are now visible from committed file names and grep-able | ||
| exports: | ||
|
|
||
| - `src/cli.ts` wires execution together | ||
| - `src/cli-args.ts` owns parse/help behavior | ||
| - `src/workspace.ts` owns workspace mutations and status rendering | ||
| - `src/drift.ts` owns playback-question extraction and matching | ||
|
|
||
| The human no longer has to scan a 1,000-line single file to answer | ||
| basic ownership questions. | ||
|
|
||
| ### If I need to review or change only drift behavior, can I find that logic in one small module instead of tracing through unrelated `init`, `pull`, `close`, and `status` code? | ||
|
|
||
| Yes. | ||
|
|
||
| `src/drift.ts` now holds the drift-specific behavior directly, and | ||
| `Workspace.detectDrift()` delegates to it. The refactor did not hide | ||
| drift behind generic helpers or mixed command code. | ||
|
|
||
| ## Agent Playback | ||
|
|
||
| ### Does `src/cli.ts` stay a thin entry point that wires command parsing and execution together rather than owning most of the runtime behavior itself? | ||
|
|
||
| Yes. | ||
|
|
||
| `src/cli.ts` is now 97 lines and contains: | ||
|
|
||
| - the exported `runCli` | ||
| - the exported `main` | ||
| - the entry-point bootstrap | ||
|
|
||
| It no longer defines `Workspace`, drift extraction, or generic file | ||
| collection behavior. | ||
|
|
||
| ### Are the resulting modules named by owned behavior, with stable tests proving that the CLI still preserves its existing contract? | ||
|
|
||
| Yes. | ||
|
|
||
| The module names describe owned behavior directly, and the existing CLI | ||
| tests still pass after the split. Two added structural tests also prove | ||
| that: | ||
|
|
||
| - the behavior-owned files exist | ||
| - `src/cli.ts` no longer contains the old monolith seams | ||
|
|
||
| ## Outcome | ||
|
|
||
| The hill is met. The CLI is structurally clearer, the entry point is | ||
| thin again, and the command behavior stayed stable under rerunnable | ||
| test/build/status verification. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor inconsistency in stated line count.
Line 119 states
src/cli.tsis "1,056 lines" but the AI summary claims "962 lines." Pick one number or drop the specific count. Documentation drift is still drift.🤖 Prompt for AI Agents