agentic-qe 1.8.4 → 1.9.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.
Files changed (212) hide show
  1. package/.claude/skills/agentic-jujutsu/SKILL.md +645 -0
  2. package/CHANGELOG.md +375 -0
  3. package/README.md +86 -18
  4. package/dist/App.d.ts +5 -0
  5. package/dist/App.d.ts.map +1 -0
  6. package/dist/App.js +15 -0
  7. package/dist/App.js.map +1 -0
  8. package/dist/cli/commands/constitution.d.ts +34 -0
  9. package/dist/cli/commands/constitution.d.ts.map +1 -0
  10. package/dist/cli/commands/constitution.js +679 -0
  11. package/dist/cli/commands/constitution.js.map +1 -0
  12. package/dist/cli/commands/init.d.ts +8 -75
  13. package/dist/cli/commands/init.d.ts.map +1 -1
  14. package/dist/cli/commands/init.js +22 -2292
  15. package/dist/cli/commands/init.js.map +1 -1
  16. package/dist/cli/commands/telemetry.d.ts +36 -0
  17. package/dist/cli/commands/telemetry.d.ts.map +1 -0
  18. package/dist/cli/commands/telemetry.js +364 -0
  19. package/dist/cli/commands/telemetry.js.map +1 -0
  20. package/dist/cli/index.js +66 -0
  21. package/dist/cli/index.js.map +1 -1
  22. package/dist/cli/init/agents.d.ts +22 -0
  23. package/dist/cli/init/agents.d.ts.map +1 -0
  24. package/dist/cli/init/agents.js +522 -0
  25. package/dist/cli/init/agents.js.map +1 -0
  26. package/dist/cli/init/bash-wrapper.d.ts +14 -0
  27. package/dist/cli/init/bash-wrapper.d.ts.map +1 -0
  28. package/dist/cli/init/bash-wrapper.js +47 -0
  29. package/dist/cli/init/bash-wrapper.js.map +1 -0
  30. package/dist/cli/init/claude-config.d.ts +24 -0
  31. package/dist/cli/init/claude-config.d.ts.map +1 -0
  32. package/dist/cli/init/claude-config.js +275 -0
  33. package/dist/cli/init/claude-config.js.map +1 -0
  34. package/dist/cli/init/claude-md.d.ts +19 -0
  35. package/dist/cli/init/claude-md.d.ts.map +1 -0
  36. package/dist/cli/init/claude-md.js +153 -0
  37. package/dist/cli/init/claude-md.js.map +1 -0
  38. package/dist/cli/init/commands.d.ts +6 -0
  39. package/dist/cli/init/commands.d.ts.map +1 -0
  40. package/dist/cli/init/commands.js +83 -0
  41. package/dist/cli/init/commands.js.map +1 -0
  42. package/dist/cli/init/database-init.d.ts +15 -0
  43. package/dist/cli/init/database-init.d.ts.map +1 -0
  44. package/dist/cli/init/database-init.js +203 -0
  45. package/dist/cli/init/database-init.js.map +1 -0
  46. package/dist/cli/init/directory-structure.d.ts +14 -0
  47. package/dist/cli/init/directory-structure.d.ts.map +1 -0
  48. package/dist/cli/init/directory-structure.js +107 -0
  49. package/dist/cli/init/directory-structure.js.map +1 -0
  50. package/dist/cli/init/documentation.d.ts +14 -0
  51. package/dist/cli/init/documentation.d.ts.map +1 -0
  52. package/dist/cli/init/documentation.js +195 -0
  53. package/dist/cli/init/documentation.js.map +1 -0
  54. package/dist/cli/init/fleet-config.d.ts +34 -0
  55. package/dist/cli/init/fleet-config.d.ts.map +1 -0
  56. package/dist/cli/init/fleet-config.js +269 -0
  57. package/dist/cli/init/fleet-config.js.map +1 -0
  58. package/dist/cli/init/helpers.d.ts +6 -0
  59. package/dist/cli/init/helpers.d.ts.map +1 -0
  60. package/dist/cli/init/helpers.js +94 -0
  61. package/dist/cli/init/helpers.js.map +1 -0
  62. package/dist/cli/init/index.d.ts +32 -0
  63. package/dist/cli/init/index.d.ts.map +1 -0
  64. package/dist/cli/init/index.js +294 -0
  65. package/dist/cli/init/index.js.map +1 -0
  66. package/dist/cli/init/skills.d.ts +6 -0
  67. package/dist/cli/init/skills.d.ts.map +1 -0
  68. package/dist/cli/init/skills.js +138 -0
  69. package/dist/cli/init/skills.js.map +1 -0
  70. package/dist/cli/init/utils/file-utils.d.ts +74 -0
  71. package/dist/cli/init/utils/file-utils.d.ts.map +1 -0
  72. package/dist/cli/init/utils/file-utils.js +187 -0
  73. package/dist/cli/init/utils/file-utils.js.map +1 -0
  74. package/dist/cli/init/utils/index.d.ts +18 -0
  75. package/dist/cli/init/utils/index.d.ts.map +1 -0
  76. package/dist/cli/init/utils/index.js +48 -0
  77. package/dist/cli/init/utils/index.js.map +1 -0
  78. package/dist/cli/init/utils/log-utils.d.ts +47 -0
  79. package/dist/cli/init/utils/log-utils.d.ts.map +1 -0
  80. package/dist/cli/init/utils/log-utils.js +68 -0
  81. package/dist/cli/init/utils/log-utils.js.map +1 -0
  82. package/dist/cli/init/utils/path-utils.d.ts +91 -0
  83. package/dist/cli/init/utils/path-utils.d.ts.map +1 -0
  84. package/dist/cli/init/utils/path-utils.js +208 -0
  85. package/dist/cli/init/utils/path-utils.js.map +1 -0
  86. package/dist/cli/init/utils/validation-utils.d.ts +44 -0
  87. package/dist/cli/init/utils/validation-utils.d.ts.map +1 -0
  88. package/dist/cli/init/utils/validation-utils.js +68 -0
  89. package/dist/cli/init/utils/validation-utils.js.map +1 -0
  90. package/dist/cli/init/utils.d.ts +183 -0
  91. package/dist/cli/init/utils.d.ts.map +1 -0
  92. package/dist/cli/init/utils.js +354 -0
  93. package/dist/cli/init/utils.js.map +1 -0
  94. package/dist/components/Dashboard/Dashboard.d.ts +4 -0
  95. package/dist/components/Dashboard/Dashboard.d.ts.map +1 -0
  96. package/dist/components/Dashboard/Dashboard.js +148 -0
  97. package/dist/components/Dashboard/Dashboard.js.map +1 -0
  98. package/dist/components/Dashboard/DashboardHeader.d.ts +4 -0
  99. package/dist/components/Dashboard/DashboardHeader.d.ts.map +1 -0
  100. package/dist/components/Dashboard/DashboardHeader.js +138 -0
  101. package/dist/components/Dashboard/DashboardHeader.js.map +1 -0
  102. package/dist/constitution/evaluators/ast-evaluator.d.ts +42 -0
  103. package/dist/constitution/evaluators/ast-evaluator.d.ts.map +1 -0
  104. package/dist/constitution/evaluators/ast-evaluator.js +303 -0
  105. package/dist/constitution/evaluators/ast-evaluator.js.map +1 -0
  106. package/dist/constitution/evaluators/base.d.ts +144 -0
  107. package/dist/constitution/evaluators/base.d.ts.map +1 -0
  108. package/dist/constitution/evaluators/base.js +144 -0
  109. package/dist/constitution/evaluators/base.js.map +1 -0
  110. package/dist/constitution/evaluators/index.d.ts +19 -0
  111. package/dist/constitution/evaluators/index.d.ts.map +1 -0
  112. package/dist/constitution/evaluators/index.js +56 -0
  113. package/dist/constitution/evaluators/index.js.map +1 -0
  114. package/dist/constitution/evaluators/metric-evaluator.d.ts +59 -0
  115. package/dist/constitution/evaluators/metric-evaluator.d.ts.map +1 -0
  116. package/dist/constitution/evaluators/metric-evaluator.js +195 -0
  117. package/dist/constitution/evaluators/metric-evaluator.js.map +1 -0
  118. package/dist/constitution/evaluators/pattern-evaluator.d.ts +66 -0
  119. package/dist/constitution/evaluators/pattern-evaluator.d.ts.map +1 -0
  120. package/dist/constitution/evaluators/pattern-evaluator.js +221 -0
  121. package/dist/constitution/evaluators/pattern-evaluator.js.map +1 -0
  122. package/dist/constitution/evaluators/semantic-evaluator.d.ts +68 -0
  123. package/dist/constitution/evaluators/semantic-evaluator.d.ts.map +1 -0
  124. package/dist/constitution/evaluators/semantic-evaluator.js +250 -0
  125. package/dist/constitution/evaluators/semantic-evaluator.js.map +1 -0
  126. package/dist/contexts/DashboardContext.d.ts +41 -0
  127. package/dist/contexts/DashboardContext.d.ts.map +1 -0
  128. package/dist/contexts/DashboardContext.js +187 -0
  129. package/dist/contexts/DashboardContext.js.map +1 -0
  130. package/dist/core/memory/SwarmMemoryManager.d.ts +40 -0
  131. package/dist/core/memory/SwarmMemoryManager.d.ts.map +1 -1
  132. package/dist/core/memory/SwarmMemoryManager.js +279 -120
  133. package/dist/core/memory/SwarmMemoryManager.js.map +1 -1
  134. package/dist/hooks/useKeyboardShortcuts.d.ts +12 -0
  135. package/dist/hooks/useKeyboardShortcuts.d.ts.map +1 -0
  136. package/dist/hooks/useKeyboardShortcuts.js +69 -0
  137. package/dist/hooks/useKeyboardShortcuts.js.map +1 -0
  138. package/dist/telemetry/instrumentation/agent.d.ts +158 -0
  139. package/dist/telemetry/instrumentation/agent.d.ts.map +1 -0
  140. package/dist/telemetry/instrumentation/agent.js +372 -0
  141. package/dist/telemetry/instrumentation/agent.js.map +1 -0
  142. package/dist/telemetry/instrumentation/index.d.ts +24 -0
  143. package/dist/telemetry/instrumentation/index.d.ts.map +1 -0
  144. package/dist/telemetry/instrumentation/index.js +54 -0
  145. package/dist/telemetry/instrumentation/index.js.map +1 -0
  146. package/dist/telemetry/instrumentation/memory.d.ts +313 -0
  147. package/dist/telemetry/instrumentation/memory.d.ts.map +1 -0
  148. package/dist/telemetry/instrumentation/memory.js +552 -0
  149. package/dist/telemetry/instrumentation/memory.js.map +1 -0
  150. package/dist/telemetry/instrumentation/task.d.ts +146 -0
  151. package/dist/telemetry/instrumentation/task.d.ts.map +1 -0
  152. package/dist/telemetry/instrumentation/task.js +305 -0
  153. package/dist/telemetry/instrumentation/task.js.map +1 -0
  154. package/dist/telemetry/metrics/collectors/cost.d.ts +246 -0
  155. package/dist/telemetry/metrics/collectors/cost.d.ts.map +1 -0
  156. package/dist/telemetry/metrics/collectors/cost.js +526 -0
  157. package/dist/telemetry/metrics/collectors/cost.js.map +1 -0
  158. package/dist/telemetry/metrics/collectors/pricing-config.d.ts +87 -0
  159. package/dist/telemetry/metrics/collectors/pricing-config.d.ts.map +1 -0
  160. package/dist/telemetry/metrics/collectors/pricing-config.js +207 -0
  161. package/dist/telemetry/metrics/collectors/pricing-config.js.map +1 -0
  162. package/dist/telemetry/metrics/index.d.ts +4 -1
  163. package/dist/telemetry/metrics/index.d.ts.map +1 -1
  164. package/dist/telemetry/metrics/index.js +18 -2
  165. package/dist/telemetry/metrics/index.js.map +1 -1
  166. package/dist/telemetry/types.d.ts +1 -1
  167. package/dist/telemetry/types.d.ts.map +1 -1
  168. package/dist/visualization/api/RestEndpoints.d.ts +136 -0
  169. package/dist/visualization/api/RestEndpoints.d.ts.map +1 -0
  170. package/dist/visualization/api/RestEndpoints.js +428 -0
  171. package/dist/visualization/api/RestEndpoints.js.map +1 -0
  172. package/dist/visualization/api/WebSocketServer.d.ts +165 -0
  173. package/dist/visualization/api/WebSocketServer.d.ts.map +1 -0
  174. package/dist/visualization/api/WebSocketServer.js +518 -0
  175. package/dist/visualization/api/WebSocketServer.js.map +1 -0
  176. package/dist/visualization/core/DataTransformer.d.ts +89 -0
  177. package/dist/visualization/core/DataTransformer.d.ts.map +1 -0
  178. package/dist/visualization/core/DataTransformer.js +478 -0
  179. package/dist/visualization/core/DataTransformer.js.map +1 -0
  180. package/dist/visualization/index.d.ts +92 -0
  181. package/dist/visualization/index.d.ts.map +1 -0
  182. package/dist/visualization/index.js +121 -0
  183. package/dist/visualization/index.js.map +1 -0
  184. package/dist/visualization/types.d.ts +148 -0
  185. package/dist/visualization/types.d.ts.map +1 -0
  186. package/dist/visualization/types.js +7 -0
  187. package/dist/visualization/types.js.map +1 -0
  188. package/dist/voting/consensus.d.ts +87 -0
  189. package/dist/voting/consensus.d.ts.map +1 -0
  190. package/dist/voting/consensus.js +568 -0
  191. package/dist/voting/consensus.js.map +1 -0
  192. package/dist/voting/index.d.ts +12 -0
  193. package/dist/voting/index.d.ts.map +1 -0
  194. package/dist/voting/index.js +36 -0
  195. package/dist/voting/index.js.map +1 -0
  196. package/dist/voting/orchestrator.d.ts +65 -0
  197. package/dist/voting/orchestrator.d.ts.map +1 -0
  198. package/dist/voting/orchestrator.js +306 -0
  199. package/dist/voting/orchestrator.js.map +1 -0
  200. package/dist/voting/panel-assembly.d.ts +54 -0
  201. package/dist/voting/panel-assembly.d.ts.map +1 -0
  202. package/dist/voting/panel-assembly.js +192 -0
  203. package/dist/voting/panel-assembly.js.map +1 -0
  204. package/dist/voting/protocol.d.ts +119 -0
  205. package/dist/voting/protocol.d.ts.map +1 -0
  206. package/dist/voting/protocol.js +18 -0
  207. package/dist/voting/protocol.js.map +1 -0
  208. package/dist/voting/types.d.ts +125 -0
  209. package/dist/voting/types.d.ts.map +1 -0
  210. package/dist/voting/types.js +7 -0
  211. package/dist/voting/types.js.map +1 -0
  212. package/package.json +27 -2
@@ -1,2305 +1,35 @@
1
1
  "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || (function () {
19
- var ownKeys = function(o) {
20
- ownKeys = Object.getOwnPropertyNames || function (o) {
21
- var ar = [];
22
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
- return ar;
24
- };
25
- return ownKeys(o);
26
- };
27
- return function (mod) {
28
- if (mod && mod.__esModule) return mod;
29
- var result = {};
30
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
- __setModuleDefault(result, mod);
32
- return result;
33
- };
34
- })();
35
- var __importDefault = (this && this.__importDefault) || function (mod) {
36
- return (mod && mod.__esModule) ? mod : { "default": mod };
37
- };
38
2
  Object.defineProperty(exports, "__esModule", { value: true });
39
3
  exports.InitCommand = void 0;
