strikethroo 3.14.2 → 3.15.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (74) hide show
  1. package/README.md +15 -6
  2. package/dist/__tests__/fixtures/review-gate.d.ts +59 -0
  3. package/dist/__tests__/fixtures/review-gate.d.ts.map +1 -0
  4. package/dist/__tests__/fixtures/review-gate.js +150 -0
  5. package/dist/__tests__/fixtures/review-gate.js.map +1 -0
  6. package/dist-web/assets/{arc-3h4SrJcP.js → arc-DXuQKY5O.js} +1 -1
  7. package/dist-web/assets/{architectureDiagram-3BPJPVTR-CHXVDgZv.js → architectureDiagram-3BPJPVTR-DaQd1Ie5.js} +1 -1
  8. package/dist-web/assets/{blockDiagram-GPEHLZMM-ByT2aIDh.js → blockDiagram-GPEHLZMM-BTAxxxkx.js} +1 -1
  9. package/dist-web/assets/{c4Diagram-AAUBKEIU-BpSMEH5T.js → c4Diagram-AAUBKEIU-DHuDwl7F.js} +1 -1
  10. package/dist-web/assets/channel-CKed0YrQ.js +1 -0
  11. package/dist-web/assets/{chunk-2J33WTMH-B00rt2rz.js → chunk-2J33WTMH-BD4uHGPG.js} +1 -1
  12. package/dist-web/assets/{chunk-4BX2VUAB-CUD0iXK7.js → chunk-4BX2VUAB-BqVSB0Q4.js} +1 -1
  13. package/dist-web/assets/{chunk-55IACEB6-KUROX5a_.js → chunk-55IACEB6-F-aB1oSz.js} +1 -1
  14. package/dist-web/assets/{chunk-727SXJPM-DdA9k_le.js → chunk-727SXJPM-iIr2R3ax.js} +1 -1
  15. package/dist-web/assets/{chunk-AQP2D5EJ-B4lS13Tr.js → chunk-AQP2D5EJ-UpIWfDiq.js} +1 -1
  16. package/dist-web/assets/{chunk-FMBD7UC4-C6DHs6Wv.js → chunk-FMBD7UC4-DeG5uTRD.js} +1 -1
  17. package/dist-web/assets/{chunk-ND2GUHAM-Nia1N7VP.js → chunk-ND2GUHAM-Tkl5amOh.js} +1 -1
  18. package/dist-web/assets/{chunk-QZHKN3VN-BKYt-ImO.js → chunk-QZHKN3VN-B3Af5I7v.js} +1 -1
  19. package/dist-web/assets/classDiagram-4FO5ZUOK-CD2fBLcy.js +1 -0
  20. package/dist-web/assets/classDiagram-v2-Q7XG4LA2-CD2fBLcy.js +1 -0
  21. package/dist-web/assets/{cose-bilkent-S5V4N54A-uxuOqDzC.js → cose-bilkent-S5V4N54A-uuts3r-t.js} +1 -1
  22. package/dist-web/assets/{dagre-BM42HDAG-CUr1pLbj.js → dagre-BM42HDAG-CHrjnY3X.js} +1 -1
  23. package/dist-web/assets/{diagram-2AECGRRQ-BCeBLzM-.js → diagram-2AECGRRQ-BjEnf2q8.js} +1 -1
  24. package/dist-web/assets/{diagram-5GNKFQAL-DuM6xmJY.js → diagram-5GNKFQAL-BzvzvRAO.js} +1 -1
  25. package/dist-web/assets/{diagram-KO2AKTUF-Cf1eoQYh.js → diagram-KO2AKTUF-DNx6lZaA.js} +1 -1
  26. package/dist-web/assets/{diagram-LMA3HP47-Buo60yAm.js → diagram-LMA3HP47-BQUKKiM4.js} +1 -1
  27. package/dist-web/assets/{diagram-OG6HWLK6-D54wh40p.js → diagram-OG6HWLK6-MgImJXDh.js} +1 -1
  28. package/dist-web/assets/{erDiagram-TEJ5UH35-59J8tJG_.js → erDiagram-TEJ5UH35-D79fXG1m.js} +1 -1
  29. package/dist-web/assets/{flowDiagram-I6XJVG4X-DfDuK7uP.js → flowDiagram-I6XJVG4X-DQDtqM9F.js} +1 -1
  30. package/dist-web/assets/{ganttDiagram-6RSMTGT7-CbA5p8Mi.js → ganttDiagram-6RSMTGT7-rbAdz41p.js} +1 -1
  31. package/dist-web/assets/{gitGraphDiagram-PVQCEYII-1WxXLmxX.js → gitGraphDiagram-PVQCEYII-C-ppoVQN.js} +1 -1
  32. package/dist-web/assets/{index-Cao1t6Aj.js → index-BpEA2dcR.js} +1 -1
  33. package/dist-web/assets/{index-DHgmc9MH.js → index-COfqZ5qw.js} +4 -4
  34. package/dist-web/assets/{index-CyyNP5mv.js → index-D8Y-LZu5.js} +1 -1
  35. package/dist-web/assets/{infoDiagram-5YYISTIA-C5SUQ2SF.js → infoDiagram-5YYISTIA-DVx4rmpa.js} +1 -1
  36. package/dist-web/assets/{ishikawaDiagram-YF4QCWOH-dU3aWKbh.js → ishikawaDiagram-YF4QCWOH-Bwo2Fe41.js} +1 -1
  37. package/dist-web/assets/{journeyDiagram-JHISSGLW-CMDkGbgV.js → journeyDiagram-JHISSGLW-Cpk1cbVU.js} +1 -1
  38. package/dist-web/assets/{kanban-definition-UN3LZRKU-mD1rJCc5.js → kanban-definition-UN3LZRKU-DT5hIyrL.js} +1 -1
  39. package/dist-web/assets/{linear-CUGnyMnk.js → linear-BHILOJgo.js} +1 -1
  40. package/dist-web/assets/{mermaid.core-Cpmiqmbf.js → mermaid.core-BYlMWjDD.js} +4 -4
  41. package/dist-web/assets/{mindmap-definition-RKZ34NQL-CDfl1B-m.js → mindmap-definition-RKZ34NQL-CjhPuIMr.js} +1 -1
  42. package/dist-web/assets/{pieDiagram-4H26LBE5-Cuo3mXQK.js → pieDiagram-4H26LBE5-BzD5r6aw.js} +1 -1
  43. package/dist-web/assets/{quadrantDiagram-W4KKPZXB-DnFnsvpl.js → quadrantDiagram-W4KKPZXB-ieE6W8Lz.js} +1 -1
  44. package/dist-web/assets/{requirementDiagram-4Y6WPE33-DCIMxgro.js → requirementDiagram-4Y6WPE33-B6Z6Nlwn.js} +1 -1
  45. package/dist-web/assets/{sankeyDiagram-5OEKKPKP-DfxERVIc.js → sankeyDiagram-5OEKKPKP-BAz2Fhdr.js} +1 -1
  46. package/dist-web/assets/{sequenceDiagram-3UESZ5HK-vKVzidDz.js → sequenceDiagram-3UESZ5HK-Dce-js6I.js} +1 -1
  47. package/dist-web/assets/{stateDiagram-AJRCARHV-OMYutbra.js → stateDiagram-AJRCARHV-DGx4tUMu.js} +1 -1
  48. package/dist-web/assets/stateDiagram-v2-BHNVJYJU-kMJLTVIN.js +1 -0
  49. package/dist-web/assets/{timeline-definition-PNZ67QCA-Ca2z9OPS.js → timeline-definition-PNZ67QCA-B8KWHkBS.js} +1 -1
  50. package/dist-web/assets/{vennDiagram-CIIHVFJN-DBrJv-N8.js → vennDiagram-CIIHVFJN-ByWUGcRD.js} +1 -1
  51. package/dist-web/assets/{wardley-L42UT6IY-C80ot0sX.js → wardley-L42UT6IY-C1B0dt0L.js} +1 -1
  52. package/dist-web/assets/{wardleyDiagram-YWT4CUSO-CzvhVwCG.js → wardleyDiagram-YWT4CUSO-BrCqwemc.js} +1 -1
  53. package/dist-web/assets/{xychartDiagram-2RQKCTM6-DFrhJySN.js → xychartDiagram-2RQKCTM6-Br_yjZmA.js} +1 -1
  54. package/dist-web/index.html +1 -1
  55. package/package.json +1 -1
  56. package/templates/harness/skills/st-code-review/SKILL.md +309 -0
  57. package/templates/harness/skills/st-code-review/scripts/code-review.cjs +1539 -0
  58. package/templates/harness/skills/st-code-review/scripts/find-strikethroo-root.cjs +116 -0
  59. package/templates/harness/skills/st-code-review/scripts/validate-plan-blueprint.cjs +429 -0
  60. package/templates/harness/skills/st-execute-blueprint/SKILL.md +49 -2
  61. package/templates/harness/skills/st-execute-blueprint/scripts/capture-base-commit.cjs +325 -0
  62. package/templates/harness/skills/st-execute-blueprint/scripts/create-feature-branch.cjs +9 -7
  63. package/templates/harness/skills/st-execute-blueprint/scripts/dispatch-task-execution.cjs +46 -26
  64. package/templates/harness/skills/st-execute-task/scripts/dispatch-task-execution.cjs +46 -26
  65. package/templates/harness/skills/st-full-workflow/SKILL.md +49 -2
  66. package/templates/harness/skills/st-full-workflow/scripts/capture-base-commit.cjs +325 -0
  67. package/templates/harness/skills/st-full-workflow/scripts/create-feature-branch.cjs +9 -7
  68. package/templates/harness/skills/st-full-workflow/scripts/dispatch-task-execution.cjs +46 -26
  69. package/templates/strikethroo/config/hooks/CODE_REVIEW.md +60 -0
  70. package/templates/strikethroo/config/schemas/self-review-v2.xsd +437 -0
  71. package/dist-web/assets/channel-DVGz7-Ij.js +0 -1
  72. package/dist-web/assets/classDiagram-4FO5ZUOK-BuW_hD8R.js +0 -1
  73. package/dist-web/assets/classDiagram-v2-Q7XG4LA2-BuW_hD8R.js +0 -1
  74. package/dist-web/assets/stateDiagram-v2-BHNVJYJU-2bqmqQl-.js +0 -1
