fraim-framework 2.0.55 โ†’ 2.0.57

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 (120) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/dist/src/cli/commands/init-project.js +10 -4
  3. package/dist/src/cli/setup/mcp-config-generator.js +23 -15
  4. package/dist/src/local-mcp-server/stdio-server.js +207 -0
  5. package/dist/src/utils/validate-workflows.js +101 -0
  6. package/dist/src/utils/workflow-parser.js +81 -0
  7. package/package.json +16 -11
  8. package/registry/scripts/pdf-styles.css +172 -0
  9. package/registry/scripts/prep-issue.sh +46 -4
  10. package/registry/scripts/profile-server.ts +131 -130
  11. package/registry/stubs/workflows/customer-development/user-survey-dispatch.md +1 -1
  12. package/registry/stubs/workflows/customer-development/users-to-target.md +1 -1
  13. package/registry/stubs/workflows/product-building/design.md +1 -1
  14. package/registry/stubs/workflows/product-building/implement.md +1 -1
  15. package/Claude.md +0 -1
  16. package/dist/registry/ai-manager-rules/design-phases/design-completeness-review.md +0 -73
  17. package/dist/registry/ai-manager-rules/design-phases/design-design.md +0 -145
  18. package/dist/registry/ai-manager-rules/implement-phases/implement-code.md +0 -283
  19. package/dist/registry/ai-manager-rules/implement-phases/implement-completeness-review.md +0 -120
  20. package/dist/registry/ai-manager-rules/implement-phases/implement-regression.md +0 -173
  21. package/dist/registry/ai-manager-rules/implement-phases/implement-repro.md +0 -104
  22. package/dist/registry/ai-manager-rules/implement-phases/implement-scoping.md +0 -100
  23. package/dist/registry/ai-manager-rules/implement-phases/implement-smoke.md +0 -237
  24. package/dist/registry/ai-manager-rules/implement-phases/implement-spike.md +0 -121
  25. package/dist/registry/ai-manager-rules/implement-phases/implement-validate.md +0 -375
  26. package/dist/registry/ai-manager-rules/retrospective.md +0 -116
  27. package/dist/registry/ai-manager-rules/shared-phases/address-pr-feedback.md +0 -188
  28. package/dist/registry/ai-manager-rules/shared-phases/submit-pr.md +0 -202
  29. package/dist/registry/ai-manager-rules/shared-phases/wait-for-pr-review.md +0 -170
  30. package/dist/registry/ai-manager-rules/spec-phases/spec-competitor-analysis.md +0 -105
  31. package/dist/registry/ai-manager-rules/spec-phases/spec-completeness-review.md +0 -66
  32. package/dist/registry/ai-manager-rules/spec-phases/spec-spec.md +0 -139
  33. package/dist/registry/providers/ado.json +0 -19
  34. package/dist/registry/providers/github.json +0 -19
  35. package/dist/registry/scripts/cleanup-branch.js +0 -287
  36. package/dist/registry/scripts/evaluate-code-quality.js +0 -66
  37. package/dist/registry/scripts/exec-with-timeout.js +0 -142
  38. package/dist/registry/scripts/generate-engagement-emails.js +0 -705
  39. package/dist/registry/scripts/newsletter-helpers.js +0 -671
  40. package/dist/registry/scripts/profile-server.js +0 -388
  41. package/dist/registry/scripts/run-thank-you-workflow.js +0 -92
  42. package/dist/registry/scripts/send-newsletter-simple.js +0 -85
  43. package/dist/registry/scripts/send-thank-you-emails.js +0 -54
  44. package/dist/registry/scripts/validate-openapi-limits.js +0 -311
  45. package/dist/registry/scripts/validate-test-coverage.js +0 -262
  46. package/dist/registry/scripts/verify-test-coverage.js +0 -66
  47. package/dist/scripts/build-stub-registry.js +0 -108
  48. package/dist/src/ai-manager/ai-manager.js +0 -482
  49. package/dist/src/ai-manager/phase-flow.js +0 -357
  50. package/dist/src/ai-manager/types.js +0 -5
  51. package/dist/src/fraim-mcp-server.js +0 -1885
  52. package/dist/tests/debug-tools.js +0 -80
  53. package/dist/tests/shared-server-utils.js +0 -57
  54. package/dist/tests/test-add-ide.js +0 -283
  55. package/dist/tests/test-ai-coach-edge-cases.js +0 -420
  56. package/dist/tests/test-ai-coach-mcp-integration.js +0 -450
  57. package/dist/tests/test-ai-coach-performance.js +0 -328
  58. package/dist/tests/test-ai-coach-phase-content.js +0 -264
  59. package/dist/tests/test-ai-coach-workflows.js +0 -514
  60. package/dist/tests/test-cli.js +0 -228
  61. package/dist/tests/test-client-scripts-validation.js +0 -167
  62. package/dist/tests/test-complete-setup-flow.js +0 -110
  63. package/dist/tests/test-config-system.js +0 -279
  64. package/dist/tests/test-debug-session.js +0 -134
  65. package/dist/tests/test-end-to-end-hybrid-validation.js +0 -328
  66. package/dist/tests/test-enhanced-session-init.js +0 -188
  67. package/dist/tests/test-first-run-journey.js +0 -368
  68. package/dist/tests/test-fraim-issues.js +0 -59
  69. package/dist/tests/test-genericization.js +0 -44
  70. package/dist/tests/test-hybrid-script-execution.js +0 -340
  71. package/dist/tests/test-ide-detector.js +0 -46
  72. package/dist/tests/test-improved-setup.js +0 -121
  73. package/dist/tests/test-mcp-config-generator.js +0 -99
  74. package/dist/tests/test-mcp-connection.js +0 -107
  75. package/dist/tests/test-mcp-issue-integration.js +0 -156
  76. package/dist/tests/test-mcp-lifecycle-methods.js +0 -240
  77. package/dist/tests/test-mcp-shared-server.js +0 -308
  78. package/dist/tests/test-mcp-template-processing.js +0 -160
  79. package/dist/tests/test-modular-issue-tracking.js +0 -165
  80. package/dist/tests/test-node-compatibility.js +0 -95
  81. package/dist/tests/test-npm-install.js +0 -68
  82. package/dist/tests/test-package-size.js +0 -108
  83. package/dist/tests/test-pr-review-workflow.js +0 -307
  84. package/dist/tests/test-prep-issue.js +0 -129
  85. package/dist/tests/test-productivity-integration.js +0 -157
  86. package/dist/tests/test-script-location-independence.js +0 -198
  87. package/dist/tests/test-script-sync.js +0 -557
  88. package/dist/tests/test-server-utils.js +0 -32
  89. package/dist/tests/test-session-rehydration.js +0 -148
  90. package/dist/tests/test-setup-integration.js +0 -98
  91. package/dist/tests/test-setup-scenarios.js +0 -322
  92. package/dist/tests/test-standalone.js +0 -143
  93. package/dist/tests/test-stub-registry.js +0 -136
  94. package/dist/tests/test-sync-stubs.js +0 -143
  95. package/dist/tests/test-sync-version-update.js +0 -93
  96. package/dist/tests/test-telemetry.js +0 -193
  97. package/dist/tests/test-token-validator.js +0 -30
  98. package/dist/tests/test-user-journey.js +0 -236
  99. package/dist/tests/test-users-to-target-workflow.js +0 -253
  100. package/dist/tests/test-utils.js +0 -109
  101. package/dist/tests/test-wizard.js +0 -71
  102. package/dist/tests/test-workflow-discovery.js +0 -242
  103. package/labels.json +0 -52
  104. package/registry/agent-guardrails.md +0 -63
  105. package/registry/fraim.md +0 -48
  106. package/registry/stubs/workflows/customer-development/ai-coach-phases/phase1-customer-profiling.md +0 -11
  107. package/registry/stubs/workflows/customer-development/ai-coach-phases/phase1-survey-scoping.md +0 -11
  108. package/registry/stubs/workflows/customer-development/ai-coach-phases/phase2-platform-discovery.md +0 -11
  109. package/registry/stubs/workflows/customer-development/ai-coach-phases/phase2-survey-build-linkedin.md +0 -11
  110. package/registry/stubs/workflows/customer-development/ai-coach-phases/phase3-prospect-qualification.md +0 -11
  111. package/registry/stubs/workflows/customer-development/ai-coach-phases/phase3-survey-build-reddit.md +0 -11
  112. package/registry/stubs/workflows/customer-development/ai-coach-phases/phase4-inventory-compilation.md +0 -11
  113. package/registry/stubs/workflows/customer-development/ai-coach-phases/phase4-survey-build-x.md +0 -11
  114. package/registry/stubs/workflows/customer-development/ai-coach-phases/phase5-survey-build-facebook.md +0 -11
  115. package/registry/stubs/workflows/customer-development/ai-coach-phases/phase6-survey-build-custom.md +0 -11
  116. package/registry/stubs/workflows/customer-development/ai-coach-phases/phase7-survey-dispatch.md +0 -11
  117. package/registry/stubs/workflows/customer-development/templates/customer-persona-template.md +0 -11
  118. package/registry/stubs/workflows/customer-development/templates/search-strategy-template.md +0 -11
  119. package/setup.js +0 -171
  120. package/tsconfig.json +0 -23
