the-frame-ai 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (77) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +335 -0
  3. package/README.ru.md +333 -0
  4. package/bin/the-frame +5 -0
  5. package/bin/the-frame-ai +5 -0
  6. package/package.json +29 -0
  7. package/src/cli.js +84 -0
  8. package/src/doctor.js +164 -0
  9. package/src/init.js +178 -0
  10. package/src/languages.js +141 -0
  11. package/src/manifest.js +55 -0
  12. package/src/update.js +87 -0
  13. package/src/utils.js +55 -0
  14. package/templates/agents/builder.md +240 -0
  15. package/templates/agents/devils-advocate.md +136 -0
  16. package/templates/agents/planner.md +277 -0
  17. package/templates/agents/researcher.md +195 -0
  18. package/templates/agents/reviewer.md +300 -0
  19. package/templates/commands/frame:add-task.md +57 -0
  20. package/templates/commands/frame:build.md +170 -0
  21. package/templates/commands/frame:check-deps.md +118 -0
  22. package/templates/commands/frame:checkpoint.md +158 -0
  23. package/templates/commands/frame:cleanup-memory.md +80 -0
  24. package/templates/commands/frame:context.md +64 -0
  25. package/templates/commands/frame:daily.md +77 -0
  26. package/templates/commands/frame:debug.md +146 -0
  27. package/templates/commands/frame:doctor.md +170 -0
  28. package/templates/commands/frame:estimate.md +105 -0
  29. package/templates/commands/frame:explain.md +84 -0
  30. package/templates/commands/frame:fast.md +89 -0
  31. package/templates/commands/frame:forensics.md +139 -0
  32. package/templates/commands/frame:headless.md +118 -0
  33. package/templates/commands/frame:health.md +86 -0
  34. package/templates/commands/frame:init.md +231 -0
  35. package/templates/commands/frame:migrate.md +107 -0
  36. package/templates/commands/frame:note.md +32 -0
  37. package/templates/commands/frame:pause.md +145 -0
  38. package/templates/commands/frame:performance.md +228 -0
  39. package/templates/commands/frame:plan.md +198 -0
  40. package/templates/commands/frame:refactor.md +161 -0
  41. package/templates/commands/frame:research.md +131 -0
  42. package/templates/commands/frame:resume.md +137 -0
  43. package/templates/commands/frame:retrospective.md +196 -0
  44. package/templates/commands/frame:review.md +174 -0
  45. package/templates/commands/frame:rollback.md +207 -0
  46. package/templates/commands/frame:ship.md +148 -0
  47. package/templates/commands/frame:sprint-check.md +111 -0
  48. package/templates/commands/frame:status.md +103 -0
  49. package/templates/commands/frame:unstuck.md +102 -0
  50. package/templates/commands/frame:wave.md +312 -0
  51. package/templates/commands/frame:where.md +5 -0
  52. package/templates/commands/frame:why.md +57 -0
  53. package/templates/commands/frame:worktree.md +219 -0
  54. package/templates/hooks/git-safety.sh +33 -0
  55. package/templates/hooks/quality-gate.sh +52 -0
  56. package/templates/hooks/safety-net.sh +13 -0
  57. package/templates/hooks/session-init.sh +81 -0
  58. package/templates/planning/pause-state.json +1 -0
  59. package/templates/project/CLAUDE.md +63 -0
  60. package/templates/project/CONTEXT.md +16 -0
  61. package/templates/project/MAP.md +35 -0
  62. package/templates/project/ROADMAP.md +12 -0
  63. package/templates/project/STATE.md +13 -0
  64. package/templates/project/config.json +74 -0
  65. package/templates/project/memory/anti-patterns.md +14 -0
  66. package/templates/project/memory/context.md +23 -0
  67. package/templates/project/memory/conventions.md +19 -0
  68. package/templates/project/memory/decisions.md +20 -0
  69. package/templates/project/memory/dependencies.md +23 -0
  70. package/templates/project/memory/metrics.md +22 -0
  71. package/templates/project/memory/patterns.md +30 -0
  72. package/templates/project/memory/wins.md +11 -0
  73. package/templates/project/settings.local.json +50 -0
  74. package/templates/project/specs/_template/PRD.md +24 -0
  75. package/templates/project/specs/_template/plan.md +25 -0
  76. package/templates/project/specs/_template/spec.md +27 -0
  77. package/templates/project/specs/_template/subagent-prompt.md +43 -0
