oneie 1.0.0 β 1.1.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/collaborative-install.js +39 -11
- package/bin/one-mission.js +247 -0
- package/bin/one-story.js +340 -0
- package/bin/one-task.js +457 -0
- package/bin/workflow-orchestration.js +406 -0
- package/package.json +10 -4
- package/one/tools/bin/one-mission.js +0 -25
- package/one/tools/bin/one-story.js +0 -25
|
@@ -13,6 +13,7 @@ import fs from 'fs-extra';
|
|
|
13
13
|
import path from 'path';
|
|
14
14
|
import os from 'os';
|
|
15
15
|
import { fileURLToPath } from 'url';
|
|
16
|
+
import { CLIAnimations, AnimationSequences } from './cli-animations.js';
|
|
16
17
|
|
|
17
18
|
const __filename = fileURLToPath(import.meta.url);
|
|
18
19
|
const __dirname = path.dirname(__filename);
|
|
@@ -25,6 +26,7 @@ class CollaborativeInstaller {
|
|
|
25
26
|
this.context = null;
|
|
26
27
|
this.preservationPlan = null;
|
|
27
28
|
this.spinner = null;
|
|
29
|
+
this.animations = null; // Will be initialized after context detection
|
|
28
30
|
}
|
|
29
31
|
|
|
30
32
|
async install() {
|
|
@@ -119,6 +121,9 @@ class CollaborativeInstaller {
|
|
|
119
121
|
// Universal scale detection
|
|
120
122
|
this.context = await this.analyzeUserContext();
|
|
121
123
|
|
|
124
|
+
// Initialize animations with detected context
|
|
125
|
+
this.animations = new CLIAnimations(this.context);
|
|
126
|
+
|
|
122
127
|
this.spinner.succeed(`Universal scale adaptation configured for your context: ${this.context.type}`);
|
|
123
128
|
}
|
|
124
129
|
|
|
@@ -295,6 +300,22 @@ created: ${new Date().toISOString()}
|
|
|
295
300
|
async createLifecycleTemplates() {
|
|
296
301
|
const templatesDir = path.join(this.currentDir, '.one', 'templates');
|
|
297
302
|
|
|
303
|
+
try {
|
|
304
|
+
// Import the enhanced template generator
|
|
305
|
+
const { TemplateGenerator } = await import('./template-generator.js');
|
|
306
|
+
const generator = new TemplateGenerator(this.context, this.architecture, this.currentDir);
|
|
307
|
+
|
|
308
|
+
// Generate all templates using the enhanced system
|
|
309
|
+
await generator.generateAllTemplates();
|
|
310
|
+
|
|
311
|
+
} catch (error) {
|
|
312
|
+
// Fallback to basic templates if enhanced generator fails
|
|
313
|
+
console.log('Using basic templates...');
|
|
314
|
+
await this.createBasicTemplates(templatesDir);
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
async createBasicTemplates(templatesDir) {
|
|
298
319
|
const missionTemplate = `# Mission Template - ${this.context.type}
|
|
299
320
|
objective: "Define your collaborative goal"
|
|
300
321
|
participants:
|
|
@@ -372,17 +393,24 @@ validation: "peer_review_all_participants"
|
|
|
372
393
|
}
|
|
373
394
|
|
|
374
395
|
async celebrateCollaborativeIntelligence() {
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
396
|
+
// Use enhanced animations if available
|
|
397
|
+
if (this.animations) {
|
|
398
|
+
await this.animations.celebrateSuccess();
|
|
399
|
+
await this.animations.showNextSteps();
|
|
400
|
+
} else {
|
|
401
|
+
// Fallback to basic celebration
|
|
402
|
+
console.log(chalk.green('\nπ ONE collaborative intelligence installed successfully!\n'));
|
|
403
|
+
|
|
404
|
+
console.log(chalk.blue('π¬ Ready for human-AI collaboration'));
|
|
405
|
+
console.log(chalk.blue('π Complete lifecycle workflow available'));
|
|
406
|
+
console.log(chalk.blue('π Universal scale adaptation active'));
|
|
407
|
+
console.log(chalk.blue('π€ Equal participation rights enabled'));
|
|
408
|
+
|
|
409
|
+
console.log(chalk.cyan('\n⨠Welcome to true collaborative intelligence!\n'));
|
|
410
|
+
|
|
411
|
+
// Next steps based on context
|
|
412
|
+
this.showNextSteps();
|
|
413
|
+
}
|
|
386
414
|
}
|
|
387
415
|
|
|
388
416
|
showNextSteps() {
|
|
@@ -0,0 +1,247 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* ONE Mission CLI Command
|
|
5
|
+
* Interactive mission creation and management
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import { Command } from 'commander';
|
|
9
|
+
import chalk from 'chalk';
|
|
10
|
+
import { MissionSystem } from './mission-system.js';
|
|
11
|
+
|
|
12
|
+
const program = new Command();
|
|
13
|
+
|
|
14
|
+
program
|
|
15
|
+
.name('one:mission')
|
|
16
|
+
.description('π― Mission management for ONE collaborative intelligence')
|
|
17
|
+
.version('1.0.0');
|
|
18
|
+
|
|
19
|
+
program
|
|
20
|
+
.command('create [objective]')
|
|
21
|
+
.description('Create a new collaborative mission')
|
|
22
|
+
.option('-i, --interactive', 'Interactive mission design', true)
|
|
23
|
+
.option('-a, --auto', 'Auto-generate mission without interaction', false)
|
|
24
|
+
.action(async (objective, options) => {
|
|
25
|
+
console.log(chalk.cyan.bold('\nπ― ONE Mission Creator\n'));
|
|
26
|
+
|
|
27
|
+
try {
|
|
28
|
+
if (!objective) {
|
|
29
|
+
const { default: inquirer } = await import('inquirer');
|
|
30
|
+
const answers = await inquirer.prompt([
|
|
31
|
+
{
|
|
32
|
+
type: 'input',
|
|
33
|
+
name: 'objective',
|
|
34
|
+
message: 'What is your mission objective?',
|
|
35
|
+
validate: input => input.length > 0 || 'Please enter a mission objective'
|
|
36
|
+
}
|
|
37
|
+
]);
|
|
38
|
+
objective = answers.objective;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
const missionSystem = new MissionSystem();
|
|
42
|
+
const mission = await missionSystem.createMission(objective, {
|
|
43
|
+
interactive: !options.auto
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
console.log(chalk.green.bold('\nπ Mission created successfully!'));
|
|
47
|
+
console.log(chalk.blue(`π Mission ID: ${mission.id}`));
|
|
48
|
+
console.log(chalk.blue(`π Location: .one/missions/${mission.id}/`));
|
|
49
|
+
console.log(chalk.blue(`π€ Agents: ${mission.agents.join(', ')}`));
|
|
50
|
+
console.log(chalk.blue(`π Stories: ${mission.suggestedStories.length} generated`));
|
|
51
|
+
|
|
52
|
+
console.log(chalk.yellow('\nπ Next steps:'));
|
|
53
|
+
console.log(' 1. Review generated stories: one:story list');
|
|
54
|
+
console.log(' 2. Start first story: one:story start <story-id>');
|
|
55
|
+
console.log(' 3. Check mission status: one:mission status ' + mission.id);
|
|
56
|
+
|
|
57
|
+
} catch (error) {
|
|
58
|
+
console.error(chalk.red('β Failed to create mission:'), error.message);
|
|
59
|
+
process.exit(1);
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
program
|
|
64
|
+
.command('list')
|
|
65
|
+
.description('List all missions')
|
|
66
|
+
.option('-s, --status <status>', 'Filter by status (planning, active, completed)')
|
|
67
|
+
.action(async (options) => {
|
|
68
|
+
try {
|
|
69
|
+
const missionSystem = new MissionSystem();
|
|
70
|
+
const missions = await missionSystem.listMissions();
|
|
71
|
+
|
|
72
|
+
if (missions.length === 0) {
|
|
73
|
+
console.log(chalk.yellow('\nπ No missions found'));
|
|
74
|
+
console.log(chalk.gray('Create your first mission: one:mission create "Your objective"'));
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
console.log(chalk.cyan.bold('\nπ― Your Missions\n'));
|
|
79
|
+
|
|
80
|
+
missions
|
|
81
|
+
.filter(mission => !options.status || mission.status === options.status)
|
|
82
|
+
.forEach(mission => {
|
|
83
|
+
const statusColor = {
|
|
84
|
+
'planning': 'yellow',
|
|
85
|
+
'active': 'green',
|
|
86
|
+
'completed': 'blue',
|
|
87
|
+
'paused': 'gray'
|
|
88
|
+
}[mission.status] || 'white';
|
|
89
|
+
|
|
90
|
+
console.log(chalk[statusColor](`π ${mission.name}`));
|
|
91
|
+
console.log(chalk.gray(` ID: ${mission.id}`));
|
|
92
|
+
console.log(chalk.gray(` Status: ${mission.status}`));
|
|
93
|
+
console.log(chalk.gray(` Agents: ${mission.agents.join(', ')}`));
|
|
94
|
+
console.log(chalk.gray(` Stories: ${mission.stories.length}`));
|
|
95
|
+
console.log(chalk.gray(` Created: ${new Date(mission.created).toLocaleDateString()}`));
|
|
96
|
+
console.log('');
|
|
97
|
+
});
|
|
98
|
+
} catch (error) {
|
|
99
|
+
console.error(chalk.red('β Failed to list missions:'), error.message);
|
|
100
|
+
process.exit(1);
|
|
101
|
+
}
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
program
|
|
105
|
+
.command('status <missionId>')
|
|
106
|
+
.description('Show detailed mission status')
|
|
107
|
+
.action(async (missionId) => {
|
|
108
|
+
try {
|
|
109
|
+
const missionSystem = new MissionSystem();
|
|
110
|
+
const mission = await missionSystem.getMission(missionId);
|
|
111
|
+
|
|
112
|
+
if (!mission) {
|
|
113
|
+
console.log(chalk.red(`β Mission not found: ${missionId}`));
|
|
114
|
+
console.log(chalk.gray('List missions: one:mission list'));
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
console.log(chalk.cyan.bold(`\nπ― Mission: ${mission.name}\n`));
|
|
119
|
+
|
|
120
|
+
console.log(chalk.blue('π Overview'));
|
|
121
|
+
console.log(` Objective: ${mission.objective}`);
|
|
122
|
+
console.log(` Status: ${mission.status}`);
|
|
123
|
+
console.log(` Duration: ${mission.duration}`);
|
|
124
|
+
console.log(` Complexity: ${mission.complexity}`);
|
|
125
|
+
console.log(` Created: ${new Date(mission.created).toLocaleDateString()}`);
|
|
126
|
+
|
|
127
|
+
console.log(chalk.blue('\nπ€ Agents'));
|
|
128
|
+
mission.agents.forEach(agent => {
|
|
129
|
+
console.log(` β’ ${agent}`);
|
|
130
|
+
});
|
|
131
|
+
|
|
132
|
+
console.log(chalk.blue('\nπ Stories'));
|
|
133
|
+
if (mission.stories.length > 0) {
|
|
134
|
+
mission.stories.forEach(story => {
|
|
135
|
+
console.log(` β’ ${story}`);
|
|
136
|
+
});
|
|
137
|
+
} else {
|
|
138
|
+
console.log(chalk.gray(' No stories yet'));
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
console.log(chalk.blue('\nποΈ Architecture Context'));
|
|
142
|
+
console.log(` Tech Stack: ${JSON.stringify(mission.architecture.techStack.languages)} + ${JSON.stringify(mission.architecture.techStack.frameworks)}`);
|
|
143
|
+
console.log(` Project Type: ${mission.architecture.projectStructure.type}`);
|
|
144
|
+
|
|
145
|
+
} catch (error) {
|
|
146
|
+
console.error(chalk.red('β Failed to get mission status:'), error.message);
|
|
147
|
+
process.exit(1);
|
|
148
|
+
}
|
|
149
|
+
});
|
|
150
|
+
|
|
151
|
+
program
|
|
152
|
+
.command('start <missionId>')
|
|
153
|
+
.description('Start a mission (change status to active)')
|
|
154
|
+
.action(async (missionId) => {
|
|
155
|
+
try {
|
|
156
|
+
console.log(chalk.yellow(`π Starting mission ${missionId}...`));
|
|
157
|
+
// TODO: Implement mission start logic
|
|
158
|
+
console.log(chalk.green('β
Mission started!'));
|
|
159
|
+
console.log(chalk.gray('Next: Begin working on stories'));
|
|
160
|
+
} catch (error) {
|
|
161
|
+
console.error(chalk.red('β Failed to start mission:'), error.message);
|
|
162
|
+
process.exit(1);
|
|
163
|
+
}
|
|
164
|
+
});
|
|
165
|
+
|
|
166
|
+
program
|
|
167
|
+
.command('complete <missionId>')
|
|
168
|
+
.description('Mark a mission as completed')
|
|
169
|
+
.action(async (missionId) => {
|
|
170
|
+
try {
|
|
171
|
+
console.log(chalk.blue(`π Completing mission ${missionId}...`));
|
|
172
|
+
// TODO: Implement mission completion logic
|
|
173
|
+
console.log(chalk.green('β
Mission completed!'));
|
|
174
|
+
console.log(chalk.gray('Great work! Ready for the next mission.'));
|
|
175
|
+
} catch (error) {
|
|
176
|
+
console.error(chalk.red('β Failed to complete mission:'), error.message);
|
|
177
|
+
process.exit(1);
|
|
178
|
+
}
|
|
179
|
+
});
|
|
180
|
+
|
|
181
|
+
// Interactive mission dashboard
|
|
182
|
+
program
|
|
183
|
+
.command('dashboard')
|
|
184
|
+
.alias('dash')
|
|
185
|
+
.description('Interactive mission dashboard')
|
|
186
|
+
.action(async () => {
|
|
187
|
+
console.log(chalk.cyan.bold('\nπ― Mission Dashboard\n'));
|
|
188
|
+
|
|
189
|
+
try {
|
|
190
|
+
const missionSystem = new MissionSystem();
|
|
191
|
+
const missions = await missionSystem.listMissions();
|
|
192
|
+
|
|
193
|
+
if (missions.length === 0) {
|
|
194
|
+
console.log(chalk.yellow('π No missions yet'));
|
|
195
|
+
console.log(chalk.gray('Create your first mission to get started!'));
|
|
196
|
+
return;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
// Show mission summary
|
|
200
|
+
const statusCounts = missions.reduce((acc, mission) => {
|
|
201
|
+
acc[mission.status] = (acc[mission.status] || 0) + 1;
|
|
202
|
+
return acc;
|
|
203
|
+
}, {});
|
|
204
|
+
|
|
205
|
+
console.log(chalk.blue('π Mission Summary'));
|
|
206
|
+
Object.entries(statusCounts).forEach(([status, count]) => {
|
|
207
|
+
const color = {
|
|
208
|
+
'planning': 'yellow',
|
|
209
|
+
'active': 'green',
|
|
210
|
+
'completed': 'blue'
|
|
211
|
+
}[status] || 'white';
|
|
212
|
+
console.log(chalk[color](` ${status}: ${count}`));
|
|
213
|
+
});
|
|
214
|
+
|
|
215
|
+
console.log(chalk.blue('\nπ Recent Missions'));
|
|
216
|
+
missions.slice(0, 5).forEach(mission => {
|
|
217
|
+
const statusEmoji = {
|
|
218
|
+
'planning': 'π',
|
|
219
|
+
'active': 'π',
|
|
220
|
+
'completed': 'β
'
|
|
221
|
+
}[mission.status] || 'π';
|
|
222
|
+
|
|
223
|
+
console.log(` ${statusEmoji} ${mission.name}`);
|
|
224
|
+
console.log(chalk.gray(` ${mission.agents.length} agents β’ ${mission.stories.length} stories β’ ${mission.status}`));
|
|
225
|
+
});
|
|
226
|
+
|
|
227
|
+
} catch (error) {
|
|
228
|
+
console.error(chalk.red('β Dashboard error:'), error.message);
|
|
229
|
+
process.exit(1);
|
|
230
|
+
}
|
|
231
|
+
});
|
|
232
|
+
|
|
233
|
+
// Handle no command
|
|
234
|
+
program.action(() => {
|
|
235
|
+
console.log(chalk.cyan.bold('\nπ― ONE Mission System\n'));
|
|
236
|
+
console.log('Available commands:');
|
|
237
|
+
console.log(' create [objective] Create a new mission');
|
|
238
|
+
console.log(' list List all missions');
|
|
239
|
+
console.log(' status <id> Show mission details');
|
|
240
|
+
console.log(' dashboard Mission dashboard');
|
|
241
|
+
console.log('');
|
|
242
|
+
console.log(chalk.gray('Example: one:mission create "Build user authentication system"'));
|
|
243
|
+
});
|
|
244
|
+
|
|
245
|
+
program.parse();
|
|
246
|
+
|
|
247
|
+
export { program };
|
package/bin/one-story.js
ADDED
|
@@ -0,0 +1,340 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* ONE Story CLI Command
|
|
5
|
+
* Interactive story creation and management within missions
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import { Command } from 'commander';
|
|
9
|
+
import chalk from 'chalk';
|
|
10
|
+
import { StorySystem } from './story-system.js';
|
|
11
|
+
|
|
12
|
+
const program = new Command();
|
|
13
|
+
|
|
14
|
+
program
|
|
15
|
+
.name('one:story')
|
|
16
|
+
.description('π Story management for ONE collaborative intelligence')
|
|
17
|
+
.version('1.0.0');
|
|
18
|
+
|
|
19
|
+
program
|
|
20
|
+
.command('create <missionId> [objective]')
|
|
21
|
+
.description('Create a new story within a mission')
|
|
22
|
+
.option('-i, --interactive', 'Interactive story design', true)
|
|
23
|
+
.option('-a, --auto', 'Auto-generate story without interaction', false)
|
|
24
|
+
.action(async (missionId, objective, options) => {
|
|
25
|
+
console.log(chalk.cyan.bold('\nπ ONE Story Creator\n'));
|
|
26
|
+
|
|
27
|
+
try {
|
|
28
|
+
if (!objective) {
|
|
29
|
+
const { default: inquirer } = await import('inquirer');
|
|
30
|
+
const answers = await inquirer.prompt([
|
|
31
|
+
{
|
|
32
|
+
type: 'input',
|
|
33
|
+
name: 'objective',
|
|
34
|
+
message: 'What is your story objective?',
|
|
35
|
+
validate: input => input.length > 0 || 'Please enter a story objective'
|
|
36
|
+
}
|
|
37
|
+
]);
|
|
38
|
+
objective = answers.objective;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
const storySystem = new StorySystem();
|
|
42
|
+
const story = await storySystem.createStory(missionId, objective, {
|
|
43
|
+
interactive: !options.auto
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
console.log(chalk.green.bold('\nπ Story created successfully!'));
|
|
47
|
+
console.log(chalk.blue(`π Story ID: ${story.id}`));
|
|
48
|
+
console.log(chalk.blue(`π Location: .one/missions/${missionId}/stories/${story.id}.yaml`));
|
|
49
|
+
console.log(chalk.blue(`π€ Agents: ${story.agents.join(', ')}`));
|
|
50
|
+
console.log(chalk.blue(`π Tasks: ${story.tasks.length} generated`));
|
|
51
|
+
|
|
52
|
+
console.log(chalk.yellow('\nπ Next steps:'));
|
|
53
|
+
console.log(' 1. Review story details: one:story status ' + story.id);
|
|
54
|
+
console.log(' 2. Start working on tasks: one:task list ' + story.id);
|
|
55
|
+
console.log(' 3. Update story progress: one:story update ' + story.id);
|
|
56
|
+
|
|
57
|
+
} catch (error) {
|
|
58
|
+
console.error(chalk.red('β Failed to create story:'), error.message);
|
|
59
|
+
process.exit(1);
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
program
|
|
64
|
+
.command('list [missionId]')
|
|
65
|
+
.description('List stories (all or for specific mission)')
|
|
66
|
+
.option('-s, --status <status>', 'Filter by status (planning, active, completed)')
|
|
67
|
+
.action(async (missionId, options) => {
|
|
68
|
+
try {
|
|
69
|
+
const storySystem = new StorySystem();
|
|
70
|
+
const stories = await storySystem.listStories(missionId);
|
|
71
|
+
|
|
72
|
+
if (stories.length === 0) {
|
|
73
|
+
if (missionId) {
|
|
74
|
+
console.log(chalk.yellow(`\nπ No stories found for mission ${missionId}`));
|
|
75
|
+
console.log(chalk.gray(`Create a story: one:story create ${missionId} "Your objective"`));
|
|
76
|
+
} else {
|
|
77
|
+
console.log(chalk.yellow('\nπ No stories found'));
|
|
78
|
+
console.log(chalk.gray('Create your first story: one:story create <mission-id> "Your objective"'));
|
|
79
|
+
}
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
const title = missionId ? `Stories for Mission ${missionId}` : 'All Stories';
|
|
84
|
+
console.log(chalk.cyan.bold(`\nπ ${title}\n`));
|
|
85
|
+
|
|
86
|
+
stories
|
|
87
|
+
.filter(story => !options.status || story.status === options.status)
|
|
88
|
+
.forEach(story => {
|
|
89
|
+
const statusColor = {
|
|
90
|
+
'planning': 'yellow',
|
|
91
|
+
'active': 'green',
|
|
92
|
+
'completed': 'blue',
|
|
93
|
+
'paused': 'gray'
|
|
94
|
+
}[story.status] || 'white';
|
|
95
|
+
|
|
96
|
+
console.log(chalk[statusColor](`π ${story.name}`));
|
|
97
|
+
console.log(chalk.gray(` ID: ${story.id}`));
|
|
98
|
+
console.log(chalk.gray(` Mission: ${story.missionId}`));
|
|
99
|
+
console.log(chalk.gray(` Status: ${story.status}`));
|
|
100
|
+
console.log(chalk.gray(` Agents: ${story.agents.join(', ')}`));
|
|
101
|
+
console.log(chalk.gray(` Tasks: ${story.tasks.length}`));
|
|
102
|
+
console.log(chalk.gray(` Priority: ${story.priority}`));
|
|
103
|
+
console.log(chalk.gray(` Created: ${new Date(story.created).toLocaleDateString()}`));
|
|
104
|
+
console.log('');
|
|
105
|
+
});
|
|
106
|
+
} catch (error) {
|
|
107
|
+
console.error(chalk.red('β Failed to list stories:'), error.message);
|
|
108
|
+
process.exit(1);
|
|
109
|
+
}
|
|
110
|
+
});
|
|
111
|
+
|
|
112
|
+
program
|
|
113
|
+
.command('status <storyId>')
|
|
114
|
+
.description('Show detailed story status')
|
|
115
|
+
.option('-m, --mission <missionId>', 'Specify mission ID for faster lookup')
|
|
116
|
+
.action(async (storyId, options) => {
|
|
117
|
+
try {
|
|
118
|
+
const storySystem = new StorySystem();
|
|
119
|
+
const story = await storySystem.getStory(storyId, options.mission);
|
|
120
|
+
|
|
121
|
+
if (!story) {
|
|
122
|
+
console.log(chalk.red(`β Story not found: ${storyId}`));
|
|
123
|
+
console.log(chalk.gray('List stories: one:story list'));
|
|
124
|
+
return;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
console.log(chalk.cyan.bold(`\nπ Story: ${story.name}\n`));
|
|
128
|
+
|
|
129
|
+
console.log(chalk.blue('π Overview'));
|
|
130
|
+
console.log(` Objective: ${story.objective}`);
|
|
131
|
+
console.log(` Status: ${story.status}`);
|
|
132
|
+
console.log(` Priority: ${story.priority}`);
|
|
133
|
+
console.log(` Duration: ${story.duration}`);
|
|
134
|
+
console.log(` Mission: ${story.missionId}`);
|
|
135
|
+
console.log(` Created: ${new Date(story.created).toLocaleDateString()}`);
|
|
136
|
+
|
|
137
|
+
console.log(chalk.blue('\nπ€ Agents'));
|
|
138
|
+
story.agents.forEach(agent => {
|
|
139
|
+
console.log(` β’ ${agent}`);
|
|
140
|
+
});
|
|
141
|
+
|
|
142
|
+
console.log(chalk.blue('\nπ Tasks'));
|
|
143
|
+
if (story.tasks.length > 0) {
|
|
144
|
+
story.tasks.forEach(task => {
|
|
145
|
+
const statusEmoji = {
|
|
146
|
+
'pending': 'β³',
|
|
147
|
+
'active': 'π',
|
|
148
|
+
'completed': 'β
',
|
|
149
|
+
'blocked': 'π«'
|
|
150
|
+
}[task.status] || 'π';
|
|
151
|
+
|
|
152
|
+
console.log(` ${statusEmoji} ${task.name} (${task.status})`);
|
|
153
|
+
});
|
|
154
|
+
} else {
|
|
155
|
+
console.log(chalk.gray(' No tasks yet'));
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
if (story.dependencies.length > 0) {
|
|
159
|
+
console.log(chalk.blue('\nπ Dependencies'));
|
|
160
|
+
story.dependencies.forEach(dep => {
|
|
161
|
+
console.log(` β’ ${dep}`);
|
|
162
|
+
});
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
if (story.description && story.description.length > 0) {
|
|
166
|
+
console.log(chalk.blue('\nπ Description'));
|
|
167
|
+
console.log(story.description);
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
} catch (error) {
|
|
171
|
+
console.error(chalk.red('β Failed to get story status:'), error.message);
|
|
172
|
+
process.exit(1);
|
|
173
|
+
}
|
|
174
|
+
});
|
|
175
|
+
|
|
176
|
+
program
|
|
177
|
+
.command('update <storyId> <status>')
|
|
178
|
+
.description('Update story status (planning, active, completed, paused)')
|
|
179
|
+
.option('-m, --mission <missionId>', 'Specify mission ID for faster lookup')
|
|
180
|
+
.action(async (storyId, status, options) => {
|
|
181
|
+
try {
|
|
182
|
+
const validStatuses = ['planning', 'active', 'completed', 'paused'];
|
|
183
|
+
if (!validStatuses.includes(status)) {
|
|
184
|
+
console.log(chalk.red(`β Invalid status. Must be one of: ${validStatuses.join(', ')}`));
|
|
185
|
+
return;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
console.log(chalk.yellow(`π Updating story ${storyId} status to ${status}...`));
|
|
189
|
+
|
|
190
|
+
const storySystem = new StorySystem();
|
|
191
|
+
const updatedStory = await storySystem.updateStoryStatus(storyId, status, options.mission);
|
|
192
|
+
|
|
193
|
+
console.log(chalk.green('β
Story status updated!'));
|
|
194
|
+
console.log(chalk.blue(`π ${updatedStory.name}: ${updatedStory.status}`));
|
|
195
|
+
|
|
196
|
+
} catch (error) {
|
|
197
|
+
console.error(chalk.red('β Failed to update story status:'), error.message);
|
|
198
|
+
process.exit(1);
|
|
199
|
+
}
|
|
200
|
+
});
|
|
201
|
+
|
|
202
|
+
program
|
|
203
|
+
.command('start <storyId>')
|
|
204
|
+
.description('Start a story (change status to active)')
|
|
205
|
+
.option('-m, --mission <missionId>', 'Specify mission ID for faster lookup')
|
|
206
|
+
.action(async (storyId, options) => {
|
|
207
|
+
try {
|
|
208
|
+
console.log(chalk.yellow(`π Starting story ${storyId}...`));
|
|
209
|
+
|
|
210
|
+
const storySystem = new StorySystem();
|
|
211
|
+
const updatedStory = await storySystem.updateStoryStatus(storyId, 'active', options.mission);
|
|
212
|
+
|
|
213
|
+
console.log(chalk.green('β
Story started!'));
|
|
214
|
+
console.log(chalk.blue(`π ${updatedStory.name} is now active`));
|
|
215
|
+
console.log(chalk.gray('Next: Begin working on tasks'));
|
|
216
|
+
|
|
217
|
+
} catch (error) {
|
|
218
|
+
console.error(chalk.red('β Failed to start story:'), error.message);
|
|
219
|
+
process.exit(1);
|
|
220
|
+
}
|
|
221
|
+
});
|
|
222
|
+
|
|
223
|
+
program
|
|
224
|
+
.command('complete <storyId>')
|
|
225
|
+
.description('Mark a story as completed')
|
|
226
|
+
.option('-m, --mission <missionId>', 'Specify mission ID for faster lookup')
|
|
227
|
+
.action(async (storyId, options) => {
|
|
228
|
+
try {
|
|
229
|
+
console.log(chalk.blue(`π Completing story ${storyId}...`));
|
|
230
|
+
|
|
231
|
+
const storySystem = new StorySystem();
|
|
232
|
+
const updatedStory = await storySystem.updateStoryStatus(storyId, 'completed', options.mission);
|
|
233
|
+
|
|
234
|
+
console.log(chalk.green('β
Story completed!'));
|
|
235
|
+
console.log(chalk.blue(`π ${updatedStory.name} is now complete`));
|
|
236
|
+
console.log(chalk.gray('Great work! Ready for the next story.'));
|
|
237
|
+
|
|
238
|
+
} catch (error) {
|
|
239
|
+
console.error(chalk.red('β Failed to complete story:'), error.message);
|
|
240
|
+
process.exit(1);
|
|
241
|
+
}
|
|
242
|
+
});
|
|
243
|
+
|
|
244
|
+
// Interactive story dashboard
|
|
245
|
+
program
|
|
246
|
+
.command('dashboard [missionId]')
|
|
247
|
+
.alias('dash')
|
|
248
|
+
.description('Interactive story dashboard')
|
|
249
|
+
.action(async (missionId) => {
|
|
250
|
+
const title = missionId ? `Story Dashboard - Mission ${missionId}` : 'Story Dashboard - All Missions';
|
|
251
|
+
console.log(chalk.cyan.bold(`\nπ ${title}\n`));
|
|
252
|
+
|
|
253
|
+
try {
|
|
254
|
+
const storySystem = new StorySystem();
|
|
255
|
+
const stories = await storySystem.listStories(missionId);
|
|
256
|
+
|
|
257
|
+
if (stories.length === 0) {
|
|
258
|
+
console.log(chalk.yellow('π No stories yet'));
|
|
259
|
+
console.log(chalk.gray('Create your first story to get started!'));
|
|
260
|
+
return;
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
// Show story summary
|
|
264
|
+
const statusCounts = stories.reduce((acc, story) => {
|
|
265
|
+
acc[story.status] = (acc[story.status] || 0) + 1;
|
|
266
|
+
return acc;
|
|
267
|
+
}, {});
|
|
268
|
+
|
|
269
|
+
const priorityCounts = stories.reduce((acc, story) => {
|
|
270
|
+
acc[story.priority] = (acc[story.priority] || 0) + 1;
|
|
271
|
+
return acc;
|
|
272
|
+
}, {});
|
|
273
|
+
|
|
274
|
+
console.log(chalk.blue('π Story Summary'));
|
|
275
|
+
Object.entries(statusCounts).forEach(([status, count]) => {
|
|
276
|
+
const color = {
|
|
277
|
+
'planning': 'yellow',
|
|
278
|
+
'active': 'green',
|
|
279
|
+
'completed': 'blue',
|
|
280
|
+
'paused': 'gray'
|
|
281
|
+
}[status] || 'white';
|
|
282
|
+
console.log(chalk[color](` ${status}: ${count}`));
|
|
283
|
+
});
|
|
284
|
+
|
|
285
|
+
console.log(chalk.blue('\nπ― Priority Distribution'));
|
|
286
|
+
Object.entries(priorityCounts).forEach(([priority, count]) => {
|
|
287
|
+
const color = {
|
|
288
|
+
'high': 'red',
|
|
289
|
+
'medium': 'yellow',
|
|
290
|
+
'low': 'green'
|
|
291
|
+
}[priority] || 'white';
|
|
292
|
+
console.log(chalk[color](` ${priority}: ${count}`));
|
|
293
|
+
});
|
|
294
|
+
|
|
295
|
+
console.log(chalk.blue('\nπ Active Stories'));
|
|
296
|
+
const activeStories = stories.filter(s => s.status === 'active');
|
|
297
|
+
if (activeStories.length > 0) {
|
|
298
|
+
activeStories.forEach(story => {
|
|
299
|
+
console.log(` π ${story.name}`);
|
|
300
|
+
console.log(chalk.gray(` ${story.agents.length} agents β’ ${story.tasks.length} tasks β’ ${story.priority} priority`));
|
|
301
|
+
});
|
|
302
|
+
} else {
|
|
303
|
+
console.log(chalk.gray(' No active stories'));
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
console.log(chalk.blue('\nπ Recent Stories'));
|
|
307
|
+
stories.slice(0, 5).forEach(story => {
|
|
308
|
+
const statusEmoji = {
|
|
309
|
+
'planning': 'π',
|
|
310
|
+
'active': 'π',
|
|
311
|
+
'completed': 'β
',
|
|
312
|
+
'paused': 'βΈοΈ'
|
|
313
|
+
}[story.status] || 'π';
|
|
314
|
+
|
|
315
|
+
console.log(` ${statusEmoji} ${story.name}`);
|
|
316
|
+
console.log(chalk.gray(` ${story.tasks.length} tasks β’ ${story.priority} priority β’ ${story.status}`));
|
|
317
|
+
});
|
|
318
|
+
|
|
319
|
+
} catch (error) {
|
|
320
|
+
console.error(chalk.red('β Dashboard error:'), error.message);
|
|
321
|
+
process.exit(1);
|
|
322
|
+
}
|
|
323
|
+
});
|
|
324
|
+
|
|
325
|
+
// Handle no command
|
|
326
|
+
program.action(() => {
|
|
327
|
+
console.log(chalk.cyan.bold('\nπ ONE Story System\n'));
|
|
328
|
+
console.log('Available commands:');
|
|
329
|
+
console.log(' create <mission> [objective] Create a new story');
|
|
330
|
+
console.log(' list [mission] List stories');
|
|
331
|
+
console.log(' status <id> Show story details');
|
|
332
|
+
console.log(' update <id> <status> Update story status');
|
|
333
|
+
console.log(' dashboard [mission] Story dashboard');
|
|
334
|
+
console.log('');
|
|
335
|
+
console.log(chalk.gray('Example: one:story create mission-123 "Implement user login"'));
|
|
336
|
+
});
|
|
337
|
+
|
|
338
|
+
program.parse();
|
|
339
|
+
|
|
340
|
+
export { program };
|