@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,220 +1,205 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.HOOK_LIFECYCLE = void 0;
|
|
8
|
-
exports.runHook = runHook;
|
|
9
|
-
exports.runHookSync = runHookSync;
|
|
10
|
-
exports.runHookChain = runHookChain;
|
|
11
|
-
exports.getHookLifecycle = getHookLifecycle;
|
|
12
|
-
exports.getHooksForPhase = getHooksForPhase;
|
|
13
|
-
exports.validateHookConfig = validateHookConfig;
|
|
14
|
-
exports.createHookConfig = createHookConfig;
|
|
15
|
-
const config_1 = require("../../lib/config");
|
|
16
|
-
const loader_1 = require("./loader");
|
|
17
|
-
const executor_1 = require("./executor");
|
|
18
|
-
/**
|
|
19
|
-
* Hook lifecycle definitions
|
|
20
|
-
*/
|
|
21
|
-
exports.HOOK_LIFECYCLE = {
|
|
22
|
-
'pre-design': { phase: 'design', timing: 'pre' },
|
|
23
|
-
'post-design': { phase: 'design', timing: 'post' },
|
|
24
|
-
'pre-planning': { phase: 'planning', timing: 'pre' },
|
|
25
|
-
'post-planning': { phase: 'planning', timing: 'post' },
|
|
26
|
-
'pre-implementation': { phase: 'implementation', timing: 'pre' },
|
|
27
|
-
'post-implementation': { phase: 'implementation', timing: 'post' },
|
|
28
|
-
'pre-review': { phase: 'review', timing: 'pre' },
|
|
29
|
-
'post-review': { phase: 'review', timing: 'post' },
|
|
30
|
-
'pre-merge': { phase: 'merge', timing: 'pre' },
|
|
31
|
-
'post-merge': { phase: 'merge', timing: 'post' },
|
|
32
|
-
'pre-command': { phase: 'command', timing: 'pre' },
|
|
33
|
-
'post-command': { phase: 'command', timing: 'post' },
|
|
34
|
-
};
|
|
35
|
-
/**
|
|
36
|
-
* Run enabled hooks async
|
|
37
|
-
*/
|
|
38
|
-
async function runEnabledHooks(enabledHooks, context, config, hookName) {
|
|
39
|
-
const results = [];
|
|
40
|
-
let allSuccess = true;
|
|
41
|
-
for (const hookConfig of enabledHooks) {
|
|
42
|
-
const result = await (0, executor_1.executeSingleHookAsync)(hookConfig, context, config);
|
|
43
|
-
results.push(result);
|
|
44
|
-
if (!result.success) {
|
|
45
|
-
allSuccess = false;
|
|
46
|
-
}
|
|
1
|
+
async function e(e, t, o, n) {
|
|
2
|
+
let s = [], r = !0;
|
|
3
|
+
for (let n of e){
|
|
4
|
+
let e = await (0, m.executeSingleHookAsync)(n, t, o);
|
|
5
|
+
s.push(e), e.success || (r = !1);
|
|
47
6
|
}
|
|
48
7
|
return {
|
|
49
|
-
success:
|
|
50
|
-
executed:
|
|
51
|
-
results,
|
|
52
|
-
hookName
|
|
8
|
+
success: r,
|
|
9
|
+
executed: s.length,
|
|
10
|
+
results: s,
|
|
11
|
+
hookName: n
|
|
53
12
|
};
|
|
54
13
|
}
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
const result = (0, executor_1.executeSingleHookSync)(hookConfig, context, config);
|
|
63
|
-
results.push(result);
|
|
64
|
-
if (!result.success) {
|
|
65
|
-
allSuccess = false;
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
return {
|
|
69
|
-
success: allSuccess,
|
|
70
|
-
executed: results.length,
|
|
71
|
-
results,
|
|
72
|
-
hookName,
|
|
14
|
+
async function t(t, o) {
|
|
15
|
+
let n = o?.config || (0, p.loadConfig)(), s = (0, g.loadHooksConfig)(n);
|
|
16
|
+
if (!s.hooks || !s.hooks[t]) return {
|
|
17
|
+
success: !0,
|
|
18
|
+
executed: 0,
|
|
19
|
+
results: [],
|
|
20
|
+
message: `no-hooks-configured:${t}`
|
|
73
21
|
};
|
|
22
|
+
let r = s.hooks[t].filter((e)=>!1 !== e.enabled);
|
|
23
|
+
return 0 === r.length ? {
|
|
24
|
+
success: !0,
|
|
25
|
+
executed: 0,
|
|
26
|
+
results: [],
|
|
27
|
+
message: `no-enabled-hooks:${t}`
|
|
28
|
+
} : e(r, o, n, t);
|
|
74
29
|
}
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
executed: 0,
|
|
95
|
-
results: [],
|
|
96
|
-
message: `no-enabled-hooks:${hookName}`,
|
|
97
|
-
};
|
|
98
|
-
}
|
|
99
|
-
return runEnabledHooks(enabledHooks, context, config, hookName);
|
|
100
|
-
}
|
|
101
|
-
/**
|
|
102
|
-
* Run a single hook by name (sync)
|
|
103
|
-
*/
|
|
104
|
-
function runHookSync(hookName, context) {
|
|
105
|
-
const config = context?.config || (0, config_1.loadConfig)();
|
|
106
|
-
const hooksConfig = (0, loader_1.loadHooksConfig)(config);
|
|
107
|
-
if (!hooksConfig.hooks || !hooksConfig.hooks[hookName]) {
|
|
108
|
-
return {
|
|
109
|
-
success: true,
|
|
110
|
-
executed: 0,
|
|
111
|
-
results: [],
|
|
112
|
-
message: `no-hooks-configured:${hookName}`,
|
|
113
|
-
};
|
|
114
|
-
}
|
|
115
|
-
const hooks = hooksConfig.hooks[hookName];
|
|
116
|
-
const enabledHooks = hooks.filter((h) => h.enabled !== false);
|
|
117
|
-
if (enabledHooks.length === 0) {
|
|
118
|
-
return {
|
|
119
|
-
success: true,
|
|
120
|
-
executed: 0,
|
|
121
|
-
results: [],
|
|
122
|
-
message: `no-enabled-hooks:${hookName}`,
|
|
123
|
-
};
|
|
30
|
+
function o(e, t) {
|
|
31
|
+
let o = t?.config || (0, p.loadConfig)(), n = (0, g.loadHooksConfig)(o);
|
|
32
|
+
if (!n.hooks || !n.hooks[e]) return {
|
|
33
|
+
success: !0,
|
|
34
|
+
executed: 0,
|
|
35
|
+
results: [],
|
|
36
|
+
message: `no-hooks-configured:${e}`
|
|
37
|
+
};
|
|
38
|
+
let s = n.hooks[e].filter((e)=>!1 !== e.enabled);
|
|
39
|
+
if (0 === s.length) return {
|
|
40
|
+
success: !0,
|
|
41
|
+
executed: 0,
|
|
42
|
+
results: [],
|
|
43
|
+
message: `no-enabled-hooks:${e}`
|
|
44
|
+
};
|
|
45
|
+
let r = [], i = !0;
|
|
46
|
+
for (let e of s){
|
|
47
|
+
let n = (0, m.executeSingleHookSync)(e, t, o);
|
|
48
|
+
r.push(n), n.success || (i = !1);
|
|
124
49
|
}
|
|
125
|
-
return
|
|
50
|
+
return {
|
|
51
|
+
success: i,
|
|
52
|
+
executed: r.length,
|
|
53
|
+
results: r,
|
|
54
|
+
hookName: e
|
|
55
|
+
};
|
|
126
56
|
}
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
for (const hookName of hookNames) {
|
|
134
|
-
const result = await runHook(hookName, context);
|
|
135
|
-
results.push(result);
|
|
136
|
-
if (!result.success) {
|
|
137
|
-
allSuccess = false;
|
|
57
|
+
async function n(e, o) {
|
|
58
|
+
let n = [], s = !0;
|
|
59
|
+
for (let r of e){
|
|
60
|
+
let e = await t(r, o);
|
|
61
|
+
if (n.push(e), !e.success) {
|
|
62
|
+
s = !1;
|
|
138
63
|
break;
|
|
139
64
|
}
|
|
140
65
|
}
|
|
141
66
|
return {
|
|
142
|
-
success:
|
|
143
|
-
executed:
|
|
144
|
-
results:
|
|
145
|
-
hookNames
|
|
67
|
+
success: s,
|
|
68
|
+
executed: n.length,
|
|
69
|
+
results: n.flatMap((e)=>e.results),
|
|
70
|
+
hookNames: e
|
|
146
71
|
};
|
|
147
72
|
}
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
*/
|
|
151
|
-
function getHookLifecycle(hookName) {
|
|
152
|
-
return exports.HOOK_LIFECYCLE[hookName] || null;
|
|
73
|
+
function s(e) {
|
|
74
|
+
return f[e] || null;
|
|
153
75
|
}
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
for (const [hookName, lifecycle] of Object.entries(exports.HOOK_LIFECYCLE)) {
|
|
165
|
-
if (lifecycle.phase === phase && lifecycle.timing === timing) {
|
|
166
|
-
const hooks = hooksConfig.hooks[hookName] || [];
|
|
167
|
-
matchingHooks.push(...hooks.map((h) => ({
|
|
168
|
-
...h,
|
|
169
|
-
hookName,
|
|
170
|
-
lifecycle,
|
|
76
|
+
function r(e, t, o) {
|
|
77
|
+
let n = o || (0, p.loadConfig)(), s = (0, g.loadHooksConfig)(n);
|
|
78
|
+
if (!s.hooks) return [];
|
|
79
|
+
let r = [];
|
|
80
|
+
for (let [o, n] of Object.entries(f))if (n.phase === e && n.timing === t) {
|
|
81
|
+
let e = s.hooks[o] || [];
|
|
82
|
+
r.push(...e.map((e)=>({
|
|
83
|
+
...e,
|
|
84
|
+
hookName: o,
|
|
85
|
+
lifecycle: n
|
|
171
86
|
})));
|
|
172
|
-
}
|
|
173
87
|
}
|
|
174
|
-
return
|
|
88
|
+
return r;
|
|
175
89
|
}
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
if (!hookConfig.name || typeof hookConfig.name !== 'string') {
|
|
182
|
-
errors.push('hook-must-have-name');
|
|
183
|
-
}
|
|
184
|
-
if (!hookConfig.script || typeof hookConfig.script !== 'string') {
|
|
185
|
-
errors.push('hook-must-have-script');
|
|
186
|
-
}
|
|
187
|
-
if (hookConfig.timeout !== undefined && typeof hookConfig.timeout !== 'number') {
|
|
188
|
-
errors.push('hook-timeout-must-be-number');
|
|
189
|
-
}
|
|
190
|
-
return {
|
|
191
|
-
valid: errors.length === 0,
|
|
192
|
-
errors,
|
|
90
|
+
function i(e) {
|
|
91
|
+
let t = [];
|
|
92
|
+
return e.name && 'string' == typeof e.name || t.push('hook-must-have-name'), e.script && 'string' == typeof e.script || t.push("hook-must-have-script"), void 0 !== e.timeout && 'number' != typeof e.timeout && t.push('hook-timeout-must-be-number'), {
|
|
93
|
+
valid: 0 === t.length,
|
|
94
|
+
errors: t
|
|
193
95
|
};
|
|
194
96
|
}
|
|
195
|
-
|
|
196
|
-
* Create hook config
|
|
197
|
-
*/
|
|
198
|
-
function createHookConfig(name, script, options = {}) {
|
|
97
|
+
function u(e, t, o = {}) {
|
|
199
98
|
return {
|
|
200
|
-
name,
|
|
201
|
-
script,
|
|
202
|
-
enabled:
|
|
203
|
-
timeout:
|
|
204
|
-
...
|
|
99
|
+
name: e,
|
|
100
|
+
script: t,
|
|
101
|
+
enabled: !1 !== o.enabled,
|
|
102
|
+
timeout: o.timeout || 30000,
|
|
103
|
+
...o
|
|
205
104
|
};
|
|
206
105
|
}
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
106
|
+
"use strict";
|
|
107
|
+
Object.defineProperty(exports, "__esModule", {
|
|
108
|
+
value: !0
|
|
109
|
+
});
|
|
110
|
+
var a = exports, c = {
|
|
111
|
+
get HOOK_LIFECYCLE () {
|
|
112
|
+
return f;
|
|
113
|
+
},
|
|
114
|
+
get createHookConfig () {
|
|
115
|
+
return u;
|
|
116
|
+
},
|
|
117
|
+
get default () {
|
|
118
|
+
return h;
|
|
119
|
+
},
|
|
120
|
+
get getHookLifecycle () {
|
|
121
|
+
return s;
|
|
122
|
+
},
|
|
123
|
+
get getHooksForPhase () {
|
|
124
|
+
return r;
|
|
125
|
+
},
|
|
126
|
+
get runHook () {
|
|
127
|
+
return t;
|
|
128
|
+
},
|
|
129
|
+
get runHookChain () {
|
|
130
|
+
return n;
|
|
131
|
+
},
|
|
132
|
+
get runHookSync () {
|
|
133
|
+
return o;
|
|
134
|
+
},
|
|
135
|
+
get validateHookConfig () {
|
|
136
|
+
return i;
|
|
137
|
+
}
|
|
138
|
+
};
|
|
139
|
+
for(var l in c)Object.defineProperty(a, l, {
|
|
140
|
+
enumerable: !0,
|
|
141
|
+
get: Object.getOwnPropertyDescriptor(c, l).get
|
|
142
|
+
});
|
|
143
|
+
let p = require("../../lib/config"), g = require("./loader"), m = require("./executor"), f = {
|
|
144
|
+
'pre-design': {
|
|
145
|
+
phase: 'design',
|
|
146
|
+
timing: 'pre'
|
|
147
|
+
},
|
|
148
|
+
'post-design': {
|
|
149
|
+
phase: 'design',
|
|
150
|
+
timing: 'post'
|
|
151
|
+
},
|
|
152
|
+
'pre-planning': {
|
|
153
|
+
phase: 'planning',
|
|
154
|
+
timing: 'pre'
|
|
155
|
+
},
|
|
156
|
+
'post-planning': {
|
|
157
|
+
phase: 'planning',
|
|
158
|
+
timing: 'post'
|
|
159
|
+
},
|
|
160
|
+
'pre-implementation': {
|
|
161
|
+
phase: 'implementation',
|
|
162
|
+
timing: 'pre'
|
|
163
|
+
},
|
|
164
|
+
'post-implementation': {
|
|
165
|
+
phase: 'implementation',
|
|
166
|
+
timing: 'post'
|
|
167
|
+
},
|
|
168
|
+
'pre-review': {
|
|
169
|
+
phase: 'review',
|
|
170
|
+
timing: 'pre'
|
|
171
|
+
},
|
|
172
|
+
'post-review': {
|
|
173
|
+
phase: 'review',
|
|
174
|
+
timing: 'post'
|
|
175
|
+
},
|
|
176
|
+
'pre-merge': {
|
|
177
|
+
phase: 'merge',
|
|
178
|
+
timing: 'pre'
|
|
179
|
+
},
|
|
180
|
+
'post-merge': {
|
|
181
|
+
phase: 'merge',
|
|
182
|
+
timing: 'post'
|
|
183
|
+
},
|
|
184
|
+
'pre-command': {
|
|
185
|
+
phase: 'command',
|
|
186
|
+
timing: 'pre'
|
|
187
|
+
},
|
|
188
|
+
'post-command': {
|
|
189
|
+
phase: 'command',
|
|
190
|
+
timing: 'post'
|
|
191
|
+
}
|
|
192
|
+
}, h = {
|
|
193
|
+
runHook: t,
|
|
194
|
+
runHookSync: o,
|
|
195
|
+
runHookChain: n,
|
|
196
|
+
loadHooksConfig: g.loadHooksConfig,
|
|
197
|
+
loadHookScript: g.loadHookScript,
|
|
198
|
+
loadHookScriptAsync: g.loadHookScriptAsync,
|
|
199
|
+
executeHookFunction: m.executeHookFunction,
|
|
200
|
+
getHookLifecycle: s,
|
|
201
|
+
getHooksForPhase: r,
|
|
202
|
+
validateHookConfig: i,
|
|
203
|
+
createHookConfig: u,
|
|
204
|
+
HOOK_LIFECYCLE: f
|
|
220
205
|
};
|
|
@@ -1,126 +1,87 @@
|
|
|
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.getDefaultHooksPath = getDefaultHooksPath;
|
|
41
|
-
exports.loadHooksConfig = loadHooksConfig;
|
|
42
|
-
exports.loadHookScriptAsync = loadHookScriptAsync;
|
|
43
|
-
exports.loadHookScript = loadHookScript;
|
|
44
|
-
const fs = __importStar(require("fs"));
|
|
45
|
-
const path = __importStar(require("path"));
|
|
46
|
-
const config_1 = require("../../lib/config");
|
|
47
|
-
/**
|
|
48
|
-
* Default hooks config
|
|
49
|
-
*/
|
|
50
|
-
const DEFAULT_HOOKS_CONFIG = {
|
|
51
|
-
hooks: {},
|
|
52
|
-
};
|
|
53
|
-
/**
|
|
54
|
-
* Get default hooks path
|
|
55
|
-
*/
|
|
56
|
-
function getDefaultHooksPath(config) {
|
|
57
|
-
return path.resolve(config.harnessRootAbs, 'hooks.json');
|
|
1
|
+
function e(r) {
|
|
2
|
+
return "function" != typeof WeakMap ? null : (e = function(e) {
|
|
3
|
+
return new WeakMap();
|
|
4
|
+
})(r);
|
|
58
5
|
}
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
function
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
if (
|
|
66
|
-
|
|
6
|
+
function r(r, o) {
|
|
7
|
+
var t, n, i;
|
|
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 l in n = {
|
|
14
|
+
__proto__: null
|
|
15
|
+
}, i = Object.defineProperty && Object.getOwnPropertyDescriptor, r)if ("default" !== l && Object.prototype.hasOwnProperty.call(r, l)) {
|
|
16
|
+
var s = i ? Object.getOwnPropertyDescriptor(r, l) : null;
|
|
17
|
+
s && (s.get || s.set) ? Object.defineProperty(n, l, s) : n[l] = r[l];
|
|
67
18
|
}
|
|
19
|
+
return n.default = r, t && t.set(r, n), n;
|
|
20
|
+
}
|
|
21
|
+
function o(e) {
|
|
22
|
+
return a.resolve(e.harnessRootAbs, 'hooks.json');
|
|
23
|
+
}
|
|
24
|
+
function t(e) {
|
|
25
|
+
let r = o(e || (0, f.loadConfig)());
|
|
26
|
+
if (!c.existsSync(r)) return {
|
|
27
|
+
...p,
|
|
28
|
+
configPath: r
|
|
29
|
+
};
|
|
68
30
|
try {
|
|
69
|
-
|
|
70
|
-
const parsed = JSON.parse(content);
|
|
31
|
+
let e = c.readFileSync(r, 'utf8'), o = JSON.parse(e);
|
|
71
32
|
return {
|
|
72
|
-
...
|
|
73
|
-
...
|
|
74
|
-
configPath:
|
|
33
|
+
...p,
|
|
34
|
+
...o,
|
|
35
|
+
configPath: r
|
|
36
|
+
};
|
|
37
|
+
} catch (e) {
|
|
38
|
+
return console.warn('[HOOK-RUNNER] Failed to load hooks config:', e instanceof Error ? e.message : 'Unknown error'), {
|
|
39
|
+
...p,
|
|
40
|
+
configPath: r
|
|
75
41
|
};
|
|
76
|
-
}
|
|
77
|
-
catch (error) {
|
|
78
|
-
console.warn('[HOOK-RUNNER] Failed to load hooks config:', error instanceof Error ? error.message : 'Unknown error');
|
|
79
|
-
return { ...DEFAULT_HOOKS_CONFIG, configPath: hooksPath };
|
|
80
42
|
}
|
|
81
43
|
}
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
async function loadHookScriptAsync(scriptPath, config) {
|
|
86
|
-
const cfg = config || (0, config_1.loadConfig)();
|
|
87
|
-
const absolutePath = path.isAbsolute(scriptPath)
|
|
88
|
-
? scriptPath
|
|
89
|
-
: path.resolve(cfg.projectRoot, scriptPath);
|
|
90
|
-
if (!fs.existsSync(absolutePath)) {
|
|
91
|
-
console.warn('[HOOK-RUNNER] Hook script not found:', absolutePath);
|
|
92
|
-
return null;
|
|
93
|
-
}
|
|
44
|
+
async function n(e, o) {
|
|
45
|
+
let t = o || (0, f.loadConfig)(), n = a.isAbsolute(e) ? e : a.resolve(t.projectRoot, e);
|
|
46
|
+
if (!c.existsSync(n)) return console.warn("[HOOK-RUNNER] Hook script not found:", n), null;
|
|
94
47
|
try {
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
catch (error) {
|
|
100
|
-
console.error('[HOOK-RUNNER] Failed to load hook script:', absolutePath, error instanceof Error ? error.message : 'Unknown error');
|
|
101
|
-
return null;
|
|
48
|
+
let e = `file://${n}?t=${Date.now()}`, o = await Promise.resolve(e).then((e)=>/*#__PURE__*/ r(require(e)));
|
|
49
|
+
return o.default || o;
|
|
50
|
+
} catch (e) {
|
|
51
|
+
return console.error("[HOOK-RUNNER] Failed to load hook script:", n, e instanceof Error ? e.message : 'Unknown error'), null;
|
|
102
52
|
}
|
|
103
53
|
}
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
*/
|
|
108
|
-
function loadHookScript(scriptPath, config) {
|
|
109
|
-
const cfg = config || (0, config_1.loadConfig)();
|
|
110
|
-
const absolutePath = path.isAbsolute(scriptPath)
|
|
111
|
-
? scriptPath
|
|
112
|
-
: path.resolve(cfg.projectRoot, scriptPath);
|
|
113
|
-
if (!fs.existsSync(absolutePath)) {
|
|
114
|
-
console.warn('[HOOK-RUNNER] Hook script not found:', absolutePath);
|
|
115
|
-
return null;
|
|
116
|
-
}
|
|
54
|
+
function i(e, r) {
|
|
55
|
+
let o = r || (0, f.loadConfig)(), t = a.isAbsolute(e) ? e : a.resolve(o.projectRoot, e);
|
|
56
|
+
if (!c.existsSync(t)) return console.warn("[HOOK-RUNNER] Hook script not found:", t), null;
|
|
117
57
|
try {
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
return
|
|
121
|
-
}
|
|
122
|
-
catch (error) {
|
|
123
|
-
console.error('[HOOK-RUNNER] Failed to load hook script:', absolutePath, error instanceof Error ? error.message : 'Unknown error');
|
|
124
|
-
return null;
|
|
58
|
+
return require(t);
|
|
59
|
+
} catch (e) {
|
|
60
|
+
return console.error("[HOOK-RUNNER] Failed to load hook script:", t, e instanceof Error ? e.message : 'Unknown error'), null;
|
|
125
61
|
}
|
|
126
62
|
}
|
|
63
|
+
"use strict";
|
|
64
|
+
Object.defineProperty(exports, "__esModule", {
|
|
65
|
+
value: !0
|
|
66
|
+
});
|
|
67
|
+
var l = exports, s = {
|
|
68
|
+
get getDefaultHooksPath () {
|
|
69
|
+
return o;
|
|
70
|
+
},
|
|
71
|
+
get loadHookScript () {
|
|
72
|
+
return i;
|
|
73
|
+
},
|
|
74
|
+
get loadHookScriptAsync () {
|
|
75
|
+
return n;
|
|
76
|
+
},
|
|
77
|
+
get loadHooksConfig () {
|
|
78
|
+
return t;
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
for(var u in s)Object.defineProperty(l, u, {
|
|
82
|
+
enumerable: !0,
|
|
83
|
+
get: Object.getOwnPropertyDescriptor(s, u).get
|
|
84
|
+
});
|
|
85
|
+
let c = /*#__PURE__*/ r(require("fs")), a = /*#__PURE__*/ r(require("path")), f = require("../../lib/config"), p = {
|
|
86
|
+
hooks: {}
|
|
87
|
+
};
|