forgedock 1.53.0 → 1.54.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.
- package/.claude-plugin/marketplace.json +51 -0
- package/README.md +8 -2
- package/bin/auth/app-manifest.mjs +89 -0
- package/bin/auth/app-manifest.test.mjs +75 -0
- package/bin/auth/app-token.mjs +256 -0
- package/bin/auth/app-token.test.mjs +232 -0
- package/bin/brand.mjs +7 -0
- package/bin/config-history.mjs +151 -0
- package/bin/config-schema.mjs +115 -0
- package/bin/demo.mjs +65 -11
- package/bin/engine/outcome-codes.mjs +6 -3
- package/bin/engine/telemetry-seam.mjs +8 -2
- package/bin/engine/telemetry-seam.test.mjs +17 -0
- package/bin/engine-cli.mjs +57 -20
- package/bin/first-run.mjs +122 -0
- package/bin/forgedock.mjs +128 -146
- package/bin/help-text.mjs +144 -0
- package/bin/hooks/pre-tool-use.mjs +7 -0
- package/bin/journey.mjs +82 -83
- package/bin/lean/acceptance.mjs +313 -0
- package/bin/lean/acceptance.test.mjs +215 -0
- package/bin/lean/activation.mjs +18 -0
- package/bin/lean/activation.test.mjs +23 -1
- package/bin/lean/batch-health.mjs +74 -1
- package/bin/lean/batch-health.test.mjs +54 -1
- package/bin/lean/batch.test.mjs +11 -9
- package/bin/lean/branchlock.mjs +54 -0
- package/bin/lean/branchlock.test.mjs +49 -0
- package/bin/lean/ceiling.mjs +72 -0
- package/bin/lean/ceiling.test.mjs +54 -0
- package/bin/lean/ci-budget.mjs +366 -0
- package/bin/lean/ci-budget.test.mjs +167 -0
- package/bin/lean/conformance.e2e.test.mjs +7 -0
- package/bin/lean/conformance.mjs +77 -19
- package/bin/lean/conformance.test.mjs +129 -3
- package/bin/lean/context.mjs +35 -6
- package/bin/lean/context.test.mjs +27 -1
- package/bin/lean/depcache.mjs +25 -1
- package/bin/lean/depcache.test.mjs +26 -0
- package/bin/lean/e2e.mjs +18 -2
- package/bin/lean/e2e.test.mjs +26 -1
- package/bin/lean/effects.mjs +40 -11
- package/bin/lean/execution.test.mjs +24 -0
- package/bin/lean/facts.mjs +3 -3
- package/bin/lean/facts.test.mjs +5 -0
- package/bin/lean/fixround.mjs +14 -0
- package/bin/lean/fixround.test.mjs +25 -2
- package/bin/lean/gh-assoc.test.mjs +2 -1
- package/bin/lean/integration.mjs +100 -9
- package/bin/lean/integration.test.mjs +98 -0
- package/bin/lean/issuewatch-parity.mjs +64 -0
- package/bin/lean/issuewatch-parity.test.mjs +127 -0
- package/bin/lean/issuewatch-release.test.mjs +1 -1
- package/bin/lean/issuewatch.mjs +34 -5
- package/bin/lean/issuewatch.test.mjs +3 -2
- package/bin/lean/lean.mjs +316 -74
- package/bin/lean/lean.test.mjs +397 -24
- package/bin/lean/mechfix.mjs +124 -0
- package/bin/lean/mechfix.test.mjs +75 -0
- package/bin/lean/orchestrate.mjs +20 -2
- package/bin/lean/phaseledger.mjs +47 -5
- package/bin/lean/phaseledger.test.mjs +30 -1
- package/bin/lean/precheck.mjs +23 -4
- package/bin/lean/precheck.test.mjs +14 -1
- package/bin/lean/prereq.mjs +28 -0
- package/bin/lean/prereq.test.mjs +20 -0
- package/bin/lean/probe.mjs +4 -2
- package/bin/lean/prodparity.mjs +52 -0
- package/bin/lean/prodparity.test.mjs +67 -0
- package/bin/lean/prompts.mjs +69 -12
- package/bin/lean/recovery.test.mjs +1 -1
- package/bin/lean/release-io.test.mjs +42 -0
- package/bin/lean/release-postmerge.mjs +6 -0
- package/bin/lean/release-preflight.mjs +58 -0
- package/bin/lean/release-preflight.test.mjs +114 -0
- package/bin/lean/release-rehearsal.mjs +8 -7
- package/bin/lean/release-review.mjs +67 -11
- package/bin/lean/release-review.test.mjs +128 -1
- package/bin/lean/release-snapshot.mjs +188 -0
- package/bin/lean/release-snapshot.test.mjs +190 -0
- package/bin/lean/release.mjs +80 -12
- package/bin/lean/release.test.mjs +95 -0
- package/bin/lean/render.mjs +1 -1
- package/bin/lean/replan.mjs +184 -0
- package/bin/lean/replan.test.mjs +110 -0
- package/bin/lean/resume.mjs +9 -7
- package/bin/lean/resume.test.mjs +16 -0
- package/bin/lean/schedd.mjs +34 -1
- package/bin/lean/schedd.test.mjs +21 -1
- package/bin/lean/selfreview.mjs +94 -0
- package/bin/lean/selfreview.test.mjs +58 -1
- package/bin/lean/selftest-gate.mjs +22 -0
- package/bin/lean/selftest-gate.test.mjs +18 -1
- package/bin/lean/selftest-journey.mjs +234 -0
- package/bin/lean/selftest-journey.test.mjs +130 -0
- package/bin/lean/selftest-live.mjs +2 -1
- package/bin/lean/seqlease.mjs +35 -1
- package/bin/lean/seqlease.test.mjs +15 -0
- package/bin/lean/seqreserve.e2e.test.mjs +135 -0
- package/bin/lean/seqreserve.mjs +73 -0
- package/bin/lean/seqreserve.test.mjs +134 -0
- package/bin/lean/sequence.mjs +35 -6
- package/bin/lean/seqversioned.mjs +147 -0
- package/bin/lean/stagestamp.mjs +28 -0
- package/bin/lean/stagestamp.test.mjs +32 -0
- package/bin/lean/surfaces.mjs +75 -0
- package/bin/lean/surfaces.test.mjs +59 -0
- package/bin/lean/toolplace.mjs +28 -0
- package/bin/lean/toolplace.test.mjs +24 -0
- package/bin/lean/toolstats.mjs +3 -1
- package/bin/lean/toolstats.test.mjs +11 -0
- package/bin/lean/validatebest.mjs +28 -0
- package/bin/lean/validatebest.test.mjs +27 -0
- package/bin/pool/agent.mjs +9 -0
- package/bin/pool/docker.mjs +5 -0
- package/bin/pool/router.mjs +8 -4
- package/bin/prereqs.mjs +111 -0
- package/bin/replay-timelapse.mjs +149 -0
- package/bin/review-staging.mjs +100 -16
- package/bin/review-staging.test.mjs +18 -0
- package/bin/runner.mjs +43 -6
- package/bin/splash-install.mjs +157 -0
- package/bin/stats/aggregate.mjs +8 -1
- package/bin/stats/conformance-outcomes.mjs +100 -19
- package/bin/stats/conformance-outcomes.test.mjs +87 -1
- package/bin/stats/depth.mjs +88 -31
- package/bin/stats/depth.test.mjs +63 -38
- package/bin/stats/efficiency.mjs +26 -5
- package/bin/stats/efficiency.test.mjs +45 -1
- package/bin/stats/first-review.mjs +77 -0
- package/bin/stats/first-review.test.mjs +36 -0
- package/bin/stats/firstmerge.mjs +40 -0
- package/bin/stats/firstmerge.test.mjs +41 -0
- package/bin/stats/github-source.mjs +51 -13
- package/bin/stats/index.mjs +91 -15
- package/bin/stats/local-source.mjs +1 -0
- package/bin/stats/origin.mjs +80 -0
- package/bin/stats/origin.test.mjs +58 -0
- package/bin/stats/render.mjs +3 -1
- package/bin/stats/scoreboard.mjs +137 -0
- package/bin/stats/scoreboard.test.mjs +87 -0
- package/bin/stats/stats.test.mjs +80 -0
- package/bin/tui.mjs +3 -2
- package/commands/bootstrap.md +15 -14
- package/commands/deploy-pr.md +18 -3
- package/commands/forge-stats.md +1 -1
- package/commands/forgedock-ci-setup.md +28 -0
- package/commands/forgedock-init.md +4 -5
- package/commands/issue.md +2 -0
- package/commands/milestone.md +9 -1
- package/commands/replay.md +2 -0
- package/commands/review-pr-staging.md +4 -1
- package/commands/work-on/close.md +8 -0
- package/docs/CONFIG.md +105 -10
- package/docs/ISSUE-WATCH.md +23 -0
- package/docs/OUTCOME-CODES.md +1 -0
- package/docs/REPLAY.md +9 -0
- package/docs/SELFTEST.md +11 -0
- package/docs/STATS.md +19 -2
- package/docs/eval/README.md +6 -0
- package/docs/eval/adversarial-bench.md +68 -0
- package/docs/eval/corpus/adversarial-v1.json +285 -0
- package/docs/eval/feature-bench.md +42 -0
- package/docs/eval/feature-specs/crud-auth/journeys/notes-crud-isolated.mjs +21 -0
- package/docs/eval/feature-specs/crud-auth/journeys/register-login.mjs +12 -0
- package/docs/eval/feature-specs/crud-auth/spec.md +15 -0
- package/docs/site/start-a-new-project.md +2 -1
- package/package.json +5 -2
- package/plugins/forgedock-splash/.claude-plugin/plugin.json +10 -0
- package/plugins/forgedock-splash/README.md +27 -0
- package/plugins/forgedock-splash/hooks/hooks.json +1 -0
- package/plugins/forgedock-splash/hooks/register.tsx +74 -0
- package/plugins/forgedock-splash/hooks/scene.ts +222 -0
- package/plugins/forgedock-splash/types/index.d.ts +10 -0
- package/scripts/bench-adversarial.mjs +216 -0
- package/scripts/bench-feature.mjs +170 -0
- package/scripts/bench-lightlane.mjs +2 -2
- package/scripts/bootstrap-create.mjs +2 -2
- package/scripts/bootstrap-validate.mjs +35 -2
- package/scripts/check-spec-size.sh +4 -3
- package/scripts/check-spec-size.test.sh +3 -0
- package/scripts/plan-validate-live.mjs +40 -6
- package/scripts/review-pr-staging-scope.test.sh +1 -1
- package/scripts/review-staging-post.sh +23 -0
- package/scripts/review-staging-post.test.sh +8 -0
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
// SPDX-FileCopyrightText: Copyright (c) RapierCraft Studios
|
|
2
|
+
// SPDX-License-Identifier: AGPL-3.0-or-later
|
|
3
|
+
/**
|
|
4
|
+
* forge#5341: feature scoreboard. `forgedock stats --milestone <id|title>` grades a whole milestone, not one issue:
|
|
5
|
+
* - journey status at ship per epic (#5336 FORGE:ACCEPTANCE comments: pass, fail or never-ran, with the head and time)
|
|
6
|
+
* - minutes from the first lane merge to the first green end-to-end run (journey record)
|
|
7
|
+
* - defects found after the last planned child merged, by class (release-review, post-deploy, hotfix, other)
|
|
8
|
+
* - rework share: issues that fix or redo a sibling of the same milestone
|
|
9
|
+
* - operator interventions: hand PRs (head branch is not a lane branch), manual merges (PRs labelled manual-merge) and needs-human issues, plus needs-human run logs
|
|
10
|
+
* Deterministic: GitHub (milestone issues, PRs, epic comments) and optional local run logs; no model, no clock; the gh runner is
|
|
11
|
+
* injected. A missing signal is null (printed n/a), never 0.
|
|
12
|
+
*/
|
|
13
|
+
import { readEpics, acceptanceResultOf } from "../lean/acceptance.mjs";
|
|
14
|
+
import { listMilestones } from "../lean/lane.mjs";
|
|
15
|
+
|
|
16
|
+
export const DEFECT_CLASSES = Object.freeze(["release-review", "post-deploy", "hotfix", "other"]);
|
|
17
|
+
const LANE_BRANCH_RE = /^(?:feat|fix|chore|docs|refactor|perf|test)\/issue-\d+/;
|
|
18
|
+
const REWORK_RE = /\b(?:fix(?:es|ed)?|redo|rework|regress\w*|follow-?up|revert\w*)\b[^\n#]*#(\d+)/gi;
|
|
19
|
+
const labelsOf = (i) => (i.labels ?? []).map((l) => (typeof l === "string" ? l : l?.name)).filter(Boolean);
|
|
20
|
+
const has = (i, re) => labelsOf(i).some((l) => re.test(l)) || re.test(String(i.title ?? ""));
|
|
21
|
+
const ms = (t) => { const v = Date.parse(t); return Number.isFinite(v) ? v : null; };
|
|
22
|
+
|
|
23
|
+
/** The defect class of an issue from its labels or title, or null when it is no defect. */
|
|
24
|
+
export function defectClass(i) {
|
|
25
|
+
if (has(i, /release[- ]review/i)) return "release-review";
|
|
26
|
+
if (has(i, /post[- ]deploy/i)) return "post-deploy";
|
|
27
|
+
if (has(i, /hotfix/i)) return "hotfix";
|
|
28
|
+
return labelsOf(i).some((l) => /^(?:bug|defect|regression)$/i.test(l)) ? "other" : null;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/** Journey status of one epic's comments: {status: pass|fail|never-ran, head, at, journeys, first_green_at}. */
|
|
32
|
+
export function journeyStatus(epic) {
|
|
33
|
+
const recs = (epic.comments ?? []).map((c) => { const r = acceptanceResultOf(c.body); return r ? { ...r, at: r.at ?? c.created_at } : null; }).filter(Boolean)
|
|
34
|
+
.filter((r) => r.site !== "post-deploy").sort((a, b) => (ms(a.at) ?? 0) - (ms(b.at) ?? 0));
|
|
35
|
+
const last = recs.at(-1);
|
|
36
|
+
const green = recs.find((r) => r.result === "pass");
|
|
37
|
+
return { epic: epic.number, journeys: epic.declared?.journeys?.length ?? 0, status: last ? last.result : "never-ran", head: last?.head ?? null, at: last?.at ?? null, runs: recs.length, first_green_at: green?.at ?? null };
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Pure scoreboard. milestone {number, title, state, closed_at}; issues: the milestone's issues and PRs (GitHub issues API);
|
|
42
|
+
* prs: [{number, merged_at, head_ref}] for the milestone's PRs; epics: readEpics rows; runs: local run summaries (optional).
|
|
43
|
+
*/
|
|
44
|
+
export function scoreboard({ milestone, issues = [], prs = [], epics = [], runs = [] }) {
|
|
45
|
+
const plain = issues.filter((i) => !i.pull_request);
|
|
46
|
+
const isEpic = (i) => labelsOf(i).includes("epic");
|
|
47
|
+
const children = plain.filter((i) => !isEpic(i));
|
|
48
|
+
const nums = new Set(children.map((i) => i.number));
|
|
49
|
+
const planned = children.filter((i) => !defectClass(i));
|
|
50
|
+
const mergeTimes = (prs.length ? prs.map((p) => ms(p.merged_at)) : planned.filter((i) => i.state === "closed").map((i) => ms(i.closed_at))).filter((t) => t != null).sort((a, b) => a - b);
|
|
51
|
+
const closedPlanned = planned.map((i) => ms(i.closed_at)).filter((t) => t != null).sort((a, b) => a - b);
|
|
52
|
+
const lastChild = planned.length && planned.every((i) => i.state === "closed") ? closedPlanned.at(-1) ?? null : null;
|
|
53
|
+
const firstMerge = mergeTimes[0] ?? null;
|
|
54
|
+
const journeys = epics.map(journeyStatus);
|
|
55
|
+
const greens = journeys.map((j) => ms(j.first_green_at)).filter((t) => t != null);
|
|
56
|
+
const firstGreen = greens.length ? Math.min(...greens) : null;
|
|
57
|
+
const defects = Object.fromEntries(DEFECT_CLASSES.map((c) => [c, 0]));
|
|
58
|
+
const defectIssues = [];
|
|
59
|
+
for (const i of children) {
|
|
60
|
+
const c = defectClass(i);
|
|
61
|
+
if (c && lastChild != null && (ms(i.created_at) ?? 0) > lastChild) { defects[c]++; defectIssues.push(i.number); }
|
|
62
|
+
}
|
|
63
|
+
const rework = new Set();
|
|
64
|
+
for (const i of children) {
|
|
65
|
+
if (labelsOf(i).includes("rework")) rework.add(i.number);
|
|
66
|
+
for (const m of String(i.body ?? "").matchAll(REWORK_RE)) if (Number(m[1]) !== i.number && nums.has(Number(m[1]))) rework.add(i.number);
|
|
67
|
+
}
|
|
68
|
+
const handPrs = prs.filter((p) => p.head_ref && !LANE_BRANCH_RE.test(p.head_ref) && !/^milestone\//.test(p.head_ref)).map((p) => p.number);
|
|
69
|
+
const manualMerges = issues.filter((i) => i.pull_request && labelsOf(i).some((l) => /^(?:manual[- ]merge|merged[- ]by[- ]hand)$/i.test(l))).map((i) => i.number);
|
|
70
|
+
const needsHuman = children.filter((i) => labelsOf(i).includes("needs-human")).map((i) => i.number);
|
|
71
|
+
const mine = runs.filter((r) => nums.has(Number(r.issue)));
|
|
72
|
+
const costs = mine.map((r) => r.usd ?? r.cost_usd).filter((x) => Number.isFinite(x));
|
|
73
|
+
return {
|
|
74
|
+
milestone: { number: milestone.number, title: milestone.title, state: milestone.state ?? null },
|
|
75
|
+
children: children.length, merged: mergeTimes.length || null,
|
|
76
|
+
journeys,
|
|
77
|
+
journey_status_at_ship: !journeys.length ? null : journeys.every((j) => j.status === "pass") ? "pass" : journeys.some((j) => j.status === "fail") ? "fail" : "never-ran",
|
|
78
|
+
minutes_first_merge_to_first_green: firstMerge != null && firstGreen != null ? Math.max(0, Math.round((firstGreen - firstMerge) / 60000)) : null,
|
|
79
|
+
last_child_merged_at: lastChild != null ? new Date(lastChild).toISOString() : null,
|
|
80
|
+
defects_after_last_child: lastChild != null ? { total: defectIssues.length, by_class: defects, issues: defectIssues } : null,
|
|
81
|
+
rework: children.length ? { issues: [...rework].sort((a, b) => a - b), share: Math.round((rework.size / children.length) * 1e4) / 1e4 } : null,
|
|
82
|
+
interventions: { hand_prs: handPrs, needs_human_issues: needsHuman, manual_merges: manualMerges, needs_human_runs: mine.filter((r) => r.reason === "needs-human").length, total: handPrs.length + manualMerges.length + needsHuman.length },
|
|
83
|
+
cost_usd: costs.length ? Math.round(costs.reduce((a, b) => a + b, 0) * 100) / 100 : null,
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
const jsonl = (raw) => String(raw ?? "").split("\n").map((l) => l.trim()).filter(Boolean).flatMap((l) => { try { return [JSON.parse(l)]; } catch { return []; } });
|
|
88
|
+
|
|
89
|
+
/** The milestone whose number or title is `ref`, or null. */
|
|
90
|
+
export async function findMilestoneByRef({ io, repo, ref }) {
|
|
91
|
+
const r = String(ref);
|
|
92
|
+
return (await listMilestones({ gh: io.gh, repo, state: "all" })).find((m) => String(m.number) === r || m.title === r) ?? null;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/** Read a milestone (number or title) with its issues, PRs and epics through an injected `io.gh`; null when it does not exist. */
|
|
96
|
+
export async function gatherScoreboard({ io, repo, ref, runs = [] }) {
|
|
97
|
+
const milestone = await findMilestoneByRef({ io, repo, ref });
|
|
98
|
+
if (!milestone) return null;
|
|
99
|
+
const issues = jsonl(await io.gh(["api", `repos/${repo}/issues?milestone=${milestone.number}&state=all&per_page=100`, "--paginate", "--jq", ".[] | @json"]));
|
|
100
|
+
const prs = [];
|
|
101
|
+
for (const p of issues.filter((i) => i.pull_request)) {
|
|
102
|
+
const row = jsonl(await io.gh(["api", `repos/${repo}/pulls/${p.number}`, "--jq", "{number, merged_at, head_ref: .head.ref} | @json"]))[0];
|
|
103
|
+
if (row) prs.push(row);
|
|
104
|
+
}
|
|
105
|
+
const epics = await readEpics({ io, repo, milestone });
|
|
106
|
+
return scoreboard({ milestone: { ...milestone, state: milestone.state }, issues, prs, epics, runs });
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
const NA = "n/a";
|
|
110
|
+
const fmt = (x, f = String) => (x == null ? NA : f(x));
|
|
111
|
+
|
|
112
|
+
export function renderScoreboard(s) {
|
|
113
|
+
if (!s) return "Feature scoreboard: milestone not found.";
|
|
114
|
+
const d = s.defects_after_last_child, iv = s.interventions;
|
|
115
|
+
return [`## Feature scoreboard: ${s.milestone.title} (#${s.milestone.number})`, "",
|
|
116
|
+
"| metric | value |", "|---|---|",
|
|
117
|
+
`| children | ${s.children} (merged ${fmt(s.merged)}) |`,
|
|
118
|
+
`| journey status at ship | ${fmt(s.journey_status_at_ship)} |`,
|
|
119
|
+
`| first lane merge to first green journey | ${fmt(s.minutes_first_merge_to_first_green, (m) => `${m}m`)} |`,
|
|
120
|
+
`| defects after last child | ${d ? `${d.total} (${DEFECT_CLASSES.map((c) => `${c} ${d.by_class[c]}`).join(", ")})` : NA} |`,
|
|
121
|
+
`| rework share | ${s.rework ? `${Math.round(s.rework.share * 100)}% (${s.rework.issues.length} issues)` : NA} |`,
|
|
122
|
+
`| operator interventions | ${iv.total} (hand PRs ${iv.hand_prs.length}, manual merges ${iv.manual_merges.length}, needs-human ${iv.needs_human_issues.length}) |`,
|
|
123
|
+
`| cost | ${fmt(s.cost_usd, (x) => `$${x.toFixed(2)}`)} |`,
|
|
124
|
+
...(s.journeys.length ? ["", "| epic | journeys | status | head | at |", "|---|---|---|---|---|", ...s.journeys.map((j) => `| #${j.epic} | ${j.journeys} | ${j.status} | ${j.head ? String(j.head).slice(0, 7) : NA} | ${j.at ?? NA} |`)] : [])].join("\n");
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
/**
|
|
128
|
+
* Promotion gate for a default flag that touches milestone lanes: it passes only while the latest feature-benchmark scorecard
|
|
129
|
+
* has no regression and, when a shipped-milestone scoreboard is given, its journeys are not red. {ok, reasons}.
|
|
130
|
+
*/
|
|
131
|
+
export function scoreboardGate({ bench = null, board = null } = {}) {
|
|
132
|
+
const reasons = [];
|
|
133
|
+
if (!bench) reasons.push("no feature benchmark scorecard recorded");
|
|
134
|
+
else if (bench.regression) reasons.push(`feature benchmark regressed: ${bench.regression}`);
|
|
135
|
+
if (board && board.journey_status_at_ship && board.journey_status_at_ship !== "pass") reasons.push(`milestone ${board.milestone.title}: journeys ${board.journey_status_at_ship} at ship`);
|
|
136
|
+
return { ok: !reasons.length, reasons };
|
|
137
|
+
}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { describe, it } from "node:test";
|
|
2
|
+
import assert from "node:assert/strict";
|
|
3
|
+
import { defectClass, scoreboard, gatherScoreboard, renderScoreboard, scoreboardGate } from "./scoreboard.mjs";
|
|
4
|
+
import { renderAcceptanceComment } from "../lean/acceptance.mjs";
|
|
5
|
+
import { buildReport, parseArgs } from "./index.mjs";
|
|
6
|
+
|
|
7
|
+
const iss = (number, o = {}) => ({ number, state: "closed", title: `t${number}`, body: "", labels: [], created_at: "2026-11-01T00:00:00Z", closed_at: "2026-11-02T00:00:00Z", ...o });
|
|
8
|
+
const ms = { number: 7, title: "Feature X", state: "closed" };
|
|
9
|
+
const acc = (head, at, result) => ({ body: renderAcceptanceComment({ head, at, site: "milestone", rows: [{ name: "j", result, exit: result === "pass" ? 0 : 1, ms: 1, output: "x" }] }), created_at: at });
|
|
10
|
+
const epicRow = (comments) => ({ number: 1, state: "open", declared: { journeys: [{ name: "j", when: "milestone" }] }, comments });
|
|
11
|
+
const ISSUES = [
|
|
12
|
+
iss(1, { labels: [{ name: "epic" }] }),
|
|
13
|
+
iss(2, { closed_at: "2026-11-02T00:00:00Z" }),
|
|
14
|
+
iss(3, { closed_at: "2026-11-03T00:00:00Z" }),
|
|
15
|
+
iss(4, { body: "Fixes #2 after the redo", closed_at: "2026-11-04T00:00:00Z" }),
|
|
16
|
+
iss(5, { labels: [{ name: "bug" }, { name: "post-deploy" }], created_at: "2026-11-06T00:00:00Z" }),
|
|
17
|
+
iss(6, { title: "hotfix: crash", labels: [{ name: "needs-human" }], created_at: "2026-11-07T00:00:00Z" }),
|
|
18
|
+
iss(8, { labels: [{ name: "bug" }], created_at: "2026-11-01T12:00:00Z" }), // before the last child: not a defect after it
|
|
19
|
+
iss(20, { pull_request: {}, closed_at: "2026-11-02T00:00:00Z" }),
|
|
20
|
+
];
|
|
21
|
+
const PRS = [{ number: 20, merged_at: "2026-11-02T00:00:00Z", head_ref: "feat/issue-2-x" }, { number: 21, merged_at: "2026-11-03T00:00:00Z", head_ref: "hand-fix" }];
|
|
22
|
+
|
|
23
|
+
describe("feature scoreboard", () => {
|
|
24
|
+
it("counts PRs labelled manual-merge as operator interventions", () => {
|
|
25
|
+
const s = scoreboard({ milestone: ms, issues: [iss(2), iss(30, { pull_request: {}, labels: [{ name: "manual-merge" }] })], prs: [] });
|
|
26
|
+
assert.deepEqual(s.interventions.manual_merges, [30]);
|
|
27
|
+
assert.equal(s.interventions.total, 1);
|
|
28
|
+
});
|
|
29
|
+
it("classifies defects by label or title", () => {
|
|
30
|
+
assert.equal(defectClass(iss(1, { labels: ["release-review"] })), "release-review");
|
|
31
|
+
assert.equal(defectClass(iss(1, { title: "hotfix: x" })), "hotfix");
|
|
32
|
+
assert.equal(defectClass(iss(1, { labels: ["bug"] })), "other");
|
|
33
|
+
assert.equal(defectClass(iss(1)), null);
|
|
34
|
+
});
|
|
35
|
+
it("a shipped milestone: journey status, time to first green, defects by class, rework, interventions", () => {
|
|
36
|
+
const epics = [epicRow([acc("a".repeat(40), "2026-11-04T00:00:00Z", "fail"), acc("b".repeat(40), "2026-11-05T00:00:00Z", "pass")])];
|
|
37
|
+
const s = scoreboard({ milestone: ms, issues: ISSUES, prs: PRS, epics });
|
|
38
|
+
assert.equal(s.journey_status_at_ship, "pass");
|
|
39
|
+
assert.equal(s.minutes_first_merge_to_first_green, 3 * 1440);
|
|
40
|
+
assert.equal(s.last_child_merged_at, "2026-11-04T00:00:00.000Z");
|
|
41
|
+
assert.deepEqual(s.defects_after_last_child.by_class, { "release-review": 0, "post-deploy": 1, hotfix: 1, other: 0 });
|
|
42
|
+
assert.deepEqual(s.rework.issues, [4]);
|
|
43
|
+
assert.deepEqual(s.interventions.hand_prs, [21]);
|
|
44
|
+
assert.deepEqual(s.interventions.needs_human_issues, [6]);
|
|
45
|
+
});
|
|
46
|
+
it("red and never-run journeys are not pass; missing data is null, not 0", () => {
|
|
47
|
+
assert.equal(scoreboard({ milestone: ms, issues: ISSUES, epics: [epicRow([acc("a".repeat(40), "2026-11-04T00:00:00Z", "fail")])] }).journey_status_at_ship, "fail");
|
|
48
|
+
const never = scoreboard({ milestone: ms, issues: ISSUES, epics: [epicRow([])] });
|
|
49
|
+
assert.equal(never.journey_status_at_ship, "never-ran");
|
|
50
|
+
assert.equal(never.minutes_first_merge_to_first_green, null);
|
|
51
|
+
const open = scoreboard({ milestone: ms, issues: [iss(2, { state: "open", closed_at: null })], epics: [] });
|
|
52
|
+
assert.equal(open.defects_after_last_child, null);
|
|
53
|
+
assert.equal(open.journey_status_at_ship, null);
|
|
54
|
+
assert.match(renderScoreboard(open), /n\/a/);
|
|
55
|
+
});
|
|
56
|
+
it("run logs add cost and needs-human runs", () => {
|
|
57
|
+
const s = scoreboard({ milestone: ms, issues: ISSUES, runs: [{ issue: 2, usd: 1.5, reason: "merged" }, { issue: 3, usd: 0.25, reason: "needs-human" }, { issue: 99, usd: 9 }] });
|
|
58
|
+
assert.equal(s.cost_usd, 1.75);
|
|
59
|
+
assert.equal(s.interventions.needs_human_runs, 1);
|
|
60
|
+
});
|
|
61
|
+
it("gate: refuses a regressed benchmark, a missing one and red journeys", () => {
|
|
62
|
+
assert.equal(scoreboardGate({ bench: { regression: null } }).ok, true);
|
|
63
|
+
assert.equal(scoreboardGate({ bench: null }).ok, false);
|
|
64
|
+
assert.equal(scoreboardGate({ bench: { regression: "x" } }).ok, false);
|
|
65
|
+
assert.equal(scoreboardGate({ bench: { regression: null }, board: { milestone: ms, journey_status_at_ship: "fail" } }).ok, false);
|
|
66
|
+
});
|
|
67
|
+
it("gatherScoreboard and stats --milestone read the board through gh alone", async () => {
|
|
68
|
+
const acceptanceComment = acc("b".repeat(40), "2026-11-05T00:00:00Z", "pass");
|
|
69
|
+
const gh = async (args) => {
|
|
70
|
+
const a = args.join(" ");
|
|
71
|
+
if (a.includes("/milestones")) return JSON.stringify(ms) + "\n";
|
|
72
|
+
if (a.includes("/pulls/")) return JSON.stringify(PRS[0]) + "\n";
|
|
73
|
+
if (a.includes("/issues?milestone=7&state=all")) return ISSUES.map((i) => JSON.stringify(i)).join("\n");
|
|
74
|
+
if (a.includes("labels=epic")) return JSON.stringify([{ number: 1, state: "open", body: "", user: { login: "bot", type: "Bot" }, author_association: "NONE" }]);
|
|
75
|
+
if (a.includes("/issues/1/comments")) return JSON.stringify({ ...acceptanceComment, user: { login: "bot", type: "Bot" }, author_association: "NONE" }) + "\n";
|
|
76
|
+
return "";
|
|
77
|
+
};
|
|
78
|
+
const s = await gatherScoreboard({ io: { gh }, repo: "o/r", ref: "Feature X" });
|
|
79
|
+
assert.equal(s.milestone.number, 7);
|
|
80
|
+
assert.equal(s.children, 6);
|
|
81
|
+
assert.equal((await gatherScoreboard({ io: { gh }, repo: "o/r", ref: "nope" })), null);
|
|
82
|
+
const report = await buildReport({ minN: 10, ...parseArgs(["--milestone", "7"]), repo: "o/r", local: false, cache: false }, { gh, releaseTimes: [], env: {} });
|
|
83
|
+
assert.equal(report.query.scoreboard.milestone.title, "Feature X");
|
|
84
|
+
assert.ok(report.query.mix, "the verdict mix stays");
|
|
85
|
+
assert.match(renderScoreboard(report.query.scoreboard), /Feature scoreboard: Feature X/);
|
|
86
|
+
});
|
|
87
|
+
});
|
package/bin/stats/stats.test.mjs
CHANGED
|
@@ -376,6 +376,68 @@ describe("cache", () => {
|
|
|
376
376
|
await fetchGithubRecords({ repo: "o/r", gh, useCache: false, env: ENV, rateCheck: true, now: () => 1_000_000_000, sleep: async (ms) => { slept.push(ms); } });
|
|
377
377
|
assert.ok(slept.length > 0 && slept[0] === 101000, `slept ${slept}`);
|
|
378
378
|
});
|
|
379
|
+
it("comments scan never requests past page 300 and completes when gh 422s beyond it (#5363)", async () => {
|
|
380
|
+
const comments = Array.from({ length: 30050 }, (_, i) => telemetryComment(1 + (i % 5), `e${i}`, "x", ts(1 + Math.floor(i / 100))));
|
|
381
|
+
const base = storeGh(mkItems(5), { comments });
|
|
382
|
+
const pages = [];
|
|
383
|
+
const gh = (args) => {
|
|
384
|
+
const m = /issues\/comments\?.*page=(\d+)/.exec(args.join(" "));
|
|
385
|
+
if (m) { pages.push(Number(m[1])); if (Number(m[1]) > 300) throw new Error("gh: HTTP 422: pagination is limited for this resource"); }
|
|
386
|
+
return base.gh(args);
|
|
387
|
+
};
|
|
388
|
+
const r = await fetchGithubRecords({ repo: "o/r", gh, useCache: false, env: ENV });
|
|
389
|
+
assert.ok(Math.max(...pages) <= 300 && pages.length > 300);
|
|
390
|
+
assert.equal(r.items.length, 5);
|
|
391
|
+
});
|
|
392
|
+
it("a 422 pagination error names a --since bound to retry with (#5363)", async () => {
|
|
393
|
+
const gh = (args) => { if (/issues\/comments\?/.test(args.join(" "))) throw new Error("HTTP 422: pagination is limited for this resource"); return "[]"; };
|
|
394
|
+
await assert.rejects(fetchGithubRecords({ repo: "o/r", gh, useCache: false, env: ENV, since: ts(1) }), /narrower --since/);
|
|
395
|
+
});
|
|
396
|
+
it("numbers mode crawls only the given issues: no listing, no comments scan, cache untouched (#5363)", async () => {
|
|
397
|
+
const env = { ...ENV, FORGE_STATS_CACHE_DIR: join(td, "cache-numbers") };
|
|
398
|
+
const comments = [telemetryComment(2, "e1", "x", ts(2)), telemetryComment(4, "e2", "x", ts(3))];
|
|
399
|
+
const h = storeGh(mkItems(50), { comments });
|
|
400
|
+
const events = [];
|
|
401
|
+
const r = await fetchGithubRecords({ repo: "o/r", gh: h.gh, env, numbers: [4, 2, 2], onProgress: (e) => events.push(e) });
|
|
402
|
+
assert.deepEqual(r.items.map((i) => i.number).sort((a, b) => a - b), [2, 4]);
|
|
403
|
+
assert.equal(r.records.length, 2);
|
|
404
|
+
assert.ok(h.calls.every((c) => /issues\/(2|4)(\/comments)?$/.test(c)), h.calls.join(","));
|
|
405
|
+
assert.ok(events.some((e) => e.phase === "telemetry" && e.total === 2));
|
|
406
|
+
assert.throws(() => readFileSync(join(cacheDir("o/r", env), "cache.json"), "utf8"));
|
|
407
|
+
});
|
|
408
|
+
it("--conformance-outcomes crawls only the joined PR and closing-issue numbers (#5363)", async () => {
|
|
409
|
+
const calls = [];
|
|
410
|
+
const gh = (args) => {
|
|
411
|
+
calls.push(args.join(" "));
|
|
412
|
+
if (/issues\/\d+\/comments/.test(args.join(" "))) return "[]";
|
|
413
|
+
const m = /issues\/(\d+)$/.exec(args.join(" "));
|
|
414
|
+
return m ? JSON.stringify({ number: Number(m[1]), state: "closed", labels: [], created_at: ts(1), updated_at: ts(2) }) : "[]";
|
|
415
|
+
};
|
|
416
|
+
const input = { prs: [{ number: 9, closingIssues: [{ number: 3 }] }, { number: 4, closingIssues: [] }] };
|
|
417
|
+
await buildReport({ repo: "o/r", conformanceOutcomes: true, local: false, cache: false, minN: 10, since: "2026-10-01" },
|
|
418
|
+
{ gh, env: ENV, releaseTimes: [], gatherConformanceOutcomes: async () => input, now: () => Date.UTC(2026, 10, 10), git: null });
|
|
419
|
+
const crawl = calls.filter((c) => /issues/.test(c));
|
|
420
|
+
assert.ok(crawl.length > 0 && crawl.every((c) => /issues\/(3|4|9)(\/comments)?$/.test(c)), crawl.join(","));
|
|
421
|
+
});
|
|
422
|
+
it("budget: AlterLab-scale conformance crawl costs two calls per joined issue, no comments scan or listing (#5363, R1 instrumentation)", async () => {
|
|
423
|
+
let n = 0;
|
|
424
|
+
const gh = (args) => {
|
|
425
|
+
const a = args.join(" "); n++;
|
|
426
|
+
if (/issues\/\d+\/comments/.test(a)) return "[]";
|
|
427
|
+
const m = /issues\/(\d+)$/.exec(a);
|
|
428
|
+
if (m) return JSON.stringify({ number: Number(m[1]), state: "closed", labels: [], created_at: ts(1), updated_at: ts(2) });
|
|
429
|
+
throw new Error(`unexpected call: ${a}`);
|
|
430
|
+
};
|
|
431
|
+
const prs = Array.from({ length: 400 }, (_, i) => ({ number: 5000 + i, closingIssues: [{ number: 100 + i }] }));
|
|
432
|
+
await buildReport({ repo: "o/r", conformanceOutcomes: true, local: false, cache: false, minN: 10, since: "2026-10-01" },
|
|
433
|
+
{ gh, env: ENV, releaseTimes: [], gatherConformanceOutcomes: async () => ({ prs }), now: () => Date.UTC(2026, 10, 10), git: null });
|
|
434
|
+
assert.ok(n <= 2 * 800, `calls ${n}`);
|
|
435
|
+
});
|
|
436
|
+
it("progress printer shows an ETA when one is known (#5363)", () => {
|
|
437
|
+
const out = [];
|
|
438
|
+
makeProgressPrinter((x) => out.push(x), () => 0)({ phase: "telemetry", done: 1, total: 4, etaMs: 3000 });
|
|
439
|
+
assert.match(out[0], /1\/4 \(eta 3s\)/);
|
|
440
|
+
});
|
|
379
441
|
it("never skips an item updated mid-crawl (keyset crawl, not page-number pagination)", async () => {
|
|
380
442
|
const env = { ...ENV, FORGE_STATS_CACHE_DIR: join(td, "cache-midcrawl") };
|
|
381
443
|
const ts = (n) => new Date(Date.UTC(2026, 9, 1) + n * 60000).toISOString().replace(/\.\d{3}Z$/, "Z");
|
|
@@ -536,6 +598,13 @@ describe("context-pack A/B over run logs (forge#4275)", () => {
|
|
|
536
598
|
{ event: "RUN_TERMINAL", reason, code: "x", context_pack: mode, lane_type: lt },
|
|
537
599
|
];
|
|
538
600
|
|
|
601
|
+
it("#5334 summariseLog counts an interrupted run's killed-attempt usage (turns, tokens, estimated cost)", () => {
|
|
602
|
+
const s = summariseLog([{ event: "RUN_START", issue: 3 },
|
|
603
|
+
{ event: "PHASE_ATTEMPT_USAGE", phase: "implement", turns: 41, usage: { output_tokens: 900, cache_read_input_tokens: 7e6 }, cost_usd: 1.5, cost_usd_delta: 1.5, cost_estimated: true, duration_ms: 60000 },
|
|
604
|
+
{ event: "RUN_TERMINAL", reason: "deferred", code: "run.interrupted", model_ms: 60000 }]);
|
|
605
|
+
assert.equal(s.costUsd, 1.5); assert.equal(s.builderTurns, 41); assert.equal(s.cacheReadTokens, 7e6); assert.equal(s.usageEvents, 1);
|
|
606
|
+
});
|
|
607
|
+
|
|
539
608
|
it("summariseLog carries mode, lane type, builder turns, cache tokens, cost and first-pass", () => {
|
|
540
609
|
const s = summariseLog(log("on", "child"));
|
|
541
610
|
assert.deepEqual(s.contextPack, { mode: "on", laneType: "child", ab: false, light: false });
|
|
@@ -973,3 +1042,14 @@ describe("env.tool_missing per release (forge#4414)", () => {
|
|
|
973
1042
|
assert.equal(after.groups[0].flow.codesN, 2);
|
|
974
1043
|
});
|
|
975
1044
|
});
|
|
1045
|
+
|
|
1046
|
+
describe("merged vs verified (#5339)", () => {
|
|
1047
|
+
const run = (n, extra) => ({ source: "local", repo: "o/r", version: "2.0.0", issue: n, run: `r${n}`, finished: true, hydrated: false, usageEvents: 1, reason: "merged", code: null, remediated: false, startTs: null, endTs: null, wallMs: 1, phases: {}, ...extra });
|
|
1048
|
+
it("a merged lane with a transferred requirement is merged but not verified; milestones are split; older runs count as verified", () => {
|
|
1049
|
+
const runs = [run(1, { milestone: "M1", verified: true }), run(2, { milestone: "M1", verified: false }), run(3, { milestone: "M2" }), run(4, { reason: "needs-human" })];
|
|
1050
|
+
const g = aggregate({ runs }, { releaseTimes: [] }).groups.find((x) => x.version === "2.0.0");
|
|
1051
|
+
assert.equal(g.flow.mergedPct, 0.75);
|
|
1052
|
+
assert.equal(g.flow.verifiedPct, 0.5);
|
|
1053
|
+
assert.deepEqual(g.flow.milestones, [{ milestone: "M1", merged: 2, verified: 1 }, { milestone: "M2", merged: 1, verified: 1 }]);
|
|
1054
|
+
});
|
|
1055
|
+
});
|
package/bin/tui.mjs
CHANGED
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
*/
|
|
15
15
|
|
|
16
16
|
import readline from "readline";
|
|
17
|
+
import { TAGLINE } from "./brand.mjs";
|
|
17
18
|
|
|
18
19
|
// ---------------------------------------------------------------------------
|
|
19
20
|
// ANSI detection — computed once at module load
|
|
@@ -1625,7 +1626,7 @@ function gradientText(text, start, end) {
|
|
|
1625
1626
|
* Default tagline — used when no context is given, or the given context has
|
|
1626
1627
|
* no mapped entry in LOGO_TAGLINES.
|
|
1627
1628
|
*/
|
|
1628
|
-
const DEFAULT_TAGLINE =
|
|
1629
|
+
const DEFAULT_TAGLINE = TAGLINE;
|
|
1629
1630
|
|
|
1630
1631
|
/**
|
|
1631
1632
|
* Context-specific taglines shown under the logo. Keyed by the invoking
|
|
@@ -1634,7 +1635,7 @@ const DEFAULT_TAGLINE = "GitHub as a knowledge graph for AI agents";
|
|
|
1634
1635
|
* caller.
|
|
1635
1636
|
*/
|
|
1636
1637
|
const LOGO_TAGLINES = {
|
|
1637
|
-
install:
|
|
1638
|
+
install: TAGLINE,
|
|
1638
1639
|
update: "tempering the blade",
|
|
1639
1640
|
uninstall: "banking the coals",
|
|
1640
1641
|
doctor: "inspecting the anvil",
|
package/commands/bootstrap.md
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
---
|
|
2
|
-
description: Guided idea-to-backlog setup for a
|
|
2
|
+
description: Guided idea-to-backlog setup for a new project: interview, defaults, doubts, spike doc, validated orchestrate-ready backlog
|
|
3
3
|
argument-hint: "<free text | path to docs> [--dry-run] [--spike <path>]"
|
|
4
4
|
---
|
|
5
5
|
<!-- SPDX-FileCopyrightText: Copyright (c) RapierCraft Studios -->
|
|
@@ -9,7 +9,7 @@ argument-hint: "<free text | path to docs> [--dry-run] [--spike <path>]"
|
|
|
9
9
|
|
|
10
10
|
**Input**: $ARGUMENTS
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
Judgment only; writes run in `scripts/bootstrap-create.mjs`.
|
|
13
13
|
|
|
14
14
|
```bash
|
|
15
15
|
type forge_resolve >/dev/null 2>&1 || { setopt nonomatch 2>/dev/null || true; FORGE_SOURCED_ROOT='${CLAUDE_PLUGIN_ROOT}'; for _r in "$(cygpath -u "${FORGEDOCK_HOME:-}" 2>/dev/null || printf %s "${FORGEDOCK_HOME:-}")" '${CLAUDE_PLUGIN_ROOT}' "${FORGE_ROOT:-}" "${FORGE_HOME:-}" "$(readlink -f "$HOME/.claude/commands/work-on.md" 2>/dev/null | sed 's|/commands/work-on\.md$||')" "$(head -n 1 "${CODEX_HOME:-$HOME/.codex}/forge-home" 2>/dev/null)" "$HOME/.claude/plugins/marketplaces/forgedock" "${CLAUDE_CONFIG_DIR:-$HOME/.claude}"/plugins/cache/forgedock/forgedock/* "$HOME/.claude"/plugins/cache/forgedock/forgedock/*; do case "$_r" in /*) [ -f "$_r/scripts/lib/forge-resolve.sh" ] && { . "$_r/scripts/lib/forge-resolve.sh"; break; };; esac; done; type forge_resolve >/dev/null 2>&1 || forge_resolve() { :; }; }
|
|
@@ -19,19 +19,20 @@ BOOT_TPL="$(forge_root)/templates/bootstrap"; VALIDATE=$(forge_resolve bootstrap
|
|
|
19
19
|
|
|
20
20
|
1. **Read the input.** Use the free text, or read each doc at the given path(s).
|
|
21
21
|
2. **Interview** from `interview.md`. Cover each aspect briefly; skip what the input answers.
|
|
22
|
-
3. **Fill the blanks.** Default every unanswered aspect with a one-line rationale
|
|
23
|
-
4. **Ask only genuine doubts** (architecture or cost: native vs PWA, data residency, self-host vs managed DB,
|
|
24
|
-
5. **Spike doc.** Write `technical-spike.md` to `--spike` (default `docs/engineering/technical-spike.md`); set the plan's `spikeDoc` to that path. Fill every section
|
|
22
|
+
3. **Fill the blanks.** Default every unanswered aspect with a one-line rationale from the closest `stack-profiles.md` preset. Show them in ONE editable "Here's what I assumed" list; apply edits.
|
|
23
|
+
4. **Ask only genuine doubts** (architecture or cost: native vs PWA, data residency, self-host vs managed DB, repo owner). Use AskUserQuestion: at most 4 multiple-choice questions per batch, each with a recommended option. Everything else stays a default. Headless (no AskUserQuestion, e.g. `npx forgedock bootstrap`): take each recommended option, list it under "Here's what I assumed".
|
|
24
|
+
5. **Spike doc.** Write `technical-spike.md` to `--spike` (default `docs/engineering/technical-spike.md`); set the plan's `spikeDoc` to that path. Fill every section; each decision gets a `**Rationale**:` line.
|
|
25
25
|
6. **Plan JSON** in `$TMPDIR` (shape: header of `bootstrap-validate.mjs` and `bootstrap-create.mjs`):
|
|
26
26
|
- Milestones as dependency layers, foundation first: each depends only on earlier ones (#4659).
|
|
27
|
-
-
|
|
28
|
-
- A
|
|
29
|
-
-
|
|
27
|
+
- Milestone 1 has one `"skeleton": true` issue owning scaffold (CI, test harness, dependency bootstrap, first runnable build) and one #5336 journey; others depend on it.
|
|
28
|
+
- A thin deployable slice (CI deploy, staging, seed) in milestone 1 or 2, never last.
|
|
29
|
+
- A `SPIKE` parent (epic) with a `forge-acceptance` journey (`acceptance check`).
|
|
30
|
+
- Sub-issues from `issue-body.md`: planned paths, `[type:*]` tags, `priority`, `component`.
|
|
30
31
|
- `"ui": true` issues carry the full design spec. `"hero": true` issues route to `/design`.
|
|
31
|
-
- One `needs-human-issue.md` issue per credential, account or external input, with `gates:` (#4660). Code issues
|
|
32
|
+
- One `needs-human-issue.md` issue per credential, account or external input, with `gates:` (#4660). Code issues cite it as `#{{KEY}}`, never depend on it, and name the mock keeping dev and CI green.
|
|
32
33
|
- Sub-issues point at the spike via `**Parent**` only, never `Depends on`.
|
|
33
|
-
- `guardrails
|
|
34
|
-
7. **Validate.** Run `node "$VALIDATE" <plan
|
|
35
|
-
8. **Create.** Run `node "$CREATE" <plan>`, adding `--dry-run` when the input has it (preview only, GitHub untouched). It reuses existing issues
|
|
36
|
-
9. **Hand off.** Print the script's hand-off verbatim: created
|
|
37
|
-
10. Later: `npx forgedock plan validate --live
|
|
34
|
+
- `guardrails`, `domainRules` from the interview.
|
|
35
|
+
7. **Validate.** Run `node "$VALIDATE" <plan>`; fix until it exits 0; heed `deploy-last`. Never create from an invalid plan.
|
|
36
|
+
8. **Create.** Run `node "$CREATE" <plan>`, adding `--dry-run` when the input has it (preview only, GitHub untouched). It reuses existing issues: re-run to resume.
|
|
37
|
+
9. **Hand off.** Print the script's hand-off verbatim: created, needs a human, and the `/orchestrate` command per milestone, in order.
|
|
38
|
+
10. Later: `npx forgedock plan validate --live`.
|
package/commands/deploy-pr.md
CHANGED
|
@@ -371,12 +371,23 @@ else
|
|
|
371
371
|
# old query errored and defaulted to 0 = "no failures"). An unreadable result counts as failing.
|
|
372
372
|
# forgedock/verify (the lean engine's report-only gate summary) is not a code failure: ignored, as wait-ci-green.sh does.
|
|
373
373
|
# forge/deploy-gate and "Check for FORGE gate markers" (the staging review's marker status and its workflow job) are not fixable by /fix-ci: ignored here, still waited on in Phase 5.
|
|
374
|
+
# A still-running check is not passed (#5277): the reads below count fail, cancel and pending. When nothing has failed yet and
|
|
375
|
+
# checks are only unfinished, this phase reports PENDING and leaves the wait to Phase 5 (wait-ci-green.sh); never PASSED.
|
|
376
|
+
CI_PENDING=false
|
|
377
|
+
ci_only_pending() {
|
|
378
|
+
gh pr checks "$PR_NUMBER" $GH_FLAG --json name,bucket \
|
|
379
|
+
--jq '[.[] | select(.name != "forgedock/verify" and .name != "forge/deploy-gate" and .name != "Check for FORGE gate markers") | select(.bucket == "fail" or .bucket == "cancel")] | length' 2>/dev/null | grep -qx 0
|
|
380
|
+
}
|
|
374
381
|
CURRENT_CI_STATUS=$(gh pr checks "$PR_NUMBER" $GH_FLAG --json name,bucket \
|
|
375
|
-
--jq '[.[] | select(.name != "forgedock/verify" and .name != "forge/deploy-gate" and .name != "Check for FORGE gate markers") | select(.bucket == "fail" or .bucket == "cancel")] | length' 2>/dev/null || echo "1")
|
|
382
|
+
--jq '[.[] | select(.name != "forgedock/verify" and .name != "forge/deploy-gate" and .name != "Check for FORGE gate markers") | select(.bucket == "fail" or .bucket == "cancel" or .bucket == "pending")] | length' 2>/dev/null || echo "1")
|
|
376
383
|
|
|
377
384
|
if [ "$CURRENT_CI_STATUS" -eq 0 ]; then
|
|
378
385
|
echo "CI gate: PASSED (no failing checks)"
|
|
379
386
|
CI_GATE_PASSED=true
|
|
387
|
+
elif ci_only_pending; then
|
|
388
|
+
echo "CI gate: PENDING ($CURRENT_CI_STATUS check(s) unfinished, none failed) — deferred to Phase 5 (wait-ci-green.sh)"
|
|
389
|
+
CI_PENDING=true
|
|
390
|
+
CI_GATE_PASSED=true
|
|
380
391
|
else
|
|
381
392
|
echo "CI has $CURRENT_CI_STATUS failing checks — invoking /fix-ci (max $MAX_CI_ITER iterations)"
|
|
382
393
|
|
|
@@ -394,11 +405,15 @@ else
|
|
|
394
405
|
|
|
395
406
|
# Re-check CI status after fix attempt (same fail-closed query as above)
|
|
396
407
|
FAILING_AFTER=$(gh pr checks "$PR_NUMBER" $GH_FLAG --json name,bucket \
|
|
397
|
-
--jq '[.[] | select(.name != "forgedock/verify" and .name != "forge/deploy-gate" and .name != "Check for FORGE gate markers") | select(.bucket == "fail" or .bucket == "cancel")] | length' 2>/dev/null || echo "1")
|
|
408
|
+
--jq '[.[] | select(.name != "forgedock/verify" and .name != "forge/deploy-gate" and .name != "Check for FORGE gate markers") | select(.bucket == "fail" or .bucket == "cancel" or .bucket == "pending")] | length' 2>/dev/null || echo "1")
|
|
398
409
|
|
|
399
410
|
if [ "$FAILING_AFTER" -eq 0 ]; then
|
|
400
411
|
echo "CI gate: PASSED after $CI_ITER iteration(s)"
|
|
401
412
|
CI_GATE_PASSED=true
|
|
413
|
+
elif ci_only_pending; then
|
|
414
|
+
echo "CI gate: PENDING after $CI_ITER iteration(s) ($FAILING_AFTER check(s) unfinished, none failed) — deferred to Phase 5 (wait-ci-green.sh)"
|
|
415
|
+
CI_PENDING=true
|
|
416
|
+
CI_GATE_PASSED=true
|
|
402
417
|
else
|
|
403
418
|
echo "CI still has $FAILING_AFTER failing checks after iteration $CI_ITER"
|
|
404
419
|
fi
|
|
@@ -414,7 +429,7 @@ fi
|
|
|
414
429
|
|
|
415
430
|
# Emit gate state marker for auditability <!-- Ref: issue #1582 — gate passes must be auditable -->
|
|
416
431
|
if [ "$DRY_RUN" = "false" ] && [ -n "$PR_NUMBER" ] && [ "$PR_NUMBER" != "DRY_RUN" ]; then
|
|
417
|
-
gh pr comment "$PR_NUMBER" $GH_FLAG --body "<!-- FORGE:GATE_PASS phase=ci iterations=${CI_ITER} fixes=${CI_FIXES} -->" 2>/dev/null || true
|
|
432
|
+
gh pr comment "$PR_NUMBER" $GH_FLAG --body "<!-- FORGE:GATE_PASS phase=ci iterations=${CI_ITER} fixes=${CI_FIXES} pending=${CI_PENDING:-false} -->" 2>/dev/null || true
|
|
418
433
|
fi
|
|
419
434
|
```
|
|
420
435
|
|
package/commands/forge-stats.md
CHANGED
|
@@ -11,7 +11,7 @@ install: internal
|
|
|
11
11
|
|
|
12
12
|
**Input**: $ARGUMENTS (default: `diff`; modes: `diff`, `baseline`, `full`, `cost`)
|
|
13
13
|
|
|
14
|
-
Tracks the size of every Forge command file over time. Detects bloat by comparing current sizes against the git-tracked baseline and per-command thresholds.
|
|
14
|
+
Run-level reports (cost, flow, issue origin via `forgedock stats --origin`) live in the CLI: see docs/STATS.md. Tracks the size of every Forge command file over time. Detects bloat by comparing current sizes against the git-tracked baseline and per-command thresholds.
|
|
15
15
|
|
|
16
16
|
## Config
|
|
17
17
|
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Conversational setup of the Actions-minutes budget and ci.mode (remote / local-first / local-attested / auto) in forge.yaml
|
|
3
|
+
argument-hint: "<plain-language request, e.g. keep me under 2,000 minutes, run tests locally first>"
|
|
4
|
+
install: extras
|
|
5
|
+
---
|
|
6
|
+
<!-- SPDX-FileCopyrightText: Copyright (c) RapierCraft Studios -->
|
|
7
|
+
<!-- SPDX-License-Identifier: AGPL-3.0-or-later -->
|
|
8
|
+
|
|
9
|
+
# /forgedock-ci-setup — Actions budget and CI placement
|
|
10
|
+
|
|
11
|
+
**Input**: $ARGUMENTS
|
|
12
|
+
|
|
13
|
+
Turn a plain-language request about GitHub Actions minutes into a valid `ci` block in `forge.yaml`. Deterministic facts come from `forgedock ci budget`; you only map the request to keys and confirm.
|
|
14
|
+
|
|
15
|
+
## Steps
|
|
16
|
+
|
|
17
|
+
1. Read plan and usage: `forgedock ci budget --json`. It gives `plan`, `includedMinutes`, `monthToDate` (across the account), `projected`, `public`, `mode`. A public repo is free hosted minutes: say so and recommend `auto` (it never switches there).
|
|
18
|
+
2. Map the request to keys (flat, under `ci:`):
|
|
19
|
+
- "keep me under N minutes" -> `monthly_minutes: N`; "leave headroom" -> `reserve_pct` (0-90, default 10).
|
|
20
|
+
- "run tests locally first" -> `mode: local-first` (host checks must pass before anything is pushed that triggers paid CI).
|
|
21
|
+
- "post the local result as a status" -> `mode: local-attested`. Tell the user the trade-off: the status is attested by ForgeDock, not run by Actions, the same trust as a self-hosted runner.
|
|
22
|
+
- "just handle it" / no preference -> `mode: auto` (remote while the projection stays under budget, then local-first with a warning).
|
|
23
|
+
- "keep current behaviour" -> `mode: remote`.
|
|
24
|
+
3. Show the projection per mode: `remote` spends about `projected` minutes; `local-first` and `local-attested` spend paid CI only on release or nightly runs. State the budget and reserve you will write.
|
|
25
|
+
4. Ask the user to confirm. Only then write it: `forgedock ci budget --set-mode <mode> --budget <N> [--reserve <P>] [--plan <free|pro|team|enterprise>]`. This keeps any `milestone_integration` keys in the `ci:` block.
|
|
26
|
+
5. Re-run `forgedock ci budget` and print the resulting mode. To see which local commands match the repo's workflows (same tool pins): `forgedock ci budget --propose --base origin/<base>`.
|
|
27
|
+
|
|
28
|
+
Never write a key the user did not ask for, and never guess a plan: if `plan` is `unknown`, ask for the included minutes (`--budget`).
|
|
@@ -579,10 +579,9 @@ For each optional section that is ALREADY ACTIVE in forge.yaml (detected in Phas
|
|
|
579
579
|
|
|
580
580
|
### 5D: Write the file
|
|
581
581
|
|
|
582
|
-
|
|
582
|
+
Record the existing file in the config history (never a `forge.yaml.bak*` file in the repo; #5315):
|
|
583
583
|
```bash
|
|
584
|
-
|
|
585
|
-
echo "Backed up: forge.yaml → forge.yaml.bak"
|
|
584
|
+
npx forgedock config record "init edit"
|
|
586
585
|
```
|
|
587
586
|
|
|
588
587
|
Write the complete new file: required sections (preserved verbatim) + active optional sections (newly generated) + inactive optional sections (left as commented-out blocks matching forge.yaml.example structure).
|
|
@@ -676,7 +675,7 @@ EOF
|
|
|
676
675
|
|
|
677
676
|
Component options come from the Phase 5E domain-label list (fallback `core`), so board components and domain labels line up.
|
|
678
677
|
|
|
679
|
-
**Write the IDs.** Re-run the Phase 3C field/option queries against `PROJECT_NUMBER`, then write the `project_board` section (Phase 5B schema) into `forge.yaml`, replacing any previous `project_board` block, and keep
|
|
678
|
+
**Write the IDs.** Re-run the Phase 3C field/option queries against `PROJECT_NUMBER`, then write the `project_board` section (Phase 5B schema) into `forge.yaml`, replacing any previous `project_board` block, and keep the config-history version recorded in 5D. If any `gh project` call fails with a missing-scope error, print `gh auth refresh -h github.com -s read:project,project` and stop this step.
|
|
680
679
|
|
|
681
680
|
---
|
|
682
681
|
|
|
@@ -751,7 +750,7 @@ Next steps:
|
|
|
751
750
|
2. Test the pipeline:
|
|
752
751
|
/work-on next
|
|
753
752
|
3. If any WARNING appeared above, edit forge.yaml to fix the flagged values.
|
|
754
|
-
4.
|
|
753
|
+
4. Previous version: npx forgedock config history (restore with: npx forgedock config rollback <n>)
|
|
755
754
|
{If BOUNDARY_ALLOW_ALL (2G): "5. Your boundary config allows every package to import every package ({BOUNDARY_ALLOW_ALL_AT}). Consider tightening it per package once its design settles: core work-on reports import growth but only blocks undeclared package.json edges."}
|
|
756
755
|
|
|
757
756
|
ForgeDock commands now use your project's config from forge.yaml.
|
package/commands/issue.md
CHANGED
|
@@ -153,6 +153,8 @@ ISSUE_CREATE_SCRIPT=$(forge_resolve issue-create.sh)
|
|
|
153
153
|
bash "$ISSUE_CREATE_SCRIPT" --title "{TITLE}" --body-file "$BODY_FILE" --label "{PRIORITY_LABEL}" --label "{CATEGORY_LABEL}" {--milestone "M"} {--repo OWNER/NAME} {--dry-run}
|
|
154
154
|
```
|
|
155
155
|
|
|
156
|
+
**Epic gate (forge#5336)**: when a label is `epic`, first run `npx forgedock acceptance check --body-file "$BODY_FILE"`; a non-zero exit refuses the creation (the body needs a ```` ```forge-acceptance ```` block with at least one journey).
|
|
157
|
+
|
|
156
158
|
Report `**#{N}**: {title}`, URL, labels, milestone, and "Run `/work-on {N}` to start the pipeline."
|
|
157
159
|
|
|
158
160
|
**Batch**: draft every issue, create each in order (no confirmation prompt), and report a table `| # | Issue | Priority | Category | Deps |`. With `--dry-run`, print the draft table plus each body and create nothing.
|
package/commands/milestone.md
CHANGED
|
@@ -207,6 +207,8 @@ Present the proposed issues to the user. Ask:
|
|
|
207
207
|
|
|
208
208
|
### Step 6: Create issues and assign to milestone
|
|
209
209
|
|
|
210
|
+
**Epic acceptance (forge#5336, hard gate)**: an issue labelled `epic` (including a planned tracker) is created only with a ```` ```forge-acceptance ```` block of at least one user journey in its body (format: `bin/lean/acceptance.mjs`). Check the body first with `npx forgedock acceptance check --body-file "$BODY_FILE"`; a non-zero exit refuses the creation.
|
|
211
|
+
|
|
210
212
|
**Issue body standard**: Use the **Pipeline Issue Template** from `issue.md` Phase 3D as the body structure for every issue created here (it is the single canonical standard; no bespoke inline template). The body content (Problem, Root Cause, Affected Files, Acceptance Criteria, Context, Dependencies) comes from the per-issue investigation in Step 4B. <!-- Added: forge#293 --> In greenfield mode it comes from the Step 4G plan instead, and Affected Files are planned paths inside the spike's `Repo layout`. <!-- Added: forge#4175 -->
|
|
211
213
|
|
|
212
214
|
**Route creation through `/issue`'s programmatic invocation contract** (`commands/issue.md`, added #2085) instead of calling `gh issue create` directly — this gets dedup (Phase 2D) and mandatory-section body validation (Phase 3F) for free. <!-- Changed: forge#2086 — route through /issue create-hook -->
|
|
@@ -360,6 +362,8 @@ fi
|
|
|
360
362
|
|
|
361
363
|
### Step 6C: Re-validate dependency order
|
|
362
364
|
|
|
365
|
+
A milestone/feature epic's first wave has one `skeleton`-labelled issue (builds, boots, one journey passes); every other issue depends on it. Run `npx forgedock plan validate --live` to check.
|
|
366
|
+
|
|
363
367
|
After a milestone is added, the train order changes or an issue is decomposed, run `npx forgedock plan validate --live` (#4659). Fix every `invalid` edge (a dependency in a later milestone) before continuing; `held` edges are reported only.
|
|
364
368
|
|
|
365
369
|
### Step 7: Report
|
|
@@ -442,6 +446,10 @@ bash "$(forge_resolve milestone-drift.sh)" "{slug}" --format text
|
|
|
442
446
|
|
|
443
447
|
### Step 1: Pre-flight check
|
|
444
448
|
|
|
449
|
+
**Re-plan (forge#5342)**: a lane or journey run that finds the design wrong ends with a `design-invalidated` block; the engine files one spike-amendment issue and holds the affected open siblings behind it. After it merges, run `npx forgedock replan apply --amendment N --repo {REPO}` to mark each open child unchanged, re-scoped or dropped and update the epic checklist. A re-scoped user-visible child is routed to `/design` before build (forge#5330 owns the generic visual gate).
|
|
450
|
+
|
|
451
|
+
**Feature acceptance (forge#5336, hard gate)**: `npx forgedock acceptance gate --milestone "{TITLE}" --stage ship`. A non-zero exit (a journey is red or never ran on the branch head) blocks the ship; print its lines and stop. A milestone without an epic is not gated.
|
|
452
|
+
|
|
445
453
|
```bash
|
|
446
454
|
# Check milestone branch exists
|
|
447
455
|
git fetch origin milestone/{slug}
|
|
@@ -784,7 +792,7 @@ Protected branches get ONE sync PR (`sync/milestone-{slug}`) whose head is force
|
|
|
784
792
|
|
|
785
793
|
## Action: Close Milestone (without shipping)
|
|
786
794
|
|
|
787
|
-
For milestones that are abandoned or superseded:
|
|
795
|
+
For milestones that are abandoned or superseded: shipped milestones close only after `npx forgedock acceptance gate --milestone "{TITLE}" --stage close` exits 0 (post-deploy journeys passed; the epic keeps `awaiting-measurement` until then). Abandoning an unshipped milestone is not gated.
|
|
788
796
|
|
|
789
797
|
```bash
|
|
790
798
|
gh api repos/{owner}/{repo}/milestones/{MILESTONE_NUMBER} --method PATCH --field state="closed"
|
package/commands/replay.md
CHANGED
|
@@ -10,6 +10,8 @@ install: extras
|
|
|
10
10
|
|
|
11
11
|
Replay a completed pipeline run. Fetches all FORGE annotations posted during the pipeline and displays them chronologically — phase headings, timestamps, and key structured fields. Read-only: nothing is written, no labels changed.
|
|
12
12
|
|
|
13
|
+
For a time-lapse of a whole batch or epic, run `forgedock replay --timelapse <batch|epic>` (see docs/REPLAY.md).
|
|
14
|
+
|
|
13
15
|
**Agent model policy**: `model: "{DEFAULT_MODEL}"` — resolved from forge.yaml `agents.default_model`, else "sonnet" (standard tier). Fallback: `model: "opus"` if rate-limited. Feature gate: pass `effort` in Task/Skill spawns only on Claude Code >= 2.1.154.
|
|
14
16
|
|
|
15
17
|
---
|