patchwarden 1.1.0 → 1.5.1
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.en.md +83 -8
- package/README.md +78 -10
- package/dist/assessments/agentAssessor.d.ts +1 -1
- package/dist/assessments/agentAssessor.js +3 -3
- package/dist/assessments/assessmentStore.d.ts +1 -1
- package/dist/assessments/assessmentStore.js +2 -2
- package/dist/assessments/confirmCli.js +5 -4
- package/dist/config.d.ts +7 -0
- package/dist/config.js +34 -0
- package/dist/control/middleware/auth.d.ts +10 -0
- package/dist/control/middleware/auth.js +8 -0
- package/dist/control/middleware/static.d.ts +3 -0
- package/dist/control/middleware/static.js +65 -0
- package/dist/control/routes/audit.d.ts +15 -0
- package/dist/control/routes/audit.js +277 -0
- package/dist/control/routes/evidence.d.ts +4 -0
- package/dist/control/routes/evidence.js +96 -0
- package/dist/control/routes/lineage.d.ts +3 -0
- package/dist/control/routes/lineage.js +71 -0
- package/dist/control/routes/policy.d.ts +3 -0
- package/dist/control/routes/policy.js +81 -0
- package/dist/control/routes/process.d.ts +5 -0
- package/dist/control/routes/process.js +200 -0
- package/dist/control/routes/sessions.d.ts +22 -0
- package/dist/control/routes/sessions.js +224 -0
- package/dist/control/routes/status.d.ts +6 -0
- package/dist/control/routes/status.js +250 -0
- package/dist/control/routes/taskActions.d.ts +21 -0
- package/dist/control/routes/taskActions.js +233 -0
- package/dist/control/routes/tasks.d.ts +20 -0
- package/dist/control/routes/tasks.js +310 -0
- package/dist/control/routes/workspace.d.ts +15 -0
- package/dist/control/routes/workspace.js +193 -0
- package/dist/control/runtime.d.ts +91 -0
- package/dist/control/runtime.js +392 -0
- package/dist/control/server.d.ts +13 -0
- package/dist/control/server.js +479 -0
- package/dist/control/shared.d.ts +35 -0
- package/dist/control/shared.js +288 -0
- package/dist/controlCenter.d.ts +6 -0
- package/dist/controlCenter.js +7 -2001
- package/dist/direct/directGuards.js +30 -8
- package/dist/direct/directSessionStore.d.ts +2 -0
- package/dist/direct/directVerification.js +7 -0
- package/dist/doctor.d.ts +18 -1
- package/dist/doctor.js +579 -348
- package/dist/goal/goalReport.d.ts +54 -0
- package/dist/goal/goalReport.js +204 -0
- package/dist/goal/goalStatus.d.ts +6 -0
- package/dist/goal/specKitImport.d.ts +63 -0
- package/dist/goal/specKitImport.js +220 -0
- package/dist/goal/subgoalSync.js +2 -1
- package/dist/httpServer.js +15 -12
- package/dist/index.js +7 -4
- package/dist/logging.d.ts +7 -1
- package/dist/logging.js +8 -0
- package/dist/policy/projectPolicy.d.ts +55 -0
- package/dist/policy/projectPolicy.js +286 -0
- package/dist/runner/changeCapture.d.ts +3 -3
- package/dist/runner/changeCapture.js +63 -39
- package/dist/runner/cli.js +7 -6
- package/dist/runner/postTaskCleanup.js +26 -2
- package/dist/runner/runTask.js +245 -221
- package/dist/runner/simpleProcess.js +4 -4
- package/dist/runner/watch.js +17 -14
- package/dist/security/contentRedaction.d.ts +6 -0
- package/dist/security/contentRedaction.js +22 -0
- package/dist/smoke-test.js +261 -255
- package/dist/test/unit/apply-patch.test.d.ts +1 -0
- package/dist/test/unit/apply-patch.test.js +225 -0
- package/dist/test/unit/create-task.test.d.ts +1 -0
- package/dist/test/unit/create-task.test.js +197 -0
- package/dist/test/unit/direct-guards.test.js +124 -9
- package/dist/test/unit/evidence-pack.test.d.ts +1 -0
- package/dist/test/unit/evidence-pack.test.js +224 -0
- package/dist/test/unit/get-task-status.test.d.ts +1 -0
- package/dist/test/unit/get-task-status.test.js +174 -0
- package/dist/test/unit/get-task-summary.test.d.ts +1 -0
- package/dist/test/unit/get-task-summary.test.js +146 -0
- package/dist/test/unit/goal-report.test.d.ts +1 -0
- package/dist/test/unit/goal-report.test.js +159 -0
- package/dist/test/unit/goal-subgoal-task.test.js +6 -6
- package/dist/test/unit/goal-tools-registry.test.js +6 -4
- package/dist/test/unit/path-guard.test.js +24 -0
- package/dist/test/unit/project-policy-release-mode.test.d.ts +1 -0
- package/dist/test/unit/project-policy-release-mode.test.js +125 -0
- package/dist/test/unit/run-task-loop.test.d.ts +1 -0
- package/dist/test/unit/run-task-loop.test.js +380 -0
- package/dist/test/unit/schema-drift-check.test.js +10 -9
- package/dist/test/unit/spec-kit-import.test.d.ts +1 -0
- package/dist/test/unit/spec-kit-import.test.js +341 -0
- package/dist/test/unit/wait-for-task.test.d.ts +1 -0
- package/dist/test/unit/wait-for-task.test.js +144 -0
- package/dist/tools/auditTask.d.ts +8 -63
- package/dist/tools/auditTask.js +12 -8
- package/dist/tools/createDirectSession.d.ts +1 -1
- package/dist/tools/createDirectSession.js +2 -2
- package/dist/tools/createTask.d.ts +2 -2
- package/dist/tools/createTask.js +4 -4
- package/dist/tools/dispatch/coreDispatch.d.ts +9 -0
- package/dist/tools/dispatch/coreDispatch.js +282 -0
- package/dist/tools/dispatch/diagnosticDispatch.d.ts +14 -0
- package/dist/tools/dispatch/diagnosticDispatch.js +78 -0
- package/dist/tools/dispatch/directDispatch.d.ts +8 -0
- package/dist/tools/dispatch/directDispatch.js +115 -0
- package/dist/tools/dispatch/goalDispatch.d.ts +8 -0
- package/dist/tools/dispatch/goalDispatch.js +91 -0
- package/dist/tools/dispatch/releaseDispatch.d.ts +8 -0
- package/dist/tools/dispatch/releaseDispatch.js +45 -0
- package/dist/tools/dispatch/types.d.ts +23 -0
- package/dist/tools/dispatch/types.js +15 -0
- package/dist/tools/evidencePack.d.ts +45 -0
- package/dist/tools/evidencePack.js +375 -0
- package/dist/tools/finalizeDirectSession.d.ts +1 -1
- package/dist/tools/finalizeDirectSession.js +3 -3
- package/dist/tools/goalSubgoalTask.d.ts +1 -1
- package/dist/tools/goalSubgoalTask.js +2 -2
- package/dist/tools/healthCheck.js +3 -3
- package/dist/tools/recommendAgentForTask.d.ts +19 -0
- package/dist/tools/recommendAgentForTask.js +56 -0
- package/dist/tools/registry.d.ts +3 -3
- package/dist/tools/registry.js +333 -402
- package/dist/tools/releaseMode.d.ts +50 -0
- package/dist/tools/releaseMode.js +370 -0
- package/dist/tools/retryTask.d.ts +2 -2
- package/dist/tools/retryTask.js +2 -2
- package/dist/tools/runDirectVerificationBundle.d.ts +26 -0
- package/dist/tools/runDirectVerificationBundle.js +64 -0
- package/dist/tools/runTaskLoop.d.ts +57 -0
- package/dist/tools/runTaskLoop.js +417 -0
- package/dist/tools/runVerification.d.ts +4 -0
- package/dist/tools/runVerification.js +4 -0
- package/dist/tools/safeViews.d.ts +8 -2
- package/dist/tools/safeViews.js +4 -2
- package/dist/tools/taskLineage.d.ts +91 -0
- package/dist/tools/taskLineage.js +175 -0
- package/dist/tools/toolCatalog.d.ts +2 -2
- package/dist/tools/toolCatalog.js +6 -0
- package/dist/tools/toolRegistry.js +132 -0
- package/dist/version.d.ts +2 -2
- package/dist/version.js +2 -2
- package/docs/CODE_WIKI.md +983 -0
- package/docs/agentseal-integration.md +150 -0
- package/docs/architecture.md +63 -0
- package/docs/assets/patchwarden-oss-demo.gif +0 -0
- package/docs/chatgpt-usage.md +31 -0
- package/docs/control-center/README.md +9 -0
- package/docs/dashboard-overview.md +86 -0
- package/docs/demo.md +8 -0
- package/docs/direct-session-workflow.md +98 -0
- package/docs/evidence-pack-schema.md +215 -0
- package/docs/execution-plan-2026-07-09.md +315 -0
- package/docs/lineage-evidence-pack-workflow.md +127 -0
- package/docs/mcp-inspector-testing.md +200 -0
- package/docs/open-source-application.md +162 -0
- package/docs/opencode-worker.md +151 -0
- package/docs/openhands-worker.md +181 -0
- package/docs/release-evidence.md +72 -0
- package/docs/roadmap-execution-and-acceptance.md +365 -0
- package/docs/spec-kit-integration.md +131 -0
- package/docs/task-safe-review-workflow.md +98 -0
- package/docs/threat-model.md +79 -0
- package/docs/user-feedback.md +40 -0
- package/docs/why-patchwarden.md +110 -0
- package/package.json +3 -3
- package/scripts/checks/control-center-smoke.js +443 -0
- package/scripts/checks/control-smoke.js +2 -2
- package/scripts/checks/lifecycle-smoke.js +29 -23
- package/scripts/checks/mcp-manifest-check.js +12 -0
- package/scripts/checks/mcp-smoke.js +33 -7
- package/scripts/checks/watcher-supervisor-smoke.js +1 -1
- package/scripts/generate-demo-gif.py +320 -0
- package/src/assessments/agentAssessor.ts +3 -3
- package/src/assessments/assessmentStore.ts +2 -2
- package/src/assessments/confirmCli.ts +5 -4
- package/src/config.ts +37 -0
- package/src/control/middleware/auth.ts +17 -0
- package/src/control/middleware/static.ts +71 -0
- package/src/control/routes/audit.ts +321 -0
- package/src/control/routes/evidence.ts +107 -0
- package/src/control/routes/lineage.ts +92 -0
- package/src/control/routes/policy.ts +81 -0
- package/src/control/routes/process.ts +204 -0
- package/src/control/routes/sessions.ts +251 -0
- package/src/control/routes/status.ts +325 -0
- package/src/control/routes/taskActions.ts +248 -0
- package/src/control/routes/tasks.ts +323 -0
- package/src/control/routes/workspace.ts +203 -0
- package/src/control/runtime.ts +472 -0
- package/src/control/server.ts +471 -0
- package/src/control/shared.ts +294 -0
- package/src/controlCenter.ts +7 -2150
- package/src/direct/directGuards.ts +28 -7
- package/src/direct/directSessionStore.ts +2 -0
- package/src/direct/directVerification.ts +7 -0
- package/src/doctor.ts +741 -481
- package/src/goal/goalReport.ts +271 -0
- package/src/goal/goalStatus.ts +6 -0
- package/src/goal/specKitImport.ts +355 -0
- package/src/goal/subgoalSync.ts +4 -2
- package/src/httpServer.ts +17 -14
- package/src/index.ts +7 -4
- package/src/logging.ts +10 -1
- package/src/policy/projectPolicy.ts +344 -0
- package/src/runner/changeCapture.ts +70 -42
- package/src/runner/cli.ts +7 -6
- package/src/runner/postTaskCleanup.ts +26 -2
- package/src/runner/runTask.ts +325 -223
- package/src/runner/simpleProcess.ts +4 -4
- package/src/runner/watch.ts +17 -14
- package/src/security/contentRedaction.ts +29 -0
- package/src/smoke-test.ts +254 -252
- package/src/test/unit/apply-patch.test.ts +293 -0
- package/src/test/unit/create-task.test.ts +255 -0
- package/src/test/unit/direct-guards.test.ts +178 -8
- package/src/test/unit/evidence-pack.test.ts +251 -0
- package/src/test/unit/get-task-status.test.ts +203 -0
- package/src/test/unit/get-task-summary.test.ts +173 -0
- package/src/test/unit/goal-report.test.ts +189 -0
- package/src/test/unit/goal-subgoal-task.test.ts +6 -6
- package/src/test/unit/goal-tools-registry.test.ts +7 -5
- package/src/test/unit/path-guard.test.ts +30 -0
- package/src/test/unit/project-policy-release-mode.test.ts +156 -0
- package/src/test/unit/run-task-loop.test.ts +425 -0
- package/src/test/unit/schema-drift-check.test.ts +11 -9
- package/src/test/unit/spec-kit-import.test.ts +429 -0
- package/src/test/unit/wait-for-task.test.ts +176 -0
- package/src/tools/auditTask.ts +99 -59
- package/src/tools/createDirectSession.ts +3 -3
- package/src/tools/createTask.ts +7 -7
- package/src/tools/dispatch/coreDispatch.ts +374 -0
- package/src/tools/dispatch/diagnosticDispatch.ts +101 -0
- package/src/tools/dispatch/directDispatch.ts +167 -0
- package/src/tools/dispatch/goalDispatch.ts +127 -0
- package/src/tools/dispatch/releaseDispatch.ts +65 -0
- package/src/tools/dispatch/types.ts +24 -0
- package/src/tools/evidencePack.ts +490 -0
- package/src/tools/finalizeDirectSession.ts +4 -4
- package/src/tools/goalSubgoalTask.ts +2 -2
- package/src/tools/healthCheck.ts +3 -3
- package/src/tools/listWorkspace.ts +71 -71
- package/src/tools/recommendAgentForTask.ts +79 -0
- package/src/tools/registry.ts +352 -509
- package/src/tools/releaseMode.ts +450 -0
- package/src/tools/retryTask.ts +2 -2
- package/src/tools/runDirectVerificationBundle.ts +98 -0
- package/src/tools/runTaskLoop.ts +526 -0
- package/src/tools/runVerification.ts +8 -0
- package/src/tools/safeViews.ts +4 -2
- package/src/tools/taskLineage.ts +300 -0
- package/src/tools/toolCatalog.ts +6 -0
- package/src/tools/toolRegistry.ts +132 -0
- package/src/version.ts +2 -2
- package/ui/pages/audit.html +192 -3
- package/ui/pages/dashboard.html +1070 -14
- package/ui/pages/direct-sessions.html +505 -53
- package/ui/pages/task-detail.html +456 -438
- package/ui/pages/tasks.html +598 -61
|
@@ -0,0 +1,365 @@
|
|
|
1
|
+
# PatchWarden Roadmap Execution And Acceptance Plan
|
|
2
|
+
|
|
3
|
+
> Created: 2026-07-09
|
|
4
|
+
> Source document: `C:\Users\zengjie\Downloads\PatchWarden_项目推进与外部PR路线图.docx`
|
|
5
|
+
> Scope: feasibility check, executable steps, and acceptance commands for PatchWarden-first ecosystem work.
|
|
6
|
+
|
|
7
|
+
## Conclusion
|
|
8
|
+
|
|
9
|
+
The roadmap is feasible, but it needs two corrections before execution:
|
|
10
|
+
|
|
11
|
+
1. `v1.5.1` is not published yet. Local source is `1.5.1`, but GitHub Release and npm `latest` are still `v1.5.0`.
|
|
12
|
+
2. Goal Session is not a greenfield feature. PatchWarden already has Goal/Subgoal tools; the next valuable work is final report export, Spec Kit import, and better evidence mapping.
|
|
13
|
+
|
|
14
|
+
Therefore the execution order should be:
|
|
15
|
+
|
|
16
|
+
1. P0: close and publish `v1.5.1` safely.
|
|
17
|
+
2. P1: finish Evidence Pack v2 and public-facing docs.
|
|
18
|
+
3. P2: submit external PRs in low-risk order: MCP Inspector, AgentSeal, then Spec Kit.
|
|
19
|
+
4. P3: move to OpenCode/OpenHands/Aider integration docs after PatchWarden has published evidence to point at.
|
|
20
|
+
|
|
21
|
+
Codex is responsible for implementation submission and acceptance verification. The user only needs to approve destructive, credentialed, or external-write actions when required by local policy.
|
|
22
|
+
|
|
23
|
+
## Current Verified State
|
|
24
|
+
|
|
25
|
+
Checked from `D:\ai_agent\Reasonix\reasonix_program\PatchWarden` on 2026-07-09:
|
|
26
|
+
|
|
27
|
+
- Branch: `codex/patchwarden-v1.5.0`
|
|
28
|
+
- HEAD: `cc27e6a Add OSS application evidence materials`
|
|
29
|
+
- Worktree: dirty before this plan was added; preserve existing user changes.
|
|
30
|
+
- `package.json`: `patchwarden@1.5.1`
|
|
31
|
+
- GitHub Release latest: `v1.5.0`
|
|
32
|
+
- npm `patchwarden`: `version=1.5.0`, `dist-tags.latest=1.5.0`
|
|
33
|
+
- PR #24: open draft, CI passing, branch behind `main`
|
|
34
|
+
- Local gates run successfully:
|
|
35
|
+
- `npm.cmd run build`
|
|
36
|
+
- `npm.cmd run test:unit`
|
|
37
|
+
- `npm.cmd run doctor:ci`
|
|
38
|
+
- `npm.cmd run verify:package`
|
|
39
|
+
|
|
40
|
+
## P0: v1.5.1 Trusted Release
|
|
41
|
+
|
|
42
|
+
### Objective
|
|
43
|
+
|
|
44
|
+
Make `v1.5.1` a real published version, not just a local source version.
|
|
45
|
+
|
|
46
|
+
### Execution
|
|
47
|
+
|
|
48
|
+
```powershell
|
|
49
|
+
git status --short --branch
|
|
50
|
+
gh pr view 24 --repo jiezeng2004-design/PatchWarden --json number,title,state,isDraft,mergeStateStatus,headRefName,headRefOid,baseRefName,statusCheckRollup,url
|
|
51
|
+
npm.cmd view patchwarden version dist-tags --json --cache "$env:TEMP\patchwarden-npm-cache"
|
|
52
|
+
gh release view --repo jiezeng2004-design/PatchWarden --json tagName,name,isDraft,isPrerelease,publishedAt,url
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
If PR #24 is still behind `main`, update the branch without overwriting local work:
|
|
56
|
+
|
|
57
|
+
```powershell
|
|
58
|
+
git fetch origin main
|
|
59
|
+
git rebase origin/main
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
If `git fetch` fails with Windows credential errors, stop and repair Git credential/proxy state before retrying. Do not work around it by force-pushing or resetting.
|
|
63
|
+
|
|
64
|
+
After branch update:
|
|
65
|
+
|
|
66
|
+
```powershell
|
|
67
|
+
npm.cmd ci
|
|
68
|
+
npm.cmd run build
|
|
69
|
+
npm.cmd run test:unit
|
|
70
|
+
npm.cmd run test:mcp
|
|
71
|
+
npm.cmd run test:http-mcp
|
|
72
|
+
npm.cmd run doctor:ci
|
|
73
|
+
npm.cmd run verify:package
|
|
74
|
+
npm.cmd test
|
|
75
|
+
npm.cmd run pack:clean
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
### Submission
|
|
79
|
+
|
|
80
|
+
Codex owns:
|
|
81
|
+
|
|
82
|
+
- push updated branch
|
|
83
|
+
- mark PR #24 ready for review only after local gates pass
|
|
84
|
+
- monitor GitHub Actions
|
|
85
|
+
- merge only through PR when checks are green
|
|
86
|
+
- create tag and GitHub Release for `v1.5.1`
|
|
87
|
+
- publish npm package only after npm auth is confirmed without exposing tokens
|
|
88
|
+
|
|
89
|
+
### Acceptance
|
|
90
|
+
|
|
91
|
+
```powershell
|
|
92
|
+
gh pr view 24 --repo jiezeng2004-design/PatchWarden --json state,mergeStateStatus,statusCheckRollup
|
|
93
|
+
gh release view v1.5.1 --repo jiezeng2004-design/PatchWarden --json tagName,name,isDraft,isPrerelease,publishedAt,url
|
|
94
|
+
npm.cmd view patchwarden version dist-tags --json --cache "$env:TEMP\patchwarden-npm-cache"
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
Pass criteria:
|
|
98
|
+
|
|
99
|
+
- PR merged.
|
|
100
|
+
- GitHub Release `v1.5.1` exists and is not draft.
|
|
101
|
+
- npm `version` is `1.5.1`.
|
|
102
|
+
- npm `dist-tags.latest` is `1.5.1`.
|
|
103
|
+
- release notes do not claim anything not verified by CI/GitHub/npm.
|
|
104
|
+
|
|
105
|
+
## P1: Evidence Pack v2
|
|
106
|
+
|
|
107
|
+
### Objective
|
|
108
|
+
|
|
109
|
+
Make Evidence Pack the project signature capability: bounded human summary plus structured machine-readable evidence.
|
|
110
|
+
|
|
111
|
+
### Current Gap
|
|
112
|
+
|
|
113
|
+
Current export writes:
|
|
114
|
+
|
|
115
|
+
- `.patchwarden/evidence-packs/<lineage_id>/evidence.json`
|
|
116
|
+
- `.patchwarden/evidence-packs/<lineage_id>/EVIDENCE.md`
|
|
117
|
+
|
|
118
|
+
The roadmap asks for richer named artifacts:
|
|
119
|
+
|
|
120
|
+
- `risk.json`
|
|
121
|
+
- `verify.json`
|
|
122
|
+
- `diffstat.json`
|
|
123
|
+
- `lineage.json`
|
|
124
|
+
- `attestation.json`
|
|
125
|
+
- `redactions.json`
|
|
126
|
+
|
|
127
|
+
This is feasible as an incremental schema upgrade, not a rewrite.
|
|
128
|
+
|
|
129
|
+
### Execution
|
|
130
|
+
|
|
131
|
+
Primary files:
|
|
132
|
+
|
|
133
|
+
- `src/tools/evidencePack.ts`
|
|
134
|
+
- `src/tools/taskLineage.ts`
|
|
135
|
+
- `src/tools/registry.ts`
|
|
136
|
+
- `src/tools/toolRegistry.ts`
|
|
137
|
+
- `src/test/unit/evidence-pack.test.ts` or existing v1.5 evidence tests
|
|
138
|
+
- `docs/evidence-pack-schema.md`
|
|
139
|
+
- `docs/lineage-evidence-pack-workflow.md`
|
|
140
|
+
|
|
141
|
+
Implementation rules:
|
|
142
|
+
|
|
143
|
+
- Keep exports bounded.
|
|
144
|
+
- Do not include full stdout, stderr, full diff, secrets, `.env`, tokens, cookies, browser state, or credential paths.
|
|
145
|
+
- Store redaction metadata as categories and reasons, not raw hidden values.
|
|
146
|
+
- Include PatchWarden version, commit, package version, Node version, OS, tool profile, and schema epoch in attestation.
|
|
147
|
+
|
|
148
|
+
### Acceptance
|
|
149
|
+
|
|
150
|
+
```powershell
|
|
151
|
+
npm.cmd run build
|
|
152
|
+
npm.cmd run test:unit
|
|
153
|
+
npm.cmd run doctor:ci
|
|
154
|
+
npm.cmd run verify:package
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
Additional manual acceptance:
|
|
158
|
+
|
|
159
|
+
- Run or reuse a `run_task_loop` lineage.
|
|
160
|
+
- Export Evidence Pack.
|
|
161
|
+
- Confirm all v2 files exist.
|
|
162
|
+
- Confirm `EVIDENCE.md` is readable and bounded.
|
|
163
|
+
- Confirm `redactions.json` does not contain raw secrets.
|
|
164
|
+
- Confirm no `.patchwarden/evidence-packs` output is included in npm package.
|
|
165
|
+
|
|
166
|
+
## P1: README And Docs Readiness
|
|
167
|
+
|
|
168
|
+
### Objective
|
|
169
|
+
|
|
170
|
+
Make the repository understandable to external users before sending traffic from external PRs.
|
|
171
|
+
|
|
172
|
+
### Execution
|
|
173
|
+
|
|
174
|
+
Add or align these docs:
|
|
175
|
+
|
|
176
|
+
- `docs/why-patchwarden.md`
|
|
177
|
+
- `docs/evidence-pack-schema.md`
|
|
178
|
+
- `docs/spec-kit-integration.md`
|
|
179
|
+
- `docs/agentseal-integration.md`
|
|
180
|
+
- `docs/mcp-inspector-testing.md`
|
|
181
|
+
- `docs/opencode-worker.md`
|
|
182
|
+
- `docs/openhands-worker.md`
|
|
183
|
+
- `docs/threat-model.md` already exists; update instead of duplicating.
|
|
184
|
+
|
|
185
|
+
README front page should preserve these sections:
|
|
186
|
+
|
|
187
|
+
1. one-line positioning
|
|
188
|
+
2. architecture diagram
|
|
189
|
+
3. why PatchWarden is not a remote shell
|
|
190
|
+
4. five-minute demo
|
|
191
|
+
5. Evidence Pack screenshot or text sample
|
|
192
|
+
6. supported agents
|
|
193
|
+
7. safety boundaries
|
|
194
|
+
8. ecosystem adaptation
|
|
195
|
+
|
|
196
|
+
### Acceptance
|
|
197
|
+
|
|
198
|
+
```powershell
|
|
199
|
+
npm.cmd run build
|
|
200
|
+
npm.cmd run check:brand
|
|
201
|
+
npm.cmd run doctor:ci
|
|
202
|
+
npm.cmd run verify:package
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
Pass criteria:
|
|
206
|
+
|
|
207
|
+
- README does not say `v1.5.1` is published until npm and GitHub confirm it.
|
|
208
|
+
- Docs explain safety boundaries before external integrations.
|
|
209
|
+
- Examples use placeholders for published versions unless release truth exists.
|
|
210
|
+
|
|
211
|
+
## P2: External PR Batch 1
|
|
212
|
+
|
|
213
|
+
### 1. MCP Inspector
|
|
214
|
+
|
|
215
|
+
Why first: it is directly relevant, low-risk, and the upstream project is a testing tool for MCP servers.
|
|
216
|
+
|
|
217
|
+
PR shape:
|
|
218
|
+
|
|
219
|
+
- `docs: add CLI smoke testing example for MCP servers`
|
|
220
|
+
- Generic first; PatchWarden only as one example if appropriate.
|
|
221
|
+
|
|
222
|
+
Execution:
|
|
223
|
+
|
|
224
|
+
```powershell
|
|
225
|
+
git clone https://github.com/modelcontextprotocol/inspector.git
|
|
226
|
+
cd inspector
|
|
227
|
+
git checkout -b docs/cli-smoke-testing-example
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
Codex then inspects upstream contribution rules, edits docs only, runs upstream docs/lint/test commands, pushes fork branch, opens PR, and monitors CI.
|
|
231
|
+
|
|
232
|
+
Acceptance:
|
|
233
|
+
|
|
234
|
+
- Upstream tests or docs checks pass.
|
|
235
|
+
- PR avoids promotional wording.
|
|
236
|
+
- PR can stand alone without PatchWarden.
|
|
237
|
+
|
|
238
|
+
### 2. AgentSeal
|
|
239
|
+
|
|
240
|
+
Why second: AgentSeal scans dangerous agent skills and MCP configs, which matches PatchWarden policy/config detection.
|
|
241
|
+
|
|
242
|
+
PR shape:
|
|
243
|
+
|
|
244
|
+
- `feat: detect PatchWarden MCP configs and project policies`
|
|
245
|
+
- or `docs: add guarded local agent execution pattern` if code detector scope is too broad.
|
|
246
|
+
|
|
247
|
+
Execution:
|
|
248
|
+
|
|
249
|
+
```powershell
|
|
250
|
+
git clone https://github.com/getagentseal/agentseal.git
|
|
251
|
+
cd agentseal
|
|
252
|
+
git checkout -b detect/patchwarden-policy
|
|
253
|
+
```
|
|
254
|
+
|
|
255
|
+
Codex then inspects `CONTRIBUTING.md`, existing probes, and tests before choosing code or docs scope.
|
|
256
|
+
|
|
257
|
+
Acceptance:
|
|
258
|
+
|
|
259
|
+
- Detector recognizes `.patchwarden/config.json` and `project-policy.json` without reading secrets.
|
|
260
|
+
- Tests cover positive and negative fixtures.
|
|
261
|
+
- PR describes a general safety pattern, not just PatchWarden marketing.
|
|
262
|
+
|
|
263
|
+
### 3. PatchWarden Compatibility Docs
|
|
264
|
+
|
|
265
|
+
Why third: after first two external drafts, PatchWarden should document how to reproduce those workflows.
|
|
266
|
+
|
|
267
|
+
Execution:
|
|
268
|
+
|
|
269
|
+
```powershell
|
|
270
|
+
npm.cmd run build
|
|
271
|
+
npm.cmd run doctor:ci
|
|
272
|
+
```
|
|
273
|
+
|
|
274
|
+
Add:
|
|
275
|
+
|
|
276
|
+
- `docs/mcp-inspector-testing.md`
|
|
277
|
+
- `docs/agentseal-integration.md`
|
|
278
|
+
|
|
279
|
+
Acceptance:
|
|
280
|
+
|
|
281
|
+
- Commands are runnable on Windows PowerShell.
|
|
282
|
+
- Docs link to real upstream PRs or issues after submission.
|
|
283
|
+
|
|
284
|
+
## P2: External PR Batch 2
|
|
285
|
+
|
|
286
|
+
### Spec Kit
|
|
287
|
+
|
|
288
|
+
Why after Evidence Pack v2: Spec Kit is a strong fit, but PatchWarden needs a stable evidence schema before proposing integration.
|
|
289
|
+
|
|
290
|
+
PR shape:
|
|
291
|
+
|
|
292
|
+
- `docs: add evidence pack pattern for spec-driven development`
|
|
293
|
+
- or `walkthrough: verify implemented tasks with an external MCP safety layer`
|
|
294
|
+
|
|
295
|
+
Execution:
|
|
296
|
+
|
|
297
|
+
```powershell
|
|
298
|
+
git clone https://github.com/github/spec-kit.git
|
|
299
|
+
cd spec-kit
|
|
300
|
+
git checkout -b docs/evidence-verification-pattern
|
|
301
|
+
```
|
|
302
|
+
|
|
303
|
+
Acceptance:
|
|
304
|
+
|
|
305
|
+
- PR maps spec -> tasks -> implementation -> evidence verification.
|
|
306
|
+
- PatchWarden appears only as an example implementation.
|
|
307
|
+
- Upstream docs checks pass.
|
|
308
|
+
|
|
309
|
+
## P3: External PR Batch 3
|
|
310
|
+
|
|
311
|
+
### OpenCode / OpenHands / Aider
|
|
312
|
+
|
|
313
|
+
These are feasible but should not be first:
|
|
314
|
+
|
|
315
|
+
- OpenCode has high traffic and a large repo; start with docs-only external supervisor pattern.
|
|
316
|
+
- OpenHands is transitioning source ownership; inspect current repo structure before choosing target.
|
|
317
|
+
- Aider is mature CLI tooling; a safe wrapper pattern is useful but should follow a published PatchWarden example.
|
|
318
|
+
|
|
319
|
+
Acceptance for each:
|
|
320
|
+
|
|
321
|
+
- Upstream contribution rules inspected.
|
|
322
|
+
- PR is useful without requiring PatchWarden.
|
|
323
|
+
- CI or documented local checks pass.
|
|
324
|
+
- PatchWarden README links back only after PR exists.
|
|
325
|
+
|
|
326
|
+
## Issue Backlog To Create
|
|
327
|
+
|
|
328
|
+
Create these as GitHub issues after P0 release truth is clean:
|
|
329
|
+
|
|
330
|
+
1. `fix: close v1.5.1 release truth gap`
|
|
331
|
+
2. `feat: add Evidence Pack v2 artifact schema`
|
|
332
|
+
3. `docs: add Evidence Pack v2 schema reference`
|
|
333
|
+
4. `feat: export goal final report`
|
|
334
|
+
5. `feat: import Spec Kit tasks into Goal Session`
|
|
335
|
+
6. `docs: add MCP Inspector CLI smoke testing guide`
|
|
336
|
+
7. `docs: add AgentSeal compatibility guide`
|
|
337
|
+
8. `docs: add OpenCode worker integration guide`
|
|
338
|
+
9. `docs: add OpenHands worker integration guide`
|
|
339
|
+
10. `docs: add external PR roadmap and ecosystem compatibility matrix`
|
|
340
|
+
|
|
341
|
+
## Global Acceptance Rules
|
|
342
|
+
|
|
343
|
+
For every internal PatchWarden PR:
|
|
344
|
+
|
|
345
|
+
```powershell
|
|
346
|
+
npm.cmd run build
|
|
347
|
+
npm.cmd run test:unit
|
|
348
|
+
npm.cmd run test:mcp
|
|
349
|
+
npm.cmd run test:http-mcp
|
|
350
|
+
npm.cmd run doctor:ci
|
|
351
|
+
npm.cmd run verify:package
|
|
352
|
+
```
|
|
353
|
+
|
|
354
|
+
Before release:
|
|
355
|
+
|
|
356
|
+
```powershell
|
|
357
|
+
npm.cmd ci
|
|
358
|
+
npm.cmd test
|
|
359
|
+
npm.cmd run pack:clean
|
|
360
|
+
gh pr checks <PR_NUMBER> --repo jiezeng2004-design/PatchWarden --watch
|
|
361
|
+
gh release view v<version> --repo jiezeng2004-design/PatchWarden --json tagName,isDraft,publishedAt,url
|
|
362
|
+
npm.cmd view patchwarden version dist-tags --json --cache "$env:TEMP\patchwarden-npm-cache"
|
|
363
|
+
```
|
|
364
|
+
|
|
365
|
+
Never mark release work complete unless GitHub Release and npm registry truth both match the intended version.
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
# Spec Kit 集成模式
|
|
2
|
+
|
|
3
|
+
> 本文基于 v1.5.1 源码编写;安装时请使用已验证发布的 <published-version>。
|
|
4
|
+
> 说明:本文描述的是 PatchWarden 与 Spec Kit 的集成模式建议,**不是** Spec Kit 的官方功能。
|
|
5
|
+
> Spec Kit 是 GitHub 维护的独立项目,本文不声称任何官方集成关系。
|
|
6
|
+
|
|
7
|
+
## Spec Kit 是什么
|
|
8
|
+
|
|
9
|
+
Spec Kit 是 GitHub 推出的 spec-driven development(规格驱动开发)工具集,
|
|
10
|
+
用于在代码实现之前先定义、版本化、验证规格(spec)。典型流程为:
|
|
11
|
+
|
|
12
|
+
1. **Spec**:用结构化方式描述功能需求与验收标准。
|
|
13
|
+
2. **Tasks**:将 spec 拆解为可执行的任务列表。
|
|
14
|
+
3. **Implementation**:由人或 Agent 执行任务。
|
|
15
|
+
4. **Verification**:根据 spec 的验收标准验证实现结果。
|
|
16
|
+
|
|
17
|
+
Spec Kit 的核心价值在于把“要做什么”与“怎么做”显式分离,让验收有据可依。
|
|
18
|
+
|
|
19
|
+
## PatchWarden 在 Spec Kit 流程中的位置
|
|
20
|
+
|
|
21
|
+
PatchWarden 不替代 Spec Kit 的规格定义能力,而是承担 Spec Kit 流程中
|
|
22
|
+
“Implementation”与“Verification”两个阶段的**安全执行与证据收集**角色:
|
|
23
|
+
|
|
24
|
+
```
|
|
25
|
+
Spec Kit: spec → tasks → implementation → verification
|
|
26
|
+
↑ ↑
|
|
27
|
+
PatchWarden 在此执行并产出 Evidence Pack v2
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
- **Implementation 阶段**:PatchWarden 以 MCP 安全桥接器身份接收任务,
|
|
31
|
+
在 workspace 隔离、命令允许列表、范围违规检测下执行。
|
|
32
|
+
- **Verification 阶段**:PatchWarden 导出 Evidence Pack v2,作为 spec
|
|
33
|
+
验收的结构化证据。
|
|
34
|
+
|
|
35
|
+
## Evidence Pack v2 作为 spec 验收证据
|
|
36
|
+
|
|
37
|
+
Spec Kit 的验收标准通常是自然语言描述。PatchWarden 的 Evidence Pack v2
|
|
38
|
+
提供机器可读的对应物,便于自动化对齐:
|
|
39
|
+
|
|
40
|
+
| Evidence Pack 文件 | Spec 验收对应物 |
|
|
41
|
+
| --- | --- |
|
|
42
|
+
| `evidence.json` | 任务整体证据,含 lineage、policy、catalog 摘要 |
|
|
43
|
+
| `EVIDENCE.md` | 人类可读摘要,便于 spec reviewer 阅读 |
|
|
44
|
+
| `risk.json` | 实现过程中识别的风险项,对应 spec 的风险条款 |
|
|
45
|
+
| `verify.json` | 每轮迭代的结构化验证记录 |
|
|
46
|
+
| `diffstat.json` | 文件级改动统计,对应 spec 声明的改动范围 |
|
|
47
|
+
| `lineage.json` | 任务谱系,证明实现源自哪条 spec task |
|
|
48
|
+
| `attestation.json` | 任务签名与证明 |
|
|
49
|
+
| `redactions.json` | 已脱敏内容清单 |
|
|
50
|
+
|
|
51
|
+
## 集成流程示例
|
|
52
|
+
|
|
53
|
+
### 1. 在 Spec Kit 中定义 spec 与 tasks
|
|
54
|
+
|
|
55
|
+
在 Spec Kit 仓库中编写 spec 与 task 清单,例如:
|
|
56
|
+
|
|
57
|
+
```json
|
|
58
|
+
{
|
|
59
|
+
"spec": "add-rate-limit-middleware",
|
|
60
|
+
"tasks": [
|
|
61
|
+
{ "id": "T1", "desc": "implement rate limiter", "files": ["src/middleware/rate.ts"] },
|
|
62
|
+
{ "id": "T2", "desc": "add tests", "files": ["test/middleware/rate.test.ts"] }
|
|
63
|
+
],
|
|
64
|
+
"acceptance": ["T1 passes", "T2 passes", "no changes outside declared files"]
|
|
65
|
+
}
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
### 1.5 批量导入 Spec Kit tasks 为 PatchWarden subgoal
|
|
69
|
+
|
|
70
|
+
PatchWarden 提供 `import_speckit_tasks` 工具,可将 Spec Kit 的 tasks 批量导入为 Goal 下的 subgoal:
|
|
71
|
+
|
|
72
|
+
- 每个 Spec Kit task 创建一个对应 subgoal,title 取自 task.desc
|
|
73
|
+
- task.files 映射为 subgoal 的 scope_hints(声明改动范围提示)
|
|
74
|
+
- task.depends_on 映射为 subgoal 间的依赖关系
|
|
75
|
+
- Spec Kit 的 acceptance[] 存入 Goal 的 acceptance_criteria 字段
|
|
76
|
+
- 支持幂等导入:重复导入同一 Spec Kit JSON 不会创建重复 subgoal
|
|
77
|
+
|
|
78
|
+
### 2. 通过 PatchWarden 执行任务
|
|
79
|
+
|
|
80
|
+
将 Spec Kit 的 task 通过 MCP 客户端交给 PatchWarden:
|
|
81
|
+
|
|
82
|
+
```powershell
|
|
83
|
+
# 假设 PatchWarden MCP server 已启动
|
|
84
|
+
# MCP 客户端调用 PatchWarden 工具,传入 task 描述与声明的文件范围
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
PatchWarden 会在执行时:
|
|
88
|
+
|
|
89
|
+
- 校验改动是否仅在 `src/middleware/rate.ts` 与 `test/middleware/rate.test.ts`。
|
|
90
|
+
- 阻断任何越界文件改动或未注册命令。
|
|
91
|
+
- 在每轮迭代后记录结构化验证。
|
|
92
|
+
|
|
93
|
+
### 3. 导出 Evidence Pack 并与 spec 对齐
|
|
94
|
+
|
|
95
|
+
任务完成后导出 Evidence Pack v2:
|
|
96
|
+
|
|
97
|
+
```powershell
|
|
98
|
+
# 通过 MCP 工具 export_task_evidence_pack 导出
|
|
99
|
+
# 产物位于 .patchwarden/evidence-packs/<lineage_id>/
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
随后可用脚本将 `diffstat.json` 与 spec 声明的 `files` 对齐,
|
|
103
|
+
将 `verify.json` 与 spec `acceptance` 对齐。
|
|
104
|
+
|
|
105
|
+
### 4. Spec 验收
|
|
106
|
+
|
|
107
|
+
reviewer 阅读 `EVIDENCE.md` 与 `verify.json`,
|
|
108
|
+
确认实现满足 spec 验收标准后标记 spec 为已验收。
|
|
109
|
+
|
|
110
|
+
## 配置要点
|
|
111
|
+
|
|
112
|
+
- PatchWarden 的 `workspaceRoot` 应覆盖 Spec Kit 仓库根目录。
|
|
113
|
+
- Spec Kit 的 task 中声明的文件范围应与 PatchWarden Project Policy 的
|
|
114
|
+
allowed paths 一致,避免执行时被范围违规检测阻断。
|
|
115
|
+
- Evidence Pack v2 的 `lineage.json` 可用于回溯到 Spec Kit 的 task id,
|
|
116
|
+
建议在任务描述中包含 Spec Kit task id。
|
|
117
|
+
|
|
118
|
+
## 边界与注意事项
|
|
119
|
+
|
|
120
|
+
- PatchWarden 不解析 Spec Kit 的 spec 格式本身,只处理 tasks 与 acceptance 字段并产出证据。
|
|
121
|
+
- Spec Kit 的 spec 验收逻辑由 Spec Kit 自身或 reviewer 负责,
|
|
122
|
+
PatchWarden 只提供证据材料。
|
|
123
|
+
- 本集成模式不修改 Spec Kit 的任何行为,仅在流程上配合使用。
|
|
124
|
+
- 如 Spec Kit task 要求读取 `.env` 或敏感文件,PatchWarden 会按安全契约阻断,
|
|
125
|
+
此时需要重新设计 task 以避免触碰敏感资源。
|
|
126
|
+
|
|
127
|
+
## 相关文档
|
|
128
|
+
|
|
129
|
+
- `docs/evidence-pack-schema.md`:Evidence Pack v2 文件结构。
|
|
130
|
+
- `docs/threat-model.md`:PatchWarden 安全契约。
|
|
131
|
+
- `docs/why-patchwarden.md`:PatchWarden 定位与动机。
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
# 任务 Safe 验收工作流
|
|
2
|
+
|
|
3
|
+
> 本文基于 v1.5.1 源码编写;安装时请使用已验证发布的 <published-version>。
|
|
4
|
+
> 相关页面:Tasks、Task Detail
|
|
5
|
+
|
|
6
|
+
## 目的
|
|
7
|
+
|
|
8
|
+
在不暴露完整日志、diff、test log 的前提下,用一组 safe 摘要接口完成对单个任务的
|
|
9
|
+
验收判断。完整产物仅在确认需要时才从折叠的“高级区”按需加载。
|
|
10
|
+
|
|
11
|
+
## 核心概念
|
|
12
|
+
|
|
13
|
+
- **safe_result**:任务结果摘要,包含 status、acceptance_status、verification 概要、
|
|
14
|
+
warnings、fail_checks、manual_verification_required、recommended_next_actions。
|
|
15
|
+
- **safe_test_summary**:测试摘要,只包含通过/失败计数和失败用例名称,不含完整 stdout。
|
|
16
|
+
- **safe_diff_summary**:diff 摘要,包含变更文件数、新增/删除/修改行数统计、
|
|
17
|
+
受保护路径命中情况,不含完整 diff。
|
|
18
|
+
- **safe_audit**:审计摘要,包含 artifact 完整性、scope_changes、命令白名单合规性
|
|
19
|
+
的有界摘要。
|
|
20
|
+
- **acceptance_status**:任务的验收状态,比 `status` 更能反映“是否真的通过”。
|
|
21
|
+
- **Advanced 区**:折叠区域,包含完整 result / diff / test_log,需手动展开。
|
|
22
|
+
|
|
23
|
+
## 验收工作流
|
|
24
|
+
|
|
25
|
+
### 1. 在 Tasks 列表筛选目标任务
|
|
26
|
+
|
|
27
|
+
Tasks 页支持按 `repo_path` / `status` / `acceptance_status` / `warning_type` /
|
|
28
|
+
`agent` / date range 过滤。建议优先关注:
|
|
29
|
+
|
|
30
|
+
- `acceptance_status` 为 `pending` 或 `failed_verification` 的任务
|
|
31
|
+
- 带有 warning 的任务(warning_type 列会高亮)
|
|
32
|
+
|
|
33
|
+
### 2. 使用行内快捷操作预览
|
|
34
|
+
|
|
35
|
+
每行任务提供以下快捷操作,无需进入详情页即可快速判断:
|
|
36
|
+
|
|
37
|
+
- `safe_result` — 查看任务结果摘要
|
|
38
|
+
- `safe_test_summary` — 查看测试摘要
|
|
39
|
+
- `safe_diff_summary` — 查看变更摘要
|
|
40
|
+
- `safe_audit` — 查看审计摘要
|
|
41
|
+
- `open detail` — 进入 Task Detail 页
|
|
42
|
+
- `copy id` — 复制完整 task_id
|
|
43
|
+
|
|
44
|
+
### 3. 进入 Task Detail 进行完整 safe 验收
|
|
45
|
+
|
|
46
|
+
Task Detail 默认展示 safe 摘要视图:
|
|
47
|
+
|
|
48
|
+
- **safe_result** 区:status、acceptance_status、verification headline、warnings、
|
|
49
|
+
fail_checks、manual_verification_required、recommended_next_actions
|
|
50
|
+
- **safe_test_summary** 区:通过/失败计数、失败用例名
|
|
51
|
+
- **safe_diff_summary** 区:变更文件数、行数统计、受保护路径命中
|
|
52
|
+
- **safe_audit** 区:artifact 完整性、scope_changes、命令合规性
|
|
53
|
+
|
|
54
|
+
### 4. 仅在必要时展开高级区
|
|
55
|
+
|
|
56
|
+
只有当 safe 摘要无法定论时(例如 `manual_verification_required` 为 true,
|
|
57
|
+
或 `fail_checks` 指向某个具体失败),才展开高级区查看完整产物:
|
|
58
|
+
|
|
59
|
+
- 完整 result(JSON)
|
|
60
|
+
- 完整 diff
|
|
61
|
+
- 完整 test_log
|
|
62
|
+
|
|
63
|
+
> 高级区内容不会自动加载,必须手动点击展开。展开不会触发任何写操作。
|
|
64
|
+
|
|
65
|
+
### 5. 根据 recommended_next_actions 决定下一步
|
|
66
|
+
|
|
67
|
+
safe_result 的 `recommended_next_actions` 会给出建议,例如:
|
|
68
|
+
|
|
69
|
+
- 验收通过 → 导出 Evidence Pack 或进行 Direct 独立验证
|
|
70
|
+
- 验收失败 → 基于 `run_task_loop` 创建修复任务
|
|
71
|
+
- 需要人工确认 → 标记 `manual_verification_required` 后人工复核
|
|
72
|
+
|
|
73
|
+
## Stale 任务处理
|
|
74
|
+
|
|
75
|
+
Stale 任务卡片会给出 explanation 和 next_action:
|
|
76
|
+
|
|
77
|
+
- **view detail** — 查看 safe 摘要判断是否需要重建
|
|
78
|
+
- **copy task_id** — 复制 id 用于后续命令
|
|
79
|
+
- **hide** — 调用 `POST /api/tasks/:taskId/hide-stale` 从 stale 列表隐藏
|
|
80
|
+
- **recreate task** — 基于原任务参数创建新任务
|
|
81
|
+
|
|
82
|
+
## 安全边界
|
|
83
|
+
|
|
84
|
+
- safe 接口返回有界摘要,不含完整 stdout/stderr、完整 diff、密钥、token。
|
|
85
|
+
- 完整产物仅在高级区手动展开后加载,且不离开本机。
|
|
86
|
+
- 验收操作不触发远程写(不 publish、不 push、不 tag、不 release)。
|
|
87
|
+
- `acceptance_status` 由 watcher 与 verification 流程计算,不能从 UI 直接伪造。
|
|
88
|
+
|
|
89
|
+
## 相关 API 端点
|
|
90
|
+
|
|
91
|
+
- `GET /api/tasks` — 任务列表(支持 repo_path / status / acceptance_status /
|
|
92
|
+
agent / warning_type 过滤)
|
|
93
|
+
- `GET /api/tasks/:taskId/safe-result` — safe_result 摘要
|
|
94
|
+
- `GET /api/tasks/:taskId/safe-test-summary` — safe_test_summary 摘要
|
|
95
|
+
- `GET /api/tasks/:taskId/safe-diff-summary` — safe_diff_summary 摘要
|
|
96
|
+
- `GET /api/tasks/:taskId/safe-audit` — safe_audit 摘要
|
|
97
|
+
- `GET /api/tasks/stale` — stale 任务列表(含 explanation / next_action)
|
|
98
|
+
- `POST /api/tasks/:taskId/hide-stale` — 隐藏 stale 任务
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
# PatchWarden Threat Model
|
|
2
|
+
|
|
3
|
+
PatchWarden is a local MCP bridge for AI coding workflows. Its core security
|
|
4
|
+
goal is to let an MCP client request bounded maintainer tasks without turning
|
|
5
|
+
the local machine into a general-purpose remote shell.
|
|
6
|
+
|
|
7
|
+
## Assets Protected
|
|
8
|
+
|
|
9
|
+
- source repositories under the configured workspace
|
|
10
|
+
- release artifacts and checksums
|
|
11
|
+
- task evidence under `.patchwarden/`
|
|
12
|
+
- local configuration files
|
|
13
|
+
- `.env` files, API keys, tokens, SSH keys, cookies, browser state, and
|
|
14
|
+
credential stores
|
|
15
|
+
- maintainer time and trust in verification evidence
|
|
16
|
+
|
|
17
|
+
## Trust Boundaries
|
|
18
|
+
|
|
19
|
+
PatchWarden assumes the upstream model or MCP client can be wrong, overbroad, or
|
|
20
|
+
prompt-injected. It should not be trusted with unrestricted command execution,
|
|
21
|
+
arbitrary filesystem reads, or release authority.
|
|
22
|
+
|
|
23
|
+
Trusted local configuration includes:
|
|
24
|
+
|
|
25
|
+
- `workspaceRoot`
|
|
26
|
+
- registered agents and their command templates
|
|
27
|
+
- `allowedTestCommands`
|
|
28
|
+
- project policy files reviewed by the maintainer
|
|
29
|
+
|
|
30
|
+
Human maintainer confirmation remains required for high-risk actions such as
|
|
31
|
+
publishing, pushing, creating releases, changing live services, or approving
|
|
32
|
+
local confirmation tickets.
|
|
33
|
+
|
|
34
|
+
## Main Threats
|
|
35
|
+
|
|
36
|
+
| Threat | Example | Mitigation |
|
|
37
|
+
| --- | --- | --- |
|
|
38
|
+
| Arbitrary shell execution | A prompt asks the MCP server to run a custom command. | PatchWarden exposes task tools, not a general shell; verification commands must exactly match allowlists. |
|
|
39
|
+
| Path traversal | A task tries to edit `../other-project` or user home files. | Task paths are resolved under `workspaceRoot`; out-of-scope changes are reported as violations. |
|
|
40
|
+
| Secret exfiltration | A task asks to read `.env`, SSH keys, cookies, or credentials. | Sensitive path names are blocked and docs require redacted logs. |
|
|
41
|
+
| Prompt injection | Repository text instructs the model to ignore safety constraints. | Safety is enforced by local code and configuration, not by prompt instructions alone. |
|
|
42
|
+
| Unsafe release claims | A local build passes and the agent claims npm/GitHub publish is complete. | Release docs require separate verification of PR/CI, GitHub Release, npm version, and `dist-tags.latest`. |
|
|
43
|
+
| Evidence overload | A client requests full logs, diffs, or private task history by default. | Safe summary tools and bounded evidence packs are the preferred review surfaces. |
|
|
44
|
+
| Live-service disruption | A task restarts tunnels, watchers, or unrelated processes. | Project rules forbid blanket process kills; live cutover must be explicit and separately approved. |
|
|
45
|
+
|
|
46
|
+
## Security Invariants
|
|
47
|
+
|
|
48
|
+
PatchWarden changes should preserve these invariants:
|
|
49
|
+
|
|
50
|
+
- no general-purpose remote shell
|
|
51
|
+
- all task repositories stay under `workspaceRoot`
|
|
52
|
+
- agents are explicitly registered before use
|
|
53
|
+
- model input cannot define arbitrary agent launch commands
|
|
54
|
+
- verification commands use exact allowlist matching
|
|
55
|
+
- sensitive paths remain blocked
|
|
56
|
+
- task artifacts remain auditable and redacted where appropriate
|
|
57
|
+
- scope violations are surfaced, not silently accepted
|
|
58
|
+
- publish, push, tag, release, and live-service operations remain
|
|
59
|
+
confirmation-gated
|
|
60
|
+
|
|
61
|
+
## Non-Goals
|
|
62
|
+
|
|
63
|
+
PatchWarden is not a full sandbox, container runtime, endpoint security product,
|
|
64
|
+
or secret scanner. It adds policy, task evidence, verification, and review
|
|
65
|
+
records around local agent work. It should be used with normal operating-system
|
|
66
|
+
permissions, Git review, CI, and maintainer judgment.
|
|
67
|
+
|
|
68
|
+
## Review Checklist For Security-Sensitive Changes
|
|
69
|
+
|
|
70
|
+
- [ ] Does the change weaken workspace confinement?
|
|
71
|
+
- [ ] Does it expand command execution beyond exact allowlists?
|
|
72
|
+
- [ ] Does it expose full logs, diffs, task history, or file contents where a
|
|
73
|
+
safe summary would be enough?
|
|
74
|
+
- [ ] Does it read or persist credentials, tokens, cookies, browser state, or
|
|
75
|
+
`.env` content?
|
|
76
|
+
- [ ] Does it auto-push, auto-publish, auto-tag, or restart live services?
|
|
77
|
+
- [ ] Does it add or update smoke coverage for changed behavior?
|
|
78
|
+
- [ ] Does it keep README, examples, tool manifests, package metadata, and
|
|
79
|
+
migration docs aligned?
|