@bicorne/task-flow 0.1.0 → 0.2.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.
- package/README.md +337 -145
- package/SKILL.md +9 -5
- package/assets/.harnessrc +0 -1
- package/dist/commands/analyze.js +160 -318
- package/dist/commands/archive.js +44 -48
- package/dist/commands/design.js +225 -400
- package/dist/commands/extract.js +174 -303
- package/dist/commands/init.js +103 -148
- package/dist/commands/merge/index.js +184 -295
- package/dist/commands/merge/merger.js +112 -134
- package/dist/commands/merge/types.js +3 -5
- package/dist/commands/merge/validators.js +115 -132
- package/dist/commands/merge.js +46 -13
- package/dist/commands/start.js +155 -248
- package/dist/commands/status.js +68 -129
- package/dist/commands/sync.js +37 -53
- package/dist/commands/tasks-gen/doc-parser.js +148 -228
- package/dist/commands/tasks-gen/generators.js +104 -116
- package/dist/commands/tasks-gen/index.js +206 -314
- package/dist/commands/tasks-gen/parsers.js +131 -232
- package/dist/commands/tasks-gen/templates.js +9 -10
- package/dist/commands/tasks-gen/types.js +36 -14
- package/dist/commands/tasks-gen/validators.js +33 -49
- package/dist/commands/tasks.js +58 -20
- package/dist/commands/worktree.js +167 -249
- package/dist/hooks/check-prd-exists.js +45 -55
- package/dist/hooks/check-worktree-conflict.js +68 -101
- package/dist/hooks/hook-runner/executor.js +134 -126
- package/dist/hooks/hook-runner/index.js +181 -196
- package/dist/hooks/hook-runner/loader.js +74 -113
- package/dist/hooks/hook-runner/types.js +3 -5
- package/dist/hooks/hook-runner.js +94 -28
- package/dist/hooks/phase-complete-detector.js +125 -191
- package/dist/hooks/phase-gate-validator.js +315 -376
- package/dist/hooks/save-checkpoint.js +87 -130
- package/dist/hooks/start-mcp-servers.js +50 -65
- package/dist/hooks/stop-mcp-servers.js +40 -49
- package/dist/index.js +84 -153
- package/dist/lib/archive.js +126 -209
- package/dist/lib/config.d.ts +0 -2
- package/dist/lib/config.js +141 -230
- package/dist/lib/constants.js +155 -145
- package/dist/lib/interactive.js +98 -148
- package/dist/lib/mcp-client.js +197 -320
- package/dist/lib/state.js +142 -253
- package/dist/slash/executor.js +309 -233
- package/dist/slash/index.js +69 -43
- package/dist/slash/parser.js +84 -97
- package/dist/slash/registry.js +100 -88
- package/dist/spec/openspec-to-task/builders.js +96 -109
- package/dist/spec/openspec-to-task/index.js +112 -173
- package/dist/spec/openspec-to-task/parsers.js +148 -219
- package/dist/spec/openspec-to-task/types.js +3 -5
- package/dist/spec/sync-openspec-to-task.js +47 -19
- package/dist/spec/sync-task-to-openspec.js +241 -272
- package/dist/types/ai-context.js +3 -8
- package/package.json +9 -7
- package/references/CLI-TUTORIAL.md +4 -10
|
@@ -1,107 +1,74 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
if (
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
18
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
19
|
-
}) : function(o, v) {
|
|
20
|
-
o["default"] = v;
|
|
21
|
-
});
|
|
22
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
23
|
-
var ownKeys = function(o) {
|
|
24
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
25
|
-
var ar = [];
|
|
26
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
27
|
-
return ar;
|
|
28
|
-
};
|
|
29
|
-
return ownKeys(o);
|
|
1
|
+
let e, t, r;
|
|
2
|
+
function o(e) {
|
|
3
|
+
return "function" != typeof WeakMap ? null : (o = function(e) {
|
|
4
|
+
return new WeakMap();
|
|
5
|
+
})(e);
|
|
6
|
+
}
|
|
7
|
+
function n(e, t) {
|
|
8
|
+
if (!e || 'string' != typeof e) return '';
|
|
9
|
+
let r = a.isAbsolute(e) ? e : a.resolve(t, e);
|
|
10
|
+
return a.relative(t, r).replace(/\\/g, '/');
|
|
11
|
+
}
|
|
12
|
+
function i(e) {
|
|
13
|
+
let { input: t, config: r } = e, o = process.env.WORKTREE_NAME, i = (0, s.getActiveWorktrees)(r);
|
|
14
|
+
if (i.length <= 1) return {
|
|
15
|
+
conflict: !1,
|
|
16
|
+
reason: 'single-worktree'
|
|
30
17
|
};
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
18
|
+
let l = n(t.tool_input?.file_path || t.tool_input?.path, r.projectRoot);
|
|
19
|
+
if (!l) return {
|
|
20
|
+
conflict: !1,
|
|
21
|
+
reason: 'no-file-path'
|
|
22
|
+
};
|
|
23
|
+
for (let e of i)if (e.name !== o && (e.pendingChanges || []).map((e)=>n(e, r.projectRoot)).filter(Boolean).includes(l)) return {
|
|
24
|
+
conflict: !0,
|
|
25
|
+
file: l,
|
|
26
|
+
conflictingWorktree: e.name,
|
|
27
|
+
message: `File ${l} is being modified by ${e.name}`
|
|
28
|
+
};
|
|
29
|
+
return {
|
|
30
|
+
conflict: !1,
|
|
31
|
+
reason: 'no-conflict'
|
|
37
32
|
};
|
|
38
|
-
})();
|
|
39
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
40
|
-
exports.normalizePath = normalizePath;
|
|
41
|
-
exports.checkWorktreeConflict = checkWorktreeConflict;
|
|
42
|
-
const path = __importStar(require("path"));
|
|
43
|
-
const config_1 = require("../lib/config");
|
|
44
|
-
const state_1 = require("../lib/state");
|
|
45
|
-
function normalizePath(inputPath, projectRoot) {
|
|
46
|
-
if (!inputPath || typeof inputPath !== 'string') {
|
|
47
|
-
return '';
|
|
48
|
-
}
|
|
49
|
-
const absolutePath = path.isAbsolute(inputPath) ? inputPath : path.resolve(projectRoot, inputPath);
|
|
50
|
-
return path.relative(projectRoot, absolutePath).replace(/\\/g, '/');
|
|
51
33
|
}
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
const targetFile = normalizePath(input.tool_input?.file_path || input.tool_input?.path, config.projectRoot);
|
|
66
|
-
if (!targetFile) {
|
|
67
|
-
return { conflict: false, reason: 'no-file-path' };
|
|
68
|
-
}
|
|
69
|
-
// Check if other active worktrees are modifying the same file
|
|
70
|
-
for (const wt of activeWorktrees) {
|
|
71
|
-
if (wt.name !== currentWorktree) {
|
|
72
|
-
const wtChanges = (wt.pendingChanges || [])
|
|
73
|
-
.map((p) => normalizePath(p, config.projectRoot))
|
|
74
|
-
.filter(Boolean);
|
|
75
|
-
if (wtChanges.includes(targetFile)) {
|
|
76
|
-
return {
|
|
77
|
-
conflict: true,
|
|
78
|
-
file: targetFile,
|
|
79
|
-
conflictingWorktree: wt.name,
|
|
80
|
-
message: `File ${targetFile} is being modified by ${wt.name}`,
|
|
81
|
-
};
|
|
82
|
-
}
|
|
83
|
-
}
|
|
34
|
+
"use strict";
|
|
35
|
+
Object.defineProperty(exports, "__esModule", {
|
|
36
|
+
value: !0
|
|
37
|
+
});
|
|
38
|
+
var l = exports, c = {
|
|
39
|
+
get checkWorktreeConflict () {
|
|
40
|
+
return i;
|
|
41
|
+
},
|
|
42
|
+
get default () {
|
|
43
|
+
return p;
|
|
44
|
+
},
|
|
45
|
+
get normalizePath () {
|
|
46
|
+
return n;
|
|
84
47
|
}
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
function
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
(
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
48
|
+
};
|
|
49
|
+
for(var f in c)Object.defineProperty(l, f, {
|
|
50
|
+
enumerable: !0,
|
|
51
|
+
get: Object.getOwnPropertyDescriptor(c, f).get
|
|
52
|
+
});
|
|
53
|
+
let a = /*#__PURE__*/ function(e) {
|
|
54
|
+
var t, r, n;
|
|
55
|
+
if (e && e.__esModule) return e;
|
|
56
|
+
if (null === e || "object" != typeof e && "function" != typeof e) return {
|
|
57
|
+
default: e
|
|
58
|
+
};
|
|
59
|
+
if ((t = o(void 0)) && t.has(e)) return t.get(e);
|
|
60
|
+
for(var i in r = {
|
|
61
|
+
__proto__: null
|
|
62
|
+
}, n = Object.defineProperty && Object.getOwnPropertyDescriptor, e)if ("default" !== i && Object.prototype.hasOwnProperty.call(e, i)) {
|
|
63
|
+
var l = n ? Object.getOwnPropertyDescriptor(e, i) : null;
|
|
64
|
+
l && (l.get || l.set) ? Object.defineProperty(r, i, l) : r[i] = e[i];
|
|
99
65
|
}
|
|
100
|
-
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
66
|
+
return r.default = e, t && t.set(e, r), r;
|
|
67
|
+
}(require("path")), u = require("../lib/config"), s = require("../lib/state");
|
|
68
|
+
require.main === module && (e = JSON.parse(process.argv[2] || '{}'), t = (0, u.loadConfig)(), (0, s.loadState)(t), (r = i({
|
|
69
|
+
input: e,
|
|
70
|
+
config: t
|
|
71
|
+
})).conflict && (console.error(`[CONFLICT] ${r.message}`), console.error(`[CONFLICT] Suggestion: Wait for ${r.conflictingWorktree} to complete or use a different file`), process.exit(2)), process.exit(0));
|
|
72
|
+
let p = {
|
|
73
|
+
checkWorktreeConflict: i
|
|
107
74
|
};
|
|
@@ -1,143 +1,151 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
if (
|
|
10
|
-
|
|
1
|
+
function e(r) {
|
|
2
|
+
return "function" != typeof WeakMap ? null : (e = function(e) {
|
|
3
|
+
return new WeakMap();
|
|
4
|
+
})(r);
|
|
5
|
+
}
|
|
6
|
+
function r(r, o) {
|
|
7
|
+
var t, n, s;
|
|
8
|
+
if (!o && r && r.__esModule) return r;
|
|
9
|
+
if (null === r || "object" != typeof r && "function" != typeof r) return {
|
|
10
|
+
default: r
|
|
11
|
+
};
|
|
12
|
+
if ((t = e(o)) && t.has(r)) return t.get(r);
|
|
13
|
+
for(var c in n = {
|
|
14
|
+
__proto__: null
|
|
15
|
+
}, s = Object.defineProperty && Object.getOwnPropertyDescriptor, r)if ("default" !== c && Object.prototype.hasOwnProperty.call(r, c)) {
|
|
16
|
+
var u = s ? Object.getOwnPropertyDescriptor(r, c) : null;
|
|
17
|
+
u && (u.get || u.set) ? Object.defineProperty(n, c, u) : n[c] = r[c];
|
|
11
18
|
}
|
|
12
|
-
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
19
|
-
}) : function(o, v) {
|
|
20
|
-
o["default"] = v;
|
|
21
|
-
});
|
|
22
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
23
|
-
var ownKeys = function(o) {
|
|
24
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
25
|
-
var ar = [];
|
|
26
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
27
|
-
return ar;
|
|
28
|
-
};
|
|
29
|
-
return ownKeys(o);
|
|
19
|
+
return n.default = r, t && t.set(r, n), n;
|
|
20
|
+
}
|
|
21
|
+
async function o(e, r) {
|
|
22
|
+
if (!e) return {
|
|
23
|
+
success: !1,
|
|
24
|
+
error: 'hook-module-not-found'
|
|
30
25
|
};
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
__setModuleDefault(result, mod);
|
|
36
|
-
return result;
|
|
26
|
+
let o = e?.run || e?.execute || e?.default || e;
|
|
27
|
+
if ('function' != typeof o) return {
|
|
28
|
+
success: !1,
|
|
29
|
+
error: 'hook-function-not-found'
|
|
37
30
|
};
|
|
38
|
-
})();
|
|
39
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
40
|
-
exports.executeHookFunction = executeHookFunction;
|
|
41
|
-
exports.executeSingleHookAsync = executeSingleHookAsync;
|
|
42
|
-
exports.executeSingleHookSync = executeSingleHookSync;
|
|
43
|
-
const fs = __importStar(require("fs"));
|
|
44
|
-
const path = __importStar(require("path"));
|
|
45
|
-
const loader_1 = require("./loader");
|
|
46
|
-
/**
|
|
47
|
-
* Execute a hook module
|
|
48
|
-
*/
|
|
49
|
-
async function executeHookFunction(hookModule, context) {
|
|
50
|
-
if (!hookModule) {
|
|
51
|
-
return { success: false, error: 'hook-module-not-found' };
|
|
52
|
-
}
|
|
53
|
-
const hookFn = hookModule?.run
|
|
54
|
-
|| hookModule?.execute
|
|
55
|
-
|| hookModule?.default
|
|
56
|
-
|| hookModule;
|
|
57
|
-
if (typeof hookFn !== 'function') {
|
|
58
|
-
return { success: false, error: 'hook-function-not-found' };
|
|
59
|
-
}
|
|
60
31
|
try {
|
|
61
|
-
|
|
62
|
-
if (
|
|
63
|
-
|
|
64
|
-
return {
|
|
32
|
+
let e = o(r);
|
|
33
|
+
if (e && 'function' == typeof e.then) {
|
|
34
|
+
let r = await e;
|
|
35
|
+
return {
|
|
36
|
+
success: !0,
|
|
37
|
+
result: r
|
|
38
|
+
};
|
|
65
39
|
}
|
|
66
|
-
return {
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
40
|
+
return {
|
|
41
|
+
success: !0,
|
|
42
|
+
result: e
|
|
43
|
+
};
|
|
44
|
+
} catch (e) {
|
|
45
|
+
return console.error('[HOOK-RUNNER] Hook execution failed:', e instanceof Error ? e.message : 'Unknown error'), {
|
|
46
|
+
success: !1,
|
|
47
|
+
error: e instanceof Error ? e.message : 'Unknown error',
|
|
48
|
+
stack: e instanceof Error ? e.stack : void 0
|
|
49
|
+
};
|
|
71
50
|
}
|
|
72
51
|
}
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
: path.resolve(cfg.projectRoot, script);
|
|
84
|
-
if (!fs.existsSync(absolutePath)) {
|
|
85
|
-
return { name, success: false, error: 'script-not-found', script };
|
|
86
|
-
}
|
|
52
|
+
async function t(e, t, n) {
|
|
53
|
+
let { name: s, script: c, timeout: u = 30000 } = e;
|
|
54
|
+
console.log(`[HOOK-RUNNER] Executing hook: ${s} (${e.hookName || 'unknown'})`);
|
|
55
|
+
let f = n || (await Promise.resolve().then(()=>/*#__PURE__*/ r(require("../../lib/config")))).loadConfig(), l = a.isAbsolute(c) ? c : a.resolve(f.projectRoot, c);
|
|
56
|
+
if (!i.existsSync(l)) return {
|
|
57
|
+
name: s,
|
|
58
|
+
success: !1,
|
|
59
|
+
error: "script-not-found",
|
|
60
|
+
script: c
|
|
61
|
+
};
|
|
87
62
|
try {
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
const timeoutId = setTimeout(() => {
|
|
92
|
-
abortController.abort(new Error(`hook-timeout:${timeout}ms`));
|
|
93
|
-
}, timeout);
|
|
63
|
+
let e = `file://${l}?t=${Date.now()}`, n = await Promise.resolve(e).then((e)=>/*#__PURE__*/ r(require(e))), i = new AbortController(), a = setTimeout(()=>{
|
|
64
|
+
i.abort(Error(`hook-timeout:${u}ms`));
|
|
65
|
+
}, u);
|
|
94
66
|
try {
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
reject(abortController.signal.reason);
|
|
67
|
+
let e = o(n.default || n, t), r = await Promise.race([
|
|
68
|
+
e,
|
|
69
|
+
new Promise((e, r)=>{
|
|
70
|
+
i.signal.addEventListener('abort', ()=>{
|
|
71
|
+
r(i.signal.reason);
|
|
101
72
|
});
|
|
102
|
-
})
|
|
73
|
+
})
|
|
103
74
|
]);
|
|
104
|
-
return {
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
75
|
+
return {
|
|
76
|
+
name: s,
|
|
77
|
+
...r,
|
|
78
|
+
script: c
|
|
79
|
+
};
|
|
80
|
+
} finally{
|
|
81
|
+
clearTimeout(a);
|
|
108
82
|
}
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
|
|
83
|
+
} catch (e) {
|
|
84
|
+
return {
|
|
85
|
+
name: s,
|
|
86
|
+
success: !1,
|
|
87
|
+
error: e instanceof Error ? e.message : 'Unknown error',
|
|
88
|
+
script: c
|
|
89
|
+
};
|
|
112
90
|
}
|
|
113
91
|
}
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
}
|
|
92
|
+
function n(e, r, o) {
|
|
93
|
+
let { name: t, script: n } = e;
|
|
94
|
+
console.log(`[HOOK-RUNNER] Executing hook (sync): ${t} (${e.hookName || 'unknown'})`);
|
|
95
|
+
let s = (0, f.loadHookScript)(n, o);
|
|
96
|
+
if (!s) return {
|
|
97
|
+
name: t,
|
|
98
|
+
success: !1,
|
|
99
|
+
error: "script-not-found",
|
|
100
|
+
script: n
|
|
101
|
+
};
|
|
102
|
+
let c = s?.run || s?.execute || s?.default || s;
|
|
103
|
+
if ('function' != typeof c) return {
|
|
104
|
+
name: t,
|
|
105
|
+
success: !1,
|
|
106
|
+
error: 'hook-function-not-found',
|
|
107
|
+
script: n
|
|
108
|
+
};
|
|
131
109
|
try {
|
|
132
|
-
|
|
133
|
-
if (
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
110
|
+
let e = c(r);
|
|
111
|
+
if (e && 'function' == typeof e.then) return console.warn('[HOOK-RUNNER] Async hook detected in sync execution:', t), {
|
|
112
|
+
name: t,
|
|
113
|
+
success: !1,
|
|
114
|
+
error: 'async-hook-in-sync-mode',
|
|
115
|
+
script: n
|
|
116
|
+
};
|
|
117
|
+
return {
|
|
118
|
+
name: t,
|
|
119
|
+
success: !0,
|
|
120
|
+
result: e,
|
|
121
|
+
script: n
|
|
122
|
+
};
|
|
123
|
+
} catch (e) {
|
|
124
|
+
return console.error('[HOOK-RUNNER] Hook execution failed:', e instanceof Error ? e.message : 'Unknown error'), {
|
|
125
|
+
name: t,
|
|
126
|
+
success: !1,
|
|
127
|
+
error: e instanceof Error ? e.message : 'Unknown error',
|
|
128
|
+
script: n
|
|
129
|
+
};
|
|
142
130
|
}
|
|
143
131
|
}
|
|
132
|
+
"use strict";
|
|
133
|
+
Object.defineProperty(exports, "__esModule", {
|
|
134
|
+
value: !0
|
|
135
|
+
});
|
|
136
|
+
var s = exports, c = {
|
|
137
|
+
get executeHookFunction () {
|
|
138
|
+
return o;
|
|
139
|
+
},
|
|
140
|
+
get executeSingleHookAsync () {
|
|
141
|
+
return t;
|
|
142
|
+
},
|
|
143
|
+
get executeSingleHookSync () {
|
|
144
|
+
return n;
|
|
145
|
+
}
|
|
146
|
+
};
|
|
147
|
+
for(var u in c)Object.defineProperty(s, u, {
|
|
148
|
+
enumerable: !0,
|
|
149
|
+
get: Object.getOwnPropertyDescriptor(c, u).get
|
|
150
|
+
});
|
|
151
|
+
let i = /*#__PURE__*/ r(require("fs")), a = /*#__PURE__*/ r(require("path")), f = require("./loader");
|