@wundr.io/cli 1.0.0 → 1.0.3

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 (224) hide show
  1. package/README.md +696 -280
  2. package/dist/ai/ai-service.d.ts +2 -2
  3. package/dist/ai/ai-service.d.ts.map +1 -1
  4. package/dist/ai/ai-service.js +1 -1
  5. package/dist/ai/ai-service.js.map +1 -1
  6. package/dist/ai/claude-client.d.ts.map +1 -1
  7. package/dist/ai/claude-client.js +2 -1
  8. package/dist/ai/claude-client.js.map +1 -1
  9. package/dist/ai/conversation-manager.d.ts +2 -2
  10. package/dist/ai/conversation-manager.d.ts.map +1 -1
  11. package/dist/ai/conversation-manager.js +5 -3
  12. package/dist/ai/conversation-manager.js.map +1 -1
  13. package/dist/cli.d.ts.map +1 -1
  14. package/dist/cli.js +32 -13
  15. package/dist/cli.js.map +1 -1
  16. package/dist/commands/ai.d.ts +3 -3
  17. package/dist/commands/ai.d.ts.map +1 -1
  18. package/dist/commands/ai.js +2 -2
  19. package/dist/commands/ai.js.map +1 -1
  20. package/dist/commands/alignment.d.ts +78 -0
  21. package/dist/commands/alignment.d.ts.map +1 -0
  22. package/dist/commands/alignment.js +817 -0
  23. package/dist/commands/alignment.js.map +1 -0
  24. package/dist/commands/analyze-optimized.d.ts.map +1 -1
  25. package/dist/commands/analyze-optimized.js +9 -6
  26. package/dist/commands/analyze-optimized.js.map +1 -1
  27. package/dist/commands/analyze.d.ts +3 -3
  28. package/dist/commands/analyze.d.ts.map +1 -1
  29. package/dist/commands/analyze.js +2 -2
  30. package/dist/commands/analyze.js.map +1 -1
  31. package/dist/commands/batch.d.ts +3 -3
  32. package/dist/commands/batch.d.ts.map +1 -1
  33. package/dist/commands/batch.js +7 -7
  34. package/dist/commands/batch.js.map +1 -1
  35. package/dist/commands/chat.d.ts +3 -3
  36. package/dist/commands/chat.d.ts.map +1 -1
  37. package/dist/commands/chat.js +3 -3
  38. package/dist/commands/chat.js.map +1 -1
  39. package/dist/commands/claude-init.d.ts +1 -1
  40. package/dist/commands/claude-init.d.ts.map +1 -1
  41. package/dist/commands/claude-init.js +11 -7
  42. package/dist/commands/claude-init.js.map +1 -1
  43. package/dist/commands/claude-setup.d.ts +88 -1
  44. package/dist/commands/claude-setup.d.ts.map +1 -1
  45. package/dist/commands/claude-setup.js +549 -46
  46. package/dist/commands/claude-setup.js.map +1 -1
  47. package/dist/commands/computer-setup-commands.d.ts +17 -3
  48. package/dist/commands/computer-setup-commands.d.ts.map +1 -1
  49. package/dist/commands/computer-setup-commands.js +145 -3
  50. package/dist/commands/computer-setup-commands.js.map +1 -1
  51. package/dist/commands/computer-setup.d.ts.map +1 -1
  52. package/dist/commands/computer-setup.js +372 -4
  53. package/dist/commands/computer-setup.js.map +1 -1
  54. package/dist/commands/create-command.d.ts.map +1 -1
  55. package/dist/commands/create-command.js +3 -3
  56. package/dist/commands/create-command.js.map +1 -1
  57. package/dist/commands/create.d.ts +3 -3
  58. package/dist/commands/create.d.ts.map +1 -1
  59. package/dist/commands/create.js +3 -3
  60. package/dist/commands/create.js.map +1 -1
  61. package/dist/commands/dashboard.d.ts +3 -3
  62. package/dist/commands/dashboard.d.ts.map +1 -1
  63. package/dist/commands/dashboard.js +4 -3
  64. package/dist/commands/dashboard.js.map +1 -1
  65. package/dist/commands/govern.d.ts +3 -3
  66. package/dist/commands/govern.d.ts.map +1 -1
  67. package/dist/commands/govern.js +4 -3
  68. package/dist/commands/govern.js.map +1 -1
  69. package/dist/commands/governance.d.ts +17 -0
  70. package/dist/commands/governance.d.ts.map +1 -0
  71. package/dist/commands/governance.js +703 -0
  72. package/dist/commands/governance.js.map +1 -0
  73. package/dist/commands/guardian.d.ts +20 -0
  74. package/dist/commands/guardian.d.ts.map +1 -0
  75. package/dist/commands/guardian.js +597 -0
  76. package/dist/commands/guardian.js.map +1 -0
  77. package/dist/commands/init.d.ts +7 -3
  78. package/dist/commands/init.d.ts.map +1 -1
  79. package/dist/commands/init.js +71 -5
  80. package/dist/commands/init.js.map +1 -1
  81. package/dist/commands/performance-optimizer.d.ts +2 -2
  82. package/dist/commands/performance-optimizer.d.ts.map +1 -1
  83. package/dist/commands/performance-optimizer.js +8 -7
  84. package/dist/commands/performance-optimizer.js.map +1 -1
  85. package/dist/commands/plugins.d.ts +3 -3
  86. package/dist/commands/plugins.d.ts.map +1 -1
  87. package/dist/commands/plugins.js +2 -2
  88. package/dist/commands/plugins.js.map +1 -1
  89. package/dist/commands/rag.d.ts +7 -0
  90. package/dist/commands/rag.d.ts.map +1 -0
  91. package/dist/commands/rag.js +748 -0
  92. package/dist/commands/rag.js.map +1 -0
  93. package/dist/commands/session.d.ts +41 -0
  94. package/dist/commands/session.d.ts.map +1 -0
  95. package/dist/commands/session.js +441 -0
  96. package/dist/commands/session.js.map +1 -0
  97. package/dist/commands/setup.d.ts +3 -3
  98. package/dist/commands/setup.d.ts.map +1 -1
  99. package/dist/commands/setup.js +1 -3
  100. package/dist/commands/setup.js.map +1 -1
  101. package/dist/commands/test-init.d.ts.map +1 -1
  102. package/dist/commands/test-init.js +2 -2
  103. package/dist/commands/test-init.js.map +1 -1
  104. package/dist/commands/test.d.ts.map +1 -1
  105. package/dist/commands/test.js +2 -2
  106. package/dist/commands/test.js.map +1 -1
  107. package/dist/commands/vp.d.ts +7 -0
  108. package/dist/commands/vp.d.ts.map +1 -0
  109. package/dist/commands/vp.js +571 -0
  110. package/dist/commands/vp.js.map +1 -0
  111. package/dist/commands/watch.d.ts +3 -3
  112. package/dist/commands/watch.d.ts.map +1 -1
  113. package/dist/commands/watch.js +10 -7
  114. package/dist/commands/watch.js.map +1 -1
  115. package/dist/commands/worktree.d.ts +63 -0
  116. package/dist/commands/worktree.d.ts.map +1 -0
  117. package/dist/commands/worktree.js +774 -0
  118. package/dist/commands/worktree.js.map +1 -0
  119. package/dist/context/context-manager.d.ts +1 -1
  120. package/dist/context/context-manager.d.ts.map +1 -1
  121. package/dist/context/context-manager.js +1 -1
  122. package/dist/context/context-manager.js.map +1 -1
  123. package/dist/context/session-manager.d.ts +2 -2
  124. package/dist/context/session-manager.d.ts.map +1 -1
  125. package/dist/context/session-manager.js +9 -5
  126. package/dist/context/session-manager.js.map +1 -1
  127. package/dist/index.d.ts.map +1 -1
  128. package/dist/index.js +1 -1
  129. package/dist/index.js.map +1 -1
  130. package/dist/interactive/interactive-mode.d.ts +2 -2
  131. package/dist/interactive/interactive-mode.d.ts.map +1 -1
  132. package/dist/interactive/interactive-mode.js +6 -4
  133. package/dist/interactive/interactive-mode.js.map +1 -1
  134. package/dist/nlp/command-mapper.d.ts +1 -1
  135. package/dist/nlp/command-mapper.d.ts.map +1 -1
  136. package/dist/nlp/command-mapper.js +3 -2
  137. package/dist/nlp/command-mapper.js.map +1 -1
  138. package/dist/nlp/command-parser.d.ts +1 -1
  139. package/dist/nlp/command-parser.d.ts.map +1 -1
  140. package/dist/nlp/command-parser.js +2 -1
  141. package/dist/nlp/command-parser.js.map +1 -1
  142. package/dist/nlp/intent-parser.d.ts +1 -1
  143. package/dist/nlp/intent-parser.d.ts.map +1 -1
  144. package/dist/nlp/intent-parser.js +14 -9
  145. package/dist/nlp/intent-parser.js.map +1 -1
  146. package/dist/plugins/plugin-manager.d.ts +2 -2
  147. package/dist/plugins/plugin-manager.d.ts.map +1 -1
  148. package/dist/plugins/plugin-manager.js +3 -3
  149. package/dist/plugins/plugin-manager.js.map +1 -1
  150. package/dist/types/index.d.ts +1 -1
  151. package/dist/types/index.d.ts.map +1 -1
  152. package/dist/utils/backup-rollback-manager.d.ts +72 -0
  153. package/dist/utils/backup-rollback-manager.d.ts.map +1 -0
  154. package/dist/utils/backup-rollback-manager.js +289 -0
  155. package/dist/utils/backup-rollback-manager.js.map +1 -0
  156. package/dist/utils/claude-config-installer.d.ts +94 -0
  157. package/dist/utils/claude-config-installer.d.ts.map +1 -0
  158. package/dist/utils/claude-config-installer.js +628 -0
  159. package/dist/utils/claude-config-installer.js.map +1 -0
  160. package/dist/utils/config-manager.d.ts +1 -1
  161. package/dist/utils/config-manager.d.ts.map +1 -1
  162. package/dist/utils/config-manager.js +5 -5
  163. package/dist/utils/config-manager.js.map +1 -1
  164. package/dist/utils/error-handler.d.ts +1 -1
  165. package/dist/utils/error-handler.d.ts.map +1 -1
  166. package/dist/utils/error-handler.js.map +1 -1
  167. package/dist/utils/logger.d.ts +1 -1
  168. package/dist/utils/logger.d.ts.map +1 -1
  169. package/dist/utils/logger.js +22 -11
  170. package/dist/utils/logger.js.map +1 -1
  171. package/package.json +26 -7
  172. package/src/ai/ai-service.ts +22 -19
  173. package/src/ai/claude-client.ts +20 -16
  174. package/src/ai/conversation-manager.ts +37 -30
  175. package/src/cli.ts +42 -13
  176. package/src/commands/ai.ts +59 -57
  177. package/src/commands/alignment.ts +1212 -0
  178. package/src/commands/analyze-optimized.ts +70 -62
  179. package/src/commands/analyze.ts +22 -20
  180. package/src/commands/batch.ts +41 -38
  181. package/src/commands/chat.ts +37 -34
  182. package/src/commands/claude-init.ts +38 -30
  183. package/src/commands/claude-setup.ts +692 -97
  184. package/src/commands/computer-setup-commands.ts +203 -37
  185. package/src/commands/computer-setup.ts +474 -4
  186. package/src/commands/create-command.ts +7 -7
  187. package/src/commands/create.ts +36 -33
  188. package/src/commands/dashboard.ts +33 -28
  189. package/src/commands/govern.ts +34 -29
  190. package/src/commands/governance.ts +1005 -0
  191. package/src/commands/guardian.ts +887 -0
  192. package/src/commands/init.ts +112 -22
  193. package/src/commands/performance-optimizer.ts +48 -42
  194. package/src/commands/plugins.ts +35 -32
  195. package/src/commands/project-update.ts +1053 -0
  196. package/src/commands/rag.ts +904 -0
  197. package/src/commands/session.ts +631 -0
  198. package/src/commands/setup.ts +35 -31
  199. package/src/commands/test-init.ts +6 -5
  200. package/src/commands/test.ts +7 -6
  201. package/src/commands/vp.ts +762 -0
  202. package/src/commands/watch.ts +44 -33
  203. package/src/commands/worktree.ts +1057 -0
  204. package/src/context/context-manager.ts +15 -12
  205. package/src/context/session-manager.ts +51 -40
  206. package/src/index.ts +7 -6
  207. package/src/interactive/interactive-mode.ts +25 -18
  208. package/src/lib/conflict-resolution.ts +28 -0
  209. package/src/lib/merge-strategy.ts +28 -0
  210. package/src/lib/safety-mechanisms.ts +47 -0
  211. package/src/lib/state-detection.ts +28 -0
  212. package/src/nlp/command-mapper.ts +35 -30
  213. package/src/nlp/command-parser.ts +20 -17
  214. package/src/nlp/intent-classifier.ts +7 -7
  215. package/src/nlp/intent-parser.ts +61 -49
  216. package/src/plugins/plugin-manager.ts +27 -23
  217. package/src/tests/computer-setup-integration.test.ts +439 -0
  218. package/src/types/index.ts +1 -1
  219. package/src/types/modules.d.ts +1 -0
  220. package/src/utils/backup-rollback-manager.ts +363 -0
  221. package/src/utils/claude-config-installer.ts +734 -0
  222. package/src/utils/config-manager.ts +12 -9
  223. package/src/utils/error-handler.ts +5 -3
  224. package/src/utils/logger.ts +35 -12
