@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
package/dist/commands/start.js
CHANGED
|
@@ -1,265 +1,172 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
*/
|
|
6
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
7
|
-
if (k2 === undefined) k2 = k;
|
|
8
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
9
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
10
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
11
|
-
}
|
|
12
|
-
Object.defineProperty(o, k2, desc);
|
|
13
|
-
}) : (function(o, m, k, k2) {
|
|
14
|
-
if (k2 === undefined) k2 = k;
|
|
15
|
-
o[k2] = m[k];
|
|
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);
|
|
30
|
-
};
|
|
31
|
-
return function (mod) {
|
|
32
|
-
if (mod && mod.__esModule) return mod;
|
|
33
|
-
var result = {};
|
|
34
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
35
|
-
__setModuleDefault(result, mod);
|
|
36
|
-
return result;
|
|
37
|
-
};
|
|
38
|
-
})();
|
|
39
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
40
|
-
exports.startTask = startTask;
|
|
41
|
-
exports.main = main;
|
|
42
|
-
const fs = __importStar(require("fs"));
|
|
43
|
-
const path = __importStar(require("path"));
|
|
44
|
-
const child_process_1 = require("child_process");
|
|
45
|
-
const config_1 = require("../lib/config");
|
|
46
|
-
const state_1 = require("../lib/state");
|
|
47
|
-
const archive_1 = require("../lib/archive");
|
|
48
|
-
const sync_task_to_openspec_1 = require("../spec/sync-task-to-openspec");
|
|
49
|
-
function parseArgs(argv) {
|
|
50
|
-
const args = {};
|
|
51
|
-
for (let i = 2; i < argv.length; i += 1) {
|
|
52
|
-
const token = argv[i] || '';
|
|
53
|
-
if (!token.startsWith('--')) {
|
|
54
|
-
continue;
|
|
55
|
-
}
|
|
56
|
-
const key = token.slice(2);
|
|
57
|
-
const next = argv[i + 1] || '';
|
|
58
|
-
if (!next || next.startsWith('--')) {
|
|
59
|
-
args[key] = true;
|
|
60
|
-
continue;
|
|
61
|
-
}
|
|
62
|
-
args[key] = next;
|
|
63
|
-
i += 1;
|
|
64
|
-
}
|
|
65
|
-
return args;
|
|
66
|
-
}
|
|
67
|
-
function toTaskId(input) {
|
|
68
|
-
return String(input || '')
|
|
69
|
-
.trim()
|
|
70
|
-
.replace(/[^a-zA-Z0-9-_]/g, '-')
|
|
71
|
-
.replace(/-+/g, '-')
|
|
72
|
-
.replace(/^-|-$/g, '');
|
|
73
|
-
}
|
|
74
|
-
function toWorktreeName(type, taskId) {
|
|
75
|
-
return `harness-${type}-${taskId}`;
|
|
76
|
-
}
|
|
77
|
-
function getGitBranch(cwd) {
|
|
78
|
-
try {
|
|
79
|
-
return (0, child_process_1.execSync)('git rev-parse --abbrev-ref HEAD', { cwd, encoding: 'utf8' }).trim();
|
|
80
|
-
}
|
|
81
|
-
catch {
|
|
82
|
-
return 'main';
|
|
83
|
-
}
|
|
1
|
+
function e(t) {
|
|
2
|
+
return "function" != typeof WeakMap ? null : (e = function(e) {
|
|
3
|
+
return new WeakMap();
|
|
4
|
+
})(t);
|
|
84
5
|
}
|
|
85
|
-
function
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
6
|
+
function t(t, r) {
|
|
7
|
+
var s, n, o;
|
|
8
|
+
if (!r && t && t.__esModule) return t;
|
|
9
|
+
if (null === t || "object" != typeof t && "function" != typeof t) return {
|
|
10
|
+
default: t
|
|
11
|
+
};
|
|
12
|
+
if ((s = e(r)) && s.has(t)) return s.get(t);
|
|
13
|
+
for(var i in n = {
|
|
14
|
+
__proto__: null
|
|
15
|
+
}, o = Object.defineProperty && Object.getOwnPropertyDescriptor, t)if ("default" !== i && Object.prototype.hasOwnProperty.call(t, i)) {
|
|
16
|
+
var a = o ? Object.getOwnPropertyDescriptor(t, i) : null;
|
|
17
|
+
a && (a.get || a.set) ? Object.defineProperty(n, i, a) : n[i] = t[i];
|
|
18
|
+
}
|
|
19
|
+
return n.default = t, s && s.set(t, n), n;
|
|
92
20
|
}
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
message: 'Config missing harnessRootAbs',
|
|
123
|
-
};
|
|
124
|
-
}
|
|
125
|
-
const statePath = path.resolve(harnessRootAbs, 'state.json');
|
|
126
|
-
if (!fs.existsSync(statePath)) {
|
|
127
|
-
const initialState = (0, state_1.createInitialState)();
|
|
128
|
-
fs.mkdirSync(harnessRootAbs, { recursive: true });
|
|
21
|
+
function r(e = {}) {
|
|
22
|
+
var t;
|
|
23
|
+
let s = (0, l.loadConfig)({
|
|
24
|
+
cwd: e.cwd
|
|
25
|
+
}), n = String(e.change || '').trim();
|
|
26
|
+
if (!n) return {
|
|
27
|
+
success: !1,
|
|
28
|
+
reason: 'missing-change',
|
|
29
|
+
message: 'Missing required argument: --change <change-name>'
|
|
30
|
+
};
|
|
31
|
+
let o = String(e.taskId || n || '').trim().replace(/[^a-zA-Z0-9-_]/g, '-').replace(/-+/g, '-').replace(/^-|-$/g, '');
|
|
32
|
+
if (!o) return {
|
|
33
|
+
success: !1,
|
|
34
|
+
reason: 'invalid-task-id',
|
|
35
|
+
message: 'Invalid task id derived from change name'
|
|
36
|
+
};
|
|
37
|
+
(0, l.ensureDirectories)(s);
|
|
38
|
+
let i = s.harnessRootAbs;
|
|
39
|
+
if (!i) return {
|
|
40
|
+
success: !1,
|
|
41
|
+
reason: 'missing-harness-root',
|
|
42
|
+
message: 'Config missing harnessRootAbs'
|
|
43
|
+
};
|
|
44
|
+
let d = c.resolve(i, 'state.json');
|
|
45
|
+
if (!a.existsSync(d)) {
|
|
46
|
+
let e = (0, p.createInitialState)();
|
|
47
|
+
a.mkdirSync(i, {
|
|
48
|
+
recursive: !0
|
|
49
|
+
});
|
|
129
50
|
try {
|
|
130
|
-
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
const errorMessage = error instanceof Error ? error.message : 'Unknown error';
|
|
51
|
+
a.writeFileSync(d, JSON.stringify(e, null, 2), 'utf8');
|
|
52
|
+
} catch (t) {
|
|
53
|
+
let e = t instanceof Error ? t.message : 'Unknown error';
|
|
134
54
|
return {
|
|
135
|
-
success:
|
|
55
|
+
success: !1,
|
|
136
56
|
reason: 'file-write-error',
|
|
137
|
-
message: `Failed to initialize state: ${
|
|
57
|
+
message: `Failed to initialize state: ${e}`
|
|
138
58
|
};
|
|
139
59
|
}
|
|
140
60
|
}
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
});
|
|
163
|
-
|
|
164
|
-
return
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
const taskOutputPath = path.resolve(projectRoot, String(options.output || path.relative(projectRoot, path.resolve(tasksDirAbs, `${taskId}.json`))));
|
|
181
|
-
// Update task JSON planning status
|
|
182
|
-
updateTaskPlanningStatus(taskOutputPath);
|
|
183
|
-
// Get git info
|
|
184
|
-
const now = new Date().toISOString();
|
|
185
|
-
const worktreeName = process.env.WORKTREE_NAME || toWorktreeName(options.type || 'feat', taskId);
|
|
186
|
-
const branch = getGitBranch(projectRoot);
|
|
187
|
-
// Update state
|
|
188
|
-
const state = (0, state_1.loadState)(config);
|
|
189
|
-
state.version = state.version || '1.0';
|
|
190
|
-
state.status = 'running';
|
|
191
|
-
state.currentPhase = 'planning';
|
|
192
|
-
state.currentTask = taskId;
|
|
193
|
-
state.currentSnapshot = null;
|
|
194
|
-
state.reviewConclusion = null;
|
|
195
|
-
state.phaseCompleted = null;
|
|
196
|
-
state.taskHistory = Array.isArray(state.taskHistory) ? state.taskHistory : [];
|
|
197
|
-
state.startedAt = state.startedAt || now;
|
|
198
|
-
state.updatedAt = now;
|
|
199
|
-
// Add worktree
|
|
200
|
-
const worktreeInfo = {
|
|
201
|
-
name: worktreeName,
|
|
61
|
+
let y = [
|
|
62
|
+
c.resolve(__dirname, '../spec/sync-openspec-to-task.js'),
|
|
63
|
+
'--change',
|
|
64
|
+
n,
|
|
65
|
+
'--task-id',
|
|
66
|
+
o
|
|
67
|
+
];
|
|
68
|
+
if (e.type && y.push('--type', String(e.type)), e.priority && y.push('--priority', String(e.priority)), e.worktree && y.push('--worktree', String(e.worktree)), e.output && y.push('--output', String(e.output)), e.force && y.push('--force'), 0 !== (0, u.spawnSync)(process.execPath, y, {
|
|
69
|
+
cwd: s.projectRoot,
|
|
70
|
+
stdio: 'inherit'
|
|
71
|
+
}).status) return {
|
|
72
|
+
success: !1,
|
|
73
|
+
reason: 'sync-failed',
|
|
74
|
+
message: 'Failed to sync Spec to task'
|
|
75
|
+
};
|
|
76
|
+
let h = s.tasksDirAbs, k = s.projectRoot;
|
|
77
|
+
if (!h || !k) return {
|
|
78
|
+
success: !1,
|
|
79
|
+
reason: 'missing-config-paths',
|
|
80
|
+
message: 'Config missing tasksDirAbs or projectRoot'
|
|
81
|
+
};
|
|
82
|
+
let m = c.resolve(k, String(e.output || c.relative(k, c.resolve(h, `${o}.json`))));
|
|
83
|
+
!function(e) {
|
|
84
|
+
if (!a.existsSync(e)) return;
|
|
85
|
+
let t = a.readFileSync(e, 'utf8').replace(/(-\s*name:\s*planning\s*\n(?:[^\n]*\n)*?status:\s*)\S+/m, '$1in_progress');
|
|
86
|
+
a.writeFileSync(e, t, 'utf8');
|
|
87
|
+
}(m);
|
|
88
|
+
let v = new Date().toISOString(), S = process.env.WORKTREE_NAME || (t = e.type || 'feat', `harness-${t}-${o}`), w = function(e) {
|
|
89
|
+
try {
|
|
90
|
+
return (0, u.execSync)('git rev-parse --abbrev-ref HEAD', {
|
|
91
|
+
cwd: e,
|
|
92
|
+
encoding: 'utf8'
|
|
93
|
+
}).trim();
|
|
94
|
+
} catch {
|
|
95
|
+
return 'main';
|
|
96
|
+
}
|
|
97
|
+
}(k), _ = (0, p.loadState)(s);
|
|
98
|
+
return _.version = _.version || '1.0', _.status = 'running', _.currentPhase = 'planning', _.currentTask = o, _.currentSnapshot = null, _.reviewConclusion = null, _.phaseCompleted = null, _.taskHistory = Array.isArray(_.taskHistory) ? _.taskHistory : [], _.startedAt = _.startedAt || v, _.updatedAt = v, (0, p.upsertWorktree)({
|
|
99
|
+
name: S,
|
|
202
100
|
path: '.',
|
|
203
|
-
branch,
|
|
101
|
+
branch: w,
|
|
204
102
|
status: 'active',
|
|
205
|
-
task:
|
|
206
|
-
startedAt:
|
|
207
|
-
lastActivity:
|
|
208
|
-
pendingChanges: []
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
(0, state_1.saveState)(state, config);
|
|
213
|
-
// Archive task state
|
|
214
|
-
(0, archive_1.archiveTaskState)({
|
|
215
|
-
cwd: projectRoot,
|
|
216
|
-
taskId,
|
|
103
|
+
task: o,
|
|
104
|
+
startedAt: v,
|
|
105
|
+
lastActivity: v,
|
|
106
|
+
pendingChanges: []
|
|
107
|
+
}, s), (0, p.saveState)(_, s), (0, g.archiveTaskState)({
|
|
108
|
+
cwd: k,
|
|
109
|
+
taskId: o,
|
|
217
110
|
eventType: 'task_started',
|
|
218
111
|
status: 'running',
|
|
219
|
-
phase: 'planning'
|
|
220
|
-
})
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
success:
|
|
225
|
-
taskId,
|
|
226
|
-
taskPath:
|
|
227
|
-
worktreeName,
|
|
228
|
-
branch
|
|
112
|
+
phase: 'planning'
|
|
113
|
+
}), (0, f.syncTaskToSpec)({
|
|
114
|
+
cwd: k,
|
|
115
|
+
taskId: o
|
|
116
|
+
}), {
|
|
117
|
+
success: !0,
|
|
118
|
+
taskId: o,
|
|
119
|
+
taskPath: m,
|
|
120
|
+
worktreeName: S,
|
|
121
|
+
branch: w
|
|
229
122
|
};
|
|
230
123
|
}
|
|
231
|
-
function
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
124
|
+
function s() {
|
|
125
|
+
let e = function(e) {
|
|
126
|
+
let t = {};
|
|
127
|
+
for(let r = 2; r < e.length; r += 1){
|
|
128
|
+
let s = e[r] || '';
|
|
129
|
+
if (!s.startsWith('--')) continue;
|
|
130
|
+
let n = s.slice(2), o = e[r + 1] || '';
|
|
131
|
+
if (!o || o.startsWith('--')) {
|
|
132
|
+
t[n] = !0;
|
|
133
|
+
continue;
|
|
134
|
+
}
|
|
135
|
+
t[n] = o, r += 1;
|
|
136
|
+
}
|
|
137
|
+
return t;
|
|
138
|
+
}(process.argv), t = r({
|
|
139
|
+
cwd: e.cwd,
|
|
140
|
+
change: e.change,
|
|
141
|
+
type: e.type,
|
|
142
|
+
priority: e.priority,
|
|
143
|
+
worktree: e.worktree,
|
|
144
|
+
output: e.output,
|
|
145
|
+
force: !0 === e.force
|
|
241
146
|
});
|
|
242
|
-
|
|
243
|
-
console.error(`[START] ${result.message}`);
|
|
244
|
-
process.exit(1);
|
|
245
|
-
}
|
|
246
|
-
console.log('');
|
|
247
|
-
console.log('[START] Task started successfully!');
|
|
248
|
-
console.log(` Task ID: ${result.taskId}`);
|
|
249
|
-
console.log(` Task File: ${result.taskPath}`);
|
|
250
|
-
console.log(` Worktree: ${result.worktreeName}`);
|
|
251
|
-
console.log(` Branch: ${result.branch}`);
|
|
252
|
-
console.log('');
|
|
253
|
-
console.log('Next steps:');
|
|
254
|
-
console.log(` 1. Edit product-requirement.md: spec/changes/${result.taskId}/product-requirement.md`);
|
|
255
|
-
console.log(` 2. Run: task-flow design --change ${result.taskId}`);
|
|
256
|
-
console.log(' 3. Check status: task-flow status');
|
|
257
|
-
console.log('');
|
|
258
|
-
process.exit(0);
|
|
259
|
-
}
|
|
260
|
-
if (require.main === module) {
|
|
261
|
-
main();
|
|
147
|
+
t.success || (console.error(`[START] ${t.message}`), process.exit(1)), console.log(''), console.log('[START] Task started successfully!'), console.log(` Task ID: ${t.taskId}`), console.log(` Task File: ${t.taskPath}`), console.log(` Worktree: ${t.worktreeName}`), console.log(` Branch: ${t.branch}`), console.log(''), console.log('Next steps:'), console.log(` 1. Edit product-requirement.md: spec/changes/${t.taskId}/product-requirement.md`), console.log(` 2. Run: task-flow design --change ${t.taskId}`), console.log(' 3. Check status: task-flow status'), console.log(''), process.exit(0);
|
|
262
148
|
}
|
|
263
|
-
|
|
264
|
-
|
|
149
|
+
"use strict";
|
|
150
|
+
Object.defineProperty(exports, "__esModule", {
|
|
151
|
+
value: !0
|
|
152
|
+
});
|
|
153
|
+
var n = exports, o = {
|
|
154
|
+
get default () {
|
|
155
|
+
return d;
|
|
156
|
+
},
|
|
157
|
+
get main () {
|
|
158
|
+
return s;
|
|
159
|
+
},
|
|
160
|
+
get startTask () {
|
|
161
|
+
return r;
|
|
162
|
+
}
|
|
163
|
+
};
|
|
164
|
+
for(var i in o)Object.defineProperty(n, i, {
|
|
165
|
+
enumerable: !0,
|
|
166
|
+
get: Object.getOwnPropertyDescriptor(o, i).get
|
|
167
|
+
});
|
|
168
|
+
let a = /*#__PURE__*/ t(require("fs")), c = /*#__PURE__*/ t(require("path")), u = require("child_process"), l = require("../lib/config"), p = require("../lib/state"), g = require("../lib/archive"), f = require("../spec/sync-task-to-openspec");
|
|
169
|
+
require.main === module && s();
|
|
170
|
+
let d = {
|
|
171
|
+
startTask: r
|
|
265
172
|
};
|
package/dist/commands/status.js
CHANGED
|
@@ -1,143 +1,82 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
* commands/status.ts
|
|
5
|
-
* Show current task and phase status
|
|
6
|
-
*/
|
|
7
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
-
exports.showStatus = showStatus;
|
|
9
|
-
exports.main = main;
|
|
10
|
-
const config_1 = require("../lib/config");
|
|
11
|
-
const state_1 = require("../lib/state");
|
|
12
|
-
function parseArgs(argv) {
|
|
13
|
-
const args = {};
|
|
14
|
-
for (let i = 2; i < argv.length; i += 1) {
|
|
15
|
-
const token = argv[i] || '';
|
|
16
|
-
if (!token.startsWith('--')) {
|
|
17
|
-
continue;
|
|
18
|
-
}
|
|
19
|
-
const key = token.slice(2);
|
|
20
|
-
const next = argv[i + 1];
|
|
21
|
-
if (!next || next.startsWith('--')) {
|
|
22
|
-
args[key] = true;
|
|
23
|
-
continue;
|
|
24
|
-
}
|
|
25
|
-
args[key] = next;
|
|
26
|
-
i += 1;
|
|
27
|
-
}
|
|
28
|
-
return args;
|
|
29
|
-
}
|
|
30
|
-
function formatPhase(phase) {
|
|
31
|
-
if (!phase) {
|
|
32
|
-
return 'None';
|
|
33
|
-
}
|
|
34
|
-
const labels = {
|
|
2
|
+
function e(e) {
|
|
3
|
+
return e ? ({
|
|
35
4
|
planning: '📋 Planning',
|
|
36
5
|
implementation: '🔨 Implementation',
|
|
37
6
|
review: '🔍 Review',
|
|
38
|
-
merge: '🔀 Merge'
|
|
39
|
-
};
|
|
40
|
-
return labels[phase] || phase;
|
|
7
|
+
merge: '🔀 Merge'
|
|
8
|
+
})[e] || e : 'None';
|
|
41
9
|
}
|
|
42
|
-
function
|
|
43
|
-
|
|
10
|
+
function o(n = {}) {
|
|
11
|
+
var t;
|
|
12
|
+
let l = (0, a.loadConfig)({
|
|
13
|
+
cwd: n.cwd
|
|
14
|
+
}), s = (0, r.loadState)(l);
|
|
15
|
+
console.log(''), console.log('╔════════════════════════════════════════════════════════╗'), console.log('║ Task Flow Status ║'), console.log('╚════════════════════════════════════════════════════════╝'), console.log(''), console.log(`Status: ${(t = s.status, `${({
|
|
44
16
|
initialized: '⚪',
|
|
45
17
|
running: '🟢',
|
|
46
18
|
paused: '🟡',
|
|
47
19
|
completed: '✅',
|
|
48
20
|
failed: '🔴',
|
|
49
|
-
blocked: '🚫'
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
console.log('');
|
|
57
|
-
console.log('
|
|
58
|
-
console.log('
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
if (state.currentTask) {
|
|
66
|
-
console.log(`Current Task: ${state.currentTask}`);
|
|
67
|
-
console.log(`Current Phase: ${formatPhase(state.currentPhase)}`);
|
|
68
|
-
console.log(`Phase Completed: ${formatPhase(state.phaseCompleted)}`);
|
|
69
|
-
if (state.reviewConclusion) {
|
|
70
|
-
const conclusionIcon = {
|
|
71
|
-
PASS: '✅',
|
|
72
|
-
NEEDS_WORK: '🔶',
|
|
73
|
-
FAIL: '❌',
|
|
74
|
-
};
|
|
75
|
-
console.log(`Review Conclusion: ${conclusionIcon[state.reviewConclusion] || '⚪'} ${state.reviewConclusion}`);
|
|
76
|
-
}
|
|
77
|
-
if (state.currentSnapshot) {
|
|
78
|
-
console.log(`Latest Snapshot: ${state.currentSnapshot}`);
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
else {
|
|
82
|
-
console.log('Current Task: None');
|
|
83
|
-
}
|
|
84
|
-
console.log('');
|
|
85
|
-
// Active worktrees
|
|
86
|
-
const activeWorktrees = (0, state_1.getActiveWorktrees)(config);
|
|
87
|
-
if (activeWorktrees.length > 0) {
|
|
88
|
-
console.log(`Worktrees (${activeWorktrees.length}):`);
|
|
89
|
-
for (const wt of activeWorktrees) {
|
|
90
|
-
console.log(` - ${wt.name}`);
|
|
91
|
-
console.log(` Branch: ${wt.branch}`);
|
|
92
|
-
console.log(` Task: ${wt.task}`);
|
|
93
|
-
console.log(` Agent: ${wt.agent}`);
|
|
94
|
-
console.log(` Last Activity: ${wt.lastActivity}`);
|
|
95
|
-
if (wt.pendingChanges && wt.pendingChanges.length > 0) {
|
|
96
|
-
console.log(` Pending Changes: ${wt.pendingChanges.join(', ')}`);
|
|
97
|
-
}
|
|
98
|
-
}
|
|
21
|
+
blocked: '🚫'
|
|
22
|
+
})[t] || '⚪'} ${t}`)}`), console.log(''), s.currentTask ? (console.log(`Current Task: ${s.currentTask}`), console.log(`Current Phase: ${e(s.currentPhase)}`), console.log(`Phase Completed: ${e(s.phaseCompleted)}`), s.reviewConclusion && console.log(`Review Conclusion: ${{
|
|
23
|
+
PASS: '✅',
|
|
24
|
+
NEEDS_WORK: '🔶',
|
|
25
|
+
FAIL: '❌'
|
|
26
|
+
}[s.reviewConclusion] || '⚪'} ${s.reviewConclusion}`), s.currentSnapshot && console.log(`Latest Snapshot: ${s.currentSnapshot}`)) : console.log('Current Task: None'), console.log('');
|
|
27
|
+
let i = (0, r.getActiveWorktrees)(l);
|
|
28
|
+
if (i.length > 0) for (let e of (console.log(`Worktrees (${i.length}):`), i))console.log(` - ${e.name}`), console.log(` Branch: ${e.branch}`), console.log(` Task: ${e.task}`), console.log(` Agent: ${e.agent}`), console.log(` Last Activity: ${e.lastActivity}`), e.pendingChanges && e.pendingChanges.length > 0 && console.log(` Pending Changes: ${e.pendingChanges.join(', ')}`);
|
|
29
|
+
else console.log('Worktrees: None');
|
|
30
|
+
if (console.log(''), s.taskHistory && s.taskHistory.length > 0) for (let e of (console.log('Task History:'), s.taskHistory.slice(-5).reverse())){
|
|
31
|
+
let o = {
|
|
32
|
+
completed: '✅',
|
|
33
|
+
failed: '❌',
|
|
34
|
+
running: '🟢'
|
|
35
|
+
};
|
|
36
|
+
console.log(` ${o[e.status] || '⚪'} ${e.taskId}: ${e.status} (${e.currentPhase || 'no phase'})`);
|
|
99
37
|
}
|
|
100
|
-
|
|
101
|
-
console.log('Worktrees: None');
|
|
102
|
-
}
|
|
103
|
-
console.log('');
|
|
104
|
-
// Recent task history
|
|
105
|
-
if (state.taskHistory && state.taskHistory.length > 0) {
|
|
106
|
-
console.log('Task History:');
|
|
107
|
-
const recent = state.taskHistory.slice(-5).reverse();
|
|
108
|
-
for (const task of recent) {
|
|
109
|
-
const icon = {
|
|
110
|
-
completed: '✅',
|
|
111
|
-
failed: '❌',
|
|
112
|
-
running: '🟢',
|
|
113
|
-
};
|
|
114
|
-
console.log(` ${icon[task.status] || '⚪'} ${task.taskId}: ${task.status} (${task.currentPhase || 'no phase'})`);
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
console.log('');
|
|
118
|
-
// Gate blocked info
|
|
119
|
-
if (state.lastGateBlockedReason) {
|
|
120
|
-
console.log('⚠️ Gate Blocked:');
|
|
121
|
-
console.log(` Phase: ${state.lastGateBlockedPhase || 'unknown'}`);
|
|
122
|
-
console.log(` Reason: ${state.lastGateBlockedReason}`);
|
|
123
|
-
if (state.lastMissingValidations && state.lastMissingValidations.length > 0) {
|
|
124
|
-
console.log(` Missing: ${state.lastMissingValidations.join(', ')}`);
|
|
125
|
-
}
|
|
126
|
-
console.log('');
|
|
127
|
-
}
|
|
128
|
-
console.log(`Started: ${state.startedAt}`);
|
|
129
|
-
console.log(`Updated: ${state.updatedAt}`);
|
|
130
|
-
console.log('');
|
|
131
|
-
}
|
|
132
|
-
function main() {
|
|
133
|
-
const args = parseArgs(process.argv);
|
|
134
|
-
showStatus({ cwd: args.cwd });
|
|
135
|
-
process.exit(0);
|
|
38
|
+
console.log(''), s.lastGateBlockedReason && (console.log('⚠️ Gate Blocked:'), console.log(` Phase: ${s.lastGateBlockedPhase || 'unknown'}`), console.log(` Reason: ${s.lastGateBlockedReason}`), s.lastMissingValidations && s.lastMissingValidations.length > 0 && console.log(` Missing: ${s.lastMissingValidations.join(', ')}`), console.log('')), console.log(`Started: ${s.startedAt}`), console.log(`Updated: ${s.updatedAt}`), console.log('');
|
|
136
39
|
}
|
|
137
|
-
|
|
138
|
-
|
|
40
|
+
function n() {
|
|
41
|
+
o({
|
|
42
|
+
cwd: function(e) {
|
|
43
|
+
let o = {};
|
|
44
|
+
for(let n = 2; n < e.length; n += 1){
|
|
45
|
+
let t = e[n] || '';
|
|
46
|
+
if (!t.startsWith('--')) continue;
|
|
47
|
+
let l = t.slice(2), s = e[n + 1];
|
|
48
|
+
if (!s || s.startsWith('--')) {
|
|
49
|
+
o[l] = !0;
|
|
50
|
+
continue;
|
|
51
|
+
}
|
|
52
|
+
o[l] = s, n += 1;
|
|
53
|
+
}
|
|
54
|
+
return o;
|
|
55
|
+
}(process.argv).cwd
|
|
56
|
+
}), process.exit(0);
|
|
139
57
|
}
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
58
|
+
"use strict";
|
|
59
|
+
Object.defineProperty(exports, "__esModule", {
|
|
60
|
+
value: !0
|
|
61
|
+
});
|
|
62
|
+
var t = exports, l = {
|
|
63
|
+
get default () {
|
|
64
|
+
return i;
|
|
65
|
+
},
|
|
66
|
+
get main () {
|
|
67
|
+
return n;
|
|
68
|
+
},
|
|
69
|
+
get showStatus () {
|
|
70
|
+
return o;
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
for(var s in l)Object.defineProperty(t, s, {
|
|
74
|
+
enumerable: !0,
|
|
75
|
+
get: Object.getOwnPropertyDescriptor(l, s).get
|
|
76
|
+
});
|
|
77
|
+
let a = require("../lib/config"), r = require("../lib/state");
|
|
78
|
+
require.main === module && n();
|
|
79
|
+
let i = {
|
|
80
|
+
showStatus: o,
|
|
81
|
+
main: n
|
|
143
82
|
};
|