oneie 1.0.2 → 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/install.js DELETED
@@ -1,473 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- import path from 'path';
4
- import fs from 'fs-extra';
5
- import chalk from 'chalk';
6
- import ora from 'ora';
7
- import figlet from 'figlet';
8
- import gradientString from 'gradient-string';
9
- import { readFile } from 'fs/promises';
10
- import { fileURLToPath } from 'url';
11
-
12
- const __filename = fileURLToPath(import.meta.url);
13
- const __dirname = path.dirname(__filename);
14
-
15
- // Get version from package.json
16
- const packageJson = JSON.parse(await readFile(path.join(__dirname, '../package.json'), 'utf8'));
17
- const ONE_VERSION = packageJson.version;
18
-
19
- /**
20
- * Production-ready ONE installer
21
- * Core workflow: Install → Configure → Ready
22
- */
23
- async function main() {
24
- try {
25
- console.clear();
26
-
27
- // 1. Welcome & System Check
28
- await showWelcome();
29
- const context = await detectEnvironment();
30
-
31
- // 2. Core Installation
32
- const spinner = ora('Installing ONE Universal AI System...').start();
33
-
34
- await sleep(1000);
35
- spinner.text = 'Creating AI universe structure...';
36
- await createCoreStructure(context);
37
-
38
- await sleep(500);
39
- spinner.text = 'Generating your digital DNA (me.md)...';
40
- await generateMeFile(context);
41
-
42
- await sleep(500);
43
- spinner.text = 'Setting up command interface...';
44
- await setupCommandInterface();
45
-
46
- await sleep(500);
47
- spinner.text = 'Setting up Claude Code integration...';
48
- await setupClaudeCodeIntegration(context);
49
-
50
- await sleep(500);
51
- spinner.text = 'Validating installation...';
52
- const validation = await validateInstallation();
53
-
54
- spinner.succeed('ONE installed successfully!');
55
-
56
- // 3. Success & Next Steps
57
- await showSuccessMessage(context, validation);
58
-
59
- } catch (error) {
60
- console.error(chalk.red('\n💥 Installation failed:'), error.message);
61
- showTroubleshootingHelp(error);
62
- process.exit(1);
63
- }
64
- }
65
-
66
- /**
67
- * Show welcome message with version info
68
- */
69
- async function showWelcome() {
70
- const title = await promisify(figlet)('ONE', { font: 'ANSI Shadow' });
71
- const gradient = gradientString(['#FF6B6B', '#4ECDC4', '#45B7D1']);
72
-
73
- console.log(gradient(title));
74
- console.log(chalk.cyan(`
75
- ╔══════════════════════════════════════════════════════════════════════════════╗
76
- ║ ║
77
- ║ 🌟 ONE Universal AI System v${ONE_VERSION.padEnd(35)}║
78
- ║ Simple blocks. Infinite possibilities. ║
79
- ║ ║
80
- ║ From homework to world domination - same system, infinite scale. ║
81
- ║ ║
82
- ╚══════════════════════════════════════════════════════════════════════════════╝
83
- `));
84
-
85
- console.log(chalk.yellow('🔍 Detecting your environment...'));
86
- await sleep(1500);
87
- }
88
-
89
- /**
90
- * Detect user environment and context
91
- */
92
- async function detectEnvironment() {
93
- const cwd = process.cwd();
94
- const context = {
95
- directory: path.basename(cwd),
96
- hasPackageJson: await fs.pathExists(path.join(cwd, 'package.json')),
97
- hasGit: await fs.pathExists(path.join(cwd, '.git')),
98
- nodeVersion: process.version,
99
- platform: process.platform,
100
- type: 'universal'
101
- };
102
-
103
- // Detect context from directory name and contents
104
- const dirName = context.directory.toLowerCase();
105
- if (dirName.includes('homework') || dirName.includes('school') || dirName.includes('study')) {
106
- context.type = 'student';
107
- } else if (context.hasPackageJson) {
108
- context.type = 'professional';
109
- } else if (dirName.includes('enterprise') || dirName.includes('company')) {
110
- context.type = 'enterprise';
111
- }
112
-
113
- console.log(chalk.green(`✅ Detected: ${context.type} environment in "${context.directory}"`));
114
- return context;
115
- }
116
-
117
- /**
118
- * Create the core ONE directory structure
119
- */
120
- async function createCoreStructure(context) {
121
- const oneDir = path.join(process.cwd(), 'one');
122
- const dotOneDir = path.join(process.cwd(), '.one');
123
-
124
- // Create main directories
125
- await fs.ensureDir(oneDir);
126
- await fs.ensureDir(dotOneDir);
127
-
128
- // Create core subdirectories
129
- const coreDirectories = [
130
- // User-customizable directories
131
- path.join(oneDir, 'me'),
132
- path.join(oneDir, 'missions'),
133
- path.join(oneDir, 'stories'),
134
- path.join(oneDir, 'tasks'),
135
- path.join(oneDir, 'agents'),
136
- path.join(oneDir, 'teams'),
137
- path.join(oneDir, 'spaces'),
138
-
139
- // System directories
140
- path.join(dotOneDir, 'core'),
141
- path.join(dotOneDir, 'templates'),
142
- path.join(dotOneDir, 'workflows')
143
- ];
144
-
145
- for (const dir of coreDirectories) {
146
- await fs.ensureDir(dir);
147
- }
148
- }
149
-
150
- /**
151
- * Generate the magical me.md file based on context
152
- */
153
- async function generateMeFile(context) {
154
- const meFilePath = path.join(process.cwd(), 'one', 'me', 'me.md');
155
-
156
- const meContent = generateContextualMeContent(context);
157
- await fs.writeFile(meFilePath, meContent, 'utf8');
158
- }
159
-
160
- /**
161
- * Generate contextual me.md content
162
- */
163
- function generateContextualMeContent(context) {
164
- const contextMessages = {
165
- student: {
166
- name: `${context.directory} Study Universe`,
167
- tagline: 'AI-powered learning that actually works',
168
- story: 'I use AI to master subjects faster and get better grades.',
169
- voice: 'Encouraging, patient, and focused on learning success'
170
- },
171
- professional: {
172
- name: `${context.directory} AI Workspace`,
173
- tagline: 'Professional productivity amplified by AI',
174
- story: 'I leverage AI agents to achieve professional goals efficiently.',
175
- voice: 'Professional, efficient, and results-driven'
176
- },
177
- enterprise: {
178
- name: `${context.directory} Enterprise Hub`,
179
- tagline: 'Enterprise-scale AI collaboration',
180
- story: 'We deploy AI at scale to transform business operations.',
181
- voice: 'Strategic, scalable, and compliance-focused'
182
- },
183
- universal: {
184
- name: `${context.directory} AI Universe`,
185
- tagline: 'Building the future with AI',
186
- story: 'I believe AI should amplify human potential.',
187
- voice: 'Professional, helpful, engaging'
188
- }
189
- };
190
-
191
- const config = contextMessages[context.type];
192
-
193
- return `---
194
- name: "${config.name}"
195
- tagline: "${config.tagline}"
196
- story: "${config.story}"
197
-
198
- brand:
199
- theme: professional
200
- colors:
201
- - "#2563EB"
202
- - "#64748B"
203
- - "#FFFFFF"
204
- voice: "${config.voice}"
205
- font: Inter
206
- cursor: default
207
-
208
- top_agents:
209
- - slot: 1
210
- name: "ARIA"
211
- base: "personal-assistant"
212
- role: "Personal Assistant & Digital Twin"
213
- personality: "Your voice, optimized for productivity"
214
- catchphrase: "I am you, but optimized"
215
-
216
- spaces:
217
- - id: "main"
218
- title: "${config.name}"
219
- vibe: "Productive workspace with AI superpowers"
220
- public: false
221
- features:
222
- - agents
223
- - missions
224
-
225
- goals:
226
- - "Master the ONE system"
227
- - "Achieve my objectives with AI"
228
-
229
- style:
230
- profile_song: false
231
- visitor_counter: false
232
- guestbook: false
233
- animations: subtle
234
- widgets:
235
- - top_8_agents
236
- ---
237
-
238
- # About Me
239
-
240
- ${config.story}
241
-
242
- My AI agents aren't just tools—they're intelligent collaborators trained to help me succeed. Together, we turn simple blocks into extraordinary results.
243
-
244
- Welcome to my universe. Let's build something amazing.
245
- `;
246
- }
247
-
248
- /**
249
- * Setup command interface for /one
250
- */
251
- async function setupCommandInterface() {
252
- // Create a simple, self-contained command script
253
- const commandScript = path.join(process.cwd(), '.one', 'one-command.js');
254
-
255
- const scriptContent = `#!/usr/bin/env node
256
-
257
- // ONE Mission Control Dashboard
258
- console.log(\`
259
- ╔══════════════════════════════════════════════════════════════════════════════╗
260
- ║ ║
261
- ║ 🌟 ONE MISSION CONTROL - Your AI Universe Dashboard ║
262
- ║ Simple blocks. Infinite possibilities. ║
263
- ║ ║
264
- ╚══════════════════════════════════════════════════════════════════════════════╝
265
-
266
- 📊 MISSION STATUS: Active (\${new Date().toLocaleDateString()})
267
-
268
- 🎯 SPECIALIZED TEAMS:
269
- 📊 Research Team - Market intelligence & analysis
270
- 📝 Content Team - Content creation & management
271
- 📈 Marketing Team - Growth & engagement strategies
272
- 💼 Sales Team - Revenue & conversion optimization
273
- 🎧 Service Team - Customer success & support
274
- 🎨 Design Team - Visual identity & user experience
275
- ⚡ Engineering Team - Technical implementation & architecture
276
- 🎓 Education Team - Learning & knowledge management
277
- 🕵️ Intelligence Team - Strategic insights & competitive analysis
278
-
279
- 🚀 CASCADE COMMANDERS:
280
- /commander - Mission Commander (Strategic Planning Specialist)
281
- /storyteller - Story Teller (Engineering Narrative Expert)
282
- /taskmaster - Task Master (Execution Coordination Master)
283
-
284
- 💡 QUICK ACTIONS:
285
- me validate - Validate your digital DNA
286
- me generate - Regenerate universe from me.md
287
- me sample - Generate sample configurations
288
-
289
- 📁 YOUR UNIVERSE:
290
- 📄 Digital DNA: one/me/me.md
291
- 🎯 Missions: one/missions/
292
- 📖 Stories: one/stories/
293
- ✅ Tasks: one/tasks/
294
- 🤖 Agents: one/agents/
295
-
296
- ✨ Your AI universe is operational! Edit one/me/me.md to customize.
297
- \`);
298
- `;
299
-
300
- await fs.writeFile(commandScript, scriptContent, 'utf8');
301
- await fs.chmod(commandScript, '755');
302
- }
303
-
304
- /**
305
- * Setup Claude Code integration with personalized commands
306
- */
307
- async function setupClaudeCodeIntegration(context) {
308
- const claudeDir = path.join(process.cwd(), '.claude');
309
- const commandsDir = path.join(claudeDir, 'commands');
310
-
311
- await fs.ensureDir(commandsDir);
312
-
313
- // Copy personalized slash commands from templates
314
- const templateCommandsDir = path.join(__dirname, '..', 'templates', 'claude-commands');
315
- const commandFiles = ['one.md', 'mission.md', 'story.md', 'agent.md'];
316
-
317
- for (const commandFile of commandFiles) {
318
- const sourcePath = path.join(templateCommandsDir, commandFile);
319
- const targetPath = path.join(commandsDir, commandFile);
320
-
321
- if (await fs.pathExists(sourcePath)) {
322
- await fs.copy(sourcePath, targetPath);
323
- }
324
- }
325
-
326
- // Create hook for me.md regeneration
327
- const hookContent = `#!/usr/bin/env node
328
-
329
- // ONE Integration Hook for Claude Code
330
- import { execSync } from 'child_process';
331
- import fs from 'fs-extra';
332
-
333
- // Regenerate on me.md changes
334
- if (process.argv.includes('me/me.md')) {
335
- console.log('🔄 me.md changed, regenerating AI universe...');
336
- try {
337
- execSync('me generate', { stdio: 'inherit' });
338
- console.log('✅ Regeneration complete!');
339
- } catch (error) {
340
- console.error('❌ Regeneration failed:', error.message);
341
- }
342
- }`;
343
-
344
- await fs.writeFile(path.join(claudeDir, 'one-hook.js'), hookContent);
345
- await fs.chmod(path.join(claudeDir, 'one-hook.js'), '755');
346
- }
347
-
348
- /**
349
- * Validate the installation
350
- */
351
- async function validateInstallation() {
352
- const checks = [
353
- { name: 'ONE directory', path: 'one', type: 'directory' },
354
- { name: 'System directory', path: '.one', type: 'directory' },
355
- { name: 'Me file', path: 'one/me/me.md', type: 'file' },
356
- { name: 'Command interface', path: '.one/one-command.js', type: 'file' }
357
- ];
358
-
359
- const results = [];
360
-
361
- for (const check of checks) {
362
- const fullPath = path.join(process.cwd(), check.path);
363
- const exists = await fs.pathExists(fullPath);
364
- const stat = exists ? await fs.stat(fullPath) : null;
365
-
366
- const isValid = exists && (
367
- (check.type === 'directory' && stat.isDirectory()) ||
368
- (check.type === 'file' && stat.isFile())
369
- );
370
-
371
- results.push({
372
- name: check.name,
373
- path: check.path,
374
- valid: isValid,
375
- exists
376
- });
377
- }
378
-
379
- return results;
380
- }
381
-
382
- /**
383
- * Show success message and next steps
384
- */
385
- async function showSuccessMessage(context, validation) {
386
- console.log(chalk.green('\n🎉 Installation Complete!'));
387
-
388
- // Show validation results
389
- console.log(chalk.cyan('\n📋 Installation Summary:'));
390
- for (const result of validation) {
391
- const icon = result.valid ? '✅' : '❌';
392
- console.log(` ${icon} ${result.name}`);
393
- }
394
-
395
- const failedChecks = validation.filter(r => !r.valid);
396
- if (failedChecks.length > 0) {
397
- console.log(chalk.yellow('\n⚠️ Some components may need attention:'));
398
- for (const failed of failedChecks) {
399
- console.log(` ${failed.name}: ${failed.path}`);
400
- }
401
- }
402
-
403
- // Next steps based on context
404
- console.log(chalk.magenta('\n🚀 Next Steps:'));
405
-
406
- if (context.type === 'student') {
407
- console.log(' 1. 📚 Start with: "Create study plan for [subject]"');
408
- console.log(' 2. 🤖 Your AI study buddy is ready in: one/agents/');
409
- console.log(' 3. ✅ Track progress with missions and tasks');
410
- } else if (context.type === 'professional') {
411
- console.log(' 1. 🎯 Edit your goals in: one/me/me.md');
412
- console.log(' 2. 🚀 Create your first mission');
413
- console.log(' 3. 🤖 Your AI team is ready to help');
414
- } else {
415
- console.log(' 1. ✏️ Customize your AI: one/me/me.md');
416
- console.log(' 2. 🎯 Create your first mission');
417
- console.log(' 3. 🤖 Start collaborating with AI agents');
418
- }
419
-
420
- console.log(chalk.cyan('\n💡 Key Files:'));
421
- console.log(` 📄 Your DNA: ${chalk.yellow('one/me/me.md')}`);
422
- console.log(` 🎯 Missions: ${chalk.yellow('one/missions/')}`);
423
- console.log(` 📖 Stories: ${chalk.yellow('one/stories/')}`);
424
- console.log(` 🤖 Agents: ${chalk.yellow('one/agents/')}`);
425
-
426
- console.log(chalk.green('\n✨ Your AI universe is ready!'));
427
- console.log(chalk.magenta('\n🎮 Ready to start? Try these commands:'));
428
- console.log(chalk.cyan(' me validate ') + chalk.gray('# Validate your me.md configuration'));
429
- console.log(chalk.cyan(' me generate ') + chalk.gray('# Generate your universe from me.md'));
430
- console.log(chalk.cyan(' node .one/one-command.js ') + chalk.gray('# Launch mission control dashboard'));
431
-
432
- console.log(chalk.yellow('\n💡 Pro tip: ') + 'Edit one/me/me.md to customize your AI universe, then run "me generate"');
433
- }
434
-
435
- /**
436
- * Show troubleshooting help
437
- */
438
- function showTroubleshootingHelp(error) {
439
- console.log(chalk.yellow('\n🔧 Troubleshooting:'));
440
- console.log(' • Ensure Node.js 18+ is installed');
441
- console.log(' • Check write permissions in current directory');
442
- console.log(' • Ensure sufficient disk space');
443
-
444
- if (error.code === 'EACCES') {
445
- console.log(' • Permission denied - try running as administrator');
446
- } else if (error.code === 'ENOSPC') {
447
- console.log(' • Insufficient disk space');
448
- } else if (error.code === 'ENOTDIR') {
449
- console.log(' • Invalid directory structure');
450
- }
451
-
452
- console.log('\n💬 Need help? Visit: https://one.ie/help');
453
- }
454
-
455
- // Utilities
456
- function sleep(ms) {
457
- return new Promise(resolve => setTimeout(resolve, ms));
458
- }
459
-
460
- function promisify(fn) {
461
- return (...args) => new Promise((resolve, reject) => {
462
- fn(...args, (err, result) => {
463
- if (err) reject(err);
464
- else resolve(result);
465
- });
466
- });
467
- }
468
-
469
- // Run installer
470
- main().catch(error => {
471
- console.error(chalk.red('\n💥 Fatal error:'), error);
472
- process.exit(1);
473
- });