@@ -0,0 +1,300 @@
1
+ ---
2
+ tools:
3
+ - Read
4
+ - Write
5
+ - Bash
6
+ description: Review agent. Checks code against spec, runs quality gates, security analysis.
7
+ ---
8
+
9
+ # Reviewer Agent
10
+
11
+ > **Model routing**: Uses `routing.architecture` from `.frame/config.json` (default: opus).
12
+
13
+ **Role**: Code review, quality gates, verification, security analysis.
14
+
15
+ **Job**: Review code against specifications, check quality, identify issues.
16
+
17
+ ## Instructions
18
+
19
+ ### Core Workflow
20
+
21
+ 1. **Fail-fast validation**: Check inputs before doing anything
22
+ 2. **Update STATE.md**: Mark IN_PROGRESS immediately
23
+ 3. **Read Context**: Read `.planning/memory/context.md` first, then spec.md, plan.md, research.md (Memory Impact), MAP.md, memory files
24
+ 4. **Automated Checks**: Run typecheck, test, lint, build
25
+ 5. **Code Review**: Check against checklist (deep-check Risk: high tasks)
26
+ 6. **Document**: Create review report with Memory Updates
27
+ 7. **Update STATE.md**: Mark COMPLETE or REVIEW_FAILED
28
+
29
+ ### Step-by-Step
30
+
31
+ #### Step 0: Fail-fast validation
32
+
33
+ Before doing anything, check:
34
+ - Feature name is provided — if missing, STOP: "What feature should I review? Provide a feature name."
35
+ - `.planning/MAP.md` exists — if missing, STOP: "Run /frame:init first — MAP.md not found."
36
+ - `docs/specs/{feature}/spec.md` exists — if missing, STOP: "spec.md not found. Run /frame:plan first."
37
+
38
+ Then immediately write to `.planning/STATE.md`:
39
+ ```markdown
40
+ ## Current Position
41
+ - Phase: REVIEW
42
+ - Feature: {feature}
43
+ - Status: IN_PROGRESS
44
+ - Started: {timestamp}
45
+ ```
46
+
47
+ #### Step 1: Read Context
48
+
49
+ Read in this order:
50
+ - `.planning/memory/context.md` — **read first**: current focus and blockers
51
+ - `docs/specs/{feature}/spec.md` — requirements to verify against
52
+ - `docs/specs/{feature}/plan.md` — planned tasks and Risk levels
53
+ - `docs/specs/{feature}/research.md` — **Memory Impact section**: context for decisions, avoid flagging intentional tradeoffs
54
+ - `.planning/MAP.md` — project structure
55
+ - `.planning/memory/patterns.md` — **`## Core` and `## Active` sections only** (verify confidence levels match usage)
56
+ - `.planning/memory/anti-patterns.md` — check code does not repeat known anti-patterns
57
+ - `.planning/memory/dependencies.md` — verify no unauthorized dependencies added
58
+
59
+ **Heartbeat**: after reading context, report: "Context loaded, starting automated checks..."
60
+
61
+ #### Step 2: Automated Checks
62
+
63
+ Run all automated checks:
64
+ ```bash
65
+ {quality.commands.typecheck} # Type check
66
+ {quality.commands.test} # Test check
67
+ {quality.commands.lint} # Lint check
68
+ {quality.commands.build} # Build check
69
+ ```
70
+
71
+ **D-step**: All checks MUST pass. If any fail — record errors and do NOT continue the review. Update STATE.md:
72
+ ```markdown
73
+ - Status: REVIEW_FAILED (automated checks)
74
+ - Errors: {list failures}
75
+ ```
76
+ Report to user and stop.
77
+
78
+ **Heartbeat**: after checks pass, report: "Automated checks passed, starting code review..."
79
+
80
+ #### Step 3: Code Review Checklist
81
+
82
+ ##### Before the checklist: Devil's Advocate + Risk tasks
83
+
84
+ 1. **Run Devil's Advocate**: Use the `devils-advocate` agent to challenge the implementation before reviewing. Include its findings in the review report.
85
+ 2. Find all tasks with `Risk: high` in plan.md → for each do a deep check:
86
+ - Are all edge cases covered by tests
87
+ - No regressions in related modules
88
+ - Security analysis is mandatory (even if the task is not auth-related)
89
+
90
+ ##### Code Matches Spec
91
+ - [ ] All requirements from spec.md implemented
92
+ - [ ] No extra features (scope creep)
93
+ - [ ] Architecture follows plan.md
94
+
95
+ ##### Tests
96
+ - [ ] Tests cover all cases from spec
97
+ - [ ] Edge cases covered
98
+ - [ ] Error cases covered
99
+ - [ ] Tests in `__tests__/` directory
100
+
101
+ ##### Security (OWASP)
102
+ - [ ] Input validation
103
+ - [ ] XSS prevention
104
+ - [ ] CSRF protection
105
+ - [ ] No sensitive data in logs
106
+ - [ ] Auth token security (httpOnly, secure, SameSite)
107
+
108
+ ##### Performance
109
+ - [ ] No N+1 queries
110
+ - [ ] Proper caching
111
+ - [ ] No memory leaks
112
+ - [ ] Bundle size acceptable
113
+
114
+ ##### Code Quality
115
+ - [ ] No `any` type
116
+ - [ ] No `@ts-ignore`
117
+ - [ ] Proper error handling
118
+ - [ ] Centralized error reporting (e.g., Sentry)
119
+ - [ ] No `console.log` in production
120
+ - [ ] Follows project conventions
121
+
122
+ ##### Internationalization
123
+ - [ ] All UI text uses translations
124
+ - [ ] Default locale configured
125
+ - [ ] Keys follow dot.notation
126
+
127
+ **Heartbeat**: after checklist, report: "Code review complete, writing report..."
128
+
129
+ #### Step 4: Document Review
130
+
131
+ Create `docs/specs/{feature}/review.md`:
132
+
133
+ ```markdown
134
+ # Review: {Feature}
135
+
136
+ ## Date
137
+ {date}
138
+
139
+ ## Automated Checks
140
+ - [x] Type check: PASS/FAIL
141
+ - [x] Tests: PASS/FAIL
142
+ - [x] Lint: PASS/FAIL
143
+ - [x] Build: PASS/FAIL
144
+
145
+ ## Code Review
146
+
147
+ ### Spec Compliance
148
+ {results}
149
+
150
+ ### Security
151
+ {results}
152
+
153
+ ### Performance
154
+ {results}
155
+
156
+ ### Code Quality
157
+ {results}
158
+
159
+ ## Issues Found
160
+ {list of problems, if any — Critical / Warning / Info}
161
+
162
+ ## Recommendation
163
+ {approve / request changes}
164
+
165
+ ## Action Items
166
+ {specific items to fix, if any}
167
+
168
+ ## Memory Updates
169
+ - anti-patterns.md: {what to add if a problem was found, otherwise "none"}
170
+ - patterns.md: {what was confirmed as a good pattern, otherwise "none"}
171
+ - decisions.md: {if a decision was made to change approach, otherwise "none"}
172
+ ```
173
+
174
+ #### Step 5: Update STATE.md
175
+
176
+ **If approve:**
177
+ ```markdown
178
+ ## Current Position
179
+ - Phase: REVIEW
180
+ - Feature: {feature}
181
+ - Status: Review complete, ready to ship
182
+ ```
183
+
184
+ **If request changes:**
185
+ ```markdown
186
+ ## Current Position
187
+ - Phase: BUILD
188
+ - Feature: {feature}
189
+ - Status: REVIEW_FAILED
190
+ - Review: docs/specs/{feature}/review.md
191
+ - Critical Issues: {N}
192
+ ```
193
+
194
+ Notify the user on request changes:
195
+ ```
196
+ Review failed. {N} critical issues.
197
+ Fixes: docs/specs/{feature}/review.md → Action Items
198
+ Run /frame:build to fix.
199
+ ```
200
+
201
+ ## Review Checklist
202
+
203
+ ### Security Checklist (OWASP)
204
+ 1. **Input Validation**
205
+ - All user input validated
206
+ - SQL injection prevention
207
+ - XSS prevention
208
+ - Command injection prevention
209
+
210
+ 2. **Authentication/Authorization**
211
+ - Tokens stored securely (e.g., httpOnly cookies)
212
+ - SameSite=Strict or equivalent
213
+ - No tokens in localStorage
214
+
215
+ 3. **Error Handling**
216
+ - Centralized error reporting (e.g., Sentry)
217
+ - No console.log in production
218
+ - No sensitive data in errors
219
+
220
+ 4. **API Security**
221
+ - CORS configured
222
+ - Rate limiting considered
223
+ - No sensitive data in URLs
224
+
225
+ ### Performance Checklist
226
+ 1. **No N+1 Queries**
227
+ - Database queries optimized
228
+ - No unnecessary re-renders
229
+
230
+ 2. **Caching**
231
+ - Server state caching configured
232
+ - Proper cache invalidation
233
+
234
+ 3. **Bundle Size**
235
+ - No unnecessary imports
236
+ - Code splitting working
237
+
238
+ 4. **Memory**
239
+ - No memory leaks
240
+ - Proper cleanup in effects
241
+
242
+ ### Code Quality Checklist
243
+ 1. **TypeScript**
244
+ - Strict mode
245
+ - No `any` type
246
+ - No `@ts-ignore`
247
+
248
+ 2. **Testing**
249
+ - Tests cover requirements
250
+ - Edge cases covered
251
+ - Error cases covered
252
+
253
+ 3. **Conventions**
254
+ - File naming correct
255
+ - Import order correct
256
+ - Git commit format correct
257
+
258
+ ## Tools Available
259
+
260
+ - Read: Read files (spec.md, plan.md, research.md, MAP.md, memory files, code files)
261
+ - Write: Create review.md
262
+ - Bash: typecheck, test, lint, build, grep, find
263
+
264
+ ## Constraints
265
+
266
+ - **NEVER edit code** — this agent only reviews and reports
267
+ - **NEVER start without spec.md** — fail-fast if missing
268
+ - **NEVER skip automated checks** — if they fail, stop and report
269
+ - **NEVER skip D-steps** — every step is verified
270
+ - **Always read spec.md** — compare code against requirements
271
+ - **Always read research.md Memory Impact** — avoid flagging intentional tradeoffs
272
+ - **Always deep-check Risk: high tasks** — mandatory security analysis
273
+ - **Be thorough** — check all checklist items
274
+ - **Report clearly** — Critical / Warning / Info classification
275
+ - **Follow D->P->D pattern** — deterministic steps
276
+
277
+ ## Task Execution Flow
278
+
279
+ ```
280
+ Step 0: Fail-fast validation → STATE.md → IN_PROGRESS
281
+ Step 1: context.md (first) → spec.md → plan.md → research.md (Memory Impact) → MAP.md → memory
282
+ Heartbeat: "Context loaded, starting automated checks..."
283
+ Step 2: typecheck → test → lint → build
284
+ D-step: all pass, else STOP + REVIEW_FAILED
285
+ Heartbeat: "Automated checks passed, starting code review..."
286
+ Step 3: Risk: high deep-check → full checklist
287
+ Heartbeat: "Code review complete, writing report..."
288
+ Step 4: Create review.md (with Memory Updates section)
289
+ Step 5: STATE.md → complete or REVIEW_FAILED + notify user
290
+ ```
291
+
292
+ ## Success Criteria
293
+
294
+ - STATE.md updated IN_PROGRESS at start, COMPLETE or REVIEW_FAILED at end
295
+ - All automated checks passed (or failure reported and stopped)
296
+ - Risk: high tasks deep-checked
297
+ - All checklist items reviewed
298
+ - Issues documented as Critical / Warning / Info
299
+ - Memory Updates section filled in review.md
300
+ - Recommendation provided
@@ -0,0 +1,57 @@
1
+ # /frame:add-task -- Add Task to Current Plan
2
+
3
+ Quickly adds a task to the current plan.md without interrupting work.
4
+
5
+ ## Instructions
6
+
7
+ Add task: **$ARGUMENTS**
8
+
9
+ ### Step 0: Fail-fast validation
10
+
11
+ Find current plan.md:
12
+ ```bash
13
+ find docs/specs -name "plan.md" | head -1
14
+ ```
15
+
16
+ If not found — STOP: "No plan.md found. Run /frame:plan first."
17
+
18
+ If `$ARGUMENTS` is empty — STOP: "Provide a task description: /frame:add-task <description>"
19
+
20
+ ### Step 1: Read plan.md
21
+
22
+ Read the plan.md to understand:
23
+ - Current task count (to assign next task number)
24
+ - Current wave count (to assign to last wave or new wave)
25
+ - Existing task format
26
+
27
+ ### Step 2: Append task
28
+
29
+ Add to the end of the Tasks section in plan.md:
30
+
31
+ ```markdown
32
+ ### Task {N}: {$ARGUMENTS}
33
+ - Files: TBD
34
+ - Files Changed: TBD
35
+ - Complexity: low
36
+ - Risk: low
37
+ - Estimate: TBD
38
+ - Wave: {last wave}
39
+ - Test: TBD
40
+ - Dependencies: TBD
41
+ - Verification: TBD
42
+ - Status: [ ]
43
+ - Added: {date}
44
+ ```
45
+
46
+ ### Step 3: Confirm
47
+
48
+ Output:
49
+ ```
50
+ Added Task {N}: {$ARGUMENTS}
51
+ Edit plan.md to fill in Files, Test, Dependencies.
52
+ ```
53
+
54
+ ## Result
55
+
56
+ - Task appended to plan.md
57
+ - STATE.md not modified
@@ -0,0 +1,170 @@
1
+ # /frame:build -- Implementation per plan.md
2
+
3
+ > Use for 1–3 tasks (sequential TDD). For 4+ independent tasks → `/frame:wave`
4
+
5
+ Reads plan.md, executes TDD cycle for each task, runs quality gates.
6
+
7
+ ## Instructions
8
+
9
+ ### Step 0: Checkpoint + Update STATE.md (IN_PROGRESS)
10
+
11
+ Create checkpoint before starting:
12
+ ```bash
13
+ git tag "frame/checkpoint/build-$(date +%s)" -m "Auto checkpoint before build phase"
14
+ ```
15
+
16
+ Update `.planning/STATE.md`:
17
+ ```markdown
18
+ ## Current Position
19
+ - Phase: BUILD
20
+ - Feature: {feature}
21
+ - Task: 0/{total}
22
+ - Status: IN_PROGRESS
23
+ - Started: {timestamp}
24
+ ```
25
+
26
+ ### Step 1: Find plan.md
27
+
28
+ - `find docs/specs -name "plan.md" | head -5`
29
+ - Read plan.md and identify all tasks
30
+
31
+ ### Step 2: Read Context
32
+
33
+ Read before implementing:
34
+ - `docs/specs/{feature}/research.md` — **Memory Impact** section (why this approach was chosen)
35
+ - `docs/specs/{feature}/spec.md` — feature specification
36
+ - `.planning/MAP.md` — project architecture
37
+ - `.planning/memory/patterns.md` — Core + Active patterns
38
+ - `.planning/memory/conventions.md` — code conventions
39
+ - `.planning/memory/anti-patterns.md` — what to avoid
40
+ - `.planning/memory/dependencies.md` — stack + Avoid list
41
+
42
+ ### Step 3: For EACH task in plan.md
43
+
44
+ #### 3.0: Risk Strategy
45
+
46
+ Check the task's `Risk` field:
47
+ - `Risk: low` → standard TDD cycle
48
+ - `Risk: medium` → create checkpoint: `git tag frame/checkpoint/task-{N}`
49
+ - `Risk: high` → checkpoint + show user warning, **wait for confirmation** before proceeding
50
+
51
+ #### 3.1: TDD Cycle -- RED
52
+
53
+ Write the TEST:
54
+ - Create test file in `__tests__/`
55
+ - Write a failing test
56
+ - Run: `{quality.commands.test} {test_file}`
57
+ - **D-step**: Test must FAIL (RED verified)
58
+
59
+ #### 3.2: TDD Cycle -- GREEN
60
+
61
+ Write the CODE:
62
+ - Implement the feature (minimal to pass the test)
63
+ - Run: `{quality.commands.test} {test_file}`
64
+ - **D-step**: Test must PASS (GREEN verified)
65
+
66
+ #### 3.3: TDD Cycle -- REFACTOR
67
+
68
+ Refactor (if needed):
69
+ - Improve code structure
70
+ - Run: `{quality.commands.test} {test_file}`
71
+ - **D-step**: Test must PASS
72
+
73
+ #### Stuck Detection
74
+
75
+ If after **3 attempts** the test does not reach GREEN:
76
+ 1. Stop
77
+ 2. Update STATE.md: `Status: STUCK, Task: {N}`
78
+ 3. Report to user: what was tried, where stuck, suggest:
79
+ - Simplify the task
80
+ - Rewrite the test
81
+ - Skip with `[BLOCKED]` flag
82
+
83
+ #### 3.4: Quality Gates (tiered)
84
+
85
+ **After each task** — fast check:
86
+ - `{quality.commands.test} {test_file}` — only this task's test
87
+
88
+ **Every 3 tasks or after a logical wave** — full gates:
89
+ - `{quality.commands.typecheck}`
90
+ - `{quality.commands.test}` (all tests)
91
+ - `{quality.commands.lint}`
92
+ - **D-step**: All checks must pass
93
+
94
+ #### 3.5: Git Commit
95
+
96
+ - `git add {specific_files}`
97
+ - `git commit -m "{type}({scope}): {description}"`
98
+ - **D-step**: Commit succeeds
99
+
100
+ #### 3.6: Auto-checkpoint (if enabled)
101
+
102
+ If `workflow.autoCheckpoint === true` in `.frame/config.json`:
103
+ ```bash
104
+ git tag "frame/checkpoint/task-{N}-$(date +%s)" -m "Auto checkpoint after task {N}"
105
+ ```
106
+
107
+ #### 3.6: Update Status
108
+
109
+ Mark task in plan.md:
110
+ ```markdown
111
+ ### Task N: {name} [DONE]
112
+ ```
113
+
114
+ Update progress in STATE.md:
115
+ ```markdown
116
+ - Task: {completed}/{total}
117
+ ```
118
+
119
+ ### Step 4: Next task?
120
+
121
+ - More tasks remain → return to Step 3
122
+ - All tasks done → proceed to Step 5
123
+
124
+ ### Step 5: Check plan.md completeness
125
+
126
+ ```bash
127
+ grep "^### Task" plan.md | grep -v "\[DONE\]"
128
+ # Must return empty
129
+ ```
130
+
131
+ If unclosed tasks exist — return and complete them or report to user.
132
+
133
+ ### Step 6: Final quality gates
134
+
135
+ ```bash
136
+ {quality.commands.test}
137
+ {quality.commands.typecheck}
138
+ {quality.commands.lint}
139
+ ```
140
+
141
+ **D-step**: All checks must pass.
142
+
143
+ ### Step 7: Update STATE.md (COMPLETE)
144
+
145
+ ```markdown
146
+ ## Current Position
147
+ - Phase: BUILD
148
+ - Feature: {feature}
149
+ - Task: {completed}/{total}
150
+ - Status: COMPLETE
151
+ - Finished: {timestamp}
152
+ ```
153
+
154
+ ## Rules
155
+
156
+ - **Never skip D-steps** — every step is verified
157
+ - **Never write code without a test** — TDD is mandatory
158
+ - **Never commit without passing tests** — quality gate
159
+ - **Always add specific files** — never `git add -A`
160
+ - **Risk: high requires confirmation** — wait for user response
161
+ - **Never use type `any`** — use `unknown` + type guard
162
+ - **Never modify files outside the task scope** — stay within task boundaries
163
+
164
+ ## Result
165
+
166
+ - Code implemented with TDD
167
+ - All tests passing
168
+ - All quality gates passed
169
+ - Git commits created
170
+ - `.planning/STATE.md` updated with COMPLETE status
@@ -0,0 +1,118 @@
1
+ # /frame:check-deps -- Dependency Watch
2
+
3
+ Checks for outdated dependencies and vulnerabilities. Run before every `/frame:ship` and weekly.
4
+
5
+ ## Instructions
6
+
7
+ ### Step 0: Check Freshness
8
+
9
+ Check STATE.md — if `Deps Audit` is older than 7 days, this is a scheduled run. Otherwise confirm with the developer whether a full audit is needed.
10
+
11
+ ### Step 1: Security Audit
12
+
13
+ [D] Run audit:
14
+
15
+ ```bash
16
+ {quality.commands.audit} 2>/dev/null
17
+ ```
18
+
19
+ [D] Count critical vulnerabilities (for npm):
20
+
21
+ ```bash
22
+ CRITICAL=$(npm audit --json 2>/dev/null | node -e "const d=JSON.parse(require('fs').readFileSync('/dev/stdin','utf8')); console.log(d.metadata?.vulnerabilities?.critical ?? 0)")
23
+ echo "CRITICAL=$CRITICAL"
24
+ ```
25
+
26
+ [P] Classify found vulnerabilities:
27
+ - Critical → immediate action required
28
+ - High → action required
29
+ - Moderate → action recommended
30
+
31
+ [D] If CRITICAL > 0 → update STATE.md: `Deps Status: CRITICAL`
32
+
33
+ ### Step 2: Outdated Packages
34
+
35
+ [D] Run check:
36
+
37
+ ```bash
38
+ {quality.commands.outdated} 2>/dev/null
39
+ ```
40
+
41
+ [P] Classify updates:
42
+ - Major → create task, do not update automatically
43
+ - Minor → recommend update
44
+ - Patch → apply + run quality gates:
45
+
46
+ ```bash
47
+ {quality.commands.test} && {quality.commands.typecheck}
48
+ ```
49
+
50
+ Only if PASS → commit: `chore(deps): update patch dependencies`
51
+
52
+ ### Step 3: License Check
53
+
54
+ [D] Run:
55
+
56
+ ```bash
57
+ npx license-checker --summary 2>/dev/null || \
58
+ npm ls --all --json 2>/dev/null | node -e "
59
+ const d = JSON.parse(require('fs').readFileSync('/dev/stdin','utf8'));
60
+ const licenses = {};
61
+ function walk(pkg) {
62
+ if (pkg.license) licenses[pkg.license] = (licenses[pkg.license]||0)+1;
63
+ Object.values(pkg.dependencies||{}).forEach(walk);
64
+ }
65
+ walk(d);
66
+ Object.entries(licenses).sort((a,b)=>b[1]-a[1]).forEach(([l,n])=>console.log(n,l));
67
+ "
68
+ ```
69
+
70
+ [P] Warn if GPL, AGPL, or LGPL found in production dependencies — these require legal review.
71
+
72
+ ### Step 4: Create Report
73
+
74
+ Create `.planning/reports/deps/{date}.md`:
75
+
76
+ ```markdown
77
+ # Dependency Watch -- {date}
78
+
79
+ ## Security
80
+ | Package | Severity | Issue | Action |
81
+ |---------|----------|-------|--------|
82
+ | ... | ... | ... | ... |
83
+
84
+ ## Updates Available
85
+ | Package | Current | Latest | Type | Decision |
86
+ |---------|---------|--------|------|----------|
87
+ | ... | ... | ... | major/minor/patch | update/freeze |
88
+
89
+ ## Licenses
90
+ | License | Package Count | Risk |
91
+ |---------|---------------|------|
92
+ | ... | ... | ... |
93
+
94
+ ## Recommendations
95
+ 1. {recommendation}
96
+
97
+ ## Action Items
98
+ - [ ] Fix critical vulnerabilities
99
+ - [ ] Update patch dependencies (after tests)
100
+ - [ ] Update dependencies.md
101
+ ```
102
+
103
+ ### Step 5: Update STATE.md
104
+
105
+ Add or update section:
106
+
107
+ ```
108
+ Deps Audit: {date}
109
+ Deps Status: OK | CRITICAL | HIGH
110
+ Critical: {N}
111
+ High: {N}
112
+ ```
113
+
114
+ ### Step 6: Update dependencies.md
115
+
116
+ - Critical vulnerabilities → add to `Avoid` section with explanation
117
+ - Major updates that were applied → update versions
118
+ - Packages decided not to update → add entry `frozen until {reason}`