forgedock 1.0.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 (44) hide show
  1. package/LICENSE +244 -0
  2. package/README.md +251 -0
  3. package/bin/forgedock.mjs +232 -0
  4. package/commands/analytics.md +777 -0
  5. package/commands/audit-agents.md +410 -0
  6. package/commands/audit.md +410 -0
  7. package/commands/autopilot.md +432 -0
  8. package/commands/cleanup.md +264 -0
  9. package/commands/deploy-info.md +292 -0
  10. package/commands/failure-recon.md +375 -0
  11. package/commands/forge-stats.md +183 -0
  12. package/commands/geo-audit.md +343 -0
  13. package/commands/incident-response.md +384 -0
  14. package/commands/issue.md +506 -0
  15. package/commands/milestone.md +599 -0
  16. package/commands/orchestrate.md +1044 -0
  17. package/commands/pipeline-health.md +2343 -0
  18. package/commands/qa-sweep.md +237 -0
  19. package/commands/quality-gate.md +777 -0
  20. package/commands/review-pr-agents.md +1711 -0
  21. package/commands/review-pr-staging.md +325 -0
  22. package/commands/review-pr.md +888 -0
  23. package/commands/rollback.md +253 -0
  24. package/commands/security-audit.md +529 -0
  25. package/commands/sync-ecosystem.md +527 -0
  26. package/commands/validate.md +131 -0
  27. package/commands/work-on/build/architect.md +291 -0
  28. package/commands/work-on/build/context.md +349 -0
  29. package/commands/work-on/build/implement.md +280 -0
  30. package/commands/work-on/build/validate.md +292 -0
  31. package/commands/work-on/build.md +262 -0
  32. package/commands/work-on/close.md +350 -0
  33. package/commands/work-on/decompose.md +254 -0
  34. package/commands/work-on/investigate.md +437 -0
  35. package/commands/work-on/review.md +245 -0
  36. package/commands/work-on-monolithic.md +298 -0
  37. package/commands/work-on.md +1089 -0
  38. package/docs/CODEX.md +92 -0
  39. package/docs/WORKFLOW.md +104 -0
  40. package/package.json +45 -0
  41. package/scripts/verify-env-vars.sh +201 -0
  42. package/scripts/verify-host-headers.sh +117 -0
  43. package/scripts/verify-route-registration.sh +118 -0
  44. package/scripts/verify-sops-chain.sh +163 -0