@@ -1,279 +0,0 @@
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
- Object.defineProperty(exports, "__esModule", { value: true });
39
- const node_test_1 = require("node:test");
40
- const node_assert_1 = __importDefault(require("node:assert"));
41
- const fs_1 = __importDefault(require("fs"));
42
- const path_1 = __importDefault(require("path"));
43
- const os_1 = __importDefault(require("os"));
44
- // Test the configuration system without interactive prompts
45
- (0, node_test_1.test)('Config System - Global vs Local Config Separation', async () => {
46
- // Create temporary directories for testing
47
- const tempHomeDir = path_1.default.join(os_1.default.tmpdir(), '.fraim-test-home-' + Date.now());
48
- const tempProjectDir = path_1.default.join(os_1.default.tmpdir(), '.fraim-test-project-' + Date.now());
49
- fs_1.default.mkdirSync(tempHomeDir, { recursive: true });
50
- fs_1.default.mkdirSync(tempProjectDir, { recursive: true });
51
- // Mock os.homedir and process.cwd
52
- const originalHomedir = os_1.default.homedir;
53
- const originalCwd = process.cwd;
54
- os_1.default.homedir = () => tempHomeDir;
55
- process.cwd = () => tempProjectDir;
56
- try {
57
- // Test 1: Global config structure
58
- const globalConfigDir = path_1.default.join(tempHomeDir, '.fraim');
59
- const globalConfigPath = path_1.default.join(globalConfigDir, 'config.json');
60
- fs_1.default.mkdirSync(globalConfigDir, { recursive: true });
61
- const globalConfig = {
62
- version: '2.0.27',
63
- apiKey: 'fraim_test_user_key',
64
- githubToken: 'ghp_test_github_token',
65
- configuredAt: new Date().toISOString(),
66
- userPreferences: {
67
- autoSync: true,
68
- backupConfigs: true
69
- }
70
- };
71
- fs_1.default.writeFileSync(globalConfigPath, JSON.stringify(globalConfig, null, 2));
72
- // Test 2: Local config structure
73
- const localConfigDir = path_1.default.join(tempProjectDir, '.fraim');
74
- const localConfigPath = path_1.default.join(localConfigDir, 'config.json');
75
- fs_1.default.mkdirSync(localConfigDir, { recursive: true });
76
- const localConfig = {
77
- version: '2.0.27',
78
- project: {
79
- name: 'test-project'
80
- },
81
- git: {
82
- defaultBranch: 'main',
83
- repoOwner: 'testuser',
84
- repoName: 'test-project'
85
- },
86
- customizations: {
87
- workflowsPath: '.fraim/workflows'
88
- }
89
- };
90
- fs_1.default.writeFileSync(localConfigPath, JSON.stringify(localConfig, null, 2));
91
- // Test 3: Verify separation - global config has secrets, local doesn't
92
- const globalData = JSON.parse(fs_1.default.readFileSync(globalConfigPath, 'utf8'));
93
- const localData = JSON.parse(fs_1.default.readFileSync(localConfigPath, 'utf8'));
94
- // Global config should have secrets
95
- (0, node_assert_1.default)(globalData.apiKey, 'Global config should have apiKey');
96
- (0, node_assert_1.default)(globalData.githubToken, 'Global config should have githubToken');
97
- (0, node_assert_1.default)(globalData.userPreferences, 'Global config should have userPreferences');
98
- // Local config should NOT have secrets
99
- (0, node_assert_1.default)(!localData.apiKey, 'Local config should NOT have apiKey');
100
- (0, node_assert_1.default)(!localData.githubToken, 'Local config should NOT have githubToken');
101
- (0, node_assert_1.default)(!localData.userPreferences, 'Local config should NOT have userPreferences');
102
- // Local config should have project settings
103
- (0, node_assert_1.default)(localData.project, 'Local config should have project settings');
104
- (0, node_assert_1.default)(localData.git, 'Local config should have git settings');
105
- (0, node_assert_1.default)(localData.customizations, 'Local config should have customizations');
106
- console.log('โœ… Config separation test passed');
107
- }
108
- finally {
109
- // Cleanup
110
- fs_1.default.rmSync(tempHomeDir, { recursive: true, force: true });
111
- fs_1.default.rmSync(tempProjectDir, { recursive: true, force: true });
112
- // Restore original functions
113
- os_1.default.homedir = originalHomedir;
114
- process.cwd = originalCwd;
115
- }
116
- });
117
- (0, node_test_1.test)('Config System - loadGlobalConfig function behavior', async () => {
118
- // Import the function dynamically to avoid module loading issues
119
- const { loadGlobalConfig } = await Promise.resolve().then(() => __importStar(require('../src/cli/commands/add-ide')));
120
- const tempHomeDir = path_1.default.join(os_1.default.tmpdir(), '.fraim-test-load-' + Date.now());
121
- const originalHomedir = os_1.default.homedir;
122
- os_1.default.homedir = () => tempHomeDir;
123
- try {
124
- // Test 1: No global config exists
125
- const result1 = loadGlobalConfig();
126
- node_assert_1.default.strictEqual(result1, null, 'Should return null when no config exists');
127
- // Test 2: Create global config with both keys
128
- const globalConfigDir = path_1.default.join(tempHomeDir, '.fraim');
129
- const globalConfigPath = path_1.default.join(globalConfigDir, 'config.json');
130
- fs_1.default.mkdirSync(globalConfigDir, { recursive: true });
131
- const completeConfig = {
132
- version: '2.0.27',
133
- apiKey: 'fraim_complete_key',
134
- githubToken: 'ghp_complete_token',
135
- configuredAt: new Date().toISOString()
136
- };
137
- fs_1.default.writeFileSync(globalConfigPath, JSON.stringify(completeConfig, null, 2));
138
- const result2 = loadGlobalConfig();
139
- (0, node_assert_1.default)(result2, 'Should return config object');
140
- node_assert_1.default.strictEqual(result2.fraimKey, 'fraim_complete_key', 'Should extract FRAIM key');
141
- node_assert_1.default.strictEqual(result2.githubToken, 'ghp_complete_token', 'Should extract GitHub token');
142
- // Test 3: Config with missing GitHub token
143
- const incompleteConfig = {
144
- version: '2.0.27',
145
- apiKey: 'fraim_incomplete_key',
146
- configuredAt: new Date().toISOString()
147
- // No githubToken
148
- };
149
- fs_1.default.writeFileSync(globalConfigPath, JSON.stringify(incompleteConfig, null, 2));
150
- const result3 = loadGlobalConfig();
151
- (0, node_assert_1.default)(result3, 'Should return config object even without GitHub token');
152
- node_assert_1.default.strictEqual(result3.fraimKey, 'fraim_incomplete_key', 'Should extract FRAIM key');
153
- node_assert_1.default.strictEqual(result3.githubToken, undefined, 'GitHub token should be undefined');
154
- // Test 4: Corrupted config file
155
- fs_1.default.writeFileSync(globalConfigPath, 'invalid json content');
156
- const result4 = loadGlobalConfig();
157
- node_assert_1.default.strictEqual(result4, null, 'Should return null for corrupted config');
158
- console.log('โœ… loadGlobalConfig function tests passed');
159
- }
160
- finally {
161
- // Cleanup
162
- fs_1.default.rmSync(tempHomeDir, { recursive: true, force: true });
163
- os_1.default.homedir = originalHomedir;
164
- }
165
- });
166
- (0, node_test_1.test)('Config System - saveGlobalConfig function behavior', async () => {
167
- const tempHomeDir = path_1.default.join(os_1.default.tmpdir(), '.fraim-test-save-' + Date.now());
168
- const originalHomedir = os_1.default.homedir;
169
- os_1.default.homedir = () => tempHomeDir;
170
- try {
171
- // Import the setup command to test saveGlobalConfig indirectly
172
- // We'll test by checking the file it creates
173
- const globalConfigDir = path_1.default.join(tempHomeDir, '.fraim');
174
- const globalConfigPath = path_1.default.join(globalConfigDir, 'config.json');
175
- // Test 1: Save config with both keys
176
- // We can't directly test the private function, so we'll test the file structure
177
- fs_1.default.mkdirSync(globalConfigDir, { recursive: true });
178
- const testConfig = {
179
- version: '2.0.27',
180
- apiKey: 'fraim_test_save_key',
181
- githubToken: 'ghp_test_save_token',
182
- configuredAt: new Date().toISOString(),
183
- userPreferences: {
184
- autoSync: true,
185
- backupConfigs: true
186
- }
187
- };
188
- fs_1.default.writeFileSync(globalConfigPath, JSON.stringify(testConfig, null, 2));
189
- // Verify the file was created correctly
190
- (0, node_assert_1.default)(fs_1.default.existsSync(globalConfigPath), 'Global config file should exist');
191
- const savedConfig = JSON.parse(fs_1.default.readFileSync(globalConfigPath, 'utf8'));
192
- node_assert_1.default.strictEqual(savedConfig.apiKey, 'fraim_test_save_key', 'FRAIM key should be saved');
193
- node_assert_1.default.strictEqual(savedConfig.githubToken, 'ghp_test_save_token', 'GitHub token should be saved');
194
- (0, node_assert_1.default)(savedConfig.userPreferences, 'User preferences should be saved');
195
- // Test 2: Save config without GitHub token
196
- const configWithoutGithub = {
197
- version: '2.0.27',
198
- apiKey: 'fraim_test_no_github',
199
- githubToken: undefined,
200
- configuredAt: new Date().toISOString(),
201
- userPreferences: {
202
- autoSync: true,
203
- backupConfigs: true
204
- }
205
- };
206
- fs_1.default.writeFileSync(globalConfigPath, JSON.stringify(configWithoutGithub, null, 2));
207
- const savedConfig2 = JSON.parse(fs_1.default.readFileSync(globalConfigPath, 'utf8'));
208
- node_assert_1.default.strictEqual(savedConfig2.apiKey, 'fraim_test_no_github', 'FRAIM key should be saved');
209
- node_assert_1.default.strictEqual(savedConfig2.githubToken, undefined, 'GitHub token should be undefined');
210
- console.log('โœ… saveGlobalConfig behavior tests passed');
211
- }
212
- finally {
213
- // Cleanup
214
- fs_1.default.rmSync(tempHomeDir, { recursive: true, force: true });
215
- os_1.default.homedir = originalHomedir;
216
- }
217
- });
218
- (0, node_test_1.test)('Config System - Path Resolution', async () => {
219
- // Test that global and local configs use correct paths
220
- const tempHomeDir = path_1.default.join(os_1.default.tmpdir(), '.fraim-test-paths-' + Date.now());
221
- const tempProjectDir = path_1.default.join(os_1.default.tmpdir(), '.fraim-test-project-paths-' + Date.now());
222
- const originalHomedir = os_1.default.homedir;
223
- const originalCwd = process.cwd;
224
- os_1.default.homedir = () => tempHomeDir;
225
- process.cwd = () => tempProjectDir;
226
- try {
227
- // Expected paths
228
- const expectedGlobalPath = path_1.default.join(tempHomeDir, '.fraim', 'config.json');
229
- const expectedLocalPath = path_1.default.join(tempProjectDir, '.fraim', 'config.json');
230
- // Create both configs
231
- fs_1.default.mkdirSync(path_1.default.dirname(expectedGlobalPath), { recursive: true });
232
- fs_1.default.mkdirSync(path_1.default.dirname(expectedLocalPath), { recursive: true });
233
- const globalConfig = { apiKey: 'global_key', githubToken: 'global_token' };
234
- const localConfig = { project: { name: 'local_project' } };
235
- fs_1.default.writeFileSync(expectedGlobalPath, JSON.stringify(globalConfig, null, 2));
236
- fs_1.default.writeFileSync(expectedLocalPath, JSON.stringify(localConfig, null, 2));
237
- // Verify paths are correct
238
- (0, node_assert_1.default)(fs_1.default.existsSync(expectedGlobalPath), 'Global config should exist at expected path');
239
- (0, node_assert_1.default)(fs_1.default.existsSync(expectedLocalPath), 'Local config should exist at expected path');
240
- // Verify they're different files with different content
241
- const globalData = JSON.parse(fs_1.default.readFileSync(expectedGlobalPath, 'utf8'));
242
- const localData = JSON.parse(fs_1.default.readFileSync(expectedLocalPath, 'utf8'));
243
- (0, node_assert_1.default)(globalData.apiKey, 'Global config should have API key');
244
- (0, node_assert_1.default)(!localData.apiKey, 'Local config should not have API key');
245
- (0, node_assert_1.default)(localData.project, 'Local config should have project info');
246
- (0, node_assert_1.default)(!globalData.project, 'Global config should not have project info');
247
- console.log('โœ… Path resolution tests passed');
248
- }
249
- finally {
250
- // Cleanup
251
- fs_1.default.rmSync(tempHomeDir, { recursive: true, force: true });
252
- fs_1.default.rmSync(tempProjectDir, { recursive: true, force: true });
253
- os_1.default.homedir = originalHomedir;
254
- process.cwd = originalCwd;
255
- }
256
- });
257
- (0, node_test_1.test)('Config System - Cross-platform Path Handling', async () => {
258
- // Test that paths work correctly on different platforms
259
- const tempHomeDir = path_1.default.join(os_1.default.tmpdir(), '.fraim-test-cross-platform-' + Date.now());
260
- const originalHomedir = os_1.default.homedir;
261
- os_1.default.homedir = () => tempHomeDir;
262
- try {
263
- // Test path.join usage (should work on all platforms)
264
- const globalConfigPath = path_1.default.join(tempHomeDir, '.fraim', 'config.json');
265
- // Create the config
266
- fs_1.default.mkdirSync(path_1.default.dirname(globalConfigPath), { recursive: true });
267
- fs_1.default.writeFileSync(globalConfigPath, JSON.stringify({ test: 'cross-platform' }, null, 2));
268
- // Verify it exists and is readable
269
- (0, node_assert_1.default)(fs_1.default.existsSync(globalConfigPath), 'Config should exist with cross-platform path');
270
- const data = JSON.parse(fs_1.default.readFileSync(globalConfigPath, 'utf8'));
271
- node_assert_1.default.strictEqual(data.test, 'cross-platform', 'Config should be readable');
272
- console.log('โœ… Cross-platform path tests passed');
273
- }
274
- finally {
275
- // Cleanup
276
- fs_1.default.rmSync(tempHomeDir, { recursive: true, force: true });
277
- os_1.default.homedir = originalHomedir;
278
- }
279
- });
@@ -1,134 +0,0 @@
1
- "use strict";
2
- /**
3
- * Debug test for session initialization
4
- */
5
- var __importDefault = (this && this.__importDefault) || function (mod) {
6
- return (mod && mod.__esModule) ? mod : { "default": mod };
7
- };
8
- Object.defineProperty(exports, "__esModule", { value: true });
9
- exports.testDebugSession = testDebugSession;
10
- const axios_1 = __importDefault(require("axios"));
11
- const db_service_1 = require("../src/fraim/db-service");
12
- const shared_server_utils_1 = require("./shared-server-utils");
13
- const MCP_URL = (0, shared_server_utils_1.getMcpEndpoint)();
14
- const TEST_API_KEY = 'test-debug-session-key';
15
- async function testDebugSession() {
16
- console.log('๐Ÿงช Debug Session Test...');
17
- const dbService = new db_service_1.FraimDbService();
18
- try {
19
- // Wait for server to be ready
20
- await (0, shared_server_utils_1.waitForServer)();
21
- console.log(' โœ… Server is ready');
22
- await dbService.connect();
23
- console.log(' โœ… Database connected');
24
- // Set up test API key in database
25
- const db = dbService.db;
26
- await db.collection('fraim_api_keys').deleteOne({ key: TEST_API_KEY });
27
- await db.collection('fraim_api_keys').insertOne({
28
- key: TEST_API_KEY,
29
- userId: 'test-user-debug-session',
30
- orgId: 'test-org',
31
- isActive: true,
32
- createdAt: new Date()
33
- });
34
- console.log(' โœ… API key inserted');
35
- // Test basic MCP call first
36
- console.log(' Testing basic MCP call...');
37
- const initResponse = await axios_1.default.post(MCP_URL, {
38
- jsonrpc: '2.0',
39
- id: 1,
40
- method: 'initialize',
41
- params: {}
42
- }, {
43
- headers: { 'x-api-key': TEST_API_KEY }
44
- });
45
- console.log(' โœ… Initialize call successful:', initResponse.status);
46
- // Test tools/list
47
- console.log(' Testing tools/list...');
48
- const toolsResponse = await axios_1.default.post(MCP_URL, {
49
- jsonrpc: '2.0',
50
- id: 2,
51
- method: 'tools/list',
52
- params: {}
53
- }, {
54
- headers: { 'x-api-key': TEST_API_KEY }
55
- });
56
- console.log(' โœ… Tools list successful:', toolsResponse.status);
57
- console.log(' Tools found:', toolsResponse.data.result.tools.length);
58
- // Check if fraim_connect is in the tools list
59
- const fraimConnectTool = toolsResponse.data.result.tools.find((t) => t.name === 'fraim_connect');
60
- if (fraimConnectTool) {
61
- console.log(' โœ… fraim_connect tool found');
62
- }
63
- else {
64
- console.log(' โŒ fraim_connect tool NOT found');
65
- console.log(' Available tools:', toolsResponse.data.result.tools.map((t) => t.name));
66
- }
67
- // Now test fraim_connect
68
- console.log(' Testing fraim_connect...');
69
- const connectResponse = await axios_1.default.post(MCP_URL, {
70
- jsonrpc: '2.0',
71
- id: 3,
72
- method: 'tools/call',
73
- params: {
74
- name: 'fraim_connect',
75
- arguments: {
76
- agent: {
77
- name: 'Claude',
78
- model: 'claude-3.5-sonnet'
79
- },
80
- machine: {
81
- hostname: 'test-machine',
82
- platform: 'linux'
83
- },
84
- repo: {
85
- url: 'https://github.com/test/repo.git'
86
- }
87
- }
88
- }
89
- }, {
90
- headers: { 'x-api-key': TEST_API_KEY }
91
- });
92
- console.log(' โœ… fraim_connect successful:', connectResponse.status);
93
- console.log(' Response:', JSON.stringify(connectResponse.data, null, 2));
94
- console.log('โœ… All debug tests passed!');
95
- return true;
96
- }
97
- catch (error) {
98
- console.error('โŒ Debug test failed:', error.message);
99
- if (error.response?.data) {
100
- console.error(' Response data:', JSON.stringify(error.response.data, null, 2));
101
- }
102
- if (error.response?.status) {
103
- console.error(' Status:', error.response.status);
104
- }
105
- return false;
106
- }
107
- finally {
108
- // Clean up
109
- if (dbService) {
110
- try {
111
- const db = dbService.db;
112
- await db.collection('fraim_api_keys').deleteOne({ key: TEST_API_KEY });
113
- await db.collection('fraim_telemetry_sessions').deleteMany({ userId: 'test-user-debug-session' });
114
- }
115
- catch (e) {
116
- // Ignore cleanup errors
117
- }
118
- await dbService.close();
119
- }
120
- }
121
- }
122
- // Run if called directly
123
- if (require.main === module) {
124
- testDebugSession()
125
- .then(success => {
126
- if (!success) {
127
- throw new Error('Test failed');
128
- }
129
- })
130
- .catch(err => {
131
- console.error('Test runner error:', err);
132
- throw err;
133
- });
134
- }