codebyplan 1.13.42 → 1.13.43
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli.js
CHANGED
package/package.json
CHANGED
|
@@ -212,6 +212,16 @@ If modifying managed files (`.claude/*`, `.claude/docs/architecture/*`, etc.):
|
|
|
212
212
|
|
|
213
213
|
**Why:** Routing commands do this automatically. If you bypass routing, you MUST do source consultation manually. Skills contain coding patterns and conventions that must be followed.
|
|
214
214
|
|
|
215
|
+
### Step 2.4: Architecture Map Consultation
|
|
216
|
+
|
|
217
|
+
For ANY module you are about to edit (app code or managed files), check for a pre-computed architecture map:
|
|
218
|
+
|
|
219
|
+
1. For each path in `files_to_modify`, derive its module and Glob `.claude/architecture/<module-slug>.md`.
|
|
220
|
+
2. If a map exists, read it BEFORE Step 3 — it surfaces the module's boundaries, internal structure, dependencies, and where-things-live landmarks, reducing broad file-system scans.
|
|
221
|
+
3. If `.claude/architecture/` is absent or the module has no map, proceed without it (not a blocker).
|
|
222
|
+
|
|
223
|
+
See `.claude/context/architecture-map.md` for the full consultation contract. Unlike Step 2 (managed files only), this step fires for every round regardless of file type.
|
|
224
|
+
|
|
215
225
|
### Step 2.5: Search Before Creating
|
|
216
226
|
|
|
217
227
|
For each file with action `create` in `files_to_modify`:
|
|
@@ -376,6 +376,11 @@ delegation_hint:
|
|
|
376
376
|
|
|
377
377
|
Read `.claude/rules/*.md` and relevant architecture docs.
|
|
378
378
|
|
|
379
|
+
If `.claude/architecture/` contains map file(s) for the target module(s), read them before
|
|
380
|
+
finalizing scope — they provide pre-computed structural context (boundaries, dependencies,
|
|
381
|
+
landmarks) that reduces the need for broad file-system scans. See
|
|
382
|
+
`.claude/context/architecture-map.md` for the consultation contract.
|
|
383
|
+
|
|
379
384
|
### Phase 4: Clarify Requirements (Context-First)
|
|
380
385
|
|
|
381
386
|
Before any AskUserQuestion call, check (1) `checkpoint.context`, (2) `task.context`, (3) codebase via Grep/Glob/Read. Only ask if all three fail. When asking, prefix with `Checked: [sources]. Not found. Asking: [question]`. If a question IS answered in context, use that answer directly — do not re-ask.
|
|
@@ -12,7 +12,7 @@ Activate the session, open a fresh session log, and surface the previous log's p
|
|
|
12
12
|
|
|
13
13
|
## Instructions
|
|
14
14
|
|
|
15
|
-
Run Steps 0 through 5.8 silently (no intermediate output) — except Step 0 aborts the session on MCP failure, Step 1.4 may surface a one-line fast-forward note or warning, Step 1.5 may surface a one-line infra-drift nudge, Step 1.6 may run an install-and-halt path, Step 1.7 may surface a one-line LSP binary nudge, Step 4.5 may auto-resume a handoff and exit session-start entirely (no Step 6 output), and Step 5.7 may surface an approval gate. (Step numbers are organizational labels; execution order is 0 → 1 → 1.4 → 1.5 → 1.6 → 1.7 → 3 → 4 → 4.5 → 5 → 5.7 → 5.8 → 6 → 7.) Produce ONE output block at Step 6, then auto-trigger or stop per Step 7.
|
|
15
|
+
Run Steps 0 through 5.8 silently (no intermediate output) — except Step 0 aborts the session on MCP failure, Step 1.4 may surface a one-line fast-forward note or warning, Step 1.5 may surface a one-line infra-drift nudge, Step 1.55 may surface a one-line architecture-map drift nudge, Step 1.6 may run an install-and-halt path, Step 1.7 may surface a one-line LSP binary nudge, Step 4.5 may auto-resume a handoff and exit session-start entirely (no Step 6 output), and Step 5.7 may surface an approval gate. (Step numbers are organizational labels; execution order is 0 → 1 → 1.4 → 1.5 → 1.55 → 1.6 → 1.7 → 3 → 4 → 4.5 → 5 → 5.7 → 5.8 → 6 → 7.) Produce ONE output block at Step 6, then auto-trigger or stop per Step 7.
|
|
16
16
|
|
|
17
17
|
### Step 0: MCP Health Gate
|
|
18
18
|
|
|
@@ -91,9 +91,37 @@ Surface — never block — when this worktree's source-monorepo `.claude/` infr
|
|
|
91
91
|
|
|
92
92
|
Fully non-blocking; every failure path falls through with no output.
|
|
93
93
|
|
|
94
|
+
### Step 1.55: Architecture-Map Drift Check
|
|
95
|
+
|
|
96
|
+
Surface — never block — when this repo's generated `.claude/architecture/` maps have
|
|
97
|
+
gone stale (a mapped module's source was committed past the SHA stamped in
|
|
98
|
+
`.codebyplan/architecture.json`). Runs after the infra-drift check (Step 1.5) and may add
|
|
99
|
+
one line to the Step 6 output. This is the freshness nudge for the architecture-map
|
|
100
|
+
pipeline (mirrors the infra-drift pattern; the analog for first-party code maps):
|
|
101
|
+
|
|
102
|
+
- **No manifest** — `.codebyplan/architecture.json` absent → skip silently (the repo has
|
|
103
|
+
no maps yet; nothing to drift-check).
|
|
104
|
+
- **Manifest present** — run the drift probe best-effort and count drifted modules:
|
|
105
|
+
|
|
106
|
+
```bash
|
|
107
|
+
npx codebyplan arch-map drift 2>/dev/null | grep -c '^[[:space:]]*DRIFTED' || true
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
If the count is `> 0`, hold this single line for Step 6:
|
|
111
|
+
|
|
112
|
+
```
|
|
113
|
+
⚠ .claude/architecture is N module(s) stale — run /cbp-refresh-arch-map
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
A count of `0` (all maps fresh, no stamped modules, or any probe failure) emits nothing.
|
|
117
|
+
|
|
118
|
+
Fully non-blocking; every failure path falls through with no output. The `arch-map` CLI is
|
|
119
|
+
itself hook-safe (exits 0 on any internal error), so a missing or too-old `codebyplan`
|
|
120
|
+
binary simply yields a zero count and no line.
|
|
121
|
+
|
|
94
122
|
### Step 1.6: Package Freshness Gate
|
|
95
123
|
|
|
96
|
-
Check whether a newer `codebyplan` is published and safe to auto-install on this worktree's current branch. Runs AFTER the
|
|
124
|
+
Check whether a newer `codebyplan` is published and safe to auto-install on this worktree's current branch. Runs AFTER the architecture-map drift check (Step 1.55) and BEFORE session activation (Step 3).
|
|
97
125
|
|
|
98
126
|
```bash
|
|
99
127
|
VERSION_JSON=$(npx codebyplan version-status 2>/dev/null)
|
|
@@ -231,6 +259,9 @@ Session active | Worktree: [worktree_id or "unregistered"]
|
|
|
231
259
|
|
|
232
260
|
[⚠ resolve-worktree: <error_kind> — local state is broken; routing may be unreliable. Run `npx codebyplan setup` to repair. — only when error_kind is non-null and not tuple_miss]
|
|
233
261
|
|
|
262
|
+
[⚠ .claude/ infra is N behind — run /cbp-refresh-infra — only when Step 1.5 found drift]
|
|
263
|
+
[⚠ .claude/architecture is N module(s) stale — run /cbp-refresh-arch-map — only when Step 1.55 found drift]
|
|
264
|
+
|
|
234
265
|
Previous session: [title or "none"]
|
|
235
266
|
Pending: [pending items from previous log, or "—"]
|
|
236
267
|
|
|
@@ -257,7 +288,7 @@ Three-branch gate using `owned_count` and `total_count` from Step 5.8:
|
|
|
257
288
|
|
|
258
289
|
- **Triggered by**: user invocation, `/clear` recovery
|
|
259
290
|
- **Resolves**: `npx codebyplan resolve-worktree --json` (worktree id + distress signal; non-tuple-miss distress is non-blocking at session-start)
|
|
260
|
-
- **Reads**: `.codebyplan/repo.json`, `.codebyplan/git.json` (`branch_config.production` for the Step 1.4 home-branch fast-forward), MCP `health_check` (Step 0 hard gate — stays MCP unconditionally); local-first reads (with `npx codebyplan sync` + MCP break-glass): `.codebyplan/state/session/current.json` (Step 4 previous log + Step 4.5 handoff probe), `.codebyplan/state/checkpoints/<id>.json` / `tasks/<id>.json` / `rounds/<id>.json` (Step 4.5 freshness probe), `.codebyplan/state/todos.json` (Step 5.7 active-task lookup); MCP `get_checkpoints({ repo_id, status: 'active' })` (Step 5.8 ownership partition — MCP only, no local mirror for active-filter query); `scripts/infra-drift.mjs` + a best-effort `git fetch` (Step 1.5 monorepo drift); `npx codebyplan version-status` (Step 1.6 package-freshness gate); `npx codebyplan lsp --check` (Step 1.7 LSP binary nudge — reads `.codebyplan/lsp.json`, non-blocking). Reads at Step 3 and later do NOT fire on a Step 0 MCP hard-fail or the Step 1.6 update-and-halt path
|
|
291
|
+
- **Reads**: `.codebyplan/repo.json`, `.codebyplan/git.json` (`branch_config.production` for the Step 1.4 home-branch fast-forward), MCP `health_check` (Step 0 hard gate — stays MCP unconditionally); local-first reads (with `npx codebyplan sync` + MCP break-glass): `.codebyplan/state/session/current.json` (Step 4 previous log + Step 4.5 handoff probe), `.codebyplan/state/checkpoints/<id>.json` / `tasks/<id>.json` / `rounds/<id>.json` (Step 4.5 freshness probe), `.codebyplan/state/todos.json` (Step 5.7 active-task lookup); MCP `get_checkpoints({ repo_id, status: 'active' })` (Step 5.8 ownership partition — MCP only, no local mirror for active-filter query); `scripts/infra-drift.mjs` + a best-effort `git fetch` (Step 1.5 monorepo drift); `npx codebyplan arch-map drift` + `.codebyplan/architecture.json` presence (Step 1.55 architecture-map drift nudge, non-blocking); `npx codebyplan version-status` (Step 1.6 package-freshness gate); `npx codebyplan lsp --check` (Step 1.7 LSP binary nudge — reads `.codebyplan/lsp.json`, non-blocking). Reads at Step 3 and later do NOT fire on a Step 0 MCP hard-fail or the Step 1.6 update-and-halt path
|
|
261
292
|
- **Writes**: `codebyplan session create-log` (Step 5 — CLI write-through; break-glass: MCP `create_session_log`), `codebyplan session update-state --action activate` (Step 3 — CLI write-through to `.codebyplan/state/session/state.json`; break-glass: MCP `update_session_state`) — both SKIPPED on a Step 0 MCP hard-fail and on the Step 1.6 update-and-halt path
|
|
262
293
|
- **Spawns**: none
|
|
263
294
|
- **Triggers**: `/cbp-git-commit` (conditional, on user approval at Step 5.7 or the Step 1.6 update path), `handoff.command` (on fresh handoff hit at Step 4.5), `/cbp-todo` (auto fall-through when owned_count >= 1 or total_count === 0; STOPS with no trigger when total_count >= 1 AND owned_count === 0; NOT triggered on a Step 0 hard-fail or the Step 1.6 update-and-halt path)
|