@@ -0,0 +1,384 @@
1
+ ---
2
+ description: Coordinate P0 incident response — hotfix validation, timeline reconstruction, and post-incident analysis
3
+ argument-hint: [issue number | "active" | "postmortem {issue}"]
4
+ ---
5
+
6
+ # /incident-response — P0 Incident Coordination
7
+
8
+ **Input**: $ARGUMENTS
9
+
10
+ You are the pipeline's incident response coordinator. When production goes down or a critical bug surfaces, this command orchestrates the response: validates the hotfix before deploy, reconstructs the incident timeline, and produces a post-incident analysis.
11
+
12
+ **Agent model policy**: Default `model: "sonnet"`. If Sonnet is rate-limited, fall back to `model: "opus"`. User can override with `--model <name>`.
13
+
14
+ **NEVER use plan mode (EnterPlanMode)** — it breaks execution context.
15
+
16
+ ---
17
+
18
+ ## Command Router
19
+
20
+ | Input | Mode | Description |
21
+ |-------|------|-------------|
22
+ | Issue number (e.g., `55`) | **Active Response** | Coordinate hotfix for this P0 issue |
23
+ | `active` or empty | **Active Response** | Find the most recent P0 issue and coordinate |
24
+ | `postmortem {issue}` | **Post-Incident** | Generate postmortem for a resolved incident |
25
+
26
+ ---
27
+
28
+ ## Mode 1: Active Incident Response
29
+
30
+ ### Phase 1: Identify the Incident
31
+
32
+ #### Step 1A: Find the P0 issue
33
+
34
+ ```bash
35
+ # If issue number provided
36
+ gh issue view {NUMBER} --json number,title,body,labels,state,comments,assignees,createdAt
37
+
38
+ # If "active" — find most recent open P0
39
+ gh issue list --state open --label "P0" --limit 5 --json number,title,createdAt,labels \
40
+ --jq 'sort_by(.createdAt) | reverse | .[0]'
41
+ ```
42
+
43
+ #### Step 1B: Establish incident context
44
+
45
+ Parse the issue to understand:
46
+ - **What's broken**: Which service, which endpoint, what user-facing impact
47
+ - **When it started**: Issue creation time, or mentioned timestamp
48
+ - **Suspected cause**: Recent deploy? Code change? External dependency?
49
+
50
+ ```bash
51
+ # Check recent deploys (merges to main in last 24h)
52
+ gh pr list --state merged --base main --json number,title,mergedAt \
53
+ --jq '[.[] | select(.mergedAt > (now - 86400 | todate))] | .[] | "\(.number) | \(.title) | \(.mergedAt)"'
54
+
55
+ # Check recent hotfix deploys
56
+ gh run list --workflow=hotfix-deploy.yml --limit 5 --json databaseId,status,conclusion,createdAt,displayTitle
57
+ ```
58
+
59
+ #### Step 1C: Post incident acknowledgment
60
+
61
+ ```bash
62
+ gh issue comment {NUMBER} --body "$(cat <<'EOF'
63
+ ## 🚨 Incident Response Activated
64
+
65
+ **Coordinator**: Forge pipeline (automated)
66
+ **Time**: $(date -u +%Y-%m-%dT%H:%M:%SZ)
67
+
68
+ **Status**: Investigating
69
+ **Next action**: Validating fix approach and preparing hotfix deploy
70
+
71
+ ---
72
+ ### Timeline
73
+ | Time | Event |
74
+ |------|-------|
75
+ | {issue_created} | Incident reported |
76
+ | $(date -u +%H:%M) UTC | Response activated |
77
+ EOF
78
+ )"
79
+ ```
80
+
81
+ ---
82
+
83
+ ### Phase 2: Validate the Fix
84
+
85
+ If a fix branch already exists (check issue comments for PR references):
86
+
87
+ #### Step 2A: Find the fix
88
+
89
+ ```bash
90
+ # Check if there's already a PR or branch
91
+ FIX_PR=$(gh pr list --state open --search "#{NUMBER}" --json number,headRefName --jq '.[0]')
92
+ FIX_BRANCH=$(echo $FIX_PR | jq -r '.headRefName // empty')
93
+
94
+ # Or check if issue comments mention a branch
95
+ gh api repos/{owner}/{repo}/issues/{NUMBER}/comments \
96
+ --jq '.[].body | select(contains("fix/") or contains("hotfix/"))' | grep -oP '(fix|hotfix)/[\w-]+'
97
+ ```
98
+
99
+ #### Step 2B: Validate the fix won't make things worse
100
+
101
+ Spawn a validation agent to check the proposed fix:
102
+
103
+ ```
104
+ Agent(model="sonnet", prompt="
105
+ You are validating a hotfix for a P0 production incident.
106
+
107
+ Issue: #{NUMBER} — {TITLE}
108
+ Fix branch: {FIX_BRANCH}
109
+ Repo: /home/mrdubey/projects/ScraperAPI/alterlab
110
+
111
+ Your job:
112
+ 1. Read the fix diff: git diff origin/main..origin/{FIX_BRANCH}
113
+ 2. Verify it addresses the reported problem (read the issue body)
114
+ 3. Check for obvious regressions:
115
+ - Does it break any imports?
116
+ - Does it remove functionality other code depends on?
117
+ - Are there syntax errors?
118
+ - Does it change DB schema without a migration?
119
+ 4. Run compile checks:
120
+ - Python: python -m py_compile on changed .py files
121
+ - TypeScript: npx tsc --noEmit (if web/ files changed)
122
+ 5. Check if the fix is scoped tightly (minimal changes for the incident)
123
+
124
+ Output:
125
+ - SAFE TO DEPLOY: {yes/no}
126
+ - Concerns: {list any non-blocking concerns}
127
+ - Confidence: {high/medium/low}
128
+ - Recommendation: {deploy immediately / needs adjustment / needs more investigation}
129
+ ")
130
+ ```
131
+
132
+ #### Step 2C: Report validation result
133
+
134
+ ```bash
135
+ gh issue comment {NUMBER} --body "$(cat <<'EOF'
136
+ ### Hotfix Validation
137
+
138
+ **Branch**: `{FIX_BRANCH}`
139
+ **Validation**: {SAFE TO DEPLOY / NEEDS ADJUSTMENT}
140
+ **Confidence**: {level}
141
+
142
+ {If safe}:
143
+ **Ready for deploy.** Run:
144
+ ```
145
+ gh workflow run hotfix-deploy.yml --ref {FIX_BRANCH} -f services={affected_services} -f reason="P0: {TITLE}"
146
+ ```
147
+
148
+ {If not safe}:
149
+ **Concerns found:**
150
+ {list of concerns}
151
+
152
+ **Recommendation**: {what to fix before deploying}
153
+ EOF
154
+ )"
155
+ ```
156
+
157
+ ---
158
+
159
+ ### Phase 3: Monitor Deploy (if hotfix triggered)
160
+
161
+ #### Step 3A: Watch the deploy workflow
162
+
163
+ ```bash
164
+ # Find the most recent hotfix-deploy run
165
+ RUN_ID=$(gh run list --workflow=hotfix-deploy.yml --limit 1 --json databaseId --jq '.[0].databaseId')
166
+
167
+ # Check status
168
+ gh run view $RUN_ID --json status,conclusion,jobs
169
+ ```
170
+
171
+ #### Step 3B: Post deploy status
172
+
173
+ ```bash
174
+ CONCLUSION=$(gh run view $RUN_ID --json conclusion --jq '.conclusion')
175
+
176
+ gh issue comment {NUMBER} --body "$(cat <<'EOF'
177
+ ### Deploy Status
178
+
179
+ **Workflow run**: $RUN_ID
180
+ **Status**: $CONCLUSION
181
+ **Time**: $(date -u +%H:%M) UTC
182
+
183
+ {If success}: ✅ Hotfix deployed. Monitor production for resolution.
184
+ {If failure}: ❌ Deploy failed. Check workflow logs: `gh run view $RUN_ID --log`
185
+ EOF
186
+ )"
187
+ ```
188
+
189
+ #### Step 3C: Update timeline
190
+
191
+ ```bash
192
+ gh issue comment {NUMBER} --body "$(cat <<'EOF'
193
+ ### Updated Timeline
194
+
195
+ | Time | Event |
196
+ |------|-------|
197
+ | {issue_created} | Incident reported |
198
+ | {response_time} | Response activated |
199
+ | {validation_time} | Fix validated |
200
+ | {deploy_time} | Hotfix deployed |
201
+ | {now} | Monitoring for resolution |
202
+
203
+ **Next**: Verify production health in 5-10 minutes. If resolved, proceed to postmortem.
204
+ EOF
205
+ )"
206
+ ```
207
+
208
+ ---
209
+
210
+ ## Mode 2: Post-Incident Analysis
211
+
212
+ ### Phase 4: Reconstruct the Incident
213
+
214
+ #### Step 4A: Gather all context
215
+
216
+ ```bash
217
+ # Read the full issue thread
218
+ gh issue view {NUMBER} --json number,title,body,labels,comments,closedAt,createdAt
219
+
220
+ # Find the fix PR
221
+ gh pr list --state merged --search "#{NUMBER}" --json number,title,mergeCommit,mergedAt,body,files
222
+
223
+ # Find the deploy that caused the incident (most recent before issue creation)
224
+ ISSUE_CREATED=$(gh issue view {NUMBER} --json createdAt --jq '.createdAt')
225
+ gh pr list --state merged --base main --json number,title,mergedAt \
226
+ --jq "[.[] | select(.mergedAt < \"$ISSUE_CREATED\")] | sort_by(.mergedAt) | reverse | .[0:5]"
227
+ ```
228
+
229
+ #### Step 4B: Identify root cause
230
+
231
+ Spawn an investigation agent:
232
+
233
+ ```
234
+ Agent(model="sonnet", prompt="
235
+ You are conducting a post-incident root cause analysis.
236
+
237
+ Incident: #{NUMBER} — {TITLE}
238
+ Issue body: {BODY}
239
+ Fix PR: #{FIX_PR}
240
+ Comments: {RELEVANT_COMMENTS}
241
+
242
+ Investigate:
243
+ 1. What was the direct cause? (specific code change, config error, external failure)
244
+ 2. What was the root cause? (why did the direct cause happen — process gap, missing test, etc.)
245
+ 3. What deploy introduced the problem? (specific PR merged to main)
246
+ 4. Why wasn't it caught before deploy? (review gap, missing test, untested path)
247
+ 5. How long was the incident? (reported → fix deployed)
248
+ 6. What was the blast radius? (all users, specific tier, specific feature)
249
+
250
+ Read the fix diff and the introducing PR to understand what went wrong and how it was resolved.
251
+ ")
252
+ ```
253
+
254
+ #### Step 4C: Generate the postmortem
255
+
256
+ ```bash
257
+ gh issue comment {NUMBER} --body "$(cat <<'POSTMORTEM_EOF'
258
+ ## Post-Incident Analysis
259
+
260
+ ### Summary
261
+ | Field | Value |
262
+ |-------|-------|
263
+ | Incident | #{NUMBER} — {TITLE} |
264
+ | Severity | P0 |
265
+ | Duration | {start} → {resolved} ({duration}) |
266
+ | Blast radius | {description} |
267
+ | Root cause | {1 sentence} |
268
+ | Fix | PR #{FIX_PR} |
269
+
270
+ ### Timeline
271
+ | Time (UTC) | Event |
272
+ |------------|-------|
273
+ | {time} | Introducing change merged (PR #{CAUSE_PR}) |
274
+ | {time} | Deploy triggered (CI/CD on push to main) |
275
+ | {time} | First user impact |
276
+ | {time} | Incident reported (issue created) |
277
+ | {time} | Response activated |
278
+ | {time} | Root cause identified |
279
+ | {time} | Fix validated |
280
+ | {time} | Hotfix deployed |
281
+ | {time} | Incident resolved |
282
+
283
+ ### Root Cause Analysis
284
+
285
+ **Direct cause**: {what specifically broke — code path, missing check, wrong config}
286
+
287
+ **Contributing factors**:
288
+ - {Why the direct cause wasn't caught in review}
289
+ - {Why it wasn't caught in testing}
290
+ - {Any process gaps}
291
+
292
+ ### What Went Well
293
+ - {Things that worked during response}
294
+
295
+ ### What Went Wrong
296
+ - {Things that made the incident worse or slower to resolve}
297
+
298
+ ### Action Items
299
+
300
+ | # | Action | Type | Priority | Owner |
301
+ |---|--------|------|----------|-------|
302
+ | 1 | {preventive action} | Prevention | P1 | Pipeline |
303
+ | 2 | {detection improvement} | Detection | P2 | Pipeline |
304
+ | 3 | {process improvement} | Process | P2 | Team |
305
+
306
+ ### Pipeline Improvement Opportunities
307
+
308
+ {Specific suggestions for how the Forge pipeline could have prevented or shortened this incident:
309
+ - Could /review-pr have caught this? (add to review-pr-agents.md)
310
+ - Could /quality-gate have caught this? (add a new check)
311
+ - Could /deploy-info have flagged the risk? (add a risk signal)
312
+ - Should /rollback be faster? (streamline the process)}
313
+ POSTMORTEM_EOF
314
+ )"
315
+ ```
316
+
317
+ #### Step 4D: Create follow-up issues
318
+
319
+ For each action item identified in the postmortem:
320
+
321
+ ```bash
322
+ gh issue create --title "{fix|feat|refactor}: {action item title}" \
323
+ --label "{type_label},P{priority}" \
324
+ --body "$(cat <<'BODY_EOF'
325
+ ## Problem
326
+
327
+ {What gap or vulnerability this action item addresses. What failure mode it prevents.}
328
+
329
+ ## Root Cause (if known)
330
+
331
+ {The specific system gap identified in the postmortem that this action item closes. If unknown: "Root cause unknown — investigation needed."}
332
+
333
+ ## Affected Files
334
+
335
+ Files that need changes:
336
+ 1. `{filepath}` — {what needs to change}
337
+ 2. `{filepath}` — {what needs to change}
338
+
339
+ ## Acceptance Criteria
340
+
341
+ - [ ] {Specific, testable criterion}
342
+ - [ ] Verified in next incident drill or deployment
343
+
344
+ ## Context
345
+
346
+ Action item from post-incident analysis of #{INCIDENT_NUMBER}.
347
+ See postmortem: #{INCIDENT_NUMBER} (comment)
348
+
349
+ ## Proposed Fix
350
+
351
+ {Concrete next step}
352
+ BODY_EOF
353
+ )"
354
+ ```
355
+
356
+ ---
357
+
358
+ ## Phase 5: Summary
359
+
360
+ ### Active Response Summary
361
+ ```
362
+ ## Incident Response: #{NUMBER}
363
+
364
+ - **Status**: {Active / Resolved / Monitoring}
365
+ - **Fix**: {branch} → validated → {deployed / pending}
366
+ - **Duration so far**: {time since issue creation}
367
+ - **Next action**: {what needs to happen next}
368
+
369
+ {If deployed}: Monitor production. Run `/incident-response postmortem {NUMBER}` after confirming resolution.
370
+ {If pending}: Fix needs {adjustment / deploy trigger}. See validation comment above.
371
+ ```
372
+
373
+ ### Postmortem Summary
374
+ ```
375
+ ## Postmortem Complete: #{NUMBER}
376
+
377
+ - **Duration**: {total incident time}
378
+ - **Root cause**: {1 sentence}
379
+ - **Fix**: PR #{FIX_PR}
380
+ - **Action items created**: {N} issues
381
+ - **Pipeline improvements**: {list of Forge changes recommended}
382
+
383
+ Action items: {list of created issue numbers}
384
+ ```