strikethroo 3.6.0 → 3.7.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 (63) hide show
  1. package/dist-web/assets/{arc-C5tFWQfy.js → arc-xFaTbwSI.js} +1 -1
  2. package/dist-web/assets/{architectureDiagram-3BPJPVTR-DgCKGG7t.js → architectureDiagram-3BPJPVTR-Xz0i2dF0.js} +1 -1
  3. package/dist-web/assets/{blockDiagram-GPEHLZMM-BCkOJRns.js → blockDiagram-GPEHLZMM-BdKR7Rki.js} +1 -1
  4. package/dist-web/assets/{c4Diagram-AAUBKEIU-CSRTvUCD.js → c4Diagram-AAUBKEIU-DAayjcH7.js} +1 -1
  5. package/dist-web/assets/channel-Cmb5ngmL.js +1 -0
  6. package/dist-web/assets/{chunk-2J33WTMH-ClcerQV2.js → chunk-2J33WTMH-D4OfjzqG.js} +1 -1
  7. package/dist-web/assets/{chunk-4BX2VUAB-CbmeOs5K.js → chunk-4BX2VUAB-Ds6twHLE.js} +1 -1
  8. package/dist-web/assets/{chunk-55IACEB6-Bul5AABk.js → chunk-55IACEB6-CoVGj0A6.js} +1 -1
  9. package/dist-web/assets/{chunk-727SXJPM-CgLGtlrF.js → chunk-727SXJPM--kGZcEL_.js} +1 -1
  10. package/dist-web/assets/{chunk-AQP2D5EJ-DL7JPYWy.js → chunk-AQP2D5EJ-dK8X6Knv.js} +1 -1
  11. package/dist-web/assets/{chunk-FMBD7UC4-CGHZbLY6.js → chunk-FMBD7UC4-CIkH8fwk.js} +1 -1
  12. package/dist-web/assets/{chunk-ND2GUHAM-CvBKPRCq.js → chunk-ND2GUHAM-BqrY0fV2.js} +1 -1
  13. package/dist-web/assets/{chunk-QZHKN3VN-DQBIVpdk.js → chunk-QZHKN3VN-Bx8TPE1r.js} +1 -1
  14. package/dist-web/assets/classDiagram-4FO5ZUOK-Dh2pEfOy.js +1 -0
  15. package/dist-web/assets/classDiagram-v2-Q7XG4LA2-Dh2pEfOy.js +1 -0
  16. package/dist-web/assets/{cose-bilkent-S5V4N54A-eh3JaEY5.js → cose-bilkent-S5V4N54A-PyZxi1yI.js} +1 -1
  17. package/dist-web/assets/{dagre-BM42HDAG-EJD5vp_w.js → dagre-BM42HDAG-yXPAIOqC.js} +1 -1
  18. package/dist-web/assets/{diagram-2AECGRRQ-BZ_P79sY.js → diagram-2AECGRRQ-DDkzzAIo.js} +1 -1
  19. package/dist-web/assets/{diagram-5GNKFQAL-OQ7nHA8w.js → diagram-5GNKFQAL-BD_aXIRb.js} +1 -1
  20. package/dist-web/assets/{diagram-KO2AKTUF-DdbHiG9U.js → diagram-KO2AKTUF-rntOw_IG.js} +1 -1
  21. package/dist-web/assets/{diagram-LMA3HP47-DtYxc1U-.js → diagram-LMA3HP47-BAB3HQQs.js} +1 -1
  22. package/dist-web/assets/{diagram-OG6HWLK6-DiYlNb2D.js → diagram-OG6HWLK6-CwTzozdw.js} +1 -1
  23. package/dist-web/assets/{erDiagram-TEJ5UH35-CfACqBE8.js → erDiagram-TEJ5UH35-BW-Ha54s.js} +1 -1
  24. package/dist-web/assets/{flowDiagram-I6XJVG4X-XjbGJa2k.js → flowDiagram-I6XJVG4X-AGkxH_mx.js} +1 -1
  25. package/dist-web/assets/{ganttDiagram-6RSMTGT7-uEIeokwH.js → ganttDiagram-6RSMTGT7--ZS9LkZ2.js} +1 -1
  26. package/dist-web/assets/{gitGraphDiagram-PVQCEYII-nmf5n0DJ.js → gitGraphDiagram-PVQCEYII-D4KfIxPI.js} +1 -1
  27. package/dist-web/assets/{index-lcDf4NjX.js → index-BN30VZfQ.js} +1 -1
  28. package/dist-web/assets/{index-DNjRW3Nz.js → index-IHSMZO2U.js} +1 -1
  29. package/dist-web/assets/{index-BDUuRubV.js → index-uk0kSvAs.js} +4 -4
  30. package/dist-web/assets/{infoDiagram-5YYISTIA-ce27RWm0.js → infoDiagram-5YYISTIA-D_Z40zdo.js} +1 -1
  31. package/dist-web/assets/{ishikawaDiagram-YF4QCWOH-D6Wresga.js → ishikawaDiagram-YF4QCWOH-CGzxJ2vS.js} +1 -1
  32. package/dist-web/assets/{journeyDiagram-JHISSGLW-BBl3RVug.js → journeyDiagram-JHISSGLW-DLtpX1Ni.js} +1 -1
  33. package/dist-web/assets/{kanban-definition-UN3LZRKU-BR4xuvyK.js → kanban-definition-UN3LZRKU-C4_O7GEC.js} +1 -1
  34. package/dist-web/assets/{linear-t7m4QGzs.js → linear-BoMijEDN.js} +1 -1
  35. package/dist-web/assets/{mermaid.core-BrBzpjFi.js → mermaid.core-B7AM5BmV.js} +4 -4
  36. package/dist-web/assets/{mindmap-definition-RKZ34NQL-BtLQxP_O.js → mindmap-definition-RKZ34NQL-b8o1AjHb.js} +1 -1
  37. package/dist-web/assets/{pieDiagram-4H26LBE5-DRJmqIpA.js → pieDiagram-4H26LBE5-D7BGsvW4.js} +1 -1
  38. package/dist-web/assets/{quadrantDiagram-W4KKPZXB-CE2Oh9Rc.js → quadrantDiagram-W4KKPZXB-BOsVmBQ_.js} +1 -1
  39. package/dist-web/assets/{requirementDiagram-4Y6WPE33-sG5PEAU3.js → requirementDiagram-4Y6WPE33-BwuELhlD.js} +1 -1
  40. package/dist-web/assets/{sankeyDiagram-5OEKKPKP-CArsTW6e.js → sankeyDiagram-5OEKKPKP-DDoQnSJz.js} +1 -1
  41. package/dist-web/assets/{sequenceDiagram-3UESZ5HK-CSEbWgF8.js → sequenceDiagram-3UESZ5HK-Dto9SgGd.js} +1 -1
  42. package/dist-web/assets/{stateDiagram-AJRCARHV-CPia1lq4.js → stateDiagram-AJRCARHV-Dx0qn_5x.js} +1 -1
  43. package/dist-web/assets/stateDiagram-v2-BHNVJYJU-qo6que2v.js +1 -0
  44. package/dist-web/assets/{timeline-definition-PNZ67QCA-BW5V8Z8D.js → timeline-definition-PNZ67QCA-Dbhzc3Xh.js} +1 -1
  45. package/dist-web/assets/{vennDiagram-CIIHVFJN-BeCuGgz0.js → vennDiagram-CIIHVFJN-BEUtD6fT.js} +1 -1
  46. package/dist-web/assets/{wardley-L42UT6IY-DIy_1BDw.js → wardley-L42UT6IY-CqNfcWnP.js} +1 -1
  47. package/dist-web/assets/{wardleyDiagram-YWT4CUSO-DV4cijhj.js → wardleyDiagram-YWT4CUSO-Co_bCOQZ.js} +1 -1
  48. package/dist-web/assets/{xychartDiagram-2RQKCTM6-DfIJ29y1.js → xychartDiagram-2RQKCTM6-CguzZIIB.js} +1 -1
  49. package/dist-web/index.html +1 -1
  50. package/package.json +3 -3
  51. package/templates/harness/skills/st-execute-blueprint/SKILL.md +4 -2
  52. package/templates/harness/skills/st-execute-blueprint/scripts/check-phase-readiness.cjs +471 -0
  53. package/templates/harness/skills/st-execute-blueprint/scripts/create-feature-branch.cjs +16 -8
  54. package/templates/harness/skills/st-execute-task/scripts/check-task-dependencies.cjs +113 -71
  55. package/templates/harness/skills/st-full-workflow/SKILL.md +4 -2
  56. package/templates/harness/skills/st-full-workflow/scripts/check-phase-readiness.cjs +471 -0
  57. package/templates/harness/skills/st-full-workflow/scripts/create-feature-branch.cjs +16 -8
  58. package/templates/strikethroo/config/hooks/POST_PHASE.md +5 -4
  59. package/templates/strikethroo/config/hooks/PRE_PHASE.md +0 -13
  60. package/dist-web/assets/channel-BaPw1Rvz.js +0 -1
  61. package/dist-web/assets/classDiagram-4FO5ZUOK-C35Ivx5Q.js +0 -1
  62. package/dist-web/assets/classDiagram-v2-Q7XG4LA2-C35Ivx5Q.js +0 -1
  63. package/dist-web/assets/stateDiagram-v2-BHNVJYJU-CR8eRw1b.js +0 -1
