@getripple/cli 1.0.8 → 1.0.9

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 CHANGED
@@ -1,467 +1,207 @@
1
1
  # @getripple/cli
2
2
 
3
- Plan before edit. Check after edit. Catch drift. Tell the agent what to fix.
3
+ **The human, hook, and CI enforcer for Ripple's local authorization gate for AI coding agents.**
4
4
 
5
- **Terminal and CI interface for Ripple's local drift-control gate for AI coding agents.**
5
+ `@getripple/cli` initializes Ripple in a repository, installs the local Git
6
+ gate, powers CI checks, and gives humans a way to audit or debug agent work.
6
7
 
7
- `@getripple/cli` is the command-line interface for Ripple. Use it when you want to plan before an AI coding agent edits, check after edit, catch drift, and tell the agent what to fix.
8
-
9
- Ripple helps agents work inside a human-approved boundary:
10
-
11
- ```txt
12
- plan before edit
13
- save intent
14
- check after edit
15
- catch drift
16
- tell the agent what to fix
17
- continue / repair / human review
18
- ```
19
-
20
- The CLI is best for:
8
+ Most AI-agent workflows should use `@getripple/mcp` for planning and gate
9
+ decisions. The CLI is the enforcement surface around that workflow:
21
10
 
22
11
  ```txt
23
- terminal workflows
24
- CI gates
25
- release checks
26
- local repo scanning
27
- human-controlled agent workflows
12
+ MCP plans.
13
+ Agent edits.
14
+ CLI hook gates the commit.
15
+ CLI CI gate audits the pull request.
16
+ Human reviews only when the boundary breaks.
28
17
  ```
29
18
 
30
- For MCP-compatible AI agents, use `@getripple/mcp`.
31
-
32
19
  ---
33
20
 
34
- ## 60-Second Start
21
+ ## Install Once
35
22
 
36
- Initialize Ripple in a repo:
23
+ Run this at the root of a Git repository:
37
24
 
38
25
  ```bash
39
26
  npx -y @getripple/cli init
40
27
  ```
41
28
 
42
- Create a saved intent before editing:
43
-
44
- ```bash
45
- npx -y @getripple/cli plan \
46
- --file src/auth.ts \
47
- --task "refactor token handling" \
48
- --mode file \
49
- --agent \
50
- --save
51
- ```
52
-
53
- Let your AI coding agent edit the code, then stage the intended files:
54
-
55
- ```bash
56
- git add src/auth.ts
57
- ```
58
-
59
- Ask Ripple whether work may continue:
60
-
61
- ```bash
62
- npx -y @getripple/cli gate --intent latest
63
- ```
64
-
65
- If the agent stayed inside the saved plan, Ripple returns:
66
-
67
- ```txt
68
- continue
69
- ```
70
-
71
- If the agent crossed the boundary, Ripple returns:
29
+ `ripple init` creates the local control layer:
72
30
 
73
- ```txt
74
- repair
75
- ```
31
+ - `.ripple/policy.json` with repo trust defaults from local project signals.
32
+ - `.github/workflows/ripple.yml` for pull request gating.
33
+ - `.ripple/.cache/` in `.gitignore`.
34
+ - A managed Ripple section in `AGENTS.md`, `CLAUDE.md`, or `.cursorrules`.
35
+ - Pre-commit and post-commit hook blocks that check active agent intents.
76
36
 
77
- or:
37
+ After that, connect the MCP server to your agent:
78
38
 
79
- ```txt
80
- human-review
39
+ ```json
40
+ {
41
+ "mcpServers": {
42
+ "ripple": {
43
+ "command": "npx",
44
+ "args": [
45
+ "-y",
46
+ "@getripple/mcp",
47
+ "--workspace",
48
+ "/absolute/path/to/your/repo"
49
+ ]
50
+ }
51
+ }
52
+ }
81
53
  ```
82
54
 
83
- with the exact reason and next action.
55
+ You should not need to manually run `ripple plan` for normal MCP-capable agent
56
+ work. The agent should call Ripple MCP tools before and after editing.
84
57
 
85
58
  ---
86
59
 
87
- ## Why This Exists
88
-
89
- AI coding agents can edit quickly.
60
+ ## What The CLI Enforces
90
61
 
91
- The hard question is not only:
62
+ When an active local intent exists, the pre-commit hook runs:
92
63
 
93
- ```txt
94
- Is the code good?
95
- ```
96
-
97
- The deeper question is:
98
-
99
- ```txt
100
- Was the agent allowed to make this change?
64
+ ```bash
65
+ ripple gate --staged --intent latest --agent --strict
101
66
  ```
