kiro-spec-engine 1.2.3 → 1.3.0

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 (45) hide show
  1. package/CHANGELOG.md +74 -0
  2. package/README.md +172 -0
  3. package/bin/kiro-spec-engine.js +62 -0
  4. package/docs/agent-hooks-analysis.md +815 -0
  5. package/docs/cross-tool-guide.md +554 -0
  6. package/docs/manual-workflows-guide.md +417 -0
  7. package/docs/steering-strategy-guide.md +196 -0
  8. package/lib/adoption/detection-engine.js +14 -4
  9. package/lib/commands/adopt.js +117 -3
  10. package/lib/commands/context.js +99 -0
  11. package/lib/commands/prompt.js +105 -0
  12. package/lib/commands/status.js +225 -0
  13. package/lib/commands/task.js +199 -0
  14. package/lib/commands/watch.js +569 -0
  15. package/lib/commands/workflows.js +240 -0
  16. package/lib/commands/workspace.js +189 -0
  17. package/lib/context/context-exporter.js +378 -0
  18. package/lib/context/prompt-generator.js +482 -0
  19. package/lib/steering/adoption-config.js +164 -0
  20. package/lib/steering/steering-manager.js +289 -0
  21. package/lib/task/task-claimer.js +430 -0
  22. package/lib/utils/tool-detector.js +383 -0
  23. package/lib/watch/action-executor.js +458 -0
  24. package/lib/watch/event-debouncer.js +323 -0
  25. package/lib/watch/execution-logger.js +550 -0
  26. package/lib/watch/file-watcher.js +499 -0
  27. package/lib/watch/presets.js +266 -0
  28. package/lib/watch/watch-manager.js +533 -0
  29. package/lib/workspace/workspace-manager.js +370 -0
  30. package/lib/workspace/workspace-sync.js +356 -0
  31. package/package.json +3 -1
  32. package/template/.kiro/tools/backup_manager.py +295 -0
  33. package/template/.kiro/tools/configuration_manager.py +218 -0
  34. package/template/.kiro/tools/document_evaluator.py +550 -0
  35. package/template/.kiro/tools/enhancement_logger.py +168 -0
  36. package/template/.kiro/tools/error_handler.py +335 -0
  37. package/template/.kiro/tools/improvement_identifier.py +444 -0
  38. package/template/.kiro/tools/modification_applicator.py +737 -0
  39. package/template/.kiro/tools/quality_gate_enforcer.py +207 -0
  40. package/template/.kiro/tools/quality_scorer.py +305 -0
  41. package/template/.kiro/tools/report_generator.py +154 -0
  42. package/template/.kiro/tools/ultrawork_enhancer_refactored.py +0 -0
  43. package/template/.kiro/tools/ultrawork_enhancer_v2.py +463 -0
  44. package/template/.kiro/tools/ultrawork_enhancer_v3.py +606 -0
  45. package/template/.kiro/tools/workflow_quality_gate.py +100 -0
