forgedock 1.0.22 → 1.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (184) hide show
  1. package/README.md +255 -211
  2. package/bin/batch-runner.mjs +339 -0
  3. package/bin/cinema.mjs +320 -0
  4. package/bin/demo.mjs +92 -7
  5. package/bin/engine/phases.mjs +168 -0
  6. package/bin/engine/projector.mjs +32 -0
  7. package/bin/engine/reconcile.mjs +11 -0
  8. package/bin/engine/runlog.mjs +79 -0
  9. package/bin/engine/state.mjs +32 -0
  10. package/bin/engine-cli.mjs +222 -0
  11. package/bin/engine.mjs +138 -0
  12. package/bin/forgedock.mjs +896 -1540
  13. package/bin/hooks/interactive-engine.mjs +509 -0
  14. package/bin/hooks/pre-tool-use.mjs +498 -0
  15. package/bin/hooks/subagent-stop-enforce.mjs +197 -0
  16. package/bin/journey.mjs +841 -0
  17. package/bin/registry.mjs +139 -0
  18. package/bin/report.mjs +447 -0
  19. package/bin/runner.mjs +136 -20
  20. package/bin/settings-hook.mjs +346 -0
  21. package/bin/tui.mjs +6 -3
  22. package/commands/adopt.md +4 -1
  23. package/commands/analytics.md +4 -1
  24. package/commands/audit-agents.md +110 -27
  25. package/commands/audit.md +20 -1
  26. package/commands/autopilot.md +84 -12
  27. package/commands/changelog.md +2 -1
  28. package/commands/ci-audit.md +2 -1
  29. package/commands/cleanup.md +161 -1
  30. package/commands/compat-audit.md +2 -1
  31. package/commands/deploy-info.md +63 -4
  32. package/commands/design-bench.md +6 -1
  33. package/commands/design-render-critique-loop.md +2 -1
  34. package/commands/design.md +1 -0
  35. package/commands/diagnose.md +2 -1
  36. package/commands/explain.md +2 -1
  37. package/commands/forge-stats.md +122 -2
  38. package/commands/forgedock-init.md +1 -1
  39. package/commands/geo-audit.md +3 -0
  40. package/commands/incident-response.md +2 -1
  41. package/commands/issue.md +24 -3
  42. package/commands/milestone.md +77 -12
  43. package/commands/optimize.md +2 -1
  44. package/commands/orchestrate/config.md +67 -0
  45. package/commands/orchestrate/phase-1-resolve.md +159 -0
  46. package/commands/orchestrate/phase-2-triage.md +126 -0
  47. package/commands/orchestrate/phase-2.5-synthesis.md +156 -0
  48. package/commands/orchestrate/phase-3-dependency.md +591 -0
  49. package/commands/orchestrate/phase-4-execution.md +962 -0
  50. package/commands/orchestrate/phase-5-cleanup.md +47 -0
  51. package/commands/orchestrate/phase-6-report.md +198 -0
  52. package/commands/orchestrate/safety.md +62 -0
  53. package/commands/orchestrate.md +25 -2027
  54. package/commands/pipeline-health/config.md +34 -0
  55. package/commands/pipeline-health/phase-1-context.md +180 -0
  56. package/commands/pipeline-health/phase-2-metrics.md +1729 -0
  57. package/commands/pipeline-health/phase-3-analyze.md +204 -0
  58. package/commands/pipeline-health/phase-4-proposals.md +117 -0
  59. package/commands/pipeline-health/phase-5-report.md +284 -0
  60. package/commands/pipeline-health/phase-6-summary.md +52 -0
  61. package/commands/pipeline-health.md +25 -2401
  62. package/commands/pipeline-resume.md +24 -1
  63. package/commands/pipeline-status.md +65 -0
  64. package/commands/qa-sweep.md +4 -1
  65. package/commands/quality-gate.md +326 -42
  66. package/commands/replay.md +2 -1
  67. package/commands/review-pr-agents/api.md +135 -0
  68. package/commands/review-pr-agents/auth.md +137 -0
  69. package/commands/review-pr-agents/billing.md +101 -0
  70. package/commands/review-pr-agents/concurrency.md +145 -0
  71. package/commands/review-pr-agents/database.md +103 -0
  72. package/commands/review-pr-agents/frontend.md +89 -0
  73. package/commands/review-pr-agents/infra.md +385 -0
  74. package/commands/review-pr-agents/protocols.md +185 -0
  75. package/commands/review-pr-agents/scraper.md +185 -0
  76. package/commands/review-pr-agents/security.md +406 -0
  77. package/commands/review-pr-agents.md +45 -1722
  78. package/commands/review-pr-staging.md +196 -40
  79. package/commands/review-pr.md +612 -56
  80. package/commands/rollback.md +2 -1
  81. package/commands/scope.md +2 -1
  82. package/commands/security-audit.md +2 -1
  83. package/commands/signal-planner.md +623 -0
  84. package/commands/sync-ecosystem.md +1 -0
  85. package/commands/test-gate.md +17 -1
  86. package/commands/validate.md +2 -1
  87. package/commands/work-on/build/architect.md +28 -0
  88. package/commands/work-on/build/context.md +2 -0
  89. package/commands/work-on/build/implement.md +19 -5
  90. package/commands/work-on/build/validate.md +62 -6
  91. package/commands/work-on/build.md +187 -30
  92. package/commands/work-on/close.md +132 -5
  93. package/commands/work-on/decompose.md +19 -1
  94. package/commands/work-on/investigate.md +117 -2
  95. package/commands/work-on/review.md +48 -4
  96. package/commands/work-on-monolithic.md +8 -2
  97. package/commands/work-on.md +247 -7
  98. package/docs/BRAND.md +16 -5
  99. package/docs/CI.md +2 -2
  100. package/docs/CODEX.md +36 -1
  101. package/docs/CONFIG.md +44 -42
  102. package/docs/FORGE-PROTOCOL.md +15 -1064
  103. package/docs/anthropic-devrel-outreach.md +2 -2
  104. package/docs/articles/command-decomposition-token-savings.md +214 -0
  105. package/docs/articles/model-release-playbook.md +131 -0
  106. package/docs/articles/per-repo-adaptive-scripts-token-savings.md +27 -25
  107. package/docs/claude-breakpoints.json +75 -5
  108. package/docs/design/abc-benchmark.md +1 -1
  109. package/docs/design/design-spec-schema.md +1 -1
  110. package/docs/design/divergent-generation.md +1 -1
  111. package/docs/design/eval-gate-runbook.md +178 -0
  112. package/docs/design/show-hn-draft.md +26 -1
  113. package/docs/design/token-cost-baseline-1298.md +59 -0
  114. package/docs/eval/README.md +117 -0
  115. package/docs/eval/corpus/seed-v1.json +6 -0
  116. package/docs/eval/published/claude-sonnet-4-6-2026-07-04.json +33 -0
  117. package/docs/site/annotations-explained.md +24 -0
  118. package/docs/site/command-learning-path.md +51 -14
  119. package/docs/site/command-reference.md +339 -113
  120. package/docs/site/for-companies.md +95 -0
  121. package/docs/site/forge-annotation-protocol.md +12 -256
  122. package/docs/site/getting-started.md +58 -12
  123. package/docs/site/github-is-the-memory.md +113 -0
  124. package/docs/site/how-it-works.md +3 -13
  125. package/docs/site/index.md +10 -2
  126. package/docs/spec/eval-run-result.md +147 -0
  127. package/docs/spec/forge-protocol-v1.md +441 -18
  128. package/docs/spec/label-state-machine.md +55 -0
  129. package/docs/spec/review-protocol.md +158 -0
  130. package/docs/spec-graph-schema.md +28 -0
  131. package/docs/superpowers/plans/2026-07-03-cinematic-onboarding-tui.md +2339 -0
  132. package/docs/superpowers/plans/2026-07-03-durable-execution-engine.md +1223 -0
  133. package/docs/superpowers/specs/2026-07-03-cinematic-onboarding-tui-design.md +157 -0
  134. package/docs/superpowers/specs/2026-07-03-durable-execution-engine-design.md +194 -0
  135. package/docs/superpowers/specs/2026-07-04-economic-self-governance-design.md +181 -0
  136. package/docs/superpowers/specs/2026-07-04-provenance-trail-design.md +189 -0
  137. package/examples/forgedock-demo/README.md +41 -22
  138. package/examples/forgedock-demo/issues/06-bug-tags-type-validation.md +43 -0
  139. package/examples/forgedock-demo/issues/07-bug-negative-offset-pagination.md +42 -0
  140. package/examples/forgedock-demo/issues/08-bug-patch-mass-assignment.md +49 -0
  141. package/examples/forgedock-demo/issues/09-bug-count-injection.md +47 -0
  142. package/examples/forgedock-demo/issues/10-feature-sort-param.md +39 -0
  143. package/examples/forgedock-demo/issues/11-feature-patch-tags.md +37 -0
  144. package/examples/forgedock-demo/issues/12-feature-bulk-create.md +42 -0
  145. package/examples/forgedock-demo/issues/13-feature-archive-notes.md +46 -0
  146. package/examples/forgedock-demo/issues/14-refactor-extract-title-validation.md +41 -0
  147. package/examples/forgedock-demo/issues/15-refactor-protected-route-flag.md +43 -0
  148. package/examples/forgedock-demo/issues/16-refactor-extract-store.md +45 -0
  149. package/examples/forgedock-demo/issues/17-perf-tags-dedup-set.md +35 -0
  150. package/examples/forgedock-demo/issues/18-perf-remove-redundant-sort.md +37 -0
  151. package/examples/forgedock-demo/issues/19-docs-api-reference-full.md +53 -0
  152. package/examples/forgedock-demo/issues/20-docs-intentional-flaw-convention.md +46 -0
  153. package/examples/forgedock-demo/scripts/smoke.js +18 -1
  154. package/examples/forgedock-demo/src/db.js +36 -11
  155. package/examples/forgedock-demo/src/routes/notes.js +106 -9
  156. package/examples/forgedock-demo/src/server.js +4 -1
  157. package/package.json +12 -4
  158. package/packages/protocol/LICENSE +21 -0
  159. package/packages/protocol/src/cli.js +135 -0
  160. package/packages/protocol/src/emit.js +146 -0
  161. package/packages/protocol/src/index.js +43 -0
  162. package/packages/protocol/src/parse.js +229 -0
  163. package/packages/protocol/src/types.js +171 -0
  164. package/packages/protocol/src/validate.js +122 -0
  165. package/scripts/bench-topology-cost.mjs +372 -0
  166. package/scripts/check-command-docs-drift.sh +198 -0
  167. package/scripts/check-protocol-restatements.sh +176 -0
  168. package/scripts/check-registry/README.md +72 -0
  169. package/scripts/check-registry/manifest.json +6 -0
  170. package/scripts/code-index.sh +454 -0
  171. package/scripts/conformance-check.mjs +168 -0
  172. package/scripts/doctor-pipeline-state.sh +484 -0
  173. package/scripts/eval-gate-baseline.json +17 -0
  174. package/scripts/eval-gate-scorecard.mjs +242 -0
  175. package/scripts/eval-scorecard-aggregator.mjs +252 -0
  176. package/scripts/flaky-quarantine.sh +241 -0
  177. package/scripts/forge-annotation.sh +567 -0
  178. package/scripts/issue-dedup.sh +236 -0
  179. package/scripts/validate-annotation-node.mjs +233 -0
  180. package/scripts/verify-env-vars.sh +18 -2
  181. package/scripts/verify-host-headers.sh +4 -4
  182. package/scripts/verify-route-registration.sh +2 -2
  183. package/scripts/worktree-lifecycle.sh +202 -0
  184. package/templates/devdocs/agent/using-forgedock.md +14 -0