102
67
 
103
- Ripple keeps a local record of what the human approved, then checks the actual staged changes against that approval.
68
+ If the staged diff crosses the approved boundary, Ripple blocks the commit and
69
+ prints a review packet.
104
70
 
105
71
  Example:
106
72
 
107
73
  ```txt
108
- Approved:
109
- - src/auth.ts
74
+ [RIPPLE STOP] Commit blocked by Ripple active-intent boundary.
110
75
 
111
- Agent changed:
112
- - src/auth.ts
113
- - src/payments/webhook.ts
76
+ Decision: human-review
77
+ Can continue: no
78
+ Must stop: yes
114
79
 
115
- Ripple:
116
- human-review — agent changed a file outside the approved boundary
117
- ```
118
-
119
- Ripple does not replace tests, code review, or human judgment.
120
-
121
- Ripple checks whether the agent stayed inside the work it was trusted to do.
122
-
123
- ---
124
-
125
- ## Install
80
+ Allowed:
81
+ - src/auth.ts::refreshToken
126
82
 
127
- Use with `npx`:
83
+ Changed outside boundary:
84
+ - symbol: src/auth.ts::login
128
85
 
129
- ```bash
130
- npx -y @getripple/cli doctor
86
+ Fix now:
87
+ - Undo or replan unapproved symbol: src/auth.ts::login
88
+ - Ask the human to approve a wider boundary before keeping these changes.
131
89
  ```
132
90
 
133
- Or install globally:
91
+ Ripple does not silently delete code. It stops the workflow and tells the agent
92
+ or human exactly what crossed the boundary.
134
93
 
135
- ```bash
136
- npm install -g @getripple/cli
137
- ```
138
-
139
- Then run:
94
+ Human developers can intentionally bypass local hooks with:
140
95
 
141
96
  ```bash
142
- ripple init
143
- ripple doctor
144
- ripple plan --file src/auth.ts --task "refactor token handling" --mode file --agent --save
145
- ripple check --staged --agent --intent latest
146
- ripple gate --intent latest
97
+ git commit --no-verify
147
98
  ```
148
99
 
149
- ---
150
-
151
- ## Core Workflow
152
-
153
- ```txt
154
- 1. Initialize Ripple
155
- 2. Plan before edit
156
- 3. Save the human-approved intent
157
- 4. Let the agent edit
158
- 5. Stage the intended files
159
- 6. Check after edit
160
- 7. Catch drift
161
- 8. Tell the agent what to fix
162
- 9. Continue, repair, or ask the human
163
- ```
100
+ Ripple is a control system, not a prison.
164
101
 
165
102
  ---
166
103
 
167
- ## 1. Initialize
168
-
169
- ```bash
170
- ripple init
171
- ```
104
+ ## CI Gate
172
105
 
173
- Creates local workflow and CI files:
106
+ `ripple init` writes a GitHub Actions workflow at:
174
107
 
175
108
  ```txt
176
- .ripple/policy.json repo trust defaults
177
- .github/workflows/ripple.yml GitHub Actions gate
178
- .gitignore .ripple/.cache/ hygiene
179
- .ripple/.cache/graph.cache.json local graph cache after scan
109
+ .github/workflows/ripple.yml
180
110
  ```
181
111
 
182
- Normal CLI `scan`, `check`, and `gate` runs stay lean. They do not dump broad agent files unless you ask.
183
-
184
- Generate file-based agent instructions explicitly:
112
+ You can also generate or refresh it explicitly:
185
113
 
186
114
  ```bash
187
- ripple workflow
115
+ ripple init-ci
188
116
  ```
189
117
 
190
- MCP-capable agents should prefer `@getripple/mcp` instead of reading generated files.
191
-
192
- ---
193
-
194
- ## 2. Plan Before Edit
118
+ Run the CI gate manually:
195
119
 
196
120
  ```bash
197
- ripple plan \
198
- --file src/auth.ts \
199
- --task "refactor token handling" \
200
- --mode file \
201
- --agent \
202
- --save
121
+ ripple ci --base origin/main --intent latest --github-annotations
203
122
  ```
204
123
 
205
- This creates a saved intent.
206
-
207
- The saved intent tells Ripple:
124
+ The CI gate emits GitHub annotations for:
208
125
 
209
126
  ```txt
210
- what task was approved
211
- which file or symbol may change
212
- which files are context only
213
- which tests should be verified
214
- which human gate applies
127
+ intent drift
128
+ boundary drift
129
+ contract drift
130
+ policy drift
131
+ readiness drift
132
+ verification gaps
215
133
  ```