@@ -3,11 +3,14 @@
3
3
  * Integrates new-starter functionality into the unified wundr CLI
4
4
  */
5
5
 
6
- import { Command } from 'commander';
6
+ import { ComputerSetupManager } from '@wundr.io/computer-setup';
7
7
  import chalk from 'chalk';
8
- import ora from 'ora';
8
+ import { Command } from 'commander';
9
+ import * as fs from 'fs/promises';
9
10
  import inquirer from 'inquirer';
10
- import { ComputerSetupManager } from '@wundr.io/computer-setup';
11
+ import * as os from 'os';
12
+ import ora from 'ora';
13
+ import * as path from 'path';
11
14
  // import { getLogger } from '@wundr/core';
12
15
  const logger = { info: console.log, error: console.error, warn: console.warn };
13
16
 
@@ -199,7 +202,24 @@ async function runComputerSetup(options: any): Promise<void> {
199
202
  }
200
203
 
201
204
  if (result.report) {
202
- console.log(chalk.cyan(`\n📄 Setup report generated successfully`));
205
+ console.log(chalk.cyan('\n📄 Setup report generated successfully'));
206
+ }
207
+
208
+ // Set up Fleet Mode if enabled
209
+ if (profile.preferences?.aiTools?.fleetMode) {
210
+ try {
211
+ await setupFleetMode(profile as DeveloperProfile);
212
+ } catch (fleetError) {
213
+ console.error(
214
+ chalk.red('\n⚠️ Fleet Mode setup encountered issues:'),
215
+ fleetError
216
+ );
217
+ console.log(
218
+ chalk.yellow(
219
+ 'You can retry with: wundr computer-setup --profile <your-profile>'
220
+ )
221
+ );
222
+ }
203
223
  }
