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