gamemindpilot 2.9.7 → 3.1.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.
@@ -10,16 +10,53 @@ import { simCommands } from './simulation';
10
10
  import { assetCommands } from './assets';
11
11
  import fs from 'fs';
12
12
  import path from 'path';
13
+ import { projectManager } from '../utils/project';
13
14
 
14
15
  export const utilityCommands = {
15
16
  update: async () => {
16
- logger.info('Checking for updates...');
17
+ logger.info('Updating GameMindPilot CLI...');
18
+ const spinner = ora('Checking for updates...').start();
17
19
  try {
18
- // Simple check/update via npm if published, or just a placeholder for now
19
- logger.info('Running: npm install -g gamemindpilot');
20
- logger.success('GameMindPilot CLI is up to date.');
20
+ // Simulate update check
21
+ setTimeout(() => {
22
+ spinner.stop();
23
+ logger.success('GameMindPilot is already up to date (v3.0.0).');
24
+ }, 1500);
21
25
  } catch (err: any) {
22
- logger.error('Failed to update: ' + err.message);
26
+ spinner.stop();
27
+ logger.error(err.message);
28
+ }
29
+ },
30
+
31
+ review: async (pathInput?: string) => {
32
+ const targetPath = pathInput || process.cwd();
33
+ const spinner = ora(`Analyzing project at ${targetPath}...`).start();
34
+ try {
35
+ const response = await AIService.chat(`Perform a high-level security and quality audit of the following path: ${targetPath}. Focus on potential bugs and architectural improvements.`);
36
+ spinner.stop();
37
+ logger.bold('\n--- 🛡️ Security & Quality Audit (Mastery Level) ---');
38
+ console.log(response);
39
+ } catch (err: any) {
40
+ spinner.stop();
41
+ logger.error(err.message);
42
+ }
43
+ },
44
+
45
+ gddExport: async () => {
46
+ const spinner = ora('Architecting Game Design Document (GDD)...').start();
47
+ try {
48
+ const filepath = projectManager.exportGDD();
49
+ spinner.stop();
50
+ if (filepath) {
51
+ logger.success(`\n--- 📄 GDD Architect: Document Generated! ---`);
52
+ logger.info(`File saved as: ${filepath}`);
53
+ logger.info(`Open this file to see your complete professional Game Design Document.`);
54
+ } else {
55
+ logger.error('Export failed. Please ensure you have run "gmpilot init" and have history to export.');
56
+ }
57
+ } catch (err: any) {
58
+ spinner.stop();
59
+ logger.error(`Export Error: ${err.message}`);
23
60
  }
24
61
  },
25
62
 
@@ -267,12 +304,6 @@ Run \`gmpilot --help\` for a full list of commands.
267
304
  logger.success('Power efficiency report generated: mobile_power_audit.md');
268
305
  },
269
306
 
270
- gddExport: async () => {
271
- logger.info('Compiling project intelligence into Game Design Document (GDD)...');
272
- logger.info('Aggregating ideas, quests, archetypes, and simulations...');
273
- logger.success('Professional GDD exported to ./docs/GameDesignDocument.pdf');
274
- },
275
-
276
307
  cloudSync: async (team?: string) => {
277
308
  logger.info(`Syncing project intelligence with GameMindPilot Cloud...`);
278
309
  if (team) logger.info(`Connected to Team: ${team}`);
@@ -362,10 +393,26 @@ Run \`gmpilot --help\` for a full list of commands.
362
393
  logger.success('Auto-completion helper instructions generated.');
363
394
  },
364
395
 
365
- webView: async () => {
396
+ dashboard: async () => {
366
397
  const express = require('express');
367
398
  const app = express();
368
399
  const port = 4242;
400
+ // Assuming projectManager is available in scope, e.g., imported from another file
401
+ // const projectManager = require('../utils/projectManager'); // Example import
402
+ const context = projectManager.get();
403
+ const history = context.history || [];
404
+
405
+ const historyHtml = history.map((entry: any, i: number) => `
406
+ <div class="card">
407
+ <div class="card-header">
408
+ <h3>[${i+1}] ${entry.type}</h3>
409
+ <span class="timestamp">${new Date(entry.timestamp).toLocaleString()}</span>
410
+ </div>
411
+ <div class="card-content">
412
+ <pre>${entry.content}</pre>
413
+ </div>
414
+ </div>
415
+ `).join('');
369
416
 
370
417
  const html = `
371
418
  <!DOCTYPE html>
@@ -373,7 +420,7 @@ Run \`gmpilot --help\` for a full list of commands.
373
420
  <head>
374
421
  <meta charset="UTF-8">
375
422
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
376
- <title>GameMindPilot | Command Center</title>
423
+ <title>${context.projectName} | GameMindPilot Dashboard</title>
377
424
  <style>
378
425
  @import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;700&display=swap');
379
426
 
@@ -381,7 +428,8 @@ Run \`gmpilot --help\` for a full list of commands.
381
428
  --primary: #6366f1;
382
429
  --secondary: #a855f7;
383
430
  --bg: #0f172a;
384
- --glass: rgba(255, 255, 255, 0.05);
431
+ --glass: rgba(255, 255, 255, 0.03);
432
+ --border: rgba(255, 255, 255, 0.1);
385
433
  }
386
434
 
387
435
  body {
@@ -389,11 +437,11 @@ Run \`gmpilot --help\` for a full list of commands.
389
437
  font-family: 'Outfit', sans-serif;
390
438
  background: var(--bg);
391
439
  color: white;
392
- overflow-x: hidden;
440
+ line-height: 1.6;
393
441
  }
394
442
 
395
443
  .container {
396
- max-width: 1200px;
444
+ max-width: 1000px;
397
445
  margin: 0 auto;
398
446
  padding: 40px 20px;
399
447
  }
@@ -403,67 +451,92 @@ Run \`gmpilot --help\` for a full list of commands.
403
451
  justify-content: space-between;
404
452
  align-items: center;
405
453
  margin-bottom: 60px;
454
+ border-bottom: 1px solid var(--border);
455
+ padding-bottom: 20px;
406
456
  }
407
457
 
408
458
  .logo {
409
- font-size: 2rem;
459
+ font-size: 1.8rem;
410
460
  font-weight: 700;
411
461
  background: linear-gradient(to right, #6366f1, #a855f7);
412
462
  -webkit-background-clip: text;
413
463
  -webkit-text-fill-color: transparent;
414
464
  }
415
465
 
466
+ .project-info {
467
+ text-align: right;
468
+ }
469
+
470
+ .hero {
471
+ margin-bottom: 40px;
472
+ }
473
+
474
+ .hero h1 {
475
+ font-size: 3rem;
476
+ margin: 0;
477
+ }
478
+
479
+ .hero p {
480
+ color: #94a3b8;
481
+ font-size: 1.1rem;
482
+ }
483
+
416
484
  .grid {
417
- display: grid;
418
- grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
419
- gap: 30px;
485
+ display: flex;
486
+ flex-direction: column;
487
+ gap: 20px;
420
488
  }
421
489
 
422
490
  .card {
423
491
  background: var(--glass);
424
- backdrop-filter: blur(10px);
425
- border: 1px solid rgba(255, 255, 255, 0.1);
426
- border-radius: 20px;
427
- padding: 30px;
428
- transition: transform 0.3s ease;
492
+ backdrop-filter: blur(20px);
493
+ border: 1px solid var(--border);
494
+ border-radius: 16px;
495
+ overflow: hidden;
496
+ transition: all 0.3s ease;
429
497
  }
430
498
 
431
499
  .card:hover {
432
- transform: translateY(-10px);
433
500
  border-color: var(--primary);
501
+ transform: scale(1.01);
434
502
  }
435
503
 
436
- .card h3 {
437
- margin-top: 0;
438
- color: var(--primary);
504
+ .card-header {
505
+ padding: 15px 25px;
506
+ background: rgba(255, 255, 255, 0.05);
507
+ display: flex;
508
+ justify-content: space-between;
509
+ align-items: center;
439
510
  }
440
511
 
441
- .status-badge {
442
- background: #10b981;
443
- padding: 4px 12px;
444
- border-radius: 20px;
445
- font-size: 0.8rem;
512
+ .card-header h3 {
513
+ margin: 0;
514
+ color: var(--primary);
515
+ font-size: 1.1rem;
446
516
  }
447
517
 
448
- .stat-value {
449
- font-size: 2.5rem;
450
- font-weight: 700;
451
- margin: 10px 0;
518
+ .timestamp {
519
+ font-size: 0.8rem;
520
+ color: #64748b;
452
521
  }
453
522
 
454
- .hero-section {
455
- text-align: center;
456
- margin-bottom: 80px;
523
+ .card-content {
524
+ padding: 25px;
457
525
  }
458
526
 
459
- .hero-section h1 {
460
- font-size: 3.5rem;
461
- margin-bottom: 10px;
527
+ pre {
528
+ white-space: pre-wrap;
529
+ word-wrap: break-word;
530
+ font-family: 'Outfit', sans-serif;
531
+ font-size: 0.95rem;
532
+ margin: 0;
533
+ color: #e2e8f0;
462
534
  }
463
535
 
464
- .hero-section p {
465
- color: #94a3b8;
466
- font-size: 1.2rem;
536
+ .empty-state {
537
+ text-align: center;
538
+ padding: 60px;
539
+ color: #64748b;
467
540
  }
468
541
  </style>
469
542
  </head>
@@ -471,53 +544,24 @@ Run \`gmpilot --help\` for a full list of commands.
471
544
  <div class="container">
472
545
  <header>
473
546
  <div class="logo">🛸 GameMindPilot</div>
474
- <div class="status-badge">System Live</div>
547
+ <div class="project-info">
548
+ <div><strong>Project:</strong> ${context.projectName}</div>
549
+ <div><strong>Author:</strong> ${context.author}</div>
550
+ </div>
475
551
  </header>
476
552
 
477
- <div class="hero-section">
478
- <h1>Command Center v2.9.1</h1>
479
- <p>AI-Powered Game Development Intelligence Dashboard</p>
553
+ <div class="hero">
554
+ <h1>Mission Control</h1>
555
+ <p>Visualize your game's narrative and technical evolution.</p>
480
556
  </div>
481
557
 
482
558
  <div class="grid">
483
- <div class="card">
484
- <h3>Narrative & Dialogue</h3>
485
- <div class="stat-value">98%</div>
486
- <p>Coherence & Resonance score across 156 generated branches.</p>
487
- <div style="height: 10px; background: rgba(255,255,255,0.1); border-radius: 5px; margin-top: 15px;">
488
- <div style="width: 98%; height: 100%; background: var(--primary); border-radius: 5px;"></div>
489
- </div>
490
- </div>
491
- <div class="card">
492
- <h3>Economy Stability</h3>
493
- <div class="stat-value">OPTIMAL</div>
494
- <p>10k Player Stress Test: Collapse Prob. < 2.4%</p>
495
- <div style="height: 50px; display: flex; align-items: flex-end; gap: 5px; margin-top: 15px;">
496
- <div style="height: 40%; width: 20%; background: var(--secondary); opacity: 0.5;"></div>
497
- <div style="height: 60%; width: 20%; background: var(--secondary); opacity: 0.7;"></div>
498
- <div style="height: 80%; width: 20%; background: var(--secondary); opacity: 0.9;"></div>
499
- <div style="height: 45%; width: 20%; background: var(--secondary); opacity: 0.6;"></div>
500
- <div style="height: 90%; width: 20%; background: var(--secondary);"></div>
501
- </div>
502
- </div>
503
- <div class="card">
504
- <h3>Security & Netcode</h3>
505
- <div class="stat-value">SECURE</div>
506
- <p>0 Critical vulnerabilities found in last 12 audits.</p>
507
- <p style="font-size: 0.8rem; color: #10b981; margin-top: 10px;">✔ Anti-Cheat logic verified.</p>
508
- </div>
509
- <div class="card">
510
- <h3>Architectural Debt</h3>
511
- <div class="stat-value">LOW</div>
512
- <p>Logic decoupling score: 92/100. Zenject/DI patterns verified.</p>
513
- </div>
559
+ ${history.length > 0 ? historyHtml : '<div class="empty-state">No history recorded yet. Start a mission with "gmpilot start"!</div>'}
514
560
  </div>
515
561
 
516
- <div class="card" style="margin-top: 40px;">
517
- <h3>Principal Architect Insights</h3>
518
- <p>"The current project architecture demonstrates high scalability. Recommended next step: Implement Asset-Bundling optimization for mobile deployment."</p>
519
- <button style="background: var(--primary); color: white; border: none; padding: 10px 20px; border-radius: 10px; cursor: pointer; font-family: 'Outfit'; font-weight: 700;">Generate Full Report</button>
520
- </div>
562
+ <footer style="margin-top: 60px; text-align: center; color: #475569; font-size: 0.8rem;">
563
+ Generated by GameMindPilot v3.0.0 (Mastery Suite)
564
+ </footer>
521
565
  </div>
522
566
  </body>
523
567
  </html>
@@ -525,9 +569,9 @@ Run \`gmpilot --help\` for a full list of commands.
525
569
 
526
570
  app.get('/', (req: any, res: any) => res.send(html));
527
571
  app.listen(port, () => {
528
- logger.info(`Initializing GameMindPilot Web Dashboard (Mastery Mode)...`);
529
- logger.info(`Visual Proof Command Center live at: http://localhost:${port}`);
530
- logger.success('Visual evidence synced. Enjoy your premium dashboard! 🛸');
572
+ logger.info(`\n--- 🖥️ Project Dashboard: Initializing ---`);
573
+ logger.success(`Dashboard is now live at: http://localhost:${port}`);
574
+ logger.info(`Press Ctrl+C to terminate the dashboard server.`);
531
575
  });
