@izkac/forgekit 0.3.12 → 0.3.14

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 (120) hide show
  1. package/bin/forge.mjs +119 -107
  2. package/bin/forgekit.mjs +83 -83
  3. package/bin/review.mjs +81 -81
  4. package/package.json +2 -1
  5. package/scripts/prepack.mjs +78 -78
  6. package/scripts/run-tests.mjs +50 -50
  7. package/src/adr.mjs +236 -236
  8. package/src/adr.test.mjs +170 -170
  9. package/src/change.mjs +327 -234
  10. package/src/change.test.mjs +145 -83
  11. package/src/cleanup-sessions.mjs +84 -84
  12. package/src/config.mjs +103 -103
  13. package/src/defer.mjs +75 -75
  14. package/src/doctor.mjs +350 -341
  15. package/src/doctor.test.mjs +114 -114
  16. package/src/fleet.test.mjs +50 -0
  17. package/src/init.mjs +680 -621
  18. package/src/install.mjs +815 -815
  19. package/src/install.test.mjs +180 -180
  20. package/src/integrity-check.mjs +60 -60
  21. package/src/integrity.mjs +688 -682
  22. package/src/integrity.test.mjs +612 -566
  23. package/src/lib/fleet.mjs +61 -4
  24. package/src/lib.mjs +160 -143
  25. package/src/lib.test.mjs +128 -0
  26. package/src/models.defaults.json +41 -41
  27. package/src/new-session.mjs +99 -99
  28. package/src/openspec-overlays/README.md +19 -19
  29. package/src/openspec-overlays/openspec-apply-change-footer.md +14 -14
  30. package/src/openspec-overlays/opsx-apply-completion-step.md +1 -1
  31. package/src/openspec-overlays/opsx-apply-implement-step.md +11 -11
  32. package/src/paths.mjs +92 -92
  33. package/src/plan-engine.mjs +321 -278
  34. package/src/plan-engine.test.mjs +447 -283
  35. package/src/preferences.defaults.json +78 -78
  36. package/src/preferences.mjs +438 -438
  37. package/src/preferences.test.mjs +174 -174
  38. package/src/record-evidence.mjs +204 -204
  39. package/src/repo-root.mjs +33 -0
  40. package/src/resolve-model.mjs +312 -312
  41. package/src/resolve-model.test.mjs +194 -194
  42. package/src/review/cli.test.mjs +117 -117
  43. package/src/review/export.mjs +172 -172
  44. package/src/review/export.test.mjs +197 -197
  45. package/src/review/fixtures/valid-review.json +42 -42
  46. package/src/review/lib.mjs +894 -894
  47. package/src/review/lib.test.mjs +266 -266
  48. package/src/review/schema.json +196 -196
  49. package/src/review/signals.test.mjs +62 -62
  50. package/src/score-cli.mjs +68 -68
  51. package/src/score.mjs +568 -568
  52. package/src/score.test.mjs +366 -366
  53. package/src/session-reminder.mjs +207 -207
  54. package/src/session-status.mjs +70 -70
  55. package/src/set-models.mjs +186 -186
  56. package/src/set-phase.mjs +205 -205
  57. package/src/set-prefs.mjs +294 -294
  58. package/src/specs-sync.mjs +232 -0
  59. package/src/specs-sync.test.mjs +114 -0
  60. package/src/spine.mjs +93 -93
  61. package/src/triage-prompt.mjs +175 -175
  62. package/src/triage-prompt.test.mjs +50 -50
  63. package/src/vendor-openspec-overlays.mjs +176 -176
  64. package/src/vendor-openspec-overlays.test.mjs +62 -62
  65. package/vendor/skills/archive-to-adr/SKILL.md +149 -149
  66. package/vendor/skills/forge/SKILL.md +136 -136
  67. package/vendor/skills/forge/docs/forge.md +650 -647
  68. package/vendor/skills/forge/phases/brainstorm.md +23 -23
  69. package/vendor/skills/forge/phases/finish.md +90 -87
  70. package/vendor/skills/forge/phases/implement.md +77 -77
  71. package/vendor/skills/forge/phases/plan-openspec.md +60 -60
  72. package/vendor/skills/forge/phases/plan-specs.md +163 -117
  73. package/vendor/skills/forge/phases/review.md +25 -25
  74. package/vendor/skills/forge/phases/verify.md +124 -124
  75. package/vendor/skills/forge/references/forge-layout.md +85 -85
  76. package/vendor/skills/forge/references/pace.md +115 -115
  77. package/vendor/skills/forge/references/plan-routing.md +52 -51
  78. package/vendor/skills/forge/references/runtime-integrity.md +232 -232
  79. package/vendor/skills/forge/references/substantial-work.md +37 -37
  80. package/vendor/skills/forge/references/test-evidence.md +30 -30
  81. package/vendor/skills/forge/references/test-strategy.md +68 -68
  82. package/vendor/skills/forge/skills/subagent-driven-development/SKILL.md +87 -87
  83. package/vendor/skills/forge/subagents/final-reviewer-prompt.md +56 -56
  84. package/vendor/skills/forge/subagents/implementer-prompt.md +38 -38
  85. package/vendor/skills/git-resolve-adr-conflict/SKILL.md +132 -132
  86. package/vendor/skills/thorough-code-review/SKILL.md +290 -290
  87. package/vendor/skills/thorough-code-review/examples.md +133 -133
  88. package/vendor/skills/thorough-code-review/reference/accepted-risks.md +26 -26
  89. package/vendor/skills/thorough-code-review/reference/lenses.md +96 -96
  90. package/vendor/skills/thorough-code-review/reference/phase1-scout.md +62 -62
  91. package/vendor/skills/thorough-code-review/reference/phase2-skeptic.md +105 -105
  92. package/vendor/skills/thorough-code-review/reference/report-schema.json +222 -222
  93. package/vendor/skills/thorough-code-review/reference/report-template.md +115 -115
  94. package/vendor/skills/thorough-code-review/reference/severity-rubric.md +49 -49
  95. package/vendor/skills/thorough-code-review/reference/signals-preflight.md +55 -55
  96. package/vendor/templates/adr/README.md +7 -7
  97. package/vendor/templates/adr/decisions.md +141 -141
  98. package/vendor/templates/adr/hooks/check-pending-adrs.mjs +74 -74
  99. package/vendor/templates/adr/hooks/check-pending-adrs.sh +3 -3
  100. package/vendor/templates/adr/hooks/openspec-archive-agent-message.mjs +52 -52
  101. package/vendor/templates/adr/hooks/openspec-archive-agent-message.sh +3 -3
  102. package/vendor/templates/project/claude/commands/forge-apply.md +75 -75
  103. package/vendor/templates/project/claude/commands/forge-brainstorm.md +7 -7
  104. package/vendor/templates/project/claude/commands/forge-build.md +17 -17
  105. package/vendor/templates/project/claude/commands/forge-plan.md +12 -12
  106. package/vendor/templates/project/claude/commands/forge-skip.md +14 -14
  107. package/vendor/templates/project/claude/commands/forge-status.md +16 -16
  108. package/vendor/templates/project/claude/commands/forge.md +16 -16
  109. package/vendor/templates/project/claude/hooks/forge-prompt-hook.mjs +73 -73
  110. package/vendor/templates/project/claude/hooks/forge-session-start.mjs +19 -19
  111. package/vendor/templates/project/claude/hooks/forge-triage-hook.mjs +77 -77
  112. package/vendor/templates/project/cursor/commands/forge-apply.md +75 -75
  113. package/vendor/templates/project/cursor/commands/forge-brainstorm.md +10 -10
  114. package/vendor/templates/project/cursor/commands/forge-build.md +17 -17
  115. package/vendor/templates/project/cursor/commands/forge-plan.md +15 -15
  116. package/vendor/templates/project/cursor/commands/forge-skip.md +14 -14
  117. package/vendor/templates/project/cursor/commands/forge-status.md +16 -16
  118. package/vendor/templates/project/cursor/commands/forge.md +16 -16
  119. package/vendor/templates/project/cursor/hooks/forge-session-start.mjs +30 -30
  120. package/vendor/templates/project/cursor/hooks/forge-session-start.sh +3 -3
