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.
@@ -0,0 +1,460 @@
1
+ const fs = require('fs-extra');
2
+ const path = require('path');
3
+
4
+ /**
5
+ * Generates the complete ONE scaffold structure
6
+ * @param {string} targetDir - Target directory (.one or one)
7
+ * @param {Object} context - User context for customization
8
+ */
9
+ async function generateScaffold(targetDir, context) {
10
+ const isHidden = targetDir === '.one';
11
+
12
+ if (isHidden) {
13
+ await generateHiddenStructure(targetDir, context);
14
+ } else {
15
+ await generateUserStructure(targetDir, context);
16
+ }
17
+ }
18
+
19
+ async function generateHiddenStructure(targetDir, context) {
20
+ const structure = {
21
+ // Core system directories
22
+ 'core': {
23
+ 'cascade-engine.js': generateCascadeEngine(),
24
+ 'quality-gates.js': generateQualityGates(),
25
+ 'viral-optimizer.js': generateViralOptimizer()
26
+ },
27
+
28
+ // Agent library (43+ agents)
29
+ 'agents': await generateAgentLibrary(context),
30
+
31
+ // System workflows
32
+ 'workflows': {
33
+ 'mission-to-story.yaml': generateMissionWorkflow(),
34
+ 'story-to-task.yaml': generateStoryWorkflow(),
35
+ 'task-to-agent.yaml': generateTaskWorkflow()
36
+ },
37
+
38
+ // Quality validation
39
+ 'checklists': {
40
+ 'mission-quality.md': generateMissionChecklist(),
41
+ 'story-quality.md': generateStoryChecklist(),
42
+ 'task-quality.md': generateTaskChecklist(),
43
+ 'agent-quality.md': generateAgentChecklist()
44
+ },
45
+
46
+ // Automation hooks
47
+ 'hooks': {
48
+ 'file-organization-monitor.js': generateFileOrganizer(),
49
+ 'naming-convention-enforcer.js': generateNamingEnforcer(),
50
+ 'content-validator.js': generateContentValidator(),
51
+ 'viral-optimization.js': generateViralHooks(),
52
+ 'auto-organizer.js': generateAutoOrganizer()
53
+ },
54
+
55
+ // Multi-platform apps
56
+ 'apps': {
57
+ 'web': await generateWebApp(context),
58
+ 'mobile': generateMobileStub(),
59
+ 'desktop': generateDesktopStub(),
60
+ 'cli': generateCLIApp()
61
+ },
62
+
63
+ // Shared packages
64
+ 'packages': {
65
+ 'one': generateCorePackage(),
66
+ 'ui': generateUIPackage(context),
67
+ 'agents': generateAgentPackage(),
68
+ 'viral': generateViralPackage(),
69
+ 'social': generateSocialPackage()
70
+ }
71
+ };
72
+
73
+ await createDirectoryStructure(targetDir, structure);
74
+ }
75
+
76
+ async function generateUserStructure(targetDir, context) {
77
+ const structure = {
78
+ // User's digital identity (customizable)
79
+ 'me': {
80
+ 'me.md': generateMeFile(context),
81
+ 'assets': {
82
+ 'avatar.png': 'placeholder',
83
+ 'background.gif': 'placeholder',
84
+ 'logo.svg': 'placeholder',
85
+ 'theme-song.mp3': 'placeholder'
86
+ },
87
+ 'themes': {
88
+ 'professional.css': generateProfessionalTheme(),
89
+ 'cyberpunk.css': generateCyberpunkTheme(),
90
+ 'classic-myspace.css': generateMySpaceTheme(),
91
+ 'student.css': generateStudentTheme()
92
+ }
93
+ },
94
+
95
+ // User's spaces (like MySpace profiles)
96
+ 'spaces': {
97
+ 'default': {
98
+ 'config.yaml': generateSpaceConfig(context),
99
+ 'agents': generateSpaceAgents(context),
100
+ 'visitors': 'guestbook.json',
101
+ 'templates': 'user-templates/'
102
+ }
103
+ },
104
+
105
+ // User's missions (goals)
106
+ 'missions': {
107
+ 'mission-1-get-started.md': generateStarterMission(context)
108
+ },
109
+
110
+ // User's stories (narratives)
111
+ 'stories': {
112
+ 'story-1-first-ai-interaction.md': generateFirstStory(context)
113
+ },
114
+
115
+ // User's agents (customizable AI)
116
+ 'agents': generateUserAgents(context),
117
+
118
+ // User's content
119
+ 'pages': { 'welcome.md': generateWelcomePage(context) },
120
+ 'posts': { 'first-post.md': generateFirstPost(context) },
121
+ 'events': { 'installation.md': generateInstallEvent() },
122
+
123
+ // User's system
124
+ 'tests': { 'basic-functionality.test.js': generateBasicTest() },
125
+ 'courses': { 'getting-started.md': generateGettingStarted(context) },
126
+
127
+ // User's team
128
+ 'teams': generateUserTeams(context),
129
+ 'tasks': { 'task-1-explore-space.md': generateFirstTask(context) }
130
+ };
131
+
132
+ await createDirectoryStructure(targetDir, structure);
133
+ }
134
+
135
+ async function createDirectoryStructure(basePath, structure) {
136
+ await fs.ensureDir(basePath);
137
+
138
+ for (const [key, value] of Object.entries(structure)) {
139
+ const currentPath = path.join(basePath, key);
140
+
141
+ if (typeof value === 'object' && value !== null && !Array.isArray(value)) {
142
+ // It's a directory
143
+ await createDirectoryStructure(currentPath, value);
144
+ } else if (typeof value === 'string') {
145
+ // It's a file
146
+ if (value === 'placeholder') {
147
+ // Create placeholder files for assets
148
+ await fs.ensureFile(currentPath);
149
+ await fs.writeFile(currentPath, `# Placeholder for ${key}`);
150
+ } else {
151
+ await fs.ensureFile(currentPath);
152
+ await fs.writeFile(currentPath, value);
153
+ }
154
+ }
155
+ }
156
+ }
157
+
158
+ // Content generators
159
+ function generateCascadeEngine() {
160
+ return `// ONE Cascade Engine - Mission → Story → Task → Agent
161
+ class CascadeEngine {
162
+ async processMission(mission) {
163
+ const stories = await this.spawnStories(mission);
164
+ const tasks = await this.breakdownTasks(stories);
165
+ const agents = await this.assignAgents(tasks);
166
+ return { stories, tasks, agents };
167
+ }
168
+
169
+ async spawnStories(mission) {
170
+ // Convert mission objectives into compelling narratives
171
+ return mission.objectives.map(obj => ({
172
+ id: this.generateId(),
173
+ title: obj.title,
174
+ narrative: this.createNarrative(obj),
175
+ viralPotential: this.calculateViralScore(obj)
176
+ }));
177
+ }
178
+
179
+ async breakdownTasks(stories) {
180
+ // Break stories into executable tasks
181
+ return stories.flatMap(story =>
182
+ story.requirements.map(req => ({
183
+ id: this.generateId(),
184
+ storyId: story.id,
185
+ description: req.description,
186
+ agent: this.selectBestAgent(req),
187
+ priority: req.priority
188
+ }))
189
+ );
190
+ }
191
+
192
+ async assignAgents(tasks) {
193
+ // Match tasks to optimal agents
194
+ return tasks.map(task => ({
195
+ ...task,
196
+ assignedAgent: this.matchAgent(task),
197
+ estimatedCompletion: this.estimateTime(task)
198
+ }));
199
+ }
200
+ }
201
+
202
+ module.exports = CascadeEngine;`;
203
+ }
204
+
205
+ function generateMeFile(context) {
206
+ const templates = {
207
+ student: `# My AI Universe
208
+
209
+ ## 🏢 Company (My Digital Identity)
210
+ company:
211
+ name: "${context.userInfo?.username || 'Student'}'s Study Space"
212
+ tagline: "Learning with my AI study buddies"
213
+ story: "I'm using AI to become the best student I can be"
214
+
215
+ brand:
216
+ theme: "student"
217
+ colors: ["#4CAF50", "#2196F3", "#FF9800"]
218
+ voice: "Friendly, encouraging, helpful"
219
+ font: "Inter"
220
+
221
+ ## 🤖 Top 8 Agents (My AI Study Squad)
222
+ top_agents:
223
+ - slot: 1
224
+ name: "Study Buddy"
225
+ role: "Learning companion and motivator"
226
+ personality: "Encouraging, patient, fun"
227
+
228
+ - slot: 2
229
+ name: "Homework Helper"
230
+ role: "Assignment assistance and guidance"
231
+ personality: "Knowledgeable, supportive, clear"
232
+
233
+ - slot: 3
234
+ name: "Time Manager"
235
+ role: "Schedule and deadline tracking"
236
+ personality: "Organized, gentle reminders, balanced"
237
+
238
+ ## 🎯 Goals (My Learning Missions)
239
+ goals:
240
+ - "Improve my grades in math"
241
+ - "Develop better study habits"
242
+ - "Prepare for college applications"
243
+ - "Learn new skills for the future"
244
+
245
+ ## 🎨 MySpace DNA (My Style)
246
+ style:
247
+ animations: "fun"
248
+ widgets: ["study_progress", "grade_tracker", "motivation_quotes"]
249
+ theme_colors: "bright and encouraging"`,
250
+
251
+ professional: `# My AI Universe
252
+
253
+ ## 🏢 Company (My Digital Identity)
254
+ company:
255
+ name: "${context.userInfo?.username || 'Professional'}'s Business Hub"
256
+ tagline: "Scaling success with my AI co-founders"
257
+ story: "I'm building an empire with AI-powered efficiency"
258
+
259
+ brand:
260
+ theme: "professional"
261
+ colors: ["#2563EB", "#64748B", "#FFFFFF"]
262
+ voice: "Professional, confident, results-driven"
263
+ font: "Inter"
264
+
265
+ ## 🤖 Top 8 Agents (My AI Dream Team)
266
+ top_agents:
267
+ - slot: 1
268
+ name: "Personal Assistant"
269
+ role: "Digital twin and coordinator"
270
+ personality: "Professional, proactive, organized"
271
+
272
+ - slot: 2
273
+ name: "Content Creator"
274
+ role: "Multi-platform content creation"
275
+ personality: "Creative, engaging, brand-consistent"
276
+
277
+ - slot: 3
278
+ name: "Growth Hacker"
279
+ role: "Lead generation and optimization"
280
+ personality: "Data-driven, creative, growth-obsessed"
281
+
282
+ ## 🎯 Goals (My Business Missions)
283
+ goals:
284
+ - "Build sustainable content creation system"
285
+ - "Generate consistent leads and revenue"
286
+ - "Establish thought leadership in my industry"
287
+ - "Create scalable business processes"
288
+
289
+ ## 🎨 MySpace DNA (My Professional Style)
290
+ style:
291
+ animations: "subtle"
292
+ widgets: ["performance_metrics", "lead_tracker", "content_calendar"]
293
+ theme_colors: "professional blue palette"`,
294
+
295
+ enterprise: `# Our AI Universe
296
+
297
+ ## 🏢 Company (Our Organization)
298
+ company:
299
+ name: "${context.hostname || 'Enterprise'} AI Command Center"
300
+ tagline: "Transforming our organization with AI orchestration"
301
+ story: "We're leading digital transformation through AI collaboration"
302
+
303
+ brand:
304
+ theme: "corporate-dashboard"
305
+ colors: ["#1E40AF", "#374151", "#FFFFFF"]
306
+ voice: "Professional, strategic, innovative"
307
+ font: "Inter"
308
+
309
+ ## 🤖 Top 8 Agents (Our AI Leadership Team)
310
+ top_agents:
311
+ - slot: 1
312
+ name: "Executive Assistant"
313
+ role: "C-suite coordination and intelligence"
314
+ personality: "Strategic, discreet, efficient"
315
+
316
+ - slot: 2
317
+ name: "Strategy Advisor"
318
+ role: "Business intelligence and planning"
319
+ personality: "Analytical, forward-thinking, insightful"
320
+
321
+ - slot: 3
322
+ name: "Compliance Officer"
323
+ role: "Risk management and regulatory compliance"
324
+ personality: "Thorough, vigilant, trustworthy"
325
+
326
+ ## 🎯 Goals (Our Transformation Missions)
327
+ goals:
328
+ - "Deploy AI across all departments"
329
+ - "Achieve operational efficiency targets"
330
+ - "Maintain compliance and security standards"
331
+ - "Drive innovation and competitive advantage"
332
+
333
+ ## 🎨 Corporate Identity
334
+ style:
335
+ animations: "minimal"
336
+ widgets: ["executive_dashboard", "compliance_status", "performance_kpis"]
337
+ theme_colors: "corporate blue and gray"`
338
+ };
339
+
340
+ return templates[context.type] || templates.professional;
341
+ }
342
+
343
+ async function generateAgentLibrary(context) {
344
+ return {
345
+ 'personal-assistant.yaml': generatePersonalAssistant(),
346
+ 'content-creator.yaml': generateContentCreator(),
347
+ 'growth-hacker.yaml': generateGrowthHacker(),
348
+ 'data-analyst.yaml': generateDataAnalyst(),
349
+ 'study-buddy.yaml': generateStudyBuddy(),
350
+ 'homework-helper.yaml': generateHomeworkHelper(),
351
+ // ... 37 more agents would be generated here
352
+ };
353
+ }
354
+
355
+ function generatePersonalAssistant() {
356
+ return `name: "Personal Assistant"
357
+ id: personal-assistant
358
+ type: coordinator
359
+ slot_preference: 1
360
+ description: "Your digital twin and chief of staff"
361
+
362
+ personality:
363
+ base: "Professional, proactive, organized"
364
+ voice: "Speaks exactly like the user but optimized"
365
+ catchphrase: "I am you, but optimized"
366
+
367
+ capabilities:
368
+ - coordination
369
+ - decision_making
370
+ - priority_setting
371
+ - email_management
372
+ - calendar_optimization
373
+ - task_delegation
374
+
375
+ specialties:
376
+ - "Thinks exactly like you"
377
+ - "Handles 90% of routine decisions"
378
+ - "Scales your personality infinitely"
379
+
380
+ viral_angle: "An AI that talks exactly like me but never gets tired"
381
+
382
+ training_data:
383
+ - user_communication_patterns
384
+ - decision_making_history
385
+ - priority_preferences
386
+ - work_style_analysis
387
+
388
+ integration:
389
+ required_tools: ["calendar", "email", "tasks"]
390
+ optional_tools: ["crm", "project_management"]
391
+
392
+ customization:
393
+ personality_training: true
394
+ voice_adaptation: true
395
+ decision_patterns: true`;
396
+ }
397
+
398
+ function generateWebApp(context) {
399
+ return {
400
+ 'package.json': generateWebPackageJson(),
401
+ 'next.config.js': generateNextConfig(),
402
+ 'tailwind.config.js': generateTailwindConfig(context),
403
+ 'app': {
404
+ 'layout.tsx': generateLayout(context),
405
+ 'page.tsx': generateHomePage(context),
406
+ 'one': {
407
+ 'page.tsx': generateOneDashboard(context)
408
+ },
409
+ 'spaces': {
410
+ 'page.tsx': generateSpacesPage()
411
+ },
412
+ 'agents': {
413
+ 'page.tsx': generateAgentsPage()
414
+ }
415
+ },
416
+ 'components': {
417
+ 'ui': 'shadcn-components/',
418
+ 'one': {
419
+ 'space-preview.tsx': generateSpacePreview(),
420
+ 'agent-card.tsx': generateAgentCard(),
421
+ 'mission-dashboard.tsx': generateMissionDashboard()
422
+ }
423
+ }
424
+ };
425
+ }
426
+
427
+ function generateWebPackageJson() {
428
+ return JSON.stringify({
429
+ "name": "@one/web",
430
+ "version": "1.0.0",
431
+ "private": true,
432
+ "scripts": {
433
+ "dev": "next dev",
434
+ "build": "next build",
435
+ "start": "next start",
436
+ "lint": "next lint"
437
+ },
438
+ "dependencies": {
439
+ "next": "14.0.0",
440
+ "react": "^18.2.0",
441
+ "react-dom": "^18.2.0",
442
+ "@radix-ui/react-slot": "^1.0.2",
443
+ "class-variance-authority": "^0.7.0",
444
+ "clsx": "^2.0.0",
445
+ "tailwindcss": "^3.3.0",
446
+ "tailwind-merge": "^2.0.0"
447
+ },
448
+ "devDependencies": {
449
+ "@types/node": "^20.0.0",
450
+ "@types/react": "^18.2.0",
451
+ "@types/react-dom": "^18.2.0",
452
+ "eslint": "^8.0.0",
453
+ "eslint-config-next": "14.0.0",
454
+ "typescript": "^5.0.0"
455
+ }
456
+ }, null, 2);
457
+ }
458
+
459
+ // Export the main function
460
+ module.exports = { generateScaffold };