@@ -3654,8 +3654,9 @@ var command = (executable, argv, request) => ({
3654
3654
  executable,
3655
3655
  argv,
3656
3656
  cwd: request.workspace,
3657
- stdin: taskPrompt(request)
3657
+ stdin: request.prompt
3658
3658
  });
3659
+ var modelArgv = (model) => model === void 0 ? [] : ["--model", model];
3659
3660
  var EXTERNAL_HARNESS_ADAPTERS = {
3660
3661
  claude: {
3661
3662
  executable: "claude",
@@ -3663,8 +3664,7 @@ var EXTERNAL_HARNESS_ADAPTERS = {
3663
3664
  "claude",
3664
3665
  [
3665
3666
  "-p",
3666
- "--model",
3667
- request.model,
3667
+ ...modelArgv(request.model),
3668
3668
  ...request.reasoningEffort === void 0 ? [] : ["--effort", request.reasoningEffort]
3669
3669
  ],
3670
3670
  request
@@ -3677,8 +3677,7 @@ var EXTERNAL_HARNESS_ADAPTERS = {
3677
3677
  "codex",
3678
3678
  [
3679
3679
  "exec",
3680
- "--model",
3681
- request.model,
3680
+ ...modelArgv(request.model),
3682
3681
  ...request.reasoningEffort === void 0 ? [] : ["--config", `model_reasoning_effort=${request.reasoningEffort}`],
3683
3682
  "-"
3684
3683
  ],
@@ -3688,17 +3687,19 @@ var EXTERNAL_HARNESS_ADAPTERS = {
3688
3687
  },
3689
3688
  cursor: {
3690
3689
  executable: "cursor-agent",
3691
- buildCommand: (request) => command("cursor-agent", ["--print", "--model", request.model], request),
3690
+ buildCommand: (request) => command("cursor-agent", ["--print", ...modelArgv(request.model)], request),
3692
3691
  authenticationArgv: () => ["status"]
3693
3692
  },
3694
3693
  gemini: {
3695
3694
  executable: "gemini",
3696
- buildCommand: (request) => command("gemini", ["--prompt", "", "--model", request.model], request),
3695
+ // The empty positional prompt is the existing contract — content travels on
3696
+ // stdin. It stays even when the model pair is dropped.
3697
+ buildCommand: (request) => command("gemini", ["--prompt", "", ...modelArgv(request.model)], request),
3697
3698
  authenticationArgv: () => ["auth", "status"]
3698
3699
  },
3699
3700
  copilot: {
3700
3701
  executable: "copilot",
3701
- buildCommand: (request) => command("copilot", ["-p", "", "--model", request.model], request),
3702
+ buildCommand: (request) => command("copilot", ["-p", "", ...modelArgv(request.model)], request),
3702
3703
  authenticationArgv: () => ["auth", "status"]
3703
3704
  },
3704
3705
  opencode: {
@@ -3707,8 +3708,7 @@ var EXTERNAL_HARNESS_ADAPTERS = {
3707
3708
  "opencode",
3708
3709
  [
3709
3710
  "run",
3710
- "--model",
3711
- request.model,
3711
+ ...modelArgv(request.model),
3712
3712
  ...request.reasoningEffort === void 0 ? [] : ["--variant", request.reasoningEffort],
3713
3713
  "-"
3714
3714
  ],
@@ -3722,6 +3722,12 @@ var harnessKeys = [...SUPPORTED_HARNESSES].sort();
3722
3722
  if (adapterKeys.join("\0") !== harnessKeys.join("\0")) {
3723
3723
  throw new Error("External harness adapter registry does not cover SUPPORTED_HARNESSES exactly.");
3724
3724
  }
3725
+ var taskCommandRequest = (request) => ({
3726
+ model: request.model,
3727
+ reasoningEffort: request.reasoningEffort,
3728
+ workspace: request.workspace,
3729
+ prompt: taskPrompt(request)
3730
+ });
3725
3731
  var executableOnPath = (executable) => (process.env.PATH ?? "").split(path2.delimiter).some((directory) => {
3726
3732
  if (!directory) return false;
3727
3733
  const candidate = path2.join(directory, executable);
@@ -3782,23 +3788,17 @@ var dependencies = {
3782
3788
  launch: (commandSpec) => runProcess(commandSpec.executable, commandSpec.argv, commandSpec.cwd, commandSpec.stdin, true)
3783
3789
  };
3784
3790
  var errorMessage = (error) => error instanceof Error ? error.message : String(error);
3785
- var dispatchExternalTask = async (request, overrides = {}) => {
3786
- const adapter = EXTERNAL_HARNESS_ADAPTERS[request.harness];
3791
+ var prepareLaunch = async (harness, input, active, guard) => {
3792
+ const adapter = EXTERNAL_HARNESS_ADAPTERS[harness];
3787
3793
  if (!adapter) {
3788
3794
  return {
3789
3795
  kind: "fallback",
3790
3796
  reason: "adapter-unavailable",
3791
- detail: `No adapter is registered for ${request.harness}.`
3792
- };
3793
- }
3794
- const active = { ...dependencies, ...overrides };
3795
- if (request.reasoningEffort !== void 0 && (request.harness === "cursor" || request.harness === "gemini" || request.harness === "copilot")) {
3796
- return {
3797
- kind: "fallback",
3798
- reason: "unsupported-reasoning-effort",
3799
- detail: `${request.harness} does not support a generic reasoning_effort override.`
3797
+ detail: `No adapter is registered for ${harness}.`
3800
3798
  };
3801
3799
  }
3800
+ const blocked = guard?.();
3801
+ if (blocked) return blocked;
3802
3802
  if (!active.executableExists(adapter.executable)) {
3803
3803
  return {
3804
3804
  kind: "fallback",
@@ -3806,7 +3806,7 @@ var dispatchExternalTask = async (request, overrides = {}) => {
3806
3806
  detail: `${adapter.executable} is unavailable.`
3807
3807
  };
3808
3808
  }
3809
- const commandSpec = adapter.buildCommand(request);
3809
+ const commandSpec = adapter.buildCommand(input);
3810
3810
  const authentication = await active.authenticate(commandSpec, adapter);
3811
3811
  if (!authentication.ok) {
3812
3812
  return {
@@ -3815,16 +3815,35 @@ var dispatchExternalTask = async (request, overrides = {}) => {
3815
3815
  detail: authentication.detail ?? `${adapter.executable} authentication check failed.`
3816
3816
  };
3817
3817
  }
3818
+ return { kind: "ready", command: commandSpec };
3819
+ };
3820
+ var launchPrepared = async (prepared, active, label) => {
3821
+ if (prepared.kind === "fallback") return prepared;
3818
3822
  try {
3819
- const launched = await active.launch(commandSpec);
3823
+ const launched = await active.launch(prepared.command);
3820
3824
  return launched.exitCode === 0 ? { kind: "launched-success", exitCode: 0 } : { kind: "launched-failure", exitCode: launched.exitCode };
3821
3825
  } catch (error) {
3822
3826
  return {
3823
3827
  kind: "infrastructure-failure",
3824
- detail: `External task process failed: ${errorMessage(error)}`
3828
+ detail: `External ${label} process failed: ${errorMessage(error)}`
3825
3829
  };
3826
3830
  }
3827
3831
  };
3832
+ var unsupportedReasoningEffort = (request) => request.reasoningEffort !== void 0 && (request.harness === "cursor" || request.harness === "gemini" || request.harness === "copilot") ? {
3833
+ kind: "fallback",
3834
+ reason: "unsupported-reasoning-effort",
3835
+ detail: `${request.harness} does not support a generic reasoning_effort override.`
3836
+ } : void 0;
3837
+ var dispatchExternalTask = async (request, overrides = {}) => {
3838
+ const active = { ...dependencies, ...overrides };
3839
+ const prepared = await prepareLaunch(
3840
+ request.harness,
3841
+ taskCommandRequest(request),
3842
+ active,
3843
+ () => unsupportedReasoningEffort(request)
3844
+ );
3845
+ return launchPrepared(prepared, active, "task");
3846
+ };
3828
3847
 
3829
3848
  // src/skill-scripts/shared/harness-availability.ts
3830
3849
  var fs2 = __toESM(require("fs"));
@@ -6509,7 +6528,7 @@ var main = async () => {
6509
6528
  );
6510
6529
  }
6511
6530
  const handoff = decodeHandoff(handoffArg);
6512
- const result = await dispatchExternalTask({
6531
+ const routed = {
6513
6532
  harness: handoff.harness,
6514
6533
  model: handoff.model,
6515
6534
  ...handoff.reasoningEffort === void 0 ? {} : { reasoningEffort: handoff.reasoningEffort },
@@ -6518,7 +6537,8 @@ var main = async () => {
6518
6537
  taskId: validTaskId,
6519
6538
  taskFile: taskPath,
6520
6539
  taskMarkdown
6521
- });
6540
+ };
6541
+ const result = await dispatchExternalTask(routed);
6522
6542
  emit(
6523
6543
  result,
6524
6544
  result.kind === "infrastructure-failure" ? 2 : result.kind === "launched-failure" ? 1 : 0
@@ -415,7 +415,9 @@ If `taskCount` is 0 or `blueprintExists` is `no`:
415
415
 
416
416
  #### 3. Optionally create a feature branch
417
417
 
418
- Run `scripts/create-feature-branch.cjs <plan-id>` once before phase execution. Branch creation is best-effort: when the script reports that it skipped creation (for example, not on `main`/`master`), continue on the current branch and do not retry or create a branch manually. When the script exits with an error (for example, uncommitted changes on `main`/`master`), halt and report the error. Do not treat a skipped branch as a failure or spend effort working around a skip.
418
+ Run `scripts/create-feature-branch.cjs <plan-id>` once before phase execution. Branch creation is best-effort: when the script reports that it skipped creation (for example, not on `main`/`master`), continue on the current branch and do not retry or create a branch manually. Uncommitted or untracked changes are permitted only when every change is inside the repository-root `.ai/strikethroo` subtree, so a newly generated plan and tasks can remain uncommitted before execution. When the script exits with an error—including changes anywhere outside that subtree or an inability to inspect Git status on `main`/`master`—halt and report the error. Do not treat a skipped branch as a failure or spend effort working around a skip.
419
+
420
+ After the branch step, run `scripts/capture-base-commit.cjs <plan-id>` once. It records the commit the review gate diffs against. A `skipped` result is not a failure — continue execution and note that the review gate will skip. Only an `error` result halts.
419
421
 
420
422
  #### 4. Load execution blueprint
421
423
 
@@ -505,6 +507,51 @@ Read `<root>/config/hooks/POST_EXECUTION.md` and execute its instructions. If va
505
507
 
506
508
  Before declaring execution complete, apply the evidence gate in `<root>/config/shared/verification-gate.md` to the plan's Success Criteria and Self Validation steps.
507
509
 
510
+ ##### Run the code review gate
511
+
512
+ After `POST_EXECUTION.md` reports green and before appending the execution summary, follow the `st-code-review` skill and run one review round with its bundled mechanism:
513
+
514
+ ```text
515
+ code-review.cjs <plan-id> <current-harness> <round>
516
+ ```
517
+
518
+ `code-review.cjs` ships with the `st-code-review` skill and lives in that skill's own `scripts` directory, a sibling of this one. Resolve it there; it is not bundled with this skill. If the `st-code-review` skill is not installed on this harness, record that as the review outcome in the execution summary and continue to the summary and archival.
519
+
520
+ `<current-harness>` is the exact supported harness identifier running this skill. `<round>` is `1` on the first invocation, and thereafter the exact `decision.nextRound` the previous round returned. The command emits exactly one JSON line on stdout. Read its `kind`, then — when `kind` is `reviewed` — its `decision.kind`, and do exactly what the matching row states.
521
+
522
+ | Result | What you do |
523
+ | --- | --- |
524
+ | `skipped` | The gate is disabled or unconfigured. Record `reason` and `detail` verbatim in the execution summary, then continue to the summary and archival. A skip is never a failure. |
525
+ | `reviewed`, `decision.kind` = `gate-passed` | The gate passed. Record `findingsGate.recorded` and `findingsGate.aboveFloorWithoutSuggestion` — real findings deliberately not applied — then continue to the summary and archival. |
526
+ | `reviewed`, `decision.kind` = `fix-and-continue` | Apply the `actionable` set from `<plan-dir>/review/round-<n>/findings.json` on the implementer route. Re-run `POST_EXECUTION.md` in full. Then run the gate again with `<round>` set to `decision.nextRound`. |
527
+ | `reviewed`, `decision.kind` = `budget-exhausted` | Halt exactly as any mechanical gate failure. Leave the plan in `plans/`, do not append a completion summary, do not archive, and report the outstanding findings with actionable next steps. |
528
+ | `reviewed`, `decision.kind` = `round-failed` | The round was not certified — the findings document was absent or invalid, or no validator was available. Halt and report `decision.detail`. Never report an uncertified round as clean. |
529
+ | `budget-exhausted` | A round past the enforced budget was requested and no reviewer was dispatched. Halt exactly as `decision.kind` = `budget-exhausted` above. |
530
+ | `launched-failure` | The reviewer harness exited non-zero. Halt and report `detail`. |
531
+ | `fallback` | The reviewer never ran — the harness was unavailable or authentication failed. Record `reason` and `detail` verbatim in the execution summary, then continue to the summary and archival. |
532
+ | `infrastructure-failure` | A real error. Halt and report `detail`. Do not retry on a different route. |
533
+
534
+ <details>
535
+ <summary>Applying an actionable finding</summary>
536
+
537
+ `<plan-dir>/review/round-<n>/findings.json` holds that round's partition. Its `actionable` array is the only set you apply. Its `recorded` array is inspection material and is never applied.
538
+
539
+ Each actionable entry names a file, a location, and a suggestion whose `original-code` was copied verbatim from that file. Apply it as an exact text replacement of `original-code` by `proposed-code`, and change nothing else. When `original-code` no longer matches the file, record the finding as not applied and move to the next one. Do not reconstruct the fix, widen it, or refactor around it.
540
+
541
+ Dispatch every fix on the implementer route. Earlier rounds' rulings are carried into the next round by the mechanism itself, which reads the partitions it already wrote; do not pass them back on the command line.
542
+
543
+ </details>
544
+
545
+ Hard rules:
546
+
547
+ - The gate creates no task files.
548
+ - The gate never mutates the Execution Blueprint.
549
+ - The gate is terminal only — never per phase, never per task.
550
+ - The reviewer never fixes its own findings. Detection runs on the reviewer route, fixes run on the implementer route.
551
+ - Any applied fix invalidates the green build that preceded it. Re-run `POST_EXECUTION.md` in full — lint, tests, and Self Validation — before the gate runs again. Never re-verify against the prior green build.
552
+ - Whether another round runs is `decision.kind`'s to state and yours to obey. Do not count rounds, reason about the budget, or invoke a round the mechanism did not name.
553
+ - A green gate is not a correctness guarantee. It reduces the exposure a human PR approval reduces, and it leaves the same exposure behind.
554
+
508
555
  #### 7. Append execution summary
509
556
 
510
557
  Append an execution summary section to the plan document using the format described in `<root>/config/templates/EXECUTION_SUMMARY_TEMPLATE.md`. Populate:
@@ -512,7 +559,7 @@ Append an execution summary section to the plan document using the format descri
512
559
  - **Status**: Completed Successfully
513
560
  - **Completed Date**: current date
514
561
  - **Results**: brief summary of deliverables
515
- - **Noteworthy Events**: all decisions, issues, and outcomes encountered during execution. If none occurred, state "No significant issues encountered."
562
+ - **Noteworthy Events**: all decisions, issues, and outcomes encountered during execution. Always record the review gate's outcome here: the reviewer harness, the number of rounds run, and the counts of findings recorded versus applied — or, when the gate did not run, its `reason` and `detail` verbatim. If nothing else occurred, state "No significant issues encountered." after the review outcome.
516
563
  - **Necessary follow-ups**: any follow-up actions or optimizations
517
564
 
518
565
  #### 8. Archive the plan
@@ -0,0 +1,325 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+
30
+ // src/skill-scripts/capture-base-commit.ts
31
+ var capture_base_commit_exports = {};
32
+ __export(capture_base_commit_exports, {
33
+ _isGitRepo: () => _isGitRepo,
34
+ _isValidSha: () => _isValidSha,
35
+ _readExistingBaseCommit: () => _readExistingBaseCommit,
36
+ main: () => main
37
+ });
38
+ module.exports = __toCommonJS(capture_base_commit_exports);
39
+ var fs4 = __toESM(require("fs"));
40
+ var path4 = __toESM(require("path"));
41
+
42
+ // src/skill-scripts/shared/git-utils.ts
43
+ var import_child_process = require("child_process");
44
+ var execGit = (command) => {
45
+ try {
46
+ return (0, import_child_process.execSync)(command, { encoding: "utf8", stdio: ["pipe", "pipe", "pipe"] }).trim();
47
+ } catch (_error) {
48
+ return null;
49
+ }
50
+ };
51
+
52
+ // src/skill-scripts/shared/plan-resolve.ts
53
+ var fs3 = __toESM(require("fs"));
54
+ var path3 = __toESM(require("path"));
55
+
56
+ // src/skill-scripts/shared/root.ts
57
+ var fs = __toESM(require("fs"));
58
+ var path = __toESM(require("path"));
59
+ var EXPECTED_SCHEMA = true ? 4 : 4;
60
+ var isValidStrikethrooRoot = (strikethrooPath) => {
61
+ try {
62
+ if (!fs.existsSync(strikethrooPath)) return false;
63
+ if (!fs.lstatSync(strikethrooPath).isDirectory()) return false;
64
+ const metadataPath = path.join(strikethrooPath, ".init-metadata.json");
65
+ if (!fs.existsSync(metadataPath)) return false;
66
+ const metadata = JSON.parse(fs.readFileSync(metadataPath, "utf8"));
67
+ return metadata && typeof metadata === "object" && "version" in metadata;
68
+ } catch (_err) {
69
+ return false;
70
+ }
71
+ };
72
+ var getStrikethrooAt = (directory) => {
73
+ const strikethrooPath = path.join(directory, ".ai", "strikethroo");
74
+ return isValidStrikethrooRoot(strikethrooPath) ? strikethrooPath : null;
75
+ };
76
+ var getParentPaths = (currentPath, acc = []) => {
77
+ const absolutePath = path.resolve(currentPath);
78
+ const nextAcc = [...acc, absolutePath];
79
+ const parentPath = path.dirname(absolutePath);
80
+ if (parentPath === absolutePath) return nextAcc;
81
+ return getParentPaths(parentPath, nextAcc);
82
+ };
83
+ var checkWorkspaceSchema = (metadataPath) => {
84
+ let metadata;
85
+ try {
86
+ metadata = JSON.parse(fs.readFileSync(metadataPath, "utf8"));
87
+ } catch {
88
+ return;
89
+ }
90
+ const actual = typeof metadata.workspaceSchemaVersion === "number" ? metadata.workspaceSchemaVersion : 1;
91
+ if (actual === EXPECTED_SCHEMA) return;
92
+ if (actual < EXPECTED_SCHEMA) {
93
+ process.stderr.write(
94
+ `Workspace schema v${actual} is older than this skill requires (v${EXPECTED_SCHEMA}). Re-run \`npx strikethroo init\` with the latest CLI to update.
95
+ `
96
+ );
97
+ } else {
98
+ process.stderr.write(
99
+ `This skill (built for workspace schema v${EXPECTED_SCHEMA}) is older than the workspace (v${actual}). Re-run \`npx skills add e0ipso/strikethroo\` to update skills.
100
+ `
101
+ );
102
+ }
103
+ process.exit(1);
104
+ };
105
+ var findStrikethrooRoot = (startPath = process.cwd()) => {
106
+ const paths = getParentPaths(startPath);
107
+ const found = paths.find((p) => getStrikethrooAt(p));
108
+ if (!found) return null;
109
+ const root = getStrikethrooAt(found);
110
+ if (root) checkWorkspaceSchema(path.join(root, ".init-metadata.json"));
111
+ return root;
112
+ };
113
+
114
+ // src/skill-scripts/shared/plan-scan.ts
115
+ var fs2 = __toESM(require("fs"));
116
+ var path2 = __toESM(require("path"));
117
+
118
+ // src/skill-scripts/shared/frontmatter.ts
119
+ var ID_PATTERNS = [
120
+ /^\s*["']?id["']?\s*:\s*["']?([+-]?\d+)["']?\s*(?:#.*)?$/im,
121
+ /^\s*id\s*:\s*([+-]?\d+)\s*(?:#.*)?$/im,
122
+ /^\s*["']?id["']?\s*:\s*"([+-]?\d+)"\s*(?:#.*)?$/im,
123
+ /^\s*["']?id["']?\s*:\s*'([+-]?\d+)'\s*(?:#.*)?$/im,
124
+ /^\s*["']id["']\s*:\s*([+-]?\d+)\s*(?:#.*)?$/im,
125
+ /^\s*id\s*:\s*[|>]\s*([+-]?\d+)\s*$/im
126
+ ];
127
+ var validateId = (rawId) => {
128
+ const id = parseInt(rawId, 10);
129
+ if (Number.isNaN(id) || id < 0 || id > Number.MAX_SAFE_INTEGER) return null;
130
+ return id;
131
+ };
132
+ var extractIdFromMarkdown = (content) => {
133
+ const frontmatterMatch = content.match(/^---\s*\r?\n([\s\S]*?)\r?\n---/);
134
+ if (!frontmatterMatch || !frontmatterMatch[1]) return null;
135
+ const block = frontmatterMatch[1];
136
+ for (const pattern of ID_PATTERNS) {
137
+ const match = block.match(pattern);
138
+ if (match && match[1]) {
139
+ const id = validateId(match[1]);
140
+ if (id !== null) return id;
141
+ }
142
+ }
143
+ return null;
144
+ };
145
+ var extractPlanId = (content, _filePath) => {
146
+ return extractIdFromMarkdown(content);
147
+ };
148
+
149
+ // src/skill-scripts/shared/plan-scan.ts
150
+ var PLAN_EXTENSIONS = [".md"];
151
+ var scanPlanDir = (planDirPath, dirName, isArchive) => {
152
+ let entries;
153
+ try {
154
+ entries = fs2.readdirSync(planDirPath, { withFileTypes: true });
155
+ } catch (_err) {
156
+ return [];
157
+ }
158
+ return entries.filter((e) => e.isFile() && PLAN_EXTENSIONS.some((ext) => e.name.endsWith(ext))).flatMap((e) => {
159
+ const filePath = path2.join(planDirPath, e.name);
160
+ try {
161
+ const content = fs2.readFileSync(filePath, "utf8");
162
+ const id = extractPlanId(content, filePath);
163
+ if (id === null) return [];
164
+ return [{ id, file: filePath, dir: planDirPath, isArchive, name: dirName }];
165
+ } catch (_err) {
166
+ return [];
167
+ }
168
+ });
169
+ };
170
+ var getAllPlans = (taskManagerRoot) => {
171
+ const sources = [
172
+ { dir: path2.join(taskManagerRoot, "plans"), isArchive: false },
173
+ { dir: path2.join(taskManagerRoot, "archive"), isArchive: true }
174
+ ];
175
+ return sources.flatMap(({ dir, isArchive }) => {
176
+ if (!fs2.existsSync(dir)) return [];
177
+ let entries;
178
+ try {
179
+ entries = fs2.readdirSync(dir, { withFileTypes: true });
180
+ } catch (_err) {
181
+ return [];
182
+ }
183
+ return entries.filter((e) => e.isDirectory()).flatMap((e) => scanPlanDir(path2.join(dir, e.name), e.name, isArchive));
184
+ });
185
+ };
186
+
187
+ // src/skill-scripts/shared/plan-resolve.ts
188
+ var isValidRootDir = (strikethrooPath) => {
189
+ try {
190
+ if (!fs3.existsSync(strikethrooPath)) return false;
191
+ if (!fs3.lstatSync(strikethrooPath).isDirectory()) return false;
192
+ const metadataPath = path3.join(strikethrooPath, ".init-metadata.json");
193
+ if (!fs3.existsSync(metadataPath)) return false;
194
+ const metadata = JSON.parse(fs3.readFileSync(metadataPath, "utf8"));
195
+ return metadata && typeof metadata === "object" && "version" in metadata;
196
+ } catch (_err) {
197
+ return false;
198
+ }
199
+ };
200
+ var checkStandardRootShortcut = (filePath) => {
201
+ const planDir = path3.dirname(filePath);
202
+ const parentDir = path3.dirname(planDir);
203
+ const possibleRoot = path3.dirname(parentDir);
204
+ const parentBase = path3.basename(parentDir);
205
+ if (parentBase !== "plans" && parentBase !== "archive") return null;
206
+ if (path3.basename(possibleRoot) !== "strikethroo") return null;
207
+ const dotAiDir = path3.dirname(possibleRoot);
208
+ if (path3.basename(dotAiDir) !== ".ai") return null;
209
+ return isValidRootDir(possibleRoot) ? possibleRoot : null;
210
+ };
211
+ var resolveByPath = (absolutePath) => {
212
+ let content;
213
+ try {
214
+ content = fs3.readFileSync(absolutePath, "utf8");
215
+ } catch (_err) {
216
+ return null;
217
+ }
218
+ const planId = extractPlanId(content, absolutePath);
219
+ if (planId === null) return null;
220
+ const tmRoot = checkStandardRootShortcut(absolutePath) || findStrikethrooRoot(path3.dirname(absolutePath));
221
+ if (!tmRoot) return null;
222
+ return {
223
+ planFile: absolutePath,
224
+ planDir: path3.dirname(absolutePath),
225
+ strikethrooRoot: tmRoot,
226
+ planId
227
+ };
228
+ };
229
+ var resolveByIdInAncestry = (planId, startPath, searched = /* @__PURE__ */ new Set()) => {
230
+ const tmRoot = findStrikethrooRoot(startPath);
231
+ if (!tmRoot) return null;
232
+ const normalized = path3.normalize(tmRoot);
233
+ if (searched.has(normalized)) return null;
234
+ searched.add(normalized);
235
+ const plans = getAllPlans(tmRoot);
236
+ const match = plans.find((p) => p.id === planId);
237
+ if (match) {
238
+ return {
239
+ planFile: match.file,
240
+ planDir: match.dir,
241
+ strikethrooRoot: tmRoot,
242
+ planId
243
+ };
244
+ }
245
+ const parentOfRoot = path3.dirname(path3.dirname(tmRoot));
246
+ if (parentOfRoot === tmRoot) return null;
247
+ return resolveByIdInAncestry(planId, parentOfRoot, searched);
248
+ };
249
+ var resolvePlan = (input, startPath = process.cwd()) => {
250
+ if (input === null || input === void 0 || input === "") return null;
251
+ const inputStr = String(input);
252
+ if (inputStr.startsWith("/")) {
253
+ return resolveByPath(inputStr);
254
+ }
255
+ const planId = parseInt(inputStr, 10);
256
+ if (Number.isNaN(planId)) return null;
257
+ return resolveByIdInAncestry(planId, startPath);
258
+ };
259
+
260
+ // src/skill-scripts/capture-base-commit.ts
261
+ var SHA_RE = /^[0-9a-f]{40}$/i;
262
+ var emit = (result, exitCode) => {
263
+ process.stdout.write(`${JSON.stringify(result)}
264
+ `);
265
+ process.exit(exitCode);
266
+ };
267
+ var _isGitRepo = () => execGit("git rev-parse --is-inside-work-tree") === "true";
268
+ var _isValidSha = (value) => typeof value === "string" && SHA_RE.test(value);
269
+ var _readExistingBaseCommit = (filePath) => {
270
+ let raw;
271
+ try {
272
+ raw = fs4.readFileSync(filePath, "utf8");
273
+ } catch {
274
+ return null;
275
+ }
276
+ try {
277
+ const parsed = JSON.parse(raw);
278
+ if (parsed && typeof parsed === "object" && _isValidSha(parsed.baseCommit)) {
279
+ return parsed.baseCommit;
280
+ }
281
+ } catch {
282
+ return null;
283
+ }
284
+ return null;
285
+ };
286
+ var main = (startPath = process.cwd()) => {
287
+ if (!_isGitRepo()) {
288
+ emit({ kind: "skipped", reason: "not-a-git-repository" }, 0);
289
+ }
290
+ const head = execGit("git rev-parse HEAD");
291
+ if (!_isValidSha(head)) {
292
+ emit({ kind: "skipped", reason: "no-commits" }, 0);
293
+ }
294
+ const inputId = process.argv[2] ?? "";
295
+ const resolved = resolvePlan(inputId, startPath);
296
+ if (!resolved) {
297
+ emit({ kind: "error", detail: `Plan "${inputId}" not found or invalid` }, 2);
298
+ }
299
+ const { planDir } = resolved;
300
+ const reviewDir = path4.join(planDir, "review");
301
+ const filePath = path4.join(reviewDir, "base-commit.json");
302
+ const existing = _readExistingBaseCommit(filePath);
303
+ if (existing) {
304
+ emit({ kind: "already-captured", baseCommit: existing, file: filePath }, 0);
305
+ }
306
+ fs4.mkdirSync(reviewDir, { recursive: true });
307
+ const record = {
308
+ version: 1,
309
+ baseCommit: head,
310
+ capturedAt: (/* @__PURE__ */ new Date()).toISOString()
311
+ };
312
+ fs4.writeFileSync(filePath, `${JSON.stringify(record)}
313
+ `, "utf8");
314
+ emit({ kind: "captured", baseCommit: head, file: filePath }, 0);
315
+ };
316
+ if (require.main === module) {
317
+ main();
318
+ }
319
+ // Annotate the CommonJS export names for ESM import in node:
320
+ 0 && (module.exports = {
321
+ _isGitRepo,
322
+ _isValidSha,
323
+ _readExistingBaseCommit,
324
+ main
325
+ });
@@ -275,10 +275,7 @@ var _isGitRepo = () => {
275
275
  var _getCurrentBranch = () => {
276
276
  return execGit("git rev-parse --abbrev-ref HEAD");
277
277
  };
278
- var _hasUncommittedChanges = () => {
279
- const status = execGit("git status --porcelain");
280
- return status !== null && status.length > 0;
281
- };
278
+ var _getUncommittedChangesOutsideWorkspace = () => execGit("git status --porcelain -- ':(top)' ':(top,exclude).ai/strikethroo'");
282
279
  var _branchExists = (branchName) => {
283
280
  const localMatch = execGit(`git branch --list "${branchName}"`);
284
281
  if (localMatch) {
@@ -326,9 +323,14 @@ var main = (startPath = process.cwd()) => {
326
323
  _printInfo("Proceeding without creating a new branch");
327
324
  process.exit(0);
328
325
  }
329
- if (_hasUncommittedChanges()) {
330
- _printError("Uncommitted changes detected in working tree");
331
- _printInfo("Please commit or stash your changes before creating a feature branch");
326
+ const outsideWorkspaceStatus = _getUncommittedChangesOutsideWorkspace();
327
+ if (outsideWorkspaceStatus === null) {
328
+ _printError("Could not inspect git status; branch creation has been blocked");
329
+ process.exit(1);
330
+ }
331
+ if (outsideWorkspaceStatus.length > 0) {
332
+ _printError("Uncommitted changes detected outside .ai/strikethroo");
333
+ _printInfo("Commit or stash changes outside .ai/strikethroo before creating a feature branch");
332
334
  process.exit(1);
333
335
  }
334
336
  const planName = _extractPlanName(planDir);