@@ -0,0 +1,471 @@
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 ? 2 : 2;
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
+ });
@@ -280,14 +280,13 @@ var _hasUncommittedChanges = () => {
280
280
  return status !== null && status.length > 0;
281
281
  };
282
282
  var _branchExists = (branchName) => {
283
- const localBranches = execGit("git branch --list");
284
- if (localBranches && localBranches.split("\n").some((b) => b.trim().replace("* ", "") === branchName)) {
285
- return true;
286
- }
287
- const remoteBranches = execGit("git branch -r --list");
288
- if (remoteBranches && remoteBranches.split("\n").some((b) => b.trim().includes(branchName))) {
289
- return true;
283
+ const localMatch = execGit(`git branch --list "${branchName}"`);
284
+ if (localMatch) {
285
+ const names = localMatch.split("\n").map((b) => b.trim().replace(/^\*\s*/, "")).filter(Boolean);
286
+ if (names.includes(branchName)) return true;
290
287
  }
288
+ const remoteMatch = execGit(`git branch -r --list "origin/${branchName}"`);
289
+ if (remoteMatch && remoteMatch.trim().length > 0) return true;
291
290
  return false;
292
291
  };
293
292
  var _sanitizeBranchName = (planName) => {
@@ -336,8 +335,17 @@ var main = (startPath = process.cwd()) => {
336
335
  const sanitizedName = _sanitizeBranchName(planName);
337
336
  const branchName = `feature/${planId}--${sanitizedName}`;
338
337
  if (_branchExists(branchName)) {
338
+ if (currentBranch === branchName) {
339
+ _printSuccess(`Already on branch: ${branchName}`);
340
+ process.exit(0);
341
+ }
339
342
  _printWarning(`Branch "${branchName}" already exists`);
340
- _printInfo("Proceeding with existing branch");
343
+ const checkoutResult = execGit(`git checkout "${branchName}"`);
344
+ if (checkoutResult === null) {
345
+ _printError(`Failed to checkout branch "${branchName}"`);
346
+ process.exit(1);
347
+ }
348
+ _printSuccess(`Switched to existing branch: ${branchName}`);
341
349
  process.exit(0);
342
350
  }
343
351
  const createResult = execGit(`git checkout -b "${branchName}"`);