@misterhuydo/cairn-mcp 1.10.0 → 1.14.0
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/README.md +70 -4
- package/bin/cairn-cli.js +408 -342
- package/index.js +10 -6
- package/package.json +1 -1
- package/src/graph/cwd.js +81 -31
- package/src/graph/db.js +9 -0
- package/src/tools/memo.js +31 -26
- package/src/tools/resume.js +30 -38
- package/src/tools/roadmap.js +267 -63
- package/src/tools/roadmapCapture.js +341 -0
- package/src/tools/roadmapFile.js +178 -0
- package/test/cairn-cli.test.js +43 -0
- package/test/cwd.test.js +36 -0
- package/test/resume-roadmap.test.js +95 -0
- package/test/roadmap-capture.test.js +262 -0
- package/test/roadmap.test.js +196 -2
- package/test/roadmapFile.test.js +246 -0
package/README.md
CHANGED
|
@@ -33,10 +33,15 @@ Restart Claude Code once after running this — required for the MCP server to l
|
|
|
33
33
|
## Upgrade
|
|
34
34
|
|
|
35
35
|
```bash
|
|
36
|
-
npm install -g @misterhuydo/cairn-mcp
|
|
36
|
+
npm install -g @misterhuydo/cairn-mcp@latest
|
|
37
|
+
cairn install
|
|
37
38
|
```
|
|
38
39
|
|
|
39
|
-
|
|
40
|
+
Updating the package replaces only the binary. Re-run `cairn install` to re-sync the
|
|
41
|
+
hook set — a release that adds new hooks (e.g. the roadmap-capture hooks) won't wire
|
|
42
|
+
them otherwise. It's idempotent and additive, so your MCP config and any existing
|
|
43
|
+
hooks are preserved. Restart Claude Code once afterward so the new hooks and MCP
|
|
44
|
+
server load.
|
|
40
45
|
|
|
41
46
|
---
|
|
42
47
|
|
|
@@ -46,8 +51,10 @@ No need to re-run `cairn install` — hooks and MCP config carry over between ve
|
|
|
46
51
|
|---|---|---|
|
|
47
52
|
| `PreToolUse[Read]` | Every file read | Source files compressed ~68% before Claude sees them; large files show structural outline with **line numbers** to save tokens |
|
|
48
53
|
| `PreToolUse[Edit]` | Every file edit | Blocks Edit if Claude only saw compressed content — requires a full re-read first |
|
|
49
|
-
| `
|
|
50
|
-
| `
|
|
54
|
+
| `PostToolUse[ExitPlanMode]` | A plan is approved | The plan is parsed into `### Phase N` entries in `.cairn/roadmap.md`, synced, and the cursor activated |
|
|
55
|
+
| `PostToolUse[TodoWrite]` | The todo list changes | Todos mirror onto the roadmap as sub-tasks under the current phase (or seed root phases if none exist) |
|
|
56
|
+
| `Stop` | End of every response | Session auto-saved to `.cairn/session.json`, Claude auto-memory backed up to `.cairn/memory/`, the roadmap re-surfaced, and any git-detected completed phases surfaced for you to confirm — all in one line |
|
|
57
|
+
| `UserPromptSubmit` | First message of a new session | Fresh project: Claude prompted to run `cairn_maintain`. Returning session: Claude prompted to run `cairn_resume`. Memory restored from `.cairn/memory/` if the Claude store is empty (new machine / fresh clone) |
|
|
51
58
|
|
|
52
59
|
---
|
|
53
60
|
|
|
@@ -74,6 +81,7 @@ No manual steps. The index lives in `.cairn/index.db` inside your project — li
|
|
|
74
81
|
| `cairn_code_graph` | Dependency health — instability, cycles, load-bearing modules |
|
|
75
82
|
| `cairn_security` | Scan for XSS, SQLi, hardcoded secrets, weak crypto, and more |
|
|
76
83
|
| `cairn_todos` | Scan codebase for TODO/FIXME/HACK comments, add manual items, resolve and list them |
|
|
84
|
+
| `cairn_roadmap` | The active project plan: phases authored in `.cairn/roadmap.md`, with a cursor, dependencies, and auto-pruning of shipped phases into `.cairn/roadmap_completed.md` |
|
|
77
85
|
| `cairn_bundle` | Minified source snapshot (auto-handled by hooks) |
|
|
78
86
|
| `cairn_checkpoint` | Save session state (auto-handled by hooks) |
|
|
79
87
|
| `cairn_minify` | Minify a single file on demand (fallback when hooks are not installed) |
|
|
@@ -133,6 +141,64 @@ Stats are included automatically in `cairn_maintain` (`todos_found`) and `cairn_
|
|
|
133
141
|
|
|
134
142
|
---
|
|
135
143
|
|
|
144
|
+
## Roadmap
|
|
145
|
+
|
|
146
|
+
TODOs are a long-tail backlog; the **roadmap** is the active plan. It's a first-class
|
|
147
|
+
document at `.cairn/roadmap.md` (not a memory) — a `## Phases` section of
|
|
148
|
+
`### Phase N: title` blocks, plus whatever overview prose you like:
|
|
149
|
+
|
|
150
|
+
```markdown
|
|
151
|
+
## Phases
|
|
152
|
+
|
|
153
|
+
### Phase 1: Decouple roadmap from memory
|
|
154
|
+
Move phases out of decision memos into this file.
|
|
155
|
+
|
|
156
|
+
### Phase 2: Completed log
|
|
157
|
+
Prune shipped phases, append them to roadmap_completed.md.
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
`cairn_roadmap` reads that file and tracks it:
|
|
161
|
+
|
|
162
|
+
```
|
|
163
|
+
cairn_roadmap { action: "tree" } → render the plan (auto-syncs roadmap.md)
|
|
164
|
+
cairn_roadmap { action: "next" } → advance the cursor to the next actionable phase
|
|
165
|
+
cairn_roadmap { action: "focus", id: 3 } → make phase 3 the current focus
|
|
166
|
+
cairn_roadmap { action: "set_status", id: 3, status: "done" } → ship it
|
|
167
|
+
cairn_roadmap { action: "add", parent: 3, text: "..." } → ad-hoc sub-task under a phase
|
|
168
|
+
cairn_roadmap { action: "deps_add", from: 2, to: 4 } → phase 2 blocks phase 4
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
Editing `roadmap.md` *is* editing the plan — read actions re-seed from it, and the
|
|
172
|
+
end-of-turn hook folds in any hand-edits. Marking a phase **done** prunes it from
|
|
173
|
+
`roadmap.md` and appends it to the append-only `.cairn/roadmap_completed.md`, so the
|
|
174
|
+
file always shows only what's next. The shipped phase stays in the database (counted
|
|
175
|
+
in the `M/N done` rollup, recoverable) but is hidden from the tree.
|
|
176
|
+
|
|
177
|
+
If a project still has its roadmap in the old `decision_production_roadmap.md` memo,
|
|
178
|
+
the first roadmap read migrates it automatically: the content moves to
|
|
179
|
+
`.cairn/roadmap.md` and the memo (plus its index entry) is removed from the memory
|
|
180
|
+
store. Content is preserved verbatim; the migration is one-time and idempotent.
|
|
181
|
+
|
|
182
|
+
### Automatic capture
|
|
183
|
+
|
|
184
|
+
You don't have to register phases by hand. Two `PostToolUse` hooks fold work into
|
|
185
|
+
the roadmap mechanically:
|
|
186
|
+
|
|
187
|
+
- **Approve a plan** (Claude's plan mode → `ExitPlanMode`) and its steps are parsed
|
|
188
|
+
into `### Phase N` entries in `roadmap.md`. Headings become phases; failing that, a
|
|
189
|
+
top-level numbered list; failing that, the whole plan becomes one phase. Duplicate
|
|
190
|
+
titles are skipped, and the cursor activates so the roadmap surfaces immediately.
|
|
191
|
+
- **Write a todo list** (`TodoWrite`) and the items mirror onto the roadmap — as
|
|
192
|
+
ad-hoc sub-tasks under the current phase, or as seed root phases when no roadmap
|
|
193
|
+
exists yet. A sub-task that's already `done` is never downgraded.
|
|
194
|
+
|
|
195
|
+
Completion is **proposed, never auto-applied**. The end-of-turn hook inspects new git
|
|
196
|
+
commits; when a commit references a phase (explicit `phase N`, or a strong overlap
|
|
197
|
+
with the phase title) the candidate is surfaced for you to confirm — Claude asks
|
|
198
|
+
before calling `set_status … done`, so a stray keyword can't silently prune your plan.
|
|
199
|
+
|
|
200
|
+
---
|
|
201
|
+
|
|
136
202
|
## Supported languages
|
|
137
203
|
|
|
138
204
|
| Language | What Cairn extracts |
|