oneie 1.1.0 → 1.2.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.
package/bin/one-task.js DELETED
@@ -1,457 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- /**
4
- * ONE Task CLI Command
5
- * Interactive task creation and management within stories
6
- */
7
-
8
- import { Command } from 'commander';
9
- import chalk from 'chalk';
10
- import { TaskSystem } from './task-system.js';
11
-
12
- const program = new Command();
13
-
14
- program
15
- .name('one:task')
16
- .description('šŸ“‹ Task management for ONE collaborative intelligence')
17
- .version('1.0.0');
18
-
19
- program
20
- .command('create <storyId> [taskName]')
21
- .description('Create a new task within a story')
22
- .option('-i, --interactive', 'Interactive task design', true)
23
- .option('-a, --auto', 'Auto-generate task without interaction', false)
24
- .action(async (storyId, taskName, options) => {
25
- console.log(chalk.cyan.bold('\\nšŸ“‹ ONE Task Creator\\n'));
26
-
27
- try {
28
- if (!taskName) {
29
- const { default: inquirer } = await import('inquirer');
30
- const answers = await inquirer.prompt([
31
- {
32
- type: 'input',
33
- name: 'taskName',
34
- message: 'What task needs to be completed?',
35
- validate: input => input.length > 0 || 'Please enter a task name'
36
- }
37
- ]);
38
- taskName = answers.taskName;
39
- }
40
-
41
- const taskSystem = new TaskSystem();
42
- const task = await taskSystem.createTask(storyId, taskName, {
43
- interactive: !options.auto
44
- });
45
-
46
- console.log(chalk.green.bold('\\nšŸŽ‰ Task created successfully!'));
47
- console.log(chalk.blue(`šŸ“‹ Task ID: ${task.id}`));
48
- console.log(chalk.blue(`šŸ“‚ Story: ${task.storyId}`));
49
- console.log(chalk.blue(`šŸ¤– Agents: ${task.agents.join(', ')}`));
50
- console.log(chalk.blue(`ā±ļø Duration: ${task.duration}`));
51
-
52
- console.log(chalk.yellow('\\nšŸš€ Next steps:'));
53
- console.log(' 1. Review task details: one:task status ' + task.id);
54
- console.log(' 2. Start working: one:task start ' + task.id);
55
- console.log(' 3. Assign additional agents: one:task assign ' + task.id + ' <agent-name>');
56
-
57
- } catch (error) {
58
- console.error(chalk.red('āŒ Failed to create task:'), error.message);
59
- process.exit(1);
60
- }
61
- });
62
-
63
- program
64
- .command('list [storyId]')
65
- .description('List tasks (all or for specific story)')
66
- .option('-s, --status <status>', 'Filter by status (pending, active, completed, blocked)')
67
- .option('-p, --priority <priority>', 'Filter by priority (high, medium, low)')
68
- .action(async (storyId, options) => {
69
- try {
70
- const taskSystem = new TaskSystem();
71
- const tasks = await taskSystem.listTasks(storyId);
72
-
73
- if (tasks.length === 0) {
74
- if (storyId) {
75
- console.log(chalk.yellow(`\\nšŸ“‹ No tasks found for story ${storyId}`));
76
- console.log(chalk.gray(`Create a task: one:task create ${storyId} "Your task"`));
77
- } else {
78
- console.log(chalk.yellow('\\nšŸ“‹ No tasks found'));
79
- console.log(chalk.gray('Create your first task: one:task create <story-id> "Your task"'));
80
- }
81
- return;
82
- }
83
-
84
- const title = storyId ? `Tasks for Story ${storyId}` : 'All Tasks';
85
- console.log(chalk.cyan.bold(`\\nšŸ“‹ ${title}\\n`));
86
-
87
- // Apply filters
88
- let filteredTasks = tasks;
89
- if (options.status) {
90
- filteredTasks = filteredTasks.filter(task => task.status === options.status);
91
- }
92
- if (options.priority) {
93
- filteredTasks = filteredTasks.filter(task => task.priority === options.priority);
94
- }
95
-
96
- if (filteredTasks.length === 0) {
97
- console.log(chalk.yellow('\\nšŸ“‹ No tasks match your filters'));
98
- return;
99
- }
100
-
101
- filteredTasks.forEach(task => {
102
- const statusColor = {
103
- 'pending': 'yellow',
104
- 'active': 'green',
105
- 'completed': 'blue',
106
- 'blocked': 'red'
107
- }[task.status] || 'white';
108
-
109
- const priorityEmoji = {
110
- 'high': 'šŸ”„',
111
- 'medium': '⚔',
112
- 'low': 'šŸ’”'
113
- }[task.priority] || 'šŸ“‹';
114
-
115
- console.log(chalk[statusColor](`${priorityEmoji} ${task.name}`));
116
- console.log(chalk.gray(` ID: ${task.id}`));
117
- console.log(chalk.gray(` Story: ${task.storyId}`));
118
- console.log(chalk.gray(` Status: ${task.status} | Priority: ${task.priority}`));
119
- console.log(chalk.gray(` Agents: ${task.agents.join(', ')}`));
120
- console.log(chalk.gray(` Duration: ${task.duration}`));
121
- console.log(chalk.gray(` Created: ${new Date(task.created).toLocaleDateString()}`));
122
- if (task.dependencies.length > 0) {
123
- console.log(chalk.gray(` Dependencies: ${task.dependencies.length} items`));
124
- }
125
- console.log('');
126
- });
127
- } catch (error) {
128
- console.error(chalk.red('āŒ Failed to list tasks:'), error.message);
129
- process.exit(1);
130
- }
131
- });
132
-
133
- program
134
- .command('status <taskId>')
135
- .description('Show detailed task status')
136
- .action(async (taskId) => {
137
- try {
138
- const taskSystem = new TaskSystem();
139
- const task = await taskSystem.getTask(taskId);
140
-
141
- if (!task) {
142
- console.log(chalk.red(`āŒ Task not found: ${taskId}`));
143
- console.log(chalk.gray('List tasks: one:task list'));
144
- return;
145
- }
146
-
147
- console.log(chalk.cyan.bold(`\\nšŸ“‹ Task: ${task.name}\\n`));
148
-
149
- const statusColor = {
150
- 'pending': 'yellow',
151
- 'active': 'green',
152
- 'completed': 'blue',
153
- 'blocked': 'red'
154
- }[task.status] || 'white';
155
-
156
- const priorityColor = {
157
- 'high': 'red',
158
- 'medium': 'yellow',
159
- 'low': 'green'
160
- }[task.priority] || 'white';
161
-
162
- console.log(chalk.blue('šŸ“‹ Overview'));
163
- console.log(` ID: ${task.id}`);
164
- console.log(` Story: ${task.storyId}`);
165
- console.log(` Mission: ${task.missionId}`);
166
- console.log(chalk[statusColor](` Status: ${task.status}`));
167
- console.log(chalk[priorityColor](` Priority: ${task.priority}`));
168
- console.log(` Duration: ${task.duration}`);
169
- console.log(` Created: ${new Date(task.created).toLocaleDateString()}`);
170
-
171
- if (task.updated) {
172
- console.log(` Updated: ${new Date(task.updated).toLocaleDateString()}`);
173
- }
174
-
175
- console.log(chalk.blue('\\nšŸ¤– Assigned Agents'));
176
- task.agents.forEach(agent => {
177
- console.log(` • ${agent}`);
178
- });
179
-
180
- if (task.acceptanceCriteria && task.acceptanceCriteria.length > 0) {
181
- console.log(chalk.blue('\\nāœ… Acceptance Criteria'));
182
- task.acceptanceCriteria.forEach(criteria => {
183
- console.log(` • ${criteria}`);
184
- });
185
- }
186
-
187
- if (task.dependencies.length > 0) {
188
- console.log(chalk.blue('\\nšŸ”— Dependencies'));
189
- task.dependencies.forEach(dep => {
190
- console.log(` • ${dep}`);
191
- });
192
- }
193
-
194
- if (task.techContext && Object.keys(task.techContext).some(key => task.techContext[key].length > 0)) {
195
- console.log(chalk.blue('\\nāš™ļø Technical Context'));
196
- if (task.techContext.frameworks.length > 0) {
197
- console.log(` Frameworks: ${task.techContext.frameworks.join(', ')}`);
198
- }
199
- if (task.techContext.languages.length > 0) {
200
- console.log(` Languages: ${task.techContext.languages.join(', ')}`);
201
- }
202
- if (task.techContext.patterns.length > 0) {
203
- console.log(` Patterns: ${task.techContext.patterns.join(', ')}`);
204
- }
205
- }
206
-
207
- if (task.progress) {
208
- console.log(chalk.blue('\\nšŸ“ˆ Progress'));
209
- if (task.progress.started) {
210
- console.log(` Started: ${new Date(task.progress.started).toLocaleString()}`);
211
- }
212
- if (task.progress.completed) {
213
- console.log(` Completed: ${new Date(task.progress.completed).toLocaleString()}`);
214
- }
215
- if (task.progress.notes.length > 0) {
216
- console.log(' Recent notes:');
217
- task.progress.notes.slice(-3).forEach(note => {
218
- console.log(` ${new Date(note.timestamp).toLocaleString()}: ${note.note}`);
219
- });
220
- }
221
- }
222
-
223
- if (task.description && task.description.length > 0) {
224
- console.log(chalk.blue('\\nšŸ“ Description'));
225
- console.log(task.description);
226
- }
227
-
228
- } catch (error) {
229
- console.error(chalk.red('āŒ Failed to get task status:'), error.message);
230
- process.exit(1);
231
- }
232
- });
233
-
234
- program
235
- .command('update <taskId> <status>')
236
- .description('Update task status (pending, active, completed, blocked)')
237
- .option('-n, --note <note>', 'Add a progress note')
238
- .action(async (taskId, status, options) => {
239
- try {
240
- const validStatuses = ['pending', 'active', 'completed', 'blocked'];
241
- if (!validStatuses.includes(status)) {
242
- console.log(chalk.red(`āŒ Invalid status. Must be one of: ${validStatuses.join(', ')}`));
243
- return;
244
- }
245
-
246
- console.log(chalk.yellow(`šŸ”„ Updating task ${taskId} status to ${status}...`));
247
-
248
- const taskSystem = new TaskSystem();
249
- const updatedTask = await taskSystem.updateTaskStatus(taskId, status, options.note);
250
-
251
- console.log(chalk.green('āœ… Task status updated!'));
252
- console.log(chalk.blue(`šŸ“‹ ${updatedTask.name}: ${updatedTask.status}`));
253
-
254
- if (options.note) {
255
- console.log(chalk.gray(`šŸ“ Note added: ${options.note}`));
256
- }
257
-
258
- } catch (error) {
259
- console.error(chalk.red('āŒ Failed to update task status:'), error.message);
260
- process.exit(1);
261
- }
262
- });
263
-
264
- program
265
- .command('start <taskId>')
266
- .description('Start a task (change status to active)')
267
- .option('-n, --note <note>', 'Add a start note')
268
- .action(async (taskId, options) => {
269
- try {
270
- console.log(chalk.yellow(`šŸš€ Starting task ${taskId}...`));
271
-
272
- const taskSystem = new TaskSystem();
273
- const updatedTask = await taskSystem.updateTaskStatus(taskId, 'active',
274
- options.note || 'Task started');
275
-
276
- console.log(chalk.green('āœ… Task started!'));
277
- console.log(chalk.blue(`šŸ“‹ ${updatedTask.name} is now active`));
278
- console.log(chalk.gray(`šŸ¤– Assigned agents: ${updatedTask.agents.join(', ')}`));
279
-
280
- } catch (error) {
281
- console.error(chalk.red('āŒ Failed to start task:'), error.message);
282
- process.exit(1);
283
- }
284
- });
285
-
286
- program
287
- .command('complete <taskId>')
288
- .description('Mark a task as completed')
289
- .option('-n, --note <note>', 'Add a completion note')
290
- .action(async (taskId, options) => {
291
- try {
292
- console.log(chalk.blue(`šŸŽ‰ Completing task ${taskId}...`));
293
-
294
- const taskSystem = new TaskSystem();
295
- const updatedTask = await taskSystem.updateTaskStatus(taskId, 'completed',
296
- options.note || 'Task completed successfully');
297
-
298
- console.log(chalk.green('āœ… Task completed!'));
299
- console.log(chalk.blue(`šŸ“‹ ${updatedTask.name} is now complete`));
300
- console.log(chalk.gray('Excellent work! Ready for the next task.'));
301
-
302
- } catch (error) {
303
- console.error(chalk.red('āŒ Failed to complete task:'), error.message);
304
- process.exit(1);
305
- }
306
- });
307
-
308
- program
309
- .command('assign <taskId> <agentName>')
310
- .description('Assign an agent to a task')
311
- .action(async (taskId, agentName) => {
312
- try {
313
- console.log(chalk.yellow(`šŸ‘¤ Assigning ${agentName} to task ${taskId}...`));
314
-
315
- const taskSystem = new TaskSystem();
316
- const updatedTask = await taskSystem.assignTaskToAgent(taskId, agentName);
317
-
318
- console.log(chalk.green('āœ… Agent assigned!'));
319
- console.log(chalk.blue(`šŸ‘¤ ${agentName} is now assigned to ${updatedTask.name}`));
320
- console.log(chalk.gray(`šŸ¤– All agents: ${updatedTask.agents.join(', ')}`));
321
-
322
- } catch (error) {
323
- console.error(chalk.red('āŒ Failed to assign agent:'), error.message);
324
- process.exit(1);
325
- }
326
- });
327
-
328
- // Interactive task dashboard
329
- program
330
- .command('dashboard [storyId]')
331
- .alias('dash')
332
- .description('Interactive task dashboard')
333
- .action(async (storyId) => {
334
- const title = storyId ? `Task Dashboard - Story ${storyId}` : 'Task Dashboard - All Stories';
335
- console.log(chalk.cyan.bold(`\\nšŸ“‹ ${title}\\n`));
336
-
337
- try {
338
- const taskSystem = new TaskSystem();
339
- const tasks = await taskSystem.listTasks(storyId);
340
-
341
- if (tasks.length === 0) {
342
- console.log(chalk.yellow('šŸ“‹ No tasks yet'));
343
- console.log(chalk.gray('Create your first task to get started!'));
344
- return;
345
- }
346
-
347
- // Show task summary
348
- const statusCounts = tasks.reduce((acc, task) => {
349
- acc[task.status] = (acc[task.status] || 0) + 1;
350
- return acc;
351
- }, {});
352
-
353
- const priorityCounts = tasks.reduce((acc, task) => {
354
- acc[task.priority] = (acc[task.priority] || 0) + 1;
355
- return acc;
356
- }, {});
357
-
358
- console.log(chalk.blue('šŸ“Š Task Summary'));
359
- Object.entries(statusCounts).forEach(([status, count]) => {
360
- const color = {
361
- 'pending': 'yellow',
362
- 'active': 'green',
363
- 'completed': 'blue',
364
- 'blocked': 'red'
365
- }[status] || 'white';
366
- console.log(chalk[color](` ${status}: ${count}`));
367
- });
368
-
369
- console.log(chalk.blue('\\nšŸŽÆ Priority Distribution'));
370
- Object.entries(priorityCounts).forEach(([priority, count]) => {
371
- const color = {
372
- 'high': 'red',
373
- 'medium': 'yellow',
374
- 'low': 'green'
375
- }[priority] || 'white';
376
- console.log(chalk[color](` ${priority}: ${count}`));
377
- });
378
-
379
- console.log(chalk.blue('\\nšŸš€ Active Tasks'));
380
- const activeTasks = tasks.filter(t => t.status === 'active');
381
- if (activeTasks.length > 0) {
382
- activeTasks.forEach(task => {
383
- const priorityEmoji = {
384
- 'high': 'šŸ”„',
385
- 'medium': '⚔',
386
- 'low': 'šŸ’”'
387
- }[task.priority] || 'šŸ“‹';
388
-
389
- console.log(` šŸš€ ${priorityEmoji} ${task.name}`);
390
- console.log(chalk.gray(` ${task.agents.length} agents • ${task.duration} • ${task.priority} priority`));
391
- });
392
- } else {
393
- console.log(chalk.gray(' No active tasks'));
394
- }
395
-
396
- console.log(chalk.blue('\\nā³ Pending Tasks'));
397
- const pendingTasks = tasks.filter(t => t.status === 'pending');
398
- if (pendingTasks.length > 0) {
399
- pendingTasks.slice(0, 5).forEach(task => {
400
- const priorityEmoji = {
401
- 'high': 'šŸ”„',
402
- 'medium': '⚔',
403
- 'low': 'šŸ’”'
404
- }[task.priority] || 'šŸ“‹';
405
-
406
- console.log(` ā³ ${priorityEmoji} ${task.name}`);
407
- console.log(chalk.gray(` ${task.agents.length} agents • ${task.duration} • ${task.priority} priority`));
408
- });
409
-
410
- if (pendingTasks.length > 5) {
411
- console.log(chalk.gray(` ... and ${pendingTasks.length - 5} more`));
412
- }
413
- } else {
414
- console.log(chalk.gray(' No pending tasks'));
415
- }
416
-
417
- // Show agent workload
418
- const agentWorkload = {};
419
- tasks.filter(t => t.status === 'active').forEach(task => {
420
- task.agents.forEach(agent => {
421
- agentWorkload[agent] = (agentWorkload[agent] || 0) + 1;
422
- });
423
- });
424
-
425
- if (Object.keys(agentWorkload).length > 0) {
426
- console.log(chalk.blue('\\nšŸ¤– Agent Workload (Active Tasks)'));
427
- Object.entries(agentWorkload)
428
- .sort(([,a], [,b]) => b - a)
429
- .slice(0, 5)
430
- .forEach(([agent, count]) => {
431
- console.log(` ${agent}: ${count} tasks`);
432
- });
433
- }
434
-
435
- } catch (error) {
436
- console.error(chalk.red('āŒ Dashboard error:'), error.message);
437
- process.exit(1);
438
- }
439
- });
440
-
441
- // Handle no command
442
- program.action(() => {
443
- console.log(chalk.cyan.bold('\\nšŸ“‹ ONE Task System\\n'));
444
- console.log('Available commands:');
445
- console.log(' create <story> [task] Create a new task');
446
- console.log(' list [story] List tasks');
447
- console.log(' status <id> Show task details');
448
- console.log(' update <id> <status> Update task status');
449
- console.log(' assign <id> <agent> Assign agent to task');
450
- console.log(' dashboard [story] Task dashboard');
451
- console.log('');
452
- console.log(chalk.gray('Example: one:task create story-123 "Implement user login"'));
453
- });
454
-
455
- program.parse();
456
-
457
- export { program };