strikethroo 3.21.3 → 3.22.1

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 (117) hide show
  1. package/README.md +10 -0
  2. package/dist/__tests__/built-skills.d.ts +15 -0
  3. package/dist/__tests__/built-skills.d.ts.map +1 -0
  4. package/dist/__tests__/built-skills.js +53 -0
  5. package/dist/__tests__/built-skills.js.map +1 -0
  6. package/dist/cli.js +19 -1
  7. package/dist/cli.js.map +1 -1
  8. package/dist/index.d.ts +2 -0
  9. package/dist/index.d.ts.map +1 -1
  10. package/dist/index.js +50 -15
  11. package/dist/index.js.map +1 -1
  12. package/dist/resolve-init-harnesses.d.ts +30 -0
  13. package/dist/resolve-init-harnesses.d.ts.map +1 -0
  14. package/dist/resolve-init-harnesses.js +44 -0
  15. package/dist/resolve-init-harnesses.js.map +1 -0
  16. package/dist/types.d.ts +32 -1
  17. package/dist/types.d.ts.map +1 -1
  18. package/dist/types.js.map +1 -1
  19. package/dist/update.d.ts +28 -0
  20. package/dist/update.d.ts.map +1 -0
  21. package/dist/update.js +198 -0
  22. package/dist/update.js.map +1 -0
  23. package/dist-web/assets/{arc-8Mxnwqfp.js → arc-Hwddr2kO.js} +1 -1
  24. package/dist-web/assets/{architectureDiagram-3BPJPVTR-CjR6ApxR.js → architectureDiagram-3BPJPVTR-i11AtK7_.js} +1 -1
  25. package/dist-web/assets/{blockDiagram-GPEHLZMM-DhGYH8V9.js → blockDiagram-GPEHLZMM-BBT6cVNX.js} +1 -1
  26. package/dist-web/assets/{c4Diagram-AAUBKEIU-BpUJqbui.js → c4Diagram-AAUBKEIU-C3vqlA6y.js} +1 -1
  27. package/dist-web/assets/channel-Cur0s-J7.js +1 -0
  28. package/dist-web/assets/{chunk-2J33WTMH-BX8NM2bi.js → chunk-2J33WTMH-B2qLeglu.js} +1 -1
  29. package/dist-web/assets/{chunk-4BX2VUAB-ChNDzlNh.js → chunk-4BX2VUAB-BOoURq0p.js} +1 -1
  30. package/dist-web/assets/{chunk-55IACEB6-62ChSXXQ.js → chunk-55IACEB6-DucbZmPO.js} +1 -1
  31. package/dist-web/assets/{chunk-727SXJPM-DM_m3yWL.js → chunk-727SXJPM-D1jwNHG5.js} +1 -1
  32. package/dist-web/assets/{chunk-AQP2D5EJ-DZcEQaCW.js → chunk-AQP2D5EJ-DEqgF-yl.js} +1 -1
  33. package/dist-web/assets/{chunk-FMBD7UC4-jITTRsf2.js → chunk-FMBD7UC4-DyqowetS.js} +1 -1
  34. package/dist-web/assets/{chunk-ND2GUHAM-D73huh8-.js → chunk-ND2GUHAM-B5m1NGQ0.js} +1 -1
  35. package/dist-web/assets/{chunk-QZHKN3VN-DqdeIFoN.js → chunk-QZHKN3VN-DuDvOVer.js} +1 -1
  36. package/dist-web/assets/classDiagram-4FO5ZUOK-CjiILMRI.js +1 -0
  37. package/dist-web/assets/classDiagram-v2-Q7XG4LA2-CjiILMRI.js +1 -0
  38. package/dist-web/assets/{cose-bilkent-S5V4N54A-B6y8LQMc.js → cose-bilkent-S5V4N54A-C9HUgr5R.js} +1 -1
  39. package/dist-web/assets/{dagre-BM42HDAG-CEudzPZe.js → dagre-BM42HDAG-DT3KjQHY.js} +1 -1
  40. package/dist-web/assets/{diagram-2AECGRRQ-ADCpFrWI.js → diagram-2AECGRRQ-DrCpXRj9.js} +1 -1
  41. package/dist-web/assets/{diagram-5GNKFQAL-BQcNfKgC.js → diagram-5GNKFQAL-QcCYThB2.js} +1 -1
  42. package/dist-web/assets/{diagram-KO2AKTUF-2Y25ZUgl.js → diagram-KO2AKTUF-BsaZwGbo.js} +1 -1
  43. package/dist-web/assets/{diagram-LMA3HP47-qiLQPz0R.js → diagram-LMA3HP47-B6ZqNLaZ.js} +1 -1
  44. package/dist-web/assets/{diagram-OG6HWLK6-5tV6wHg0.js → diagram-OG6HWLK6-ZfJLCrYD.js} +1 -1
  45. package/dist-web/assets/{erDiagram-TEJ5UH35-C9KwzSBJ.js → erDiagram-TEJ5UH35-BlnJ9PIz.js} +1 -1
  46. package/dist-web/assets/{flowDiagram-I6XJVG4X-DWFT6yjl.js → flowDiagram-I6XJVG4X-CIfl3CnE.js} +1 -1
  47. package/dist-web/assets/{ganttDiagram-6RSMTGT7-CwOaaOj-.js → ganttDiagram-6RSMTGT7-CPrwdiin.js} +1 -1
  48. package/dist-web/assets/{gitGraphDiagram-PVQCEYII-D9GwiRiE.js → gitGraphDiagram-PVQCEYII-DcY9oRGk.js} +1 -1
  49. package/dist-web/assets/{index-R-j45X6T.js → index-COfame-T.js} +4 -4
  50. package/dist-web/assets/{index-CJtNiGoR.js → index-DGtMmSy6.js} +1 -1
  51. package/dist-web/assets/{index-CXzu9Ojw.js → index-j2lPssdc.js} +1 -1
  52. package/dist-web/assets/{infoDiagram-5YYISTIA-8s7z_vpg.js → infoDiagram-5YYISTIA-DVU5i5FV.js} +1 -1
  53. package/dist-web/assets/{ishikawaDiagram-YF4QCWOH-mkZLBAJy.js → ishikawaDiagram-YF4QCWOH-B8Ga6Rav.js} +1 -1
  54. package/dist-web/assets/{journeyDiagram-JHISSGLW-CrSmLI8k.js → journeyDiagram-JHISSGLW-DOzvgBoA.js} +1 -1
  55. package/dist-web/assets/{kanban-definition-UN3LZRKU-jB_Pkb2G.js → kanban-definition-UN3LZRKU-BGc6pe_I.js} +1 -1
  56. package/dist-web/assets/{linear-BmZe-JSe.js → linear-BpZOijWC.js} +1 -1
  57. package/dist-web/assets/{mermaid.core-kJp9v7BU.js → mermaid.core-C_2qQ8rS.js} +4 -4
  58. package/dist-web/assets/{mindmap-definition-RKZ34NQL-BygLhP5m.js → mindmap-definition-RKZ34NQL-DkMM_7Yr.js} +1 -1
  59. package/dist-web/assets/{pieDiagram-4H26LBE5-CERgWyaB.js → pieDiagram-4H26LBE5-1TkSQl-I.js} +1 -1
  60. package/dist-web/assets/{quadrantDiagram-W4KKPZXB-BA_bITko.js → quadrantDiagram-W4KKPZXB-cmPoFli_.js} +1 -1
  61. package/dist-web/assets/{requirementDiagram-4Y6WPE33-BkZUv4kJ.js → requirementDiagram-4Y6WPE33-BRm2ySws.js} +1 -1
  62. package/dist-web/assets/{sankeyDiagram-5OEKKPKP-DpAA7Nm0.js → sankeyDiagram-5OEKKPKP-Bm7c5KA3.js} +1 -1
  63. package/dist-web/assets/{sequenceDiagram-3UESZ5HK-D1A1wk57.js → sequenceDiagram-3UESZ5HK-TsJi1UnU.js} +1 -1
  64. package/dist-web/assets/{stateDiagram-AJRCARHV-GNvrUmkz.js → stateDiagram-AJRCARHV-C96-LO_W.js} +1 -1
  65. package/dist-web/assets/stateDiagram-v2-BHNVJYJU-DyP066tY.js +1 -0
  66. package/dist-web/assets/{timeline-definition-PNZ67QCA-GEOSAbn6.js → timeline-definition-PNZ67QCA-CXS_QOle.js} +1 -1
  67. package/dist-web/assets/{vennDiagram-CIIHVFJN-D_IwvMPq.js → vennDiagram-CIIHVFJN-C2GyjnKb.js} +1 -1
  68. package/dist-web/assets/{wardley-L42UT6IY-CpNQq-PK.js → wardley-L42UT6IY-B4Z1vQiy.js} +1 -1
  69. package/dist-web/assets/{wardleyDiagram-YWT4CUSO-DjyTS7lS.js → wardleyDiagram-YWT4CUSO-C4rdUwqJ.js} +1 -1
  70. package/dist-web/assets/{xychartDiagram-2RQKCTM6-Bi0kYEuJ.js → xychartDiagram-2RQKCTM6-ldEuZMCT.js} +1 -1
  71. package/dist-web/index.html +1 -1
  72. package/package.json +5 -1
  73. package/templates/strikethroo/config/templates/UPDATE_NOTICE_TEMPLATE.md +1 -0
  74. package/dist-web/assets/channel-BJWsQ6W2.js +0 -1
  75. package/dist-web/assets/classDiagram-4FO5ZUOK-yCIjCNKh.js +0 -1
  76. package/dist-web/assets/classDiagram-v2-Q7XG4LA2-yCIjCNKh.js +0 -1
  77. package/dist-web/assets/stateDiagram-v2-BHNVJYJU-DkJ7czmr.js +0 -1
  78. package/templates/harness/skills/st-code-review/SKILL.md +0 -52
  79. package/templates/harness/skills/st-code-review/references/review-example.xml.md +0 -18
  80. package/templates/harness/skills/st-code-review/scripts/code-review.cjs +0 -3887
  81. package/templates/harness/skills/st-code-review/scripts/find-strikethroo-root.cjs +0 -116
  82. package/templates/harness/skills/st-code-review/scripts/validate-plan-blueprint.cjs +0 -429
  83. package/templates/harness/skills/st-create-plan/SKILL.md +0 -100
  84. package/templates/harness/skills/st-create-plan/scripts/find-strikethroo-root.cjs +0 -116
  85. package/templates/harness/skills/st-create-plan/scripts/get-next-plan-id.cjs +0 -197
  86. package/templates/harness/skills/st-execute-blueprint/SKILL.md +0 -184
  87. package/templates/harness/skills/st-execute-blueprint/scripts/capture-base-commit.cjs +0 -330
  88. package/templates/harness/skills/st-execute-blueprint/scripts/check-phase-readiness.cjs +0 -471
  89. package/templates/harness/skills/st-execute-blueprint/scripts/create-feature-branch.cjs +0 -374
  90. package/templates/harness/skills/st-execute-blueprint/scripts/dispatch-task-execution.cjs +0 -6815
  91. package/templates/harness/skills/st-execute-blueprint/scripts/find-strikethroo-root.cjs +0 -116
  92. package/templates/harness/skills/st-execute-blueprint/scripts/validate-plan-blueprint.cjs +0 -429
  93. package/templates/harness/skills/st-execute-task/SKILL.md +0 -138
  94. package/templates/harness/skills/st-execute-task/scripts/check-task-dependencies.cjs +0 -462
  95. package/templates/harness/skills/st-execute-task/scripts/dispatch-task-execution.cjs +0 -6815
  96. package/templates/harness/skills/st-execute-task/scripts/find-strikethroo-root.cjs +0 -116
  97. package/templates/harness/skills/st-execute-task/scripts/validate-plan-blueprint.cjs +0 -429
  98. package/templates/harness/skills/st-full-workflow/SKILL.md +0 -453
  99. package/templates/harness/skills/st-full-workflow/references/complexity-rubric.md +0 -8
  100. package/templates/harness/skills/st-full-workflow/scripts/capture-base-commit.cjs +0 -330
  101. package/templates/harness/skills/st-full-workflow/scripts/check-phase-readiness.cjs +0 -471
  102. package/templates/harness/skills/st-full-workflow/scripts/create-feature-branch.cjs +0 -374
  103. package/templates/harness/skills/st-full-workflow/scripts/dispatch-task-execution.cjs +0 -6815
  104. package/templates/harness/skills/st-full-workflow/scripts/find-strikethroo-root.cjs +0 -116
  105. package/templates/harness/skills/st-full-workflow/scripts/get-next-plan-id.cjs +0 -197
  106. package/templates/harness/skills/st-full-workflow/scripts/get-next-task-id.cjs +0 -295
  107. package/templates/harness/skills/st-full-workflow/scripts/route-task-execution.cjs +0 -2874
  108. package/templates/harness/skills/st-full-workflow/scripts/validate-plan-blueprint.cjs +0 -429
  109. package/templates/harness/skills/st-generate-tasks/SKILL.md +0 -207
  110. package/templates/harness/skills/st-generate-tasks/references/complexity-rubric.md +0 -8
  111. package/templates/harness/skills/st-generate-tasks/scripts/find-strikethroo-root.cjs +0 -116
  112. package/templates/harness/skills/st-generate-tasks/scripts/get-next-task-id.cjs +0 -295
  113. package/templates/harness/skills/st-generate-tasks/scripts/route-task-execution.cjs +0 -2874
  114. package/templates/harness/skills/st-generate-tasks/scripts/validate-plan-blueprint.cjs +0 -429
  115. package/templates/harness/skills/st-refine-plan/SKILL.md +0 -121
  116. package/templates/harness/skills/st-refine-plan/scripts/find-strikethroo-root.cjs +0 -116
  117. package/templates/harness/skills/st-refine-plan/scripts/validate-plan-blueprint.cjs +0 -429