@@ -0,0 +1,158 @@
1
+ <!-- SPDX-FileCopyrightText: Copyright (c) RapierCraft Studios -->
2
+ <!-- SPDX-License-Identifier: AGPL-3.0-or-later -->
3
+
4
+ # Review Protocol — Normative Reference
5
+
6
+ **This is the single normative source for the Evidence-Based Review Protocol and the Structured Findings Protocol.**
7
+
8
+ These protocols are referenced by:
9
+ - `commands/review-pr-agents.md` — agent catalog (includes this via pointer)
10
+ - `commands/review-pr.md` — PR review orchestrator (reads agent catalog which references this)
11
+ - `commands/review-pr-staging.md` — staging review orchestrator (references this directly)
12
+
13
+ Do not duplicate these protocols in any other file. When updating either protocol, update only this file.
14
+
15
+ ---
16
+
17
+ ## Evidence-Based Review Protocol (ALL Agents Follow)
18
+
19
+ Every agent MUST follow this protocol:
20
+
21
+ ### 1. Start From the PR Diff
22
+ ```bash
23
+ # Verify review is still current before reading diff
24
+ CURRENT_SHA=$(gh pr view [PR_NUMBER] --json headRefOid --jq '.headRefOid')
25
+ if [ "$CURRENT_SHA" != "[REVIEW_SHA]" ]; then
26
+ echo "WARNING: PR HEAD changed during review. Review may be stale."
27
+ echo "Review pinned to: [REVIEW_SHA_SHORT]"
28
+ echo "Current HEAD: $(echo $CURRENT_SHA | cut -c1-7)"
29
+ fi
30
+
31
+ gh pr diff [PR_NUMBER] --name-only
32
+ gh pr diff [PR_NUMBER]
33
+ ```
34
+
35
+ **Hot-spot prior**:
36
+ [CHURN_CONTEXT]
37
+
38
+ If a file you are reviewing is listed above as a hot-spot, apply deeper scrutiny to it — high historical churn correlates with defect density. Prefer tracing that file's full code paths (Evidence-Based Review Protocol §2) over a quick pattern scan, and weight ambiguous findings in hot-spot files toward LIKELY rather than POSSIBLE.
39
+
40
+ ### 2. Dynamic Exploration
41
+ - From each changed file, follow imports and function calls
42
+ - Trace data flows across service boundaries (API → Redis → Worker)
43
+ - Search for related code: `grep -rn "function_name" services/`
44
+
45
+ ### 3. Validation Before Reporting
46
+
47
+ | Confidence | Criteria | Action |
48
+ |------------|----------|--------|
49
+ | **CONFIRMED** | Traced the full code path, found specific lines proving the bug | Report as blocking — P1 issue |
50
+ | **LIKELY** | Code pattern suggests issue but mitigations might exist elsewhere | Report with caveat — P2 issue |
51
+ | **POSSIBLE** | Suspicious pattern but couldn't trace the full flow | Report as informational — P3 advisory (non-blocking) |
52
+ | **UNFOUNDED** | Looked for the issue but found mitigations/correct handling | Do NOT report |
53
+
54
+ ### 3.5 REPRODUCTION GATE — Required Before CONFIRMED Classification
55
+
56
+ **MANDATORY**: Before classifying any finding as CONFIRMED, you MUST document one of the following forms of reproduction evidence in your report. A pattern match alone is not sufficient.
57
+
58
+ **Acceptable reproduction evidence (one of)**:
59
+ - **(a) Full code path trace**: List the execution chain from PR-changed code to the failure point. Minimum: 3 steps with specific file + line for each. Example: `services/api/app/routers/billing.py:142 → credits.py:check_balance():87 → returns None → caller at billing.py:148 raises AttributeError`. The chain must terminate at the actual failure — not at "and then it could fail."
60
+ - **(b) Specific input demonstration**: Provide concrete input values that trigger the failure. Example: `POST /api/v1/scrape with {"url": "http://internal:6432/"}` → `requests.get()` hits internal DB port → SSRF confirmed. The values must be specific (not "if an attacker provides a malicious URL") and must map to actual code in the PR diff.
61
+
62
+ **Downgrade rule**: If you cannot produce either (a) or (b) after a reasonable trace attempt, you MUST classify the finding as **POSSIBLE** — not CONFIRMED or LIKELY. Do NOT use CONFIRMED when the finding is based on:
63
+ - A suspicious pattern without tracing whether the condition is reachable via changed code
64
+ - A theoretical exploit path not grounded in specific lines from the diff
65
+ - A heuristic ("this type of code often has X bug") without verification
66
+
67
+ **POSSIBLE findings are informational advisories** — they are logged and tracked but do NOT block merge and do NOT trigger mandatory fix PRs. When in doubt, POSSIBLE is the correct classification. <!-- Added: forge#371 -->
68
+
69
+ ### 4. SEVERITY CLASSIFICATION — TRACE THE IMPACT
70
+
71
+ **CRITICAL RULE: Never dismiss a finding as "minor", "cosmetic", or "harmless" without tracing its downstream impact.** If you spot something unusual (redundant code, odd patterns, duplicated values), ask: "Does this cause a runtime error, data corruption, or wrong behavior in any code path that touches it?" Trace forward through every consumer of the construct.
72
+
73
+ **Severity decision tree:**
74
+ 1. Will this error at runtime? → **HIGH or CRITICAL** (not "minor redundancy")
75
+ 2. Will this produce wrong data silently? → **HIGH**
76
+ 3. Will this cause degraded performance? → **MEDIUM**
77
+ 4. Is it genuinely cosmetic with no runtime impact after tracing all consumers? → **LOW**
78
+
79
+ If you're unsure whether something is cosmetic or a runtime error, **assume it's a runtime error** and flag it for investigation. A false positive costs a minute of review time. A missed runtime error costs production downtime.
80
+
81
+ ### 5. INTERACTION ANALYSIS — "Pre-existing" Is Not "Safe"
82
+
83
+ **CRITICAL RULE: Never dismiss a finding as "pre-existing, not introduced by this PR" without checking whether NEW code in the PR interacts with the pre-existing construct to create a bug.**
84
+
85
+ A redundant import, an unused variable, or a duplicated constant may be harmless in isolation. But new code added in the same scope can turn it into a crash. Example: a local `import os` inside a function is harmless until new code above it calls `os.getenv()` — Python treats `os` as local for the entire function scope, causing `UnboundLocalError` before the import line is reached.
86
+
87
+ **Before dismissing anything as "pre-existing":**
88
+ 1. List every NEW line in the PR that references the pre-existing construct
89
+ 2. For each reference, ask: "Does the pre-existing construct cause this new line to fail at runtime?"
90
+ 3. If yes → CONFIRMED finding, not a dismissal
91
+
92
+ ### 6. FALSE POSITIVE PREVENTION
93
+
94
+ **Before claiming variable scope issues:** Read the FULL function, count indentation levels, check if/else structure.
95
+
96
+ **Before claiming type/unit mismatches:** Trace the variable to its source. Check if naming is misleading (e.g., `balanceCents` might hold microcents).
97
+
98
+ **Before claiming missing functions/imports:** `grep -rn "functionName" .` — check re-exports, aliases.
99
+
100
+ **Before claiming unreachable code:** Check all callers, dynamic dispatch, test code.
101
+
102
+ **Before dismissing redundant imports as harmless:** In Python, a local `import X` inside a function makes `X` a local variable for the ENTIRE function scope. Any use of `X` before that import line will raise `UnboundLocalError`. Check whether any code (existing or new) references `X` before the local import. This is a CONFIRMED CRITICAL if found — it crashes at runtime.
103
+
104
+ ### 7. Report Format
105
+
106
+ Every finding must include:
107
+ - **File:Line** — Exact location
108
+ - **Code snippet** — The problematic code
109
+ - **Evidence** — Why this is a bug (show the code path)
110
+ - **Confidence** — CONFIRMED/LIKELY/POSSIBLE
111
+ - **What you checked** — List files you read to verify
112
+
113
+ ---
114
+
115
+ ## Structured Findings Protocol
116
+
117
+ **All review agents MUST include a machine-readable findings block at the end of their PR comment.** This is NON-OPTIONAL. Without structured findings, the review system cannot create GitHub issues, and findings die as unread PR comments. Every finding that doesn't become a GitHub issue is a finding that will never be addressed.
118
+
119
+ ### Format
120
+
121
+ Append this block at the very end of your comment (after the `---` footer line, still inside the EOF heredoc). It uses HTML comments so it's invisible in rendered markdown:
122
+
123
+ `<!-- REVIEW-FINDINGS-START -->`
124
+ `<!-- FINDING:PREFIX-N|CONFIDENCE|SEVERITY|file.py:line|One-line summary -->`
125
+ `<!-- REVIEW-FINDINGS-END -->`
126
+
127
+ ### Rules
128
+
129
+ 1. **Include ALL findings at CONFIRMED, LIKELY, and POSSIBLE confidence** — every finding becomes a GitHub issue. Nothing stays as just a PR comment. **POSSIBLE findings are informational advisories (P3/non-blocking)** — they are tracked but do not require a fix PR and do not block merge. CONFIRMED and LIKELY findings are blocking at P1/P2 respectively.
130
+ 2. **One line per finding** — sequential numbering (PREFIX-1, PREFIX-2, ...)
131
+ 3. **Confidence**: `CONFIRMED`, `LIKELY`, or `POSSIBLE`
132
+ 4. **Severity**: `CRITICAL`, `HIGH`, `MEDIUM`, or `LOW`
133
+ 5. **Location**: Exact `file:line` reference
134
+ 6. **Summary**: Concise one-line description (no pipe `|` characters in summary)
135
+ 7. **Empty block**: If no findings at all, include just the START/END markers
136
+ 8. **HTML comments**: The block is invisible in rendered markdown but parseable by the review system
137
+
138
+ ### Domain Prefixes
139
+
140
+ | Agent | Prefix |
141
+ |-------|--------|
142
+ | General Security | `SEC` |
143
+ | Auth Conventions | `AUTH` |
144
+ | Billing Integrity | `BILL` |
145
+ | Concurrency | `CONC` |
146
+ | Scraper Logic | `SCRP` |
147
+ | Frontend Quality | `FE` |
148
+ | API Design | `API` |
149
+ | Database & Migration | `DB` |
150
+ | Infrastructure | `INFRA` |
151
+ | Config Schema | `CFG` |
152
+
153
+ ### Example
154
+
155
+ `<!-- REVIEW-FINDINGS-START -->`
156
+ `<!-- FINDING:SEC-1|CONFIRMED|HIGH|services/api/app/routers/scrape.py:45|SQL injection via unsanitized user input in query parameter -->`
157
+ `<!-- FINDING:SEC-2|LIKELY|MEDIUM|services/worker/worker/queues.py:312|Potential SSRF through user-controlled proxy URL -->`
158
+ `<!-- REVIEW-FINDINGS-END -->`
@@ -395,3 +395,31 @@ task-relevant spec set instead of letting the agent load blindly.
395
395
 
