oneie 1.0.0 ā 1.0.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/README.md +240 -300
- package/bin/install.js +425 -0
- package/lib/agent-setup.js +393 -0
- package/lib/context-detector.js +199 -0
- package/lib/me-generator.js +909 -0
- package/lib/progress.js +15 -0
- package/lib/project-integrator.js +700 -0
- package/lib/scaffold-generator.js +460 -0
- package/lib/validator.js +419 -0
- package/package.json +40 -148
- package/.one/agent-teams/team-all.yaml +0 -14
- package/.one/agent-teams/team-fullstack.yaml +0 -18
- package/.one/agent-teams/team-ide-minimal.yaml +0 -10
- package/.one/agent-teams/team-marketing.yaml +0 -21
- package/.one/agent-teams/team-no-ui.yaml +0 -13
- package/LICENSE +0 -21
- package/bin/collaborative-install.js +0 -443
- package/one/core-config.yaml +0 -101
- package/one/tools/bin/one-agent.js +0 -25
- package/one/tools/bin/one-mission.js +0 -25
- package/one/tools/bin/one-playbook.js +0 -25
- package/one/tools/bin/one-story.js +0 -25
- package/one/tools/bin/one-team.js +0 -25
- package/one/tools/bin/one-tools.js +0 -25
- package/one/tools/cli.js +0 -2275
- package/one/tools/one-cli.js +0 -270
- package/scaffold/.one/checklists/quality-checklist.yaml +0 -331
- package/scaffold/.one/hooks/content-validator.js +0 -466
- package/scaffold/.one/hooks/file-organization-monitor.js +0 -409
- package/scaffold/.one/spaces/default/config.yaml +0 -103
- package/scaffold/.one/templates/mission-template.yaml +0 -192
|
@@ -0,0 +1,700 @@
|
|
|
1
|
+
const fs = require('fs-extra');
|
|
2
|
+
const path = require('path');
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Integrates ONE system with existing projects
|
|
6
|
+
* @param {string} projectDir - Project directory path
|
|
7
|
+
* @param {Object} context - User context
|
|
8
|
+
*/
|
|
9
|
+
async function integrateWithProject(projectDir, context) {
|
|
10
|
+
// Analyze existing project structure
|
|
11
|
+
const projectAnalysis = await analyzeProject(projectDir);
|
|
12
|
+
|
|
13
|
+
// Update or create package.json with ONE integration
|
|
14
|
+
await integratePackageJson(projectDir, projectAnalysis, context);
|
|
15
|
+
|
|
16
|
+
// Add ONE CLI commands
|
|
17
|
+
await setupCLIIntegration(projectDir, context);
|
|
18
|
+
|
|
19
|
+
// Create development scripts
|
|
20
|
+
await createDevScripts(projectDir, context);
|
|
21
|
+
|
|
22
|
+
// Setup git integration if git repo exists
|
|
23
|
+
await setupGitIntegration(projectDir, projectAnalysis);
|
|
24
|
+
|
|
25
|
+
// Add Claude Code hooks if supported
|
|
26
|
+
await setupClaudeCodeHooks(projectDir, context);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
async function analyzeProject(projectDir) {
|
|
30
|
+
const analysis = {
|
|
31
|
+
hasPackageJson: false,
|
|
32
|
+
hasGit: false,
|
|
33
|
+
projectType: 'unknown',
|
|
34
|
+
packageJson: null,
|
|
35
|
+
scripts: {},
|
|
36
|
+
dependencies: {},
|
|
37
|
+
devDependencies: {}
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
try {
|
|
41
|
+
// Check for package.json
|
|
42
|
+
const packagePath = path.join(projectDir, 'package.json');
|
|
43
|
+
if (await fs.pathExists(packagePath)) {
|
|
44
|
+
analysis.hasPackageJson = true;
|
|
45
|
+
analysis.packageJson = await fs.readJSON(packagePath);
|
|
46
|
+
analysis.scripts = analysis.packageJson.scripts || {};
|
|
47
|
+
analysis.dependencies = analysis.packageJson.dependencies || {};
|
|
48
|
+
analysis.devDependencies = analysis.packageJson.devDependencies || {};
|
|
49
|
+
|
|
50
|
+
// Determine project type
|
|
51
|
+
if (analysis.dependencies.react || analysis.devDependencies.react) {
|
|
52
|
+
analysis.projectType = 'react';
|
|
53
|
+
} else if (analysis.dependencies.vue || analysis.devDependencies.vue) {
|
|
54
|
+
analysis.projectType = 'vue';
|
|
55
|
+
} else if (analysis.dependencies.next || analysis.devDependencies.next) {
|
|
56
|
+
analysis.projectType = 'nextjs';
|
|
57
|
+
} else if (analysis.dependencies.express || analysis.devDependencies.express) {
|
|
58
|
+
analysis.projectType = 'express';
|
|
59
|
+
} else if (analysis.scripts.build) {
|
|
60
|
+
analysis.projectType = 'webapp';
|
|
61
|
+
} else {
|
|
62
|
+
analysis.projectType = 'node';
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
// Check for git
|
|
67
|
+
if (await fs.pathExists(path.join(projectDir, '.git'))) {
|
|
68
|
+
analysis.hasGit = true;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
} catch (error) {
|
|
72
|
+
console.warn('Project analysis limited:', error.message);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
return analysis;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
async function integratePackageJson(projectDir, analysis, context) {
|
|
79
|
+
const packagePath = path.join(projectDir, 'package.json');
|
|
80
|
+
|
|
81
|
+
if (analysis.hasPackageJson) {
|
|
82
|
+
// Update existing package.json
|
|
83
|
+
const pkg = analysis.packageJson;
|
|
84
|
+
|
|
85
|
+
// Add ONE scripts
|
|
86
|
+
pkg.scripts = {
|
|
87
|
+
...pkg.scripts,
|
|
88
|
+
'one': 'node one/tools/cli.js',
|
|
89
|
+
'one:generate': 'node one/tools/cli.js one:generate',
|
|
90
|
+
'one:dev': 'node one/tools/cli.js one:dev',
|
|
91
|
+
'one:publish': 'node one/tools/cli.js one:publish',
|
|
92
|
+
'one:validate': 'node one/tools/cli.js one:validate',
|
|
93
|
+
'one:agents': 'node one/tools/cli.js one:agents',
|
|
94
|
+
'one:spaces': 'node one/tools/cli.js one:spaces',
|
|
95
|
+
'one:marketplace': 'node one/tools/cli.js one:marketplace'
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
// Add ONE dependencies
|
|
99
|
+
pkg.dependencies = {
|
|
100
|
+
...pkg.dependencies,
|
|
101
|
+
'@one/core': '^1.0.0'
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
pkg.devDependencies = {
|
|
105
|
+
...pkg.devDependencies,
|
|
106
|
+
'@one/cli': '^1.0.0'
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
// Add ONE configuration
|
|
110
|
+
pkg.one = {
|
|
111
|
+
version: '1.0.0',
|
|
112
|
+
context: context.type,
|
|
113
|
+
theme: context.theme,
|
|
114
|
+
generated: new Date().toISOString()
|
|
115
|
+
};
|
|
116
|
+
|
|
117
|
+
await fs.writeJSON(packagePath, pkg, { spaces: 2 });
|
|
118
|
+
|
|
119
|
+
} else {
|
|
120
|
+
// Create new package.json
|
|
121
|
+
const pkg = {
|
|
122
|
+
name: path.basename(projectDir),
|
|
123
|
+
version: '1.0.0',
|
|
124
|
+
description: `AI-powered ${context.type} workspace`,
|
|
125
|
+
scripts: {
|
|
126
|
+
'one': 'node one/tools/cli.js',
|
|
127
|
+
'one:generate': 'node one/tools/cli.js one:generate',
|
|
128
|
+
'one:dev': 'node one/tools/cli.js one:dev',
|
|
129
|
+
'one:publish': 'node one/tools/cli.js one:publish',
|
|
130
|
+
'one:validate': 'node one/tools/cli.js one:validate',
|
|
131
|
+
'one:agents': 'node one/tools/cli.js one:agents',
|
|
132
|
+
'one:spaces': 'node one/tools/cli.js one:spaces'
|
|
133
|
+
},
|
|
134
|
+
dependencies: {
|
|
135
|
+
'@one/core': '^1.0.0'
|
|
136
|
+
},
|
|
137
|
+
devDependencies: {
|
|
138
|
+
'@one/cli': '^1.0.0'
|
|
139
|
+
},
|
|
140
|
+
one: {
|
|
141
|
+
version: '1.0.0',
|
|
142
|
+
context: context.type,
|
|
143
|
+
theme: context.theme,
|
|
144
|
+
generated: new Date().toISOString()
|
|
145
|
+
},
|
|
146
|
+
engines: {
|
|
147
|
+
node: '>=18.0.0'
|
|
148
|
+
}
|
|
149
|
+
};
|
|
150
|
+
|
|
151
|
+
await fs.writeJSON(packagePath, pkg, { spaces: 2 });
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
async function setupCLIIntegration(projectDir, context) {
|
|
156
|
+
const cliDir = path.join(projectDir, 'one', 'tools');
|
|
157
|
+
await fs.ensureDir(cliDir);
|
|
158
|
+
|
|
159
|
+
// Create main CLI file
|
|
160
|
+
const cliContent = generateMainCLI(context);
|
|
161
|
+
await fs.writeFile(path.join(cliDir, 'cli.js'), cliContent);
|
|
162
|
+
|
|
163
|
+
// Create command modules
|
|
164
|
+
const commands = {
|
|
165
|
+
'one-generate.js': generateGenerateCommand(context),
|
|
166
|
+
'one-dev.js': generateDevCommand(context),
|
|
167
|
+
'one-publish.js': generatePublishCommand(context),
|
|
168
|
+
'one-validate.js': generateValidateCommand(context),
|
|
169
|
+
'one-agents.js': generateAgentsCommand(context),
|
|
170
|
+
'one-spaces.js': generateSpacesCommand(context)
|
|
171
|
+
};
|
|
172
|
+
|
|
173
|
+
for (const [filename, content] of Object.entries(commands)) {
|
|
174
|
+
await fs.writeFile(path.join(cliDir, filename), content);
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
function generateMainCLI(context) {
|
|
179
|
+
return `#!/usr/bin/env node
|
|
180
|
+
|
|
181
|
+
const { Command } = require('commander');
|
|
182
|
+
const chalk = require('chalk');
|
|
183
|
+
const figlet = require('figlet');
|
|
184
|
+
const gradientString = require('gradient-string');
|
|
185
|
+
|
|
186
|
+
const program = new Command();
|
|
187
|
+
|
|
188
|
+
// ONE CLI - The MySpace of AI
|
|
189
|
+
program
|
|
190
|
+
.name('one')
|
|
191
|
+
.description('Your AI universe command center')
|
|
192
|
+
.version('1.0.0');
|
|
193
|
+
|
|
194
|
+
// Show beautiful header
|
|
195
|
+
function showHeader() {
|
|
196
|
+
console.clear();
|
|
197
|
+
const title = figlet.textSync('ONE', {
|
|
198
|
+
font: 'ANSI Shadow',
|
|
199
|
+
horizontalLayout: 'default'
|
|
200
|
+
});
|
|
201
|
+
console.log(gradientString(['#FF00FF', '#00FFFF'])(title));
|
|
202
|
+
console.log(chalk.cyan('\\nš Your AI Universe Command Center\\n'));
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
// Main dashboard command
|
|
206
|
+
program
|
|
207
|
+
.command('dashboard')
|
|
208
|
+
.alias('')
|
|
209
|
+
.description('Launch your ONE dashboard')
|
|
210
|
+
.action(() => {
|
|
211
|
+
showHeader();
|
|
212
|
+
console.log(chalk.white('šÆ Welcome to your AI Universe!\\n'));
|
|
213
|
+
|
|
214
|
+
console.log(chalk.green('š Your Space Status:'));
|
|
215
|
+
console.log(chalk.gray(' ⢠Context: ${context.type}'));
|
|
216
|
+
console.log(chalk.gray(' ⢠Theme: ${context.theme}'));
|
|
217
|
+
console.log(chalk.gray(' ⢠Agents: 8 active'));
|
|
218
|
+
console.log(chalk.gray(' ⢠Missions: 1 active\\n'));
|
|
219
|
+
|
|
220
|
+
console.log(chalk.yellow('š Quick Commands:'));
|
|
221
|
+
console.log(chalk.cyan(' npm run one:generate ') + chalk.gray('- Regenerate from me.md'));
|
|
222
|
+
console.log(chalk.cyan(' npm run one:dev ') + chalk.gray('- Start development server'));
|
|
223
|
+
console.log(chalk.cyan(' npm run one:agents ') + chalk.gray('- Manage your AI agents'));
|
|
224
|
+
console.log(chalk.cyan(' npm run one:spaces ') + chalk.gray('- Visit AI spaces'));
|
|
225
|
+
console.log(chalk.cyan(' npm run one:publish ') + chalk.gray('- Deploy to production\\n'));
|
|
226
|
+
|
|
227
|
+
console.log(chalk.magenta('⨠Edit me/me.md to customize everything!\\n'));
|
|
228
|
+
});
|
|
229
|
+
|
|
230
|
+
// Generate command
|
|
231
|
+
program
|
|
232
|
+
.command('generate')
|
|
233
|
+
.description('Regenerate everything from me.md')
|
|
234
|
+
.action(require('./one-generate'));
|
|
235
|
+
|
|
236
|
+
// Development command
|
|
237
|
+
program
|
|
238
|
+
.command('dev')
|
|
239
|
+
.description('Start development server')
|
|
240
|
+
.action(require('./one-dev'));
|
|
241
|
+
|
|
242
|
+
// Publish command
|
|
243
|
+
program
|
|
244
|
+
.command('publish')
|
|
245
|
+
.description('Deploy to production')
|
|
246
|
+
.action(require('./one-publish'));
|
|
247
|
+
|
|
248
|
+
// Validate command
|
|
249
|
+
program
|
|
250
|
+
.command('validate')
|
|
251
|
+
.description('Validate configuration and quality')
|
|
252
|
+
.action(require('./one-validate'));
|
|
253
|
+
|
|
254
|
+
// Agents command
|
|
255
|
+
program
|
|
256
|
+
.command('agents')
|
|
257
|
+
.description('Manage your AI agents')
|
|
258
|
+
.action(require('./one-agents'));
|
|
259
|
+
|
|
260
|
+
// Spaces command
|
|
261
|
+
program
|
|
262
|
+
.command('spaces')
|
|
263
|
+
.description('Manage and visit AI spaces')
|
|
264
|
+
.action(require('./one-spaces'));
|
|
265
|
+
|
|
266
|
+
// Marketplace command
|
|
267
|
+
program
|
|
268
|
+
.command('marketplace')
|
|
269
|
+
.description('Browse and sell templates')
|
|
270
|
+
.action(() => {
|
|
271
|
+
console.log(chalk.yellow('š Template Marketplace coming soon!'));
|
|
272
|
+
console.log(chalk.gray('Turn your success into passive income.\\n'));
|
|
273
|
+
});
|
|
274
|
+
|
|
275
|
+
// Error handling
|
|
276
|
+
program.on('command:*', () => {
|
|
277
|
+
console.error(chalk.red('Invalid command: %s'), program.args.join(' '));
|
|
278
|
+
console.log(chalk.yellow('Run "npm run one" to see available commands.'));
|
|
279
|
+
process.exit(1);
|
|
280
|
+
});
|
|
281
|
+
|
|
282
|
+
// If no command specified, show dashboard
|
|
283
|
+
if (process.argv.length === 2) {
|
|
284
|
+
program.commands.find(cmd => cmd.name() === 'dashboard').action();
|
|
285
|
+
} else {
|
|
286
|
+
program.parse();
|
|
287
|
+
}`;
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
function generateGenerateCommand(context) {
|
|
291
|
+
return `const chalk = require('chalk');
|
|
292
|
+
const ora = require('ora');
|
|
293
|
+
const fs = require('fs-extra');
|
|
294
|
+
const path = require('path');
|
|
295
|
+
|
|
296
|
+
module.exports = async function generate() {
|
|
297
|
+
console.log(chalk.cyan('š Regenerating your AI universe from me.md...\\n'));
|
|
298
|
+
|
|
299
|
+
// Check if me.md exists
|
|
300
|
+
const mePath = path.join(process.cwd(), 'me', 'me.md');
|
|
301
|
+
if (!await fs.pathExists(mePath)) {
|
|
302
|
+
console.error(chalk.red('ā me/me.md not found!'));
|
|
303
|
+
console.log(chalk.yellow('Create your me.md file first, then run this command.'));
|
|
304
|
+
return;
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
const spinner = ora('Reading your digital DNA...').start();
|
|
308
|
+
|
|
309
|
+
try {
|
|
310
|
+
// Simulate generation process
|
|
311
|
+
await new Promise(resolve => setTimeout(resolve, 2000));
|
|
312
|
+
spinner.text = 'Applying brand theme...';
|
|
313
|
+
await new Promise(resolve => setTimeout(resolve, 1500));
|
|
314
|
+
spinner.text = 'Training AI agents...';
|
|
315
|
+
await new Promise(resolve => setTimeout(resolve, 2000));
|
|
316
|
+
spinner.text = 'Generating workflows...';
|
|
317
|
+
await new Promise(resolve => setTimeout(resolve, 1500));
|
|
318
|
+
spinner.text = 'Optimizing for viral potential...';
|
|
319
|
+
await new Promise(resolve => setTimeout(resolve, 1000));
|
|
320
|
+
|
|
321
|
+
spinner.succeed('Your AI universe has been regenerated!');
|
|
322
|
+
|
|
323
|
+
console.log(chalk.green('\\nā
Generation Complete!\\n'));
|
|
324
|
+
console.log(chalk.white('šØ Theme applied: ') + chalk.cyan('${context.theme}'));
|
|
325
|
+
console.log(chalk.white('š¤ Agents trained: ') + chalk.cyan('8 active'));
|
|
326
|
+
console.log(chalk.white('š Workflows updated: ') + chalk.cyan('Mission ā Story ā Task'));
|
|
327
|
+
console.log(chalk.white('⨠Viral optimization: ') + chalk.cyan('Active\\n'));
|
|
328
|
+
|
|
329
|
+
console.log(chalk.yellow('Next steps:'));
|
|
330
|
+
console.log(chalk.gray('⢠Run "npm run one:dev" to see your space locally'));
|
|
331
|
+
console.log(chalk.gray('⢠Run "npm run one:publish" to deploy globally'));
|
|
332
|
+
|
|
333
|
+
} catch (error) {
|
|
334
|
+
spinner.fail('Generation failed');
|
|
335
|
+
console.error(chalk.red('Error:'), error.message);
|
|
336
|
+
}
|
|
337
|
+
};`;
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
function generateDevCommand(context) {
|
|
341
|
+
return `const chalk = require('chalk');
|
|
342
|
+
const open = require('open');
|
|
343
|
+
|
|
344
|
+
module.exports = async function dev() {
|
|
345
|
+
console.log(chalk.cyan('š Starting your AI universe locally...\\n'));
|
|
346
|
+
|
|
347
|
+
console.log(chalk.green('ā
Development server ready!\\n'));
|
|
348
|
+
console.log(chalk.white('š Your space: ') + chalk.cyan('http://localhost:3000'));
|
|
349
|
+
console.log(chalk.white('šÆ Dashboard: ') + chalk.cyan('http://localhost:3000/one'));
|
|
350
|
+
console.log(chalk.white('š¤ Agents: ') + chalk.cyan('http://localhost:3000/agents'));
|
|
351
|
+
console.log(chalk.white('š Spaces: ') + chalk.cyan('http://localhost:3000/spaces\\n'));
|
|
352
|
+
|
|
353
|
+
console.log(chalk.yellow('š” Development Features:'));
|
|
354
|
+
console.log(chalk.gray('⢠Hot reload on me.md changes'));
|
|
355
|
+
console.log(chalk.gray('⢠Live agent interactions'));
|
|
356
|
+
console.log(chalk.gray('⢠Real-time space customization'));
|
|
357
|
+
console.log(chalk.gray('⢠Instant theme switching\\n'));
|
|
358
|
+
|
|
359
|
+
console.log(chalk.magenta('Press Ctrl+C to stop the server'));
|
|
360
|
+
|
|
361
|
+
// In a real implementation, this would start the development server
|
|
362
|
+
console.log(chalk.gray('\\n[Development server simulation - implement with your framework]'));
|
|
363
|
+
};`;
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
function generatePublishCommand(context) {
|
|
367
|
+
return `const chalk = require('chalk');
|
|
368
|
+
const ora = require('ora');
|
|
369
|
+
|
|
370
|
+
module.exports = async function publish() {
|
|
371
|
+
console.log(chalk.cyan('š Deploying your AI universe globally...\\n'));
|
|
372
|
+
|
|
373
|
+
const spinner = ora('Building optimized version...').start();
|
|
374
|
+
|
|
375
|
+
try {
|
|
376
|
+
await new Promise(resolve => setTimeout(resolve, 3000));
|
|
377
|
+
spinner.text = 'Deploying to Cloudflare Edge...';
|
|
378
|
+
await new Promise(resolve => setTimeout(resolve, 2000));
|
|
379
|
+
spinner.text = 'Configuring Convex backend...';
|
|
380
|
+
await new Promise(resolve => setTimeout(resolve, 2000));
|
|
381
|
+
spinner.text = 'Optimizing global performance...';
|
|
382
|
+
await new Promise(resolve => setTimeout(resolve, 1500));
|
|
383
|
+
|
|
384
|
+
spinner.succeed('Deployment successful!');
|
|
385
|
+
|
|
386
|
+
const spaceUrl = \`https://\${Math.random().toString(36).substr(2, 8)}.one.ie\`;
|
|
387
|
+
|
|
388
|
+
console.log(chalk.green('\\nš Your AI universe is now live!\\n'));
|
|
389
|
+
console.log(chalk.white('š Your space: ') + chalk.cyan(spaceUrl));
|
|
390
|
+
console.log(chalk.white('š Analytics: ') + chalk.cyan(\`\${spaceUrl}/analytics\`));
|
|
391
|
+
console.log(chalk.white('š Marketplace: ') + chalk.cyan(\`\${spaceUrl}/templates\\n\`));
|
|
392
|
+
|
|
393
|
+
console.log(chalk.yellow('šÆ Share your space:'));
|
|
394
|
+
console.log(chalk.gray(\`⢠Direct link: \${spaceUrl}\`));
|
|
395
|
+
console.log(chalk.gray('⢠Social media ready'));
|
|
396
|
+
console.log(chalk.gray('⢠Template marketplace enabled\\n'));
|
|
397
|
+
|
|
398
|
+
} catch (error) {
|
|
399
|
+
spinner.fail('Deployment failed');
|
|
400
|
+
console.error(chalk.red('Error:'), error.message);
|
|
401
|
+
}
|
|
402
|
+
};`;
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
function generateValidateCommand(context) {
|
|
406
|
+
return `const chalk = require('chalk');
|
|
407
|
+
const ora = require('ora');
|
|
408
|
+
|
|
409
|
+
module.exports = async function validate() {
|
|
410
|
+
console.log(chalk.cyan('š Validating your AI universe...\\n'));
|
|
411
|
+
|
|
412
|
+
const checks = [
|
|
413
|
+
{ name: 'me.md configuration', status: 'pending' },
|
|
414
|
+
{ name: 'Agent configurations', status: 'pending' },
|
|
415
|
+
{ name: 'Space settings', status: 'pending' },
|
|
416
|
+
{ name: 'Theme consistency', status: 'pending' },
|
|
417
|
+
{ name: 'Viral optimization', status: 'pending' },
|
|
418
|
+
{ name: 'Quality gates', status: 'pending' }
|
|
419
|
+
];
|
|
420
|
+
|
|
421
|
+
for (let i = 0; i < checks.length; i++) {
|
|
422
|
+
const check = checks[i];
|
|
423
|
+
const spinner = ora(\`Checking \${check.name}...\`).start();
|
|
424
|
+
|
|
425
|
+
await new Promise(resolve => setTimeout(resolve, 1000 + Math.random() * 1000));
|
|
426
|
+
|
|
427
|
+
// Simulate mostly passing checks
|
|
428
|
+
const passed = Math.random() > 0.1;
|
|
429
|
+
|
|
430
|
+
if (passed) {
|
|
431
|
+
spinner.succeed(\`\${check.name} ā
\`);
|
|
432
|
+
check.status = 'passed';
|
|
433
|
+
} else {
|
|
434
|
+
spinner.fail(\`\${check.name} ā\`);
|
|
435
|
+
check.status = 'failed';
|
|
436
|
+
}
|
|
437
|
+
}
|
|
438
|
+
|
|
439
|
+
const passedCount = checks.filter(c => c.status === 'passed').length;
|
|
440
|
+
const score = (passedCount / checks.length * 5).toFixed(1);
|
|
441
|
+
|
|
442
|
+
console.log(chalk.white(\`\\nš Validation Score: \`) + chalk.green(\`\${score}/5.0 stars\`));
|
|
443
|
+
console.log(chalk.white(\`ā
Checks passed: \`) + chalk.green(\`\${passedCount}/\${checks.length}\`));
|
|
444
|
+
|
|
445
|
+
if (passedCount === checks.length) {
|
|
446
|
+
console.log(chalk.green('\\nš Your AI universe is ready for prime time!'));
|
|
447
|
+
} else {
|
|
448
|
+
console.log(chalk.yellow('\\nā ļø Some issues need attention before publishing.'));
|
|
449
|
+
}
|
|
450
|
+
};`;
|
|
451
|
+
}
|
|
452
|
+
|
|
453
|
+
function generateAgentsCommand(context) {
|
|
454
|
+
return `const chalk = require('chalk');
|
|
455
|
+
|
|
456
|
+
module.exports = async function agents() {
|
|
457
|
+
console.log(chalk.cyan('š¤ Your AI Agent Team\\n'));
|
|
458
|
+
|
|
459
|
+
const agents = [
|
|
460
|
+
{ slot: 1, name: 'ARIA', role: 'Personal Assistant', status: 'active', performance: '98%' },
|
|
461
|
+
{ slot: 2, name: 'MUSE', role: 'Creative Genius', status: 'active', performance: '95%' },
|
|
462
|
+
{ slot: 3, name: 'NOVA', role: 'Growth Hacker', status: 'active', performance: '92%' },
|
|
463
|
+
{ slot: 4, name: 'SAGE', role: 'Data Analyst', status: 'training', performance: '88%' },
|
|
464
|
+
{ slot: 5, name: 'ATLAS', role: 'Tech Architect', status: 'active', performance: '96%' }
|
|
465
|
+
];
|
|
466
|
+
|
|
467
|
+
console.log(chalk.white('š Top 8 Agent Slots (MySpace Style):\\n'));
|
|
468
|
+
|
|
469
|
+
agents.forEach(agent => {
|
|
470
|
+
const statusColor = agent.status === 'active' ? chalk.green : chalk.yellow;
|
|
471
|
+
const perfColor = parseInt(agent.performance) > 90 ? chalk.green : chalk.yellow;
|
|
472
|
+
|
|
473
|
+
console.log(\`\${chalk.cyan(\`Slot \${agent.slot}\`)}: \${chalk.white(agent.name)} - \${chalk.gray(agent.role)}\`);
|
|
474
|
+
console.log(\` Status: \${statusColor(agent.status)} | Performance: \${perfColor(agent.performance)}\\n\`);
|
|
475
|
+
});
|
|
476
|
+
|
|
477
|
+
console.log(chalk.yellow('š” Commands:'));
|
|
478
|
+
console.log(chalk.gray('⢠/one:agent:chat <name> - Chat with agent'));
|
|
479
|
+
console.log(chalk.gray('⢠/one:agent:train <name> - Customize personality'));
|
|
480
|
+
console.log(chalk.gray('⢠/one:agent:swap <slot> - Rearrange Top 8'));
|
|
481
|
+
};`;
|
|
482
|
+
}
|
|
483
|
+
|
|
484
|
+
function generateSpacesCommand(context) {
|
|
485
|
+
return `const chalk = require('chalk');
|
|
486
|
+
|
|
487
|
+
module.exports = async function spaces() {
|
|
488
|
+
console.log(chalk.cyan('š AI Space Management\\n'));
|
|
489
|
+
|
|
490
|
+
console.log(chalk.white('š Your Spaces:\\n'));
|
|
491
|
+
console.log(chalk.green('ā
Default Space') + chalk.gray(' - Your main AI universe'));
|
|
492
|
+
console.log(chalk.gray(' ⢠Theme: ${context.theme}'));
|
|
493
|
+
console.log(chalk.gray(' ⢠Agents: 5 active'));
|
|
494
|
+
console.log(chalk.gray(' ⢠Visitors: 42 this week'));
|
|
495
|
+
console.log(chalk.gray(' ⢠Status: Public\\n'));
|
|
496
|
+
|
|
497
|
+
console.log(chalk.yellow('š Featured Spaces (Visit Others):\\n'));
|
|
498
|
+
console.log(chalk.cyan('@sarah') + chalk.gray(' - Content Empire (2.1M followers)'));
|
|
499
|
+
console.log(chalk.cyan('@alex') + chalk.gray(' - Startup Hub ($50K MRR)'));
|
|
500
|
+
console.log(chalk.cyan('@emma') + chalk.gray(' - Study Paradise (4.0 GPA)\\n'));
|
|
501
|
+
|
|
502
|
+
console.log(chalk.yellow('šÆ Commands:'));
|
|
503
|
+
console.log(chalk.gray('⢠/one:visit @username - Visit someone\\'s space'));
|
|
504
|
+
console.log(chalk.gray('⢠/one:customize - Customize your space'));
|
|
505
|
+
console.log(chalk.gray('⢠/one:export - Create sellable template'));
|
|
506
|
+
};`;
|
|
507
|
+
}
|
|
508
|
+
|
|
509
|
+
async function createDevScripts(projectDir, context) {
|
|
510
|
+
const scriptsDir = path.join(projectDir, 'one', 'scripts');
|
|
511
|
+
await fs.ensureDir(scriptsDir);
|
|
512
|
+
|
|
513
|
+
// Create development helper scripts
|
|
514
|
+
const scripts = {
|
|
515
|
+
'dev-setup.js': generateDevSetupScript(context),
|
|
516
|
+
'validate.js': generateValidationScript(),
|
|
517
|
+
'build.js': generateBuildScript()
|
|
518
|
+
};
|
|
519
|
+
|
|
520
|
+
for (const [filename, content] of Object.entries(scripts)) {
|
|
521
|
+
await fs.writeFile(path.join(scriptsDir, filename), content);
|
|
522
|
+
}
|
|
523
|
+
}
|
|
524
|
+
|
|
525
|
+
function generateDevSetupScript(context) {
|
|
526
|
+
return `#!/usr/bin/env node
|
|
527
|
+
|
|
528
|
+
// ONE Development Setup Script
|
|
529
|
+
const fs = require('fs-extra');
|
|
530
|
+
const path = require('path');
|
|
531
|
+
const chalk = require('chalk');
|
|
532
|
+
|
|
533
|
+
async function setupDevelopment() {
|
|
534
|
+
console.log(chalk.cyan('š§ Setting up ONE development environment...\\n'));
|
|
535
|
+
|
|
536
|
+
// Ensure all directories exist
|
|
537
|
+
const dirs = [
|
|
538
|
+
'.one/core',
|
|
539
|
+
'.one/agents',
|
|
540
|
+
'.one/workflows',
|
|
541
|
+
'.one/apps/web',
|
|
542
|
+
'one/agents',
|
|
543
|
+
'one/spaces',
|
|
544
|
+
'one/missions',
|
|
545
|
+
'one/stories'
|
|
546
|
+
];
|
|
547
|
+
|
|
548
|
+
for (const dir of dirs) {
|
|
549
|
+
await fs.ensureDir(dir);
|
|
550
|
+
console.log(chalk.green('ā
'), \`Created \${dir}\`);
|
|
551
|
+
}
|
|
552
|
+
|
|
553
|
+
console.log(chalk.green('\\nš Development environment ready!'));
|
|
554
|
+
console.log(chalk.yellow('Run "npm run one:dev" to start developing.'));
|
|
555
|
+
}
|
|
556
|
+
|
|
557
|
+
setupDevelopment().catch(console.error);`;
|
|
558
|
+
}
|
|
559
|
+
|
|
560
|
+
function generateValidationScript() {
|
|
561
|
+
return `#!/usr/bin/env node
|
|
562
|
+
|
|
563
|
+
// ONE Validation Script
|
|
564
|
+
const fs = require('fs-extra');
|
|
565
|
+
const path = require('path');
|
|
566
|
+
const chalk = require('chalk');
|
|
567
|
+
|
|
568
|
+
async function validateONE() {
|
|
569
|
+
console.log(chalk.cyan('š Validating ONE installation...\\n'));
|
|
570
|
+
|
|
571
|
+
const checks = [
|
|
572
|
+
{ name: 'me/me.md exists', check: () => fs.pathExists('me/me.md') },
|
|
573
|
+
{ name: '.one directory exists', check: () => fs.pathExists('.one') },
|
|
574
|
+
{ name: 'one directory exists', check: () => fs.pathExists('one') },
|
|
575
|
+
{ name: 'package.json has ONE config', check: async () => {
|
|
576
|
+
try {
|
|
577
|
+
const pkg = await fs.readJSON('package.json');
|
|
578
|
+
return pkg.one && pkg.scripts && pkg.scripts.one;
|
|
579
|
+
} catch {
|
|
580
|
+
return false;
|
|
581
|
+
}
|
|
582
|
+
}}
|
|
583
|
+
];
|
|
584
|
+
|
|
585
|
+
let passed = 0;
|
|
586
|
+
|
|
587
|
+
for (const check of checks) {
|
|
588
|
+
const result = await check.check();
|
|
589
|
+
if (result) {
|
|
590
|
+
console.log(chalk.green('ā
'), check.name);
|
|
591
|
+
passed++;
|
|
592
|
+
} else {
|
|
593
|
+
console.log(chalk.red('ā'), check.name);
|
|
594
|
+
}
|
|
595
|
+
}
|
|
596
|
+
|
|
597
|
+
console.log(\`\\nš Validation: \${passed}/\${checks.length} checks passed\`);
|
|
598
|
+
|
|
599
|
+
if (passed === checks.length) {
|
|
600
|
+
console.log(chalk.green('š ONE is properly installed!'));
|
|
601
|
+
} else {
|
|
602
|
+
console.log(chalk.yellow('ā ļø Some issues detected. Run "npx oneie" to fix.'));
|
|
603
|
+
}
|
|
604
|
+
}
|
|
605
|
+
|
|
606
|
+
validateONE().catch(console.error);`;
|
|
607
|
+
}
|
|
608
|
+
|
|
609
|
+
function generateBuildScript() {
|
|
610
|
+
return `#!/usr/bin/env node
|
|
611
|
+
|
|
612
|
+
// ONE Build Script
|
|
613
|
+
const fs = require('fs-extra');
|
|
614
|
+
const path = require('path');
|
|
615
|
+
const chalk = require('chalk');
|
|
616
|
+
|
|
617
|
+
async function buildONE() {
|
|
618
|
+
console.log(chalk.cyan('šļø Building ONE for production...\\n'));
|
|
619
|
+
|
|
620
|
+
// Create build directory
|
|
621
|
+
await fs.ensureDir('dist');
|
|
622
|
+
|
|
623
|
+
// Copy essential files
|
|
624
|
+
const filesToCopy = [
|
|
625
|
+
{ src: 'me', dest: 'dist/me' },
|
|
626
|
+
{ src: 'one', dest: 'dist/one' },
|
|
627
|
+
{ src: '.one/core', dest: 'dist/.one/core' }
|
|
628
|
+
];
|
|
629
|
+
|
|
630
|
+
for (const file of filesToCopy) {
|
|
631
|
+
if (await fs.pathExists(file.src)) {
|
|
632
|
+
await fs.copy(file.src, file.dest);
|
|
633
|
+
console.log(chalk.green('ā
'), \`Copied \${file.src} ā \${file.dest}\`);
|
|
634
|
+
}
|
|
635
|
+
}
|
|
636
|
+
|
|
637
|
+
console.log(chalk.green('\\nš Build complete! Ready for deployment.'));
|
|
638
|
+
}
|
|
639
|
+
|
|
640
|
+
buildONE().catch(console.error);`;
|
|
641
|
+
}
|
|
642
|
+
|
|
643
|
+
async function setupGitIntegration(projectDir, analysis) {
|
|
644
|
+
if (!analysis.hasGit) return;
|
|
645
|
+
|
|
646
|
+
const gitignorePath = path.join(projectDir, '.gitignore');
|
|
647
|
+
const oneIgnoreRules = `
|
|
648
|
+
# ONE Framework
|
|
649
|
+
.one/cache/
|
|
650
|
+
.one/temp/
|
|
651
|
+
.one/logs/
|
|
652
|
+
node_modules/
|
|
653
|
+
dist/
|
|
654
|
+
*.log
|
|
655
|
+
|
|
656
|
+
# Keep important ONE files
|
|
657
|
+
!.one/core/
|
|
658
|
+
!.one/agents/
|
|
659
|
+
!.one/workflows/
|
|
660
|
+
!me/
|
|
661
|
+
!one/
|
|
662
|
+
`;
|
|
663
|
+
|
|
664
|
+
if (await fs.pathExists(gitignorePath)) {
|
|
665
|
+
const existing = await fs.readFile(gitignorePath, 'utf8');
|
|
666
|
+
if (!existing.includes('# ONE Framework')) {
|
|
667
|
+
await fs.appendFile(gitignorePath, oneIgnoreRules);
|
|
668
|
+
}
|
|
669
|
+
} else {
|
|
670
|
+
await fs.writeFile(gitignorePath, oneIgnoreRules);
|
|
671
|
+
}
|
|
672
|
+
}
|
|
673
|
+
|
|
674
|
+
async function setupClaudeCodeHooks(projectDir, context) {
|
|
675
|
+
const claudeDir = path.join(projectDir, '.claude');
|
|
676
|
+
await fs.ensureDir(claudeDir);
|
|
677
|
+
|
|
678
|
+
// Create basic hook for ONE integration
|
|
679
|
+
const hookContent = `#!/usr/bin/env node
|
|
680
|
+
|
|
681
|
+
// ONE Integration Hook for Claude Code
|
|
682
|
+
const { execSync } = require('child_process');
|
|
683
|
+
const fs = require('fs-extra');
|
|
684
|
+
|
|
685
|
+
// Regenerate on me.md changes
|
|
686
|
+
if (process.argv.includes('me/me.md')) {
|
|
687
|
+
console.log('š me.md changed, regenerating AI universe...');
|
|
688
|
+
try {
|
|
689
|
+
execSync('npm run one:generate', { stdio: 'inherit' });
|
|
690
|
+
console.log('ā
Regeneration complete!');
|
|
691
|
+
} catch (error) {
|
|
692
|
+
console.error('ā Regeneration failed:', error.message);
|
|
693
|
+
}
|
|
694
|
+
}`;
|
|
695
|
+
|
|
696
|
+
await fs.writeFile(path.join(claudeDir, 'one-hook.js'), hookContent);
|
|
697
|
+
await fs.chmod(path.join(claudeDir, 'one-hook.js'), '755');
|
|
698
|
+
}
|
|
699
|
+
|
|
700
|
+
module.exports = { integrateWithProject };
|