204
224
 
205
225
  // Display next steps
@@ -311,6 +331,13 @@ async function createInteractiveProfile(): Promise<any> {
311
331
  'Do you want to set up AI development tools (Claude Code, Claude Flow)?',
312
332
  default: true,
313
333
  },
334
+ {
335
+ type: 'confirm',
336
+ name: 'fleetMode',
337
+ message: 'Enable Fleet-Scale Autonomous Engineering mode?',
338
+ default: false,
339
+ when: (answers: any) => answers.aiTools,
340
+ },
314
341
  {
315
342
  type: 'confirm',
316
343
  name: 'slack',
@@ -342,6 +369,7 @@ async function createInteractiveProfile(): Promise<any> {
342
369
  mcpTools: answers.aiTools ? ['all'] : [],
343
370
  swarmAgents: answers.aiTools ? ['default'] : [],
344
371
  memoryAllocation: '2GB',
372
+ fleetMode: answers.fleetMode || false,
345
373
  },
346
374
  },
347
375
  tools: {
@@ -425,6 +453,448 @@ function buildLanguageConfig(languages: string[]): any {
425
453
  return config;
426
454
  }
427
455
 
456
+ /**
457
+ * Developer profile interface with fleet mode support
458
+ */
459
+ interface DeveloperProfile {
460
+ name: string;
461
+ email: string;
462
+ role: string;
463
+ team?: string;
464
+ preferences: {
465
+ shell: string;
466
+ editor: string;
467
+ theme: string;
468
+ gitConfig: {
469
+ userName: string;
470
+ userEmail: string;
471
+ signCommits: boolean;
472
+ defaultBranch: string;
473
+ aliases: Record<string, string>;
474
+ };
475
+ aiTools: {
476
+ claudeCode: boolean;
477
+ claudeFlow: boolean;
478
+ mcpTools: string[];
479
+ swarmAgents: string[];
480
+ memoryAllocation: string;
481
+ fleetMode: boolean;
482
+ };
483
+ };
484
+ tools: Record<string, unknown>;
485
+ }
486
+
487
+ /**
488
+ * Sets up Fleet-Scale Autonomous Engineering mode
489
+ * Installs VP Daemon scripts, Memory Bank templates, and IPRE governance defaults
490
+ */
491
+ async function setupFleetMode(profile: DeveloperProfile): Promise<void> {
492
+ const wundrDir = path.join(os.homedir(), '.wundr');
493
+ const vpDaemonDir = path.join(wundrDir, 'vp-daemon');
494
+ const governanceDir = path.join(wundrDir, 'governance');
495
+ const templatesDir = path.join(wundrDir, 'templates');
496
+
497
+ console.log(
498
+ chalk.cyan('\n🚀 Setting up Fleet-Scale Autonomous Engineering mode...\n')
499
+ );
500
+
501
+ // Create directory structure
502
+ await fs.mkdir(vpDaemonDir, { recursive: true });
503
+ await fs.mkdir(governanceDir, { recursive: true });
504
+ await fs.mkdir(path.join(templatesDir, 'memory-bank'), { recursive: true });
505
+ await fs.mkdir(path.join(templatesDir, 'sub-agents'), { recursive: true });
506
+
507
+ // 1. Install VP Daemon configuration
508
+ const vpConfig = {
509
+ version: '1.0.0',
510
+ identity: {
511
+ name: profile.name,
512
+ email: profile.email,
513
+ role: 'VP-Supervisor',
514
+ },
515
+ resourceLimits: {
516
+ maxSessions: 10,
517
+ tokenBudget: {
518
+ subscription: 0.8, // 80% for VP & Session Managers
519
+ api: 0.2, // 20% for sub-agent swarms
520
+ },
521
+ },
522
+ systemLimits: {
523
+ fileDescriptors: 65000,
524
+ diskSpaceBufferGB: 10,
525
+ maxWorktreesPerMachine: 200,
526
+ },
527
+ measurableObjectives: {
528
+ responseTime: '<30s to Slack mentions',
529
+ rateLimit: "Zero 'Rate Limit Exceeded' per week",
530
+ routingAccuracy: '100% correct task routing',
531
+ },
532
+ hardConstraints: [
533
+ 'Never exhaust API quota',
534
+ 'Always maintain audit trail',
535
+ 'Escalate blocked requests within 5 minutes',
536
+ ],
537
+ };
538
+
539
+ await fs.writeFile(
540
+ path.join(vpDaemonDir, 'config.yaml'),
541
+ generateYamlContent(vpConfig),
542
+ 'utf-8'
543
+ );
544
+ console.log(chalk.green(' ✓ VP Daemon configuration installed'));
545
+
546
+ // 2. Copy VP Charter template
547
+ const vpCharter = `---
548
+ name: vp-supervisor
549
+ role: Tier1-VP
550
+ identity:
551
+ name: '${profile.name}'
552
+ email: '${profile.email}'
553
+ slackHandle: '@vp-supervisor'
554
+
555
+ responsibilities:
556
+ - triage_requests
557
+ - manage_session_lifecycle
558
+ - allocate_token_budget
559
+ - human_communication
560
+ - fleet_status_reporting
561
+
562
+ resourceLimits:
563
+ maxSessions: 10
564
+ tokenBudget:
565
+ subscription: 80%
566
+ api: 20%
567
+
568
+ measurableObjectives:
569
+ responseTime: '<30s to Slack mentions'
570
+ rateLimit: "Zero 'Rate Limit Exceeded' per week"
571
+ routingAccuracy: '100% correct task routing'
572
+
573
+ hardConstraints:
574
+ - 'Never exhaust API quota'
575
+ - 'Always maintain audit trail'
576
+ - 'Escalate blocked requests within 5 minutes'
577
+ ---
578
+ `;
579
+
580
+ await fs.writeFile(
581
+ path.join(vpDaemonDir, 'vp-charter.md'),
582
+ vpCharter,
583
+ 'utf-8'
584
+ );
585
+ console.log(chalk.green(' ✓ VP Charter template deployed'));
586
+
587
+ // 3. Set up token budgeting configuration
588
+ const tokenBudgetConfig = {
589
+ version: '1.0.0',
590
+ subscription: {
591
+ type: 'claude-code-max-20x',
592
+ promptsPerFiveHours: 800,
593
+ warningThreshold: 0.8,
594
+ criticalThreshold: 0.95,
595
+ },
596
+ api: {
597
+ monthlyBudget: 500,
598
+ haikuRatePerMillion: 0.25,
599
+ sonnetRatePerMillion: 3.0,
600
+ },
601
+ modelAllocation: {
602
+ tier1: {
603
+ model: 'claude-3-5-sonnet',
604
+ source: 'subscription',
605
+ priority: 'critical',
606
+ },
607
+ tier2: {
608
+ model: 'claude-3-5-sonnet',
609
+ source: 'subscription',
610
+ priority: 'high',
611
+ },
612
+ tier3: {
613
+ model: 'claude-3-5-haiku',
614
+ source: 'api',
615
+ priority: 'normal',
616
+ },
617
+ },
618
+ throttlingPolicy: {
619
+ onWarning: ['pause_non_critical_sessions', 'queue_new_requests'],
620
+ onCritical: ['pause_all_except_critical', 'notify_vp_human'],
621
+ },
622
+ };
623
+
624
+ await fs.writeFile(
625
+ path.join(vpDaemonDir, 'token-budget.yaml'),
626
+ generateYamlContent(tokenBudgetConfig),
627
+ 'utf-8'
628
+ );
629
+ console.log(chalk.green(' ✓ Token budgeting configuration set up'));
630
+
631
+ // 4. Deploy Memory Bank templates
632
+ const sessionTemplate = `# Active Context - Session {{SESSION_ID}}
633
+
634
+ ## Current Focus
635
+ <!-- Updated by session manager -->
636
+
637
+ ## Working Memory
638
+ - Last action:
639
+ - Next planned step:
640
+ - Blockers:
641
+
642
+ ## Context Window State
643
+ - Tokens used: X / 200,000
644
+ - Compression needed: Yes/No
645
+
646
+ ## Handoff Notes
647
+ <!-- For session resumption -->
648
+ `;
649
+
650
+ const progressTemplate = `# Progress Tracker - Session {{SESSION_ID}}
651
+
652
+ ## Milestones
653
+ | Status | Milestone | Target Date | Notes |
654
+ |--------|-----------|-------------|-------|
655
+
656
+ ## Completed Tasks
657
+ <!-- Archive of completed work -->
658
+
659
+ ## Blockers
660
+ <!-- Current impediments -->
661
+ `;
662
+
663
+ const subAgentDelegationTemplate = `# Sub-Agent Delegation Tracker
664
+
665
+ ## Active Sub-Agents
666
+ | ID | Type | Task | Status | Worktree | Started |
667
+ |----|------|------|--------|----------|---------|
668
+
669
+ ## Completed Tasks
670
+ <!-- Archive of completed sub-agent work -->
671
+
672
+ ## Resource Usage
673
+ - Active worktrees: X / 20
674
+ - API calls (session): X
675
+ `;
676
+
677
+ const ipreAlignmentTemplate = `# IPRE Alignment State
678
+
679
+ ## Active Policies
680
+ <!-- Hard constraints for this session -->
681
+
682
+ ## Reward Weights
683
+ \`\`\`yaml
684
+ customer_value: 0.35
685
+ code_quality: 0.30
686
+ timeline: 0.20
687
+ technical_debt: 0.15
688
+ \`\`\`
689
+
690
+ ## Alignment Score
691
+ - Current: 85/100
692
+ - Last evaluation: {{TIMESTAMP}}
693
+ - Trend: Improving
694
+
695
+ ## Escalation History
696
+ <!-- Guardian review log -->
697
+ `;
698
+
699
+ await fs.writeFile(
700
+ path.join(templatesDir, 'memory-bank', 'activeContext.md'),
701
+ sessionTemplate,
702
+ 'utf-8'
703
+ );
704
+ await fs.writeFile(
705
+ path.join(templatesDir, 'memory-bank', 'progress.md'),
706
+ progressTemplate,
707
+ 'utf-8'
708
+ );
709
+ await fs.writeFile(
710
+ path.join(templatesDir, 'memory-bank', 'subAgentDelegation.md'),
711
+ subAgentDelegationTemplate,
712
+ 'utf-8'
713
+ );
714
+ await fs.writeFile(
715
+ path.join(templatesDir, 'memory-bank', 'ipre-alignment.md'),
716
+ ipreAlignmentTemplate,
717
+ 'utf-8'
718
+ );
719
+ console.log(chalk.green(' ✓ Memory Bank templates deployed'));
720
+
721
+ // 5. Initialize IPRE governance defaults
722
+ const ipreDefaults = {
723
+ version: '1.0.0',
724
+ intent: {
725
+ mission: 'Deliver high-quality software that solves customer problems',
726
+ values: [
727
+ 'customer_first',
728
+ 'technical_excellence',
729
+ 'sustainable_velocity',
730
+ ],
731
+ },
732
+ policies: {
733
+ security: [
734
+ 'No secrets in code',
735
+ 'No SQL injection vulnerabilities',
736
+ 'No XSS attack vectors',
737
+ ],
738
+ compliance: [
739
+ 'All changes require PR review',
740
+ 'No force pushes to main/master',
741
+ 'Test coverage minimum 80%',
742
+ ],
743
+ operational: [
744
+ 'No deployments on Fridays after 2pm',
745
+ 'Rollback plan required for production changes',
746
+ ],
747
+ },
748
+ rewards: {
749
+ customer_value: 0.35,
750
+ code_quality: 0.25,
751
+ delivery_speed: 0.2,
752
+ technical_debt_reduction: 0.15,
753
+ documentation: 0.05,
754
+ },
755
+ evaluators: [
756
+ {
757
+ type: 'policy_compliance',
758
+ frequency: 'per_commit',
759
+ action: 'block_on_violation',
760
+ },
761
+ {
762
+ type: 'reward_alignment',
763
+ frequency: 'hourly',
764
+ threshold: 0.7,
765
+ action: 'escalate_to_guardian',
766
+ },
767
+ {
768
+ type: 'drift_detection',
769
+ frequency: 'daily',
770
+ patterns: ['reward_hacking', 'escalation_suppression'],
771
+ action: 'alert_architect',
772
+ },
773
+ ],
774
+ };
775
+
776
+ await fs.writeFile(
777
+ path.join(governanceDir, 'ipre-defaults.yaml'),
778
+ generateYamlContent(ipreDefaults),
779
+ 'utf-8'
780
+ );
781
+ console.log(chalk.green(' ✓ IPRE governance defaults initialized'));
782
+
783
+ // 6. Configure system resource limits guidance
784
+ const resourceGuidance = `# System Resource Configuration for Fleet Mode
785
+
786
+ ## File Descriptor Limits
787
+ For optimal fleet operation with up to 200 worktrees, configure:
788
+
789
+ ### macOS / Linux
790
+ \`\`\`bash
791
+ # Add to ~/.zshrc or ~/.bashrc
792
+ ulimit -n 65000
793
+ \`\`\`
794
+
795
+ ### Persistent Configuration (macOS)
796
+ \`\`\`bash
797
+ # Create /Library/LaunchDaemons/limit.maxfiles.plist with:
798
+ # soft limit: 65000
799
+ # hard limit: 200000
800
+ \`\`\`
801
+
802
+ ### Persistent Configuration (Linux)
803
+ \`\`\`bash
804
+ # Add to /etc/security/limits.conf
805
+ * soft nofile 65000
806
+ * hard nofile 200000
807
+ \`\`\`
808
+
809
+ ## Disk Space Requirements
810
+ - Minimum: 500GB SSD
811
+ - Recommended: 4TB+ SSD (for 200 worktrees at ~2GB each)
812
+ - Buffer: Keep 10GB free at all times
813
+
814
+ ## Git Worktree Best Practices
815
+ - Session Managers sync with remote (fetch/pull)
816
+ - Sub-Agents rarely git fetch (reduces index lock contention)
817
+ - Use fractional worktree pattern:
818
+ - Read-only agents: Share Session Manager's worktree
819
+ - Write-access agents: Get dedicated worktrees
820
+
821
+ ## Monitoring Commands
822
+ \`\`\`bash
823
+ # Check current file descriptor limit
824
+ ulimit -n
825
+
826
+ # Check open files
827
+ lsof | wc -l
828
+
829
+ # Check disk space
830
+ df -h
831
+
832
+ # List active worktrees
833
+ git worktree list
834
+ \`\`\`
835
+ `;
836
+
837
+ await fs.writeFile(
838
+ path.join(wundrDir, 'RESOURCE_LIMITS.md'),
839
+ resourceGuidance,
840
+ 'utf-8'
841
+ );
842
+ console.log(chalk.green(' ✓ System resource limits guidance configured'));
843
+
844
+ console.log(
845
+ chalk.cyan('\n✅ Fleet-Scale Autonomous Engineering mode setup complete!\n')
846
+ );
847
+ console.log(chalk.white('Files created:'));
848
+ console.log(chalk.gray(' ~/.wundr/vp-daemon/config.yaml'));
849
+ console.log(chalk.gray(' ~/.wundr/vp-daemon/vp-charter.md'));
850
+ console.log(chalk.gray(' ~/.wundr/vp-daemon/token-budget.yaml'));
851
+ console.log(chalk.gray(' ~/.wundr/templates/memory-bank/'));
852
+ console.log(chalk.gray(' ~/.wundr/governance/ipre-defaults.yaml'));
853
+ console.log(chalk.gray(' ~/.wundr/RESOURCE_LIMITS.md'));
854
+ console.log(
855
+ chalk.yellow(
856
+ '\n⚠️ Review ~/.wundr/RESOURCE_LIMITS.md for system configuration recommendations.'
857
+ )
858
+ );
859
+ }
860
+
861
+ /**
862
+ * Simple YAML generator for configuration objects
863
+ */
864
+ function generateYamlContent(obj: Record<string, unknown>, indent = 0): string {
865
+ let yaml = '';
866
+ const spaces = ' '.repeat(indent);
867
+
868
+ for (const [key, value] of Object.entries(obj)) {
869
+ if (value === null || value === undefined) {
870
+ yaml += `${spaces}${key}: null\n`;
871
+ } else if (typeof value === 'object' && !Array.isArray(value)) {
872
+ yaml += `${spaces}${key}:\n`;
873
+ yaml += generateYamlContent(value as Record<string, unknown>, indent + 1);
874
+ } else if (Array.isArray(value)) {
875
+ yaml += `${spaces}${key}:\n`;
876
+ for (const item of value) {
877
+ if (typeof item === 'object') {
878
+ yaml += `${spaces} -\n`;
879
+ const itemYaml = generateYamlContent(
880
+ item as Record<string, unknown>,
881
+ indent + 2
882
+ );
883
+ yaml += itemYaml;
884
+ } else {
885
+ yaml += `${spaces} - '${item}'\n`;
886
+ }
887
+ }
888
+ } else if (typeof value === 'string') {
889
+ yaml += `${spaces}${key}: '${value}'\n`;
890
+ } else {
891
+ yaml += `${spaces}${key}: ${value}\n`;
892
+ }
893
+ }
894
+
895
+ return yaml;
896
+ }
897
+
428
898
  async function manageProfiles(): Promise<void> {
429
899
  const manager = new ComputerSetupManager();
430
900
  await manager.initialize();
@@ -3,10 +3,10 @@
3
3
  * Scaffolds new wundr-compliant projects
4
4
  */
5
5
 
6
- import { Command } from 'commander';
7
- import chalk from 'chalk';
8
- import { projectTemplates } from '@wundr/project-templates';
9
6
  import { getLogger } from '@wundr/core';
7
+ import { projectTemplates } from '@wundr/project-templates';
8
+ import chalk from 'chalk';
9
+ import { Command } from 'commander';
10
10
 
11
11
  const logger = getLogger('cli:create');
12
12
 
@@ -14,7 +14,7 @@ export const createCommand = new Command('create')
14
14
  .description('Create a new wundr-compliant project')
15
15
  .argument(
16
16
  '[type]',
17
- 'Project type (frontend|backend|fullstack|monorepo|library|cli)'
17
+ 'Project type (frontend|backend|fullstack|monorepo|library|cli)',
18
18
  )
19
19
  .argument('[name]', 'Project name')
20
20
  .option('-f, --framework <framework>', 'Framework to use')
@@ -76,8 +76,8 @@ export const createCommand = new Command('create')
76
76
  logger.error('Failed to create project', error);
77
77
  console.error(
78
78
  chalk.red(
79
- `\n❌ Error: ${error instanceof Error ? error.message : 'Unknown error'}`
80
- )
79
+ `\n❌ Error: ${error instanceof Error ? error.message : 'Unknown error'}`,
80
+ ),
81
81
  );
82
82
  process.exit(1);
83
83
  }
@@ -104,7 +104,7 @@ createCommand
104
104
  .option(
105
105
  '-f, --framework <framework>',
106
106
  'Framework (fastify|express|nestjs)',
107
- 'fastify'
107
+ 'fastify',
108
108
  )
109
109
  .action(async (name: string, options: any) => {
110
110
  await projectTemplates.createProject({