forgedock 1.1.6 → 1.1.8

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 (43) hide show
  1. package/README.md +3 -1
  2. package/bin/engine/invariants.mjs +361 -0
  3. package/bin/hooks/pre-tool-use.mjs +182 -0
  4. package/bin/journey.mjs +77 -7
  5. package/bin/labels.json +10 -0
  6. package/bin/recall.mjs +540 -0
  7. package/commands/autopilot.md +959 -78
  8. package/commands/cleanup.md +52 -3
  9. package/commands/optimize.md +585 -0
  10. package/commands/orchestrate/phase-1-resolve.md +35 -25
  11. package/commands/orchestrate/phase-3-dependency.md +465 -34
  12. package/commands/orchestrate/phase-4-execution.md +448 -29
  13. package/commands/orchestrate/phase-6-report.md +198 -9
  14. package/commands/pipeline-health/phase-2-metrics.md +305 -1
  15. package/commands/pipeline-health/phase-4-proposals.md +127 -0
  16. package/commands/quality-gate.md +417 -0
  17. package/commands/review-pr.md +391 -13
  18. package/commands/spec-doctor.md +429 -0
  19. package/commands/validate.md +52 -0
  20. package/commands/work-on/build/architect.md +77 -0
  21. package/commands/work-on/build/context.md +357 -22
  22. package/commands/work-on/build/implement.md +2 -0
  23. package/commands/work-on/build/validate.md +28 -0
  24. package/commands/work-on/build.md +44 -0
  25. package/commands/work-on/close.md +621 -8
  26. package/commands/work-on/investigate.md +221 -0
  27. package/commands/work-on.md +15 -14
  28. package/docs/FORGE-PROTOCOL.md +101 -0
  29. package/docs/design/awesome-list-submissions.md +105 -0
  30. package/docs/design/f5bot-monitoring-setup.md +43 -0
  31. package/docs/design/growth-strategy-2026.md +579 -0
  32. package/docs/spec/forge-protocol-v1.md +97 -5
  33. package/docs/spec/label-state-machine.md +6 -1
  34. package/package.json +2 -2
  35. package/packages/protocol/src/cli.js +374 -84
  36. package/packages/protocol/src/types.js +75 -1
  37. package/scripts/build-knowledge-index.mjs +1761 -0
  38. package/scripts/calibration.mjs +996 -0
  39. package/scripts/danger-zones.mjs +782 -0
  40. package/scripts/doctor-pipeline-state.sh +88 -2
  41. package/scripts/refresh-bot-token.sh +97 -0
  42. package/scripts/select-fix-targets.sh +234 -0
  43. package/scripts/transition-label.sh +157 -6
@@ -64,48 +64,57 @@ If a `workflow:decomposed` issue is found, automatically expand it to its open s
64
64
  ### P3 Review-Finding Batching (deterministic grouping rule)
65
65
 
66
66
  <!-- Added: forge#1333 -->
67
+ <!-- Extended: forge#1818 — default-batchable eligibility, surface-area grouping, lowered same-file threshold -->
67
68
 
68
69
  Before finalizing the issue set, apply the P3 batching rule to reduce full-pipeline overhead on low-severity review findings.
69
70
 
70
- **Trigger conditions** (BOTH must be true to batch):
71
+ **Trigger conditions** (default-batchable — no opt-in marker required):
71
72
  1. The issue has labels `review-finding` + `priority:P3`
72
- 2. The issue has `<!-- FORGE:BATCHABLE -->` in its body
73
+ 2. The issue does NOT match any Safety exclusion below
73
74
 
74
- **Safety exclusions — NEVER batch** (override all trigger conditions):
75
- - Issue body contains the word "security" or "billing" anywhere in the title or `## Problem` section
76
- - Issue has a `security` label
77
- - Issue has a `billing` label
75
+ The `<!-- FORGE:BATCHABLE -->` marker (still appended by `review-pr.md` at finding-creation time) is honored when present but is no longer REQUIRED for eligibility — a `review-finding`+`priority:P3` issue is batchable by default unless explicitly excluded. This closes the gap where cascade-spawned findings that never carried the marker sat un-batched indefinitely. <!-- Added: forge#1818 -->
78
76
 
