oneie 1.1.0 → 1.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.
package/bin/oneie.js ADDED
@@ -0,0 +1,496 @@
1
+ #!/usr/bin/env node
2
+
3
+ /**
4
+ * ONE - Personal Collaborative Intelligence
5
+ * Main entry point for the ONE system
6
+ */
7
+
8
+ import { Command } from 'commander';
9
+ import chalk from 'chalk';
10
+ import fs from 'fs-extra';
11
+ import path from 'path';
12
+ import { OneInstaller } from './one-installer.js';
13
+ import { MissionSystem } from './mission-system.js';
14
+ import { StorySystem } from './story-system.js';
15
+ import { TaskSystem } from './task-system.js';
16
+
17
+ const program = new Command();
18
+
19
+ program
20
+ .name('oneie')
21
+ .description('šŸ¤ ONE - Personal Collaborative Intelligence')
22
+ .version('1.1.0');
23
+
24
+ // Main install command (default - engineering agents only)
25
+ program
26
+ .command('install', { isDefault: true })
27
+ .description('Install ONE and create your personal workspace with engineering team')
28
+ .option('-a, --auto', 'Skip interactive setup', false)
29
+ .action(async (options) => {
30
+ try {
31
+ const installer = new OneInstaller();
32
+ // Force core-only installation (engineering agents only)
33
+ options.coreOnly = true;
34
+ await installer.install(options);
35
+ } catch (error) {
36
+ console.error(chalk.red('āŒ Installation failed:'), error.message);
37
+ process.exit(1);
38
+ }
39
+ });
40
+
41
+ // Secret marketing command
42
+ program
43
+ .command('marketing')
44
+ .description('Install marketing team agents')
45
+ .option('-a, --auto', 'Skip interactive setup', false)
46
+ .action(async (options) => {
47
+ try {
48
+ const installer = new OneInstaller();
49
+ // Install all agents including marketing
50
+ options.includeMarketing = true;
51
+ await installer.install(options);
52
+ } catch (error) {
53
+ console.error(chalk.red('āŒ Marketing installation failed:'), error.message);
54
+ process.exit(1);
55
+ }
56
+ });
57
+
58
+ // Generate content from me.md
59
+ program
60
+ .command('generate')
61
+ .description('Generate personalized content from your me.md')
62
+ .action(async () => {
63
+ try {
64
+ const installer = new OneInstaller();
65
+ await installer.generate();
66
+ } catch (error) {
67
+ console.error(chalk.red('āŒ Generation failed:'), error.message);
68
+ process.exit(1);
69
+ }
70
+ });
71
+
72
+ // Update me.md profile
73
+ program
74
+ .command('update-me')
75
+ .alias('me')
76
+ .description('Update your personal me.md profile')
77
+ .action(async () => {
78
+ try {
79
+ const installer = new OneInstaller();
80
+ await installer.updateMe();
81
+ } catch (error) {
82
+ console.error(chalk.red('āŒ Profile update failed:'), error.message);
83
+ process.exit(1);
84
+ }
85
+ });
86
+
87
+ // Mission management
88
+ program
89
+ .command('mission')
90
+ .description('Mission management commands')
91
+ .argument('[command]', 'Mission command (create, list, status)')
92
+ .argument('[args...]', 'Mission arguments')
93
+ .action(async (command, args) => {
94
+ const missionSystem = new MissionSystem();
95
+
96
+ try {
97
+ if (!command || command === 'list') {
98
+ const missions = await missionSystem.listMissions();
99
+
100
+ if (missions.length === 0) {
101
+ console.log(chalk.yellow('\\nšŸ“‹ No missions yet'));
102
+ console.log(chalk.gray('Create your first mission: npx oneie mission create "Your goal"'));
103
+ return;
104
+ }
105
+
106
+ console.log(chalk.cyan.bold('\\nšŸŽÆ Your Missions\\n'));
107
+ missions.forEach(mission => {
108
+ const statusEmoji = {
109
+ 'planning': 'šŸ“‹',
110
+ 'active': 'šŸš€',
111
+ 'completed': 'āœ…'
112
+ }[mission.status] || 'šŸ“‹';
113
+
114
+ console.log(`${statusEmoji} ${mission.name}`);
115
+ console.log(chalk.gray(` ${mission.objective}`));
116
+ console.log(chalk.gray(` Status: ${mission.status} | Created: ${new Date(mission.created).toLocaleDateString()}`));
117
+ console.log('');
118
+ });
119
+
120
+ } else if (command === 'create') {
121
+ const objective = args.join(' ') || 'Complete current project';
122
+ console.log(chalk.cyan(`\\nšŸŽÆ Creating mission: ${objective}`));
123
+
124
+ const mission = await missionSystem.createMission(objective, {
125
+ interactive: false
126
+ });
127
+
128
+ console.log(chalk.green(`\\nāœ… Mission created: ${mission.name}`));
129
+ console.log(chalk.blue(`šŸ“‹ ID: ${mission.id}`));
130
+ console.log(chalk.gray('Next: npx oneie story create ' + mission.id + ' "Story objective"'));
131
+
132
+ } else if (command === 'status') {
133
+ const missionId = args[0];
134
+ if (!missionId) {
135
+ console.log(chalk.red('āŒ Please provide mission ID'));
136
+ return;
137
+ }
138
+
139
+ const mission = await missionSystem.getMission(missionId);
140
+ if (!mission) {
141
+ console.log(chalk.red(`āŒ Mission not found: ${missionId}`));
142
+ return;
143
+ }
144
+
145
+ console.log(chalk.cyan.bold(`\\nšŸŽÆ Mission: ${mission.name}`));
146
+ console.log(`Objective: ${mission.objective}`);
147
+ console.log(`Status: ${mission.status}`);
148
+ console.log(`Created: ${new Date(mission.created).toLocaleDateString()}`);
149
+ console.log(`Agents: ${mission.agents.join(', ')}`);
150
+
151
+ } else {
152
+ console.log(chalk.red(`āŒ Unknown mission command: ${command}`));
153
+ console.log(chalk.gray('Available: create, list, status'));
154
+ }
155
+
156
+ } catch (error) {
157
+ console.error(chalk.red('āŒ Mission command failed:'), error.message);
158
+ process.exit(1);
159
+ }
160
+ });
161
+
162
+ // Story management
163
+ program
164
+ .command('story')
165
+ .description('Story management commands')
166
+ .argument('[command]', 'Story command (create, list, status)')
167
+ .argument('[args...]', 'Story arguments')
168
+ .action(async (command, args) => {
169
+ const storySystem = new StorySystem();
170
+
171
+ try {
172
+ if (!command || command === 'list') {
173
+ const stories = await storySystem.listStories();
174
+
175
+ if (stories.length === 0) {
176
+ console.log(chalk.yellow('\\nšŸ“š No stories yet'));
177
+ console.log(chalk.gray('Create your first story: npx oneie story create <mission-id> "Story goal"'));
178
+ return;
179
+ }
180
+
181
+ console.log(chalk.cyan.bold('\\nšŸ“š Your Stories\\n'));
182
+ stories.forEach(story => {
183
+ const statusEmoji = {
184
+ 'planning': 'šŸ“‹',
185
+ 'active': 'šŸš€',
186
+ 'completed': 'āœ…'
187
+ }[story.status] || 'šŸ“‹';
188
+
189
+ console.log(`${statusEmoji} ${story.name}`);
190
+ console.log(chalk.gray(` Mission: ${story.missionId} | Status: ${story.status}`));
191
+ console.log(chalk.gray(` Agents: ${story.agents?.join(', ') || 'None'} | Tasks: ${story.tasks?.length || 0}`));
192
+ console.log('');
193
+ });
194
+
195
+ } else if (command === 'create') {
196
+ const missionId = args[0];
197
+ const objective = args.slice(1).join(' ');
198
+
199
+ if (!missionId) {
200
+ console.log(chalk.red('āŒ Please provide mission ID'));
201
+ console.log(chalk.gray('Usage: npx oneie story create <mission-id> "Story objective"'));
202
+ return;
203
+ }
204
+
205
+ if (!objective) {
206
+ console.log(chalk.red('āŒ Please provide story objective'));
207
+ return;
208
+ }
209
+
210
+ console.log(chalk.cyan(`\\nšŸ“š Creating story: ${objective}`));
211
+
212
+ const story = await storySystem.createStory(missionId, objective, {
213
+ interactive: false
214
+ });
215
+
216
+ console.log(chalk.green(`\\nāœ… Story created: ${story.name}`));
217
+ console.log(chalk.blue(`šŸ“š ID: ${story.id}`));
218
+ console.log(chalk.gray('Next: npx oneie task create ' + story.id + ' "Task to complete"'));
219
+
220
+ } else {
221
+ console.log(chalk.red(`āŒ Unknown story command: ${command}`));
222
+ console.log(chalk.gray('Available: create, list'));
223
+ }
224
+
225
+ } catch (error) {
226
+ console.error(chalk.red('āŒ Story command failed:'), error.message);
227
+ process.exit(1);
228
+ }
229
+ });
230
+
231
+ // Task management
232
+ program
233
+ .command('task')
234
+ .description('Task management commands')
235
+ .argument('[command]', 'Task command (create, list, status)')
236
+ .argument('[args...]', 'Task arguments')
237
+ .action(async (command, args) => {
238
+ const taskSystem = new TaskSystem();
239
+
240
+ try {
241
+ if (!command || command === 'list') {
242
+ const tasks = await taskSystem.listTasks();
243
+
244
+ if (tasks.length === 0) {
245
+ console.log(chalk.yellow('\\nšŸ“‹ No tasks yet'));
246
+ console.log(chalk.gray('Create your first task: npx oneie task create <story-id> "Task description"'));
247
+ return;
248
+ }
249
+
250
+ console.log(chalk.cyan.bold('\\nšŸ“‹ Your Tasks\\n'));
251
+
252
+ const activeTasks = tasks.filter(t => t.status === 'active');
253
+ const pendingTasks = tasks.filter(t => t.status === 'pending');
254
+ const completedTasks = tasks.filter(t => t.status === 'completed');
255
+
256
+ if (activeTasks.length > 0) {
257
+ console.log(chalk.green('šŸš€ Active Tasks'));
258
+ activeTasks.forEach(task => {
259
+ console.log(` ⚔ ${task.name}`);
260
+ console.log(chalk.gray(` Agents: ${task.agents.join(', ')}`));
261
+ });
262
+ console.log('');
263
+ }
264
+
265
+ if (pendingTasks.length > 0) {
266
+ console.log(chalk.yellow('ā³ Pending Tasks'));
267
+ pendingTasks.slice(0, 5).forEach(task => {
268
+ console.log(` šŸ“‹ ${task.name}`);
269
+ console.log(chalk.gray(` Story: ${task.storyId}`));
270
+ });
271
+ if (pendingTasks.length > 5) {
272
+ console.log(chalk.gray(` ... and ${pendingTasks.length - 5} more`));
273
+ }
274
+ console.log('');
275
+ }
276
+
277
+ console.log(chalk.blue(`šŸ“Š Summary: ${activeTasks.length} active, ${pendingTasks.length} pending, ${completedTasks.length} completed`));
278
+
279
+ } else if (command === 'create') {
280
+ const storyId = args[0];
281
+ const taskName = args.slice(1).join(' ');
282
+
283
+ if (!storyId) {
284
+ console.log(chalk.red('āŒ Please provide story ID'));
285
+ console.log(chalk.gray('Usage: npx oneie task create <story-id> "Task description"'));
286
+ return;
287
+ }
288
+
289
+ if (!taskName) {
290
+ console.log(chalk.red('āŒ Please provide task description'));
291
+ return;
292
+ }
293
+
294
+ console.log(chalk.cyan(`\\nšŸ“‹ Creating task: ${taskName}`));
295
+
296
+ const task = await taskSystem.createTask(storyId, taskName, {
297
+ interactive: false
298
+ });
299
+
300
+ console.log(chalk.green(`\\nāœ… Task created: ${task.name}`));
301
+ console.log(chalk.blue(`šŸ“‹ ID: ${task.id}`));
302
+ console.log(chalk.gray(`šŸ¤– Agents: ${task.agents.join(', ')}`));
303
+ console.log(chalk.gray('Next: npx oneie task status ' + task.id));
304
+
305
+ } else {
306
+ console.log(chalk.red(`āŒ Unknown task command: ${command}`));
307
+ console.log(chalk.gray('Available: create, list'));
308
+ }
309
+
310
+ } catch (error) {
311
+ console.error(chalk.red('āŒ Task command failed:'), error.message);
312
+ process.exit(1);
313
+ }
314
+ });
315
+
316
+ // Agent management commands
317
+ program
318
+ .command('agents')
319
+ .description('Agent management and installation')
320
+ .argument('[command]', 'Agent command (install, update, uninstall, status)')
321
+ .option('--backup', 'Create backup before update/uninstall')
322
+ .action(async (command, options) => {
323
+ try {
324
+ const installer = new OneInstaller();
325
+ const { AgentInstaller } = await import('../one/tools/agent-installer.js');
326
+ const agentInstaller = new AgentInstaller();
327
+
328
+ if (!command || command === 'status') {
329
+ // Show agent status
330
+ console.log(chalk.cyan.bold('\\nšŸ¤– Agent Installation Status\\n'));
331
+
332
+ const status = await agentInstaller.getStatus();
333
+
334
+ if (!status.installed) {
335
+ console.log(chalk.yellow('āš ļø Claude Code agents not installed'));
336
+ console.log(chalk.gray('Run: npx oneie agents install'));
337
+ return;
338
+ }
339
+
340
+ console.log(chalk.blue('šŸ“Š Agent Summary:'));
341
+ console.log(` šŸ†“ Free Agents: ${status.agents.free}`);
342
+ console.log(` šŸ’Ž Premium Agents: ${status.agents.premium}`);
343
+ console.log(` šŸ“ Total Agents: ${status.agents.total}`);
344
+ console.log(` āš™ļø Command Files: ${status.commands}`);
345
+
346
+ if (status.license) {
347
+ console.log(`\\nšŸ“„ License Status: ${status.license.status}`);
348
+ if (status.license.licenseType) {
349
+ console.log(` License Type: ${status.license.licenseType}`);
350
+ console.log(` Expires: ${status.license.expiresAt ? new Date(status.license.expiresAt).toLocaleDateString() : 'N/A'}`);
351
+ }
352
+ }
353
+
354
+ console.log(chalk.cyan('\\nšŸ’¬ Try your agents:'));
355
+ console.log(' one:engineering-director "Help me with system design"');
356
+ console.log(' one:content-team-manager "Create a content strategy"');
357
+ if (status.license && status.license.status === 'active') {
358
+ console.log(' one:marketing-director "Develop a marketing campaign"');
359
+ }
360
+
361
+ } else if (command === 'install') {
362
+ console.log(chalk.cyan.bold('\\nšŸ“¦ Installing Claude Code Agents\\n'));
363
+ await agentInstaller.install(options);
364
+
365
+ } else if (command === 'update') {
366
+ console.log(chalk.cyan.bold('\\nšŸ”„ Updating Claude Code Agents\\n'));
367
+ await agentInstaller.update(options);
368
+
369
+ } else if (command === 'uninstall') {
370
+ console.log(chalk.cyan.bold('\\nšŸ—‘ļø Uninstalling Claude Code Agents\\n'));
371
+
372
+ const { confirm } = await import('inquirer').then(m => m.default);
373
+ const { proceed } = await confirm.prompt([{
374
+ type: 'confirm',
375
+ name: 'proceed',
376
+ message: 'Are you sure you want to uninstall all agents?',
377
+ default: false
378
+ }]);
379
+
380
+ if (proceed) {
381
+ await agentInstaller.uninstall(options);
382
+ } else {
383
+ console.log(chalk.gray('Uninstall cancelled'));
384
+ }
385
+
386
+ } else if (command === 'list') {
387
+ // Show personal agents (legacy behavior)
388
+ if (!await installer.isInstalled()) {
389
+ console.log(chalk.red('āŒ ONE is not installed here.'));
390
+ console.log(chalk.gray('Run: npx oneie'));
391
+ return;
392
+ }
393
+
394
+ console.log(chalk.cyan.bold('\\nšŸ¤– Your Personal AI Agents\\n'));
395
+
396
+ const agentsDir = path.join(process.cwd(), '.one', 'agents');
397
+ if (await fs.pathExists(agentsDir)) {
398
+ const agentFiles = await fs.readdir(agentsDir);
399
+ const yamlFiles = agentFiles.filter(file => file.endsWith('.yaml'));
400
+
401
+ if (yamlFiles.length === 0) {
402
+ console.log(chalk.yellow('No personal agents found. Run: npx oneie generate'));
403
+ return;
404
+ }
405
+
406
+ for (const file of yamlFiles) {
407
+ const agentPath = path.join(agentsDir, file);
408
+ const content = await fs.readFile(agentPath, 'utf8');
409
+ const frontMatter = content.match(/^---\\n([\\s\\S]*?)\\n---/);
410
+
411
+ if (frontMatter) {
412
+ try {
413
+ const yaml = await import('js-yaml');
414
+ const config = yaml.default.load(frontMatter[1]);
415
+
416
+ console.log(chalk.blue(`šŸ¤– ${config.name}`));
417
+ console.log(chalk.gray(` ${config.description.split('\\n')[0]}`));
418
+ if (config.expertise) {
419
+ console.log(chalk.gray(` Expertise: ${JSON.parse(config.expertise).join(', ')}`));
420
+ }
421
+ console.log('');
422
+ } catch (e) {
423
+ console.log(chalk.gray(`šŸ¤– ${file.replace('.yaml', '')}`));
424
+ }
425
+ }
426
+ }
427
+ } else {
428
+ console.log(chalk.yellow('No agents directory found. Run: npx oneie generate'));
429
+ }
430
+
431
+ } else {
432
+ console.log(chalk.red(`āŒ Unknown agent command: ${command}`));
433
+ console.log(chalk.gray('Available: install, update, uninstall, status, list'));
434
+ }
435
+
436
+ } catch (error) {
437
+ console.error(chalk.red('āŒ Agent command failed:'), error.message);
438
+ process.exit(1);
439
+ }
440
+ });
441
+
442
+ // Help command
443
+ program
444
+ .command('help')
445
+ .description('Show help and usage examples')
446
+ .action(() => {
447
+ console.log(chalk.cyan.bold('\\nšŸ¤ ONE - Personal Collaborative Intelligence\\n'));
448
+
449
+ console.log(chalk.blue('šŸš€ Getting Started:'));
450
+ console.log(' npx oneie # Install engineering team workspace');
451
+ console.log(' npx oneie marketing # Add marketing team agents');
452
+ console.log(' npx oneie update-me # Update your me.md profile');
453
+ console.log(' npx oneie generate # Generate content from your profile');
454
+ console.log('');
455
+
456
+ console.log(chalk.blue('šŸŽÆ Mission-Story-Task Workflow:'));
457
+ console.log(' npx oneie mission create "Build my app" # Create a mission');
458
+ console.log(' npx oneie story create <mission-id> "Setup" # Add stories to mission');
459
+ console.log(' npx oneie task create <story-id> "Code API" # Add tasks to story');
460
+ console.log('');
461
+
462
+ console.log(chalk.blue('šŸ¤– Your Personalized Workspace:'));
463
+ console.log(' npx oneie agents # Agent management and status');
464
+ console.log(' npx oneie agents install # Install Claude Code agents');
465
+ console.log(' npx oneie agents list # View your personal agents');
466
+ console.log(' npx oneie mission list # See your missions');
467
+ console.log(' npx oneie story list # See your stories');
468
+ console.log(' npx oneie task list # See your tasks');
469
+ console.log('');
470
+
471
+ console.log(chalk.yellow('šŸ’” How it works:'));
472
+ console.log('1. ONE reads your me.md profile (name, role, skills, goals)');
473
+ console.log('2. Creates personalized AI agents and workflows just for you');
474
+ console.log('3. Helps you organize work into missions → stories → tasks');
475
+ console.log('4. Agents help execute tasks based on your context and preferences');
476
+ console.log('');
477
+
478
+ console.log(chalk.gray('Your workspace adapts as you update me.md - try it!'));
479
+ });
480
+
481
+ // Handle no command (default to install with core-only)
482
+ program.action(async (options) => {
483
+ try {
484
+ const installer = new OneInstaller();
485
+ // Default to engineering agents only
486
+ options.coreOnly = true;
487
+ await installer.install(options);
488
+ } catch (error) {
489
+ console.error(chalk.red('āŒ Installation failed:'), error.message);
490
+ process.exit(1);
491
+ }
492
+ });
493
+
494
+ program.parse();
495
+
496
+ export { program };