oneie 3.6.25 → 3.6.27

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.
Files changed (55) hide show
  1. package/.claude/agents/TROUBLESHOOTING.md +530 -0
  2. package/.claude/agents/agent-builder.md +226 -198
  3. package/.claude/agents/agent-claude.md +645 -0
  4. package/.claude/agents/agent-designer.md +166 -11
  5. package/.claude/agents/agent-director.md +109 -41
  6. package/.claude/agents/agent-frontend.md +314 -27
  7. package/.claude/agents/agent-quality.md +377 -0
  8. package/.claude/commands/chat.md +504 -0
  9. package/.claude/commands/create.md +134 -18
  10. package/.claude/commands/fast.md +531 -0
  11. package/.claude/commands/one.md +12 -85
  12. package/.claude/commands/optimize.md +74 -0
  13. package/.claude/commands/plan.md +420 -373
  14. package/.claude/commands/review.md +99 -0
  15. package/.claude/commands/test.md +197 -0
  16. package/.claude/commands/validate.md +140 -0
  17. package/.claude/hooks/__pycache__/todo.cpython-312.pyc +0 -0
  18. package/.claude/hooks/auto-format.sh +106 -0
  19. package/.claude/hooks/formatting.py +187 -0
  20. package/.claude/hooks/ontology-validation.py +255 -0
  21. package/.claude/hooks/validate-imports.py +182 -0
  22. package/.claude/hooks/validate-ontology.py +140 -0
  23. package/CLAUDE.md +105 -0
  24. package/dist/commands/agent.d.ts +18 -0
  25. package/dist/commands/agent.d.ts.map +1 -0
  26. package/dist/commands/agent.js +271 -0
  27. package/dist/commands/agent.js.map +1 -0
  28. package/dist/commands/init.js +1 -1
  29. package/dist/commands/init.js.map +1 -1
  30. package/dist/index.js +20 -0
  31. package/dist/index.js.map +1 -1
  32. package/dist/lib/agent-detection.d.ts +19 -0
  33. package/dist/lib/agent-detection.d.ts.map +1 -0
  34. package/dist/lib/agent-detection.js +87 -0
  35. package/dist/lib/agent-detection.js.map +1 -0
  36. package/dist/lib/detect.d.ts +45 -0
  37. package/dist/lib/detect.d.ts.map +1 -0
  38. package/dist/lib/detect.js +221 -0
  39. package/dist/lib/detect.js.map +1 -0
  40. package/llms.txt +257 -0
  41. package/one/knowledge/cascading-context-specification.md +1617 -0
  42. package/one/knowledge/claude-code-integration.md +1293 -0
  43. package/one/knowledge/development-commands.md +251 -0
  44. package/one/knowledge/games-english.md +691 -0
  45. package/one/knowledge/games.md +1082 -0
  46. package/one/knowledge/guidelines.md +314 -0
  47. package/one/knowledge/parallel-agents.md +932 -0
  48. package/one/knowledge/performance.md +459 -0
  49. package/one/knowledge/troubleshooting.md +434 -0
  50. package/one/things/plans/dsl-claude-code.md +1011 -0
  51. package/one/things/plans/npx-agent-safety.md +785 -0
  52. package/one/things/plans/npx-agent.md +1089 -0
  53. package/one/things/plans/remove-backend-development-from-agents.md +1331 -0
  54. package/package.json +3 -2
  55. package/.claude/agents/AUDIT-agent-ops-alignment.md +0 -379
