@bicorne/task-flow 0.2.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 +2 -4
- package/SKILL.md +2 -4
- 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 -147
- 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.js +141 -226
- 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 +299 -330
- 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 +8 -6
- package/references/CLI-TUTORIAL.md +4 -10
|
@@ -1,138 +1,125 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
* spec/openspec-to-task/builders.ts
|
|
4
|
-
* Task object builders for Spec to task sync
|
|
5
|
-
*/
|
|
6
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.buildTaskOutputs = buildTaskOutputs;
|
|
8
|
-
exports.buildTaskObject = buildTaskObject;
|
|
9
|
-
exports.buildTaskJson = buildTaskJson;
|
|
10
|
-
exports.buildSyncParams = buildSyncParams;
|
|
11
|
-
const parsers_1 = require("./parsers");
|
|
12
|
-
/**
|
|
13
|
-
* Build task output paths config
|
|
14
|
-
*/
|
|
15
|
-
function buildTaskOutputs(config, taskId) {
|
|
16
|
-
const tasksDir = config?.tasksDir || 'tasks';
|
|
17
|
-
const snapshotsDir = config?.snapshotsDir || 'snapshots';
|
|
18
|
-
const reportsDir = config?.reportsDir || 'reports';
|
|
1
|
+
function e(e, t) {
|
|
2
|
+
let r = e?.tasksDir || 'tasks', a = e?.snapshotsDir || 'snapshots', i = e?.reportsDir || 'reports';
|
|
19
3
|
return {
|
|
20
|
-
task: `${
|
|
21
|
-
snapshot: `${
|
|
22
|
-
report: `${
|
|
4
|
+
task: `${r}/${t}.json`,
|
|
5
|
+
snapshot: `${a}/${t}-impl.json`,
|
|
6
|
+
report: `${i}/${t}-review.md`
|
|
23
7
|
};
|
|
24
8
|
}
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
*/
|
|
28
|
-
function buildTaskObject(params) {
|
|
29
|
-
const { taskId, type, title, priority, description, files, worktree, implementationValidations, reviewValidations, changeName, manifestPath, executionPath, mergeStrategy, planningSummary, implementationSteps, outputs, } = params;
|
|
9
|
+
function t(e) {
|
|
10
|
+
let { taskId: t, type: r, title: a, priority: i, description: n, files: s, worktree: o, implementationValidations: l, reviewValidations: p, changeName: d, manifestPath: c, executionPath: m, mergeStrategy: u, planningSummary: g, implementationSteps: y, outputs: k } = e;
|
|
30
11
|
return {
|
|
31
|
-
id:
|
|
32
|
-
type,
|
|
33
|
-
title,
|
|
34
|
-
priority,
|
|
12
|
+
id: t,
|
|
13
|
+
type: r,
|
|
14
|
+
title: a,
|
|
15
|
+
priority: i,
|
|
35
16
|
phase: 1,
|
|
36
17
|
dependencies: [],
|
|
37
18
|
docs_to_read: [
|
|
38
|
-
`spec/changes/${
|
|
39
|
-
`spec/changes/${
|
|
40
|
-
`spec/changes/${
|
|
19
|
+
`spec/changes/${d}/product-requirement.md`,
|
|
20
|
+
`spec/changes/${d}/design.md`,
|
|
21
|
+
`spec/changes/${d}/tasks.md`
|
|
41
22
|
],
|
|
42
23
|
spec: {
|
|
43
|
-
description:
|
|
44
|
-
files:
|
|
45
|
-
context: []
|
|
24
|
+
description: n || `从 Spec 变更 ${d} 同步生成。`,
|
|
25
|
+
files: s || [],
|
|
26
|
+
context: []
|
|
46
27
|
},
|
|
47
28
|
acceptance_criteria: [
|
|
48
29
|
'validation-passes',
|
|
49
|
-
'review-pass'
|
|
30
|
+
'review-pass'
|
|
50
31
|
],
|
|
51
32
|
implementation: {
|
|
52
|
-
steps:
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
notes:
|
|
33
|
+
steps: y.map((e)=>({
|
|
34
|
+
step: e,
|
|
35
|
+
details: ''
|
|
36
|
+
})),
|
|
37
|
+
notes: g || ''
|
|
57
38
|
},
|
|
58
39
|
validation: {
|
|
59
|
-
commands:
|
|
60
|
-
manual_checks:
|
|
40
|
+
commands: l || [],
|
|
41
|
+
manual_checks: p || []
|
|
61
42
|
},
|
|
62
43
|
status: 'pending',
|
|
63
44
|
metadata: {
|
|
64
|
-
change:
|
|
65
|
-
manifest:
|
|
66
|
-
execution:
|
|
67
|
-
worktree,
|
|
45
|
+
change: d,
|
|
46
|
+
manifest: c,
|
|
47
|
+
execution: m,
|
|
48
|
+
worktree: o,
|
|
68
49
|
mergeStrategy: {
|
|
69
|
-
type:
|
|
70
|
-
deleteBranch:
|
|
71
|
-
deleteWorktree:
|
|
50
|
+
type: u.type || 'squash',
|
|
51
|
+
deleteBranch: u.deleteBranch ?? !0,
|
|
52
|
+
deleteWorktree: u.deleteWorktree ?? !0
|
|
72
53
|
},
|
|
73
|
-
outputs
|
|
74
|
-
}
|
|
54
|
+
outputs: k
|
|
55
|
+
}
|
|
75
56
|
};
|
|
76
57
|
}
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
return JSON.stringify(taskObject, null, 2);
|
|
58
|
+
function r(r) {
|
|
59
|
+
let a = e(r.config, r.taskId);
|
|
60
|
+
return JSON.stringify(t({
|
|
61
|
+
...r,
|
|
62
|
+
outputs: a
|
|
63
|
+
}), null, 2);
|
|
84
64
|
}
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
function buildSyncParams(options, config, changeName, _changeDir, proposalContent, _designContent, tasksContent, manifest, _manifestPath, _executionPath) {
|
|
89
|
-
const checklistItems = (0, parsers_1.extractChecklistItems)(tasksContent);
|
|
90
|
-
const taskId = (0, parsers_1.toTaskId)(options.taskId || manifest.taskId || changeName);
|
|
91
|
-
const type = String(options.type || manifest.type || 'feat');
|
|
92
|
-
const priority = String(options.priority || manifest.priority || 'medium');
|
|
93
|
-
const title = String(manifest.title || (0, parsers_1.extractTitle)(changeName, proposalContent));
|
|
94
|
-
const description = [
|
|
95
|
-
`从 Spec 变更 ${changeName} 同步生成。`,
|
|
65
|
+
function a(e, t, r, a, i, n, s, l, p, d) {
|
|
66
|
+
let c = (0, o.extractChecklistItems)(s), m = (0, o.toTaskId)(e.taskId || l.taskId || r), u = String(e.type || l.type || 'feat'), g = String(e.priority || l.priority || 'medium'), y = String(l.title || (0, o.extractTitle)(r, i)), k = [
|
|
67
|
+
`从 Spec 变更 ${r} 同步生成。`,
|
|
96
68
|
'',
|
|
97
|
-
|
|
98
|
-
].join('\n')
|
|
99
|
-
|
|
100
|
-
...(
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
:
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
:
|
|
69
|
+
i ? i.split(/\r?\n/).slice(0, 20).join('\n') : '请参考 Spec proposal/design/tasks 文档补全细节。'
|
|
70
|
+
].join('\n'), h = (0, o.uniqueArray)([
|
|
71
|
+
...Array.isArray(l.files) ? l.files : [],
|
|
72
|
+
...(0, o.extractFileCandidates)([
|
|
73
|
+
i,
|
|
74
|
+
n,
|
|
75
|
+
s
|
|
76
|
+
])
|
|
77
|
+
]), S = h.length > 0 ? h : [
|
|
78
|
+
`${t.tasksDir}/README.md`
|
|
79
|
+
], f = String(e.worktree || l.worktree || (0, o.toWorktreeName)(u, m)), $ = (0, o.uniqueArray)(Array.isArray(l.implementationValidation) && l.implementationValidation.length > 0 ? l.implementationValidation : (0, o.inferImplementationValidations)(c)), v = (0, o.uniqueArray)(Array.isArray(l.reviewValidation) && l.reviewValidation.length > 0 ? l.reviewValidation : (0, o.inferReviewValidations)(c));
|
|
80
|
+
return {
|
|
81
|
+
taskId: m,
|
|
82
|
+
type: u,
|
|
83
|
+
title: y,
|
|
84
|
+
priority: g,
|
|
85
|
+
description: k,
|
|
86
|
+
files: S,
|
|
87
|
+
worktree: f,
|
|
88
|
+
implementationValidations: $,
|
|
89
|
+
reviewValidations: v,
|
|
90
|
+
mergeStrategy: {
|
|
91
|
+
type: String(l.mergeStrategy?.type || 'squash'),
|
|
92
|
+
deleteBranch: (0, o.normalizeBoolean)(l.mergeStrategy?.deleteBranch, !0),
|
|
93
|
+
deleteWorktree: (0, o.normalizeBoolean)(l.mergeStrategy?.deleteWorktree, !0)
|
|
94
|
+
},
|
|
95
|
+
planningSummary: `从 Spec 变更 ${r} 同步生成,基于 proposal、design、tasks 与 harness manifest 收敛出的执行规划。`,
|
|
96
|
+
implementationSteps: c.length > 0 ? c : [
|
|
119
97
|
'读取 Spec 规格并补全任务分解',
|
|
120
98
|
'完成实现并执行构建、测试、类型检查与 lint',
|
|
121
|
-
'输出审查报告并给出结论'
|
|
122
|
-
]
|
|
123
|
-
const planningSummary = `从 Spec 变更 ${changeName} 同步生成,基于 proposal、design、tasks 与 harness manifest 收敛出的执行规划。`;
|
|
124
|
-
return {
|
|
125
|
-
taskId,
|
|
126
|
-
type,
|
|
127
|
-
title,
|
|
128
|
-
priority,
|
|
129
|
-
description,
|
|
130
|
-
files,
|
|
131
|
-
worktree,
|
|
132
|
-
implementationValidations,
|
|
133
|
-
reviewValidations,
|
|
134
|
-
mergeStrategy,
|
|
135
|
-
planningSummary,
|
|
136
|
-
implementationSteps,
|
|
99
|
+
'输出审查报告并给出结论'
|
|
100
|
+
]
|
|
137
101
|
};
|
|
138
102
|
}
|
|
103
|
+
"use strict";
|
|
104
|
+
Object.defineProperty(exports, "__esModule", {
|
|
105
|
+
value: !0
|
|
106
|
+
});
|
|
107
|
+
var i = exports, n = {
|
|
108
|
+
get buildSyncParams () {
|
|
109
|
+
return a;
|
|
110
|
+
},
|
|
111
|
+
get buildTaskJson () {
|
|
112
|
+
return r;
|
|
113
|
+
},
|
|
114
|
+
get buildTaskObject () {
|
|
115
|
+
return t;
|
|
116
|
+
},
|
|
117
|
+
get buildTaskOutputs () {
|
|
118
|
+
return e;
|
|
119
|
+
}
|
|
120
|
+
};
|
|
121
|
+
for(var s in n)Object.defineProperty(i, s, {
|
|
122
|
+
enumerable: !0,
|
|
123
|
+
get: Object.getOwnPropertyDescriptor(n, s).get
|
|
124
|
+
});
|
|
125
|
+
let o = require("./parsers");
|
|
@@ -1,182 +1,121 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
12
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
13
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
14
|
-
}
|
|
15
|
-
Object.defineProperty(o, k2, desc);
|
|
16
|
-
}) : (function(o, m, k, k2) {
|
|
17
|
-
if (k2 === undefined) k2 = k;
|
|
18
|
-
o[k2] = m[k];
|
|
19
|
-
}));
|
|
20
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
21
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
22
|
-
}) : function(o, v) {
|
|
23
|
-
o["default"] = v;
|
|
24
|
-
});
|
|
25
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
26
|
-
var ownKeys = function(o) {
|
|
27
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
28
|
-
var ar = [];
|
|
29
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
30
|
-
return ar;
|
|
31
|
-
};
|
|
32
|
-
return ownKeys(o);
|
|
33
|
-
};
|
|
34
|
-
return function (mod) {
|
|
35
|
-
if (mod && mod.__esModule) return mod;
|
|
36
|
-
var result = {};
|
|
37
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
38
|
-
__setModuleDefault(result, mod);
|
|
39
|
-
return result;
|
|
1
|
+
function e(s) {
|
|
2
|
+
return "function" != typeof WeakMap ? null : (e = function(e) {
|
|
3
|
+
return new WeakMap();
|
|
4
|
+
})(s);
|
|
5
|
+
}
|
|
6
|
+
function s(s, r) {
|
|
7
|
+
var t, o, n;
|
|
8
|
+
if (!r && s && s.__esModule) return s;
|
|
9
|
+
if (null === s || "object" != typeof s && "function" != typeof s) return {
|
|
10
|
+
default: s
|
|
40
11
|
};
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
const config_1 = require("../../lib/config");
|
|
48
|
-
const parsers_1 = require("./parsers");
|
|
49
|
-
const builders_1 = require("./builders");
|
|
50
|
-
/**
|
|
51
|
-
* Validate config has required properties for sync
|
|
52
|
-
*/
|
|
53
|
-
function validateConfigForSync(config) {
|
|
54
|
-
if (!config.projectRoot) {
|
|
55
|
-
return {
|
|
56
|
-
valid: false,
|
|
57
|
-
reason: 'missing-project-root',
|
|
58
|
-
message: 'Config missing projectRoot',
|
|
59
|
-
};
|
|
60
|
-
}
|
|
61
|
-
if (!config.specRootAbs) {
|
|
62
|
-
return {
|
|
63
|
-
valid: false,
|
|
64
|
-
reason: 'missing-spec-root',
|
|
65
|
-
message: 'Config missing specRootAbs',
|
|
66
|
-
};
|
|
67
|
-
}
|
|
68
|
-
if (!config.tasksDirAbs) {
|
|
69
|
-
return {
|
|
70
|
-
valid: false,
|
|
71
|
-
reason: 'missing-tasks-dir',
|
|
72
|
-
message: 'Config missing tasksDirAbs',
|
|
73
|
-
};
|
|
12
|
+
if ((t = e(r)) && t.has(s)) return t.get(s);
|
|
13
|
+
for(var i in o = {
|
|
14
|
+
__proto__: null
|
|
15
|
+
}, n = Object.defineProperty && Object.getOwnPropertyDescriptor, s)if ("default" !== i && Object.prototype.hasOwnProperty.call(s, i)) {
|
|
16
|
+
var a = n ? Object.getOwnPropertyDescriptor(s, i) : null;
|
|
17
|
+
a && (a.get || a.set) ? Object.defineProperty(o, i, a) : o[i] = s[i];
|
|
74
18
|
}
|
|
75
|
-
return
|
|
19
|
+
return o.default = s, t && t.set(s, o), o;
|
|
76
20
|
}
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
success: false,
|
|
86
|
-
reason: 'missing-change',
|
|
87
|
-
message: 'Missing required argument: --change <change-name>',
|
|
88
|
-
};
|
|
89
|
-
}
|
|
90
|
-
// Validate config before use
|
|
91
|
-
const configValidation = validateConfigForSync(config);
|
|
92
|
-
if (!configValidation.valid) {
|
|
93
|
-
return {
|
|
94
|
-
success: false,
|
|
95
|
-
reason: configValidation.reason,
|
|
96
|
-
message: configValidation.message || 'Unknown config validation error',
|
|
97
|
-
};
|
|
98
|
-
}
|
|
99
|
-
const projectRoot = config.projectRoot || process.cwd();
|
|
100
|
-
const specRoot = config.specRootAbs || path.resolve(projectRoot, 'spec');
|
|
101
|
-
const changeDir = path.resolve(specRoot, 'changes', changeName);
|
|
102
|
-
const proposalPath = path.resolve(changeDir, 'product-requirement.md');
|
|
103
|
-
const designPath = path.resolve(changeDir, 'design.md');
|
|
104
|
-
const tasksPath = path.resolve(changeDir, 'tasks.md');
|
|
105
|
-
if (!fs.existsSync(changeDir)) {
|
|
106
|
-
return {
|
|
107
|
-
success: false,
|
|
108
|
-
reason: 'missing-change-dir',
|
|
109
|
-
message: `Spec change not found: ${changeDir}`,
|
|
110
|
-
};
|
|
111
|
-
}
|
|
112
|
-
// Continue with sync only if change directory exists
|
|
113
|
-
const proposalContent = (0, parsers_1.readIfExists)(proposalPath);
|
|
114
|
-
const designContent = (0, parsers_1.readIfExists)(designPath);
|
|
115
|
-
const tasksContent = (0, parsers_1.readIfExists)(tasksPath);
|
|
116
|
-
const { manifestPath, manifest, executionPath } = (0, parsers_1.resolveStructuredConfig)(changeDir, changeName);
|
|
117
|
-
const syncParams = (0, builders_1.buildSyncParams)(options, config, changeName, changeDir, proposalContent, designContent, tasksContent, manifest, manifestPath, executionPath);
|
|
118
|
-
const taskOutputPath = path.resolve(projectRoot, String(options.output || path.relative(projectRoot, path.resolve(config.tasksDirAbs, `${syncParams.taskId}.json`))));
|
|
119
|
-
const taskJson = (0, builders_1.buildTaskJson)({
|
|
120
|
-
...syncParams,
|
|
121
|
-
changeName,
|
|
122
|
-
manifestPath,
|
|
123
|
-
executionPath,
|
|
124
|
-
config,
|
|
125
|
-
});
|
|
126
|
-
if (options.dryRun) {
|
|
127
|
-
return {
|
|
128
|
-
success: true,
|
|
129
|
-
taskId: syncParams.taskId,
|
|
130
|
-
json: taskJson,
|
|
131
|
-
dryRun: true,
|
|
132
|
-
};
|
|
133
|
-
}
|
|
134
|
-
fs.mkdirSync(path.dirname(taskOutputPath), { recursive: true });
|
|
135
|
-
if (!options.force && fs.existsSync(taskOutputPath)) {
|
|
136
|
-
return {
|
|
137
|
-
success: false,
|
|
138
|
-
reason: 'file-exists',
|
|
139
|
-
message: 'Target task file already exists. Use --force to overwrite.',
|
|
140
|
-
};
|
|
141
|
-
}
|
|
142
|
-
fs.writeFileSync(taskOutputPath, taskJson, 'utf8');
|
|
143
|
-
return {
|
|
144
|
-
success: true,
|
|
145
|
-
taskId: syncParams.taskId,
|
|
146
|
-
taskPath: (0, parsers_1.ensurePosix)(path.relative(config.projectRoot, taskOutputPath)),
|
|
21
|
+
function r(e = {}) {
|
|
22
|
+
let s = (0, u.loadConfig)({
|
|
23
|
+
cwd: e.cwd
|
|
24
|
+
}), t = String(e.change || '').trim();
|
|
25
|
+
if (!t) return {
|
|
26
|
+
success: !1,
|
|
27
|
+
reason: 'missing-change',
|
|
28
|
+
message: 'Missing required argument: --change <change-name>'
|
|
147
29
|
};
|
|
30
|
+
let o = s.projectRoot ? s.specRootAbs ? s.tasksDirAbs ? {
|
|
31
|
+
valid: !0
|
|
32
|
+
} : {
|
|
33
|
+
valid: !1,
|
|
34
|
+
reason: 'missing-tasks-dir',
|
|
35
|
+
message: 'Config missing tasksDirAbs'
|
|
36
|
+
} : {
|
|
37
|
+
valid: !1,
|
|
38
|
+
reason: 'missing-spec-root',
|
|
39
|
+
message: 'Config missing specRootAbs'
|
|
40
|
+
} : {
|
|
41
|
+
valid: !1,
|
|
42
|
+
reason: 'missing-project-root',
|
|
43
|
+
message: 'Config missing projectRoot'
|
|
44
|
+
};
|
|
45
|
+
if (!o.valid) return {
|
|
46
|
+
success: !1,
|
|
47
|
+
reason: o.reason,
|
|
48
|
+
message: o.message || 'Unknown config validation error'
|
|
49
|
+
};
|
|
50
|
+
let n = s.projectRoot || process.cwd(), i = s.specRootAbs || c.resolve(n, 'spec'), g = c.resolve(i, 'changes', t), p = c.resolve(g, 'product-requirement.md'), f = c.resolve(g, 'design.md'), m = c.resolve(g, 'tasks.md');
|
|
51
|
+
if (!a.existsSync(g)) return {
|
|
52
|
+
success: !1,
|
|
53
|
+
reason: 'missing-change-dir',
|
|
54
|
+
message: `Spec change not found: ${g}`
|
|
55
|
+
};
|
|
56
|
+
let y = (0, d.readIfExists)(p), v = (0, d.readIfExists)(f), k = (0, d.readIfExists)(m), { manifestPath: b, manifest: j, executionPath: w } = (0, d.resolveStructuredConfig)(g, t), P = (0, l.buildSyncParams)(e, s, t, g, y, v, k, j, b, w), _ = c.resolve(n, String(e.output || c.relative(n, c.resolve(s.tasksDirAbs, `${P.taskId}.json`)))), h = (0, l.buildTaskJson)({
|
|
57
|
+
...P,
|
|
58
|
+
changeName: t,
|
|
59
|
+
manifestPath: b,
|
|
60
|
+
executionPath: w,
|
|
61
|
+
config: s
|
|
62
|
+
});
|
|
63
|
+
return e.dryRun ? {
|
|
64
|
+
success: !0,
|
|
65
|
+
taskId: P.taskId,
|
|
66
|
+
json: h,
|
|
67
|
+
dryRun: !0
|
|
68
|
+
} : (a.mkdirSync(c.dirname(_), {
|
|
69
|
+
recursive: !0
|
|
70
|
+
}), !e.force && a.existsSync(_)) ? {
|
|
71
|
+
success: !1,
|
|
72
|
+
reason: 'file-exists',
|
|
73
|
+
message: 'Target task file already exists. Use --force to overwrite.'
|
|
74
|
+
} : (a.writeFileSync(_, h, 'utf8'), {
|
|
75
|
+
success: !0,
|
|
76
|
+
taskId: P.taskId,
|
|
77
|
+
taskPath: (0, d.ensurePosix)(c.relative(s.projectRoot, _))
|
|
78
|
+
});
|
|
148
79
|
}
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
worktree: args.worktree,
|
|
161
|
-
output: args.output,
|
|
162
|
-
force: args.force === true,
|
|
163
|
-
dryRun: args['dry-run'] === true,
|
|
80
|
+
function t() {
|
|
81
|
+
let e = (0, d.parseArgs)(process.argv), s = r({
|
|
82
|
+
cwd: e.cwd,
|
|
83
|
+
change: e.change,
|
|
84
|
+
taskId: e['task-id'],
|
|
85
|
+
type: e.type,
|
|
86
|
+
priority: e.priority,
|
|
87
|
+
worktree: e.worktree,
|
|
88
|
+
output: e.output,
|
|
89
|
+
force: !0 === e.force,
|
|
90
|
+
dryRun: !0 === e['dry-run']
|
|
164
91
|
});
|
|
165
|
-
if (
|
|
166
|
-
|
|
167
|
-
process.exit(
|
|
168
|
-
}
|
|
169
|
-
if (result.dryRun) {
|
|
170
|
-
const jsonOutput = result.json || '';
|
|
171
|
-
process.stdout.write(jsonOutput);
|
|
172
|
-
process.exit(0);
|
|
92
|
+
if (s.success || (console.error(`[SPEC-SYNC] ${s.message}`), process.exit(1)), s.dryRun) {
|
|
93
|
+
let e = s.json || '';
|
|
94
|
+
process.stdout.write(e), process.exit(0);
|
|
173
95
|
}
|
|
174
|
-
console.log(`[SPEC-SYNC] Generated task: ${
|
|
175
|
-
process.exit(0);
|
|
96
|
+
console.log(`[SPEC-SYNC] Generated task: ${s.taskPath}`), process.exit(0);
|
|
176
97
|
}
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
98
|
+
"use strict";
|
|
99
|
+
Object.defineProperty(exports, "__esModule", {
|
|
100
|
+
value: !0
|
|
101
|
+
});
|
|
102
|
+
var o = exports, n = {
|
|
103
|
+
get default () {
|
|
104
|
+
return g;
|
|
105
|
+
},
|
|
106
|
+
get main () {
|
|
107
|
+
return t;
|
|
108
|
+
},
|
|
109
|
+
get syncSpecToTask () {
|
|
110
|
+
return r;
|
|
111
|
+
}
|
|
112
|
+
};
|
|
113
|
+
for(var i in n)Object.defineProperty(o, i, {
|
|
114
|
+
enumerable: !0,
|
|
115
|
+
get: Object.getOwnPropertyDescriptor(n, i).get
|
|
116
|
+
});
|
|
117
|
+
let a = /*#__PURE__*/ s(require("fs")), c = /*#__PURE__*/ s(require("path")), u = require("../../lib/config"), d = require("./parsers"), l = require("./builders");
|
|
118
|
+
require.main === module && t();
|
|
119
|
+
let g = {
|
|
120
|
+
syncSpecToTask: r
|
|
182
121
|
};
|