@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.
Files changed (56) hide show
  1. package/README.md +2 -4
  2. package/SKILL.md +2 -4
  3. package/dist/commands/analyze.js +160 -318
  4. package/dist/commands/archive.js +44 -48
  5. package/dist/commands/design.js +225 -400
  6. package/dist/commands/extract.js +174 -303
  7. package/dist/commands/init.js +103 -147
  8. package/dist/commands/merge/index.js +184 -295
  9. package/dist/commands/merge/merger.js +112 -134
  10. package/dist/commands/merge/types.js +3 -5
  11. package/dist/commands/merge/validators.js +115 -132
  12. package/dist/commands/merge.js +46 -13
  13. package/dist/commands/start.js +155 -248
  14. package/dist/commands/status.js +68 -129
  15. package/dist/commands/sync.js +37 -53
  16. package/dist/commands/tasks-gen/doc-parser.js +148 -228
  17. package/dist/commands/tasks-gen/generators.js +104 -116
  18. package/dist/commands/tasks-gen/index.js +206 -314
  19. package/dist/commands/tasks-gen/parsers.js +131 -232
  20. package/dist/commands/tasks-gen/templates.js +9 -10
  21. package/dist/commands/tasks-gen/types.js +36 -14
  22. package/dist/commands/tasks-gen/validators.js +33 -49
  23. package/dist/commands/tasks.js +58 -20
  24. package/dist/commands/worktree.js +167 -249
  25. package/dist/hooks/check-prd-exists.js +45 -55
  26. package/dist/hooks/check-worktree-conflict.js +68 -101
  27. package/dist/hooks/hook-runner/executor.js +134 -126
  28. package/dist/hooks/hook-runner/index.js +181 -196
  29. package/dist/hooks/hook-runner/loader.js +74 -113
  30. package/dist/hooks/hook-runner/types.js +3 -5
  31. package/dist/hooks/hook-runner.js +94 -28
  32. package/dist/hooks/phase-complete-detector.js +125 -191
  33. package/dist/hooks/phase-gate-validator.js +315 -376
  34. package/dist/hooks/save-checkpoint.js +87 -130
  35. package/dist/hooks/start-mcp-servers.js +50 -65
  36. package/dist/hooks/stop-mcp-servers.js +40 -49
  37. package/dist/index.js +84 -153
  38. package/dist/lib/archive.js +126 -209
  39. package/dist/lib/config.js +141 -226
  40. package/dist/lib/constants.js +155 -145
  41. package/dist/lib/interactive.js +98 -148
  42. package/dist/lib/mcp-client.js +197 -320
  43. package/dist/lib/state.js +142 -253
  44. package/dist/slash/executor.js +299 -330
  45. package/dist/slash/index.js +69 -43
  46. package/dist/slash/parser.js +84 -97
  47. package/dist/slash/registry.js +100 -88
  48. package/dist/spec/openspec-to-task/builders.js +96 -109
  49. package/dist/spec/openspec-to-task/index.js +112 -173
  50. package/dist/spec/openspec-to-task/parsers.js +148 -219
  51. package/dist/spec/openspec-to-task/types.js +3 -5
  52. package/dist/spec/sync-openspec-to-task.js +47 -19
  53. package/dist/spec/sync-task-to-openspec.js +241 -272
  54. package/dist/types/ai-context.js +3 -8
  55. package/package.json +8 -6
  56. package/references/CLI-TUTORIAL.md +4 -10