@@ -1,471 +0,0 @@
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/check-phase-readiness.ts
31
- var check_phase_readiness_exports = {};
32
- __export(check_phase_readiness_exports, {
33
- main: () => main
34
- });
35
- module.exports = __toCommonJS(check_phase_readiness_exports);
36
- var fs5 = __toESM(require("fs"));
37
-
38
- // src/skill-scripts/shared/blueprint-parse.ts
39
- var BLUEPRINT_SECTION_RE = /^##[ \t]+Execution Blueprint[ \t]*$/m;
40
- var PHASE_HEADING_RE = /^###[ \t]+(?:✅[ \t]*)?Phase[ \t]+(\d+)[ \t]*:?[ \t]*(.*?)[ \t]*$/gm;
41
- var TASK_REF_RE = /Task[ \t]+0*(\d+)/i;
42
- var parseBlueprintPhases = (planBody) => {
43
- const sectionMatch = planBody.match(BLUEPRINT_SECTION_RE);
44
- if (!sectionMatch || sectionMatch.index === void 0) return void 0;
45
- const blueprint = planBody.slice(sectionMatch.index);
46
- const headings = [];
47
- PHASE_HEADING_RE.lastIndex = 0;
48
- let m;
49
- while ((m = PHASE_HEADING_RE.exec(blueprint)) !== null) {
50
- headings.push({
51
- index: m.index,
52
- afterHeading: m.index + m[0].length,
53
- name: (m[2] ?? "").trim()
54
- });
55
- }
56
- if (headings.length === 0) return void 0;
57
- const phases = [];
58
- for (let i = 0; i < headings.length; i++) {
59
- const current = headings[i];
60
- const next = headings[i + 1];
61
- const end = next ? next.index : blueprint.length;
62
- const segment = blueprint.slice(current.afterHeading, end);
63
- const taskIds = [];
64
- for (const line of segment.split(/\r?\n/)) {
65
- const trimmed = line.trim();
66
- if (!trimmed.startsWith("-") && !trimmed.startsWith("*")) continue;
67
- const ref = trimmed.match(TASK_REF_RE);
68
- if (ref && ref[1] !== void 0) {
69
- const id = parseInt(ref[1], 10);
70
- if (!Number.isNaN(id) && !taskIds.includes(id)) taskIds.push(id);
71
- }
72
- }
73
- phases.push({
74
- index: i + 1,
75
- name: current.name.length > 0 ? current.name : void 0,
76
- taskIds
77
- });
78
- }
79
- return phases;
80
- };
81
-
82
- // src/skill-scripts/shared/plan-resolve.ts
83
- var fs3 = __toESM(require("fs"));
84
- var path3 = __toESM(require("path"));
85
-
86
- // src/skill-scripts/shared/root.ts
87
- var fs = __toESM(require("fs"));
88
- var path = __toESM(require("path"));
89
- var EXPECTED_SCHEMA = true ? 4 : 4;
90
- var isValidStrikethrooRoot = (strikethrooPath) => {
91
- try {
92
- if (!fs.existsSync(strikethrooPath)) return false;
93
- if (!fs.lstatSync(strikethrooPath).isDirectory()) return false;
94
- const metadataPath = path.join(strikethrooPath, ".init-metadata.json");
95
- if (!fs.existsSync(metadataPath)) return false;
96
- const metadata = JSON.parse(fs.readFileSync(metadataPath, "utf8"));
97
- return metadata && typeof metadata === "object" && "version" in metadata;
98
- } catch (_err) {
99
- return false;
100
- }
101
- };
102
- var getStrikethrooAt = (directory) => {
103
- const strikethrooPath = path.join(directory, ".ai", "strikethroo");
104
- return isValidStrikethrooRoot(strikethrooPath) ? strikethrooPath : null;
105
- };
106
- var getParentPaths = (currentPath, acc = []) => {
107
- const absolutePath = path.resolve(currentPath);
108
- const nextAcc = [...acc, absolutePath];
109
- const parentPath = path.dirname(absolutePath);
110
- if (parentPath === absolutePath) return nextAcc;
111
- return getParentPaths(parentPath, nextAcc);
112
- };
113
- var checkWorkspaceSchema = (metadataPath) => {
114
- let metadata;
115
- try {
116
- metadata = JSON.parse(fs.readFileSync(metadataPath, "utf8"));
117
- } catch {
118
- return;
119
- }
120
- const actual = typeof metadata.workspaceSchemaVersion === "number" ? metadata.workspaceSchemaVersion : 1;
121
- if (actual === EXPECTED_SCHEMA) return;
122
- if (actual < EXPECTED_SCHEMA) {
123
- process.stderr.write(
124
- `Workspace schema v${actual} is older than this skill requires (v${EXPECTED_SCHEMA}). Re-run \`npx strikethroo init\` with the latest CLI to update.
125
- `
126
- );
127
- } else {
128
- process.stderr.write(
129
- `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.
130
- `
131
- );
132
- }
133
- process.exit(1);
134
- };
135
- var findStrikethrooRoot = (startPath = process.cwd()) => {
136
- const paths = getParentPaths(startPath);
137
- const found = paths.find((p) => getStrikethrooAt(p));
138
- if (!found) return null;
139
- const root = getStrikethrooAt(found);
140
- if (root) checkWorkspaceSchema(path.join(root, ".init-metadata.json"));
141
- return root;
142
- };
143
-
144
- // src/skill-scripts/shared/plan-scan.ts
145
- var fs2 = __toESM(require("fs"));
146
- var path2 = __toESM(require("path"));
147
-
148
- // src/skill-scripts/shared/frontmatter.ts
149
- var ID_PATTERNS = [
150
- /^\s*["']?id["']?\s*:\s*["']?([+-]?\d+)["']?\s*(?:#.*)?$/im,
151
- /^\s*id\s*:\s*([+-]?\d+)\s*(?:#.*)?$/im,
152
- /^\s*["']?id["']?\s*:\s*"([+-]?\d+)"\s*(?:#.*)?$/im,
153
- /^\s*["']?id["']?\s*:\s*'([+-]?\d+)'\s*(?:#.*)?$/im,
154
- /^\s*["']id["']\s*:\s*([+-]?\d+)\s*(?:#.*)?$/im,
155
- /^\s*id\s*:\s*[|>]\s*([+-]?\d+)\s*$/im
156
- ];
157
- var validateId = (rawId) => {
158
- const id = parseInt(rawId, 10);
159
- if (Number.isNaN(id) || id < 0 || id > Number.MAX_SAFE_INTEGER) return null;
160
- return id;
161
- };
162
- var extractIdFromMarkdown = (content) => {
163
- const frontmatterMatch = content.match(/^---\s*\r?\n([\s\S]*?)\r?\n---/);
164
- if (!frontmatterMatch || !frontmatterMatch[1]) return null;
165
- const block = frontmatterMatch[1];
166
- for (const pattern of ID_PATTERNS) {
167
- const match = block.match(pattern);
168
- if (match && match[1]) {
169
- const id = validateId(match[1]);
170
- if (id !== null) return id;
171
- }
172
- }
173
- return null;
174
- };
175
- var extractPlanId = (content, _filePath) => {
176
- return extractIdFromMarkdown(content);
177
- };
178
-
179
- // src/skill-scripts/shared/plan-scan.ts
180
- var PLAN_EXTENSIONS = [".md"];
181
- var scanPlanDir = (planDirPath, dirName, isArchive) => {
182
- let entries;
183
- try {
184
- entries = fs2.readdirSync(planDirPath, { withFileTypes: true });
185
- } catch (_err) {
186
- return [];
187
- }
188
- return entries.filter((e) => e.isFile() && PLAN_EXTENSIONS.some((ext) => e.name.endsWith(ext))).flatMap((e) => {
189
- const filePath = path2.join(planDirPath, e.name);
190
- try {
191
- const content = fs2.readFileSync(filePath, "utf8");
192
- const id = extractPlanId(content, filePath);
193
- if (id === null) return [];
194
- return [{ id, file: filePath, dir: planDirPath, isArchive, name: dirName }];
195
- } catch (_err) {
196
- return [];
197
- }
198
- });
199
- };
200
- var getAllPlans = (taskManagerRoot) => {
201
- const sources = [
202
- { dir: path2.join(taskManagerRoot, "plans"), isArchive: false },
203
- { dir: path2.join(taskManagerRoot, "archive"), isArchive: true }
204
- ];
205
- return sources.flatMap(({ dir, isArchive }) => {
206
- if (!fs2.existsSync(dir)) return [];
207
- let entries;
208
- try {
209
- entries = fs2.readdirSync(dir, { withFileTypes: true });
210
- } catch (_err) {
211
- return [];
212
- }
213
- return entries.filter((e) => e.isDirectory()).flatMap((e) => scanPlanDir(path2.join(dir, e.name), e.name, isArchive));
214
- });
215
- };
216
-
217
- // src/skill-scripts/shared/plan-resolve.ts
218
- var isValidRootDir = (strikethrooPath) => {
219
- try {
220
- if (!fs3.existsSync(strikethrooPath)) return false;
221
- if (!fs3.lstatSync(strikethrooPath).isDirectory()) return false;
222
- const metadataPath = path3.join(strikethrooPath, ".init-metadata.json");
223
- if (!fs3.existsSync(metadataPath)) return false;
224
- const metadata = JSON.parse(fs3.readFileSync(metadataPath, "utf8"));
225
- return metadata && typeof metadata === "object" && "version" in metadata;
226
- } catch (_err) {
227
- return false;
228
- }
229
- };
230
- var checkStandardRootShortcut = (filePath) => {
231
- const planDir = path3.dirname(filePath);
232
- const parentDir = path3.dirname(planDir);
233
- const possibleRoot = path3.dirname(parentDir);
234
- const parentBase = path3.basename(parentDir);
235
- if (parentBase !== "plans" && parentBase !== "archive") return null;
236
- if (path3.basename(possibleRoot) !== "strikethroo") return null;
237
- const dotAiDir = path3.dirname(possibleRoot);
238
- if (path3.basename(dotAiDir) !== ".ai") return null;
239
- return isValidRootDir(possibleRoot) ? possibleRoot : null;
240
- };
241
- var resolveByPath = (absolutePath) => {
242
- let content;
243
- try {
244
- content = fs3.readFileSync(absolutePath, "utf8");
245
- } catch (_err) {
246
- return null;
247
- }
248
- const planId = extractPlanId(content, absolutePath);
249
- if (planId === null) return null;
250
- const tmRoot = checkStandardRootShortcut(absolutePath) || findStrikethrooRoot(path3.dirname(absolutePath));
251
- if (!tmRoot) return null;
252
- return {
253
- planFile: absolutePath,
254
- planDir: path3.dirname(absolutePath),
255
- strikethrooRoot: tmRoot,
256
- planId
257
- };
258
- };
259
- var resolveByIdInAncestry = (planId, startPath, searched = /* @__PURE__ */ new Set()) => {
260
- const tmRoot = findStrikethrooRoot(startPath);
261
- if (!tmRoot) return null;
262
- const normalized = path3.normalize(tmRoot);
263
- if (searched.has(normalized)) return null;
264
- searched.add(normalized);
265
- const plans = getAllPlans(tmRoot);
266
- const match = plans.find((p) => p.id === planId);
267
- if (match) {
268
- return {
269
- planFile: match.file,
270
- planDir: match.dir,
271
- strikethrooRoot: tmRoot,
272
- planId
273
- };
274
- }
275
- const parentOfRoot = path3.dirname(path3.dirname(tmRoot));
276
- if (parentOfRoot === tmRoot) return null;
277
- return resolveByIdInAncestry(planId, parentOfRoot, searched);
278
- };
279
- var resolvePlan = (input, startPath = process.cwd()) => {
280
- if (input === null || input === void 0 || input === "") return null;
281
- const inputStr = String(input);
282
- if (inputStr.startsWith("/")) {
283
- return resolveByPath(inputStr);
284
- }
285
- const planId = parseInt(inputStr, 10);
286
- if (Number.isNaN(planId)) return null;
287
- return resolveByIdInAncestry(planId, startPath);
288
- };
289
-
290
- // src/skill-scripts/shared/task-file.ts
291
- var fs4 = __toESM(require("fs"));
292
- var path4 = __toESM(require("path"));
293
- var extractFrontmatter = (content) => {
294
- const match = content.match(/^---\s*\r?\n([\s\S]*?)\r?\n---/);
295
- return match && match[1] ? match[1] : null;
296
- };
297
- var findTaskFile = (planDir, taskId) => {
298
- const taskDir = path4.join(planDir, "tasks");
299
- if (!fs4.existsSync(taskDir)) return null;
300
- const idStr = String(taskId);
301
- const variations = [idStr, idStr.padStart(2, "0"), idStr.replace(/^0+/, "") || "0"];
302
- const uniqueVariations = [...new Set(variations)];
303
- try {
304
- const files = fs4.readdirSync(taskDir);
305
- return uniqueVariations.reduce((acc, v) => {
306
- if (acc) return acc;
307
- const match = files.find((f) => f.startsWith(`${v}--`) && f.endsWith(".md"));
308
- return match ? path4.join(taskDir, match) : null;
309
- }, null) ?? null;
310
- } catch (_err) {
311
- return null;
312
- }
313
- };
314
- var extractDependencies = (frontmatter) => {
315
- const lines = frontmatter.split("\n");
316
- const dependencies = [];
317
- let inDependenciesSection = false;
318
- for (const line of lines) {
319
- if (line.match(/^dependencies:/)) {
320
- inDependenciesSection = true;
321
- const arrayMatch = line.match(/\[(.*)\]/);
322
- if (arrayMatch && arrayMatch[1]) {
323
- const deps = arrayMatch[1].split(",").map((dep) => dep.trim().replace(/['"]/g, "")).filter((dep) => dep.length > 0);
324
- dependencies.push(...deps);
325
- inDependenciesSection = false;
326
- }
327
- continue;
328
- }
329
- if (inDependenciesSection && line.match(/^[^ ]/) && !line.match(/^[ \t]*-/)) {
330
- inDependenciesSection = false;
331
- }
332
- if (inDependenciesSection && line.match(/^[ \t]*-/)) {
333
- const dep = line.replace(/^[ \t]*-[ \t]*/, "").replace(/[ \t]*$/, "").replace(/['"]/g, "");
334
- if (dep.length > 0) dependencies.push(dep);
335
- }
336
- }
337
- return dependencies;
338
- };
339
- var extractStatus = (frontmatter) => {
340
- for (const line of frontmatter.split("\n")) {
341
- if (line.match(/^status:/)) {
342
- return line.replace(/^status:[ \t]*/, "").replace(/^["']/, "").replace(/["']$/, "").trim();
343
- }
344
- }
345
- return null;
346
- };
347
- var collectTaskReadinessIssues = (planDir, taskId) => {
348
- const issues = [];
349
- const taskFile = findTaskFile(planDir, taskId);
350
- const idLabel = String(taskId);
351
- if (!taskFile || !fs4.existsSync(taskFile)) {
352
- issues.push({ taskId: idLabel, kind: "missing", detail: "task file not found" });
353
- return issues;
354
- }
355
- const taskContent = fs4.readFileSync(taskFile, "utf8");
356
- const frontmatter = extractFrontmatter(taskContent);
357
- if (!frontmatter) {
358
- issues.push({ taskId: idLabel, kind: "missing", detail: "task frontmatter not found" });
359
- return issues;
360
- }
361
- const status = extractStatus(frontmatter);
362
- if (status === "needs-clarification") {
363
- issues.push({
364
- taskId: idLabel,
365
- kind: "needs-clarification",
366
- detail: "status is needs-clarification"
367
- });
368
- }
369
- for (const depId of extractDependencies(frontmatter)) {
370
- const depFile = findTaskFile(planDir, depId);
371
- if (!depFile || !fs4.existsSync(depFile)) {
372
- issues.push({
373
- taskId: idLabel,
374
- kind: "unresolved-dependency",
375
- detail: `dependency ${depId} not found`
376
- });
377
- continue;
378
- }
379
- const depContent = fs4.readFileSync(depFile, "utf8");
380
- const depFrontmatter = extractFrontmatter(depContent);
381
- if (!depFrontmatter) {
382
- issues.push({
383
- taskId: idLabel,
384
- kind: "unresolved-dependency",
385
- detail: `dependency ${depId} has no frontmatter`
386
- });
387
- continue;
388
- }
389
- const depStatus = extractStatus(depFrontmatter);
390
- if (depStatus !== "completed") {
391
- issues.push({
392
- taskId: idLabel,
393
- kind: "unresolved-dependency",
394
- detail: `dependency ${depId} status is ${depStatus ?? "unknown"}`
395
- });
396
- }
397
- }
398
- return issues;
399
- };
400
-
401
- // src/skill-scripts/check-phase-readiness.ts
402
- var _printError = (message) => {
403
- console.error(`ERROR: ${message}`);
404
- };
405
- var _printSuccess = (message) => {
406
- console.log(`\u2713 ${message}`);
407
- };
408
- var _printInfo = (message) => {
409
- console.log(message);
410
- };
411
- var main = (startPath = process.cwd()) => {
412
- if (process.argv.length !== 4) {
413
- _printError("Invalid number of arguments");
414
- console.log("Usage: node check-phase-readiness.cjs <plan-id-or-path> <phase-number>");
415
- console.log("Example: node check-phase-readiness.cjs 16 1");
416
- process.exit(1);
417
- }
418
- const inputId = process.argv[2];
419
- const phaseNumber = parseInt(process.argv[3], 10);
420
- if (Number.isNaN(phaseNumber) || phaseNumber < 1) {
421
- _printError("Phase number must be a positive integer");
422
- process.exit(1);
423
- }
424
- const resolved = resolvePlan(inputId, startPath);
425
- if (!resolved) {
426
- _printError(`Plan "${inputId}" not found or invalid`);
427
- process.exit(1);
428
- }
429
- const { planDir, planFile, planId } = resolved;
430
- const planBody = fs5.readFileSync(planFile, "utf8");
431
- const phases = parseBlueprintPhases(planBody);
432
- if (!phases || phases.length === 0) {
433
- _printError("No Execution Blueprint section with phases found in plan");
434
- process.exit(1);
435
- }
436
- const phase = phases.find((p) => p.index === phaseNumber);
437
- if (!phase) {
438
- _printError(`Phase ${phaseNumber} not found in plan ${planId}`);
439
- process.exit(1);
440
- }
441
- _printInfo(`Checking phase ${phaseNumber} readiness for plan ${planId}`);
442
- if (phase.name) _printInfo(`Phase name: ${phase.name}`);
443
- if (phase.taskIds.length === 0) {
444
- _printError(`Phase ${phaseNumber} has no tasks listed in the blueprint`);
445
- process.exit(1);
446
- }
447
- _printInfo(`Tasks in phase: ${phase.taskIds.join(", ")}`);
448
- console.log("");
449
- const allIssues = phase.taskIds.flatMap(
450
- (taskId) => collectTaskReadinessIssues(planDir, taskId).map((issue) => ({
451
- ...issue,
452
- phaseTaskId: String(taskId)
453
- }))
454
- );
455
- if (allIssues.length === 0) {
456
- _printSuccess(`Phase ${phaseNumber} is ready to execute`);
457
- process.exit(0);
458
- }
459
- _printError(`Phase ${phaseNumber} is not ready:`);
460
- for (const issue of allIssues) {
461
- console.log(` - Task ${issue.phaseTaskId}: ${issue.detail}`);
462
- }
463
- process.exit(1);
464
- };
465
- if (require.main === module) {
466
- main();
467
- }
468
- // Annotate the CommonJS export names for ESM import in node:
469
- 0 && (module.exports = {
470
- main
471
- });