@@ -0,0 +1,785 @@
1
+ ---
2
+ title: npx oneie agent - Safety & Compatibility System
3
+ type: plan
4
+ status: draft
5
+ created: 2025-01-08
6
+ tags:
7
+ - cli
8
+ - safety
9
+ - compatibility
10
+ - backup
11
+ - conflict-resolution
12
+ ---
13
+
14
+ # npx oneie agent - Safety & Compatibility System
15
+
16
+ ## Core Principle
17
+
18
+ **Never destroy user data. Always have an undo path.**
19
+
20
+ When installing ONE into existing projects, we must:
21
+ 1. Detect what's already there
22
+ 2. Backup before any changes
23
+ 3. Choose safe installation strategy
24
+ 4. Make everything reversible
25
+ 5. Communicate clearly what happened
26
+
27
+ ## Project Detection Matrix
28
+
29
+ ### Detection Strategy
30
+
31
+ Run these checks in order:
32
+
33
+ ```typescript
34
+ interface ProjectDetection {
35
+ isEmpty: boolean; // No files except .git
36
+ hasPackageJson: boolean; // Has package.json
37
+ framework: Framework; // What framework detected
38
+ hasONE: boolean; // ONE already installed
39
+ hasEnv: boolean; // Has .env files
40
+ hasClaude: boolean; // Has CLAUDE.md or .claude/
41
+ conflicts: string[]; // List of conflicting files
42
+ compatibilityLevel: 'perfect' | 'compatible' | 'conflict' | 'incompatible';
43
+ }
44
+
45
+ type Framework =
46
+ | 'none' // Empty directory
47
+ | 'astro' // Astro project (compatible!)
48
+ | 'nextjs' // Next.js (incompatible)
49
+ | 'react' // Create React App (incompatible)
50
+ | 'vue' // Vue (incompatible)
51
+ | 'svelte' // SvelteKit (incompatible)
52
+ | 'remix' // Remix (incompatible)
53
+ | 'nuxt' // Nuxt (incompatible)
54
+ | 'one' // ONE Platform (upgrade)
55
+ | 'unknown'; // Has package.json but unknown framework
56
+ ```
57
+
58
+ ### Framework Detection Logic
59
+
60
+ ```typescript
61
+ async function detectFramework(): Promise<Framework> {
62
+ if (!fs.existsSync('package.json')) {
63
+ return 'none';
64
+ }
65
+
66
+ const pkg = JSON.parse(fs.readFileSync('package.json', 'utf-8'));
67
+
68
+ // Check for ONE Platform
69
+ if (pkg.name === 'oneie' || pkg.dependencies?.['@one/platform']) {
70
+ return 'one';
71
+ }
72
+
73
+ // Check dependencies and devDependencies
74
+ const allDeps = {
75
+ ...pkg.dependencies,
76
+ ...pkg.devDependencies,
77
+ };
78
+
79
+ // Priority order (most specific first)
80
+ if (allDeps.astro) return 'astro';
81
+ if (allDeps.next) return 'nextjs';
82
+ if (allDeps['@remix-run/react']) return 'remix';
83
+ if (allDeps['@sveltejs/kit']) return 'svelte';
84
+ if (allDeps.nuxt) return 'nuxt';
85
+ if (allDeps.vue) return 'vue';
86
+ if (allDeps['react-scripts']) return 'react';
87
+
88
+ return 'unknown';
89
+ }
90
+ ```
91
+
92
+ ## Compatibility Matrix
93
+
94
+ | Scenario | Framework | Strategy | Reason |
95
+ |----------|-----------|----------|--------|
96
+ | Empty directory | `none` | **Fresh Install** | No conflicts, perfect |
97
+ | Astro project | `astro` | **Merge Install** | Compatible architecture |
98
+ | ONE project | `one` | **Upgrade Install** | Update existing |
99
+ | Next.js project | `nextjs` | **Subfolder Install** | Different routing |
100
+ | React/Vue/Svelte | `react`/`vue`/`svelte` | **Subfolder Install** | Incompatible |
101
+ | Unknown project | `unknown` | **Subfolder Install** | Play it safe |
102
+
103
+ ## Installation Strategies
104
+
105
+ ### 1. Fresh Install (Empty Directory)
106
+
107
+ **When:** No package.json, no source files
108
+
109
+ **Action:**
110
+ ```bash
111
+ # Install everything normally
112
+ ./
113
+ ├── web/ # Full Astro frontend
114
+ ├── backend/ # Convex backend
115
+ ├── one/ # Documentation
116
+ ├── .claude/ # Claude Code config
117
+ ├── CLAUDE.md # Root instructions
118
+ ├── package.json # Root package file
119
+ └── .env # Environment variables
120
+ ```
121
+
122
+ **Risk:** None - directory is empty
123
+
124
+ ### 2. Merge Install (Astro Project)
125
+
126
+ **When:** Existing Astro project detected
127
+
128
+ **Action:**
129
+ ```bash
130
+ # Backup first
131
+ .one-backups/
132
+ └── 2025-01-08T10-30-00/
133
+ ├── package.json
134
+ ├── .env
135
+ ├── CLAUDE.md (if exists)
136
+ └── astro.config.mjs
137
+
138
+ # Then merge
139
+ ./
140
+ ├── src/
141
+ │ ├── pages/ # Keep existing + add ONE pages
142
+ │ ├── components/ # Keep existing + add ONE components
143
+ │ └── content/ # Keep existing + add ONE collections
144
+ ├── one/ # Add documentation
145
+ ├── backend/ # Add Convex backend
146
+ ├── .claude/ # Add Claude config (or merge if exists)
147
+ ├── CLAUDE.md # Add or merge
148
+ └── package.json # Merge dependencies
149
+ ```
150
+
151
+ **Strategy:**
152
+ 1. Backup all files that will change
153
+ 2. Merge package.json dependencies (don't replace)
154
+ 3. Add ONE-specific files to existing structure
155
+ 4. Preserve existing pages and components
156
+ 5. Add ONE documentation to /one folder
157
+ 6. Merge or create .env files (never overwrite)
158
+ 7. Update astro.config.mjs carefully
159
+
160
+ **Risk:** Medium - must preserve existing work
161
+
162
+ ### 3. Subfolder Install (Incompatible Framework)
163
+
164
+ **When:** Next.js, React, Vue, Svelte, or unknown project
165
+
166
+ **Action:**
167
+ ```bash
168
+ # Install in subfolder
169
+ ./
170
+ ├── [existing project files]
171
+ ├── package.json # Original project
172
+ └── one-platform/ # ONE installed here
173
+ ├── web/
174
+ ├── backend/
175
+ ├── one/
176
+ ├── .claude/
177
+ ├── CLAUDE.md
178
+ └── package.json
179
+ ```
180
+
181
+ **Strategy:**
182
+ 1. No backup needed (no files modified)
183
+ 2. Ask for subfolder name (default: `one-platform`)
184
+ 3. Install complete ONE structure in subfolder
185
+ 4. Completely isolated from main project
186
+ 5. Suggest: "Your ONE Platform is in ./one-platform/"
187
+
188
+ **Risk:** None - completely isolated
189
+
190
+ ### 4. Upgrade Install (ONE Already Exists)
191
+
192
+ **When:** ONE Platform already detected
193
+
194
+ **Action:**
195
+ ```bash
196
+ # Backup existing customizations
197
+ .one-backups/
198
+ └── 2025-01-08T10-30-00/
199
+ ├── one/ # User's docs
200
+ ├── .claude/ # User's agents
201
+ ├── CLAUDE.md # User's instructions
202
+ └── [installation-folder]/ # User's customizations
203
+
204
+ # Then upgrade
205
+ - Update core files (web/, backend/, one/ templates)
206
+ - Preserve user customizations
207
+ - Merge new features
208
+ - Update dependencies
209
+ ```
210
+
211
+ **Strategy:**
212
+ 1. Detect existing ONE version
213
+ 2. Backup all user customizations
214
+ 3. Update core ONE files
215
+ 4. Preserve installation folders
216
+ 5. Merge new features from latest version
217
+ 6. Show upgrade report
218
+
219
+ **Risk:** Low - existing ONE user, knows the system
220
+
221
+ ## Backup System
222
+
223
+ ### Backup Directory Structure
224
+
225
+ ```bash
226
+ .one-backups/
227
+ ├── 2025-01-08T10-30-00/ # Timestamp format
228
+ │ ├── metadata.json # What was backed up and why
229
+ │ ├── package.json
230
+ │ ├── .env
231
+ │ ├── .env.local
232
+ │ ├── CLAUDE.md
233
+ │ ├── .claude/
234
+ │ └── [any other conflicts]
235
+ └── 2025-01-08T11-45-00/ # Next backup
236
+ └── ...
237
+ ```
238
+
239
+ ### Backup Metadata
240
+
241
+ ```json
242
+ {
243
+ "timestamp": "2025-01-08T10:30:00Z",
244
+ "reason": "merge-install",
245
+ "framework": "astro",
246
+ "backedUpFiles": [
247
+ "package.json",
248
+ ".env",
249
+ "CLAUDE.md",
250
+ ".claude/commands/custom.md"
251
+ ],
252
+ "installationStrategy": "merge",
253
+ "canRestore": true,
254
+ "restoreCommand": "npx oneie restore 2025-01-08T10-30-00"
255
+ }
256
+ ```
257
+
258
+ ### Restore Command
259
+
260
+ ```bash
261
+ # List available backups
262
+ npx oneie restore --list
263
+
264
+ # Restore specific backup
265
+ npx oneie restore 2025-01-08T10-30-00
266
+
267
+ # Interactive restore (choose what to restore)
268
+ npx oneie restore --interactive
269
+ ```
270
+
271
+ ## File Conflict Resolution
272
+
273
+ ### Protected Files (Never Overwrite Without Backup)
274
+
275
+ **Critical files:**
276
+ - `.env`, `.env.local`, `.env.production`
277
+ - `CLAUDE.md`
278
+ - `.claude/` directory
279
+ - `package.json`, `package-lock.json`
280
+ - `tsconfig.json`
281
+ - `astro.config.mjs`
282
+
283
+ **User content:**
284
+ - `src/pages/*` (except ONE-specific)
285
+ - `src/components/*` (except ONE-specific)
286
+ - `src/content/*` (except ONE-specific)
287
+ - Installation folders (e.g., `/acme`)
288
+
289
+ ### Merge Strategy for Common Files
290
+
291
+ #### package.json
292
+
293
+ ```typescript
294
+ function mergePackageJson(existing: any, oneTemplate: any): any {
295
+ return {
296
+ ...existing,
297
+ // Preserve user's name, version, etc.
298
+ name: existing.name,
299
+ version: existing.version,
300
+ description: existing.description || oneTemplate.description,
301
+
302
+ // Merge scripts (ONE scripts prefixed)
303
+ scripts: {
304
+ ...existing.scripts,
305
+ 'one:dev': oneTemplate.scripts.dev,
306
+ 'one:build': oneTemplate.scripts.build,
307
+ 'one:preview': oneTemplate.scripts.preview,
308
+ },
309
+
310
+ // Merge dependencies (ONE + existing)
311
+ dependencies: {
312
+ ...existing.dependencies,
313
+ ...oneTemplate.dependencies,
314
+ },
315
+
316
+ // Merge devDependencies
317
+ devDependencies: {
318
+ ...existing.devDependencies,
319
+ ...oneTemplate.devDependencies,
320
+ },
321
+ };
322
+ }
323
+ ```
324
+
325
+ #### .env files
326
+
327
+ ```typescript
328
+ function mergeEnvFile(existing: string, oneTemplate: string): string {
329
+ const existingVars = parseEnv(existing);
330
+ const oneVars = parseEnv(oneTemplate);
331
+
332
+ // Never overwrite existing variables
333
+ const merged = { ...oneVars, ...existingVars };
334
+
335
+ // Add comment for new ONE variables
336
+ let result = '# Existing environment variables\n';
337
+ result += formatEnv(existingVars);
338
+ result += '\n\n# ONE Platform variables\n';
339
+ result += formatEnv(oneVars);
340
+
341
+ return result;
342
+ }
343
+ ```
344
+
345
+ #### CLAUDE.md
346
+
347
+ ```typescript
348
+ function mergeClaude(existing: string, oneTemplate: string): string {
349
+ // Keep existing at top (user's customizations)
350
+ // Add ONE platform instructions at bottom
351
+ return `${existing}
352
+
353
+ ---
354
+ # ONE Platform Instructions (Auto-generated)
355
+
356
+ ${oneTemplate}
357
+
358
+ ---
359
+
360
+ **Note:** Your custom instructions above take precedence over ONE defaults.
361
+ `;
362
+ }
363
+ ```
364
+
365
+ ## Safety Checks Before Installation
366
+
367
+ ### Pre-flight Checks
368
+
369
+ ```typescript
370
+ interface SafetyCheck {
371
+ name: string;
372
+ passed: boolean;
373
+ severity: 'error' | 'warning' | 'info';
374
+ message: string;
375
+ canContinue: boolean;
376
+ }
377
+
378
+ async function runSafetyChecks(): Promise<SafetyCheck[]> {
379
+ return [
380
+ // Critical checks (must pass)
381
+ {
382
+ name: 'git-initialized',
383
+ passed: await hasGit(),
384
+ severity: 'error',
385
+ message: 'Git repository not initialized. Run: git init',
386
+ canContinue: false,
387
+ },
388
+ {
389
+ name: 'git-clean',
390
+ passed: await isGitClean(),
391
+ severity: 'warning',
392
+ message: 'Uncommitted changes detected. Commit first for safety.',
393
+ canContinue: true,
394
+ },
395
+ {
396
+ name: 'node-version',
397
+ passed: await checkNodeVersion('>=18.0.0'),
398
+ severity: 'error',
399
+ message: 'Node.js 18+ required',
400
+ canContinue: false,
401
+ },
402
+
403
+ // Compatibility checks
404
+ {
405
+ name: 'framework-compatible',
406
+ passed: await isFrameworkCompatible(),
407
+ severity: 'warning',
408
+ message: 'Incompatible framework detected. Will install in subfolder.',
409
+ canContinue: true,
410
+ },
411
+ {
412
+ name: 'disk-space',
413
+ passed: await hasDiskSpace(500), // 500MB required
414
+ severity: 'error',
415
+ message: 'Insufficient disk space',
416
+ canContinue: false,
417
+ },
418
+
419
+ // Backup checks
420
+ {
421
+ name: 'can-backup',
422
+ passed: await canCreateBackup(),
423
+ severity: 'error',
424
+ message: 'Cannot create backup directory',
425
+ canContinue: false,
426
+ },
427
+ ];
428
+ }
429
+ ```
430
+
431
+ ## Agent Command with Safety
432
+
433
+ ### Enhanced Command Flags
434
+
435
+ ```bash
436
+ # Safety flags
437
+ npx oneie agent --dry-run # Show plan without executing
438
+ npx oneie agent --backup-only # Just backup, don't install
439
+ npx oneie agent --force # Skip safety checks (dangerous!)
440
+ npx oneie agent --no-backup # Skip backup (not recommended)
441
+ npx oneie agent --subfolder="custom" # Force subfolder install
442
+
443
+ # Compatibility flags
444
+ npx oneie agent --merge # Force merge strategy
445
+ npx oneie agent --isolated # Force subfolder strategy
446
+ npx oneie agent --upgrade # Force upgrade strategy
447
+
448
+ # Recovery flags
449
+ npx oneie agent --restore="timestamp" # Restore from backup
450
+ npx oneie agent --undo # Undo last install
451
+ ```
452
+
453
+ ### Execution Flow with Safety
454
+
455
+ ```typescript
456
+ async function agentInstall(options: AgentOptions) {
457
+ // 1. Detect existing project
458
+ const detection = await detectProject();
459
+ console.log('🔍 Detected:', detection.framework);
460
+
461
+ // 2. Run safety checks
462
+ const checks = await runSafetyChecks();
463
+ const errors = checks.filter(c => !c.passed && !c.canContinue);
464
+
465
+ if (errors.length > 0) {
466
+ console.log('❌ Safety checks failed:');
467
+ errors.forEach(e => console.log(` - ${e.message}`));
468
+ return { success: false, errors };
469
+ }
470
+
471
+ // 3. Choose installation strategy
472
+ const strategy = chooseStrategy(detection);
473
+ console.log('📋 Strategy:', strategy);
474
+
475
+ // 4. Show what will happen (if verbose)
476
+ if (options.verbose || options.dryRun) {
477
+ await showInstallationPlan(detection, strategy);
478
+ }
479
+
480
+ if (options.dryRun) {
481
+ console.log('\n✓ Dry run complete (no changes made)');
482
+ return { success: true, dryRun: true };
483
+ }
484
+
485
+ // 5. Create backup (unless --no-backup)
486
+ if (!options.noBackup && detection.hasConflicts) {
487
+ const backup = await createBackup(detection);
488
+ console.log('💾 Backup created:', backup.timestamp);
489
+ console.log(' Restore with: npx oneie restore', backup.timestamp);
490
+ }
491
+
492
+ // 6. Execute installation
493
+ const result = await executeStrategy(strategy, detection, options);
494
+
495
+ // 7. Verify installation
496
+ const verification = await verifyInstallation();
497
+
498
+ if (verification.success) {
499
+ console.log('✓ Installation verified');
500
+ return { success: true, ...result };
501
+ } else {
502
+ console.log('⚠️ Installation completed with warnings');
503
+ return { success: false, warnings: verification.warnings };
504
+ }
505
+ }
506
+ ```
507
+
508
+ ## Strategy Decision Logic
509
+
510
+ ```typescript
511
+ function chooseStrategy(detection: ProjectDetection): InstallStrategy {
512
+ // Empty directory - perfect!
513
+ if (detection.isEmpty) {
514
+ return 'fresh';
515
+ }
516
+
517
+ // ONE already installed - upgrade
518
+ if (detection.framework === 'one') {
519
+ return 'upgrade';
520
+ }
521
+
522
+ // Astro project - compatible, can merge
523
+ if (detection.framework === 'astro' && !detection.hasConflicts) {
524
+ return 'merge';
525
+ }
526
+
527
+ // Astro with conflicts - ask user
528
+ if (detection.framework === 'astro' && detection.hasConflicts) {
529
+ // In agent mode, default to subfolder (safest)
530
+ return 'subfolder';
531
+ }
532
+
533
+ // Any other framework - subfolder for safety
534
+ if (detection.framework !== 'none') {
535
+ return 'subfolder';
536
+ }
537
+
538
+ // Unknown situation - play it safe
539
+ return 'subfolder';
540
+ }
541
+ ```
542
+
543
+ ## Output Examples
544
+
545
+ ### Success: Fresh Install
546
+
547
+ ```bash
548
+ $ npx oneie agent
549
+
550
+ 🔍 Detected: Empty directory
551
+ 📋 Strategy: Fresh installation
552
+ 💾 No backup needed (directory empty)
553
+
554
+ ✓ Created project structure
555
+ ✓ Installed dependencies (23 packages)
556
+ ✓ Generated environment files
557
+ ✓ Your ONE Platform is ready!
558
+
559
+ Next steps:
560
+ /one # Show control center
561
+ bun run dev # Start development
562
+ ```
563
+
564
+ ### Success: Merge Install
565
+
566
+ ```bash
567
+ $ npx oneie agent
568
+
569
+ 🔍 Detected: Astro project
570
+ 📋 Strategy: Merge installation
571
+ 💾 Backup created: 2025-01-08T10-30-00
572
+ Restore with: npx oneie restore 2025-01-08T10-30-00
573
+
574
+ ✓ Backed up 4 files
575
+ ✓ Merged package.json (added 8 dependencies)
576
+ ✓ Merged .env (preserved existing variables)
577
+ ✓ Added ONE documentation to /one
578
+ ✓ Added backend to /backend
579
+ ✓ Added Claude config to /.claude
580
+
581
+ ⚠️ Your existing pages preserved in:
582
+ src/pages/index.astro
583
+ src/pages/about.astro
584
+
585
+ ✓ Installation complete!
586
+
587
+ Next steps:
588
+ /one # See ONE commands
589
+ bun run dev # Your existing dev script
590
+ bun run one:dev # ONE-specific dev script
591
+ ```
592
+
593
+ ### Success: Subfolder Install
594
+
595
+ ```bash
596
+ $ npx oneie agent
597
+
598
+ 🔍 Detected: Next.js project
599
+ 📋 Strategy: Subfolder installation
600
+ 💾 No backup needed (isolated install)
601
+
602
+ ⚠️ Next.js and ONE use different routing systems.
603
+ Installing ONE in subfolder: ./one-platform
604
+
605
+ ✓ Created ./one-platform
606
+ ✓ Installed ONE Platform
607
+ ✓ Completely isolated from your Next.js project
608
+
609
+ ✓ Installation complete!
610
+
611
+ Your projects:
612
+ ./ Next.js project (unchanged)
613
+ ./one-platform ONE Platform (new)
614
+
615
+ Next steps:
616
+ cd one-platform
617
+ /one # Start using ONE
618
+ ```
619
+
620
+ ### Success: Upgrade Install
621
+
622
+ ```bash
623
+ $ npx oneie agent
624
+
625
+ 🔍 Detected: ONE Platform (v1.0.0)
626
+ 📋 Strategy: Upgrade to v1.1.0
627
+ 💾 Backup created: 2025-01-08T10-30-00
628
+ Your customizations backed up
629
+
630
+ ✓ Backed up user customizations
631
+ ✓ Updated core files
632
+ ✓ Preserved installation folder: /acme
633
+ ✓ Preserved custom agents: /.claude/agents/custom-agent.md
634
+ ✓ Updated dependencies
635
+ ✓ Merged new features
636
+
637
+ ✓ Upgrade complete!
638
+
639
+ What's new in v1.1.0:
640
+ - New agent: agent-problem-solver
641
+ - Enhanced cycle workflow
642
+ - Improved documentation
643
+
644
+ Next steps:
645
+ /one # See updated commands
646
+ ```
647
+
648
+ ### Error: Safety Check Failed
649
+
650
+ ```bash
651
+ $ npx oneie agent
652
+
653
+ 🔍 Detected: React project
654
+ ❌ Safety checks failed:
655
+ - Git repository not initialized. Run: git init
656
+ - Node.js 18+ required (found: v16.14.0)
657
+
658
+ Cannot continue installation.
659
+
660
+ Fix these issues first:
661
+ git init
662
+ nvm install 18
663
+ nvm use 18
664
+
665
+ Then run: npx oneie agent
666
+ ```
667
+
668
+ ## Restore Functionality
669
+
670
+ ### List Backups
671
+
672
+ ```bash
673
+ $ npx oneie restore --list
674
+
675
+ Available backups:
676
+ 1. 2025-01-08T10-30-00 (2 hours ago)
677
+ - Reason: merge-install
678
+ - Files: package.json, .env, CLAUDE.md
679
+ - Size: 15 KB
680
+
681
+ 2. 2025-01-08T08-15-00 (4 hours ago)
682
+ - Reason: upgrade-install
683
+ - Files: package.json, .claude/
684
+ - Size: 42 KB
685
+
686
+ Restore with: npx oneie restore <timestamp>
687
+ ```
688
+
689
+ ### Restore Backup
690
+
691
+ ```bash
692
+ $ npx oneie restore 2025-01-08T10-30-00
693
+
694
+ 🔍 Backup found: 2025-01-08T10-30-00
695
+ 📋 Will restore 3 files:
696
+ - package.json
697
+ - .env
698
+ - CLAUDE.md
699
+
700
+ ⚠️ Current files will be backed up first
701
+
702
+ Continue? (y/n): y
703
+
704
+ 💾 Created safety backup: 2025-01-08T12-45-00
705
+ ✓ Restored package.json
706
+ ✓ Restored .env
707
+ ✓ Restored CLAUDE.md
708
+
709
+ ✓ Restore complete!
710
+
711
+ Tip: If something went wrong, restore the safety backup:
712
+ npx oneie restore 2025-01-08T12-45-00
713
+ ```
714
+
715
+ ## Testing Matrix
716
+
717
+ | Test Case | Framework | Has Files | Expected Strategy | Expected Outcome |
718
+ |-----------|-----------|-----------|-------------------|------------------|
719
+ | Empty dir | none | No | fresh | Full install |
720
+ | New Astro | astro | Yes | merge | Merge success |
721
+ | Astro + conflicts | astro | Yes | subfolder | Isolated install |
722
+ | Next.js | nextjs | Yes | subfolder | Isolated install |
723
+ | ONE v1.0 | one | Yes | upgrade | Upgrade success |
724
+ | Unknown | unknown | Yes | subfolder | Isolated install |
725
+ | No git | any | Any | error | Exit with error |
726
+ | No space | any | Any | error | Exit with error |
727
+
728
+ ## Implementation Checklist
729
+
730
+ ### Phase 1: Detection
731
+ - [ ] Implement `detectProject()`
732
+ - [ ] Implement `detectFramework()`
733
+ - [ ] Implement conflict detection
734
+ - [ ] Test with all framework types
735
+
736
+ ### Phase 2: Safety System
737
+ - [ ] Implement backup system
738
+ - [ ] Implement restore command
739
+ - [ ] Implement safety checks
740
+ - [ ] Test backup/restore flow
741
+
742
+ ### Phase 3: Strategies
743
+ - [ ] Implement fresh install
744
+ - [ ] Implement merge install
745
+ - [ ] Implement subfolder install
746
+ - [ ] Implement upgrade install
747
+
748
+ ### Phase 4: Merge Logic
749
+ - [ ] Implement package.json merge
750
+ - [ ] Implement .env merge
751
+ - [ ] Implement CLAUDE.md merge
752
+ - [ ] Implement config file merge
753
+
754
+ ### Phase 5: Testing
755
+ - [ ] Test all scenarios in matrix
756
+ - [ ] Test restore functionality
757
+ - [ ] Test error handling
758
+ - [ ] Test agent integration
759
+
760
+ ## Summary
761
+
762
+ **Key Safety Features:**
763
+
764
+ 1. ✅ **Never overwrites** without backup
765
+ 2. ✅ **Smart detection** of existing projects
766
+ 3. ✅ **Safe strategies** for each scenario
767
+ 4. ✅ **Full restore** capability
768
+ 5. ✅ **Clear communication** of what happens
769
+ 6. ✅ **Reversible** operations
770
+ 7. ✅ **Idempotent** (safe to run multiple times)
771
+
772
+ **Result:** Agents can confidently run `npx oneie agent` knowing it will:
773
+ - Detect the situation
774
+ - Choose the safest strategy
775
+ - Backup everything important
776
+ - Install without destroying work
777
+ - Provide clear next steps
778
+
779
+ **Philosophy:** "Make it safe first, then make it automatic."
780
+
781
+ ---
782
+
783
+ **Status:** Ready for implementation
784
+ **Dependencies:** npx-agent.md (base command design)
785
+ **Estimated Completion:** 2 weeks (includes comprehensive testing)