@flyingrobots/graft 0.4.0 → 0.5.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/ARCHITECTURE.md +386 -0
- package/CHANGELOG.md +47 -0
- package/CODE_OF_CONDUCT.md +65 -0
- package/README.md +153 -17
- package/bin/graft.js +4 -14
- package/docs/ADVANCED_GUIDE.md +49 -0
- package/docs/CLI.md +43 -0
- package/docs/GUIDE.md +321 -32
- package/docs/MCP.md +44 -0
- package/package.json +15 -4
- package/src/adapters/node-fs.ts +4 -0
- package/src/adapters/node-git.ts +47 -0
- package/src/adapters/node-process-runner.ts +27 -0
- package/src/cli/index-cmd.ts +75 -11
- package/src/cli/init.ts +808 -57
- package/src/cli/main.ts +437 -0
- package/src/contracts/capabilities.ts +341 -0
- package/src/contracts/causal-ontology.ts +622 -0
- package/src/contracts/causal-surface-next-action.ts +18 -0
- package/src/contracts/output-schemas.ts +1169 -0
- package/src/git/diff.ts +25 -21
- package/src/git/target-git-hook-bootstrap.ts +56 -0
- package/src/hooks/posttooluse-read.ts +21 -74
- package/src/hooks/pretooluse-read.ts +20 -56
- package/src/hooks/read-governor.ts +95 -0
- package/src/hooks/read-messages.ts +53 -0
- package/src/mcp/burden.ts +123 -0
- package/src/mcp/cache.ts +51 -0
- package/src/mcp/cached-file.ts +10 -8
- package/src/mcp/context.ts +65 -2
- package/src/mcp/daemon-control-plane.ts +554 -0
- package/src/mcp/daemon-job-scheduler.ts +279 -0
- package/src/mcp/daemon-repos.ts +216 -0
- package/src/mcp/daemon-server.ts +396 -0
- package/src/mcp/daemon-worker-pool.ts +310 -0
- package/src/mcp/daemon-worker-process.ts +52 -0
- package/src/mcp/metrics.ts +108 -1
- package/src/mcp/monitor-tick-job.ts +99 -0
- package/src/mcp/persisted-local-history.ts +1246 -0
- package/src/mcp/persistent-monitor-runtime.ts +549 -0
- package/src/mcp/policy.ts +84 -0
- package/src/mcp/receipt.ts +82 -12
- package/src/mcp/repo-concurrency.ts +318 -0
- package/src/mcp/repo-state.ts +777 -0
- package/src/mcp/repo-tool-job.ts +302 -0
- package/src/mcp/run-capture-config.ts +33 -0
- package/src/mcp/runtime-causal-context.ts +72 -0
- package/src/mcp/runtime-observability.ts +219 -0
- package/src/mcp/runtime-staged-target.ts +161 -0
- package/src/mcp/runtime-workspace-overlay.ts +255 -0
- package/src/mcp/semantic-transition-guidance.ts +60 -0
- package/src/mcp/semantic-transition-summary.ts +130 -0
- package/src/mcp/server.ts +696 -55
- package/src/mcp/stdio-server.ts +12 -0
- package/src/mcp/stdio.ts +2 -5
- package/src/mcp/tools/activity-view.ts +325 -0
- package/src/mcp/tools/causal-attach.ts +67 -0
- package/src/mcp/tools/causal-status.ts +58 -0
- package/src/mcp/tools/changed-since.ts +13 -11
- package/src/mcp/tools/code-find.ts +164 -0
- package/src/mcp/tools/code-refs.ts +466 -0
- package/src/mcp/tools/code-show.ts +252 -0
- package/src/mcp/tools/daemon-monitors.ts +14 -0
- package/src/mcp/tools/daemon-repos.ts +22 -0
- package/src/mcp/tools/daemon-sessions.ts +14 -0
- package/src/mcp/tools/daemon-status.ts +12 -0
- package/src/mcp/tools/doctor.ts +45 -2
- package/src/mcp/tools/explain.ts +4 -0
- package/src/mcp/tools/file-outline.ts +7 -3
- package/src/mcp/tools/git-files.ts +73 -0
- package/src/mcp/tools/graft-diff.ts +12 -4
- package/src/mcp/tools/map.ts +92 -38
- package/src/mcp/tools/monitor-pause.ts +18 -0
- package/src/mcp/tools/monitor-resume.ts +18 -0
- package/src/mcp/tools/monitor-start.ts +20 -0
- package/src/mcp/tools/monitor-stop.ts +18 -0
- package/src/mcp/tools/precision-match.ts +51 -0
- package/src/mcp/tools/precision-query.ts +127 -0
- package/src/mcp/tools/precision.ts +312 -0
- package/src/mcp/tools/run-capture.ts +126 -44
- package/src/mcp/tools/safe-read.ts +14 -12
- package/src/mcp/tools/since.ts +7 -2
- package/src/mcp/tools/state.ts +11 -3
- package/src/mcp/tools/stats.ts +5 -1
- package/src/mcp/tools/workspace-authorizations.ts +14 -0
- package/src/mcp/tools/workspace-authorize.ts +20 -0
- package/src/mcp/tools/workspace-bind.ts +25 -0
- package/src/mcp/tools/workspace-rebind.ts +25 -0
- package/src/mcp/tools/workspace-revoke.ts +18 -0
- package/src/mcp/tools/workspace-status.ts +12 -0
- package/src/mcp/warp-pool.ts +36 -0
- package/src/mcp/workspace-router.ts +984 -0
- package/src/operations/file-outline.ts +12 -2
- package/src/operations/graft-diff.ts +56 -10
- package/src/operations/safe-read.ts +27 -4
- package/src/operations/state.ts +6 -9
- package/src/parser/lang.ts +19 -3
- package/src/parser/outline.ts +191 -2
- package/src/parser/types.ts +9 -1
- package/src/policy/types.ts +4 -3
- package/src/ports/filesystem.ts +1 -0
- package/src/ports/git.ts +16 -0
- package/src/ports/process-runner.ts +22 -0
- package/src/release/security-gate.ts +102 -0
- package/src/session/tracker.ts +31 -0
- package/src/version.ts +3 -0
- package/src/warp/indexer.ts +171 -56
- package/src/warp/observers.ts +1 -1
- package/src/warp/open.ts +4 -3
- package/src/warp/plumbing.d.ts +5 -1
- package/src/warp/writer-id.ts +30 -0
package/README.md
CHANGED
|
@@ -8,6 +8,8 @@ structurally correct view of a codebase instead of dumping entire
|
|
|
8
8
|
files into their context window. Agent-first, but the structural
|
|
9
9
|
tools (outlines, diffs, symbol history) are useful to anyone.
|
|
10
10
|
|
|
11
|
+
**v0.5.0** — bounded between-commit activity for humans and agents.
|
|
12
|
+
|
|
11
13
|
## Why
|
|
12
14
|
|
|
13
15
|
Empirical analysis of 1,091 real coding sessions ([Blacklight](https://github.com/flyingrobots/blacklight)) found
|
|
@@ -42,7 +44,27 @@ npx @flyingrobots/graft init
|
|
|
42
44
|
|
|
43
45
|
Scaffolds `.graftignore`, adds `.graft/` to `.gitignore`, generates
|
|
44
46
|
a `CLAUDE.md` snippet telling agents to prefer graft tools, and
|
|
45
|
-
prints Claude Code hook config.
|
|
47
|
+
prints Claude Code hook / MCP config for manual setup.
|
|
48
|
+
|
|
49
|
+
If you use Codex, the explicit `--write-codex-mcp` path also seeds
|
|
50
|
+
`AGENTS.md` so the repo has both the MCP wiring and the instruction
|
|
51
|
+
layer that tells Codex to prefer graft reads. It also writes a larger
|
|
52
|
+
Codex `startup_timeout_sec` because cold `npx` startup can exceed the
|
|
53
|
+
default 30 second MCP budget.
|
|
54
|
+
|
|
55
|
+
For a project-local one-step bootstrap, use explicit write flags:
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
npx @flyingrobots/graft init --write-claude-mcp --write-claude-hooks
|
|
59
|
+
npx @flyingrobots/graft init --write-cursor-mcp
|
|
60
|
+
npx @flyingrobots/graft init --write-windsurf-mcp
|
|
61
|
+
npx @flyingrobots/graft init --write-continue-mcp
|
|
62
|
+
npx @flyingrobots/graft init --write-cline-mcp
|
|
63
|
+
npx @flyingrobots/graft init --write-codex-mcp
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
These writes are idempotent. Existing JSON / TOML config is merged
|
|
67
|
+
without duplicating graft entries.
|
|
46
68
|
|
|
47
69
|
Then add graft to your MCP config:
|
|
48
70
|
|
|
@@ -51,18 +73,45 @@ Then add graft to your MCP config:
|
|
|
51
73
|
"mcpServers": {
|
|
52
74
|
"graft": {
|
|
53
75
|
"command": "npx",
|
|
54
|
-
"args": ["-y", "@flyingrobots/graft"]
|
|
76
|
+
"args": ["-y", "@flyingrobots/graft", "serve"]
|
|
55
77
|
}
|
|
56
78
|
}
|
|
57
79
|
}
|
|
58
80
|
```
|
|
59
81
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
82
|
+
The MCP server works with Codex, Claude Code, Cursor, Windsurf,
|
|
83
|
+
Continue, Cline, and any MCP-compatible client. Governed native-read
|
|
84
|
+
behavior differs by client: Claude has hook guardrails, Codex now has
|
|
85
|
+
repo-local `AGENTS.md` bootstrap guidance, and the other clients remain
|
|
86
|
+
MCP-plus-instructions rather than true default-governed reads.
|
|
87
|
+
|
|
88
|
+
Supported deployment posture today is local-user:
|
|
89
|
+
|
|
90
|
+
- repo-local `serve` remains the standard editor bootstrap path
|
|
91
|
+
- `graft daemon` now exists as a separate same-user local runtime on a
|
|
92
|
+
Unix socket or Windows named pipe
|
|
93
|
+
|
|
94
|
+
The daemon still follows a stricter contract than repo-local stdio:
|
|
95
|
+
daemon sessions start unbound, workspace binding is the authorization
|
|
96
|
+
event, `/healthz` is the liveness surface, and escape hatches like
|
|
97
|
+
`run_capture` stay default-denied there unless a workspace is
|
|
98
|
+
explicitly authorized for that posture through the daemon control
|
|
99
|
+
plane. Daemon-wide inspection now exists through MCP tools such as
|
|
100
|
+
`daemon_status`, `daemon_repos`, `daemon_sessions`,
|
|
101
|
+
`workspace_authorizations`, and `daemon_monitors`. Repo-scoped
|
|
102
|
+
background WARP indexing can now be controlled there too through
|
|
103
|
+
`monitor_start`, `monitor_pause`, `monitor_resume`, and `monitor_stop`.
|
|
104
|
+
|
|
105
|
+
See the **[Setup decision table](docs/GUIDE.md#choose-your-setup-path)**
|
|
106
|
+
for the fastest path by client and mode, and the full
|
|
107
|
+
**[Setup Guide](docs/GUIDE.md)** for per-editor instructions, Claude
|
|
108
|
+
Code hooks, `.graftignore` configuration, troubleshooting, and
|
|
109
|
+
details on what the agent experiences. For release-facing operator
|
|
110
|
+
surfaces, see **[CLI Guide](docs/CLI.md)**,
|
|
111
|
+
**[MCP Guide](docs/MCP.md)**, and **[Advanced Guide](docs/ADVANCED_GUIDE.md)**.
|
|
112
|
+
Contributors should also read **[Architecture](ARCHITECTURE.md)** for
|
|
113
|
+
the runtime systems map and **[Code of Conduct](CODE_OF_CONDUCT.md)**
|
|
114
|
+
for project participation expectations.
|
|
66
115
|
|
|
67
116
|
## What it does
|
|
68
117
|
|
|
@@ -82,12 +131,20 @@ When an agent asks to read a file, Graft applies policy:
|
|
|
82
131
|
- **Budget governor** — agent declares a byte budget, thresholds
|
|
83
132
|
tighten as it drains. No single read may consume more than 5% of
|
|
84
133
|
remaining budget.
|
|
134
|
+
- **Structural memory** — WARP-backed structural history across git
|
|
135
|
+
commits. Query what changed structurally without reading files.
|
|
85
136
|
- **Tripwires** signal when the session is going off the rails.
|
|
86
|
-
- **Receipts** on every response with
|
|
87
|
-
analysis.
|
|
137
|
+
- **Receipts** on every response with session/trace correlation,
|
|
138
|
+
latency, and compression ratio for usage analysis.
|
|
139
|
+
- **MCP runtime observability** — metadata-only session and tool-call
|
|
140
|
+
logs under `.graft/logs/mcp-runtime.ndjson`.
|
|
141
|
+
- **Versioned schemas** on every machine-readable MCP / CLI payload.
|
|
142
|
+
- **Between-commit activity view** — bounded local `artifact_history`
|
|
143
|
+
over recent continuity, transitions, staging, and reads, anchored
|
|
144
|
+
to the current commit when possible.
|
|
88
145
|
|
|
89
146
|
Every decision is logged. Every refusal is explainable. All output
|
|
90
|
-
is structured JSON.
|
|
147
|
+
is structured JSON with versioned `_schema` metadata.
|
|
91
148
|
|
|
92
149
|
## Tools
|
|
93
150
|
|
|
@@ -96,15 +153,21 @@ is structured JSON.
|
|
|
96
153
|
| `safe_read` | Policy-enforced file read (content, outline, refusal, or diff) |
|
|
97
154
|
| `file_outline` | Structural skeleton with jump table |
|
|
98
155
|
| `read_range` | Bounded range read (max 250 lines), policy-gated |
|
|
99
|
-
| `graft_diff` | Structural diff between git refs with per-file summary lines |
|
|
156
|
+
| `graft_diff` | Structural diff between git refs with per-file summary lines and explicit denied-file reporting |
|
|
157
|
+
| `graft_since` | Structural changes since a git ref — symbols added/removed/changed with explicit denied-file reporting |
|
|
158
|
+
| `graft_map` | Structural map of a directory — all files and symbols in one call, with explicit denied-file reporting |
|
|
159
|
+
| `code_show` | Focus on a symbol by name — get its source code in one call |
|
|
160
|
+
| `code_find` | Search symbols across the project by approximate name or glob, with optional kind/path filters |
|
|
161
|
+
| `code_refs` | Search import sites, callsites, property access, or literal text references with explicit text-fallback provenance |
|
|
100
162
|
| `changed_since` | Check if a file changed since last read (peek or consume) |
|
|
101
|
-
| `run_capture` |
|
|
163
|
+
| `run_capture` | Diagnostic shell-output escape hatch — tail to agent, optional redacted log persistence, explicit enable/disable posture, outside bounded-read policy, with explicit `policyBoundary` marker |
|
|
102
164
|
| `state_save` | Save session working state (max 8 KB) |
|
|
103
165
|
| `state_load` | Restore session working state |
|
|
104
166
|
| `set_budget` | Declare session byte budget — governor tightens as it drains |
|
|
167
|
+
| `activity_view` | Recent bounded local `artifact_history` for the active workspace, with current commit anchor, grouped activity, and degraded posture |
|
|
105
168
|
| `explain` | Human-readable help for any reason code |
|
|
106
|
-
| `doctor` | Runtime health check |
|
|
107
|
-
| `stats` | Decision metrics summary |
|
|
169
|
+
| `doctor` | Runtime health check with burden summary and layered-worldline state |
|
|
170
|
+
| `stats` | Decision metrics summary with cumulative burden-by-kind totals |
|
|
108
171
|
|
|
109
172
|
## Claude Code hooks
|
|
110
173
|
|
|
@@ -141,12 +204,60 @@ calls — a safety net for when agents bypass graft's tools:
|
|
|
141
204
|
```
|
|
142
205
|
|
|
143
206
|
Add to `.claude/settings.json` in your project root.
|
|
144
|
-
**PreToolUse** blocks banned files
|
|
145
|
-
|
|
207
|
+
**PreToolUse** blocks banned files and redirects large JS/TS reads to
|
|
208
|
+
`safe_read` before native `Read` can dump them into context.
|
|
209
|
+
**PostToolUse** is the backstop: it reports what `safe_read` would have
|
|
210
|
+
saved when an oversized code read still slips through.
|
|
146
211
|
|
|
147
212
|
See the **[Setup Guide](docs/GUIDE.md)** for full details on hooks,
|
|
148
213
|
per-editor MCP config, `.graftignore`, and troubleshooting.
|
|
149
214
|
|
|
215
|
+
## CLI
|
|
216
|
+
|
|
217
|
+
```bash
|
|
218
|
+
npx @flyingrobots/graft init
|
|
219
|
+
npx @flyingrobots/graft init --write-claude-mcp --write-claude-hooks
|
|
220
|
+
npx @flyingrobots/graft init --write-cursor-mcp
|
|
221
|
+
npx @flyingrobots/graft init --write-windsurf-mcp
|
|
222
|
+
npx @flyingrobots/graft init --write-continue-mcp
|
|
223
|
+
npx @flyingrobots/graft init --write-cline-mcp
|
|
224
|
+
npx @flyingrobots/graft init --write-codex-mcp
|
|
225
|
+
npx @flyingrobots/graft serve
|
|
226
|
+
npx @flyingrobots/graft index
|
|
227
|
+
npx @flyingrobots/graft read safe src/app.ts --json
|
|
228
|
+
npx @flyingrobots/graft read outline README.md --json
|
|
229
|
+
npx @flyingrobots/graft read range src/app.ts --start 10 --end 40 --json
|
|
230
|
+
npx @flyingrobots/graft read changed src/app.ts --json
|
|
231
|
+
npx @flyingrobots/graft struct diff --json
|
|
232
|
+
npx @flyingrobots/graft struct since HEAD~3 --json
|
|
233
|
+
npx @flyingrobots/graft struct map src --json
|
|
234
|
+
npx @flyingrobots/graft symbol show createServer --path src/mcp/server.ts --json
|
|
235
|
+
npx @flyingrobots/graft symbol find 'create*' --json
|
|
236
|
+
npx @flyingrobots/graft diag activity --json
|
|
237
|
+
npx @flyingrobots/graft diag doctor --json
|
|
238
|
+
npx @flyingrobots/graft diag explain CONTENT --json
|
|
239
|
+
npx @flyingrobots/graft diag stats --json
|
|
240
|
+
npx @flyingrobots/graft diag capture --tail 20 -- pnpm test --json
|
|
241
|
+
```
|
|
242
|
+
|
|
243
|
+
The CLI now mirrors the core MCP product surface through grouped
|
|
244
|
+
namespaces:
|
|
245
|
+
- `read` for bounded reads
|
|
246
|
+
- `struct` for structural navigation
|
|
247
|
+
- `symbol` for precision lookup
|
|
248
|
+
- `diag` for diagnostics
|
|
249
|
+
|
|
250
|
+
`init` and `index` remain explicit CLI-only commands. MCP responses and
|
|
251
|
+
CLI peer commands both carry versioned `_schema` metadata, and declared
|
|
252
|
+
output contracts live in `src/contracts/output-schemas.ts`.
|
|
253
|
+
|
|
254
|
+
`run_capture` remains an explicit shell escape hatch. For shared or
|
|
255
|
+
release-sensitive environments, you can disable it with
|
|
256
|
+
`GRAFT_ENABLE_RUN_CAPTURE=0`. Persisted capture logs can be disabled
|
|
257
|
+
with `GRAFT_RUN_CAPTURE_PERSIST=0`, and persisted output is redacted for
|
|
258
|
+
obvious secret-shaped values by default. In the local daemon runtime,
|
|
259
|
+
`run_capture` remains opt-in rather than ambiently available.
|
|
260
|
+
|
|
150
261
|
## Reason codes
|
|
151
262
|
|
|
152
263
|
Every refusal or policy decision includes a machine-readable reason
|
|
@@ -158,6 +269,7 @@ code. Use `explain(code)` to get meaning and recommended action.
|
|
|
158
269
|
| `OUTLINE` | File exceeds thresholds — structural outline returned |
|
|
159
270
|
| `SESSION_CAP` | Session-depth byte cap triggered |
|
|
160
271
|
| `BUDGET_CAP` | Budget-proportional cap triggered |
|
|
272
|
+
| `UNSUPPORTED_LANGUAGE` | No parser-backed outline for this file type |
|
|
161
273
|
| `BINARY` | Binary file refused |
|
|
162
274
|
| `LOCKFILE` | Machine-generated lockfile refused |
|
|
163
275
|
| `MINIFIED` | Minified file refused |
|
|
@@ -168,3 +280,27 @@ code. Use `explain(code)` to get meaning and recommended action.
|
|
|
168
280
|
## License
|
|
169
281
|
|
|
170
282
|
Apache 2.0 — see [LICENSE](LICENSE).
|
|
283
|
+
|
|
284
|
+
---
|
|
285
|
+
|
|
286
|
+
```ts
|
|
287
|
+
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
|
|
288
|
+
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
|
|
289
|
+
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣴⣾⣿⣿⣿⣿⣷⣄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
|
|
290
|
+
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣀⣀⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣿⣿⣿⣿⣿⣿⣿⣿⠿⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
|
|
291
|
+
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢸⣿⣿⣿⣶⡄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢸⣿⣿⠁⠀⠀⠀⠀⠀⠀⠀⠀⢀⣴⣆⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
|
|
292
|
+
⠀⠀⠀⠀⠀⠀⢀⣤⣴⣶⣶⣶⣶⣦⣤⣼⣿⣿⣿⣿⣿⠀⢠⣶⣶⣦⡀⠀⢀⣴⣶⣶⣤⠀⠀⠀⠀⣀⣤⣴⣶⣶⣶⣶⣦⣄⠀⠀⠀⠀⠀⠀⠀⠈⣿⣿⡄⠀⣀⣀⣠⣤⠀⠀⢀⣾⣿⣿⣀⣀⣀⣤⣤⣄⠀⠀⠀⠀⠀⠀
|
|
293
|
+
⠀⠀⠀⠀⠀⣴⣿⣿⠛⠉⠉⠉⠛⠿⣿⣿⣿⡿⠉⠉⠀⠀⢻⣿⣿⣿⣇⠀⣾⣿⣿⣿⣿⡇⠀⢠⣾⣿⣿⣿⡿⠟⠛⢻⣿⣿⣷⠀⠀⠀⠀⠀⣠⣾⣿⣿⣿⣿⣿⣿⣿⣿⠀⢠⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠀⠀⠀⠀⠀⠀
|
|
294
|
+
⠀⠀⠀⠀⢸⣿⣿⣇⠀⠀⠀⠀⠀⠀⠘⣿⣿⡇⠀⠀⠀⠀⠈⢿⣿⣿⣿⢠⡿⠛⠛⠿⠟⠁⠀⢺⣿⣿⡿⠋⠀⠀⠀⣸⣿⣿⣿⡀⠀⠀⠀⠀⠛⠿⢿⣿⣿⠟⠛⠛⠛⠛⠀⠘⠻⠿⢿⣿⣿⠛⠛⠛⠛⠋⠀⠀⠀⠀⠀⠀
|
|
295
|
+
⠀⠀⠀⠀⠸⣿⣿⣿⣆⠀⠀⠀⠀⠀⠀⣿⣿⡇⠀⠀⠀⠀⠀⠀⢻⣿⣿⣿⠁⠀⠀⠀⠀⠀⠀⠀⠉⠉⠀⠀⠀⣠⣾⠟⢻⣿⣿⡇⠀⠀⠀⠀⠀⠀⠈⣿⣿⡆⠀⠀⠀⠀⠀⠀⠀⠀⢸⣿⣿⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
|
|
296
|
+
⠀⠀⠀⠀⠀⠙⢿⣿⣿⣿⣶⣤⣤⣤⣾⣿⠟⠀⠀⠀⠀⠀⠀⠀⠀⢻⣿⣿⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣠⣾⡿⠋⠀⢸⣿⣿⡇⠀⢀⣤⡀⠀⠀⠀⣿⣿⣿⠀⠀⠀⠀⠀⠀⠀⠀⢸⣿⣿⡆⠀⠀⠀⢀⣀⡀⠀⠀⠀⠀
|
|
297
|
+
⠀⠀⠀⠀⠀⠀⠀⣨⣿⡿⠟⠛⠛⠛⠋⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣿⣿⡆⠀⠀⠀⠀⠀⠀⠀⠀⢠⣾⣿⡏⠀⠀⠀⢸⣿⣿⡇⠀⢸⣿⡇⠀⠀⠀⢻⣿⣿⣇⠀⠀⠀⠀⠀⠀⠀⢸⣿⣿⣇⠀⠀⠀⢸⣿⣿⠀⠀⠀⠀
|
|
298
|
+
⠀⠀⠀⠀⠀⠀⣼⣿⣿⡀⠀⢀⣀⣀⣤⣤⣤⣴⣦⣤⣄⠀⠀⠀⠀⢰⣿⣿⣷⠀⠀⠀⠀⠀⠀⠀⠀⢾⣿⣿⣇⠀⠀⣠⣿⢻⣿⣿⡀⣸⣿⡇⠀⠀⠀⠸⣿⣿⣿⡄⠀⠀⠀⠀⠀⠀⠀⣿⣿⣿⣦⣀⣠⣾⣿⡟⠀⠀⠀⠀
|
|
299
|
+
⠀⠀⠀⠀⠀⠀⠹⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣇⠀⠀⠀⢸⣿⣿⣿⡆⠀⠀⠀⠀⠀⠀⠀⠘⣿⣿⣿⣿⣿⣿⠏⠀⢿⣿⣿⣿⣿⠇⠀⠀⠀⠀⣿⣿⣿⣧⠀⠀⠀⠀⠀⠀⠀⠘⢿⣿⣿⣿⣿⣿⣿⠃⠀⠀⠀⠀
|
|
300
|
+
⠀⠀⠀⠀⠀⠀⠀⢀⣼⣿⠟⠉⠁⠀⠀⠀⠀⠀⢻⣿⣿⡟⠀⠀⠀⠈⠉⠉⠉⠁⠀⠀⠀⠀⠀⠀⠀⠀⠈⠙⠛⠛⠛⠁⠀⠀⠀⠙⠛⠛⠁⠀⠀⠀⠀⠀⣿⣿⣿⣿⡆⠀⠀⠀⠀⠀⠀⠀⠀⠙⠛⠛⠛⠋⠁⠀⠀⠀⠀⠀
|
|
301
|
+
⠀⠀⠀⠀⠀⠀⢠⣿⣿⣿⠀⠀⠀⠀⠀⠀⠀⢀⣾⣿⡿⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢸⣿⣿⣿⣷⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
|
|
302
|
+
⠀⠀⠀⠀⠀⠀⠈⢿⣿⣿⣷⣤⣤⣤⣤⣤⣾⣿⡿⠋⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠘⣿⣿⣿⣿⠆⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
|
|
303
|
+
⠀⠀⠀⠀⠀⠀⠀⠀⠙⠛⠻⠿⠿⠿⠛⠛⠋⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠙⠿⠿⠋⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
|
|
304
|
+
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
|
|
305
|
+
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
|
|
306
|
+
```
|
package/bin/graft.js
CHANGED
|
@@ -13,20 +13,10 @@ const require = createRequire(import.meta.url);
|
|
|
13
13
|
|
|
14
14
|
// If already running under tsx, proceed directly
|
|
15
15
|
if (process.env.__GRAFT_TSX_LOADED === "1") {
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
} else if (command === "index") {
|
|
21
|
-
const { runIndex } = await import("../src/cli/index-cmd.js");
|
|
22
|
-
await runIndex();
|
|
23
|
-
} else {
|
|
24
|
-
const { createGraftServer } = await import("../src/mcp/server.js");
|
|
25
|
-
const { StdioServerTransport } = await import("@modelcontextprotocol/sdk/server/stdio.js");
|
|
26
|
-
const graft = createGraftServer();
|
|
27
|
-
const transport = new StdioServerTransport();
|
|
28
|
-
await graft.getMcpServer().connect(transport);
|
|
29
|
-
}
|
|
16
|
+
const { resolveEntrypointArgs, runCli } = await import("../src/cli/main.js");
|
|
17
|
+
await runCli({
|
|
18
|
+
args: resolveEntrypointArgs(process.argv.slice(2), process.stdin.isTTY, process.stdout.isTTY),
|
|
19
|
+
});
|
|
30
20
|
} else {
|
|
31
21
|
// Re-exec with tsx loader from our own node_modules
|
|
32
22
|
const tsxPath = require.resolve("tsx/esm");
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# Advanced Guide
|
|
2
|
+
|
|
3
|
+
This guide is the release-facing signpost for operators and
|
|
4
|
+
contributors who need more than setup instructions.
|
|
5
|
+
|
|
6
|
+
## Use this guide for
|
|
7
|
+
|
|
8
|
+
- understanding the same-user local daemon posture
|
|
9
|
+
- understanding hook/bootstrap coverage and degraded footing
|
|
10
|
+
- understanding the boundary between bounded local `artifact_history`
|
|
11
|
+
and canonical provenance
|
|
12
|
+
- understanding why release prep pauses the repo after a cycle close
|
|
13
|
+
|
|
14
|
+
## Current advanced topics
|
|
15
|
+
|
|
16
|
+
### Daemon posture
|
|
17
|
+
|
|
18
|
+
`graft daemon` is a same-user local runtime with explicit workspace
|
|
19
|
+
authorization, session binding, monitor control, and bounded daemon
|
|
20
|
+
inspection surfaces.
|
|
21
|
+
|
|
22
|
+
### Reactive footing
|
|
23
|
+
|
|
24
|
+
Checkout-boundary footing is explicit. Graft can report installed hook
|
|
25
|
+
coverage, hook-observed transitions, and degraded posture when local
|
|
26
|
+
edit watchers are absent.
|
|
27
|
+
|
|
28
|
+
### Same-repo concurrency
|
|
29
|
+
|
|
30
|
+
Graft now distinguishes bounded same-repo postures such as
|
|
31
|
+
`exclusive`, `shared_repo_only`, `shared_worktree`,
|
|
32
|
+
`overlapping_actors`, and `divergent_checkout` without pretending
|
|
33
|
+
multi-writer provenance already exists.
|
|
34
|
+
|
|
35
|
+
### Between-commit activity
|
|
36
|
+
|
|
37
|
+
`activity_view` and `graft diag activity` expose bounded local
|
|
38
|
+
between-commit `artifact_history`. This is not canonical provenance
|
|
39
|
+
and not causal collapse.
|
|
40
|
+
|
|
41
|
+
## Related docs
|
|
42
|
+
|
|
43
|
+
- [README](../README.md)
|
|
44
|
+
- [Setup Guide](GUIDE.md)
|
|
45
|
+
- [CLI Guide](CLI.md)
|
|
46
|
+
- [MCP Guide](MCP.md)
|
|
47
|
+
- [Architecture](../ARCHITECTURE.md)
|
|
48
|
+
- [Bearing](BEARING.md)
|
|
49
|
+
- [Vision](VISION.md)
|
package/docs/CLI.md
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# CLI Guide
|
|
2
|
+
|
|
3
|
+
This is the shortest operator-facing guide to Graft's CLI surface.
|
|
4
|
+
|
|
5
|
+
Use the CLI when you want the same bounded product surfaces without
|
|
6
|
+
attaching a separate MCP client.
|
|
7
|
+
|
|
8
|
+
## What it is for
|
|
9
|
+
|
|
10
|
+
- bootstrap and setup via `graft init`
|
|
11
|
+
- local debugging and dogfooding of MCP peer commands
|
|
12
|
+
- human-facing inspection of bounded state such as:
|
|
13
|
+
- `graft diag activity`
|
|
14
|
+
- `graft diag doctor`
|
|
15
|
+
- `graft diag stats`
|
|
16
|
+
|
|
17
|
+
## Core namespaces
|
|
18
|
+
|
|
19
|
+
- `read` — bounded reads and change checks
|
|
20
|
+
- `struct` — structural diff / since / map
|
|
21
|
+
- `symbol` — precision show / find
|
|
22
|
+
- `diag` — activity, doctor, explain, stats, capture
|
|
23
|
+
|
|
24
|
+
## Release-facing commands
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
graft diag activity --json
|
|
28
|
+
graft diag doctor --json
|
|
29
|
+
graft symbol find 'create*' --json
|
|
30
|
+
graft struct diff --json
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
`graft diag activity` is the current human-facing between-commit
|
|
34
|
+
surface. It reports bounded local `artifact_history`, not canonical
|
|
35
|
+
provenance.
|
|
36
|
+
|
|
37
|
+
## Related docs
|
|
38
|
+
|
|
39
|
+
- [README](../README.md)
|
|
40
|
+
- [Setup Guide](GUIDE.md)
|
|
41
|
+
- [MCP Guide](MCP.md)
|
|
42
|
+
- [Advanced Guide](ADVANCED_GUIDE.md)
|
|
43
|
+
- [Architecture](../ARCHITECTURE.md)
|