79
- **Grouping algorithm:**
77
+ **Safety exclusions — NEVER batch, at any priority** (override all trigger conditions):
78
+ - Issue body contains the word "security", "billing", "anti-bot", or "auth" anywhere in the title or `## Problem` section
79
+ - Issue has a `security`, `billing`, `anti-bot`, or `auth` label
80
+
81
+ These exclusions apply regardless of priority: P1/P2 findings are already never batched (see Important limits), and P3 findings in these domains are excluded even though they would otherwise qualify for default-batchable treatment. <!-- Added: forge#1818 -->
82
+
83
+ **Grouping algorithm (surface area — same file first, leaf directory as broader fallback):** <!-- Changed: forge#1818 — was domain-only -->
80
84
  ```bash
81
- # Fetch all open batchable P3 issues
85
+ # Fetch all open batchable P3 issues (default-batchable; marker no longer required)
82
86
  BATCHABLE_P3=$(gh issue list {GH_FLAG} \
83
87
  --state open \
84
88
  --label "review-finding,priority:P3" \
85
89
  --limit 500 \
86
90
  --json number,title,body,labels \
87
- --jq '.[] | select(.body | test("<!-- FORGE:BATCHABLE -->"))
88
- | select((.title | test("security|billing"; "i")) | not)
89
- | select(.body | test("## Problem[\\s\\S]{0,500}(security|billing)"; "i") | not)
90
- | select(([.labels[].name] | any(. == "security" or . == "billing")) | not)')
91
-
92
- # Group by domain (file-cluster derived from the affected file path in each issue body)
93
- # Domain is the top-level directory of the first affected file listed under "## Affected Files"
94
- # e.g., "services/api/auth/login.py" → domain "services/api/auth"
95
- # "web/src/app/billing/" → EXCLUDED (billing path)
96
- # "commands/review-pr.md" → domain "commands"
91
+ --jq '.[] | select((.title | test("security|billing|anti-bot|auth"; "i")) | not)
92
+ | select(.body | test("## Problem[\\s\\S]{0,500}(security|billing|anti-bot|auth)"; "i") | not)
93
+ | select(([.labels[].name] | any(. == "security" or . == "billing" or . == "anti-bot" or . == "auth")) | not)')
94
+
95
+ # Surface area = the exact affected file path listed first under "## Affected Files" (primary grouping key).
96
+ # Leaf directory = dirname of that file (broader fallback grouping key, formerly called "domain").
97
+ # e.g., "services/api/auth/login.py" → EXCLUDED (auth path)
98
+ # "web/src/app/billing/page.tsx" → EXCLUDED (billing path)
99
+ # "commands/orchestrate/phase-1-resolve.md" → file "commands/orchestrate/phase-1-resolve.md", leaf-dir "commands/orchestrate"
100
+ # "commands/review-pr.md" → file "commands/review-pr.md", leaf-dir "commands"
97
101
  ```
98
102
 
99
- **Batch creation rule**: When 5+ batchable P3 issues share the same domain, OR when the oldest batchable P3 in a domain exceeds 72 hours, create a single batch issue grouping those issues:
103
+ **Batch creation rule (two-tier threshold):** <!-- Changed: forge#1818 — added lower same-file tier -->
104
+ - **Same-file cluster** (primary, low threshold): When **2+** batchable P3 issues share the exact same affected file, create a batch issue for that file cluster. Same-file P3 findings are the dominant low-value token sink (dead imports, stale comments, style nits) and already conflict with each other if built individually — the low threshold reflects that they'd otherwise serialize into slow one-at-a-time chains regardless of count.
105
+ - **Leaf-directory cluster** (broader grouping, existing threshold preserved): When **5+** batchable P3 issues share the same leaf directory but are not already covered by a same-file cluster above, OR the oldest batchable P3 in that leaf directory exceeds 72 hours, create a batch issue for that leaf-directory cluster.
106
+ - Form same-file clusters first; evaluate any remaining ungrouped findings for leaf-directory clustering. A finding is claimed by at most one batch.
100
107
 