40
- const ProcessExit_1 = require("../../utils/ProcessExit");
41
- const chalk_1 = __importDefault(require("chalk"));
42
- const inquirer_1 = __importDefault(require("inquirer"));
43
- const ora_1 = __importDefault(require("ora"));
44
- const fs = __importStar(require("fs-extra"));
45
- const path = __importStar(require("path"));
46
- const init_claude_md_template_1 = require("./init-claude-md-template");
4
+ // ⚔ NEW: Import modular initialization orchestrator
5
+ // This is the new way to initialize the fleet using the modular structure in src/cli/init/
6
+ const index_1 = require("../init/index");
47
7
  // Import version from package.json to maintain consistency
48
8
  const packageJson = require('../../../package.json');
49
9
  const PACKAGE_VERSION = packageJson.version;
50
10
  class InitCommand {
51
- static async execute(options) {
52
- console.log(chalk_1.default.blue.bold(`\nšŸš€ Initializing Agentic QE Project (v${PACKAGE_VERSION})\n`));
53
- try {
54
- // Parse options
55
- const maxAgents = parseInt(options.maxAgents);
56
- const testingFocus = options.focus.split(',').map(f => f.trim());
57
- const environments = options.environments.split(',').map(e => e.trim());
58
- const frameworks = options.frameworks ? options.frameworks.split(',').map(f => f.trim()) : ['jest'];
59
- // Validate inputs
60
- if (maxAgents < 5 || maxAgents > 50) {
61
- console.error(chalk_1.default.red('āŒ Max agents must be between 5 and 50'));
62
- ProcessExit_1.ProcessExit.exitIfNotTest(1);
63
- }
64
- const validTopologies = ['hierarchical', 'mesh', 'ring', 'adaptive'];
65
- if (!validTopologies.includes(options.topology)) {
66
- console.error(chalk_1.default.red(`āŒ Invalid topology. Must be one of: ${validTopologies.join(', ')}`));
67
- ProcessExit_1.ProcessExit.exitIfNotTest(1);
68
- }
69
- // Create fleet configuration
70
- const fleetConfig = {
71
- agents: [], // Will be populated during interactive setup
72
- topology: options.topology,
73
- maxAgents,
74
- testingFocus,
75
- environments,
76
- frameworks,
77
- routing: {
78
- enabled: false, // Disabled by default for safe rollout
79
- defaultModel: 'claude-sonnet-4.5',
80
- enableCostTracking: true,
81
- enableFallback: true,
82
- maxRetries: 3,
83
- costThreshold: 0.5
84
- },
85
- streaming: {
86
- enabled: true, // Enabled by default
87
- progressInterval: 2000,
88
- bufferEvents: false,
89
- timeout: 1800000
90
- }
91
- };
92
- // Interactive project setup if needed (skip if --non-interactive or --yes)
93
- const isNonInteractive = options.nonInteractive || options.yes;
94
- if (!options.config && !isNonInteractive) {
95
- const projectAnswers = await inquirer_1.default.prompt([
96
- {
97
- type: 'input',
98
- name: 'projectName',
99
- message: 'Project name:',
100
- default: path.basename(process.cwd()),
101
- validate: (input) => input.trim().length > 0 || 'Project name is required'
102
- },
103
- {
104
- type: 'list',
105
- name: 'language',
106
- message: 'Primary programming language:',
107
- choices: ['JavaScript', 'TypeScript', 'Python', 'Java', 'C#', 'Go', 'Other'],
108
- default: 'TypeScript'
109
- },
110
- {
111
- type: 'confirm',
112
- name: 'useClaudeFlow',
113
- message: 'Enable Claude Flow coordination?',
114
- default: true
115
- },
116
- {
117
- type: 'confirm',
118
- name: 'setupCi',
119
- message: 'Setup CI/CD integration?',
120
- default: true
121
- },
122
- {
123
- type: 'confirm',
124
- name: 'enableRouting',
125
- message: 'Enable Multi-Model Router for cost optimization? (70-81% savings)',
126
- default: false
127
- },
128
- {
129
- type: 'confirm',
130
- name: 'enableStreaming',
131
- message: 'Enable streaming progress updates for long-running operations?',
132
- default: true
133
- }
134
- ]);
135
- fleetConfig.project = {
136
- name: projectAnswers.projectName,
137
- path: '.', // Relative path - use current directory as project root
138
- language: projectAnswers.language.toLowerCase()
139
- };
140
- // Update routing/streaming config based on user answers
141
- if (fleetConfig.routing) {
142
- fleetConfig.routing.enabled = projectAnswers.enableRouting;
143
- }
144
- if (fleetConfig.streaming) {
145
- fleetConfig.streaming.enabled = projectAnswers.enableStreaming;
146
- }
147
- // Enable Phase 2 features by default (no questions)
148
- options.enableLearning = true;
149
- options.enablePatterns = true;
150
- options.enableImprovement = true;
151
- }
152
- else {
153
- // Non-interactive mode: use defaults or environment variables
154
- fleetConfig.project = {
155
- name: process.env.AQE_PROJECT_NAME || path.basename(process.cwd()),
156
- path: '.', // Relative path - use current directory as project root
157
- language: (process.env.AQE_LANGUAGE || 'typescript').toLowerCase()
158
- };
159
- // Use environment variables or defaults
160
- if (fleetConfig.routing) {
161
- fleetConfig.routing.enabled = process.env.AQE_ROUTING_ENABLED === 'true' || false;
162
- }
163
- if (fleetConfig.streaming) {
164
- fleetConfig.streaming.enabled = process.env.AQE_STREAMING_ENABLED !== 'false';
165
- }
166
- // Use defaults if non-interactive
167
- options.enableLearning = process.env.AQE_LEARNING_ENABLED !== 'false';
168
- options.enablePatterns = process.env.AQE_PATTERNS_ENABLED !== 'false';
169
- options.enableImprovement = process.env.AQE_IMPROVEMENT_ENABLED !== 'false';
170
- console.log(chalk_1.default.gray(' ā„¹ļø Running in non-interactive mode with defaults'));
171
- console.log(chalk_1.default.gray(` • Project: ${fleetConfig.project.name}`));
172
- console.log(chalk_1.default.gray(` • Language: ${fleetConfig.project.language}`));
173
- console.log(chalk_1.default.gray(` • Routing: ${fleetConfig.routing?.enabled ? 'enabled' : 'disabled'}`));
174
- console.log(chalk_1.default.gray(` • Streaming: ${fleetConfig.streaming?.enabled ? 'enabled' : 'disabled'}`));
175
- }
176
- const spinner = (0, ora_1.default)('Setting up fleet infrastructure...').start();
177
- // Create directory structure
178
- await this.createDirectoryStructure(options.force);
179
- spinner.text = 'Creating configuration files...';
180
- // Write fleet configuration
181
- await this.writeFleetConfig(fleetConfig);
182
- spinner.text = 'Installing dependencies...';
183
- // Initialize Claude Flow hooks if requested
184
- if (fleetConfig.project) {
185
- await this.setupClaudeFlowIntegration(fleetConfig);
186
- }
187
- spinner.text = 'Creating CLAUDE.md documentation...';
188
- // Create or update CLAUDE.md with agent documentation
189
- await this.createClaudeMd(fleetConfig, options.yes);
190
- // Initialize Claude Flow coordination
191
- await this.initializeCoordination(fleetConfig);
192
- // Phase 2: Initialize memory database FIRST (required for agents)
193
- spinner.text = 'Initializing memory database...';
194
- await this.initializeMemoryDatabase();
195
- // Phase 2: Initialize AgentDB for learning (v1.8.0 - replaces patterns.db)
196
- if (options.enableLearning !== false) {
197
- spinner.text = 'Initializing AgentDB learning system...';
198
- await this.initializeAgentDB(fleetConfig);
199
- }
200
- // Phase 2: Initialize improvement loop
201
- if (options.enableImprovement !== false) {
202
- spinner.text = 'Setting up improvement loop...';
203
- await this.initializeImprovementLoop(fleetConfig);
204
- }
205
- // Now spawn agents AFTER databases are initialized
206
- spinner.text = 'Spawning initial agents...';
207
- await this.spawnInitialAgents(fleetConfig);
208
- spinner.succeed(chalk_1.default.green('Fleet initialization completed successfully!'));
209
- // Display summary
210
- console.log(chalk_1.default.yellow('\nšŸ“Š Fleet Configuration Summary:'));
211
- console.log(chalk_1.default.gray(` Topology: ${fleetConfig.topology}`));
212
- console.log(chalk_1.default.gray(` Max Agents: ${fleetConfig.maxAgents}`));
213
- console.log(chalk_1.default.gray(` Testing Focus: ${fleetConfig.testingFocus?.join(', ') || 'None'}`));
214
- console.log(chalk_1.default.gray(` Environments: ${fleetConfig.environments?.join(', ') || 'None'}`));
215
- console.log(chalk_1.default.gray(` Frameworks: ${fleetConfig.frameworks?.join(', ') || 'None'}`));
216
- // Show agent status
217
- const agentCount = await this.countAgentFiles('.claude/agents');
218
- console.log(chalk_1.default.gray(` Agent Definitions: ${agentCount} agents ready`));
219
- // Create comprehensive config.json
220
- spinner.text = 'Creating comprehensive configuration...';
221
- await this.createComprehensiveConfig(fleetConfig, {
222
- enableLearning: options.enableLearning !== false,
223
- enablePatterns: options.enablePatterns !== false,
224
- enableImprovement: options.enableImprovement !== false
225
- });
226
- spinner.succeed(chalk_1.default.green('Project initialization completed successfully!'));
227
- // Display comprehensive summary
228
- await this.displayComprehensiveSummary(fleetConfig, {
229
- enableLearning: options.enableLearning !== false,
230
- enablePatterns: options.enablePatterns !== false,
231
- enableImprovement: options.enableImprovement !== false
232
- });
233
- }
234
- catch (error) {
235
- console.error(chalk_1.default.red('āŒ Initialization failed:'), error.message);
236
- console.error(chalk_1.default.gray('\nStack trace:'));
237
- console.error(chalk_1.default.gray(error.stack));
238
- ProcessExit_1.ProcessExit.exitIfNotTest(1);
239
- }
240
- }
241
- static async createDirectoryStructure(force = false) {
242
- const dirs = [
243
- '.agentic-qe',
244
- '.agentic-qe/config',
245
- '.agentic-qe/logs',
246
- '.agentic-qe/data',
247
- '.agentic-qe/data/learning', // Phase 2: Learning state
248
- '.agentic-qe/data/patterns', // Phase 2: Pattern database
249
- '.agentic-qe/data/improvement', // Phase 2: Improvement state
250
- '.agentic-qe/agents',
251
- '.agentic-qe/reports',
252
- '.agentic-qe/scripts', // For coordination scripts
253
- '.agentic-qe/state', // For state management
254
- '.agentic-qe/state/coordination', // Coordination state
255
- '.claude', // For Claude Code integration
256
- '.claude/agents', // Where agent definitions live
257
- '.claude/agents/subagents', // Where subagent definitions live (8 TDD subagents)
258
- '.claude/skills', // Where QE skill definitions live (35 QE skills)
259
- '.claude/commands', // Where AQE slash commands live (8 commands)
260
- 'tests/unit',
261
- 'tests/integration',
262
- 'tests/e2e',
263
- 'tests/performance',
264
- 'tests/security'
265
- ];
266
- for (const dir of dirs) {
267
- await fs.ensureDir(dir);
268
- }
269
- // Copy agent templates from agentic-qe package
270
- await this.copyAgentTemplates(force);
271
- // Copy skill templates (only QE Fleet skills, not Claude Flow)
272
- await this.copySkillTemplates();
273
- // Copy command templates (8 AQE slash commands)
274
- await this.copyCommandTemplates();
275
- }
276
- static async copyAgentTemplates(force = false) {
277
- console.log(chalk_1.default.cyan(' šŸ” Searching for agent templates...'));
278
- // Find the agentic-qe package location (handles both npm install and local dev)
279
- const possiblePaths = [
280
- path.join(__dirname, '../../../.claude/agents'), // From dist/cli/commands
281
- path.join(process.cwd(), 'node_modules/agentic-qe/.claude/agents'),
282
- path.join(process.cwd(), '../agentic-qe/.claude/agents') // Monorepo case
283
- ];
284
- console.log(chalk_1.default.gray(' • Checking paths:'));
285
- let sourcePath = null;
286
- for (const p of possiblePaths) {
287
- const exists = await fs.pathExists(p);
288
- console.log(chalk_1.default.gray(` ${exists ? 'āœ“' : 'āœ—'} ${p}`));
289
- if (exists && !sourcePath) {
290
- sourcePath = p;
291
- }
292
- }
293
- if (!sourcePath) {
294
- console.warn(chalk_1.default.yellow(' āš ļø No agent templates found in package paths'));
295
- console.warn(chalk_1.default.yellow(' ā„¹ļø Falling back to programmatic generation (all 18 agents)'));
296
- await this.createBasicAgents(force);
297
- return;
298
- }
299
- console.log(chalk_1.default.green(` āœ“ Found agent templates at: ${sourcePath}`));
300
- // Count available templates
301
- const availableFiles = await fs.readdir(sourcePath);
302
- const templateFiles = availableFiles.filter(f => f.endsWith('.md'));
303
- console.log(chalk_1.default.cyan(` šŸ“¦ Found ${templateFiles.length} agent templates to copy`));
304
- // Copy all agent definition files individually (not directory copy)
305
- const targetPath = path.join(process.cwd(), '.claude/agents');
306
- let copiedFiles = 0;
307
- let updatedFiles = 0;
308
- let skippedFiles = 0;
309
- for (const templateFile of templateFiles) {
310
- const sourceFile = path.join(sourcePath, templateFile);
311
- const targetFile = path.join(targetPath, templateFile);
312
- // Skip if source and target are the same file
313
- const sourceResolved = path.resolve(sourceFile);
314
- const targetResolved = path.resolve(targetFile);
315
- if (sourceResolved === targetResolved) {
316
- skippedFiles++;
317
- continue;
318
- }
319
- const targetExists = await fs.pathExists(targetFile);
320
- // Copy if target doesn't exist OR force flag is set
321
- if (!targetExists || force) {
322
- await fs.copy(sourceFile, targetFile);
323
- if (targetExists) {
324
- updatedFiles++;
325
- }
326
- else {
327
- copiedFiles++;
328
- }
329
- }
330
- }
331
- // Copy subagents folder if it exists
332
- const subagentsSourcePath = path.join(sourcePath, 'subagents');
333
- const subagentsTargetPath = path.join(targetPath, 'subagents');
334
- if (await fs.pathExists(subagentsSourcePath)) {
335
- console.log(chalk_1.default.cyan(' šŸ“¦ Copying subagent definitions...'));
336
- await fs.ensureDir(subagentsTargetPath);
337
- const subagentFiles = await fs.readdir(subagentsSourcePath);
338
- const subagentTemplates = subagentFiles.filter(f => f.endsWith('.md'));
339
- let subagentsCopied = 0;
340
- let subagentsUpdated = 0;
341
- for (const subagentFile of subagentTemplates) {
342
- const sourceFile = path.join(subagentsSourcePath, subagentFile);
343
- const targetFile = path.join(subagentsTargetPath, subagentFile);
344
- const targetExists = await fs.pathExists(targetFile);
345
- if (!targetExists || force) {
346
- await fs.copy(sourceFile, targetFile);
347
- if (targetExists) {
348
- subagentsUpdated++;
349
- }
350
- else {
351
- subagentsCopied++;
352
- }
353
- }
354
- }
355
- if (force && subagentsUpdated > 0) {
356
- console.log(chalk_1.default.green(` āœ“ Updated ${subagentsUpdated} existing subagent definitions`));
357
- }
358
- console.log(chalk_1.default.green(` āœ“ Copied ${subagentsCopied} new subagent definitions (${subagentTemplates.length} total subagents)`));
359
- }
360
- if (force && updatedFiles > 0) {
361
- console.log(chalk_1.default.green(` āœ“ Updated ${updatedFiles} existing agent definitions`));
362
- }
363
- console.log(chalk_1.default.green(` āœ“ Copied ${copiedFiles} new agent definitions`));
364
- const copiedCount = await this.countAgentFiles(targetPath);
365
- console.log(chalk_1.default.cyan(` šŸ“‹ Total agents in target: ${copiedCount}`));
366
- // Verify all 18 agents exist (17 QE agents + 1 base template generator)
367
- const expectedAgents = 18;
368
- if (copiedCount < expectedAgents) {
369
- console.warn(chalk_1.default.yellow(` āš ļø Expected ${expectedAgents} agents, found ${copiedCount}`));
370
- console.warn(chalk_1.default.yellow(` ā„¹ļø Creating missing agents programmatically...`));
371
- // Get list of files that actually exist in TARGET (not source!)
372
- const targetFiles = await fs.readdir(targetPath);
373
- const existingTargetFiles = targetFiles.filter(f => f.endsWith('.md'));
374
- await this.createMissingAgents(targetPath, existingTargetFiles, force);
375
- }
376
- else {
377
- console.log(chalk_1.default.green(` āœ“ All ${expectedAgents} agents present and ready`));
378
- }
379
- }
380
- static async createBasicAgents(force = false) {
381
- try {
382
- console.log(chalk_1.default.cyan(' šŸ› ļø Creating all agent definitions programmatically...'));
383
- // ALL 18 AGENTS (17 QE agents + 1 base template generator)
384
- const allAgents = [
385
- // Core Testing (5)
386
- 'qe-test-generator',
387
- 'qe-test-executor',
388
- 'qe-coverage-analyzer',
389
- 'qe-quality-gate',
390
- 'qe-quality-analyzer',
391
- // Performance & Security (2)
392
- 'qe-performance-tester',
393
- 'qe-security-scanner',
394
- // Strategic Planning (3)
395
- 'qe-requirements-validator',
396
- 'qe-production-intelligence',
397
- 'qe-fleet-commander',
398
- // Deployment (1)
399
- 'qe-deployment-readiness',
400
- // Advanced Testing (4)
401
- 'qe-regression-risk-analyzer',
402
- 'qe-test-data-architect',
403
- 'qe-api-contract-validator',
404
- 'qe-flaky-test-hunter',
405
- // Specialized (2)
406
- 'qe-visual-tester',
407
- 'qe-chaos-engineer'
408
- ];
409
- const targetPath = path.join(process.cwd(), '.claude/agents');
410
- console.log(chalk_1.default.gray(` • Creating ${allAgents.length} agent definition files...`));
411
- for (const agentName of allAgents) {
412
- // Defensive null check
413
- if (!agentName || typeof agentName !== 'string') {
414
- console.warn(chalk_1.default.yellow(`āš ļø Skipping invalid agent name: ${agentName}`));
415
- continue;
416
- }
417
- const agentFile = path.join(targetPath, `${agentName}.md`);
418
- // Skip if file exists and force is not set
419
- if (!force && await fs.pathExists(agentFile)) {
420
- continue;
421
- }
422
- const agentType = agentName.replace('qe-', '');
423
- const skills = this.getAgentSkills(agentName);
424
- const description = this.getAgentDescription(agentName);
425
- const content = `---
426
- name: ${agentName}
427
- description: ${description}
428
- ---
429
-
430
- # ${agentName.toUpperCase()} Agent
431
-
432
- ## Description
433
- This agent is part of the Agentic QE Fleet and specializes in ${agentType}.
434
-
435
- ## Capabilities
436
- - AI-powered ${agentType}
437
- - Integration with Agentic QE Fleet
438
- - Native TypeScript coordination
439
- - **Q-Learning**: Learns from task execution automatically
440
- - **Pattern Bank**: Uses proven test patterns
441
- - **Improvement Loop**: Continuously optimizes strategies
442
-
443
- ## 🧠 Q-Learning Integration (Phase 2)
444
-
445
- This agent automatically learns from EVERY task execution through Q-learning integration in \`BaseAgent.onPostTask()\`.
446
-
447
- ### Observability Methods
448
-
449
- \`\`\`typescript
450
- // 1. Check learning status
451
- const status = agent.getLearningStatus();
452
- console.log(status);
453
- // {
454
- // enabled: true,
455
- // totalExperiences: 1247,
456
- // explorationRate: 0.08,
457
- // patterns: 34
458
- // }
459
-
460
- // 2. View learned patterns
461
- const patterns = agent.getLearnedPatterns();
462
- console.log(patterns[0]);
463
- // {
464
- // state: { taskComplexity: 'high', ... },
465
- // action: 'thorough-deep-analysis',
466
- // qValue: 0.8734,
467
- // successRate: 0.88
468
- // }
469
-
470
- // 3. Get strategy recommendations
471
- const recommendation = await agent.recommendStrategy({
472
- taskComplexity: 'medium',
473
- availableCapabilities: agent.capabilities
474
- });
475
- console.log(recommendation);
476
- // {
477
- // action: 'balanced-coverage',
478
- // confidence: 0.92,
479
- // expectedQValue: 0.7845
480
- // }
481
- \`\`\`
482
-
483
- ### CLI Commands
484
-
485
- \`\`\`bash
486
- # Check learning status
487
- aqe learn status --agent ${agentName}
488
-
489
- # View learned patterns
490
- aqe learn history --agent ${agentName} --limit 50
491
-
492
- # Export learning data
493
- aqe learn export --agent ${agentName} --output learning.json
494
- \`\`\`
495
-
496
- ## Skills
497
-
498
- This agent can use the following Claude Code Skills:
499
-
500
- ${this.getSkillDocumentation(agentName)}
501
-
502
- ## Coordination Protocol
503
-
504
- This agent uses **AQE hooks** (Agentic QE native hooks) for coordination (zero external dependencies, 100-500x faster than external hooks).
505
-
506
- **Automatic Lifecycle Hooks:**
507
- \`\`\`typescript
508
- protected async onPreTask(data: { assignment: TaskAssignment }): Promise<void> {
509
- // Load context from memory
510
- const context = await this.memoryStore.retrieve('aqe/context', {
511
- partition: 'coordination'
512
- });
513
-
514
- this.logger.info('Pre-task hook complete');
515
- }
516
-
517
- protected async onPostTask(data: { assignment: TaskAssignment; result: any }): Promise<void> {
518
- // Store results in memory
519
- await this.memoryStore.store(\`aqe/\${this.agentId.type}/results\`, data.result, {
520
- partition: 'agent_results',
521
- ttl: 86400 // 24 hours
522
- });
523
-
524
- // Emit completion event
525
- this.eventBus.emit('task:completed', {
526
- agentId: this.agentId,
527
- result: data.result
528
- });
529
-
530
- this.logger.info('Post-task hook complete');
531
- }
532
-
533
- protected async onTaskError(data: { assignment: TaskAssignment; error: Error }): Promise<void> {
534
- // Store error for analysis
535
- await this.memoryStore.store(\`aqe/errors/\${data.assignment.id}\`, {
536
- error: data.error.message,
537
- stack: data.error.stack,
538
- timestamp: Date.now()
539
- }, {
540
- partition: 'errors',
541
- ttl: 604800 // 7 days
542
- });
543
-
544
- this.logger.error('Task failed', { error: data.error });
545
- }
546
- \`\`\`
547
-
548
- **Memory Integration:**
549
- \`\`\`typescript
550
- // Store data with partitions and TTLs
551
- await this.memoryStore.store('aqe/${agentType}/results', results, {
552
- partition: 'agent_results',
553
- ttl: 86400, // 24 hours
554
- accessLevel: AccessLevel.SWARM
555
- });
556
-
557
- // Retrieve context
558
- const context = await this.memoryStore.retrieve('aqe/context', {
559
- partition: 'coordination'
560
- });
561
-
562
- // Query patterns
563
- const relatedData = await this.memoryStore.query('aqe/${agentType}/%', {
564
- partition: 'agent_results'
565
- });
566
- \`\`\`
567
-
568
- **Event-Driven Coordination:**
569
- \`\`\`typescript
570
- // Emit events
571
- this.eventBus.emit('${agentType}:completed', {
572
- agentId: this.agentId,
573
- results: data
574
- });
575
-
576
- // Register event handlers
577
- this.registerEventHandler({
578
- eventType: '${agentType}:required',
579
- handler: async (event) => {
580
- await this.process(event.data);
581
- }
582
- });
583
- \`\`\`
584
-
585
- ## Usage
586
- \`\`\`bash
587
- # Spawn this agent via Claude Code Task tool
588
- Task("${agentType}", "Execute ${agentType} task", "${agentName}")
589
-
590
- # Or use CLI
591
- aqe agent spawn --name ${agentName} --type ${agentType}
592
- aqe agent execute --name ${agentName} --task "<your task>"
593
- \`\`\`
594
-
595
- ## Integration
596
- This agent coordinates with other QE Fleet agents through:
597
- - **AQE Hooks**: Native TypeScript lifecycle hooks (<1ms vs 100-500ms external)
598
- - **SwarmMemoryManager**: Persistent memory with 12-table schema
599
- - **EventBus**: Event-driven communication
600
- - **Fleet Manager**: Lifecycle management
601
-
602
- ## šŸ’° Cost Optimization (v${PACKAGE_VERSION})
603
-
604
- This agent supports the **Multi-Model Router** for intelligent model selection and cost savings.
605
-
606
- **Routing Status**: Check \\\`.agentic-qe/config/routing.json\\\`
607
-
608
- If routing is enabled, this agent will automatically use the most cost-effective model for each task:
609
- - Simple tasks → GPT-3.5 (cheapest)
610
- - Complex tasks → GPT-4 (balanced)
611
- - Critical tasks → Claude Sonnet 4.5 (best quality)
612
-
613
- **No code changes required** - routing is transparent infrastructure.
614
-
615
- ## šŸ“Š Streaming Support (v${PACKAGE_VERSION})
616
-
617
- This agent supports **streaming progress updates** for real-time visibility.
618
-
619
- When using streaming MCP tools, you'll see:
620
- - Real-time progress percentage
621
- - Current operation status
622
- - Incremental results
623
-
624
- **Example**:
625
- \\\`\\\`\\\`javascript
626
- for await (const event of agent.execute(params)) {
627
- console.log(\\\`\\\${event.percent}% - \\\${event.message}\\\`);
628
- }
629
- \\\`\\\`\\\`
630
-
631
- ## Code Execution Workflows
632
-
633
- Instead of multiple MCP tool calls, write code to orchestrate ${agentType} workflows. This approach is **352x faster** (Agent Booster WASM) and reduces token usage by 98.7%.
634
-
635
- ### Basic Workflow
636
-
637
- \\\`\\\`\\\`typescript
638
- import { /* tools */ } from './servers/qe-tools/${agentType}';
639
-
640
- // Example workflow code
641
- const result = await executeWorkflow({
642
- // workflow parameters
643
- });
644
-
645
- console.log('Workflow completed:', result);
646
- \\\`\\\`\\\`
647
-
648
- ### Discover Available Tools
649
-
650
- \\\`\\\`\\\`bash
651
- # List available tools
652
- ls ./servers/qe-tools/${agentType}/
653
-
654
- # Search for specific functionality
655
- ./servers/qe-tools/search_tools.ts "keyword"
656
- \\\`\\\`\\\`
657
-
658
- ### Benefits
659
-
660
- - **98.7% token reduction**: 450K → 2K tokens per workflow
661
- - **352x faster**: Agent Booster WASM for code editing
662
- - **Better patterns**: Direct code execution vs multiple tool calls
663
- - **Follows Anthropic MCP best practices**
664
-
665
- For full capabilities, install the complete agentic-qe package.
666
- `;
667
- await fs.writeFile(agentFile, content);
668
- console.log(chalk_1.default.gray(` āœ“ Created ${agentName}.md`));
669
- }
670
- const finalCount = await this.countAgentFiles(targetPath);
671
- console.log(chalk_1.default.green(` āœ“ Successfully created ${finalCount} agent definitions`));
672
- }
673
- catch (error) {
674
- console.error(chalk_1.default.red('āŒ Error in createBasicAgents:'), error.message);
675
- console.error(chalk_1.default.gray('Stack trace:'), error.stack);
676
- throw error;
677
- }
678
- }
679
- static async createMissingAgents(targetPath, existingFiles, force = false) {
680
- const allAgentNames = [
681
- 'qe-test-generator', 'qe-test-executor', 'qe-coverage-analyzer',
682
- 'qe-quality-gate', 'qe-quality-analyzer', 'qe-performance-tester',
683
- 'qe-security-scanner', 'qe-requirements-validator', 'qe-production-intelligence',
684
- 'qe-fleet-commander', 'qe-deployment-readiness', 'qe-regression-risk-analyzer',
685
- 'qe-test-data-architect', 'qe-api-contract-validator', 'qe-flaky-test-hunter',
686
- 'qe-visual-tester', 'qe-chaos-engineer'
687
- ];
688
- const existingAgentNames = existingFiles.map(f => f.replace('.md', ''));
689
- const missingAgents = allAgentNames.filter(name => !existingAgentNames.includes(name));
690
- if (missingAgents.length === 0) {
691
- console.log(chalk_1.default.green(' āœ“ No missing agents to create'));
692
- return;
693
- }
694
- console.log(chalk_1.default.cyan(` šŸ› ļø Creating ${missingAgents.length} missing agents:`));
695
- for (const agentName of missingAgents) {
696
- console.log(chalk_1.default.gray(` • ${agentName}`));
697
- }
698
- // Create missing agents using the same logic as createBasicAgents
699
- for (const agentName of missingAgents) {
700
- const agentFile = path.join(targetPath, `${agentName}.md`);
701
- const agentType = agentName.replace('qe-', '');
702
- const skills = this.getAgentSkills(agentName);
703
- const description = this.getAgentDescription(agentName);
704
- const content = `---
705
- name: ${agentName}
706
- description: ${description}
707
- ---
708
-
709
- # ${agentName.toUpperCase()} Agent
710
-
711
- ## Description
712
- This agent is part of the Agentic QE Fleet and specializes in ${agentType}.
713
-
714
- ## Capabilities
715
- - AI-powered ${agentType}
716
- - Integration with Agentic QE Fleet
717
- - Native TypeScript coordination
718
- - **Q-Learning**: Learns from task execution automatically
719
- - **Pattern Bank**: Uses proven test patterns
720
- - **Improvement Loop**: Continuously optimizes strategies
721
-
722
- ## Skills
723
-
724
- This agent can use the following Claude Code Skills:
725
-
726
- ${this.getSkillDocumentation(agentName)}
727
-
728
- ## Coordination Protocol
729
-
730
- This agent uses **AQE hooks** (Agentic QE native hooks) for coordination (zero external dependencies, 100-500x faster than external hooks).
731
-
732
- ## Code Execution Workflows
733
-
734
- Instead of multiple MCP tool calls, write code to orchestrate ${agentType} workflows. This approach is **352x faster** (Agent Booster WASM) and reduces token usage by 98.7%.
735
-
736
- ### Basic Workflow
737
-
738
- \\\`\\\`\\\`typescript
739
- import { /* tools */ } from './servers/qe-tools/${agentType}';
740
-
741
- // Example workflow code
742
- const result = await executeWorkflow({
743
- // workflow parameters
744
- });
745
-
746
- console.log('Workflow completed:', result);
747
- \\\`\\\`\\\`
748
-
749
- ### Discover Available Tools
750
-
751
- \\\`\\\`\\\`bash
752
- # List available tools
753
- ls ./servers/qe-tools/${agentType}/
754
-
755
- # Search for specific functionality
756
- ./servers/qe-tools/search_tools.ts "keyword"
757
- \\\`\\\`\\\`
758
-
759
- ### Benefits
760
-
761
- - **98.7% token reduction**: 450K → 2K tokens per workflow
762
- - **352x faster**: Agent Booster WASM for code editing
763
- - **Better patterns**: Direct code execution vs multiple tool calls
764
- - **Follows Anthropic MCP best practices**
765
-
766
- For full capabilities, install the complete agentic-qe package.
767
- `;
768
- await fs.writeFile(agentFile, content);
769
- console.log(chalk_1.default.gray(` āœ“ Created ${agentName}.md`));
770
- }
771
- const finalCount = await this.countAgentFiles(targetPath);
772
- console.log(chalk_1.default.green(` āœ“ Total agent count: ${finalCount}`));
773
- }
774
- static async countAgentFiles(dirPath) {
775
- if (!await fs.pathExists(dirPath))
776
- return 0;
777
- const files = await fs.readdir(dirPath);
778
- return files.filter(f => f.endsWith('.md')).length;
779
- }
780
- /**
781
- * Copy all 38 QE Fleet skills (filters out Claude Flow skills)
782
- */
783
- static async copySkillTemplates() {
784
- console.log(chalk_1.default.cyan(' šŸŽÆ Initializing QE Fleet skills...'));
785
- // Define all 38 QE Fleet skills (Phase 1: 18 + Phase 2: 16 + Phase 3: 4 = 38 total)
786
- const QE_FLEET_SKILLS = [
787
- // Phase 1: Original Quality Practices (18 skills)
788
- // Core Quality Practices (3)
789
- 'agentic-quality-engineering',
790
- 'context-driven-testing',
791
- 'holistic-testing-pact',
792
- // Testing Methodologies (4)
793
- 'tdd-london-chicago',
794
- 'xp-practices',
795
- 'risk-based-testing',
796
- 'test-automation-strategy',
797
- // Testing Techniques (4)
798
- 'api-testing-patterns',
799
- 'exploratory-testing-advanced',
800
- 'performance-testing',
801
- 'security-testing',
802
- // Code Quality (3)
803
- 'code-review-quality',
804
- 'refactoring-patterns',
805
- 'quality-metrics',
806
- // Communication (3)
807
- 'bug-reporting-excellence',
808
- 'technical-writing',
809
- 'consultancy-practices',
810
- // Phase 2: Expanded QE Skills Library (16 skills)
811
- // Testing Methodologies (6)
812
- 'regression-testing',
813
- 'shift-left-testing',
814
- 'shift-right-testing',
815
- 'test-design-techniques',
816
- 'mutation-testing',
817
- 'test-data-management',
818
- // Specialized Testing (9)
819
- 'accessibility-testing',
820
- 'mobile-testing',
821
- 'database-testing',
822
- 'contract-testing',
823
- 'chaos-engineering-resilience',
824
- 'compatibility-testing',
825
- 'localization-testing',
826
- 'compliance-testing',
827
- 'visual-testing-advanced',
828
- // Testing Infrastructure (1)
829
- 'test-environment-management',
830
- 'test-reporting-analytics',
831
- // Phase 3: Advanced Quality Engineering Skills (4 skills)
832
- // Strategic Testing Methodologies (4)
833
- 'six-thinking-hats',
834
- 'brutal-honesty-review',
835
- 'sherlock-review',
836
- 'cicd-pipeline-qe-orchestrator'
837
- ];
838
- // Find the agentic-qe package location
839
- const possiblePaths = [
840
- path.join(__dirname, '../../../.claude/skills'), // From dist/cli/commands
841
- path.join(process.cwd(), 'node_modules/agentic-qe/.claude/skills'),
842
- path.join(process.cwd(), '../agentic-qe/.claude/skills') // Monorepo case
843
- ];
844
- console.log(chalk_1.default.gray(' • Checking skill source paths:'));
845
- let sourcePath = null;
846
- for (const p of possiblePaths) {
847
- const exists = await fs.pathExists(p);
848
- console.log(chalk_1.default.gray(` ${exists ? 'āœ“' : 'āœ—'} ${p}`));
849
- if (exists && !sourcePath) {
850
- sourcePath = p;
851
- }
852
- }
853
- if (!sourcePath) {
854
- console.warn(chalk_1.default.yellow(' āš ļø No skill templates found in package paths'));
855
- console.warn(chalk_1.default.yellow(' ā„¹ļø Skills can be added manually to .claude/skills/'));
856
- return;
857
- }
858
- console.log(chalk_1.default.green(` āœ“ Found skill templates at: ${sourcePath}`));
859
- // List all available skills
860
- const availableDirs = await fs.readdir(sourcePath);
861
- const availableSkills = [];
862
- for (const name of availableDirs) {
863
- const skillPath = path.join(sourcePath, name);
864
- try {
865
- const stats = await fs.stat(skillPath);
866
- if (stats.isDirectory()) {
867
- availableSkills.push(name);
868
- }
869
- }
870
- catch {
871
- // Skip items that can't be stat'd
872
- }
873
- }
874
- console.log(chalk_1.default.cyan(` šŸ“¦ Found ${availableSkills.length} total skills in source`));
875
- // Filter to only QE Fleet skills
876
- const qeSkillsToConfig = availableSkills.filter(skill => QE_FLEET_SKILLS.includes(skill));
877
- console.log(chalk_1.default.cyan(` šŸŽÆ Filtering to ${qeSkillsToConfig.length} QE Fleet skills (excluding Claude Flow skills)`));
878
- const targetPath = path.join(process.cwd(), '.claude/skills');
879
- let copiedCount = 0;
880
- // Copy each QE skill directory
881
- for (const skillName of qeSkillsToConfig) {
882
- const sourceSkillPath = path.join(sourcePath, skillName);
883
- const targetSkillPath = path.join(targetPath, skillName);
884
- // Skip if already exists
885
- if (await fs.pathExists(targetSkillPath)) {
886
- console.log(chalk_1.default.gray(` • Skipped ${skillName} (already exists)`));
887
- continue;
888
- }
889
- // Copy the entire skill directory
890
- await fs.copy(sourceSkillPath, targetSkillPath);
891
- copiedCount++;
892
- console.log(chalk_1.default.gray(` āœ“ Copied ${skillName}`));
893
- }
894
- // Final count
895
- const finalSkillCount = await this.countSkillDirs(targetPath);
896
- if (copiedCount > 0) {
897
- console.log(chalk_1.default.green(` āœ“ Copied ${copiedCount} new QE skills`));
898
- }
899
- else {
900
- console.log(chalk_1.default.green(' āœ“ All QE skills already present'));
901
- }
902
- console.log(chalk_1.default.cyan(` šŸ“‹ Total QE skills initialized: ${finalSkillCount}`));
903
- // Verify we have exactly 38 QE skills
904
- if (finalSkillCount === 38) {
905
- console.log(chalk_1.default.green(' āœ… All 38 QE Fleet skills successfully initialized'));
906
- }
907
- else if (finalSkillCount < 38) {
908
- console.warn(chalk_1.default.yellow(` āš ļø Expected 38 QE skills, found ${finalSkillCount}`));
909
- // Check missing skills asynchronously
910
- const missingSkills = [];
911
- for (const skill of QE_FLEET_SKILLS) {
912
- try {
913
- await fs.access(path.join(targetPath, skill));
914
- }
915
- catch {
916
- missingSkills.push(skill);
917
- }
918
- }
919
- console.warn(chalk_1.default.yellow(` ā„¹ļø Missing skills: ${missingSkills.join(', ')}`));
920
- }
921
- }
922
- /**
923
- * Count skill directories in .claude/skills
924
- */
925
- static async countSkillDirs(dirPath) {
926
- if (!await fs.pathExists(dirPath))
927
- return 0;
928
- const items = await fs.readdir(dirPath);
929
- let count = 0;
930
- for (const item of items) {
931
- const itemPath = path.join(dirPath, item);
932
- try {
933
- const stats = await fs.stat(itemPath);
934
- if (stats.isDirectory()) {
935
- count++;
936
- }
937
- }
938
- catch {
939
- // Ignore errors
940
- }
941
- }
942
- return count;
943
- }
944
- /**
945
- * Copy AQE slash command templates (8 commands)
946
- */
947
- static async copyCommandTemplates() {
948
- console.log(chalk_1.default.cyan(' ⚔ Initializing AQE slash commands...'));
949
- // Define the 8 AQE slash commands
950
- const AQE_COMMANDS = [
951
- 'aqe-analyze.md',
952
- 'aqe-benchmark.md',
953
- 'aqe-chaos.md',
954
- 'aqe-execute.md',
955
- 'aqe-fleet-status.md',
956
- 'aqe-generate.md',
957
- 'aqe-optimize.md',
958
- 'aqe-report.md'
959
- ];
960
- // Find the agentic-qe package location
961
- const possiblePaths = [
962
- path.join(__dirname, '../../../.claude/commands'), // From dist/cli/commands
963
- path.join(process.cwd(), 'node_modules/agentic-qe/.claude/commands'),
964
- path.join(process.cwd(), '../agentic-qe/.claude/commands') // Monorepo case
965
- ];
966
- console.log(chalk_1.default.gray(' • Checking command source paths:'));
967
- let sourcePath = null;
968
- for (const p of possiblePaths) {
969
- const exists = await fs.pathExists(p);
970
- console.log(chalk_1.default.gray(` ${exists ? 'āœ“' : 'āœ—'} ${p}`));
971
- if (exists && !sourcePath) {
972
- sourcePath = p;
973
- }
974
- }
975
- if (!sourcePath) {
976
- console.warn(chalk_1.default.yellow(' āš ļø No command templates found in package paths'));
977
- console.warn(chalk_1.default.yellow(' ā„¹ļø Commands can be added manually to .claude/commands/'));
978
- return;
979
- }
980
- console.log(chalk_1.default.green(` āœ“ Found command templates at: ${sourcePath}`));
981
- const targetPath = path.join(process.cwd(), '.claude/commands');
982
- let copiedCount = 0;
983
- // Copy each AQE command file
984
- for (const commandFile of AQE_COMMANDS) {
985
- const sourceFile = path.join(sourcePath, commandFile);
986
- const targetFile = path.join(targetPath, commandFile);
987
- // Skip if already exists or if source doesn't exist
988
- if (await fs.pathExists(targetFile)) {
989
- console.log(chalk_1.default.gray(` • Skipped ${commandFile} (already exists)`));
990
- continue;
991
- }
992
- if (!await fs.pathExists(sourceFile)) {
993
- console.log(chalk_1.default.gray(` • Skipped ${commandFile} (source not found)`));
994
- continue;
995
- }
996
- // Copy the command file
997
- await fs.copy(sourceFile, targetFile);
998
- copiedCount++;
999
- console.log(chalk_1.default.gray(` āœ“ Copied ${commandFile}`));
1000
- }
1001
- // Count final commands
1002
- const finalCommandCount = await this.countCommandFiles(targetPath);
1003
- if (copiedCount > 0) {
1004
- console.log(chalk_1.default.green(` āœ“ Copied ${copiedCount} new AQE commands`));
1005
- }
1006
- else {
1007
- console.log(chalk_1.default.green(' āœ“ All AQE commands already present'));
1008
- }
1009
- console.log(chalk_1.default.cyan(` šŸ“‹ Total AQE commands initialized: ${finalCommandCount}`));
1010
- // Verify we have all 8 AQE commands
1011
- if (finalCommandCount >= 8) {
1012
- console.log(chalk_1.default.green(' āœ… All 8 AQE slash commands successfully initialized'));
1013
- }
1014
- else if (finalCommandCount < 8) {
1015
- console.warn(chalk_1.default.yellow(` āš ļø Expected 8 AQE commands, found ${finalCommandCount}`));
1016
- }
1017
- }
1018
- /**
1019
- * Count command files in .claude/commands
1020
- */
1021
- static async countCommandFiles(dirPath) {
1022
- if (!await fs.pathExists(dirPath))
1023
- return 0;
1024
- const items = await fs.readdir(dirPath);
1025
- return items.filter(f => f.startsWith('aqe-') && f.endsWith('.md')).length;
1026
- }
1027
- static async writeFleetConfig(config) {
1028
- console.log(chalk_1.default.cyan(' šŸ“ Writing fleet configuration...'));
1029
- // Sanitize config to remove undefined values that cause jsonfile errors
1030
- const sanitizedConfig = this.sanitizeConfig(config);
1031
- const configPath = '.agentic-qe/config/fleet.json';
1032
- await fs.writeJson(configPath, sanitizedConfig, { spaces: 2 });
1033
- console.log(chalk_1.default.gray(` āœ“ Wrote ${configPath}`));
1034
- // Create agent configurations
1035
- const agentConfigs = this.sanitizeConfig(this.generateAgentConfigs(config));
1036
- await fs.writeJson('.agentic-qe/config/agents.json', agentConfigs, { spaces: 2 });
1037
- console.log(chalk_1.default.gray(` āœ“ Wrote .agentic-qe/config/agents.json`));
1038
- // Create environment configurations
1039
- const envConfigs = this.sanitizeConfig(this.generateEnvironmentConfigs(config.environments || []));
1040
- await fs.writeJson('.agentic-qe/config/environments.json', envConfigs, { spaces: 2 });
1041
- console.log(chalk_1.default.gray(` āœ“ Wrote .agentic-qe/config/environments.json`));
1042
- // Create routing configuration
1043
- await this.writeRoutingConfig(config);
1044
- console.log(chalk_1.default.green(' āœ“ Fleet configuration complete'));
1045
- }
1046
- /**
1047
- * Sanitize config object by removing undefined values and ensuring all properties are serializable
1048
- */
1049
- static sanitizeConfig(obj) {
1050
- if (obj === null || obj === undefined) {
1051
- return null;
1052
- }
1053
- if (Array.isArray(obj)) {
1054
- return obj.map(item => this.sanitizeConfig(item)).filter(item => item !== null && item !== undefined);
1055
- }
1056
- if (typeof obj === 'object') {
1057
- const sanitized = {};
1058
- for (const [key, value] of Object.entries(obj)) {
1059
- // Skip undefined values
1060
- if (value === undefined) {
1061
- continue;
1062
- }
1063
- // Recursively sanitize nested objects
1064
- const sanitizedValue = this.sanitizeConfig(value);
1065
- if (sanitizedValue !== null && sanitizedValue !== undefined) {
1066
- sanitized[key] = sanitizedValue;
1067
- }
1068
- }
1069
- return sanitized;
1070
- }
1071
- return obj;
1072
- }
1073
- static async writeRoutingConfig(config) {
1074
- const routingConfig = {
1075
- multiModelRouter: {
1076
- enabled: config.routing?.enabled || false,
1077
- version: PACKAGE_VERSION,
1078
- defaultModel: config.routing?.defaultModel || 'claude-sonnet-4.5',
1079
- enableCostTracking: config.routing?.enableCostTracking !== false,
1080
- enableFallback: config.routing?.enableFallback !== false,
1081
- maxRetries: config.routing?.maxRetries || 3,
1082
- costThreshold: config.routing?.costThreshold || 0.5,
1083
- modelRules: {
1084
- simple: {
1085
- model: 'gpt-3.5-turbo',
1086
- maxTokens: 2000,
1087
- estimatedCost: 0.0004
1088
- },
1089
- moderate: {
1090
- model: 'gpt-3.5-turbo',
1091
- maxTokens: 4000,
1092
- estimatedCost: 0.0008
1093
- },
1094
- complex: {
1095
- model: 'gpt-4',
1096
- maxTokens: 8000,
1097
- estimatedCost: 0.0048
1098
- },
1099
- critical: {
1100
- model: 'claude-sonnet-4.5',
1101
- maxTokens: 8000,
1102
- estimatedCost: 0.0065
1103
- }
1104
- },
1105
- fallbackChains: {
1106
- 'gpt-4': ['gpt-3.5-turbo', 'claude-haiku'],
1107
- 'gpt-3.5-turbo': ['claude-haiku', 'gpt-4'],
1108
- 'claude-sonnet-4.5': ['claude-haiku', 'gpt-4'],
1109
- 'claude-haiku': ['gpt-3.5-turbo']
1110
- }
1111
- },
1112
- streaming: {
1113
- enabled: config.streaming?.enabled !== false,
1114
- progressInterval: config.streaming?.progressInterval || 2000,
1115
- bufferEvents: config.streaming?.bufferEvents || false,
1116
- timeout: config.streaming?.timeout || 1800000
1117
- }
1118
- };
1119
- await fs.writeJson('.agentic-qe/config/routing.json', routingConfig, { spaces: 2 });
1120
- }
1121
- static generateAgentConfigs(fleetConfig) {
1122
- const agentTypes = [
1123
- 'test-generator',
1124
- 'coverage-analyzer',
1125
- 'quality-gate',
1126
- 'performance-tester',
1127
- 'security-scanner'
1128
- ];
1129
- return {
1130
- fleet: {
1131
- topology: fleetConfig.topology,
1132
- maxAgents: fleetConfig.maxAgents,
1133
- agents: agentTypes.map(type => ({
1134
- type,
1135
- count: type === 'test-generator' ? 2 : 1,
1136
- capabilities: this.getAgentCapabilities(type),
1137
- resources: {
1138
- memory: '100MB',
1139
- cpu: '0.5'
1140
- }
1141
- }))
1142
- }
1143
- };
1144
- }
1145
- static getAgentCapabilities(agentType) {
1146
- const capabilities = {
1147
- 'test-generator': ['unit-tests', 'integration-tests', 'property-based-testing', 'test-data-synthesis'],
1148
- 'coverage-analyzer': ['coverage-analysis', 'gap-identification', 'trend-analysis'],
1149
- 'quality-gate': ['quality-metrics', 'threshold-enforcement', 'decision-making'],
1150
- 'performance-tester': ['load-testing', 'stress-testing', 'bottleneck-analysis'],
1151
- 'security-scanner': ['vulnerability-scanning', 'security-testing', 'compliance-checking']
1152
- };
1153
- return capabilities[agentType] || [];
1154
- }
1155
- static generateEnvironmentConfigs(environments) {
1156
- return environments.reduce((configs, env) => {
1157
- configs[env] = {
1158
- database: {
1159
- type: env === 'production' ? 'postgresql' : 'sqlite',
1160
- connectionString: env === 'production'
1161
- ? '${DATABASE_URL}'
1162
- : `.agentic-qe/data/${env}.db`
1163
- },
1164
- testing: {
1165
- parallel: env !== 'production',
1166
- timeout: env === 'production' ? 600 : 300,
1167
- retries: env === 'production' ? 2 : 1
1168
- },
1169
- monitoring: {
1170
- enabled: true,
1171
- metrics: ['coverage', 'performance', 'quality'],
1172
- alerts: env === 'production'
1173
- }
1174
- };
1175
- return configs;
1176
- }, {});
1177
- }
1178
- static async setupClaudeFlowIntegration(config) {
1179
- // Create AQE hooks configuration (native, zero dependencies)
1180
- const hooksConfig = {
1181
- hooks: {
1182
- 'pre-task': {
1183
- // AQE hooks are built-in via BaseAgent.onPreTask() - no external commands needed
1184
- enabled: true,
1185
- description: 'Pre-task verification via BaseAgent lifecycle hooks'
1186
- },
1187
- 'post-edit': {
1188
- // AQE hooks use VerificationHookManager.executePostEditUpdate() - no external commands
1189
- enabled: true,
1190
- description: 'Post-edit validation via VerificationHookManager'
1191
- },
1192
- 'post-task': {
1193
- // AQE hooks via BaseAgent.onPostTask() - built-in coordination
1194
- enabled: true,
1195
- description: 'Post-task coordination via BaseAgent lifecycle hooks'
1196
- }
1197
- },
1198
- coordination: {
1199
- enabled: true,
1200
- topology: config.topology,
1201
- memory: {
1202
- namespace: 'agentic-qe',
1203
- ttl: 3600,
1204
- implementation: 'SwarmMemoryManager' // TypeScript-native memory store
1205
- },
1206
- hooks_system: 'aqe-hooks', // Built-in AQE hooks protocol
1207
- performance: '100-500x faster than external hooks'
1208
- }
1209
- };
1210
- await fs.writeJson('.agentic-qe/config/aqe-hooks.json', hooksConfig, { spaces: 2 });
1211
- }
1212
- static async spawnInitialAgents(config) {
1213
- // Create agent registry
1214
- const agentRegistry = {
1215
- fleet: {
1216
- id: `fleet-${Date.now()}`,
1217
- status: 'initializing',
1218
- agents: [],
1219
- created: new Date().toISOString()
1220
- }
1221
- };
1222
- await fs.writeJson('.agentic-qe/data/registry.json', agentRegistry, { spaces: 2 });
1223
- }
1224
- static async initializeCoordination(config) {
1225
- // Ensure config has required properties
1226
- const topology = config.topology || 'hierarchical';
1227
- const maxAgents = config.maxAgents || 10;
1228
- // Create a sanitized config with relative paths for the script
1229
- const scriptConfig = { ...config };
1230
- if (scriptConfig.project) {
1231
- // Ensure project path is relative (always use . for portability)
1232
- scriptConfig.project = {
1233
- ...scriptConfig.project,
1234
- path: '.' // Relative path - script runs from project root
1235
- };
1236
- }
1237
- // Escape JSON for embedding in bash script
1238
- const configJson = JSON.stringify(scriptConfig, null, 2).replace(/\$/g, '\\$');
1239
- // Create pre-execution coordination script (AQE native)
1240
- const preExecutionScript = `#!/bin/bash
1241
- # Agentic QE Fleet Pre-Execution Coordination
1242
- # This script uses native AQE capabilities - no external dependencies required
1243
-
1244
- # Ensure we're in the project root (works from any directory)
1245
- SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
1246
- PROJECT_ROOT="$(cd "$SCRIPT_DIR/../.." && pwd)"
1247
- cd "$PROJECT_ROOT" || exit 1
1248
-
1249
- # Store fleet status before execution
1250
- agentic-qe fleet status --json > /tmp/aqe-fleet-status-pre.json 2>/dev/null || true
1251
-
1252
- # Log coordination event
1253
- echo "[AQE] Pre-execution coordination: Fleet topology=${topology}, Max agents=${maxAgents}" >> .agentic-qe/logs/coordination.log
1254
-
1255
- # Store fleet config in coordination memory (via file-based state)
1256
- mkdir -p .agentic-qe/state/coordination
1257
- cat > .agentic-qe/state/coordination/fleet-config.json << 'FLEET_CONFIG_EOF'
1258
- ${configJson}
1259
- FLEET_CONFIG_EOF
1260
-
1261
- echo "[AQE] Pre-execution coordination complete"
1262
- `;
1263
- // Create post-execution coordination script (AQE native)
1264
- const postExecutionScript = `#!/bin/bash
1265
- # Agentic QE Fleet Post-Execution Coordination
1266
- # This script uses native AQE capabilities - no external dependencies required
1267
-
1268
- # Ensure we're in the project root (works from any directory)
1269
- SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
1270
- PROJECT_ROOT="$(cd "$SCRIPT_DIR/../.." && pwd)"
1271
- cd "$PROJECT_ROOT" || exit 1
1272
-
1273
- # Capture final fleet status
1274
- agentic-qe fleet status --json > /tmp/aqe-fleet-status-post.json 2>/dev/null || true
1275
-
1276
- # Log execution completion
1277
- echo "[AQE] Post-execution coordination: Execution completed at $(date)" >> .agentic-qe/logs/coordination.log
1278
-
1279
- # Store execution timestamp
1280
- echo "{\\"timestamp\\": \\"$(date -Iseconds)\\", \\"status\\": \\"completed\\"}" > .agentic-qe/state/coordination/last-execution.json
1281
-
1282
- echo "[AQE] Post-execution coordination complete"
1283
- `;
1284
- // Write coordination scripts
1285
- await fs.writeFile('.agentic-qe/scripts/pre-execution.sh', preExecutionScript);
1286
- await fs.chmod('.agentic-qe/scripts/pre-execution.sh', '755');
1287
- await fs.writeFile('.agentic-qe/scripts/post-execution.sh', postExecutionScript);
1288
- await fs.chmod('.agentic-qe/scripts/post-execution.sh', '755');
1289
- // Create coordination log directory
1290
- await fs.ensureDir('.agentic-qe/logs');
1291
- await fs.ensureDir('.agentic-qe/state/coordination');
1292
- }
1293
- static async createClaudeMd(config, isYesMode = false) {
1294
- const claudeMdPath = 'CLAUDE.md';
1295
- const agentCount = await this.countAgentFiles('.claude/agents');
1296
- // Check if CLAUDE.md exists
1297
- const exists = await fs.pathExists(claudeMdPath);
1298
- let existingContent = '';
1299
- let appendPosition = 'append'; // default for --yes mode (v1.3.7 fix)
1300
- if (exists) {
1301
- // Backup existing CLAUDE.md
1302
- const backupPath = 'CLAUDE.md.backup';
1303
- await fs.copy(claudeMdPath, backupPath);
1304
- console.log(chalk_1.default.yellow(` ā„¹ļø Existing CLAUDE.md backed up to ${backupPath}`));
1305
- // Read existing content
1306
- existingContent = await fs.readFile(claudeMdPath, 'utf8');
1307
- // In interactive mode, ask where to add AQE instructions (v1.3.7 fix)
1308
- if (!isYesMode) {
1309
- const { position } = await inquirer_1.default.prompt([
1310
- {
1311
- type: 'list',
1312
- name: 'position',
1313
- message: 'Existing CLAUDE.md detected. Where should we add AQE instructions?',
1314
- choices: [
1315
- {
1316
- name: 'At the end (append) - Recommended',
1317
- value: 'append',
1318
- },
1319
- {
1320
- name: 'At the beginning (prepend)',
1321
- value: 'prepend',
1322
- },
1323
- ],
1324
- default: 'append',
1325
- },
1326
- ]);
1327
- appendPosition = position;
1328
- }
1329
- }
1330
- // Generate condensed CLAUDE.md using template
1331
- const claudeMdContent = (0, init_claude_md_template_1.generateCondensedClaudeMd)({
1332
- agentCount,
1333
- topology: config.topology,
1334
- maxAgents: config.maxAgents,
1335
- testingFocus: config.testingFocus,
1336
- environments: config.environments,
1337
- frameworks: config.frameworks,
1338
- routing: config.routing,
1339
- streaming: config.streaming,
1340
- }, PACKAGE_VERSION);
1341
- /* OLD TEMPLATE - Replaced with condensed version
1342
- const claudeMdContent = `# Claude Code Configuration - Agentic QE Fleet
1343
-
1344
- ## šŸ¤– Agentic Quality Engineering Fleet
1345
-
1346
- This project uses the **Agentic QE Fleet** - a distributed swarm of ${agentCount} AI agents for comprehensive software testing and quality assurance.
1347
-
1348
- ### Available Agents
1349
-
1350
- #### Core Testing (5 agents)
1351
- - **qe-test-generator**: AI-powered test generation with sublinear optimization
1352
- - **qe-test-executor**: Multi-framework test execution with parallel processing
1353
- - **qe-coverage-analyzer**: Real-time gap detection with O(log n) algorithms
1354
- - **qe-quality-gate**: Intelligent quality gate with risk assessment
1355
- - **qe-quality-analyzer**: Comprehensive quality metrics analysis
1356
-
1357
- #### Performance & Security (2 agents)
1358
- - **qe-performance-tester**: Load testing with k6, JMeter, Gatling integration
1359
- - **qe-security-scanner**: Multi-layer security with SAST/DAST scanning
1360
-
1361
- #### Strategic Planning (3 agents)
1362
- - **qe-requirements-validator**: INVEST criteria validation and BDD generation
1363
- - **qe-production-intelligence**: Production data to test scenarios conversion
1364
- - **qe-fleet-commander**: Hierarchical fleet coordination (50+ agents)
1365
-
1366
- #### Deployment (1 agent)
1367
- - **qe-deployment-readiness**: Multi-factor risk assessment for deployments
1368
-
1369
- #### Advanced Testing (4 agents)
1370
- - **qe-regression-risk-analyzer**: Smart test selection with ML patterns
1371
- - **qe-test-data-architect**: High-speed realistic data generation (10k+ records/sec)
1372
- - **qe-api-contract-validator**: Breaking change detection across API versions
1373
- - **qe-flaky-test-hunter**: Statistical flakiness detection and auto-stabilization
1374
-
1375
- #### Specialized (2 agents)
1376
- - **qe-visual-tester**: Visual regression with AI-powered comparison
1377
- - **qe-chaos-engineer**: Resilience testing with controlled fault injection
1378
-
1379
- ## šŸš€ Quick Start
1380
-
1381
- ### Using Agents via Claude Code Task Tool (Recommended)
1382
-
1383
- \\\`\\\`\\\`javascript
1384
- // Spawn agents directly in Claude Code
1385
- Task("Generate tests", "Create comprehensive test suite for UserService", "qe-test-generator")
1386
- Task("Analyze coverage", "Find gaps using O(log n) algorithms", "qe-coverage-analyzer")
1387
- Task("Quality check", "Run quality gate validation", "qe-quality-gate")
1388
- \\\`\\\`\\\`
1389
-
1390
- ### Using MCP Tools
1391
-
1392
- \\\`\\\`\\\`bash
1393
- # Check MCP connection
1394
- claude mcp list
1395
- # Should show: agentic-qe: npm run mcp:start - āœ“ Connected
1396
-
1397
- # Use MCP tools in Claude Code
1398
- mcp__agentic_qe__test_generate({ type: "unit", framework: "${config.frameworks?.[0] || 'jest'}" })
1399
- mcp__agentic_qe__test_execute({ parallel: true, coverage: true })
1400
- mcp__agentic_qe__quality_analyze({ scope: "full" })
1401
- \\\`\\\`\\\`
1402
-
1403
- ### Using CLI
1404
-
1405
- \\\`\\\`\\\`bash
1406
- # Quick commands
1407
- aqe test <module-name> # Generate tests
1408
- aqe coverage # Analyze coverage
1409
- aqe quality # Run quality gate
1410
- aqe status # Check fleet status
1411
- \\\`\\\`\\\`
1412
-
1413
- ## šŸ”„ Agent Coordination
1414
-
1415
- All agents coordinate through **AQE hooks** (Agentic QE native hooks - zero external dependencies, 100-500x faster):
1416
-
1417
- ### Automatic Lifecycle Hooks
1418
-
1419
- Agents extend \\\`BaseAgent\\\` and override lifecycle methods:
1420
-
1421
- \\\`\\\`\\\`typescript
1422
- protected async onPreTask(data: { assignment: TaskAssignment }): Promise<void> {
1423
- // Load context before task execution
1424
- const context = await this.memoryStore.retrieve('aqe/context', {
1425
- partition: 'coordination'
1426
- });
1427
-
1428
- this.logger.info('Pre-task hook complete');
1429
- }
1430
-
1431
- protected async onPostTask(data: { assignment: TaskAssignment; result: any }): Promise<void> {
1432
- // Store results after task completion
1433
- await this.memoryStore.store('aqe/' + this.agentId.type + '/results', data.result, {
1434
- partition: 'agent_results',
1435
- ttl: 86400 // 24 hours
1436
- });
1437
-
1438
- // Emit completion event
1439
- this.eventBus.emit('task:completed', {
1440
- agentId: this.agentId,
1441
- result: data.result
1442
- });
1443
-
1444
- this.logger.info('Post-task hook complete');
1445
- }
1446
-
1447
- protected async onTaskError(data: { assignment: TaskAssignment; error: Error }): Promise<void> {
1448
- // Handle task errors
1449
- await this.memoryStore.store('aqe/errors/' + data.assignment.id, {
1450
- error: data.error.message,
1451
- stack: data.error.stack,
1452
- timestamp: Date.now()
1453
- }, {
1454
- partition: 'errors',
1455
- ttl: 604800 // 7 days
1456
- });
1457
-
1458
- this.logger.error('Task failed', { error: data.error });
1459
- }
1460
- \\\`\\\`\\\`
1461
-
1462
- ### Performance Comparison
1463
-
1464
- | Feature | AQE Hooks | External Hooks |
1465
- |---------|-----------|----------------|
1466
- | **Speed** | <1ms | 100-500ms |
1467
- | **Dependencies** | Zero | External package |
1468
- | **Type Safety** | Full TypeScript | Shell strings |
1469
- | **Integration** | Direct API | Shell commands |
1470
- | **Performance** | 100-500x faster | Baseline |
1471
-
1472
- ## šŸ“‹ Memory Namespace
1473
-
1474
- Agents share state through the **\\\`aqe/*\\\` memory namespace**:
1475
-
1476
- - \\\`aqe/test-plan/*\\\` - Test planning and requirements
1477
- - \\\`aqe/coverage/*\\\` - Coverage analysis and gaps
1478
- - \\\`aqe/quality/*\\\` - Quality metrics and gates
1479
- - \\\`aqe/performance/*\\\` - Performance test results
1480
- - \\\`aqe/security/*\\\` - Security scan findings
1481
- - \\\`aqe/swarm/coordination\\\` - Cross-agent coordination
1482
-
1483
- ## šŸŽÆ Fleet Configuration
1484
-
1485
- **Topology**: ${config.topology}
1486
- **Max Agents**: ${config.maxAgents}
1487
- **Testing Focus**: ${config.testingFocus?.join(', ') || 'All areas'}
1488
- **Environments**: ${config.environments?.join(', ') || 'Not specified'}
1489
- **Frameworks**: ${config.frameworks?.join(', ') || 'jest'}
1490
-
1491
- ## šŸ’° Multi-Model Router (v${PACKAGE_VERSION})
1492
-
1493
- **Status**: ${config.routing?.enabled ? 'āœ… Enabled' : 'āš ļø Disabled (opt-in)'}
1494
-
1495
- The Multi-Model Router provides **70-81% cost savings** by intelligently selecting AI models based on task complexity.
1496
-
1497
- ### Features
1498
-
1499
- - āœ… Intelligent model selection (GPT-3.5, GPT-4, Claude Sonnet 4.5, Claude Haiku)
1500
- - āœ… Real-time cost tracking and aggregation
1501
- - āœ… Automatic fallback chains for resilience
1502
- - āœ… Feature flags for safe rollout
1503
- - āœ… Zero breaking changes (disabled by default)
1504
-
1505
- ### Enabling Routing
1506
-
1507
- **Option 1: Via Configuration**
1508
- \\\`\\\`\\\`json
1509
- // .agentic-qe/config/routing.json
1510
- {
1511
- "multiModelRouter": {
1512
- "enabled": true
1513
- }
1514
- }
1515
- \\\`\\\`\\\`
1516
-
1517
- **Option 2: Via Environment Variable**
1518
- \\\`\\\`\\\`bash
1519
- export AQE_ROUTING_ENABLED=true
1520
- \\\`\\\`\\\`
1521
-
1522
- ### Model Selection Rules
1523
-
1524
- | Task Complexity | Model | Est. Cost | Use Case |
1525
- |----------------|-------|-----------|----------|
1526
- | **Simple** | GPT-3.5 | $0.0004 | Unit tests, basic validation |
1527
- | **Moderate** | GPT-3.5 | $0.0008 | Integration tests, mocks |
1528
- | **Complex** | GPT-4 | $0.0048 | Property-based, edge cases |
1529
- | **Critical** | Claude Sonnet 4.5 | $0.0065 | Security, architecture review |
1530
-
1531
- ### Cost Savings Example
1532
-
1533
- **Before Routing** (always GPT-4):
1534
- - 100 simple tasks: $0.48
1535
- - 50 complex tasks: $0.24
1536
- - **Total**: $0.72
1537
-
1538
- **After Routing**:
1539
- - 100 simple → GPT-3.5: $0.04
1540
- - 50 complex → GPT-4: $0.24
1541
- - **Total**: $0.28
1542
- - **Savings**: $0.44 (61%)
1543
-
1544
- ### Monitoring Costs
1545
-
1546
- \\\`\\\`\\\`bash
1547
- # View cost dashboard
1548
- aqe routing dashboard
1549
-
1550
- # Export cost report
1551
- aqe routing report --format json
1552
-
1553
- # Check savings
1554
- aqe routing stats
1555
- \\\`\\\`\\\`
1556
-
1557
- ## šŸ“Š Streaming Progress (v${PACKAGE_VERSION})
1558
-
1559
- **Status**: ${config.streaming?.enabled ? 'āœ… Enabled' : 'āš ļø Disabled'}
1560
-
1561
- Real-time progress updates for long-running operations using AsyncGenerator pattern.
1562
-
1563
- ### Features
1564
-
1565
- - āœ… Real-time progress percentage
1566
- - āœ… Current operation visibility
1567
- - āœ… for-await-of compatibility
1568
- - āœ… Backward compatible (non-streaming still works)
1569
-
1570
- ### Example Usage
1571
-
1572
- \\\`\\\`\\\`javascript
1573
- // Using streaming MCP tool
1574
- const handler = new TestExecuteStreamHandler();
1575
-
1576
- for await (const event of handler.execute(params)) {
1577
- if (event.type === 'progress') {
1578
- console.log(\\\`Progress: \\\${event.percent}% - \\\${event.message}\\\`);
1579
- } else if (event.type === 'result') {
1580
- console.log('Completed:', event.data);
1581
- }
1582
- }
1583
- \\\`\\\`\\\`
1584
-
1585
- ### Supported Operations
1586
-
1587
- - āœ… Test execution (test-by-test progress)
1588
- - āœ… Coverage analysis (incremental gap detection)
1589
- - āš ļø Test generation (coming in v1.1.0)
1590
- - āš ļø Security scanning (coming in v1.1.0)
1591
-
1592
- ## šŸŽÆ Claude Code Skills Integration
1593
-
1594
- This fleet includes **38 specialized QE skills** that agents can use:
1595
-
1596
- ### Phase 1: Original Quality Engineering Skills (18 skills)
1597
-
1598
- #### Core Testing (3 skills)
1599
- - **agentic-quality-engineering**: Using AI agents as force multipliers in quality work - autonomous testing systems, PACT principles, scaling quality engineering with intelligent agents
1600
- - **context-driven-testing**: Apply context-driven testing principles where practices are chosen based on project context, not universal "best practices"
1601
- - **holistic-testing-pact**: Apply the Holistic Testing Model evolved with PACT (Proactive, Autonomous, Collaborative, Targeted) principles
1602
-
1603
- #### Testing Methodologies (4 skills)
1604
- - **tdd-london-chicago**: Apply both London and Chicago school TDD approaches - understanding different TDD philosophies and choosing the right testing style
1605
- - **xp-practices**: Apply XP practices including pair programming, ensemble programming, continuous integration, and sustainable pace
1606
- - **risk-based-testing**: Focus testing effort on highest-risk areas using risk assessment and prioritization
1607
- - **test-automation-strategy**: Design and implement comprehensive test automation strategies
1608
-
1609
- #### Testing Techniques (4 skills)
1610
- - **api-testing-patterns**: Comprehensive API testing patterns including contract testing, REST/GraphQL testing, and integration testing
1611
- - **exploratory-testing-advanced**: Advanced exploratory testing techniques with Session-Based Test Management (SBTM), RST heuristics, and test tours
1612
- - **performance-testing**: Test application performance, scalability, and resilience with load testing and stress testing
1613
- - **security-testing**: Test for security vulnerabilities using OWASP principles and security testing techniques
1614
-
1615
- #### Code Quality (3 skills)
1616
- - **code-review-quality**: Conduct context-driven code reviews focusing on quality, testability, and maintainability
1617
- - **refactoring-patterns**: Apply safe refactoring patterns to improve code structure without changing behavior
1618
- - **quality-metrics**: Measure quality effectively with actionable metrics and KPIs
1619
-
1620
- #### Communication (3 skills)
1621
- - **bug-reporting-excellence**: Write high-quality bug reports that get fixed quickly - includes templates, examples, and best practices
1622
- - **technical-writing**: Create clear, concise technical documentation
1623
- - **consultancy-practices**: Apply effective software quality consultancy practices
1624
-
1625
- ### Phase 2: Expanded QE Skills Library (17 skills)
1626
-
1627
- #### Testing Methodologies (6 skills)
1628
- - **regression-testing**: Strategic regression testing with test selection, impact analysis, and continuous regression management
1629
- - **shift-left-testing**: Move testing activities earlier in development lifecycle with TDD, BDD, and design for testability
1630
- - **shift-right-testing**: Testing in production with feature flags, canary deployments, synthetic monitoring, and chaos engineering
1631
- - **test-design-techniques**: Advanced test design using equivalence partitioning, boundary value analysis, and decision tables
1632
- - **mutation-testing**: Test quality validation through mutation testing and measuring test suite effectiveness
1633
- - **test-data-management**: Realistic test data generation, GDPR compliance, and data masking strategies
1634
-
1635
- #### Specialized Testing (9 skills)
1636
- - **accessibility-testing**: WCAG 2.2 compliance testing, screen reader validation, and inclusive design verification
1637
- - **mobile-testing**: Comprehensive mobile testing for iOS and Android including gestures, sensors, and device fragmentation
1638
- - **database-testing**: Database schema validation, data integrity testing, migration testing, and query performance
1639
- - **contract-testing**: Consumer-driven contract testing for microservices using Pact and API versioning
1640
- - **chaos-engineering-resilience**: Chaos engineering principles, controlled failure injection, and resilience testing
1641
- - **compatibility-testing**: Cross-browser, cross-platform, and cross-device compatibility testing
1642
- - **localization-testing**: Internationalization (i18n) and localization (l10n) testing for global products
1643
- - **compliance-testing**: Regulatory compliance testing for GDPR, CCPA, HIPAA, SOC2, and PCI-DSS
1644
- - **visual-testing-advanced**: Advanced visual regression testing with AI-powered screenshot comparison and UI validation
1645
-
1646
- #### Testing Infrastructure (2 skills)
1647
- - **test-environment-management**: Manage test environments, infrastructure as code, and environment provisioning
1648
- - **test-reporting-analytics**: Comprehensive test reporting with metrics, trends, and actionable insights
1649
-
1650
- ### Phase 3: Advanced Quality Engineering Skills (4 skills)
1651
-
1652
- #### Strategic Testing Methodologies (4 skills)
1653
- - **six-thinking-hats**: Apply De Bono's Six Thinking Hats methodology to quality engineering for comprehensive analysis from multiple perspectives
1654
- - **brutal-honesty-review**: Unvarnished technical criticism combining Linus Torvalds' precision, Gordon Ramsay's standards, and James Bach's BS-detection
1655
- - **sherlock-review**: Evidence-based investigative code review using deductive reasoning to determine what actually happened versus what was claimed
1656
- - **cicd-pipeline-qe-orchestrator**: Orchestrate comprehensive quality engineering across CI/CD pipeline phases with intelligent agent coordination
1657
-
1658
- ### Using Skills
1659
-
1660
- #### Via CLI
1661
- \\\`\\\`\\\`bash
1662
- # List all available skills
1663
- aqe skills list
1664
-
1665
- # Search for specific skills
1666
- aqe skills search "testing"
1667
-
1668
- # Show skill details
1669
- aqe skills show agentic-quality-engineering
1670
-
1671
- # Show skill statistics
1672
- aqe skills stats
1673
- \\\`\\\`\\\`
1674
-
1675
- #### Via Skill Tool in Claude Code
1676
- \\\`\\\`\\\`javascript
1677
- // Execute a skill
1678
- Skill("agentic-quality-engineering")
1679
- Skill("tdd-london-chicago")
1680
- Skill("api-testing-patterns")
1681
- \\\`\\\`\\\`
1682
-
1683
- #### Integration with Agents
1684
- All QE agents automatically have access to relevant skills based on their specialization:
1685
- - **Test generators** use: agentic-quality-engineering, api-testing-patterns, tdd-london-chicago
1686
- - **Coverage analyzers** use: agentic-quality-engineering, quality-metrics, risk-based-testing
1687
- - **Flaky test hunters** use: agentic-quality-engineering, exploratory-testing-advanced
1688
- - **Performance testers** use: agentic-quality-engineering, performance-testing, quality-metrics
1689
- - **Security scanners** use: agentic-quality-engineering, security-testing, risk-based-testing
1690
-
1691
- ## 🧠 Q-Learning Integration (Phase 2)
1692
-
1693
- All agents automatically learn from task execution through Q-learning:
1694
-
1695
- ### Observability
1696
- \\\`\\\`\\\`bash
1697
- # Check learning status
1698
- aqe learn status --agent test-gen
1699
-
1700
- # View learned patterns
1701
- aqe learn history --agent test-gen --limit 50
1702
-
1703
- # Export learning data
1704
- aqe learn export --agent test-gen --output learning.json
1705
- \\\`\\\`\\\`
1706
-
1707
- ### Pattern Management
1708
- \\\`\\\`\\\`bash
1709
- # List test patterns
1710
- aqe patterns list --framework jest
1711
-
1712
- # Search patterns
1713
- aqe patterns search "api validation"
1714
-
1715
- # Extract patterns from tests
1716
- aqe patterns extract ./tests --framework jest
1717
- \\\`\\\`\\\`
1718
-
1719
- ### Improvement Loop
1720
- \\\`\\\`\\\`bash
1721
- # Start continuous improvement
1722
- aqe improve start
1723
-
1724
- # Check improvement status
1725
- aqe improve status
1726
-
1727
- # Run single improvement cycle
1728
- aqe improve cycle
1729
- \\\`\\\`\\\`
1730
-
1731
- ## šŸ“š Documentation
1732
-
1733
- - **Agent Definitions**: \\\`.claude/agents/\\\` - ${agentCount} specialized QE agents (18 main + 8 TDD subagents)
1734
- - **Subagent Definitions**: \\\`.claude/agents/subagents/\\\` - 8 specialized TDD subagents for test generation workflow
1735
- - **Skills**: \\\`.claude/skills/\\\` - 38 specialized QE skills for agents (Phase 1: 18 + Phase 2: 16 + Phase 3: 4)
1736
- - **Fleet Config**: \\\`.agentic-qe/config/fleet.json\\\`
1737
- - **Routing Config**: \\\`.agentic-qe/config/routing.json\\\` (Multi-Model Router settings)
1738
- - **AQE Hooks Config**: \\\`.agentic-qe/config/aqe-hooks.json\\\` (zero dependencies, 100-500x faster)
1739
-
1740
- ## šŸ”§ Advanced Usage
1741
-
1742
- ### Parallel Agent Execution
1743
-
1744
- \\\`\\\`\\\`javascript
1745
- // Execute multiple agents concurrently
1746
- Task("Test Generation", "Generate unit tests", "qe-test-generator")
1747
- Task("Coverage Analysis", "Analyze current coverage", "qe-coverage-analyzer")
1748
- Task("Security Scan", "Run security checks", "qe-security-scanner")
1749
- Task("Performance Test", "Load test critical paths", "qe-performance-tester")
1750
- \\\`\\\`\\\`
1751
-
1752
- ### Agent Coordination Example
1753
-
1754
- \\\`\\\`\\\`javascript
1755
- // Test generator stores results
1756
- Task("Generate tests", "Create tests and store in memory at aqe/test-plan/generated", "qe-test-generator")
1757
-
1758
- // Test executor reads from memory
1759
- Task("Execute tests", "Read test plan from aqe/test-plan/generated and execute", "qe-test-executor")
1760
-
1761
- // Coverage analyzer processes results
1762
- Task("Analyze coverage", "Check coverage from aqe/coverage/results", "qe-coverage-analyzer")
1763
- \\\`\\\`\\\`
1764
-
1765
- ## šŸ’” Best Practices
1766
-
1767
- 1. **Use Task Tool**: Claude Code's Task tool is the primary way to spawn agents
1768
- 2. **Batch Operations**: Always spawn multiple related agents in a single message
1769
- 3. **Memory Keys**: Use the \\\`aqe/*\\\` namespace for agent coordination
1770
- 4. **AQE Hooks**: Agents automatically use native AQE hooks for coordination (100-500x faster)
1771
- 5. **Parallel Execution**: Leverage concurrent agent execution for speed
1772
-
1773
- ## šŸ†˜ Troubleshooting
1774
-
1775
- ### Check MCP Connection
1776
- \\\`\\\`\\\`bash
1777
- claude mcp list
1778
- \\\`\\\`\\\`
1779
-
1780
- ### View Agent Definitions
1781
- \\\`\\\`\\\`bash
1782
- ls -la .claude/agents/
1783
- \\\`\\\`\\\`
1784
-
1785
- ### Check Fleet Status
1786
- \\\`\\\`\\\`bash
1787
- aqe status --verbose
1788
- \\\`\\\`\\\`
1789
-
1790
- ### View Logs
1791
- \\\`\\\`\\\`bash
1792
- tail -f .agentic-qe/logs/fleet.log
1793
- \\\`\\\`\\\`
1794
-
1795
- ---
1796
-
1797
- **Generated by**: Agentic QE Fleet v${PACKAGE_VERSION}
1798
- **Initialization Date**: ${new Date().toISOString()}
1799
- **Fleet Topology**: ${config.topology}
1800
- `; */ // End of old template comment
1801
- // Write CLAUDE.md based on append strategy (v1.3.7 fix)
1802
- let finalContent;
1803
- if (exists && existingContent) {
1804
- const separator = '\n\n---\n\n';
1805
- if (appendPosition === 'append') {
1806
- finalContent = existingContent + separator + claudeMdContent;
1807
- console.log(chalk_1.default.green(` āœ“ AQE instructions appended to existing CLAUDE.md`));
1808
- }
1809
- else {
1810
- finalContent = claudeMdContent + separator + existingContent;
1811
- console.log(chalk_1.default.green(` āœ“ AQE instructions prepended to existing CLAUDE.md`));
1812
- }
1813
- }
1814
- else {
1815
- finalContent = claudeMdContent;
1816
- }
1817
- await fs.writeFile(claudeMdPath, finalContent);
1818
- }
1819
- // ============================================================================
1820
- // Phase 2 Initialization Methods (v1.1.0)
1821
- // ============================================================================
1822
11
  /**
1823
- * Initialize AgentDB for Learning (v1.8.0 - replaces patterns.db)
12
+ * ⚔ UPDATED: Now uses modular orchestrator from src/cli/init/
1824
13
  *
1825
- * Consolidated learning storage for all QE agents using AgentDB.
1826
- * Replaces the deprecated patterns.db with vector-based learning storage.
1827
- */
1828
- static async initializeAgentDB(config) {
1829
- const dbPath = path.join(process.cwd(), '.agentic-qe', 'agentdb.db');
1830
- console.log(chalk_1.default.cyan(' 🧠 Initializing AgentDB learning system...'));
1831
- // Import AgentDB dynamically
1832
- const { createAgentDBManager } = await Promise.resolve().then(() => __importStar(require('../../core/memory/AgentDBManager')));
1833
- // Initialize AgentDB with learning configuration
1834
- const agentDB = await createAgentDBManager({
1835
- dbPath,
1836
- enableLearning: true,
1837
- enableReasoning: true,
1838
- cacheSize: 1000,
1839
- quantizationType: 'scalar'
1840
- });
1841
- // CRITICAL: Must initialize before calling getStats()
1842
- await agentDB.initialize();
1843
- // Verify initialization
1844
- const stats = await agentDB.getStats();
1845
- await agentDB.close();
1846
- console.log(chalk_1.default.green(' āœ“ AgentDB learning system initialized'));
1847
- console.log(chalk_1.default.gray(` • Database: ${dbPath}`));
1848
- console.log(chalk_1.default.gray(` • Episodes stored: ${stats.episodeCount || 0}`));
1849
- console.log(chalk_1.default.gray(` • Vector search: HNSW enabled (150x faster)`));
1850
- console.log(chalk_1.default.gray(` • Learning: Reflexion pattern + Q-values`));
1851
- console.log(chalk_1.default.gray(` • Used by: All 19 QE agents`));
1852
- console.log(chalk_1.default.yellow(` ā“˜ patterns.db deprecated - using AgentDB for all learning`));
1853
- }
1854
- /**
1855
- * Initialize Phase 2 Memory Database (SwarmMemoryManager)
1856
- */
1857
- static async initializeMemoryDatabase() {
1858
- const dbPath = path.join(process.cwd(), '.agentic-qe', 'memory.db');
1859
- console.log(chalk_1.default.cyan(' šŸ’¾ Initializing Memory Manager database...'));
1860
- // Import SwarmMemoryManager dynamically
1861
- const { SwarmMemoryManager } = await Promise.resolve().then(() => __importStar(require('../../core/memory/SwarmMemoryManager')));
1862
- const memoryManager = new SwarmMemoryManager(dbPath);
1863
- await memoryManager.initialize();
1864
- // Verify tables created
1865
- const stats = await memoryManager.stats();
1866
- await memoryManager.close();
1867
- console.log(chalk_1.default.green(' āœ“ Memory Manager initialized'));
1868
- console.log(chalk_1.default.gray(` • Database: ${dbPath}`));
1869
- console.log(chalk_1.default.gray(` • Tables: 12 tables (memory_entries, hints, events, workflow_state, patterns, etc.)`));
1870
- console.log(chalk_1.default.gray(` • Access control: 5 levels (private, team, swarm, public, system)`));
1871
- }
1872
- /**
1873
- * Initialize Phase 2 Learning System
1874
- */
1875
- static async initializeLearningSystem(config) {
1876
- const learningConfig = {
1877
- enabled: true,
1878
- learningRate: 0.1,
1879
- discountFactor: 0.95,
1880
- explorationRate: 0.2,
1881
- explorationDecay: 0.995,
1882
- minExplorationRate: 0.01,
1883
- targetImprovement: 0.20, // 20% improvement goal
1884
- maxMemorySize: 100 * 1024 * 1024, // 100MB
1885
- batchSize: 32,
1886
- updateFrequency: 10,
1887
- replayBufferSize: 10000
1888
- };
1889
- // Store learning configuration
1890
- await fs.writeJson('.agentic-qe/config/learning.json', learningConfig, { spaces: 2 });
1891
- // Create learning database directory
1892
- await fs.ensureDir('.agentic-qe/data/learning');
1893
- // Create learning state placeholder
1894
- const learningState = {
1895
- initialized: true,
1896
- version: PACKAGE_VERSION,
1897
- createdAt: new Date().toISOString(),
1898
- agents: {} // Will be populated as agents learn
1899
- };
1900
- await fs.writeJson('.agentic-qe/data/learning/state.json', learningState, { spaces: 2 });
1901
- console.log(chalk_1.default.green(' āœ“ Learning system initialized'));
1902
- console.log(chalk_1.default.gray(` • Q-learning algorithm (lr=${learningConfig.learningRate}, γ=${learningConfig.discountFactor})`));
1903
- console.log(chalk_1.default.gray(` • Experience replay buffer: ${learningConfig.replayBufferSize} experiences`));
1904
- console.log(chalk_1.default.gray(` • Target improvement: ${learningConfig.targetImprovement * 100}%`));
1905
- }
1906
- /**
1907
- * Get inline Pattern Bank schema (fallback if schema file not found)
1908
- */
1909
- static getPatternBankSchema() {
1910
- return `
1911
- -- Enable WAL mode for better concurrent access
1912
- PRAGMA journal_mode = WAL;
1913
- PRAGMA synchronous = NORMAL;
1914
-
1915
- -- Core Pattern Storage
1916
- CREATE TABLE IF NOT EXISTS test_patterns (
1917
- id TEXT PRIMARY KEY NOT NULL,
1918
- pattern_type TEXT NOT NULL,
1919
- framework TEXT NOT NULL,
1920
- language TEXT NOT NULL DEFAULT 'typescript',
1921
- code_signature_hash TEXT NOT NULL,
1922
- code_signature JSON NOT NULL,
1923
- test_template JSON NOT NULL,
1924
- metadata JSON NOT NULL,
1925
- version TEXT NOT NULL DEFAULT '1.0.0',
1926
- created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
1927
- updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
1928
- CHECK(pattern_type IN ('edge-case', 'integration', 'boundary', 'error-handling', 'unit', 'e2e', 'performance', 'security')),
1929
- CHECK(framework IN ('jest', 'mocha', 'cypress', 'vitest', 'playwright', 'ava', 'jasmine')),
1930
- CHECK(json_valid(code_signature)),
1931
- CHECK(json_valid(test_template)),
1932
- CHECK(json_valid(metadata))
1933
- );
1934
-
1935
- CREATE INDEX IF NOT EXISTS idx_patterns_framework_type ON test_patterns(framework, pattern_type);
1936
- CREATE INDEX IF NOT EXISTS idx_patterns_signature_hash ON test_patterns(code_signature_hash);
1937
- CREATE UNIQUE INDEX IF NOT EXISTS idx_patterns_dedup ON test_patterns(code_signature_hash, framework);
1938
-
1939
- -- Pattern Usage Tracking
1940
- CREATE TABLE IF NOT EXISTS pattern_usage (
1941
- id INTEGER PRIMARY KEY AUTOINCREMENT,
1942
- pattern_id TEXT NOT NULL,
1943
- project_id TEXT NOT NULL,
1944
- usage_count INTEGER NOT NULL DEFAULT 0,
1945
- success_count INTEGER NOT NULL DEFAULT 0,
1946
- failure_count INTEGER NOT NULL DEFAULT 0,
1947
- avg_execution_time REAL NOT NULL DEFAULT 0.0,
1948
- avg_coverage_gain REAL NOT NULL DEFAULT 0.0,
1949
- flaky_count INTEGER NOT NULL DEFAULT 0,
1950
- quality_score REAL NOT NULL DEFAULT 0.0,
1951
- first_used TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
1952
- last_used TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
1953
- FOREIGN KEY (pattern_id) REFERENCES test_patterns(id) ON DELETE CASCADE,
1954
- UNIQUE(pattern_id, project_id)
1955
- );
1956
-
1957
- CREATE INDEX IF NOT EXISTS idx_usage_pattern ON pattern_usage(pattern_id);
1958
- CREATE INDEX IF NOT EXISTS idx_usage_quality ON pattern_usage(quality_score DESC);
1959
-
1960
- -- Cross-Project Pattern Sharing
1961
- CREATE TABLE IF NOT EXISTS cross_project_mappings (
1962
- id INTEGER PRIMARY KEY AUTOINCREMENT,
1963
- pattern_id TEXT NOT NULL,
1964
- source_framework TEXT NOT NULL,
1965
- target_framework TEXT NOT NULL,
1966
- transformation_rules JSON NOT NULL,
1967
- compatibility_score REAL NOT NULL DEFAULT 1.0,
1968
- project_count INTEGER NOT NULL DEFAULT 0,
1969
- success_rate REAL NOT NULL DEFAULT 0.0,
1970
- created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
1971
- updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
1972
- FOREIGN KEY (pattern_id) REFERENCES test_patterns(id) ON DELETE CASCADE,
1973
- UNIQUE(pattern_id, source_framework, target_framework),
1974
- CHECK(json_valid(transformation_rules))
1975
- );
1976
-
1977
- -- Pattern Similarity Index
1978
- CREATE TABLE IF NOT EXISTS pattern_similarity_index (
1979
- pattern_a TEXT NOT NULL,
1980
- pattern_b TEXT NOT NULL,
1981
- similarity_score REAL NOT NULL,
1982
- structure_similarity REAL NOT NULL,
1983
- identifier_similarity REAL NOT NULL,
1984
- metadata_similarity REAL NOT NULL,
1985
- algorithm TEXT NOT NULL DEFAULT 'hybrid-tfidf',
1986
- last_computed TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
1987
- PRIMARY KEY (pattern_a, pattern_b),
1988
- FOREIGN KEY (pattern_a) REFERENCES test_patterns(id) ON DELETE CASCADE,
1989
- FOREIGN KEY (pattern_b) REFERENCES test_patterns(id) ON DELETE CASCADE
1990
- );
1991
-
1992
- CREATE INDEX IF NOT EXISTS idx_similarity_score ON pattern_similarity_index(similarity_score DESC);
1993
-
1994
- -- Full-Text Search
1995
- CREATE VIRTUAL TABLE IF NOT EXISTS pattern_fts USING fts5(
1996
- pattern_id UNINDEXED,
1997
- pattern_name,
1998
- description,
1999
- tags,
2000
- framework,
2001
- pattern_type,
2002
- content='',
2003
- tokenize='porter ascii'
2004
- );
2005
-
2006
- -- Schema Version
2007
- CREATE TABLE IF NOT EXISTS schema_version (
2008
- version TEXT PRIMARY KEY,
2009
- applied_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
2010
- description TEXT
2011
- );
2012
-
2013
- INSERT OR IGNORE INTO schema_version (version, description)
2014
- VALUES ('1.1.0', 'Initial QE ReasoningBank schema');
2015
- `;
2016
- }
2017
- /**
2018
- * Initialize Phase 2 Improvement Loop
2019
- */
2020
- static async initializeImprovementLoop(config) {
2021
- const improvementConfig = {
2022
- enabled: true,
2023
- intervalMs: 3600000, // 1 hour
2024
- autoApply: false, // Requires user approval
2025
- enableABTesting: true,
2026
- strategies: {
2027
- parallelExecution: { enabled: true, weight: 0.8 },
2028
- adaptiveRetry: { enabled: true, maxRetries: 3 },
2029
- resourceOptimization: { enabled: true, adaptive: true }
2030
- },
2031
- thresholds: {
2032
- minImprovement: 0.05, // 5% minimum improvement to apply
2033
- maxFailureRate: 0.1, // 10% max failure rate
2034
- minConfidence: 0.8 // 80% confidence required
2035
- },
2036
- abTesting: {
2037
- sampleSize: 100,
2038
- significanceLevel: 0.05,
2039
- minSampleDuration: 3600000 // 1 hour
2040
- }
2041
- };
2042
- // Store improvement configuration
2043
- await fs.writeJson('.agentic-qe/config/improvement.json', improvementConfig, { spaces: 2 });
2044
- // Create improvement state
2045
- const improvementState = {
2046
- version: PACKAGE_VERSION,
2047
- lastCycle: null,
2048
- activeCycles: 0,
2049
- totalImprovement: 0,
2050
- strategies: {}
2051
- };
2052
- await fs.writeJson('.agentic-qe/data/improvement/state.json', improvementState, { spaces: 2 });
2053
- console.log(chalk_1.default.green(' āœ“ Improvement loop initialized'));
2054
- console.log(chalk_1.default.gray(` • Cycle interval: ${improvementConfig.intervalMs / 3600000} hour(s)`));
2055
- console.log(chalk_1.default.gray(` • A/B testing: enabled (sample size: ${improvementConfig.abTesting.sampleSize})`));
2056
- console.log(chalk_1.default.gray(` • Auto-apply: ${improvementConfig.autoApply ? 'enabled' : 'disabled (requires approval)'}`));
2057
- }
2058
- /**
2059
- * Create comprehensive config.json with all Phase 1 and Phase 2 settings
2060
- */
2061
- static async createComprehensiveConfig(fleetConfig, options) {
2062
- const comprehensiveConfig = {
2063
- version: '1.1.0',
2064
- initialized: new Date().toISOString(),
2065
- // Phase 1: Multi-Model Router
2066
- phase1: {
2067
- routing: {
2068
- enabled: fleetConfig.routing?.enabled || false,
2069
- defaultModel: fleetConfig.routing?.defaultModel || 'claude-sonnet-4.5',
2070
- costTracking: fleetConfig.routing?.enableCostTracking !== false,
2071
- fallback: fleetConfig.routing?.enableFallback !== false,
2072
- maxRetries: fleetConfig.routing?.maxRetries || 3,
2073
- modelPreferences: {
2074
- simple: 'gpt-3.5-turbo',
2075
- medium: 'claude-haiku',
2076
- complex: 'claude-sonnet-4.5',
2077
- critical: 'gpt-4'
2078
- },
2079
- budgets: {
2080
- daily: 50,
2081
- monthly: 1000
2082
- }
2083
- },
2084
- streaming: {
2085
- enabled: fleetConfig.streaming?.enabled !== false,
2086
- progressInterval: fleetConfig.streaming?.progressInterval || 2000,
2087
- bufferEvents: fleetConfig.streaming?.bufferEvents || false,
2088
- timeout: fleetConfig.streaming?.timeout || 1800000
2089
- }
2090
- },
2091
- // Phase 2: Learning, Patterns, and Improvement
2092
- phase2: {
2093
- learning: {
2094
- enabled: options.enableLearning,
2095
- learningRate: 0.1,
2096
- discountFactor: 0.95,
2097
- explorationRate: 0.2,
2098
- targetImprovement: 0.20
2099
- },
2100
- patterns: {
2101
- enabled: options.enablePatterns,
2102
- dbPath: '.agentic-qe/data/patterns.db',
2103
- minConfidence: 0.85,
2104
- enableExtraction: true
2105
- },
2106
- improvement: {
2107
- enabled: options.enableImprovement,
2108
- intervalMs: 3600000,
2109
- autoApply: false,
2110
- enableABTesting: true
2111
- }
2112
- },
2113
- // Agent configurations
2114
- agents: {
2115
- testGenerator: {
2116
- enablePatterns: options.enablePatterns,
2117
- enableLearning: options.enableLearning
2118
- },
2119
- coverageAnalyzer: {
2120
- enableLearning: options.enableLearning,
2121
- targetImprovement: 0.20
2122
- },
2123
- flakyTestHunter: {
2124
- enableML: true,
2125
- enableLearning: options.enableLearning
2126
- },
2127
- defaultAgents: {
2128
- enableLearning: options.enableLearning
2129
- }
2130
- },
2131
- // Fleet configuration
2132
- fleet: {
2133
- topology: fleetConfig.topology || 'hierarchical',
2134
- maxAgents: fleetConfig.maxAgents || 10,
2135
- testingFocus: fleetConfig.testingFocus || [],
2136
- environments: fleetConfig.environments || [],
2137
- frameworks: fleetConfig.frameworks || ['jest']
2138
- }
2139
- };
2140
- await fs.writeJson('.agentic-qe/config.json', comprehensiveConfig, { spaces: 2 });
2141
- console.log(chalk_1.default.green(' āœ“ Comprehensive configuration created'));
2142
- console.log(chalk_1.default.gray(` • Config file: .agentic-qe/config.json`));
2143
- }
2144
- /**
2145
- * Display comprehensive initialization summary
2146
- */
2147
- static async displayComprehensiveSummary(fleetConfig, options) {
2148
- console.log(chalk_1.default.yellow('\nšŸ“Š Initialization Summary:\n'));
2149
- // Multi-Model Router Summary
2150
- console.log(chalk_1.default.cyan('Multi-Model Router'));
2151
- console.log(chalk_1.default.gray(` Status: ${fleetConfig.routing?.enabled ? 'āœ… Enabled' : 'āš ļø Disabled (opt-in)'}`));
2152
- if (fleetConfig.routing?.enabled) {
2153
- console.log(chalk_1.default.gray(' • Cost optimization: 70-81% savings'));
2154
- console.log(chalk_1.default.gray(' • Fallback chains: enabled'));
2155
- console.log(chalk_1.default.gray(' • Budget tracking: daily $50, monthly $1000'));
2156
- }
2157
- console.log(chalk_1.default.cyan('\nStreaming'));
2158
- console.log(chalk_1.default.gray(` Status: ${fleetConfig.streaming?.enabled !== false ? 'āœ… Enabled' : 'āš ļø Disabled'}`));
2159
- console.log(chalk_1.default.gray(' • Real-time progress updates'));
2160
- console.log(chalk_1.default.gray(' • for-await-of compatible'));
2161
- // Learning System Summary
2162
- console.log(chalk_1.default.cyan('\nLearning System'));
2163
- console.log(chalk_1.default.gray(` Status: ${options.enableLearning ? 'āœ… Enabled' : 'āš ļø Disabled'}`));
2164
- if (options.enableLearning) {
2165
- console.log(chalk_1.default.gray(' • Q-learning (lr=0.1, γ=0.95)'));
2166
- console.log(chalk_1.default.gray(' • Experience replay (10,000 buffer)'));
2167
- console.log(chalk_1.default.gray(' • Target: 20% improvement'));
2168
- }
2169
- console.log(chalk_1.default.cyan('\nPattern Bank'));
2170
- console.log(chalk_1.default.gray(` Status: ${options.enablePatterns ? 'āœ… Enabled' : 'āš ļø Disabled'}`));
2171
- if (options.enablePatterns) {
2172
- console.log(chalk_1.default.gray(' • Pattern extraction: enabled'));
2173
- console.log(chalk_1.default.gray(' • Confidence threshold: 85%'));
2174
- console.log(chalk_1.default.gray(' • Cross-project sharing: enabled'));
2175
- }
2176
- console.log(chalk_1.default.cyan('\nImprovement Loop'));
2177
- console.log(chalk_1.default.gray(` Status: ${options.enableImprovement ? 'āœ… Enabled' : 'āš ļø Disabled'}`));
2178
- if (options.enableImprovement) {
2179
- console.log(chalk_1.default.gray(' • Cycle: 1 hour intervals'));
2180
- console.log(chalk_1.default.gray(' • A/B testing: enabled'));
2181
- console.log(chalk_1.default.gray(' • Auto-apply: OFF (requires approval)'));
2182
- }
2183
- // Agent Configuration
2184
- console.log(chalk_1.default.cyan('\nAgent Configuration:'));
2185
- console.log(chalk_1.default.gray(' • TestGeneratorAgent: Patterns + Learning'));
2186
- console.log(chalk_1.default.gray(' • CoverageAnalyzerAgent: Learning + 20% target'));
2187
- console.log(chalk_1.default.gray(' • FlakyTestHunterAgent: ML + Learning'));
2188
- console.log(chalk_1.default.gray(' • All agents: Learning enabled (opt-in)'));
2189
- // Fleet Configuration
2190
- console.log(chalk_1.default.cyan('\nFleet Configuration:'));
2191
- console.log(chalk_1.default.gray(` Topology: ${fleetConfig.topology}`));
2192
- console.log(chalk_1.default.gray(` Max Agents: ${fleetConfig.maxAgents}`));
2193
- console.log(chalk_1.default.gray(` Frameworks: ${(fleetConfig.frameworks || ['jest']).join(', ')}`));
2194
- // Next Steps
2195
- console.log(chalk_1.default.yellow('\nšŸ’” Next Steps:\n'));
2196
- console.log(chalk_1.default.gray(' 1. Review configuration: .agentic-qe/config.json'));
2197
- console.log(chalk_1.default.gray(' 2. Generate tests: aqe test generate src/'));
2198
- if (options.enableLearning) {
2199
- console.log(chalk_1.default.gray(' 3. Check learning status: aqe learn status'));
2200
- }
2201
- if (fleetConfig.routing?.enabled) {
2202
- console.log(chalk_1.default.gray(' 4. View routing dashboard: aqe routing dashboard'));
2203
- }
2204
- if (options.enablePatterns) {
2205
- console.log(chalk_1.default.gray(' 5. List patterns: aqe patterns list'));
2206
- }
2207
- if (options.enableImprovement) {
2208
- console.log(chalk_1.default.gray(' 6. Start improvement loop: aqe improve start'));
2209
- }
2210
- // Documentation
2211
- console.log(chalk_1.default.yellow('\nšŸ“š Documentation:\n'));
2212
- console.log(chalk_1.default.gray(' • Getting Started: docs/GETTING-STARTED.md'));
2213
- if (options.enableLearning) {
2214
- console.log(chalk_1.default.gray(' • Learning System: docs/guides/LEARNING-SYSTEM-USER-GUIDE.md'));
2215
- }
2216
- if (options.enablePatterns) {
2217
- console.log(chalk_1.default.gray(' • Pattern Management: docs/guides/PATTERN-MANAGEMENT-USER-GUIDE.md'));
2218
- }
2219
- if (fleetConfig.routing?.enabled) {
2220
- console.log(chalk_1.default.gray(' • Cost Optimization: docs/guides/COST-OPTIMIZATION-GUIDE.md'));
2221
- }
2222
- // Performance Tips
2223
- console.log(chalk_1.default.yellow('\n⚔ Performance Tips:\n'));
2224
- console.log(chalk_1.default.gray(' • Learning improves over time (20% target in 100 tasks)'));
2225
- console.log(chalk_1.default.gray(' • Patterns increase test quality (85% confidence threshold)'));
2226
- if (fleetConfig.routing?.enabled) {
2227
- console.log(chalk_1.default.gray(' • Routing saves 70-81% on AI costs'));
2228
- }
2229
- console.log(chalk_1.default.gray(' • Improvement loop optimizes continuously (1 hour cycles)'));
2230
- console.log('');
2231
- }
2232
- /**
2233
- * Get agent description for progressive disclosure
2234
- */
2235
- static getAgentDescription(agentName) {
2236
- const descriptions = {
2237
- 'qe-test-generator': 'AI-powered test generation agent with sublinear optimization and multi-framework support',
2238
- 'qe-test-executor': 'Multi-framework test executor with parallel execution, retry logic, and real-time reporting',
2239
- 'qe-coverage-analyzer': 'AI-powered coverage analysis with sublinear gap detection and critical path optimization',
2240
- 'qe-quality-gate': 'Intelligent quality gate with risk assessment, policy validation, and automated decision-making',
2241
- 'qe-quality-analyzer': 'Comprehensive quality metrics analysis with trend detection, predictive analytics, and actionable insights',
2242
- 'qe-performance-tester': 'Multi-tool performance testing with load orchestration, bottleneck detection, and SLA validation',
2243
- 'qe-security-scanner': 'Multi-layer security scanning with SAST/DAST, vulnerability detection, and compliance validation',
2244
- 'qe-requirements-validator': 'Validates requirements testability and generates BDD scenarios before development begins',
2245
- 'qe-production-intelligence': 'Converts production data into test scenarios through incident replay and RUM analysis',
2246
- 'qe-fleet-commander': 'Hierarchical fleet coordinator for 50+ agent orchestration with dynamic topology management and resource optimization',
2247
- 'qe-deployment-readiness': 'Aggregates quality signals to provide deployment risk assessment and go/no-go decisions',
2248
- 'qe-regression-risk-analyzer': 'Analyzes code changes to predict regression risk and intelligently select minimal test suites',
2249
- 'qe-test-data-architect': 'Generates realistic, schema-aware test data with relationship preservation and edge case coverage',
2250
- 'qe-api-contract-validator': 'Validates API contracts, detects breaking changes, and ensures backward compatibility across services',
2251
- 'qe-flaky-test-hunter': 'Detects, analyzes, and stabilizes flaky tests through pattern recognition and auto-remediation',
2252
- 'qe-visual-tester': 'AI-powered visual testing agent with screenshot comparison, visual regression detection, accessibility validation, and cross-browser UI/UX testing',
2253
- 'qe-chaos-engineer': 'Resilience testing agent with controlled chaos experiments, fault injection, and blast radius management for production-grade systems'
2254
- };
2255
- return descriptions[agentName] || `Agentic QE Fleet ${agentName.replace('qe-', '')} agent`;
2256
- }
2257
- /**
2258
- * Get relevant skills for an agent
2259
- */
2260
- static getAgentSkills(agentName) {
2261
- const skillMap = {
2262
- 'qe-test-generator': ['agentic-quality-engineering', 'api-testing-patterns', 'tdd-london-chicago', 'test-automation-strategy'],
2263
- 'qe-coverage-analyzer': ['agentic-quality-engineering', 'quality-metrics', 'risk-based-testing'],
2264
- 'qe-flaky-test-hunter': ['agentic-quality-engineering', 'exploratory-testing-advanced', 'risk-based-testing'],
2265
- 'qe-performance-tester': ['agentic-quality-engineering', 'performance-testing', 'quality-metrics'],
2266
- 'qe-security-scanner': ['agentic-quality-engineering', 'security-testing', 'risk-based-testing'],
2267
- 'qe-quality-gate': ['agentic-quality-engineering', 'quality-metrics', 'risk-based-testing'],
2268
- 'qe-api-contract-validator': ['agentic-quality-engineering', 'api-testing-patterns'],
2269
- 'qe-test-executor': ['agentic-quality-engineering', 'test-automation-strategy'],
2270
- 'qe-requirements-validator': ['agentic-quality-engineering', 'context-driven-testing'],
2271
- 'qe-quality-analyzer': ['agentic-quality-engineering', 'quality-metrics'],
2272
- 'qe-visual-tester': ['agentic-quality-engineering', 'exploratory-testing-advanced'],
2273
- 'qe-chaos-engineer': ['agentic-quality-engineering', 'risk-based-testing'],
2274
- 'qe-production-intelligence': ['agentic-quality-engineering', 'context-driven-testing'],
2275
- 'qe-fleet-commander': ['agentic-quality-engineering'],
2276
- 'qe-deployment-readiness': ['agentic-quality-engineering', 'risk-based-testing', 'quality-metrics'],
2277
- 'qe-regression-risk-analyzer': ['agentic-quality-engineering', 'risk-based-testing'],
2278
- 'qe-test-data-architect': ['agentic-quality-engineering', 'test-automation-strategy']
2279
- };
2280
- return skillMap[agentName] || ['agentic-quality-engineering'];
2281
- }
2282
- /**
2283
- * Get skill documentation for agent
14
+ * This method acts as a thin wrapper that delegates to the new modular
15
+ * initialization system. The old monolithic methods below are deprecated
16
+ * and kept for backward compatibility.
17
+ *
18
+ * @see src/cli/init/index.ts for the new orchestrator
19
+ * @see src/cli/init/README.md for documentation
2284
20
  */
2285
- static getSkillDocumentation(agentName) {
2286
- const skills = this.getAgentSkills(agentName);
2287
- const skillDescriptions = {
2288
- 'agentic-quality-engineering': 'AI agents as force multipliers in quality work (PACT principles)',
2289
- 'api-testing-patterns': 'REST, GraphQL, contract testing patterns',
2290
- 'tdd-london-chicago': 'Both TDD schools, when to use each approach',
2291
- 'test-automation-strategy': 'When/how to automate effectively',
2292
- 'quality-metrics': 'Meaningful metrics vs vanity metrics',
2293
- 'risk-based-testing': 'Focus testing where failure hurts most',
2294
- 'exploratory-testing-advanced': 'RST heuristics, SBTM, test tours',
2295
- 'performance-testing': 'Load, stress, soak testing strategies',
2296
- 'security-testing': 'OWASP Top 10, vulnerability patterns',
2297
- 'context-driven-testing': 'RST techniques and contextual best practices'
2298
- };
2299
- return skills.map(skill => {
2300
- const description = skillDescriptions[skill] || 'Quality engineering expertise';
2301
- return `- **${skill}**: ${description}`;
2302
- }).join('\n');
21
+ static async execute(options) {
22
+ // ⚔ NEW: Use the modular orchestrator
23
+ // All initialization logic has been moved to src/cli/init/ modules
24
+ await (0, index_1.initCommand)(options);
25
+ // That's it! The orchestrator handles everything:
26
+ // - Directory structure
27
+ // - Database initialization
28
+ // - Claude configuration
29
+ // - Documentation
30
+ // - Bash wrapper
31
+ // - Error handling and rollback
32
+ return;
2303
33
  }
2304
34
  }
2305
35
  exports.InitCommand = InitCommand;