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,253 @@
1
+ ---
2
+ description: Create a revert PR to roll back a shipped feature or fix that caused a production incident
3
+ argument-hint: [PR number to revert, or "last" for most recent deploy]
4
+ ---
5
+
6
+ # /rollback — Automated Revert PR Creation
7
+
8
+ **Input**: $ARGUMENTS
9
+
10
+ You are the pipeline's emergency rollback system. When a shipped feature or fix causes production issues, this command creates a revert PR and fast-tracks it through the pipeline.
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
+ ## Phase 1: Identify What to Revert
19
+
20
+ ### Step 1A: Parse the input
21
+
22
+ | Input | Action |
23
+ |-------|--------|
24
+ | PR number (e.g., `142`) | Revert that specific PR |
25
+ | `last` or empty | Revert the most recent merge to `main` |
26
+ | Issue number with `#` (e.g., `#55`) | Find the PR that closed this issue, revert it |
27
+
28
+ ### Step 1B: Resolve the target PR
29
+
30
+ ```bash
31
+ # If PR number given directly
32
+ gh pr view {PR_NUMBER} --json number,title,mergeCommit,headRefName,baseRefName,body,mergedAt
33
+
34
+ # If "last" — find most recent merge to main
35
+ gh pr list --state merged --base main --limit 1 --json number,title,mergeCommit,mergedAt
36
+
37
+ # If issue number — find the PR that closed it
38
+ gh pr list --state merged --search "Closes #{ISSUE}" --limit 1 --json number,title,mergeCommit
39
+ ```
40
+
41
+ ### Step 1C: Validate revert is safe
42
+
43
+ Before reverting, check:
44
+
45
+ 1. **Was the PR actually merged to main?** If it's only on staging, revert from staging instead.
46
+ 2. **Are there dependent PRs merged after this one?** If later PRs build on this code, a simple revert may break them.
47
+
48
+ ```bash
49
+ # Check what changed in the PR
50
+ gh pr diff {PR_NUMBER} --name-only
51
+
52
+ # Check if any later PRs touched the same files
53
+ MERGE_DATE=$(gh pr view {PR_NUMBER} --json mergedAt --jq '.mergedAt')
54
+ gh pr list --state merged --base main --json number,title,mergedAt,files \
55
+ --jq ".[] | select(.mergedAt > \"$MERGE_DATE\") | {number, title}"
56
+ ```
57
+
58
+ If dependent PRs exist, warn the user:
59
+ ```
60
+ ⚠️ PRs merged AFTER #{PR_NUMBER} that touch the same files:
61
+ - #{LATER_PR} — {title}
62
+
63
+ A simple revert may break these. Options:
64
+ 1. Revert all dependent PRs together (risky)
65
+ 2. Create a targeted fix instead of a full revert
66
+ 3. Proceed with revert anyway (you'll need to fix conflicts)
67
+
68
+ Which approach? (Reply or press enter for option 1)
69
+ ```
70
+
71
+ ---
72
+
73
+ ## Phase 2: Create the Revert
74
+
75
+ ### Step 2A: Create a revert branch
76
+
77
+ ```bash
78
+ cd /home/mrdubey/projects/ScraperAPI/alterlab
79
+ git fetch origin main
80
+ git worktree add ../alterlab-revert-pr-{PR_NUMBER} -b revert/pr-{PR_NUMBER} origin/main
81
+
82
+ cd ../alterlab-revert-pr-{PR_NUMBER}
83
+ ```
84
+
85
+ ### Step 2B: Execute the revert
86
+
87
+ ```bash
88
+ # Get the merge commit SHA
89
+ MERGE_SHA=$(gh pr view {PR_NUMBER} --json mergeCommit --jq '.mergeCommit.oid')
90
+
91
+ # Revert the merge commit (use -m 1 for merge commits to select the mainline parent)
92
+ git revert -m 1 $MERGE_SHA --no-edit
93
+ ```
94
+
95
+ If the revert has conflicts:
96
+ ```bash
97
+ # Show conflicts
98
+ git diff --name-only --diff-filter=U
99
+
100
+ # Report to user
101
+ echo "Revert has conflicts in these files:"
102
+ git diff --name-only --diff-filter=U
103
+ echo ""
104
+ echo "This usually means later changes depend on the reverted PR."
105
+ echo "Manual resolution needed — opening conflicted files for review."
106
+ ```
107
+
108
+ If conflicts cannot be auto-resolved, report to user and STOP.
109
+
110
+ ### Step 2C: Verify the revert compiles
111
+
112
+ ```bash
113
+ # Python files
114
+ poetry -C services/api run python -m py_compile {reverted_python_files} 2>&1
115
+
116
+ # TypeScript files (if any)
117
+ cd web && npx tsc --noEmit 2>&1 | head -20
118
+ ```
119
+
120
+ ---
121
+
122
+ ## Phase 3: Create the Revert PR
123
+
124
+ ### Step 3A: Push and create PR
125
+
126
+ ```bash
127
+ git push origin revert/pr-{PR_NUMBER}
128
+
129
+ gh pr create --base main --title "Revert: #{PR_NUMBER} — {original_title}" --body "$(cat <<'PR_EOF'
130
+ ## Revert
131
+
132
+ Reverts #{PR_NUMBER} ({original_title}).
133
+
134
+ **Reason**: {user-provided reason or "Production incident — rollback requested"}
135
+
136
+ **Original PR**: #{PR_NUMBER}
137
+ **Merge commit**: {MERGE_SHA}
138
+
139
+ ## What This Reverts
140
+
141
+ {List of files changed, from the original PR}
142
+
143
+ ## Verification
144
+
145
+ - [ ] Revert compiles cleanly
146
+ - [ ] No dependent PRs broken
147
+ - [ ] Production incident should resolve after deploy
148
+ PR_EOF
149
+ )"
150
+ ```
151
+
152
+ ### Step 3B: Fast-track decision
153
+
154
+ **If this is a P0 incident** (user said "urgent", "P0", "production down", or similar):
155
+ - Skip the full review — revert PRs are low-risk (they restore known-good state)
156
+ - Merge immediately:
157
+ ```bash
158
+ gh pr merge {REVERT_PR} --merge
159
+ ```
160
+ - Then trigger hotfix deploy:
161
+ ```bash
162
+ echo "Revert merged to main. CI/CD will deploy automatically."
163
+ echo "For faster deploy, trigger hotfix: gh workflow run hotfix-deploy.yml --ref main -f services={affected} -f reason=\"Rollback PR #{PR_NUMBER}\""
164
+ ```
165
+
166
+ **If not urgent**:
167
+ - Let the revert PR go through normal review via `/review-pr`
168
+ - It will merge to main and deploy on next CI/CD cycle
169
+
170
+ ---
171
+
172
+ ## Phase 4: Post-Revert Cleanup
173
+
174
+ ### Step 4A: Update the original issue
175
+
176
+ If the reverted PR referenced an issue:
177
+
178
+ ```bash
179
+ # Reopen the original issue
180
+ ORIGINAL_ISSUE=$(gh pr view {PR_NUMBER} --json body --jq '.body' | grep -oP 'Closes #\K\d+')
181
+ if [ -n "$ORIGINAL_ISSUE" ]; then
182
+ gh issue reopen $ORIGINAL_ISSUE --comment "Reverted in PR #{REVERT_PR_NUMBER} due to production incident. Needs a new fix approach."
183
+ gh issue edit $ORIGINAL_ISSUE --remove-label "workflow:merged"
184
+ gh issue edit $ORIGINAL_ISSUE --add-label "workflow:ready-to-build,needs-validation"
185
+ fi
186
+ ```
187
+
188
+ ### Step 4B: Create a follow-up issue
189
+
190
+ ```bash
191
+ gh issue create --title "fix: {original_title} (reverted — needs new approach)" \
192
+ --label "bug,P1" \
193
+ --body "$(cat <<'BODY_EOF'
194
+ ## Problem
195
+
196
+ PR #{PR_NUMBER} ({original_title}) was merged and deployed but caused a production incident. It was reverted in PR #{REVERT_PR_NUMBER}. The original fix needs to be re-implemented with a different approach that avoids the production issue.
197
+
198
+ **What went wrong**: {brief description of the production issue}
199
+
200
+ ## Root Cause (if known)
201
+
202
+ {Why the original approach caused the incident — the failure mode that needs to be avoided in the new approach. If unknown: "Root cause unknown — investigation needed."}
203
+
204
+ **Original approach that failed**: {summary of what the reverted PR did}
205
+
206
+ ## Affected Files
207
+
208
+ Files that need changes (same as original fix, different approach):
209
+ 1. `{filepath}` — {what needs to change with the new approach}
210
+ 2. `{filepath}` — {what needs to change}
211
+
212
+ ## Acceptance Criteria
213
+
214
+ - [ ] New approach avoids the failure mode from the reverted PR
215
+ - [ ] Fix validated in staging before merging
216
+ - [ ] Original production issue is resolved
217
+
218
+ ## Context
219
+
220
+ **Original issue**: #{ORIGINAL_ISSUE}
221
+ **Reverted PR**: #{REVERT_PR_NUMBER}
222
+
223
+ ## Dependencies
224
+
225
+ Regression of #{ORIGINAL_ISSUE}. Should investigate why the original approach caused issues before implementing.
226
+ BODY_EOF
227
+ )"
228
+ ```
229
+
230
+ ### Step 4C: Clean up worktree
231
+
232
+ ```bash
233
+ cd /home/mrdubey/projects/ScraperAPI/alterlab
234
+ git worktree remove ../alterlab-revert-pr-{PR_NUMBER}
235
+ git branch -D revert/pr-{PR_NUMBER} 2>/dev/null || true
236
+ ```
237
+
238
+ ---
239
+
240
+ ## Phase 5: Summary
241
+
242
+ ```
243
+ ## Rollback Complete
244
+
245
+ - **Reverted**: PR #{PR_NUMBER} — {original_title}
246
+ - **Revert PR**: #{REVERT_PR_NUMBER} → main
247
+ - **Status**: {Merged + deploying | Pending review}
248
+ - **Original issue**: #{ORIGINAL_ISSUE} — reopened with `needs-validation`
249
+ - **Follow-up**: #{FOLLOWUP_ISSUE} — fix with new approach
250
+
251
+ {If urgent: "Deploy in progress. Monitor production for resolution."}
252
+ {If not urgent: "Revert PR is in review. Once merged, CI/CD will deploy."}
253
+ ```