@patze/code-cli 0.10.2
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/CHANGELOG.md +92 -0
- package/NOTICE.md +17 -0
- package/README.md +177 -0
- package/VERSION +1 -0
- package/bin/patze.mjs +7 -0
- package/dist/backend/auth.d.ts +13 -0
- package/dist/backend/auth.d.ts.map +1 -0
- package/dist/backend/auth.js +12 -0
- package/dist/backend/auth.js.map +1 -0
- package/dist/backend/client.d.ts +14 -0
- package/dist/backend/client.d.ts.map +1 -0
- package/dist/backend/client.js +51 -0
- package/dist/backend/client.js.map +1 -0
- package/dist/backend/preview-client.d.ts +33 -0
- package/dist/backend/preview-client.d.ts.map +1 -0
- package/dist/backend/preview-client.js +104 -0
- package/dist/backend/preview-client.js.map +1 -0
- package/dist/backend/preview-payload.d.ts +50 -0
- package/dist/backend/preview-payload.d.ts.map +1 -0
- package/dist/backend/preview-payload.js +92 -0
- package/dist/backend/preview-payload.js.map +1 -0
- package/dist/cli/argv.d.ts +10 -0
- package/dist/cli/argv.d.ts.map +1 -0
- package/dist/cli/argv.js +67 -0
- package/dist/cli/argv.js.map +1 -0
- package/dist/cli/commands/apply-format.d.ts +12 -0
- package/dist/cli/commands/apply-format.d.ts.map +1 -0
- package/dist/cli/commands/apply-format.js +50 -0
- package/dist/cli/commands/apply-format.js.map +1 -0
- package/dist/cli/commands/apply.d.ts +14 -0
- package/dist/cli/commands/apply.d.ts.map +1 -0
- package/dist/cli/commands/apply.js +256 -0
- package/dist/cli/commands/apply.js.map +1 -0
- package/dist/cli/commands/approve-format.d.ts +4 -0
- package/dist/cli/commands/approve-format.d.ts.map +1 -0
- package/dist/cli/commands/approve-format.js +40 -0
- package/dist/cli/commands/approve-format.js.map +1 -0
- package/dist/cli/commands/approve.d.ts +19 -0
- package/dist/cli/commands/approve.d.ts.map +1 -0
- package/dist/cli/commands/approve.js +91 -0
- package/dist/cli/commands/approve.js.map +1 -0
- package/dist/cli/commands/code.d.ts +4 -0
- package/dist/cli/commands/code.d.ts.map +1 -0
- package/dist/cli/commands/code.js +57 -0
- package/dist/cli/commands/code.js.map +1 -0
- package/dist/cli/commands/diff-format.d.ts +12 -0
- package/dist/cli/commands/diff-format.d.ts.map +1 -0
- package/dist/cli/commands/diff-format.js +151 -0
- package/dist/cli/commands/diff-format.js.map +1 -0
- package/dist/cli/commands/diff.d.ts +22 -0
- package/dist/cli/commands/diff.d.ts.map +1 -0
- package/dist/cli/commands/diff.js +101 -0
- package/dist/cli/commands/diff.js.map +1 -0
- package/dist/cli/commands/doctor.d.ts +6 -0
- package/dist/cli/commands/doctor.d.ts.map +1 -0
- package/dist/cli/commands/doctor.js +99 -0
- package/dist/cli/commands/doctor.js.map +1 -0
- package/dist/cli/commands/goal-format.d.ts +3 -0
- package/dist/cli/commands/goal-format.d.ts.map +1 -0
- package/dist/cli/commands/goal-format.js +32 -0
- package/dist/cli/commands/goal-format.js.map +1 -0
- package/dist/cli/commands/goal.d.ts +28 -0
- package/dist/cli/commands/goal.d.ts.map +1 -0
- package/dist/cli/commands/goal.js +80 -0
- package/dist/cli/commands/goal.js.map +1 -0
- package/dist/cli/commands/inspect-format.d.ts +6 -0
- package/dist/cli/commands/inspect-format.d.ts.map +1 -0
- package/dist/cli/commands/inspect-format.js +62 -0
- package/dist/cli/commands/inspect-format.js.map +1 -0
- package/dist/cli/commands/inspect.d.ts +7 -0
- package/dist/cli/commands/inspect.d.ts.map +1 -0
- package/dist/cli/commands/inspect.js +11 -0
- package/dist/cli/commands/inspect.js.map +1 -0
- package/dist/cli/commands/login.d.ts +4 -0
- package/dist/cli/commands/login.d.ts.map +1 -0
- package/dist/cli/commands/login.js +21 -0
- package/dist/cli/commands/login.js.map +1 -0
- package/dist/cli/commands/plan-format.d.ts +7 -0
- package/dist/cli/commands/plan-format.d.ts.map +1 -0
- package/dist/cli/commands/plan-format.js +48 -0
- package/dist/cli/commands/plan-format.js.map +1 -0
- package/dist/cli/commands/plan.d.ts +13 -0
- package/dist/cli/commands/plan.d.ts.map +1 -0
- package/dist/cli/commands/plan.js +64 -0
- package/dist/cli/commands/plan.js.map +1 -0
- package/dist/cli/commands/runs.d.ts +5 -0
- package/dist/cli/commands/runs.d.ts.map +1 -0
- package/dist/cli/commands/runs.js +25 -0
- package/dist/cli/commands/runs.js.map +1 -0
- package/dist/cli/commands/session-snapshot-format.d.ts +3 -0
- package/dist/cli/commands/session-snapshot-format.d.ts.map +1 -0
- package/dist/cli/commands/session-snapshot-format.js +5 -0
- package/dist/cli/commands/session-snapshot-format.js.map +1 -0
- package/dist/cli/commands/status-format.d.ts +11 -0
- package/dist/cli/commands/status-format.d.ts.map +1 -0
- package/dist/cli/commands/status-format.js +57 -0
- package/dist/cli/commands/status-format.js.map +1 -0
- package/dist/cli/commands/status.d.ts +4 -0
- package/dist/cli/commands/status.d.ts.map +1 -0
- package/dist/cli/commands/status.js +12 -0
- package/dist/cli/commands/status.js.map +1 -0
- package/dist/cli/commands/trust-loop-snapshot.d.ts +3 -0
- package/dist/cli/commands/trust-loop-snapshot.d.ts.map +1 -0
- package/dist/cli/commands/trust-loop-snapshot.js +125 -0
- package/dist/cli/commands/trust-loop-snapshot.js.map +1 -0
- package/dist/cli/commands/verify-drift-guard.d.ts +2 -0
- package/dist/cli/commands/verify-drift-guard.d.ts.map +1 -0
- package/dist/cli/commands/verify-drift-guard.js +11 -0
- package/dist/cli/commands/verify-drift-guard.js.map +1 -0
- package/dist/cli/commands/verify.d.ts +12 -0
- package/dist/cli/commands/verify.d.ts.map +1 -0
- package/dist/cli/commands/verify.js +62 -0
- package/dist/cli/commands/verify.js.map +1 -0
- package/dist/cli/help.d.ts +3 -0
- package/dist/cli/help.d.ts.map +1 -0
- package/dist/cli/help.js +36 -0
- package/dist/cli/help.js.map +1 -0
- package/dist/cli/interactive/agent-turn-format.d.ts +15 -0
- package/dist/cli/interactive/agent-turn-format.d.ts.map +1 -0
- package/dist/cli/interactive/agent-turn-format.js +70 -0
- package/dist/cli/interactive/agent-turn-format.js.map +1 -0
- package/dist/cli/interactive/agent-turn.d.ts +9 -0
- package/dist/cli/interactive/agent-turn.d.ts.map +1 -0
- package/dist/cli/interactive/agent-turn.js +103 -0
- package/dist/cli/interactive/agent-turn.js.map +1 -0
- package/dist/cli/interactive/header.d.ts +4 -0
- package/dist/cli/interactive/header.d.ts.map +1 -0
- package/dist/cli/interactive/header.js +28 -0
- package/dist/cli/interactive/header.js.map +1 -0
- package/dist/cli/interactive/permissions-command.d.ts +15 -0
- package/dist/cli/interactive/permissions-command.d.ts.map +1 -0
- package/dist/cli/interactive/permissions-command.js +88 -0
- package/dist/cli/interactive/permissions-command.js.map +1 -0
- package/dist/cli/interactive/permissions-format.d.ts +18 -0
- package/dist/cli/interactive/permissions-format.d.ts.map +1 -0
- package/dist/cli/interactive/permissions-format.js +142 -0
- package/dist/cli/interactive/permissions-format.js.map +1 -0
- package/dist/cli/interactive/permissions-keys.d.ts +5 -0
- package/dist/cli/interactive/permissions-keys.d.ts.map +1 -0
- package/dist/cli/interactive/permissions-keys.js +58 -0
- package/dist/cli/interactive/permissions-keys.js.map +1 -0
- package/dist/cli/interactive/session-state.d.ts +68 -0
- package/dist/cli/interactive/session-state.d.ts.map +1 -0
- package/dist/cli/interactive/session-state.js +2 -0
- package/dist/cli/interactive/session-state.js.map +1 -0
- package/dist/cli/interactive/session.d.ts +71 -0
- package/dist/cli/interactive/session.d.ts.map +1 -0
- package/dist/cli/interactive/session.js +244 -0
- package/dist/cli/interactive/session.js.map +1 -0
- package/dist/cli/interactive/shell.d.ts +13 -0
- package/dist/cli/interactive/shell.d.ts.map +1 -0
- package/dist/cli/interactive/shell.js +115 -0
- package/dist/cli/interactive/shell.js.map +1 -0
- package/dist/cli/interactive/slash-dispatch.d.ts +14 -0
- package/dist/cli/interactive/slash-dispatch.d.ts.map +1 -0
- package/dist/cli/interactive/slash-dispatch.js +276 -0
- package/dist/cli/interactive/slash-dispatch.js.map +1 -0
- package/dist/cli/interactive/slash-parse.d.ts +9 -0
- package/dist/cli/interactive/slash-parse.d.ts.map +1 -0
- package/dist/cli/interactive/slash-parse.js +78 -0
- package/dist/cli/interactive/slash-parse.js.map +1 -0
- package/dist/cli/interactive/slash-registry.d.ts +11 -0
- package/dist/cli/interactive/slash-registry.d.ts.map +1 -0
- package/dist/cli/interactive/slash-registry.js +26 -0
- package/dist/cli/interactive/slash-registry.js.map +1 -0
- package/dist/cli/interactive/slash-suggest.d.ts +4 -0
- package/dist/cli/interactive/slash-suggest.d.ts.map +1 -0
- package/dist/cli/interactive/slash-suggest.js +46 -0
- package/dist/cli/interactive/slash-suggest.js.map +1 -0
- package/dist/cli/interactive/tools-catalog.d.ts +8 -0
- package/dist/cli/interactive/tools-catalog.d.ts.map +1 -0
- package/dist/cli/interactive/tools-catalog.js +51 -0
- package/dist/cli/interactive/tools-catalog.js.map +1 -0
- package/dist/cli/main.d.ts +2 -0
- package/dist/cli/main.d.ts.map +1 -0
- package/dist/cli/main.js +69 -0
- package/dist/cli/main.js.map +1 -0
- package/dist/cli/ui/diff-view.d.ts +7 -0
- package/dist/cli/ui/diff-view.d.ts.map +1 -0
- package/dist/cli/ui/diff-view.js +18 -0
- package/dist/cli/ui/diff-view.js.map +1 -0
- package/dist/cli/ui/printer.d.ts +13 -0
- package/dist/cli/ui/printer.d.ts.map +1 -0
- package/dist/cli/ui/printer.js +24 -0
- package/dist/cli/ui/printer.js.map +1 -0
- package/dist/cli/ui/spinner.d.ts +5 -0
- package/dist/cli/ui/spinner.d.ts.map +1 -0
- package/dist/cli/ui/spinner.js +30 -0
- package/dist/cli/ui/spinner.js.map +1 -0
- package/dist/cli/ui/text-writer.d.ts +8 -0
- package/dist/cli/ui/text-writer.d.ts.map +1 -0
- package/dist/cli/ui/text-writer.js +17 -0
- package/dist/cli/ui/text-writer.js.map +1 -0
- package/dist/config/config.d.ts +30 -0
- package/dist/config/config.d.ts.map +1 -0
- package/dist/config/config.js +133 -0
- package/dist/config/config.js.map +1 -0
- package/dist/runtime/apply-verify.d.ts +28 -0
- package/dist/runtime/apply-verify.d.ts.map +1 -0
- package/dist/runtime/apply-verify.js +180 -0
- package/dist/runtime/apply-verify.js.map +1 -0
- package/dist/runtime/approvals.d.ts +10 -0
- package/dist/runtime/approvals.d.ts.map +1 -0
- package/dist/runtime/approvals.js +22 -0
- package/dist/runtime/approvals.js.map +1 -0
- package/dist/runtime/content-hash.d.ts +3 -0
- package/dist/runtime/content-hash.d.ts.map +1 -0
- package/dist/runtime/content-hash.js +8 -0
- package/dist/runtime/content-hash.js.map +1 -0
- package/dist/runtime/digest-mask.d.ts +2 -0
- package/dist/runtime/digest-mask.d.ts.map +1 -0
- package/dist/runtime/digest-mask.js +11 -0
- package/dist/runtime/digest-mask.js.map +1 -0
- package/dist/runtime/inspect.d.ts +20 -0
- package/dist/runtime/inspect.d.ts.map +1 -0
- package/dist/runtime/inspect.js +152 -0
- package/dist/runtime/inspect.js.map +1 -0
- package/dist/runtime/patch-apply.d.ts +32 -0
- package/dist/runtime/patch-apply.d.ts.map +1 -0
- package/dist/runtime/patch-apply.js +170 -0
- package/dist/runtime/patch-apply.js.map +1 -0
- package/dist/runtime/patch-path-guard.d.ts +17 -0
- package/dist/runtime/patch-path-guard.d.ts.map +1 -0
- package/dist/runtime/patch-path-guard.js +56 -0
- package/dist/runtime/patch-path-guard.js.map +1 -0
- package/dist/runtime/patch-proposal.d.ts +55 -0
- package/dist/runtime/patch-proposal.d.ts.map +1 -0
- package/dist/runtime/patch-proposal.js +118 -0
- package/dist/runtime/patch-proposal.js.map +1 -0
- package/dist/runtime/permissions.d.ts +18 -0
- package/dist/runtime/permissions.d.ts.map +1 -0
- package/dist/runtime/permissions.js +91 -0
- package/dist/runtime/permissions.js.map +1 -0
- package/dist/runtime/sandbox.d.ts +9 -0
- package/dist/runtime/sandbox.d.ts.map +1 -0
- package/dist/runtime/sandbox.js +17 -0
- package/dist/runtime/sandbox.js.map +1 -0
- package/dist/runtime/unified-diff.d.ts +19 -0
- package/dist/runtime/unified-diff.d.ts.map +1 -0
- package/dist/runtime/unified-diff.js +114 -0
- package/dist/runtime/unified-diff.js.map +1 -0
- package/dist/runtime/verifier.d.ts +6 -0
- package/dist/runtime/verifier.d.ts.map +1 -0
- package/dist/runtime/verifier.js +16 -0
- package/dist/runtime/verifier.js.map +1 -0
- package/dist/runtime/workspace.d.ts +10 -0
- package/dist/runtime/workspace.d.ts.map +1 -0
- package/dist/runtime/workspace.js +107 -0
- package/dist/runtime/workspace.js.map +1 -0
- package/dist/version.d.ts +3 -0
- package/dist/version.d.ts.map +1 -0
- package/dist/version.js +10 -0
- package/dist/version.js.map +1 -0
- package/docs/beta-feedback-template.md +75 -0
- package/docs/beta-feedback-triage.md +169 -0
- package/docs/beta-release-handoff.md +182 -0
- package/docs/beta-tester-checklist.md +62 -0
- package/docs/install-beta.md +77 -0
- package/docs/internal-beta.md +84 -0
- package/docs/known-limitations.md +62 -0
- package/docs/patze-cli-architecture.md +137 -0
- package/docs/patze-cli-codex-reference-study.md +43 -0
- package/docs/release-checklist.md +83 -0
- package/docs/safety-model.md +69 -0
- package/docs/smoke-command-guide.md +61 -0
- package/docs/trust-loop.md +90 -0
- package/docs/uninstall-reset.md +44 -0
- package/package.json +39 -0
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
# Patze CLI architecture
|
|
2
|
+
|
|
3
|
+
Status: **Phase 4E — Session apply history & drift recovery UX** (2026-05-27)
|
|
4
|
+
Package: `@patze/code-cli` · binary: `patze`
|
|
5
|
+
|
|
6
|
+
Quality benchmark for permission selector layout: external [OpenAI Codex CLI](https://github.com/openai/codex) permission menu (reference only).
|
|
7
|
+
|
|
8
|
+
## Agent loop (trust chain)
|
|
9
|
+
|
|
10
|
+
```
|
|
11
|
+
prompt → inspect → plan → diff → permissions → approve → apply → verify
|
|
12
|
+
✅ ✅ ✅ ✅ ✅ ✅ ✅ ✅
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
| Stage | Status | Notes |
|
|
16
|
+
|-------|--------|-------|
|
|
17
|
+
| prompt | ✅ | Free text or `/goal` |
|
|
18
|
+
| inspect | ✅ | Local read-only summary |
|
|
19
|
+
| plan | ✅ | Server preview when auth ready |
|
|
20
|
+
| diff | ✅ | Read-only patch proposal |
|
|
21
|
+
| permissions | ✅ | Codex-like selector; `edit-with-approval` enables apply |
|
|
22
|
+
| approve | ✅ | Gate object; requires `/diff` + suggest/edit-with-approval |
|
|
23
|
+
| apply | ✅ | Interactive only; typed `APPLY <digest>` confirmation |
|
|
24
|
+
| verify | ✅ | Local read-only check of last apply; repeatable |
|
|
25
|
+
|
|
26
|
+
## Gated apply (Phase 4C)
|
|
27
|
+
|
|
28
|
+
### Preconditions (fail-closed)
|
|
29
|
+
|
|
30
|
+
1. Permission mode = `edit-with-approval`
|
|
31
|
+
2. Active `ApprovalGate` matching latest `DiffReviewState`
|
|
32
|
+
3. Session preview still carries same `artifact_digest` / `preview_digest` + patch body
|
|
33
|
+
4. Exact confirmation phrase: `APPLY ${maskDigest(artifact_digest)}`
|
|
34
|
+
5. No active verify drift recovery block (Phase 4E)
|
|
35
|
+
|
|
36
|
+
### Patch application
|
|
37
|
+
|
|
38
|
+
- Module: `runtime/patch-apply.ts` + `runtime/unified-diff.ts`
|
|
39
|
+
- Applies unified diff from approved server preview only
|
|
40
|
+
- Validates workspace root, deny rules, relative paths
|
|
41
|
+
- Rejects: absolute paths, `..` traversal, binary diffs, shell-style diff commands
|
|
42
|
+
- **Never** invokes shell
|
|
43
|
+
|
|
44
|
+
### Session updates after apply
|
|
45
|
+
|
|
46
|
+
- `lastApplyResult` records files written, per-file `beforeHash` / `afterHash`, `appliedAt`, `gateConsumed`
|
|
47
|
+
- `applyHistory[]` append (max 20, process-local only)
|
|
48
|
+
- `consumedGateKeys` prevents repeated `/apply` from the same gate
|
|
49
|
+
- Approval gate and pending review cleared
|
|
50
|
+
- `patze code apply` remains disabled (no `--yes`)
|
|
51
|
+
|
|
52
|
+
## Safe verify (Phase 4D)
|
|
53
|
+
|
|
54
|
+
### Scope
|
|
55
|
+
|
|
56
|
+
- Interactive `/verify` only; **repeatable** (re-check drift anytime)
|
|
57
|
+
- Verifies **last apply result in session** — not historical runs
|
|
58
|
+
- Read-only filesystem checks + content hash comparison
|
|
59
|
+
- **Never** runs shell, npm test, or network calls
|
|
60
|
+
|
|
61
|
+
### Checks (fail-closed)
|
|
62
|
+
|
|
63
|
+
1. `lastApplyResult` exists
|
|
64
|
+
2. Approval gate inactive; no pending `approved_apply_patch`
|
|
65
|
+
3. Gate key marked consumed in session
|
|
66
|
+
4. Each applied file: workspace boundary, existence, `afterHash` match
|
|
67
|
+
|
|
68
|
+
### Status
|
|
69
|
+
|
|
70
|
+
| Status | Meaning |
|
|
71
|
+
|--------|---------|
|
|
72
|
+
| `passed` | All checks OK — clears drift recovery block |
|
|
73
|
+
| `failed` | Drift or session inconsistency — activates drift recovery |
|
|
74
|
+
| `unavailable` | No prior apply in session |
|
|
75
|
+
|
|
76
|
+
### Non-interactive
|
|
77
|
+
|
|
78
|
+
- `patze code verify` → help-only / local-safe summary
|
|
79
|
+
- Command-based project test/lint verify → **future gated capability**
|
|
80
|
+
|
|
81
|
+
## Drift recovery (Phase 4E)
|
|
82
|
+
|
|
83
|
+
Module: `cli/commands/trust-loop-snapshot.ts`, `cli/commands/verify-drift-guard.ts`
|
|
84
|
+
|
|
85
|
+
### On verify failure
|
|
86
|
+
|
|
87
|
+
1. Store `lastVerifyResult` with `issues[]`
|
|
88
|
+
2. Set `verifyDriftBlocked = true`
|
|
89
|
+
3. Clear approval gate, diff review, pending actions (no file writes)
|
|
90
|
+
4. Block `/approve` and `/apply` until recovery
|
|
91
|
+
|
|
92
|
+
### Recovery paths
|
|
93
|
+
|
|
94
|
+
| Action | Effect |
|
|
95
|
+
|--------|--------|
|
|
96
|
+
| Fix files + `/verify` (pass) | Clears drift block |
|
|
97
|
+
| `/reject` | Clears pending gate + drift block; no file writes |
|
|
98
|
+
| `/diff` | Allowed (read-only review) while blocked |
|
|
99
|
+
|
|
100
|
+
### Trust-loop snapshot (`/status`, `/context`)
|
|
101
|
+
|
|
102
|
+
Redacted view of permission, goal, pending state, apply history, last apply/verify summaries.
|
|
103
|
+
|
|
104
|
+
**Limitation:** apply history is in-memory for the current process only — no persistence, no runs sync.
|
|
105
|
+
|
|
106
|
+
## Permission modes
|
|
107
|
+
|
|
108
|
+
| Mode | Phase | Writes |
|
|
109
|
+
|------|-------|--------|
|
|
110
|
+
| `read-only` | active | none |
|
|
111
|
+
| `suggest` | active | none; approval gate only |
|
|
112
|
+
| `edit-with-approval` | active | gated `/apply` only |
|
|
113
|
+
| `full-auto` | forbidden | never |
|
|
114
|
+
|
|
115
|
+
## Safety model
|
|
116
|
+
|
|
117
|
+
1. No auto-apply in any mode.
|
|
118
|
+
2. No SSE, execute, or runs sync.
|
|
119
|
+
3. No backend contract changes for apply/verify.
|
|
120
|
+
4. Interactive confirmation is mandatory for apply.
|
|
121
|
+
5. Verify and `/reject` recovery never modify files.
|
|
122
|
+
|
|
123
|
+
## Dev instructions
|
|
124
|
+
|
|
125
|
+
```bash
|
|
126
|
+
cd packages/patze-code-cli
|
|
127
|
+
npm run verify
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
## Non-goals (Phase 4E)
|
|
131
|
+
|
|
132
|
+
- `--yes` non-interactive apply
|
|
133
|
+
- `patze code apply` mutation path
|
|
134
|
+
- Shell-based verify (npm test, lint, typecheck)
|
|
135
|
+
- Persistent apply history across process restarts
|
|
136
|
+
- execute / runs sync
|
|
137
|
+
- full-auto permission
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# Patze CLI — Codex reference study
|
|
2
|
+
|
|
3
|
+
Status: **Phase 0** reference notes (2026-05-28)
|
|
4
|
+
Benchmark: [openai/codex](https://github.com/openai/codex) public repo and docs — **quality bar only**, not a product copy.
|
|
5
|
+
|
|
6
|
+
## What Codex optimizes for
|
|
7
|
+
|
|
8
|
+
| Area | Codex pattern | Patze adoption |
|
|
9
|
+
|------|---------------|----------------|
|
|
10
|
+
| Install | curl/npm/Homebrew; single binary name | `@patze/code-cli` npm first; binary `patze`; Homebrew later |
|
|
11
|
+
| Entry | `codex` opens TUI; `codex "prompt"` one-shot | Phase 1b TUI; Phase 1 one-shot via `patze goal --dry-run` |
|
|
12
|
+
| Help | Short top-level help; deeper docs linked | `patze --help` + package docs |
|
|
13
|
+
| Workspace | Local cwd; Rust core owns sandbox | `runtime/workspace.ts`; server owns execute policy |
|
|
14
|
+
| Approval | Explicit trust/sandbox posture | `runtime/approvals.ts`; default preview-first |
|
|
15
|
+
| Patches | Inline diff presentation in TUI | `cli/ui/diff-view.ts`; server artifact truth later |
|
|
16
|
+
| Progress | Streaming phases + tool trace | Phase 4 SSE client against PatzeAgents |
|
|
17
|
+
| Packaging | Multi-platform binaries + npm | Node 20 ESM now; optional native lane later |
|
|
18
|
+
| Docs | install.md, contributing, auth guides | README + architecture + rollout notes |
|
|
19
|
+
|
|
20
|
+
## Command UX patterns worth copying (behavior, not names)
|
|
21
|
+
|
|
22
|
+
1. **Deterministic subcommands** — stable verbs (`status`, `login`, `goal`, `code`, `runs`).
|
|
23
|
+
2. **Safe defaults** — dry-run / preview before apply.
|
|
24
|
+
3. **Structured status** — one screen answers “am I configured?” and “can I reach backend?”
|
|
25
|
+
4. **Progress semantics** — queued → running → completed/failed; never infer success from stream close alone.
|
|
26
|
+
5. **Patch review** — human-readable diff before write; apply is a separate explicit action.
|
|
27
|
+
|
|
28
|
+
## Patze deliberate differences
|
|
29
|
+
|
|
30
|
+
- Auth via **Patze internal API key + user UUID**, not ChatGPT OAuth.
|
|
31
|
+
- Execute/verify authority stays on **FastAPI PatzeAgents** (`/internal/patze-code/*`).
|
|
32
|
+
- No OpenAI/Codex branding in user-facing strings.
|
|
33
|
+
- No `--dangerously-skip-permissions` equivalent.
|
|
34
|
+
|
|
35
|
+
## Non-goals (this study)
|
|
36
|
+
|
|
37
|
+
- Copying Codex Rust crate layout verbatim into Patze.
|
|
38
|
+
- Shipping Cursor SDK or `CURSOR_API_KEY` flows to end users.
|
|
39
|
+
- Rebuilding OpenAI cloud auth in the CLI.
|
|
40
|
+
|
|
41
|
+
## Rollout note
|
|
42
|
+
|
|
43
|
+
When adding server-backed commands, gate behind explicit flags and keep Phase 0 dry-run paths working without network.
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
# Release checklist — @patze/code-cli internal beta
|
|
2
|
+
|
|
3
|
+
Use before tagging `0.10.x` for team rollout. **Not** npm `latest` / 1.0 gate.
|
|
4
|
+
|
|
5
|
+
## Version bump
|
|
6
|
+
|
|
7
|
+
- [ ] `VERSION` matches `package.json` version
|
|
8
|
+
- [ ] `CHANGELOG.md` entry for this version
|
|
9
|
+
- [ ] README version pins and command tables updated
|
|
10
|
+
- [ ] `scripts/verify-version.mjs` passes
|
|
11
|
+
|
|
12
|
+
## Build and verify
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
cd packages/patze-code-cli
|
|
16
|
+
npm run verify
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
Includes:
|
|
20
|
+
|
|
21
|
+
- [ ] `verify-version.mjs`
|
|
22
|
+
- [ ] `tsc` build
|
|
23
|
+
- [ ] `verify-pack.mjs` (tarball audit)
|
|
24
|
+
- [ ] `typecheck`
|
|
25
|
+
- [ ] unit tests (`node --test tests/*.test.mjs`)
|
|
26
|
+
- [ ] `smoke-beta.mjs` (temp workspace + local pack install)
|
|
27
|
+
|
|
28
|
+
Individual commands:
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
npm run verify:pack -- --verbose
|
|
32
|
+
npm run smoke
|
|
33
|
+
npm pack --dry-run
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## Package contents
|
|
37
|
+
|
|
38
|
+
- [ ] `files` in `package.json`: `bin`, `dist`, `docs`, `README`, `CHANGELOG`, `NOTICE`, `VERSION`
|
|
39
|
+
- [ ] No `src/`, `tests/`, `.cookbook-vendor`, `.env` in pack output
|
|
40
|
+
- [ ] Required docs present (see `verify-pack.mjs` `REQUIRED_PATHS`)
|
|
41
|
+
|
|
42
|
+
## Safety / capability truthfulness
|
|
43
|
+
|
|
44
|
+
- [ ] README **implemented vs planned** table accurate
|
|
45
|
+
- [ ] `patze code apply` still disabled
|
|
46
|
+
- [ ] No `--yes`, no auto-apply, no full-auto
|
|
47
|
+
- [ ] Verify remains local read-only (no shell)
|
|
48
|
+
- [ ] No new backend contract changes in this slice
|
|
49
|
+
- [ ] No telemetry upload added
|
|
50
|
+
|
|
51
|
+
## Secrets hygiene
|
|
52
|
+
|
|
53
|
+
- [ ] `verify-pack` secret scan clean on publish tree
|
|
54
|
+
- [ ] Rollout docs/scripts use placeholders (`<token>`, `api.example.com`)
|
|
55
|
+
- [ ] No real home paths or tokens in committed docs
|
|
56
|
+
- [ ] `patze doctor` / `patze status` mask tokens in output
|
|
57
|
+
|
|
58
|
+
## Rollout assets (0.10.2+)
|
|
59
|
+
|
|
60
|
+
- [ ] `docs/install-beta.md` + `scripts/install-beta.sh`
|
|
61
|
+
- [ ] `docs/beta-tester-checklist.md`
|
|
62
|
+
- [ ] `docs/beta-feedback-template.md`
|
|
63
|
+
- [ ] `docs/known-limitations.md`
|
|
64
|
+
- [ ] `docs/smoke-command-guide.md`
|
|
65
|
+
- [ ] `docs/uninstall-reset.md`
|
|
66
|
+
|
|
67
|
+
## Publish (when ready)
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
npm publish --tag beta
|
|
71
|
+
# or team tarball handoff:
|
|
72
|
+
npm pack
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
## Post-publish smoke (testers)
|
|
76
|
+
|
|
77
|
+
Hand testers [`install-beta.md`](install-beta.md) and confirm:
|
|
78
|
+
|
|
79
|
+
```bash
|
|
80
|
+
patze --version
|
|
81
|
+
patze doctor
|
|
82
|
+
patze status
|
|
83
|
+
```
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
# Safety model
|
|
2
|
+
|
|
3
|
+
`@patze/code-cli` is a **local terminal client**. PatzeAgents server remains authoritative for auth, entitlements, artifacts, and policy. The CLI defaults **fail-closed**.
|
|
4
|
+
|
|
5
|
+
## Non-negotiables
|
|
6
|
+
|
|
7
|
+
| Rule | Enforcement |
|
|
8
|
+
|------|-------------|
|
|
9
|
+
| No auto-apply | Writes only via gated interactive `/apply` |
|
|
10
|
+
| No `--yes` | Apply requires typed `APPLY <masked-artifact-digest>` |
|
|
11
|
+
| No shell execution | Verify is read-only filesystem + hash checks only |
|
|
12
|
+
| No `full-auto` | Permission mode is forbidden permanently |
|
|
13
|
+
| No SSE / runs sync | No background run streaming or remote run mutation |
|
|
14
|
+
| No backend contract changes from CLI | Client adapts to existing PatzeAgents APIs |
|
|
15
|
+
|
|
16
|
+
## Permission modes
|
|
17
|
+
|
|
18
|
+
| Mode | Reads | Approval gate | File writes |
|
|
19
|
+
|------|-------|---------------|-------------|
|
|
20
|
+
| `read-only` | ✅ | ❌ | ❌ |
|
|
21
|
+
| `suggest` | ✅ | ✅ | ❌ |
|
|
22
|
+
| `edit-with-approval` | ✅ | ✅ | ✅ gated `/apply` only |
|
|
23
|
+
| `full-auto` | — | — | **forbidden** |
|
|
24
|
+
|
|
25
|
+
## Gated apply preconditions
|
|
26
|
+
|
|
27
|
+
All must pass before any file write:
|
|
28
|
+
|
|
29
|
+
1. Permission = `edit-with-approval`
|
|
30
|
+
2. Active approval gate matching latest `/diff` review
|
|
31
|
+
3. Session preview digests + patch body still match gate
|
|
32
|
+
4. Exact confirmation phrase
|
|
33
|
+
5. No active verify drift recovery block
|
|
34
|
+
|
|
35
|
+
## Verify scope
|
|
36
|
+
|
|
37
|
+
- Checks **last apply in current session only**
|
|
38
|
+
- Local read-only: workspace boundary, file existence, content hash vs apply snapshot
|
|
39
|
+
- Repeatable (`/verify` may be run multiple times)
|
|
40
|
+
- Does **not** run npm test, lint, typecheck, or arbitrary shell commands
|
|
41
|
+
|
|
42
|
+
## Drift recovery
|
|
43
|
+
|
|
44
|
+
When `/verify` fails:
|
|
45
|
+
|
|
46
|
+
- `/approve` and `/apply` are blocked
|
|
47
|
+
- `/reject` clears pending gate + drift state — **never modifies files**
|
|
48
|
+
- Fix files manually + `/verify` pass, or `/reject` and restart trust loop
|
|
49
|
+
|
|
50
|
+
## Redaction
|
|
51
|
+
|
|
52
|
+
Session output masks:
|
|
53
|
+
|
|
54
|
+
- Artifact and preview digests (`artifa…90ab` style)
|
|
55
|
+
- API tokens (`configured` / masked, never full value in `/status`)
|
|
56
|
+
|
|
57
|
+
Never log or print raw bearer tokens in normal operator flows.
|
|
58
|
+
|
|
59
|
+
## Workspace boundaries
|
|
60
|
+
|
|
61
|
+
Default deny patterns include `.env`, `node_modules`, `.git`. Patches reject absolute paths, `..` traversal, binary diffs, and shell-style diff commands.
|
|
62
|
+
|
|
63
|
+
## Internal beta limits
|
|
64
|
+
|
|
65
|
+
- Apply history is **in-memory for current process** — not persisted across restarts
|
|
66
|
+
- No remote run sync or server-side apply receipt (future read-only slice)
|
|
67
|
+
- Shell-based project verification remains a **future gated capability**
|
|
68
|
+
|
|
69
|
+
See also: [`trust-loop.md`](trust-loop.md), [`internal-beta.md`](internal-beta.md).
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
# Smoke command guide — maintainers
|
|
2
|
+
|
|
3
|
+
Quick reference for release verification. Beta testers can use the lighter checklist in [`beta-tester-checklist.md`](beta-tester-checklist.md).
|
|
4
|
+
|
|
5
|
+
## Full verify (recommended before tag)
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
cd packages/patze-code-cli
|
|
9
|
+
npm run verify
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
Runs: version check → build → pack audit → typecheck → unit tests → smoke.
|
|
13
|
+
|
|
14
|
+
## Individual commands
|
|
15
|
+
|
|
16
|
+
| Command | Purpose |
|
|
17
|
+
|---------|---------|
|
|
18
|
+
| `npm run build` | Compile TypeScript to `dist/` |
|
|
19
|
+
| `npm run typecheck` | `tsc --noEmit` |
|
|
20
|
+
| `npm test` | Unit tests (requires build) |
|
|
21
|
+
| `npm run verify:pack` | Audit `npm pack` output |
|
|
22
|
+
| `npm run verify:pack -- --verbose` | JSON summary of pack manifest |
|
|
23
|
+
| `npm run smoke` | Temp workspace CLI smoke + local install |
|
|
24
|
+
| `npm run smoke -- --skip-install` | Skip tarball install step |
|
|
25
|
+
|
|
26
|
+
## What smoke covers
|
|
27
|
+
|
|
28
|
+
- `patze --version`
|
|
29
|
+
- `patze --help`
|
|
30
|
+
- `patze status` (auth/cwd lines)
|
|
31
|
+
- `patze code inspect`
|
|
32
|
+
- `patze goal … --dry-run`
|
|
33
|
+
- `patze code verify` (help/safety text)
|
|
34
|
+
- `patze code apply` (disabled message)
|
|
35
|
+
- Optional: `npm pack` → global install → `patze --version`
|
|
36
|
+
|
|
37
|
+
Smoke does **not** exercise interactive `/apply` (requires stdin). Use manual trust-loop checklist for that.
|
|
38
|
+
|
|
39
|
+
## Pack audit (`verify-pack`)
|
|
40
|
+
|
|
41
|
+
Fails closed on:
|
|
42
|
+
|
|
43
|
+
- Blocked paths: `.cookbook-vendor`, `src/`, `tests/`, etc.
|
|
44
|
+
- Missing required publish files
|
|
45
|
+
- Secret-like patterns in text files (keys, bearer tokens, home paths)
|
|
46
|
+
|
|
47
|
+
## Install script smoke
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
./scripts/install-beta.sh local
|
|
51
|
+
patze doctor
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
## Troubleshooting
|
|
55
|
+
|
|
56
|
+
| Symptom | Check |
|
|
57
|
+
|---------|-------|
|
|
58
|
+
| `dist_main: missing` in doctor | Run `npm run build` |
|
|
59
|
+
| verify-pack home-path hit | Remove real `/home/...` from docs |
|
|
60
|
+
| smoke install fail | Node 20+, npm global prefix writable |
|
|
61
|
+
| status exit 1 | Expected without auth — not a smoke failure |
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
# Trust loop
|
|
2
|
+
|
|
3
|
+
The Patze Code CLI interactive trust loop is the operator path from intent to verified local apply.
|
|
4
|
+
|
|
5
|
+
```
|
|
6
|
+
prompt → inspect → plan → diff → permissions → approve → apply → verify
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
## Stages
|
|
10
|
+
|
|
11
|
+
| Stage | Command | Mutates files? |
|
|
12
|
+
|-------|---------|----------------|
|
|
13
|
+
| prompt | free text or `/goal` | No |
|
|
14
|
+
| inspect | `/inspect` or `patze code inspect` | No |
|
|
15
|
+
| plan | `/plan` or `patze code plan --preview` | No |
|
|
16
|
+
| diff | `/diff` | No (read-only patch view) |
|
|
17
|
+
| permissions | `/permissions` | No |
|
|
18
|
+
| approve | `/approve` | No (gate only) |
|
|
19
|
+
| apply | `/apply` + confirmation | **Yes** (gated) |
|
|
20
|
+
| verify | `/verify` | No (read-only check) |
|
|
21
|
+
|
|
22
|
+
## Example session
|
|
23
|
+
|
|
24
|
+
```text
|
|
25
|
+
patze
|
|
26
|
+
/goal Improve README quickstart
|
|
27
|
+
/plan
|
|
28
|
+
/diff
|
|
29
|
+
/permissions suggest
|
|
30
|
+
/approve
|
|
31
|
+
/permissions edit-with-approval
|
|
32
|
+
/apply
|
|
33
|
+
APPLY artifa…90ab
|
|
34
|
+
/verify
|
|
35
|
+
/status
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## Permission flow
|
|
39
|
+
|
|
40
|
+
1. **`suggest`** — review and approve patches; no writes
|
|
41
|
+
2. **`edit-with-approval`** — enables `/apply` after approval gate is set
|
|
42
|
+
|
|
43
|
+
Direct set: `/permissions read-only|suggest|edit-with-approval`
|
|
44
|
+
|
|
45
|
+
## After apply
|
|
46
|
+
|
|
47
|
+
```
|
|
48
|
+
Next
|
|
49
|
+
/verify — check applied files
|
|
50
|
+
/status
|
|
51
|
+
/exit
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
## Session visibility
|
|
55
|
+
|
|
56
|
+
`/status` and `/context` show a redacted trust-loop snapshot:
|
|
57
|
+
|
|
58
|
+
- permission mode, goal, pending diff/approval
|
|
59
|
+
- apply history (this process only)
|
|
60
|
+
- last apply and last verify summaries (masked digests)
|
|
61
|
+
|
|
62
|
+
## Drift recovery
|
|
63
|
+
|
|
64
|
+
If `/verify` reports `status: failed`:
|
|
65
|
+
|
|
66
|
+
```
|
|
67
|
+
Recommended next steps
|
|
68
|
+
/diff — review latest proposed patch
|
|
69
|
+
/reject — clear pending gate and drift recovery
|
|
70
|
+
manual review — file changed after apply
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
## Non-interactive commands
|
|
74
|
+
|
|
75
|
+
| Command | Status |
|
|
76
|
+
|---------|--------|
|
|
77
|
+
| `patze code inspect` | ✅ read-only |
|
|
78
|
+
| `patze code plan --preview` | ✅ server preview when auth configured |
|
|
79
|
+
| `patze code diff` | ✅ read-only |
|
|
80
|
+
| `patze code apply` | ❌ disabled — use interactive `/apply` |
|
|
81
|
+
| `patze code verify` | ℹ️ help-only summary |
|
|
82
|
+
|
|
83
|
+
## Planned (not in 0.10.x beta)
|
|
84
|
+
|
|
85
|
+
- Shell-based verify (npm test / lint / typecheck)
|
|
86
|
+
- `patze runs` sync
|
|
87
|
+
- Non-interactive apply (`--yes`)
|
|
88
|
+
- Server-side apply receipt (read-only)
|
|
89
|
+
|
|
90
|
+
See [`safety-model.md`](safety-model.md) for boundaries.
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# Uninstall and reset — internal beta
|
|
2
|
+
|
|
3
|
+
## Uninstall global CLI
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
npm uninstall -g @patze/code-cli
|
|
7
|
+
which patze # should print nothing
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
If you installed from a local tarball, the same command applies (`npm uninstall -g @patze/code-cli`).
|
|
11
|
+
|
|
12
|
+
## Reset local credentials (optional)
|
|
13
|
+
|
|
14
|
+
Patze Code stores config under your user config directory and optional project `.patze/` files.
|
|
15
|
+
|
|
16
|
+
1. Remove or edit global config (path shown by `patze doctor` under **config** — values redacted).
|
|
17
|
+
2. Remove project override if present: `.patze/config.json` in your workspace.
|
|
18
|
+
3. Unset env vars:
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
unset PATZE_CODE_API PATZE_CODE_TOKEN PATZE_CODE_USER_ID
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## Reset interactive session only
|
|
25
|
+
|
|
26
|
+
Inside `patze` shell:
|
|
27
|
+
|
|
28
|
+
```text
|
|
29
|
+
/reset # clears agent session state (in-memory)
|
|
30
|
+
/clear # clears transcript
|
|
31
|
+
/exit
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
Session apply history is **process-local** — restarting `patze` clears it.
|
|
35
|
+
|
|
36
|
+
## Clean beta fixture workspace
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
rm -rf /tmp/patze-beta # or your chosen test directory
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## Reinstall fresh
|
|
43
|
+
|
|
44
|
+
See [`install-beta.md`](install-beta.md).
|
package/package.json
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@patze/code-cli",
|
|
3
|
+
"version": "0.10.2",
|
|
4
|
+
"description": "Patze Code — local terminal coding agent client for PatzeAgents",
|
|
5
|
+
"license": "UNLICENSED",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"engines": {
|
|
8
|
+
"node": ">=20"
|
|
9
|
+
},
|
|
10
|
+
"bin": {
|
|
11
|
+
"patze": "bin/patze.mjs"
|
|
12
|
+
},
|
|
13
|
+
"files": [
|
|
14
|
+
"bin",
|
|
15
|
+
"dist",
|
|
16
|
+
"docs",
|
|
17
|
+
"CHANGELOG.md",
|
|
18
|
+
"NOTICE.md",
|
|
19
|
+
"README.md",
|
|
20
|
+
"VERSION"
|
|
21
|
+
],
|
|
22
|
+
"scripts": {
|
|
23
|
+
"build": "tsc -p tsconfig.json",
|
|
24
|
+
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
25
|
+
"test": "npm run build && node --test tests/*.test.mjs",
|
|
26
|
+
"verify:pack": "npm run build && node scripts/verify-pack.mjs --verbose",
|
|
27
|
+
"smoke": "node scripts/smoke-beta.mjs",
|
|
28
|
+
"verify": "node scripts/verify-version.mjs && npm run build && node scripts/verify-pack.mjs && npm run typecheck && npm test && node scripts/smoke-beta.mjs"
|
|
29
|
+
},
|
|
30
|
+
"keywords": [
|
|
31
|
+
"patze",
|
|
32
|
+
"patze-code",
|
|
33
|
+
"coding-agent",
|
|
34
|
+
"cli"
|
|
35
|
+
],
|
|
36
|
+
"publishConfig": {
|
|
37
|
+
"access": "public"
|
|
38
|
+
}
|
|
39
|
+
}
|