216
134
 
217
- The saved intent becomes the trust boundary for the agent's work.
135
+ It exits non-zero when work should not merge.
218
136
 
219
137
  ---
220
138
 
221
- ## 3. Check After Edit
139
+ ## Readiness And Debugging
222
140
 
223
- After the agent edits code and you stage the intended files:
141
+ Manual CLI usage is not the main product loop. It is available for humans,
142
+ scripts, hooks, CI, and debugging.
224
143
 
225
144
  ```bash
226
- git add src/auth.ts
227
- ripple check --staged --agent --intent latest
228
- ```
229
-
230
- For the compact continue/stop decision:
231
-
232
- ```bash
233
- ripple gate --intent latest
234
- ```
235
-
236
- `ripple gate` answers one question:
237
-
238
- ```txt
239
- Can the agent continue?
145
+ npm install -g @getripple/cli
146
+ ripple doctor # check repository readiness
147
+ ripple gate # ask the compact continue/stop question
148
+ ripple audit # generate a fuller review packet
149
+ ripple history # inspect recent architectural history
240
150
  ```
241
151
 
242
- ---
243
-
244
- ## 4. Catch Drift
245
-
246
- Ripple checks two forms of drift:
152
+ Useful debugging commands:
247
153
 
248
154
  ```txt
249
- intent drift -> did the edit leave the saved task?
250
- boundary drift -> did the edit cross the chosen freedom level?
155
+ ripple scan refresh local graph data
156
+ ripple focus show focused context for a file
157
+ ripple blast show files affected by a target file
158
+ ripple symbols show exported symbols for a file
159
+ ripple verify record verification evidence on an intent
160
+ ripple repair get concrete repair actions after drift
251
161
  ```
252
162
 
253
- If the agent stayed inside the approved work, Ripple allows the workflow to continue.
254
-
255
- If the agent crossed the approved work, Ripple returns a repair or human-review decision.
256
-
257
- ---
258
-
259
- ## 5. Tell the Agent What to Fix
260
-
261
- When drift is found, Ripple gives the agent a concrete handoff:
262
-
263
- ```txt
264
- what changed
265
- why it is risky
266
- what must be undone
267
- what needs verification
268
- when to ask the human
269
- ```
270
-
271
- For detailed repair actions:
272
-
273
- ```bash
274
- ripple repair --agent --intent latest
275
- ```
276
-
277
- Repair may tell the agent to:
278
-
279
- ```txt
280
- unstage an unplanned file
281
- undo a symbol outside the approved boundary
282
- review a possible public contract change
283
- run a verification target
284
- create a wider intent if the task expanded
285
- ask the human for approval
286
- ```
163
+ Use these when you are inspecting a failure, wiring automation, or building a
164
+ custom workflow. They are not meant to be busywork for every normal agent edit.
287
165
 
288
166
  ---
289
167
 
290
168
  ## Trust Boundaries
291
169
 
292
- Choose how much freedom the agent gets when you plan:
293
-
294
- | Mode | Boundary |
295
- | ------------ | -------------------------------------------- |
296
- | `brainstorm` | No edits allowed. Suggest and explain only. |
297
- | `function` | Only the approved symbol may change. |
298
- | `file` | Only the selected file may change. |
299
- | `task` | Files in the saved task plan may change. |
300
- | `pr` | Full task scope. Human reviews before merge. |
170
+ Ripple stores the freedom level the agent was given before editing.
301
171
 
302
- Example function boundary:
172
+ | Mode | Agent is allowed to |
173
+ | --- | --- |
174
+ | `brainstorm` | Suggest and explain only. No edits. |
175
+ | `function` | Edit only the approved symbol. |
176
+ | `file` | Edit only the approved file. |
177
+ | `task` | Edit files in the saved task plan. |
178
+ | `pr` | Complete low-risk PR work for human review before merge. |
303
179
 
304
- ```bash
305
- ripple plan \
306
- --file src/auth.ts \
307
- --symbol refreshToken \
308
- --task "fix retry behavior" \
309
- --mode function \
310
- --agent \
311
- --save
312
- ```
313
-
314
- If `function` mode approves only `refreshToken` but the agent also changes `login`, Ripple stops the workflow and tells the agent what to fix.
180
+ When an MCP agent calls `ripple_plan_context`, it chooses one of these control
181
+ modes and saves the active intent. The CLI hook and CI gate then enforce that
182
+ saved boundary against the real Git diff.
315
183
 
