swarmdo 1.45.0 → 1.54.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (207) hide show
  1. package/.claude/helpers/hook-handler.cjs +16 -0
  2. package/.claude/helpers/router.cjs +27 -1
  3. package/.claude/settings.local.json +7 -0
  4. package/README.md +6 -2
  5. package/package.json +1 -1
  6. package/v3/@swarmdo/cli/dist/src/agent-bridge/bridge.d.ts +104 -0
  7. package/v3/@swarmdo/cli/dist/src/agent-bridge/bridge.js +133 -0
  8. package/v3/@swarmdo/cli/dist/src/commands/agent.js +133 -1
  9. package/v3/@swarmdo/cli/dist/src/commands/config.js +32 -1
  10. package/v3/@swarmdo/cli/dist/src/commands/hidden-coupling.d.ts +19 -0
  11. package/v3/@swarmdo/cli/dist/src/commands/hidden-coupling.js +92 -0
  12. package/v3/@swarmdo/cli/dist/src/commands/index.js +14 -4
  13. package/v3/@swarmdo/cli/dist/src/commands/ownership.d.ts +18 -0
  14. package/v3/@swarmdo/cli/dist/src/commands/ownership.js +88 -0
  15. package/v3/@swarmdo/cli/dist/src/commands/pack.js +4 -4
  16. package/v3/@swarmdo/cli/dist/src/commands/standup.d.ts +18 -0
  17. package/v3/@swarmdo/cli/dist/src/commands/standup.js +116 -0
  18. package/v3/@swarmdo/cli/dist/src/commands/swarm.js +29 -0
  19. package/v3/@swarmdo/cli/dist/src/config-lint/commands-lint.d.ts +31 -0
  20. package/v3/@swarmdo/cli/dist/src/config-lint/commands-lint.js +127 -0
  21. package/v3/@swarmdo/cli/dist/src/config-lint/lint.d.ts +5 -0
  22. package/v3/@swarmdo/cli/dist/src/config-lint/lint.js +4 -0
  23. package/v3/@swarmdo/cli/dist/src/coupling/hidden.d.ts +45 -0
  24. package/v3/@swarmdo/cli/dist/src/coupling/hidden.js +66 -0
  25. package/v3/@swarmdo/cli/dist/src/init/helpers-generator.js +41 -1
  26. package/v3/@swarmdo/cli/dist/src/mcp-client.js +2 -0
  27. package/v3/@swarmdo/cli/dist/src/mcp-tools/agent-tools.js +166 -0
  28. package/v3/@swarmdo/cli/dist/src/mcp-tools/index.d.ts +1 -0
  29. package/v3/@swarmdo/cli/dist/src/mcp-tools/index.js +1 -0
  30. package/v3/@swarmdo/cli/dist/src/mcp-tools/ownership-tools.d.ts +14 -0
  31. package/v3/@swarmdo/cli/dist/src/mcp-tools/ownership-tools.js +51 -0
  32. package/v3/@swarmdo/cli/dist/src/mcp-tools/profiles.js +1 -0
  33. package/v3/@swarmdo/cli/dist/src/mcp-tools/swarm-tools.d.ts +33 -0
  34. package/v3/@swarmdo/cli/dist/src/mcp-tools/swarm-tools.js +73 -38
  35. package/v3/@swarmdo/cli/dist/src/ownership/ownership.d.ts +61 -0
  36. package/v3/@swarmdo/cli/dist/src/ownership/ownership.js +151 -0
  37. package/v3/@swarmdo/cli/dist/src/pack/pack.d.ts +1 -1
  38. package/v3/@swarmdo/cli/dist/src/pack/pack.js +12 -4
  39. package/v3/@swarmdo/cli/dist/src/redact/redact.js +28 -9
  40. package/v3/@swarmdo/cli/dist/src/standup/standup.d.ts +83 -0
  41. package/v3/@swarmdo/cli/dist/src/standup/standup.js +157 -0
  42. package/v3/@swarmdo/cli/package.json +1 -1
  43. package/v3/@swarmdo/cli-core/dist/src/index.js +1 -1
  44. package/v3/@swarmdo/codex/dist/cli.js +0 -0
  45. package/v3/@swarmdo/hooks/dist/cli/guidance-cli.js +0 -0
  46. package/v3/@swarmdo/hooks/dist/statusline/index.d.ts +3 -3
  47. package/v3/@swarmdo/hooks/dist/statusline/index.js +3 -3
  48. package/v3/@swarmdo/integration/dist/__tests__/agentic-flow-agent.test.js +1 -4
  49. package/v3/@swarmdo/neural/dist/flash-attention.d.ts +1 -1
  50. package/v3/@swarmdo/neural/dist/flash-attention.js +1 -1
  51. package/v3/@swarmdo/plugin-agent-federation/dist/plugin.js +1 -1
  52. package/v3/@swarmdo/plugin-agent-federation/dist/transport/midstream-aware-loader.js +2 -2
  53. package/v3/@swarmdo/plugin-iot-cognitum/dist/application/index.d.ts +2 -0
  54. package/v3/@swarmdo/plugin-iot-cognitum/dist/application/index.js +2 -0
  55. package/v3/@swarmdo/plugin-iot-cognitum/dist/application/iot-coordinator.d.ts +138 -0
  56. package/v3/@swarmdo/plugin-iot-cognitum/dist/application/iot-coordinator.js +418 -0
  57. package/v3/@swarmdo/plugin-iot-cognitum/dist/bin.d.ts +15 -0
  58. package/v3/@swarmdo/plugin-iot-cognitum/dist/bin.js +240 -0
  59. package/v3/@swarmdo/plugin-iot-cognitum/dist/cli-commands.d.ts +7 -0
  60. package/v3/@swarmdo/plugin-iot-cognitum/dist/cli-commands.js +508 -0
  61. package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/entities/device-agent.d.ts +54 -0
  62. package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/entities/device-agent.js +2 -0
  63. package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/entities/device-fleet.d.ts +46 -0
  64. package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/entities/device-fleet.js +2 -0
  65. package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/entities/device-trust-level.d.ts +18 -0
  66. package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/entities/device-trust-level.js +28 -0
  67. package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/entities/index.d.ts +5 -0
  68. package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/entities/index.js +2 -0
  69. package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/entities/telemetry.d.ts +35 -0
  70. package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/entities/telemetry.js +2 -0
  71. package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/repositories/device-repository.d.ts +11 -0
  72. package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/repositories/device-repository.js +2 -0
  73. package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/repositories/fleet-repository.d.ts +9 -0
  74. package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/repositories/fleet-repository.js +2 -0
  75. package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/repositories/index.d.ts +5 -0
  76. package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/repositories/index.js +2 -0
  77. package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/repositories/telemetry-repository.d.ts +12 -0
  78. package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/repositories/telemetry-repository.js +2 -0
  79. package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/repositories/trust-history-repository.d.ts +19 -0
  80. package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/repositories/trust-history-repository.js +2 -0
  81. package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/services/anomaly-detection-service.d.ts +44 -0
  82. package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/services/anomaly-detection-service.js +117 -0
  83. package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/services/device-lifecycle-service.d.ts +70 -0
  84. package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/services/device-lifecycle-service.js +194 -0
  85. package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/services/firmware-orchestration-service.d.ts +69 -0
  86. package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/services/firmware-orchestration-service.js +139 -0
  87. package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/services/fleet-topology-service.d.ts +34 -0
  88. package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/services/fleet-topology-service.js +101 -0
  89. package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/services/index.d.ts +10 -0
  90. package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/services/index.js +10 -0
  91. package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/services/mesh-service.d.ts +64 -0
  92. package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/services/mesh-service.js +70 -0
  93. package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/services/sona-integration-service.d.ts +44 -0
  94. package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/services/sona-integration-service.js +79 -0
  95. package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/services/telemetry-ingestion-service.d.ts +37 -0
  96. package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/services/telemetry-ingestion-service.js +39 -0
  97. package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/services/telemetry-service.d.ts +67 -0
  98. package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/services/telemetry-service.js +58 -0
  99. package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/services/witness-verification-service.d.ts +45 -0
  100. package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/services/witness-verification-service.js +63 -0
  101. package/v3/@swarmdo/plugin-iot-cognitum/dist/index.d.ts +26 -0
  102. package/v3/@swarmdo/plugin-iot-cognitum/dist/index.js +17 -0
  103. package/v3/@swarmdo/plugin-iot-cognitum/dist/infrastructure/agentdb-telemetry-repository.d.ts +51 -0
  104. package/v3/@swarmdo/plugin-iot-cognitum/dist/infrastructure/agentdb-telemetry-repository.js +110 -0
  105. package/v3/@swarmdo/plugin-iot-cognitum/dist/infrastructure/in-memory-device-repository.d.ts +13 -0
  106. package/v3/@swarmdo/plugin-iot-cognitum/dist/infrastructure/in-memory-device-repository.js +25 -0
  107. package/v3/@swarmdo/plugin-iot-cognitum/dist/infrastructure/in-memory-fleet-repository.d.ts +11 -0
  108. package/v3/@swarmdo/plugin-iot-cognitum/dist/infrastructure/in-memory-fleet-repository.js +19 -0
  109. package/v3/@swarmdo/plugin-iot-cognitum/dist/infrastructure/in-memory-trust-history-repository.d.ts +11 -0
  110. package/v3/@swarmdo/plugin-iot-cognitum/dist/infrastructure/in-memory-trust-history-repository.js +27 -0
  111. package/v3/@swarmdo/plugin-iot-cognitum/dist/infrastructure/index.d.ts +6 -0
  112. package/v3/@swarmdo/plugin-iot-cognitum/dist/infrastructure/index.js +6 -0
  113. package/v3/@swarmdo/plugin-iot-cognitum/dist/infrastructure/seed-client-factory.d.ts +41 -0
  114. package/v3/@swarmdo/plugin-iot-cognitum/dist/infrastructure/seed-client-factory.js +64 -0
  115. package/v3/@swarmdo/plugin-iot-cognitum/dist/mcp-tools.d.ts +8 -0
  116. package/v3/@swarmdo/plugin-iot-cognitum/dist/mcp-tools.js +703 -0
  117. package/v3/@swarmdo/plugin-iot-cognitum/dist/plugin.d.ts +23 -0
  118. package/v3/@swarmdo/plugin-iot-cognitum/dist/plugin.js +239 -0
  119. package/v3/@swarmdo/plugin-iot-cognitum/dist/workers/anomaly-scan-worker.d.ts +17 -0
  120. package/v3/@swarmdo/plugin-iot-cognitum/dist/workers/anomaly-scan-worker.js +42 -0
  121. package/v3/@swarmdo/plugin-iot-cognitum/dist/workers/firmware-watch-worker.d.ts +18 -0
  122. package/v3/@swarmdo/plugin-iot-cognitum/dist/workers/firmware-watch-worker.js +45 -0
  123. package/v3/@swarmdo/plugin-iot-cognitum/dist/workers/health-probe-worker.d.ts +19 -0
  124. package/v3/@swarmdo/plugin-iot-cognitum/dist/workers/health-probe-worker.js +50 -0
  125. package/v3/@swarmdo/plugin-iot-cognitum/dist/workers/mesh-sync-worker.d.ts +19 -0
  126. package/v3/@swarmdo/plugin-iot-cognitum/dist/workers/mesh-sync-worker.js +47 -0
  127. package/v3/@swarmdo/plugin-iot-cognitum/dist/workers/telemetry-ingest-worker.d.ts +17 -0
  128. package/v3/@swarmdo/plugin-iot-cognitum/dist/workers/telemetry-ingest-worker.js +40 -0
  129. package/v3/@swarmdo/plugin-iot-cognitum/dist/workers/witness-audit-worker.d.ts +18 -0
  130. package/v3/@swarmdo/plugin-iot-cognitum/dist/workers/witness-audit-worker.js +51 -0
  131. package/v3/@swarmdo/providers/dist/swarmvector-provider.d.ts +1 -1
  132. package/v3/@swarmdo/providers/dist/swarmvector-provider.js +1 -1
  133. package/v3/@swarmdo/security/dist/input-validator.d.ts +6 -6
  134. package/v3/@swarmdo/shared/dist/hooks/safety/git-commit.js +1 -1
  135. package/v3/@swarmdo/shared/dist/mcp/transport/http.js +1 -8
  136. package/v3/@swarmdo/testing/dist/fixtures/agent-fixtures.d.ts +214 -0
  137. package/v3/@swarmdo/testing/dist/fixtures/agent-fixtures.js +595 -0
  138. package/v3/@swarmdo/testing/dist/fixtures/agents.d.ts +76 -0
  139. package/v3/@swarmdo/testing/dist/fixtures/agents.js +158 -0
  140. package/v3/@swarmdo/testing/dist/fixtures/configurations.d.ts +157 -0
  141. package/v3/@swarmdo/testing/dist/fixtures/configurations.js +337 -0
  142. package/v3/@swarmdo/testing/dist/fixtures/index.d.ts +10 -0
  143. package/v3/@swarmdo/testing/dist/fixtures/index.js +17 -0
  144. package/v3/@swarmdo/testing/dist/fixtures/mcp-fixtures.d.ts +329 -0
  145. package/v3/@swarmdo/testing/dist/fixtures/mcp-fixtures.js +714 -0
  146. package/v3/@swarmdo/testing/dist/fixtures/memory-entries.d.ts +159 -0
  147. package/v3/@swarmdo/testing/dist/fixtures/memory-entries.js +262 -0
  148. package/v3/@swarmdo/testing/dist/fixtures/memory-fixtures.d.ts +290 -0
  149. package/v3/@swarmdo/testing/dist/fixtures/memory-fixtures.js +547 -0
  150. package/v3/@swarmdo/testing/dist/fixtures/swarm-fixtures.d.ts +289 -0
  151. package/v3/@swarmdo/testing/dist/fixtures/swarm-fixtures.js +534 -0
  152. package/v3/@swarmdo/testing/dist/fixtures/tasks.d.ts +106 -0
  153. package/v3/@swarmdo/testing/dist/fixtures/tasks.js +229 -0
  154. package/v3/@swarmdo/testing/dist/helpers/assertion-helpers.d.ts +213 -0
  155. package/v3/@swarmdo/testing/dist/helpers/assertion-helpers.js +435 -0
  156. package/v3/@swarmdo/testing/dist/helpers/assertions.d.ts +135 -0
  157. package/v3/@swarmdo/testing/dist/helpers/assertions.js +217 -0
  158. package/v3/@swarmdo/testing/dist/helpers/create-mock.d.ts +96 -0
  159. package/v3/@swarmdo/testing/dist/helpers/create-mock.js +164 -0
  160. package/v3/@swarmdo/testing/dist/helpers/index.d.ts +14 -0
  161. package/v3/@swarmdo/testing/dist/helpers/index.js +22 -0
  162. package/v3/@swarmdo/testing/dist/helpers/mock-factory.d.ts +323 -0
  163. package/v3/@swarmdo/testing/dist/helpers/mock-factory.js +350 -0
  164. package/v3/@swarmdo/testing/dist/helpers/setup-teardown.d.ts +271 -0
  165. package/v3/@swarmdo/testing/dist/helpers/setup-teardown.js +446 -0
  166. package/v3/@swarmdo/testing/dist/helpers/swarm-instance.d.ts +142 -0
  167. package/v3/@swarmdo/testing/dist/helpers/swarm-instance.js +205 -0
  168. package/v3/@swarmdo/testing/dist/helpers/test-application.d.ts +190 -0
  169. package/v3/@swarmdo/testing/dist/helpers/test-application.js +138 -0
  170. package/v3/@swarmdo/testing/dist/helpers/test-utils.d.ts +274 -0
  171. package/v3/@swarmdo/testing/dist/helpers/test-utils.js +456 -0
  172. package/v3/@swarmdo/testing/dist/index.d.ts +42 -0
  173. package/v3/@swarmdo/testing/dist/index.js +66 -0
  174. package/v3/@swarmdo/testing/dist/mocks/index.d.ts +8 -0
  175. package/v3/@swarmdo/testing/dist/mocks/index.js +10 -0
  176. package/v3/@swarmdo/testing/dist/mocks/mock-mcp-client.d.ts +206 -0
  177. package/v3/@swarmdo/testing/dist/mocks/mock-mcp-client.js +575 -0
  178. package/v3/@swarmdo/testing/dist/mocks/mock-services.d.ts +287 -0
  179. package/v3/@swarmdo/testing/dist/mocks/mock-services.js +563 -0
  180. package/v3/@swarmdo/testing/dist/regression/api-contract.d.ts +109 -0
  181. package/v3/@swarmdo/testing/dist/regression/api-contract.js +374 -0
  182. package/v3/@swarmdo/testing/dist/regression/index.d.ts +18 -0
  183. package/v3/@swarmdo/testing/dist/regression/index.js +18 -0
  184. package/v3/@swarmdo/testing/dist/regression/integration-regression.d.ts +67 -0
  185. package/v3/@swarmdo/testing/dist/regression/integration-regression.js +334 -0
  186. package/v3/@swarmdo/testing/dist/regression/performance-baseline.d.ts +106 -0
  187. package/v3/@swarmdo/testing/dist/regression/performance-baseline.js +268 -0
  188. package/v3/@swarmdo/testing/dist/regression/regression-runner.d.ts +124 -0
  189. package/v3/@swarmdo/testing/dist/regression/regression-runner.js +227 -0
  190. package/v3/@swarmdo/testing/dist/regression/security-regression.d.ts +73 -0
  191. package/v3/@swarmdo/testing/dist/regression/security-regression.js +258 -0
  192. package/v3/@swarmdo/testing/dist/setup.d.ts +43 -0
  193. package/v3/@swarmdo/testing/dist/setup.js +91 -0
  194. package/v3/@swarmdo/testing/dist/v2-compat/api-compat.test.d.ts +10 -0
  195. package/v3/@swarmdo/testing/dist/v2-compat/api-compat.test.js +433 -0
  196. package/v3/@swarmdo/testing/dist/v2-compat/cli-compat.test.d.ts +10 -0
  197. package/v3/@swarmdo/testing/dist/v2-compat/cli-compat.test.js +352 -0
  198. package/v3/@swarmdo/testing/dist/v2-compat/compatibility-validator.d.ts +206 -0
  199. package/v3/@swarmdo/testing/dist/v2-compat/compatibility-validator.js +839 -0
  200. package/v3/@swarmdo/testing/dist/v2-compat/hooks-compat.test.d.ts +10 -0
  201. package/v3/@swarmdo/testing/dist/v2-compat/hooks-compat.test.js +428 -0
  202. package/v3/@swarmdo/testing/dist/v2-compat/index.d.ts +38 -0
  203. package/v3/@swarmdo/testing/dist/v2-compat/index.js +41 -0
  204. package/v3/@swarmdo/testing/dist/v2-compat/mcp-compat.test.d.ts +10 -0
  205. package/v3/@swarmdo/testing/dist/v2-compat/mcp-compat.test.js +419 -0
  206. package/v3/@swarmdo/testing/dist/v2-compat/report-generator.d.ts +34 -0
  207. package/v3/@swarmdo/testing/dist/v2-compat/report-generator.js +372 -0