@@ -1,247 +1,162 @@
1
- "use strict";
2
- /**
3
- * config.ts
4
- * Configuration loader for task-flow
5
- *
6
- * Loads configuration from:
7
- * 1. Environment variables (highest priority)
8
- * 2. Config file (.harnessrc)
9
- * 3. Default values (lowest priority)
10
- */
11
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
12
- if (k2 === undefined) k2 = k;
13
- var desc = Object.getOwnPropertyDescriptor(m, k);
14
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
15
- desc = { enumerable: true, get: function() { return m[k]; } };
16
- }
17
- Object.defineProperty(o, k2, desc);
18
- }) : (function(o, m, k, k2) {
19
- if (k2 === undefined) k2 = k;
20
- o[k2] = m[k];
21
- }));
22
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
23
- Object.defineProperty(o, "default", { enumerable: true, value: v });
24
- }) : function(o, v) {
25
- o["default"] = v;
26
- });
27
- var __importStar = (this && this.__importStar) || (function () {
28
- var ownKeys = function(o) {
29
- ownKeys = Object.getOwnPropertyNames || function (o) {
30
- var ar = [];
31
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
32
- return ar;
33
- };
34
- return ownKeys(o);
35
- };
36
- return function (mod) {
37
- if (mod && mod.__esModule) return mod;
38
- var result = {};
39
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
40
- __setModuleDefault(result, mod);
41
- return result;
1
+ function e(r) {
2
+ return "function" != typeof WeakMap ? null : (e = function(e) {
3
+ return new WeakMap();
4
+ })(r);
5
+ }
6
+ function r(r, t) {
7
+ var s, o, n;
8
+ if (!t && r && r.__esModule) return r;
9
+ if (null === r || "object" != typeof r && "function" != typeof r) return {
10
+ default: r
42
11
  };
43
- })();
44
- Object.defineProperty(exports, "__esModule", { value: true });
45
- exports.DEFAULTS = void 0;
46
- exports.findConfigFile = findConfigFile;
47
- exports.loadConfigFile = loadConfigFile;
48
- exports.loadEnvConfig = loadEnvConfig;
49
- exports.resolvePath = resolvePath;
50
- exports.loadConfig = loadConfig;
51
- exports.getConfig = getConfig;
52
- exports.ensureDirectories = ensureDirectories;
53
- const fs = __importStar(require("fs"));
54
- const path = __importStar(require("path"));
55
- /**
56
- * Default configuration values
57
- */
58
- exports.DEFAULTS = {
59
- harnessRoot: '.harness',
60
- worktreesDir: '.worktrees',
61
- tasksDir: 'tasks',
62
- snapshotsDir: 'snapshots',
63
- archiveDir: 'archive',
64
- reportsDir: 'reports',
65
- specRoot: 'spec',
66
- };
67
- /**
68
- * Environment variable mappings
69
- */
70
- const ENV_MAPPING = {
71
- HARNESS_ROOT: 'harnessRoot',
72
- HARNESS_WORKTREES_DIR: 'worktreesDir',
73
- HARNESS_TASKS_DIR: 'tasksDir',
74
- HARNESS_SNAPSHOTS_DIR: 'snapshotsDir',
75
- HARNESS_ARCHIVE_DIR: 'archiveDir',
76
- HARNESS_REPORTS_DIR: 'reportsDir',
77
- HARNESS_SPEC_ROOT: 'specRoot',
78
- HARNESS_CONFIG_FILE: 'configFile',
79
- };
80
- /**
81
- * Find config file starting from cwd and walking up
82
- * @param cwd - Current working directory
83
- * @returns Path to config file or null
84
- */
85
- function findConfigFile(cwd) {
86
- const configNames = ['.harnessrc', '.harnessrc.json', 'harness.config.json'];
87
- let current = cwd;
88
- while (current !== path.dirname(current)) {
89
- for (const configName of configNames) {
90
- const configPath = path.resolve(current, configName);
91
- if (fs.existsSync(configPath)) {
92
- return configPath;
93
- }
94
- }
95
- current = path.dirname(current);
12
+ if ((s = e(t)) && s.has(r)) return s.get(r);
13
+ for(var i in o = {
14
+ __proto__: null
15
+ }, n = Object.defineProperty && Object.getOwnPropertyDescriptor, r)if ("default" !== i && Object.prototype.hasOwnProperty.call(r, i)) {
16
+ var a = n ? Object.getOwnPropertyDescriptor(r, i) : null;
17
+ a && (a.get || a.set) ? Object.defineProperty(o, i, a) : o[i] = r[i];
96
18
  }
97
- // Check cwd for config file even if not found walking up
98
- for (const configName of configNames) {
99
- const configPath = path.resolve(cwd, configName);
100
- if (fs.existsSync(configPath)) {
101
- return configPath;
19
+ return o.default = r, s && s.set(r, o), o;
20
+ }
21
+ function t(e) {
22
+ let r = [
23
+ '.harnessrc',
24
+ '.harnessrc.json',
25
+ 'harness.config.json'
26
+ ], t = e;
27
+ for(; t !== D.dirname(t);){
28
+ for (let e of r){
29
+ let r = D.resolve(t, e);
30
+ if (p.existsSync(r)) return r;
102
31
  }
32
+ t = D.dirname(t);
33
+ }
34
+ for (let t of r){
35
+ let r = D.resolve(e, t);
36
+ if (p.existsSync(r)) return r;
103
37
  }
104
38
  return null;
105
39
  }
106
- /**
107
- * Load config from file
108
- * @param configPath - Path to config file
109
- * @returns Config object
110
- */
111
- function loadConfigFile(configPath) {
112
- if (!configPath || !fs.existsSync(configPath)) {
113
- return {};
114
- }
40
+ function s(e) {
41
+ if (!e || !p.existsSync(e)) return {};
115
42
  try {
116
- const content = fs.readFileSync(configPath, 'utf8');
117
- // Support both JSON and JSONC (with comments)
118
- const cleaned = content.replace(/\/\/.*$/gm, '').replace(/\/\*[\s\S]*?\*\//g, '');
119
- return JSON.parse(cleaned);
120
- }
121
- catch (error) {
122
- const errorMessage = error instanceof Error ? error.message : 'Unknown error';
123
- console.warn(`[CONFIG] Failed to load config file: ${configPath}`, errorMessage);
124
- return {};
43
+ let r = p.readFileSync(e, 'utf8').replace(/\/\/.*$/gm, '').replace(/\/\*[\s\S]*?\*\//g, '');
44
+ return JSON.parse(r);
45
+ } catch (r) {
46
+ return console.warn(`[CONFIG] Failed to load config file: ${e}`, r instanceof Error ? r.message : 'Unknown error'), {};
125
47
  }
126
48
  }
127
- /**
128
- * Load config from environment variables
129
- * @returns Config object
130
- */
131
- function loadEnvConfig() {
132
- const config = {};
133
- for (const [envVar, configKey] of Object.entries(ENV_MAPPING)) {
134
- const envValue = process.env[envVar];
135
- if (envValue) {
136
- config[configKey] = envValue;
137
- }
49
+ function o() {
50
+ let e = {};
51
+ for (let [r, t] of Object.entries(h)){
52
+ let s = process.env[r];
53
+ s && (e[t] = s);
138
54
  }
139
- return config;
55
+ return e;
140
56
  }
141
- /**
142
- * Resolve absolute path relative to project root
143
- * @param basePath - Base path (can be relative or absolute)
144
- * @param projectRoot - Project root directory
145
- * @returns Resolved absolute path
146
- */
147
- function resolvePath(basePath, projectRoot) {
148
- if (!basePath) {
149
- return projectRoot;
150
- }
151
- if (path.isAbsolute(basePath)) {
152
- return basePath;
153
- }
154
- return path.resolve(projectRoot, basePath);
57
+ function n(e, r) {
58
+ return e ? D.isAbsolute(e) ? e : D.resolve(r, e) : r;
155
59
  }
156
- /**
157
- * Load and merge all configuration sources
158
- * @param options - Options
159
- * @param options.cwd - Current working directory
160
- * @param options.configFile - Explicit config file path
161
- * @returns Merged configuration
162
- */
163
- function loadConfig(options = {}) {
164
- const cwd = path.resolve(options.cwd || process.cwd());
165
- // Find config file
166
- const configPath = options.configFile || findConfigFile(cwd);
167
- // Determine project root
168
- let projectRoot = cwd;
169
- if (configPath) {
170
- projectRoot = path.dirname(configPath);
171
- // Walk up to find actual project root (where .git is)
172
- let current = projectRoot;
173
- while (current !== path.dirname(current)) {
174
- if (fs.existsSync(path.resolve(current, '.git'))) {
175
- projectRoot = current;
60
+ function i(e = {}) {
61
+ let r = D.resolve(e.cwd || process.cwd()), a = e.configFile || t(r), c = r;
62
+ if (a) {
63
+ let e = c = D.dirname(a);
64
+ for(; e !== D.dirname(e);){
65
+ if (p.existsSync(D.resolve(e, '.git'))) {
66
+ c = e;
176
67
  break;
177
68
  }
178
- current = path.dirname(current);
69
+ e = D.dirname(e);
179
70
  }
180
71
  }
181
- // Load from all sources
182
- const fileConfig = configPath ? loadConfigFile(configPath) : {};
183
- const envConfig = loadEnvConfig();
184
- // Merge configurations (priority: env > file > defaults)
185
- const config = {
186
- ...exports.DEFAULTS,
187
- ...fileConfig,
188
- ...envConfig,
72
+ let f = a ? s(a) : {}, l = o(), u = {
73
+ ...R,
74
+ ...f,
75
+ ...l
189
76
  };
190
- // Resolve all paths to absolute
191
- const pathKeys = ['harnessRoot', 'worktreesDir', 'tasksDir', 'snapshotsDir', 'archiveDir', 'reportsDir', 'specRoot'];
192
- for (const key of pathKeys) {
193
- const value = config[key];
194
- if (typeof value === 'string') {
195
- const absKey = `${key}Abs`;
196
- config[absKey] = resolvePath(value, projectRoot);
197
- }
77
+ for (let e of [
78
+ 'harnessRoot',
79
+ 'worktreesDir',
80
+ 'tasksDir',
81
+ 'snapshotsDir',
82
+ 'archiveDir',
83
+ 'reportsDir',
84
+ 'specRoot'
85
+ ]){
86
+ let r = u[e];
87
+ 'string' == typeof r && (u[`${e}Abs`] = n(r, c));
198
88
  }
199
- // Add derived paths
200
- config.harnessRootAbs = resolvePath(config.harnessRoot, projectRoot);
201
- config.tasksDirAbs = resolvePath(config.tasksDir, config.harnessRootAbs);
202
- config.snapshotsDirAbs = resolvePath(config.snapshotsDir, config.harnessRootAbs);
203
- config.archiveDirAbs = resolvePath(config.archiveDir, config.harnessRootAbs);
204
- config.reportsDirAbs = resolvePath(config.reportsDir, config.harnessRootAbs);
205
- config.worktreesDirAbs = resolvePath(config.worktreesDir, projectRoot);
206
- config.specRootAbs = resolvePath(config.specRoot, projectRoot);
207
- // Add metadata
208
- config.projectRoot = projectRoot;
209
- config.configPath = configPath || undefined;
210
- config.configSources = {
211
- defaults: exports.DEFAULTS,
212
- file: fileConfig,
213
- env: envConfig,
214
- };
215
- return config;
89
+ return u.harnessRootAbs = n(u.harnessRoot, c), u.tasksDirAbs = n(u.tasksDir, u.harnessRootAbs), u.snapshotsDirAbs = n(u.snapshotsDir, u.harnessRootAbs), u.archiveDirAbs = n(u.archiveDir, u.harnessRootAbs), u.reportsDirAbs = n(u.reportsDir, u.harnessRootAbs), u.worktreesDirAbs = n(u.worktreesDir, c), u.specRootAbs = n(u.specRoot, c), u.projectRoot = c, u.configPath = a || void 0, u.configSources = {
90
+ defaults: R,
91
+ file: f,
92
+ env: l
93
+ }, u;
216
94
  }
217
- /**
218
- * Get a specific config value
219
- * @param key - Config key
220
- * @param defaultValue - Default value if not found
221
- * @param options - Options
222
- * @returns Config value
223
- */
224
- function getConfig(key, defaultValue, options = {}) {
225
- const config = loadConfig(options);
226
- const value = config[key] || config[`${key}Abs`] || defaultValue;
227
- return value;
95
+ function a(e, r, t = {}) {
96
+ let s = i(t);
97
+ return s[e] || s[`${e}Abs`] || r;
228
98
  }
229
- /**
230
- * Ensure all harness directories exist
231
- * @param config - Config object
232
- */
233
- function ensureDirectories(config) {
234
- const dirs = [
235
- config.harnessRootAbs,
236
- config.tasksDirAbs,
237
- config.snapshotsDirAbs,
238
- config.archiveDirAbs,
239
- config.reportsDirAbs,
240
- config.worktreesDirAbs,
241
- ];
242
- for (const dir of dirs) {
243
- if (dir) {
244
- fs.mkdirSync(dir, { recursive: true });
245
- }
246
- }
99
+ function c(e) {
100
+ for (let r of [
101
+ e.harnessRootAbs,
102
+ e.tasksDirAbs,
103
+ e.snapshotsDirAbs,
104
+ e.archiveDirAbs,
105
+ e.reportsDirAbs,
106
+ e.worktreesDirAbs
107
+ ])r && p.mkdirSync(r, {
108
+ recursive: !0
109
+ });
247
110
  }
111
+ "use strict";
112
+ Object.defineProperty(exports, "__esModule", {
113
+ value: !0
114
+ });
115
+ var f = exports, l = {
116
+ get DEFAULTS () {
117
+ return R;
118
+ },
119
+ get ensureDirectories () {
120
+ return c;
121
+ },
122
+ get findConfigFile () {
123
+ return t;
124
+ },
125
+ get getConfig () {
126
+ return a;
127
+ },
128
+ get loadConfig () {
129
+ return i;
130
+ },
131
+ get loadConfigFile () {
132
+ return s;
133
+ },
134
+ get loadEnvConfig () {
135
+ return o;
136
+ },
137
+ get resolvePath () {
138
+ return n;
139
+ }
140
+ };
141
+ for(var u in l)Object.defineProperty(f, u, {
142
+ enumerable: !0,
143
+ get: Object.getOwnPropertyDescriptor(l, u).get
144
+ });
145
+ let p = /*#__PURE__*/ r(require("fs")), D = /*#__PURE__*/ r(require("path")), R = {
146
+ harnessRoot: '.harness',
147
+ worktreesDir: '.worktrees',
148
+ tasksDir: 'tasks',
149
+ snapshotsDir: 'snapshots',
150
+ archiveDir: 'archive',
151
+ reportsDir: 'reports',
152
+ specRoot: 'spec'
153
+ }, h = {
154
+ HARNESS_ROOT: 'harnessRoot',
155
+ HARNESS_WORKTREES_DIR: 'worktreesDir',
156
+ HARNESS_TASKS_DIR: 'tasksDir',
157
+ HARNESS_SNAPSHOTS_DIR: 'snapshotsDir',
158
+ HARNESS_ARCHIVE_DIR: 'archiveDir',
159
+ HARNESS_REPORTS_DIR: 'reportsDir',
160
+ HARNESS_SPEC_ROOT: 'specRoot',
161
+ HARNESS_CONFIG_FILE: 'configFile'
162
+ };