316
184
  ---
317
185
 
318
- ## Gate Decisions
319
-
320
- `ripple gate` is the command an agent or CI system should obey:
321
-
322
- ```bash
323
- ripple gate --intent latest
324
- ```
325
-
326
- Example output:
327
-
328
- ```txt
329
- STOP: agent crossed approved function boundary.
330
-
331
- Allowed:
332
- - src/auth.ts::refreshToken
333
-
334
- Changed outside boundary:
335
- - src/auth.ts::login
336
-
337
- Fix:
338
- - undo src/auth.ts::login
339
- - or create a wider human-approved intent
340
- ```
341
-
342
- Machine-readable output includes:
343
-
344
- ```json
345
- {
346
- "status": "closed",
347
- "decision": "human-review",
348
- "canContinue": false,
349
- "mustStop": true,
350
- "needsHuman": true,
351
- "why": ["Changed symbol outside approved boundary: src/auth.ts::login"],
352
- "fixNow": ["Undo src/auth.ts::login or replan with human approval."]
353
- }
354
- ```
355
-
356
- Agent rule:
357
-
358
- ```txt
359
- canContinue=true -> continue after required verification
360
- mustStop=true -> stop and follow fixNow
361
- needsHuman=true -> ask the human; do not self-approve
362
- ```
363
-
364
- ---
365
-
366
- ## Check and Repair
367
-
368
- For detailed drift information:
369
-
370
- ```bash
371
- ripple check --staged --agent --intent latest
372
- ```
373
-
374
- For concrete repair actions:
375
-
376
- ```bash
377
- ripple repair --agent --intent latest
378
- ```
379
-
380
- Use `check` when you want evidence.
381
-
382
- Use `gate` when you want a compact decision.
383
-
384
- Use `repair` when the agent needs exact next actions.
385
-
386
- ---
186
+ ## Verification Evidence
387
187
 
388
- ## CI Gate
188
+ Ripple can treat missing, failed, skipped, or stale verification as a stop
189
+ condition.
389
190
 
390
- Generate the workflow:
191
+ From the CLI, record verification with:
391
192
 
392
193
  ```bash
393
- ripple init-ci
194
+ ripple verify --run "npm test -- tests/auth.test.ts" --intent latest
394
195
  ```
395
196
 
396
- Run the gate in CI:
197
+ or report evidence from an external runner:
397
198
 
398
199
  ```bash
399
- ripple ci --base origin/main --intent latest --github-annotations
400
- ```
401
-
402
- The CI gate emits GitHub annotations for:
403
-
404
- ```txt
405
- intent drift
406
- boundary drift
407
- contract drift
408
- policy drift
409
- readiness drift
200
+ ripple verify --command "npm test -- tests/auth.test.ts" --status passed --intent latest
410
201
  ```
411
202
 
412
- It exits non-zero when work must not merge.
413
-
414
- ---
415
-
416
- ## Useful Commands
417
-
418
- ```txt
419
- ripple init initialize policy, CI, git hygiene, and graph cache
420
- ripple doctor check project readiness
421
- ripple scan refresh the local graph cache
422
- ripple workflow generate .ripple/WORKFLOW.md for file-based agents
423
- ripple plan plan context before editing and optionally save intent
424
- ripple check check staged or changed files against saved intent
425
- ripple audit audit a completed change for drift signals
426
- ripple repair get concrete repair actions
427
- ripple gate compact continue/stop decision
428
- ripple approval check saved human gate status
429
- ripple approve record human approval for a gate
430
- ripple ci run the CI gate against a base ref
431
- ripple agent print the agent workflow guide
432
- ripple focus show focused context for a file
433
- ripple blast show files affected by a target file
434
- ripple imports show files imported by a target file
435
- ripple importers show files that import a target file
436
- ripple symbols show exported symbols for a file
437
- ripple callers show callers of a symbol
438
- ripple history show recent architectural history
439
- ripple policy init create repo trust policy
440
- ripple policy explain explain active policy for a file
441
- ```
442
-
443
- ---
444
-
445
- ## Example Agent Loop
446
-
447
- A safe CLI-based agent workflow should look like this:
448
-
449
- ```txt
450
- 1. Run ripple doctor
451
- 2. Run ripple plan with --save
452
- 3. Read the suggested context
453
- 4. Edit only inside the approved boundary
454
- 5. Stage the intended files
455
- 6. Run ripple check --staged
456
- 7. Run ripple gate
457
- 8. Continue, repair, or stop based on the gate
458
- ```
459
-
460
- If `mustStop=true`, the agent must stop.
461
-
462
- If `needsHuman=true`, the agent must ask the human.
463
-
464
- If `canContinue=true`, the agent may continue only after required verification passes.
203
+ After verification evidence is recorded, run the gate again so the final
204
+ continue/stop decision includes that evidence.
465
205
 