@@ -0,0 +1,352 @@
1
+ /**
2
+ * V2 CLI Compatibility Tests
3
+ *
4
+ * Tests all 25 V2 CLI commands work via compatibility layer or native V3 equivalents.
5
+ * Verifies flag compatibility and output format compatibility.
6
+ *
7
+ * @module v3/testing/v2-compat/cli-compat.test
8
+ */
9
+ import { describe, it, expect, beforeEach, afterEach, vi } from 'vitest';
10
+ import { V2CompatibilityValidator, V2_CLI_COMMANDS, } from './compatibility-validator.js';
11
+ /**
12
+ * Create mock CLI executor
13
+ */
14
+ function createMockCLIExecutor() {
15
+ const v3Commands = [
16
+ 'init', 'start', 'stop', 'status', 'config',
17
+ 'agent spawn', 'agent list', 'agent terminate', 'agent status',
18
+ 'swarm init', 'swarm status', 'swarm scale',
19
+ 'memory list', 'memory search', 'memory clear',
20
+ 'hooks pre-edit', 'hooks post-edit', 'hooks pre-command', 'hooks post-command',
21
+ 'hooks route', 'hooks pretrain', 'hooks metrics',
22
+ ];
23
+ return {
24
+ execute: vi.fn().mockImplementation(async (command, args) => {
25
+ // Simulate V3 CLI behavior with V2 command translation
26
+ const commandTranslation = {
27
+ 'hive-mind init': 'swarm init',
28
+ 'hive-mind status': 'swarm status',
29
+ 'hive-mind spawn': 'agent spawn',
30
+ 'neural init': 'hooks pretrain',
31
+ 'goal init': 'hooks pretrain',
32
+ 'memory query': 'memory search',
33
+ 'agent info': 'agent status',
34
+ };
35
+ const translatedCommand = commandTranslation[command] || command;
36
+ const isSupported = v3Commands.some(c => c === translatedCommand || translatedCommand.startsWith(c.split(' ')[0]));
37
+ if (!isSupported) {
38
+ return {
39
+ success: false,
40
+ output: `Error: Command "${command}" not found`,
41
+ exitCode: 1,
42
+ };
43
+ }
44
+ // Simulate successful output
45
+ const outputMap = {
46
+ 'status': JSON.stringify({ status: 'running', agents: 0, memory: 'healthy' }),
47
+ 'agent list': JSON.stringify([]),
48
+ 'swarm status': JSON.stringify({ topology: 'hierarchical-mesh', agents: 0 }),
49
+ 'memory list': JSON.stringify([]),
50
+ 'hooks metrics': JSON.stringify({ patterns: 0, successRate: 0 }),
51
+ };
52
+ return {
53
+ success: true,
54
+ output: outputMap[translatedCommand] || 'OK',
55
+ exitCode: 0,
56
+ };
57
+ }),
58
+ getCommands: vi.fn().mockReturnValue(v3Commands),
59
+ parseOutput: vi.fn().mockImplementation((output) => {
60
+ try {
61
+ return JSON.parse(output);
62
+ }
63
+ catch {
64
+ return { raw: output };
65
+ }
66
+ }),
67
+ };
68
+ }
69
+ describe('V2 CLI Compatibility', () => {
70
+ let validator;
71
+ let mockCLI;
72
+ beforeEach(() => {
73
+ mockCLI = createMockCLIExecutor();
74
+ validator = new V2CompatibilityValidator({
75
+ verbose: false,
76
+ });
77
+ });
78
+ afterEach(() => {
79
+ vi.clearAllMocks();
80
+ });
81
+ describe('Core Commands', () => {
82
+ const coreCommands = V2_CLI_COMMANDS.filter(c => ['init', 'start', 'stop', 'status', 'config'].includes(c.name));
83
+ it.each(coreCommands)('should support V2 command: $name', async (cmd) => {
84
+ const result = await mockCLI.execute(cmd.name, []);
85
+ expect(result.success).toBe(true);
86
+ expect(result.exitCode).toBe(0);
87
+ });
88
+ it('should support init command with --force flag', async () => {
89
+ const result = await mockCLI.execute('init', ['--force']);
90
+ expect(result.success).toBe(true);
91
+ expect(mockCLI.execute).toHaveBeenCalledWith('init', ['--force']);
92
+ });
93
+ it('should support init command with --template flag', async () => {
94
+ const result = await mockCLI.execute('init', ['--template', 'minimal']);
95
+ expect(result.success).toBe(true);
96
+ });
97
+ it('should support status command with --json flag', async () => {
98
+ const result = await mockCLI.execute('status', ['--json']);
99
+ expect(result.success).toBe(true);
100
+ const parsed = mockCLI.parseOutput(result.output);
101
+ expect(parsed).toHaveProperty('status');
102
+ });
103
+ it('should support config command with --list flag', async () => {
104
+ const result = await mockCLI.execute('config', ['--list']);
105
+ expect(result.success).toBe(true);
106
+ });
107
+ });
108
+ describe('Agent Commands', () => {
109
+ const agentCommands = V2_CLI_COMMANDS.filter(c => c.name.startsWith('agent'));
110
+ it.each(agentCommands)('should support V2 command: $name', async (cmd) => {
111
+ const result = await mockCLI.execute(cmd.name, []);
112
+ expect(result.success).toBe(true);
113
+ });
114
+ it('should support agent spawn with --type flag', async () => {
115
+ const result = await mockCLI.execute('agent spawn', ['--type', 'coder']);
116
+ expect(result.success).toBe(true);
117
+ });
118
+ it('should support agent spawn with --id flag', async () => {
119
+ const result = await mockCLI.execute('agent spawn', ['--id', 'my-agent']);
120
+ expect(result.success).toBe(true);
121
+ });
122
+ it('should support agent list with --status filter', async () => {
123
+ const result = await mockCLI.execute('agent list', ['--status', 'active']);
124
+ expect(result.success).toBe(true);
125
+ });
126
+ it('should support agent terminate with --force flag', async () => {
127
+ const result = await mockCLI.execute('agent terminate', ['--force', 'agent-1']);
128
+ expect(result.success).toBe(true);
129
+ });
130
+ it('should translate agent info to agent status', async () => {
131
+ const result = await mockCLI.execute('agent info', ['agent-1']);
132
+ expect(result.success).toBe(true);
133
+ });
134
+ it('should support alias "a spawn" for "agent spawn"', async () => {
135
+ // Aliases should be handled by CLI framework
136
+ const result = await mockCLI.execute('agent spawn', ['--type', 'coder']);
137
+ expect(result.success).toBe(true);
138
+ });
139
+ });
140
+ describe('Swarm Commands', () => {
141
+ const swarmCommands = V2_CLI_COMMANDS.filter(c => c.name.startsWith('swarm'));
142
+ it.each(swarmCommands)('should support V2 command: $name', async (cmd) => {
143
+ const result = await mockCLI.execute(cmd.name, []);
144
+ expect(result.success).toBe(true);
145
+ });
146
+ it('should support swarm init with --topology flag', async () => {
147
+ const result = await mockCLI.execute('swarm init', ['--topology', 'hierarchical-mesh']);
148
+ expect(result.success).toBe(true);
149
+ });
150
+ it('should support swarm init with --max-agents flag', async () => {
151
+ const result = await mockCLI.execute('swarm init', ['--max-agents', '15']);
152
+ expect(result.success).toBe(true);
153
+ });
154
+ it('should support swarm status with --detailed flag', async () => {
155
+ const result = await mockCLI.execute('swarm status', ['--detailed']);
156
+ expect(result.success).toBe(true);
157
+ const parsed = mockCLI.parseOutput(result.output);
158
+ expect(parsed).toHaveProperty('topology');
159
+ });
160
+ it('should support swarm scale with --up flag', async () => {
161
+ const result = await mockCLI.execute('swarm scale', ['--up', '3']);
162
+ expect(result.success).toBe(true);
163
+ });
164
+ });
165
+ describe('Memory Commands', () => {
166
+ const memoryCommands = V2_CLI_COMMANDS.filter(c => c.name.startsWith('memory'));
167
+ it.each(memoryCommands)('should support V2 command: $name', async (cmd) => {
168
+ const result = await mockCLI.execute(cmd.name, []);
169
+ expect(result.success).toBe(true);
170
+ });
171
+ it('should support memory list with --type filter', async () => {
172
+ const result = await mockCLI.execute('memory list', ['--type', 'pattern']);
173
+ expect(result.success).toBe(true);
174
+ });
175
+ it('should translate memory query to memory search', async () => {
176
+ const result = await mockCLI.execute('memory query', ['--search', 'test']);
177
+ expect(result.success).toBe(true);
178
+ });
179
+ it('should support memory clear with --force flag', async () => {
180
+ const result = await mockCLI.execute('memory clear', ['--force']);
181
+ expect(result.success).toBe(true);
182
+ });
183
+ });
184
+ describe('Hooks Commands', () => {
185
+ const hooksCommands = V2_CLI_COMMANDS.filter(c => c.name.startsWith('hooks'));
186
+ it.each(hooksCommands)('should support V2 command: $name', async (cmd) => {
187
+ const result = await mockCLI.execute(cmd.name, []);
188
+ expect(result.success).toBe(true);
189
+ });
190
+ it('should support hooks pre-edit with file path', async () => {
191
+ const result = await mockCLI.execute('hooks pre-edit', ['--file', '/path/to/file.ts']);
192
+ expect(result.success).toBe(true);
193
+ });
194
+ it('should support hooks post-edit with success flag', async () => {
195
+ const result = await mockCLI.execute('hooks post-edit', ['--file', '/path/to/file.ts', '--success', 'true']);
196
+ expect(result.success).toBe(true);
197
+ });
198
+ it('should support hooks route with task description', async () => {
199
+ const result = await mockCLI.execute('hooks route', ['--task', 'implement feature']);
200
+ expect(result.success).toBe(true);
201
+ });
202
+ it('should support hooks metrics with --dashboard flag', async () => {
203
+ const result = await mockCLI.execute('hooks metrics', ['--dashboard']);
204
+ expect(result.success).toBe(true);
205
+ });
206
+ });
207
+ describe('Deprecated Commands', () => {
208
+ const deprecatedCommands = V2_CLI_COMMANDS.filter(c => c.deprecated);
209
+ it.each(deprecatedCommands)('should support deprecated command: $name (with warning)', async (cmd) => {
210
+ const result = await mockCLI.execute(cmd.name, []);
211
+ // Deprecated commands should still work
212
+ expect(result.success).toBe(true);
213
+ });
214
+ it('should translate hive-mind init to swarm init', async () => {
215
+ const result = await mockCLI.execute('hive-mind init', []);
216
+ expect(result.success).toBe(true);
217
+ });
218
+ it('should translate neural init to hooks pretrain', async () => {
219
+ const result = await mockCLI.execute('neural init', []);
220
+ expect(result.success).toBe(true);
221
+ });
222
+ it('should translate goal init to hooks pretrain', async () => {
223
+ const result = await mockCLI.execute('goal init', []);
224
+ expect(result.success).toBe(true);
225
+ });
226
+ });
227
+ describe('Output Format Compatibility', () => {
228
+ it('should return JSON output for status command', async () => {
229
+ const result = await mockCLI.execute('status', ['--json']);
230
+ expect(result.success).toBe(true);
231
+ const parsed = mockCLI.parseOutput(result.output);
232
+ expect(typeof parsed).toBe('object');
233
+ });
234
+ it('should return agent list as array', async () => {
235
+ const result = await mockCLI.execute('agent list', []);
236
+ expect(result.success).toBe(true);
237
+ const parsed = mockCLI.parseOutput(result.output);
238
+ expect(Array.isArray(parsed)).toBe(true);
239
+ });
240
+ it('should return swarm status as object', async () => {
241
+ const result = await mockCLI.execute('swarm status', []);
242
+ expect(result.success).toBe(true);
243
+ const parsed = mockCLI.parseOutput(result.output);
244
+ expect(parsed).toHaveProperty('topology');
245
+ });
246
+ it('should return memory list as array', async () => {
247
+ const result = await mockCLI.execute('memory list', []);
248
+ expect(result.success).toBe(true);
249
+ const parsed = mockCLI.parseOutput(result.output);
250
+ expect(Array.isArray(parsed)).toBe(true);
251
+ });
252
+ it('should return hooks metrics as object', async () => {
253
+ const result = await mockCLI.execute('hooks metrics', []);
254
+ expect(result.success).toBe(true);
255
+ const parsed = mockCLI.parseOutput(result.output);
256
+ expect(parsed).toHaveProperty('patterns');
257
+ });
258
+ });
259
+ describe('Error Handling', () => {
260
+ it('should return error for unknown command', async () => {
261
+ const result = await mockCLI.execute('unknown-command', []);
262
+ expect(result.success).toBe(false);
263
+ expect(result.exitCode).toBe(1);
264
+ expect(result.output).toContain('not found');
265
+ });
266
+ it('should handle missing required arguments gracefully', async () => {
267
+ // Most commands should work without arguments for listing operations
268
+ const result = await mockCLI.execute('agent list', []);
269
+ expect(result.success).toBe(true);
270
+ });
271
+ });
272
+ describe('Full CLI Validation', () => {
273
+ it('should pass full CLI validation', async () => {
274
+ const result = await validator.validateCLI();
275
+ expect(result.category).toBe('cli');
276
+ expect(result.totalChecks).toBeGreaterThan(0);
277
+ expect(result.passedChecks).toBeGreaterThan(0);
278
+ });
279
+ it('should detect all 25 V2 CLI commands', async () => {
280
+ const result = await validator.validateCLI();
281
+ const commandChecks = result.checks.filter(c => c.name.startsWith('CLI:'));
282
+ // Should have checks for all 25 commands
283
+ expect(commandChecks.length).toBeGreaterThanOrEqual(25);
284
+ });
285
+ it('should identify deprecated commands', async () => {
286
+ const result = await validator.validateCLI();
287
+ const deprecatedChecks = result.checks.filter(c => c.name.includes('hive-mind') || c.name.includes('neural') || c.name.includes('goal'));
288
+ expect(deprecatedChecks.length).toBeGreaterThan(0);
289
+ });
290
+ it('should verify flag compatibility', async () => {
291
+ const result = await validator.validateCLI();
292
+ const flagChecks = result.checks.filter(c => c.name.includes('Flag:'));
293
+ expect(flagChecks.length).toBeGreaterThan(0);
294
+ });
295
+ it('should report breaking changes for unsupported commands', async () => {
296
+ const result = await validator.validateCLI();
297
+ // All non-deprecated commands should be supported
298
+ const breakingNonDeprecated = result.checks.filter(c => c.breaking && !c.name.includes('deprecated'));
299
+ // Expect minimal breaking changes in supported commands
300
+ expect(breakingNonDeprecated.length).toBeLessThan(5);
301
+ });
302
+ it('should provide migration paths', async () => {
303
+ const result = await validator.validateCLI();
304
+ const withMigration = result.checks.filter(c => c.migrationPath);
305
+ expect(withMigration.length).toBeGreaterThan(0);
306
+ });
307
+ });
308
+ describe('Alias Compatibility', () => {
309
+ it('should check all command aliases', async () => {
310
+ const result = await validator.validateCLI();
311
+ const aliasChecks = result.checks.filter(c => c.name.includes('Alias:'));
312
+ expect(aliasChecks.length).toBeGreaterThan(0);
313
+ });
314
+ it('should verify common aliases work', async () => {
315
+ const commonAliases = ['i', 's', 'st', 'c', 'a spawn', 'a ls'];
316
+ for (const alias of commonAliases) {
317
+ // Aliases should map to valid commands
318
+ const aliasCmd = V2_CLI_COMMANDS.find(c => c.aliases.includes(alias));
319
+ expect(aliasCmd).toBeDefined();
320
+ }
321
+ });
322
+ });
323
+ });
324
+ describe('CLI Command Coverage', () => {
325
+ it('should test all 25 V2 CLI commands', () => {
326
+ expect(V2_CLI_COMMANDS.length).toBe(25);
327
+ });
328
+ it('should have V3 equivalents for all non-deprecated commands', () => {
329
+ const nonDeprecated = V2_CLI_COMMANDS.filter(c => !c.deprecated);
330
+ for (const cmd of nonDeprecated) {
331
+ expect(cmd.v3Equivalent).toBeDefined();
332
+ expect(cmd.v3Equivalent).not.toBe('');
333
+ }
334
+ });
335
+ it('should categorize commands correctly', () => {
336
+ const categories = {
337
+ core: ['init', 'start', 'stop', 'status', 'config'],
338
+ agent: V2_CLI_COMMANDS.filter(c => c.name.startsWith('agent')).map(c => c.name),
339
+ swarm: V2_CLI_COMMANDS.filter(c => c.name.startsWith('swarm')).map(c => c.name),
340
+ memory: V2_CLI_COMMANDS.filter(c => c.name.startsWith('memory')).map(c => c.name),
341
+ hooks: V2_CLI_COMMANDS.filter(c => c.name.startsWith('hooks')).map(c => c.name),
342
+ deprecated: V2_CLI_COMMANDS.filter(c => c.deprecated).map(c => c.name),
343
+ };
344
+ expect(categories.core.length).toBe(5);
345
+ expect(categories.agent.length).toBe(4);
346
+ expect(categories.swarm.length).toBe(3);
347
+ expect(categories.memory.length).toBe(3);
348
+ expect(categories.hooks.length).toBe(7);
349
+ expect(categories.deprecated.length).toBe(3);
350
+ });
351
+ });
352
+ //# sourceMappingURL=cli-compat.test.js.map
@@ -0,0 +1,206 @@
1
+ /**
2
+ * V2 Compatibility Validator
3
+ *
4
+ * Validates that V3 implementation maintains backward compatibility with V2 capabilities.
5
+ * Tests CLI commands, MCP tools, hooks, and API interfaces.
6
+ *
7
+ * @module v3/testing/v2-compat/compatibility-validator
8
+ */
9
+ /**
10
+ * Validation result for a single check
11
+ */
12
+ export interface ValidationCheck {
13
+ name: string;
14
+ category: 'cli' | 'mcp' | 'hooks' | 'api';
15
+ passed: boolean;
16
+ message: string;
17
+ v2Behavior: string;
18
+ v3Behavior: string;
19
+ breaking: boolean;
20
+ migrationPath?: string;
21
+ details?: Record<string, unknown>;
22
+ }
23
+ /**
24
+ * Validation result for a category
25
+ */
26
+ export interface ValidationResult {
27
+ category: 'cli' | 'mcp' | 'hooks' | 'api';
28
+ totalChecks: number;
29
+ passedChecks: number;
30
+ failedChecks: number;
31
+ breakingChanges: number;
32
+ checks: ValidationCheck[];
33
+ duration: number;
34
+ }
35
+ /**
36
+ * Full validation report
37
+ */
38
+ export interface FullValidationReport {
39
+ timestamp: Date;
40
+ v2Version: string;
41
+ v3Version: string;
42
+ overallPassed: boolean;
43
+ totalChecks: number;
44
+ passedChecks: number;
45
+ failedChecks: number;
46
+ breakingChanges: number;
47
+ cli: ValidationResult;
48
+ mcp: ValidationResult;
49
+ hooks: ValidationResult;
50
+ api: ValidationResult;
51
+ summary: string;
52
+ recommendations: string[];
53
+ duration: number;
54
+ }
55
+ /**
56
+ * V2 CLI command definition
57
+ */
58
+ export interface V2CLICommand {
59
+ name: string;
60
+ aliases: string[];
61
+ flags: string[];
62
+ description: string;
63
+ v3Equivalent?: string;
64
+ deprecated?: boolean;
65
+ }
66
+ /**
67
+ * V2 MCP tool definition
68
+ */
69
+ export interface V2MCPTool {
70
+ name: string;
71
+ parameters: Record<string, {
72
+ type: string;
73
+ required: boolean;
74
+ }>;
75
+ returnType: string;
76
+ v3Equivalent?: string;
77
+ deprecated?: boolean;
78
+ }
79
+ /**
80
+ * V2 hook definition
81
+ */
82
+ export interface V2Hook {
83
+ name: string;
84
+ trigger: string;
85
+ parameters: string[];
86
+ returnType: string;
87
+ v3Equivalent?: string;
88
+ deprecated?: boolean;
89
+ }
90
+ /**
91
+ * V2 API interface definition
92
+ */
93
+ export interface V2APIInterface {
94
+ name: string;
95
+ methods: {
96
+ name: string;
97
+ signature: string;
98
+ }[];
99
+ v3Equivalent?: string;
100
+ deprecated?: boolean;
101
+ }
102
+ /**
103
+ * V2 CLI Commands (25 total)
104
+ */
105
+ export declare const V2_CLI_COMMANDS: V2CLICommand[];
106
+ /**
107
+ * V2 MCP Tools (65 total - showing key ones)
108
+ */
109
+ export declare const V2_MCP_TOOLS: V2MCPTool[];
110
+ /**
111
+ * V2 Hooks (42 total)
112
+ */
113
+ export declare const V2_HOOKS: V2Hook[];
114
+ /**
115
+ * V2 API Interfaces
116
+ */
117
+ export declare const V2_API_INTERFACES: V2APIInterface[];
118
+ /**
119
+ * Mock V3 service for testing
120
+ */
121
+ interface MockV3Service {
122
+ cli: {
123
+ execute: (command: string, args: string[]) => Promise<{
124
+ success: boolean;
125
+ output: string;
126
+ }>;
127
+ getCommands: () => string[];
128
+ };
129
+ mcp: {
130
+ callTool: (name: string, params: Record<string, unknown>) => Promise<unknown>;
131
+ getTools: () => string[];
132
+ translateToolName: (v2Name: string) => string;
133
+ };
134
+ hooks: {
135
+ trigger: (name: string, params: Record<string, unknown>) => Promise<{
136
+ handled: boolean;
137
+ result: unknown;
138
+ }>;
139
+ getHooks: () => string[];
140
+ };
141
+ api: {
142
+ getClass: (name: string) => {
143
+ methods: string[];
144
+ } | null;
145
+ getClasses: () => string[];
146
+ };
147
+ }
148
+ /**
149
+ * V2 Compatibility Validator
150
+ *
151
+ * Tests V3 implementation against V2 capabilities to ensure backward compatibility.
152
+ */
153
+ export declare class V2CompatibilityValidator {
154
+ private readonly v3Service;
155
+ private readonly v2Version;
156
+ private readonly v3Version;
157
+ private readonly verbose;
158
+ constructor(options?: {
159
+ v3Service?: MockV3Service;
160
+ v2Version?: string;
161
+ v3Version?: string;
162
+ verbose?: boolean;
163
+ });
164
+ /**
165
+ * Create default mock V3 service for testing
166
+ */
167
+ private createDefaultMockService;
168
+ /**
169
+ * Validate CLI command compatibility
170
+ */
171
+ validateCLI(): Promise<ValidationResult>;
172
+ /**
173
+ * Validate MCP tool compatibility
174
+ */
175
+ validateMCPTools(): Promise<ValidationResult>;
176
+ /**
177
+ * Validate hook compatibility
178
+ */
179
+ validateHooks(): Promise<ValidationResult>;
180
+ /**
181
+ * Validate API compatibility
182
+ */
183
+ validateAPI(): Promise<ValidationResult>;
184
+ /**
185
+ * Run full validation suite
186
+ */
187
+ runFullValidation(): Promise<FullValidationReport>;
188
+ /**
189
+ * Generate recommendations based on results
190
+ */
191
+ private generateRecommendations;
192
+ /**
193
+ * Generate human-readable summary
194
+ */
195
+ private generateSummary;
196
+ /**
197
+ * Log message if verbose mode is enabled
198
+ */
199
+ private log;
200
+ }
201
+ /**
202
+ * Generate markdown compatibility report
203
+ */
204
+ export declare function generateCompatibilityReport(report: FullValidationReport): string;
205
+ export {};
206
+ //# sourceMappingURL=compatibility-validator.d.ts.map