108
+ **Sanitize the surface-area path before interpolation (MANDATORY):** `{SURFACE_AREA}` is an affected-file path derived from an issue body, and git filenames can legally carry shell metacharacters (`` ` ``, `$()`, quotes). Restrict it to a validated `[A-Za-z0-9._/-]` charset before templating it into `--title` / `--body`, so an untrusted issue body cannot break the `gh` argument boundary. The same guard is applied at the mirror site in `phase-4-execution.md`. <!-- forge#1833, forge#1835 -->
101
109
  ```bash
110
+ SAFE_SURFACE_AREA=$(printf '%s' "{SURFACE_AREA}" | tr -cd 'A-Za-z0-9._/-')
102
111
  BATCH_ISSUE_NUM=$(gh issue create {GH_FLAG} \
103
- --title "fix(batch): P3 review findings — {DOMAIN} domain (batch #{BATCH_N})" \
112
+ --title "fix(batch): P3 review findings — ${SAFE_SURFACE_AREA} (batch #{BATCH_N})" \
104
113
  --label "review-finding,priority:P3,batch" \
105
114
  --body "$(cat <<'BATCH_EOF'
106
115
  ## Problem
107
116
 
108
- Batch of P3 review findings in the **{DOMAIN}** domain, grouped to reduce per-finding pipeline overhead.
117
+ Batch of P3 review findings in **{SURFACE_AREA}** (same file or leaf directory), grouped to reduce per-finding pipeline overhead.
109
118
 
110
119
  ## Member Findings
111
120
 
@@ -117,11 +126,11 @@ Batch of P3 review findings in the **{DOMAIN}** domain, grouped to reduce per-fi
117
126
 
118
127
  - [ ] All member findings addressed or closed as false-positive
119
128
  - [ ] Member issues auto-closed with reference to this batch PR on merge
120
- - [ ] No security or billing paths touched (validated before batching)
129
+ - [ ] No security, billing, anti-bot, or auth paths touched (validated before batching)
121
130
 
122
131
  ## Context
123
132
 
124
- **Batch policy**: 5+ open P3 findings in the same domain, or oldest > 72h.
133
+ **Batch policy**: 2+ open P3 findings sharing the same file, or 5+ sharing the same leaf directory, or oldest > 72h.
125
134
  **Member issues**: #{N1}, #{N2}, #{N3}, ...
126
135
 
127
136
  <!-- FORGE:BATCHABLE -->
@@ -132,11 +141,12 @@ BATCH_EOF
132
141
  **Replace member issues with the batch issue** in the resolved issue set. Member issues are NOT individually dispatched to `/work-on` — the batch issue is the single pipeline unit.
133
142
 
134
143
  **Important limits**:
135
- - Max 10 members per batch issue — if more than 10 batchable P3s exist in a domain, create multiple batch issues of ≤ 10 each
144
+ - Max **8** members per batch issue — if more than 8 batchable P3s exist in a surface-area cluster, create multiple batch issues of ≤ 8 each <!-- Changed: forge#1818 — was 10 -->
136
145
  - P1 and P2 issues are NEVER batched — they keep the standard one-issue-one-PR path
146
+ - Security/billing/anti-bot/auth findings are NEVER batched at any priority (see Safety exclusions above) <!-- Added: forge#1818 -->
137
147
  - Batch issues themselves are never nested inside other batch issues
138
148
 
139
- If fewer than 5 batchable P3 findings exist in any domain AND none exceed 72h, skip batch creation entirely — individual P3s run through the standard pipeline.
149
+ If fewer than 2 batchable P3 findings share a file, AND fewer than 5 share a leaf directory, AND none exceed 72h, skip batch creation entirely — individual P3s run through the standard pipeline.
140
150
 
141
151
  ### CRITICAL: No duplicate detection at orchestrator level
142
152