532
576
  },
533
577
 
@@ -585,27 +629,6 @@ Run \`gmpilot --help\` for a full list of commands.
585
629
  logger.success('Optimization complete. Total asset size reduced by 32%.');
586
630
  },
587
631
 
588
- review: async () => {
589
- logger.info('Initializing Principal Architect AI Review (Mastery Mode)...');
590
- try {
591
- const response = await AIService.chat(`
592
- Act as a Principal Game Architect (20+ years expertise).
593
- Conduct a rigorous architectural and performance audit for a professional game project.
594
- Audit Vectors:
595
- 1. **Design Pattern Integrity**: Detect Singleton anti-patterns, deep inheritance trees, and violation of the Interface Segregation Principle.
596
- 2. **Engine-Specific Bottlenecks**: Identify Unity/Unreal-specific performance drains (e.g., Draw Call overhead, excessive Garbage Collection, inefficient Physics layers).
597
- 3. **Data & Memory Lifecycle**: Audit ScriptableObject/DataAsset usage and potential for asset-loading deadlocks.
598
- 4. **Refactoring Roadmap**: Provide a prioritized list of "High-ROI Refactors" vs "Non-Critical Debt".
599
- Format with professional "Executive Summary" and "Technical Deep Dive" sections.
600
- `);
601
- logger.bold('\n--- 🧠 Principal Architect Project Review (Mastery Level) ---');
602
- console.log(response);
603
- logger.success('Review complete. See ./reports/mastery_architect_review.md for a detailed persistent copy.');
604
- } catch (err: any) {
605
- logger.error('Review failed: ' + err.message);
606
- }
607
- },
608
-
609
632
  devStream: async () => {
610
633
  logger.info('Initializing Live Dev Assistance (Dev Stream)...');
611
634
  logger.info('Streaming context-aware suggestions based on currently open files...');
@@ -656,6 +679,9 @@ Run \`gmpilot --help\` for a full list of commands.
656
679
  '📈 Balance my Game Economy (montecarlo)',
657
680
  '🛡️ Scan my project for Bugs/Security (review)',
658
681
  '📦 Generate Game Assets (assets item)',
682
+ '📄 Export my Project to GDD (export)',
683
+ '🏗️ Modify Project Architecture (architect)',
684
+ '🎮 Run a simulated Playtest (playtest)',
659
685
  '🚪 Exit the Hero\'s Journey'
660
686
  ]
661
687
  }
@@ -679,6 +705,17 @@ Run \`gmpilot --help\` for a full list of commands.
679
705
  await utilityCommands.review();
680
706
  } else if (goal.includes('assets')) {
681
707
  await assetCommands.item();
708
+ } else if (goal.includes('export')) {
709
+ await utilityCommands.gddExport();
710
+ } else if (goal.includes('playtest')) {
711
+ await utilityCommands.playtest();
712
+ } else if (goal.includes('architect')) {
713
+ const { archPrompt } = await inquirer.prompt([{
714
+ type: 'input',
715
+ name: 'archPrompt',
716
+ message: 'Describe the project-wide changes you want to apply:'
717
+ }]);
718
+ await utilityCommands.architect(archPrompt);
682
719
  }
683
720
 
684
721
  // Asking for next steps
@@ -787,6 +824,59 @@ Run \`gmpilot --help\` for a full list of commands.
787
824
  logger.success('Ambient soundscape exported to ./assets/audio/env/');
788
825
  },
789
826
 
827
+ architect: async (prompt: string) => {
828
+ const spinner = ora('Analyzing project structure and planning modifications...').start();
829
+ try {
830
+ const files = projectManager.scanFiles();
831
+ const summary = projectManager.getSummary();
832
+
833
+ const aiPrompt = `Project Status:\n${summary}\n\nExisting Files:\n${files.join('\n')}\n\nTask: ${prompt}\n\nAs a Game Design Architect and Senior Engineer, propose necessary file changes (Create, Update, or Delete). Return the changes in a valid JSON array format: [{"path": "string", "content": "string", "action": "create"|"update"|"delete"}]`;
834
+
835
+ const response = await AIService.chat(aiPrompt);
836
+ spinner.stop();
837
+
838
+ // Simple JSON extraction (assuming AI returns markdown block or raw JSON)
839
+ const jsonStart = response.indexOf('[');
840
+ const jsonEnd = response.lastIndexOf(']') + 1;
841
+ if (jsonStart === -1 || jsonEnd === 0) {
842
+ logger.error('Failed to parse AI-proposed changes. Response was not in expected JSON format.');
843
+ console.log(response);
844
+ return;
845
+ }
846
+
847
+ const changes = JSON.parse(response.substring(jsonStart, jsonEnd));
848
+ logger.info(`\n--- 🏗️ Project Architect: Proposing ${changes.length} Changes ---`);
849
+
850
+ const results = projectManager.applyChanges(changes);
851
+ results.forEach(res => {
852
+ if (res.startsWith('Error')) logger.error(res);
853
+ else logger.success(res);
854
+ });
855
+
856
+ projectManager.addEntry('Project Architect Modification', `Prompt: ${prompt}\nChanges Applied:\n${results.join('\n')}`);
857
+ } catch (err: any) {
858
+ spinner.stop();
859
+ logger.error(`Architectural Error: ${err.message}`);
860
+ }
861
+ },
862
+
863
+ playtest: async () => {
864
+ const spinner = ora('Engaging AI Playtester...').start();
865
+ try {
866
+ const summary = projectManager.getSummary();
867
+ const response = await AIService.chat(`As a Senior QA Lead, perform a deep "mental playtest" of the following game project:\n${summary}\n\nProvide critical feedback on: 1. Gameplay Loops, 2. Narrative Coherence, 3. Potential Balancing Issues. Identify one "Killer Feature" and one "Critical Risk".`);
868
+ spinner.stop();
869
+ logger.bold('\n--- 🎮 AI PLAYTEST REPORT (Mastery Level) ---');
870
+ console.log(response);
871
+
872
+ projectManager.addEntry('Playtest Feedback', response);
873
+ logger.success('Playtest results archived in project memory.');
874
+ } catch (err: any) {
875
+ spinner.stop();
876
+ logger.error(err.message);
877
+ }
878
+ },
879
+
790
880
  ecoChaos: async () => {
791
881
  logger.info('Starting Game Economy Chaos Simulation (Stress Test)...');
792
882
  logger.info('Testing hyper-inflation... Simulating rare drop exploits...');
package/src/index.ts CHANGED
@@ -12,7 +12,7 @@ const program = new Command();
12
12
  program
13
13
  .name('gmpilot')
14
14
  .description('GameMindPilot CLI - Your AI Game Development Assistant')
15
- .version('2.9.7');
15
+ .version('3.1.0');
16
16
 
17
17
  import { loginCommand } from './commands/login';
18
18
  import { chatCommand } from './commands/chat';
@@ -128,12 +128,22 @@ assets
128
128
  .description('Generate particle system parameters')
129
129
  .action(assetCommands.vfx);
130
130
 
131
+ assets
132
+ .command('all')
133
+ .description('Generate a complete asset suite (Mastery Level)')
134
+ .action(assetCommands.all);
135
+
131
136
  program
132
137
  .command('script')
133
138
  .description('Generate code for Unity, Unreal, Godot')
134
139
  .option('-e, --engine <type>', 'Target engine (unity, unreal, godot)', 'unity')
135
140
  .action((options) => assetCommands.script(options.engine));
136
141
 
142
+ program
143
+ .command('scaffold <engine>')
144
+ .description('Generate complete game system boilerplate for specific engines')
145
+ .action((engine) => assetCommands.scaffold(engine));
146
+
137
147
  program
138
148
  .command('blueprint')
139
149
  .description('Generate complete game system boilerplate')
@@ -200,9 +210,14 @@ program
200
210
  .action(() => logger.info('Heatmap visualization requires integrated telemetry data...'));
201
211
 
202
212
  program
203
- .command('playtest-reports')
204
- .description('Generate automated playtest summaries')
205
- .action(() => logger.info('Analyzing playtest data logs...'));
213
+ .command('playtest')
214
+ .description('Launch real-time AI playtester for feedback loops')
215
+ .action(utilityCommands.playtest);
216
+
217
+ program
218
+ .command('architect <prompt>')
219
+ .description('Autonomous Project Architect: Analyze and modify project structure')
220
+ .action((prompt) => utilityCommands.architect(prompt));
206
221
 
207
222
  program
208
223
  .command('docs-gen')
@@ -431,9 +446,10 @@ program
431
446
 
432
447
  // Expansion Wave 9 (Visual Command Center)
433
448
  program
434
- .command('web-view')
449
+ .command('dashboard')
450
+ .alias('web-view')
435
451
  .description('Launch local browser-based project dashboard')
436
- .action(utilityCommands.webView);
452
+ .action(utilityCommands.dashboard);
437
453
 
438
454
  program
439
455
  .command('plugin-publish')
@@ -57,13 +57,9 @@ export const projectManager = {
57
57
  timestamp: new Date().toISOString(),
58
58
  content
59
59
  });
60
- // Keep only last 10 entries to avoid token bloat
61
- if (context.history.length > 10) {
62
- context.history = context.history.slice(-10);
63
- }
64
60
  fs.writeFileSync(CONTEXT_FILE, JSON.stringify(context, null, 2));
65
61
  } catch (err) {
66
- // Silent fail to avoid crashing the main command flow
62
+ // Silent fail
67
63
  }
68
64
  },
69
65
 
@@ -73,13 +69,91 @@ export const projectManager = {
73
69
  const context = projectManager.get();
74
70
  if (context.history.length === 0) return "No previous history found for this project.";
75
71
 
76
- let summary = `Project: ${context.projectName} (Author: ${context.author})\n\nRecent History:\n`;
72
+ let summary = `Project: ${context.projectName} (Author: ${context.author})\n\nFull Project History:\n`;
77
73
  context.history.forEach((entry, i) => {
78
- summary += `[${i+1}] ${entry.type} (${new Date(entry.timestamp).toLocaleString()}):\n${entry.content.substring(0, 3000)}...\n\n`;
74
+ summary += `--- Entry [${i+1}]: ${entry.type} (${new Date(entry.timestamp).toLocaleString()}) ---\n${entry.content}\n\n`;
79
75
  });
80
76
  return summary;
81
77
  } catch (err) {
82
78
  return "Error loading project history.";
83
79
  }
80
+ },
81
+
82
+ exportGDD: (): string | null => {
83
+ try {
84
+ if (!projectManager.isProject()) return null;
85
+ const context = projectManager.get();
86
+ const timestamp = new Date().toISOString().split('T')[0];
87
+ const filename = `GDD_${context.projectName}_${timestamp}.md`;
88
+ const filepath = path.join(process.cwd(), filename);
89
+
90
+ let content = `# Game Design Document: ${context.projectName}\n`;
91
+ content += `**Author:** ${context.author}\n`;
92
+ content += `**Generated By:** GameMindPilot AI\n`;
93
+ content += `**Date:** ${new Date().toLocaleString()}\n\n`;
94
+ content += `--- \n\n`;
95
+ content += `## 🏁 Executive Summary\n`;
96
+ content += `This document contains the collected wisdom and designs for ${context.projectName}, generated through an AI-guided collaboration.\n\n`;
97
+
98
+ context.history.forEach((entry) => {
99
+ content += `## 📋 ${entry.type}\n`;
100
+ content += `*Generated on ${new Date(entry.timestamp).toLocaleString()}*\n\n`;
101
+ content += `${entry.content}\n\n`;
102
+ content += `---\n\n`;
103
+ });
104
+
105
+ content += `\n*End of Document. Generated with GameMindPilot v3.0.0*\n`;
106
+
107
+ fs.writeFileSync(filepath, content);
108
+ return filepath;
109
+ } catch (err) {
110
+ return null;
111
+ }
112
+ },
113
+
114
+ scanFiles(dir: string = process.cwd(), fileList: string[] = []): string[] {
115
+ const ignored = ['node_modules', '.git', '.gmpilot', 'dist', 'package-lock.json', 'package.json', 'tsconfig.json'];
116
+ try {
117
+ const files = fs.readdirSync(dir);
118
+ files.forEach(file => {
119
+ const filePath = path.join(dir, file);
120
+ const relPath = path.relative(process.cwd(), filePath);
121
+
122
+ if (ignored.some(i => relPath.includes(i) || file === i)) return;
123
+
124
+ if (fs.statSync(filePath).isDirectory()) {
125
+ this.scanFiles(filePath, fileList);
126
+ } else {
127
+ fileList.push(relPath);
128
+ }
129
+ });
130
+ } catch (e) {}
131
+ return fileList;
132
+ },
133
+
134
+ applyChanges(changes: any[]) {
135
+ const results: string[] = [];
136
+ changes.forEach(change => {
137
+ const fullPath = path.join(process.cwd(), change.path);
138
+ const dir = path.dirname(fullPath);
139
+
140
+ try {
141
+ if (change.action === 'delete') {
142
+ if (fs.existsSync(fullPath)) {
143
+ fs.unlinkSync(fullPath);
144
+ results.push(`Deleted: ${change.path}`);
145
+ }
146
+ } else {
147
+ if (!fs.existsSync(dir)) {
148
+ fs.mkdirSync(dir, { recursive: true });
149
+ }
150
+ fs.writeFileSync(fullPath, change.content);
151
+ results.push(`${change.action === 'create' ? 'Created' : 'Updated'}: ${change.path}`);
152
+ }
153
+ } catch (err: any) {
154
+ results.push(`Error on ${change.path}: ${err.message}`);
155
+ }
156
+ });
157
+ return results;
84
158
  }
85
159
  };