396
396
  Shipping the wiring is deferred because no hook-infrastructure layer exists in
397
397
  the repo yet; this section is the spec that a later issue implements against.
398
+
399
+ ## Nested-Command Decomposition and the Graph
400
+
401
+ The spec graph's `walk()` function (in `build-spec-graph.mjs`) and the
402
+ `load-set` query together enable the nested-command decomposition pattern. A
403
+ brief summary is given here; the full naming convention, decomposition criteria,
404
+ and token-saving effect are documented in
405
+ **`docs/spec/forge-protocol-v1.md` § 10 (Nested-Command Decomposition
406
+ Pattern)**.
407
+
408
+ **How nested specs become graph nodes**: `walk()` recursively discovers every
409
+ `commands/**/*.md` file at any depth. Each file is registered as a `cmd:` node
410
+ whose id follows the Skill() colon-delimited form (`cmd:work-on:build:context`
411
+ for `commands/work-on/build/context.md`). `CONTAINS` edges are inferred when a
412
+ parent spec references a child via `Skill(skill="<name>", ...)`.
413
+
414
+ **How `load-set` exploits decomposition**: `load-set <command>` seeds at the
415
+ command's node and walks `CONTAINS` and `REQUIRES` edges forward. A decomposed
416
+ command like `work-on` returns only the 11 files its execution graph actually
417
+ reaches — not the full ~44-spec corpus. Sub-specs that belong to `work-on/build/`
418
+ but are only invoked under specific conditions (e.g., `context.md` is skipped for
419
+ TRIVIAL tasks) can be added or removed from the reachable set by updating the
420
+ `CONTAINS` edges in the parent spec, without changing the query logic.
421
+
422
+ **Token-saving measurement**: See
423
+ `docs/articles/command-decomposition-token-savings.md` for before/after token
424
+ counts for `/review-pr` and `/orchestrate` following their spec decompositions
425
+ in #1271 and #1272.