@@ -0,0 +1,199 @@
1
+ /**
2
+ * Task Command Group
3
+ *
4
+ * Manages task claiming and status updates
5
+ */
6
+
7
+ const chalk = require('chalk');
8
+ const TaskClaimer = require('../task/task-claimer');
9
+ const WorkspaceManager = require('../workspace/workspace-manager');
10
+
11
+ /**
12
+ * Claim a task
13
+ *
14
+ * @param {string} specName - Spec name
15
+ * @param {string} taskId - Task ID
16
+ * @param {Object} options - Command options
17
+ * @param {string} options.user - Override username
18
+ * @param {boolean} options.force - Force claim even if already claimed
19
+ * @returns {Promise<void>}
20
+ */
21
+ async function claimTask(specName, taskId, options = {}) {
22
+ const projectPath = process.cwd();
23
+ const taskClaimer = new TaskClaimer();
24
+ const workspaceManager = new WorkspaceManager();
25
+
26
+ console.log(chalk.red('🔥') + ' Claiming Task');
27
+ console.log();
28
+
29
+ try {
30
+ const username = options.user || await workspaceManager.detectUsername();
31
+
32
+ if (!username) {
33
+ console.log(chalk.red('❌ Could not detect username'));
34
+ console.log();
35
+ console.log('Please configure git or use --user flag');
36
+ return;
37
+ }
38
+
39
+ console.log(`Spec: ${chalk.cyan(specName)}`);
40
+ console.log(`Task: ${chalk.cyan(taskId)}`);
41
+ console.log(`User: ${chalk.cyan(username)}`);
42
+ console.log();
43
+
44
+ const result = await taskClaimer.claimTask(
45
+ projectPath,
46
+ specName,
47
+ taskId,
48
+ username,
49
+ options.force
50
+ );
51
+
52
+ if (result.success) {
53
+ console.log(chalk.green('✅ Task claimed successfully'));
54
+ console.log();
55
+ console.log(`Task: ${result.taskTitle}`);
56
+ console.log(`Claimed by: ${chalk.cyan(username)}`);
57
+ console.log(`Claimed at: ${chalk.gray(result.claimedAt)}`);
58
+
59
+ if (result.previousClaim) {
60
+ console.log();
61
+ console.log(chalk.yellow('⚠️ Previous claim overridden:'));
62
+ console.log(` User: ${result.previousClaim.username}`);
63
+ console.log(` Time: ${result.previousClaim.timestamp}`);
64
+ }
65
+ } else {
66
+ console.log(chalk.red('❌ Failed to claim task'));
67
+ console.log();
68
+ console.log(`Error: ${result.error}`);
69
+
70
+ if (result.existingClaim) {
71
+ console.log();
72
+ console.log('Task is already claimed by:');
73
+ console.log(` User: ${chalk.cyan(result.existingClaim.username)}`);
74
+ console.log(` Time: ${chalk.gray(result.existingClaim.timestamp)}`);
75
+ console.log();
76
+ console.log('Use ' + chalk.cyan('--force') + ' to override the claim');
77
+ }
78
+ }
79
+ } catch (error) {
80
+ console.log(chalk.red('❌ Error:'), error.message);
81
+ }
82
+ }
83
+
84
+ /**
85
+ * Unclaim a task
86
+ *
87
+ * @param {string} specName - Spec name
88
+ * @param {string} taskId - Task ID
89
+ * @param {Object} options - Command options
90
+ * @param {string} options.user - Override username
91
+ * @returns {Promise<void>}
92
+ */
93
+ async function unclaimTask(specName, taskId, options = {}) {
94
+ const projectPath = process.cwd();
95
+ const taskClaimer = new TaskClaimer();
96
+ const workspaceManager = new WorkspaceManager();
97
+
98
+ console.log(chalk.red('🔥') + ' Unclaiming Task');
99
+ console.log();
100
+
101
+ try {
102
+ const username = options.user || await workspaceManager.detectUsername();
103
+
104
+ if (!username) {
105
+ console.log(chalk.red('❌ Could not detect username'));
106
+ return;
107
+ }
108
+
109
+ console.log(`Spec: ${chalk.cyan(specName)}`);
110
+ console.log(`Task: ${chalk.cyan(taskId)}`);
111
+ console.log(`User: ${chalk.cyan(username)}`);
112
+ console.log();
113
+
114
+ const result = await taskClaimer.unclaimTask(
115
+ projectPath,
116
+ specName,
117
+ taskId,
118
+ username
119
+ );
120
+
121
+ if (result.success) {
122
+ console.log(chalk.green('✅ Task unclaimed successfully'));
123
+ console.log();
124
+ console.log(`Task: ${result.taskTitle}`);
125
+ } else {
126
+ console.log(chalk.red('❌ Failed to unclaim task'));
127
+ console.log();
128
+ console.log(`Error: ${result.error}`);
129
+ }
130
+ } catch (error) {
131
+ console.log(chalk.red('❌ Error:'), error.message);
132
+ }
133
+ }
134
+
135
+ /**
136
+ * List claimed tasks
137
+ *
138
+ * @param {string} specName - Spec name (optional)
139
+ * @param {Object} options - Command options
140
+ * @param {string} options.user - Filter by username
141
+ * @returns {Promise<void>}
142
+ */
143
+ async function listClaimedTasks(specName, options = {}) {
144
+ const projectPath = process.cwd();
145
+ const taskClaimer = new TaskClaimer();
146
+
147
+ console.log(chalk.red('🔥') + ' Claimed Tasks');
148
+ console.log();
149
+
150
+ try {
151
+ if (specName) {
152
+ // List claimed tasks for specific spec
153
+ const tasks = await taskClaimer.getClaimedTasks(projectPath, specName);
154
+
155
+ if (tasks.length === 0) {
156
+ console.log(chalk.gray('No claimed tasks found'));
157
+ return;
158
+ }
159
+
160
+ console.log(`Spec: ${chalk.cyan(specName)}`);
161
+ console.log();
162
+
163
+ // Group by user
164
+ const byUser = {};
165
+ for (const task of tasks) {
166
+ if (!byUser[task.claimedBy]) {
167
+ byUser[task.claimedBy] = [];
168
+ }
169
+ byUser[task.claimedBy].push(task);
170
+ }
171
+
172
+ for (const [user, userTasks] of Object.entries(byUser)) {
173
+ if (options.user && user !== options.user) {
174
+ continue;
175
+ }
176
+
177
+ console.log(chalk.cyan(`${user} (${userTasks.length} task(s))`));
178
+ for (const task of userTasks) {
179
+ const staleMarker = task.isStale ? chalk.yellow(' [STALE]') : '';
180
+ console.log(` ${chalk.gray('•')} ${task.taskId} ${task.taskTitle}${staleMarker}`);
181
+ console.log(` ${chalk.gray(task.claimedAt)}`);
182
+ }
183
+ console.log();
184
+ }
185
+ } else {
186
+ console.log(chalk.gray('Please specify a spec name'));
187
+ console.log();
188
+ console.log('Usage: ' + chalk.cyan('kse task list <spec-name>'));
189
+ }
190
+ } catch (error) {
191
+ console.log(chalk.red('❌ Error:'), error.message);
192
+ }
193
+ }
194
+
195
+ module.exports = {
196
+ claimTask,
197
+ unclaimTask,
198
+ listClaimedTasks
199
+ };