@@ -1,105 +1,105 @@
1
- # Phase 2 — Skeptic pass
2
-
3
- You are an **adversarial skeptic**. Your job is to **disprove** the scout's claim unless evidence confirms it.
4
-
5
- **You receive only this packet — no chat history.** It may contain **one finding** (critical, or an important finding alone in its file) or a **batch of findings sharing a file or module** (important: ≤4, minor: ≤6) — steelman and verdict each finding independently; never let one verdict color another.
6
-
7
- ## Finding(s) under review
8
-
9
- One block per finding:
10
-
11
- ```
12
- id: {FINDING_ID}
13
- lens: {LENS}
14
- location: {LOCATION}
15
- claim: {CLAIM}
16
- evidence: {EVIDENCE}
17
- context: {CONTEXT_EXCERPT} # ±30 lines around the cited location, from the scout
18
- related: {RELATED} # callers, test files, ADR paths
19
- tentative_severity: {SEVERITY}
20
- confidence: {CONFIDENCE}
21
- ```
22
-
23
- Start from `context` and `related` — most verdicts need only 1–2 additional reads. Read more files only when the disproof checklist genuinely requires it.
24
-
25
- ## Scope context
26
-
27
- - **Scope:** {SCOPE_DESCRIPTION}
28
- - **Mode:** {MODE} <!-- `initial` or `reverify` -->
29
- - **Accepted risks:** {ACCEPTED_RISKS_DIGEST} <!-- contents of reference/accepted-risks.md -->
30
-
31
- Check the digest **before** reading `docs/adr/` — if it covers the claim and no re-open trigger fired, the verdict is `false_positive` (cite the ADR id). Read full ADRs only when the digest is silent.
32
-
33
- ## Steelman rule
34
-
35
- First, restate the **strongest** version of the claim — the worst reasonable interpretation an attacker or failure mode could exploit.
36
-
37
- ## Disproof checklist
38
-
39
- Attempt each before concluding:
40
-
41
- 1. **Call chain** — trace callers and callees; does the dangerous path actually execute?
42
- 2. **Data flow** — is input attacker-controlled at the sink?
43
- 3. **Tests** — read (or run if feasible) tests covering this path
44
- 4. **Framework mitigations** — middleware, ORM parameterization, framework defaults
45
- 5. **Deployment boundary** — internal-only API, LAN trust model, ADR-accepted risk
46
- 6. **Project docs** — `docs/adr/`, `AGENTS.md`, prior security reviews
47
- 7. **Intent** — comment, type guard, or early return that negates the claim
48
-
49
- ## Verdict (initial review)
50
-
51
- | Verdict | When |
52
- | ------- | ---- |
53
- | `confirmed` | Issue is real at stated or higher severity |
54
- | `false_positive` | Claim does not hold after investigation |
55
- | `downgraded` | Real issue but lower severity — set `severity` and `original_severity` |
56
- | `needs_decision` | Architectural/policy choice; not a clear defect |
57
-
58
- **Requirements:**
59
-
60
- - `verdict_reason` must cite specific evidence (file:line, test name, ADR id).
61
- - "Looks fine" without evidence is invalid.
62
- - Upgrade severity only with **new** evidence not in the scout packet.
63
-
64
- ## Risk-weighted second opinion
65
-
66
- A single skeptic returning `false_positive` is itself a single point of failure — it can quietly bury a real bug. The orchestrator dispatches a **second independent skeptic** (no history, blind to the first verdict) when the finding is in the **dangerous quadrant**:
67
-
68
- - `severity` is `critical`/`important` **and** the first verdict is `false_positive`, or
69
- - `phase1_confidence: high` **and** the first verdict is `false_positive` (scout/skeptic disagreement), or
70
- - `phase1_confidence: low` **and** `severity: critical` (high-stakes, low-certainty).
71
-
72
- If you are the second skeptic, verify independently and return your verdict in the `second_opinion` block. When the two skeptics disagree, the orchestrator keeps the higher-severity outcome or routes to `needs_decision` — a disagreement is never silently resolved in favour of dismissal.
73
-
74
- ## Verdict (reverify mode)
75
-
76
- When `MODE` is `reverify`, the finding was previously `confirmed` or `downgraded`. Read **current** code at `location`.
77
-
78
- | Verdict | When |
79
- | ------- | ---- |
80
- | `resolved` | Fix fully addresses the issue |
81
- | `still_open` | Issue persists unchanged |
82
- | `partially_fixed` | Improved but incomplete |
83
- | `regressed` | Fix introduced new problem or made it worse |
84
-
85
- Include `verdict_reason` with before/after comparison.
86
-
87
- ## Output
88
-
89
- Return one structured block **per finding** for synthesis:
90
-
91
- ```yaml
92
- id: F-001
93
- lens: security
94
- location: path:line
95
- claim: ...
96
- severity: critical | important | minor
97
- original_severity: ... # required if downgraded
98
- verdict: confirmed | false_positive | downgraded | needs_decision | resolved | still_open | partially_fixed | regressed
99
- verdict_reason: ...
100
- evidence: ...
101
- second_opinion: # only for dangerous-quadrant findings
102
- verdict: ...
103
- verdict_reason: ...
104
- agrees: true | false
105
- ```
1
+ # Phase 2 — Skeptic pass
2
+
3
+ You are an **adversarial skeptic**. Your job is to **disprove** the scout's claim unless evidence confirms it.
4
+
5
+ **You receive only this packet — no chat history.** It may contain **one finding** (critical, or an important finding alone in its file) or a **batch of findings sharing a file or module** (important: ≤4, minor: ≤6) — steelman and verdict each finding independently; never let one verdict color another.
6
+
7
+ ## Finding(s) under review
8
+
9
+ One block per finding:
10
+
11
+ ```
12
+ id: {FINDING_ID}
13
+ lens: {LENS}
14
+ location: {LOCATION}
15
+ claim: {CLAIM}
16
+ evidence: {EVIDENCE}
17
+ context: {CONTEXT_EXCERPT} # ±30 lines around the cited location, from the scout
18
+ related: {RELATED} # callers, test files, ADR paths
19
+ tentative_severity: {SEVERITY}
20
+ confidence: {CONFIDENCE}
21
+ ```
22
+
23
+ Start from `context` and `related` — most verdicts need only 1–2 additional reads. Read more files only when the disproof checklist genuinely requires it.
24
+
25
+ ## Scope context
26
+
27
+ - **Scope:** {SCOPE_DESCRIPTION}
28
+ - **Mode:** {MODE} <!-- `initial` or `reverify` -->
29
+ - **Accepted risks:** {ACCEPTED_RISKS_DIGEST} <!-- contents of reference/accepted-risks.md -->
30
+
31
+ Check the digest **before** reading `docs/adr/` — if it covers the claim and no re-open trigger fired, the verdict is `false_positive` (cite the ADR id). Read full ADRs only when the digest is silent.
32
+
33
+ ## Steelman rule
34
+
35
+ First, restate the **strongest** version of the claim — the worst reasonable interpretation an attacker or failure mode could exploit.
36
+
37
+ ## Disproof checklist
38
+
39
+ Attempt each before concluding:
40
+
41
+ 1. **Call chain** — trace callers and callees; does the dangerous path actually execute?
42
+ 2. **Data flow** — is input attacker-controlled at the sink?
43
+ 3. **Tests** — read (or run if feasible) tests covering this path
44
+ 4. **Framework mitigations** — middleware, ORM parameterization, framework defaults
45
+ 5. **Deployment boundary** — internal-only API, LAN trust model, ADR-accepted risk
46
+ 6. **Project docs** — `docs/adr/`, `AGENTS.md`, prior security reviews
47
+ 7. **Intent** — comment, type guard, or early return that negates the claim
48
+
49
+ ## Verdict (initial review)
50
+
51
+ | Verdict | When |
52
+ | ------- | ---- |
53
+ | `confirmed` | Issue is real at stated or higher severity |
54
+ | `false_positive` | Claim does not hold after investigation |
55
+ | `downgraded` | Real issue but lower severity — set `severity` and `original_severity` |
56
+ | `needs_decision` | Architectural/policy choice; not a clear defect |
57
+
58
+ **Requirements:**
59
+
60
+ - `verdict_reason` must cite specific evidence (file:line, test name, ADR id).
61
+ - "Looks fine" without evidence is invalid.
62
+ - Upgrade severity only with **new** evidence not in the scout packet.
63
+
64
+ ## Risk-weighted second opinion
65
+
66
+ A single skeptic returning `false_positive` is itself a single point of failure — it can quietly bury a real bug. The orchestrator dispatches a **second independent skeptic** (no history, blind to the first verdict) when the finding is in the **dangerous quadrant**:
67
+
68
+ - `severity` is `critical`/`important` **and** the first verdict is `false_positive`, or
69
+ - `phase1_confidence: high` **and** the first verdict is `false_positive` (scout/skeptic disagreement), or
70
+ - `phase1_confidence: low` **and** `severity: critical` (high-stakes, low-certainty).
71
+
72
+ If you are the second skeptic, verify independently and return your verdict in the `second_opinion` block. When the two skeptics disagree, the orchestrator keeps the higher-severity outcome or routes to `needs_decision` — a disagreement is never silently resolved in favour of dismissal.
73
+
74
+ ## Verdict (reverify mode)
75
+
76
+ When `MODE` is `reverify`, the finding was previously `confirmed` or `downgraded`. Read **current** code at `location`.
77
+
78
+ | Verdict | When |
79
+ | ------- | ---- |
80
+ | `resolved` | Fix fully addresses the issue |
81
+ | `still_open` | Issue persists unchanged |
82
+ | `partially_fixed` | Improved but incomplete |
83
+ | `regressed` | Fix introduced new problem or made it worse |
84
+
85
+ Include `verdict_reason` with before/after comparison.
86
+
87
+ ## Output
88
+
89
+ Return one structured block **per finding** for synthesis:
90
+
91
+ ```yaml
92
+ id: F-001
93
+ lens: security
94
+ location: path:line
95
+ claim: ...
96
+ severity: critical | important | minor
97
+ original_severity: ... # required if downgraded
98
+ verdict: confirmed | false_positive | downgraded | needs_decision | resolved | still_open | partially_fixed | regressed
99
+ verdict_reason: ...
100
+ evidence: ...
101
+ second_opinion: # only for dangerous-quadrant findings
102
+ verdict: ...
103
+ verdict_reason: ...
104
+ agrees: true | false
105
+ ```