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-story.js DELETED
@@ -1,340 +0,0 @@
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 };