466
206
  ---
467
207
 
@@ -476,6 +216,7 @@ Ripple may create local workflow state in the target repo:
476
216
  .ripple/approvals/
477
217
  .ripple/.cache/
478
218
  .github/workflows/ripple.yml
219
+ AGENTS.md / CLAUDE.md / .cursorrules
479
220
  ```
480
221
 
481
222
  Recommended git behavior:
@@ -483,48 +224,43 @@ Recommended git behavior:
483
224
  ```txt
484
225
  commit: .ripple/policy.json
485
226
  commit: .github/workflows/ripple.yml
227
+ commit: agent instruction files if your team wants shared agent rules
486
228
  commit: .ripple/intents/ only if your team wants saved intent records
487
229
  ignore: .ripple/.cache/
488
230
  ```
489
231
 
490
232
  `.ripple/.cache/` is machine cache.
491
233
 
492
- Policy, CI, intents, and approvals are workflow/audit state.
493
-
494
234
  ---
495
235
 
496
- ## MCP
236
+ ## Relationship To MCP
497
237
 
498
- For MCP-compatible AI agents, use:
238
+ Use `@getripple/mcp` when you want agents to call Ripple directly.
499
239
 
500
- ```bash
501
- npx -y @getripple/mcp --workspace /absolute/path/to/your/repo
502
- ```
240
+ Use `@getripple/cli` when you want:
503
241
 
504
- The CLI is best for terminal, CI, scripts, and human-controlled workflows.
242
+ ```txt
243
+ repo initialization
244
+ Git hook enforcement
245
+ CI gates
246
+ terminal audits
247
+ debugging commands
248
+ release proofs
249
+ ```
505
250
 
506
- The MCP server is best when the agent should call Ripple tools directly.
251
+ The two packages are meant to work together.
507
252
 
508
253
  ---
509
254
 
510
255
  ## Language Support
511
256
 
512
- Strongest today:
257
+ | Language | Status |
258
+ | --- | --- |
259
+ | TypeScript / JavaScript | Deep support for imports, exports, symbols, callers, staged drift, and blast radius |
260
+ | Python | Basic support for imports, functions, classes, methods, and file-level staged checks |
513
261
 
514
- ```txt
515
- JavaScript
516
- TypeScript
517
- ```
518
-
519
- Basic support:
520
-
521
- ```txt
522
- Python imports
523
- Python functions
524
- Python classes
525
- Python methods
526
- file-level staged checks
527
- ```
262
+ Ripple uses static analysis. It can miss runtime-only behavior, dynamic imports,
263
+ reflection, decorators, generated code, and framework-specific magic.
528
264
 
529
265
  ---
530
266
 
@@ -533,35 +269,26 @@ file-level staged checks
533
269
  Ripple runs locally.
534
270
 
535
271
  ```txt
536
- No account required
537
- No telemetry
538
- No cloud indexing
539
- No code upload
540
- No remote model call required
272
+ No account required.
273
+ No telemetry.
274
+ No cloud indexing.
275
+ No code upload.
276
+ No remote model call required.
541
277
  ```
542
278
 
543
- Your repo is scanned on your machine.
279
+ Your repository is scanned on your machine.
544
280
 
545
281
  ---
546
282
 
547
- ## Status
283
+ ## Honest Limits
548
284
 
549
- Public alpha.
550
-
551
- Ripple is a strong local signal and gate.
552
-
553
- It is not:
554
-
555
- ```txt
556
- a sandbox
557
- a test replacement
558
- a typechecker replacement
559
- a code review replacement
560
- a CI replacement
561
- a human judgment replacement
562
- ```
285
+ Ripple is deterministic infrastructure, not a magical AI wrapper.
563
286
 
564
- Ripple helps you check whether an AI coding agent stayed inside the work it was trusted to do.
287
+ - Ripple is not a coding agent.
288
+ - Ripple is not a sandbox.
289
+ - Ripple relies on standard Git hooks, which humans can intentionally bypass.
290
+ - Ripple uses static analysis.
291
+ - Ripple does not replace your compiler, test suite, code review, or judgment.
565
292
 
566
293
  ---
567
294