fraim-framework 2.0.36 → 2.0.38

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 (192) hide show
  1. package/bin/fraim.js +5 -52
  2. package/dist/registry/scripts/build-scripts-generator.js +205 -0
  3. package/dist/registry/scripts/fraim-config.js +61 -0
  4. package/dist/registry/scripts/generic-issues-api.js +100 -0
  5. package/dist/registry/scripts/openapi-generator.js +664 -0
  6. package/dist/registry/scripts/performance/profile-server.js +390 -0
  7. package/dist/scripts/build-stub-registry.js +108 -0
  8. package/dist/src/cli/commands/doctor.js +5 -5
  9. package/dist/src/cli/commands/init-project.js +74 -0
  10. package/dist/src/cli/commands/setup.js +176 -0
  11. package/dist/src/cli/commands/sync.js +33 -19
  12. package/dist/src/cli/commands/test-mcp.js +135 -0
  13. package/dist/src/cli/fraim.js +6 -0
  14. package/dist/src/cli/setup/auto-mcp-setup.js +367 -0
  15. package/dist/src/cli/setup/ide-detector.js +163 -0
  16. package/dist/src/cli/setup/mcp-config-generator.js +115 -0
  17. package/dist/src/cli/setup/token-validator.js +49 -0
  18. package/dist/test-utils.js +96 -0
  19. package/dist/tests/debug-tools.js +2 -2
  20. package/dist/tests/esm-compat.js +11 -0
  21. package/dist/tests/shared-server-utils.js +57 -0
  22. package/dist/tests/test-chalk-esm-issue.js +159 -0
  23. package/dist/tests/test-chalk-real-world.js +265 -0
  24. package/dist/tests/test-chalk-regression.js +2 -18
  25. package/dist/tests/test-chalk-resolution-issue.js +304 -0
  26. package/dist/tests/test-client-scripts-validation.js +27 -5
  27. package/dist/tests/test-complete-setup-flow.js +110 -0
  28. package/dist/tests/test-fraim-install-chalk-issue.js +254 -0
  29. package/dist/tests/test-ide-detector.js +46 -0
  30. package/dist/tests/test-improved-setup.js +121 -0
  31. package/dist/tests/test-mcp-config-generator.js +70 -0
  32. package/dist/tests/test-mcp-connection.js +58 -117
  33. package/dist/tests/test-mcp-issue-integration.js +2 -2
  34. package/dist/tests/test-mcp-lifecycle-methods.js +34 -100
  35. package/dist/tests/test-mcp-shared-server.js +308 -0
  36. package/dist/tests/test-npm-resolution-diagnostic.js +140 -0
  37. package/dist/tests/test-package-size.js +101 -0
  38. package/dist/tests/test-prep-issue.js +34 -1
  39. package/dist/tests/test-script-location-independence.js +39 -62
  40. package/dist/tests/test-server-utils.js +32 -0
  41. package/dist/tests/test-session-rehydration.js +2 -2
  42. package/dist/tests/test-setup-integration.js +98 -0
  43. package/dist/tests/test-standalone.js +2 -2
  44. package/dist/tests/test-stub-registry.js +136 -0
  45. package/dist/tests/test-sync-stubs.js +143 -0
  46. package/dist/tests/test-telemetry.js +2 -2
  47. package/dist/tests/test-token-validator.js +30 -0
  48. package/dist/tests/test-user-journey.js +2 -1
  49. package/package.json +7 -9
  50. package/registry/agent-guardrails.md +62 -62
  51. package/registry/scripts/code-quality-check.sh +559 -559
  52. package/registry/scripts/detect-tautological-tests.sh +38 -38
  53. package/registry/scripts/prep-issue.sh +61 -30
  54. package/registry/scripts/validate-openapi-limits.ts +366 -366
  55. package/registry/scripts/validate-test-coverage.ts +280 -280
  56. package/registry/scripts/verify-pr-comments.sh +70 -70
  57. package/registry/stubs/workflows/bootstrap/create-architecture.md +11 -0
  58. package/registry/stubs/workflows/bootstrap/detect-broken-windows.md +11 -0
  59. package/registry/stubs/workflows/bootstrap/evaluate-code-quality.md +11 -0
  60. package/registry/stubs/workflows/bootstrap/verify-test-coverage.md +11 -0
  61. package/registry/stubs/workflows/business-development/create-business-plan.md +11 -0
  62. package/registry/stubs/workflows/business-development/ideate-business-opportunity.md +11 -0
  63. package/registry/stubs/workflows/business-development/price-product.md +18 -0
  64. package/registry/stubs/workflows/convert-to-pdf.md +11 -0
  65. package/registry/stubs/workflows/customer-development/insight-analysis.md +11 -0
  66. package/registry/stubs/workflows/customer-development/insight-triage.md +11 -0
  67. package/registry/stubs/workflows/customer-development/interview-preparation.md +11 -0
  68. package/registry/stubs/workflows/customer-development/linkedin-outreach.md +11 -0
  69. package/registry/stubs/workflows/customer-development/strategic-brainstorming.md +11 -0
  70. package/registry/stubs/workflows/customer-development/thank-customers.md +11 -0
  71. package/registry/stubs/workflows/customer-development/weekly-newsletter.md +11 -0
  72. package/registry/stubs/workflows/deploy/cloud-deployment.md +11 -0
  73. package/registry/stubs/workflows/improve-fraim/contribute.md +11 -0
  74. package/registry/stubs/workflows/improve-fraim/file-issue.md +11 -0
  75. package/registry/stubs/workflows/marketing/content-creation.md +11 -0
  76. package/registry/stubs/workflows/marketing/hbr-article.md +11 -0
  77. package/registry/stubs/workflows/marketing/launch-checklist.md +11 -0
  78. package/registry/stubs/workflows/marketing/marketing-strategy.md +11 -0
  79. package/registry/stubs/workflows/marketing/storytelling.md +11 -0
  80. package/registry/stubs/workflows/performance/analyze-performance.md +11 -0
  81. package/registry/stubs/workflows/product-building/design.md +11 -0
  82. package/registry/stubs/workflows/product-building/implement.md +12 -0
  83. package/registry/stubs/workflows/product-building/iterate-on-pr-comments.md +11 -0
  84. package/registry/stubs/workflows/product-building/prep-issue.md +11 -0
  85. package/registry/stubs/workflows/product-building/prototype.md +11 -0
  86. package/registry/stubs/workflows/product-building/resolve.md +11 -0
  87. package/registry/stubs/workflows/product-building/retrospect.md +11 -0
  88. package/registry/stubs/workflows/product-building/spec.md +11 -0
  89. package/registry/stubs/workflows/product-building/test.md +11 -0
  90. package/registry/stubs/workflows/quality-assurance/browser-validation.md +11 -0
  91. package/registry/stubs/workflows/quality-assurance/iterative-improvement-cycle.md +11 -0
  92. package/registry/stubs/workflows/replicate/replicate-discovery.md +11 -0
  93. package/registry/stubs/workflows/replicate/replicate-to-issues.md +11 -0
  94. package/registry/stubs/workflows/reviewer/review-implementation-vs-design-spec.md +11 -0
  95. package/registry/stubs/workflows/reviewer/review-implementation-vs-feature-spec.md +11 -0
  96. package/registry/stubs/workflows/startup-credits/aws-activate-application.md +11 -0
  97. package/registry/stubs/workflows/startup-credits/google-cloud-application.md +11 -0
  98. package/registry/stubs/workflows/startup-credits/microsoft-azure-application.md +11 -0
  99. package/.github/workflows/ci.yml +0 -65
  100. package/.github/workflows/deploy-fraim.yml +0 -87
  101. package/.github/workflows/phase-change.yml +0 -251
  102. package/.github/workflows/status-change.yml +0 -68
  103. package/.github/workflows/sync-on-pr-review.yml +0 -66
  104. package/examples/simple-webapp/TESTING.md +0 -62
  105. package/examples/simple-webapp/example-test.ts +0 -186
  106. package/registry/github/workflows/ci.yml +0 -51
  107. package/registry/github/workflows/phase-change.yml +0 -251
  108. package/registry/github/workflows/status-change.yml +0 -68
  109. package/registry/github/workflows/sync-on-pr-review.yml +0 -66
  110. package/registry/mcp-template.jsonc +0 -29
  111. package/registry/rules/agent-success-criteria.md +0 -52
  112. package/registry/rules/agent-testing-guidelines.md +0 -502
  113. package/registry/rules/architecture.md +0 -52
  114. package/registry/rules/communication.md +0 -122
  115. package/registry/rules/continuous-learning.md +0 -55
  116. package/registry/rules/debugging-multitenancy-issues.md +0 -85
  117. package/registry/rules/ephemeral-execution.md +0 -57
  118. package/registry/rules/git-safe-commands.md +0 -34
  119. package/registry/rules/hitl-ppe-record-analysis.md +0 -302
  120. package/registry/rules/integrity-and-test-ethics.md +0 -275
  121. package/registry/rules/local-development.md +0 -254
  122. package/registry/rules/merge-requirements.md +0 -231
  123. package/registry/rules/simplicity.md +0 -118
  124. package/registry/rules/software-development-lifecycle.md +0 -105
  125. package/registry/rules/spike-first-development.md +0 -205
  126. package/registry/rules/successful-debugging-patterns.md +0 -491
  127. package/registry/rules/telemetry.md +0 -67
  128. package/registry/templates/bootstrap/ARCHITECTURE-TEMPLATE.md +0 -53
  129. package/registry/templates/bootstrap/CODE-QUALITY-REPORT-TEMPLATE.md +0 -37
  130. package/registry/templates/bootstrap/TEST-COVERAGE-REPORT-TEMPLATE.md +0 -35
  131. package/registry/templates/business-development/IDEATION-REPORT-TEMPLATE.md +0 -29
  132. package/registry/templates/business-development/PRICING-STRATEGY-TEMPLATE.md +0 -126
  133. package/registry/templates/customer-development/customer-interview-template.md +0 -99
  134. package/registry/templates/customer-development/follow-up-email-templates.md +0 -132
  135. package/registry/templates/customer-development/insight-analysis-template.md +0 -74
  136. package/registry/templates/customer-development/strategic-recommendations-template.md +0 -53
  137. package/registry/templates/customer-development/thank-you-email-template.html +0 -124
  138. package/registry/templates/customer-development/thank-you-note-template.md +0 -16
  139. package/registry/templates/customer-development/triage-log-template.md +0 -278
  140. package/registry/templates/customer-development/weekly-newsletter-template.html +0 -204
  141. package/registry/templates/evidence/Design-Evidence.md +0 -30
  142. package/registry/templates/evidence/Implementation-BugEvidence.md +0 -86
  143. package/registry/templates/evidence/Implementation-FeatureEvidence.md +0 -121
  144. package/registry/templates/evidence/Spec-Evidence.md +0 -19
  145. package/registry/templates/help/HelpNeeded.md +0 -14
  146. package/registry/templates/marketing/HBR-ARTICLE-TEMPLATE.md +0 -66
  147. package/registry/templates/replicate/implementation-checklist.md +0 -39
  148. package/registry/templates/replicate/use-cases-template.md +0 -88
  149. package/registry/templates/retrospective/RETROSPECTIVE-TEMPLATE.md +0 -55
  150. package/registry/templates/specs/BUGSPEC-TEMPLATE.md +0 -37
  151. package/registry/templates/specs/FEATURESPEC-TEMPLATE.md +0 -29
  152. package/registry/templates/specs/TECHSPEC-TEMPLATE.md +0 -39
  153. package/registry/workflows/bootstrap/create-architecture.md +0 -38
  154. package/registry/workflows/bootstrap/evaluate-code-quality.md +0 -36
  155. package/registry/workflows/bootstrap/verify-test-coverage.md +0 -37
  156. package/registry/workflows/business-development/create-business-plan.md +0 -737
  157. package/registry/workflows/business-development/ideate-business-opportunity.md +0 -55
  158. package/registry/workflows/business-development/price-product.md +0 -325
  159. package/registry/workflows/convert-to-pdf.md +0 -235
  160. package/registry/workflows/customer-development/insight-analysis.md +0 -156
  161. package/registry/workflows/customer-development/insight-triage.md +0 -933
  162. package/registry/workflows/customer-development/interview-preparation.md +0 -421
  163. package/registry/workflows/customer-development/linkedin-outreach.md +0 -593
  164. package/registry/workflows/customer-development/strategic-brainstorming.md +0 -146
  165. package/registry/workflows/customer-development/thank-customers.md +0 -203
  166. package/registry/workflows/customer-development/weekly-newsletter.md +0 -366
  167. package/registry/workflows/deploy/cloud-deployment.md +0 -310
  168. package/registry/workflows/improve-fraim/contribute.md +0 -32
  169. package/registry/workflows/improve-fraim/file-issue.md +0 -32
  170. package/registry/workflows/marketing/content-creation.md +0 -37
  171. package/registry/workflows/marketing/hbr-article.md +0 -73
  172. package/registry/workflows/marketing/launch-checklist.md +0 -37
  173. package/registry/workflows/marketing/marketing-strategy.md +0 -45
  174. package/registry/workflows/performance/analyze-performance.md +0 -65
  175. package/registry/workflows/product-building/design.md +0 -130
  176. package/registry/workflows/product-building/implement.md +0 -315
  177. package/registry/workflows/product-building/iterate-on-pr-comments.md +0 -70
  178. package/registry/workflows/product-building/prep-issue.md +0 -43
  179. package/registry/workflows/product-building/prototype.md +0 -60
  180. package/registry/workflows/product-building/resolve.md +0 -164
  181. package/registry/workflows/product-building/retrospect.md +0 -86
  182. package/registry/workflows/product-building/spec.md +0 -117
  183. package/registry/workflows/product-building/test.md +0 -120
  184. package/registry/workflows/quality-assurance/browser-validation.md +0 -221
  185. package/registry/workflows/quality-assurance/iterative-improvement-cycle.md +0 -562
  186. package/registry/workflows/replicate/replicate-discovery.md +0 -336
  187. package/registry/workflows/replicate/replicate-to-issues.md +0 -319
  188. package/registry/workflows/reviewer/review-implementation-vs-design-spec.md +0 -632
  189. package/registry/workflows/reviewer/review-implementation-vs-feature-spec.md +0 -669
  190. package/registry/workflows/startup-credits/aws-activate-application.md +0 -535
  191. package/registry/workflows/startup-credits/google-cloud-application.md +0 -647
  192. package/registry/workflows/startup-credits/microsoft-azure-application.md +0 -538
@@ -0,0 +1,254 @@
1
+ "use strict";
2
+ /**
3
+ * Integration test to verify fraim-framework installs correctly
4
+ * and doesn't have the chalk ESM issue
5
+ *
6
+ * This test:
7
+ * 1. Packs the current fraim-framework into a tarball
8
+ * 2. Installs it fresh in a temp directory
9
+ * 3. Runs fraim init to verify it works
10
+ * 4. Tests with both pinned (4.1.2) and unpinned (^4.1.2) chalk versions
11
+ */
12
+ var __importDefault = (this && this.__importDefault) || function (mod) {
13
+ return (mod && mod.__esModule) ? mod : { "default": mod };
14
+ };
15
+ Object.defineProperty(exports, "__esModule", { value: true });
16
+ const node_child_process_1 = require("node:child_process");
17
+ const test_utils_1 = require("./test-utils");
18
+ const fs_1 = __importDefault(require("fs"));
19
+ const path_1 = __importDefault(require("path"));
20
+ const os_1 = __importDefault(require("os"));
21
+ async function runCommand(command, args, cwd) {
22
+ return new Promise((resolve) => {
23
+ const proc = (0, node_child_process_1.spawn)(command, args, {
24
+ cwd,
25
+ stdio: 'pipe',
26
+ shell: true
27
+ });
28
+ let stdout = '';
29
+ let stderr = '';
30
+ proc.stdout?.on('data', (data) => {
31
+ stdout += data.toString();
32
+ });
33
+ proc.stderr?.on('data', (data) => {
34
+ stderr += data.toString();
35
+ });
36
+ proc.on('close', (code) => {
37
+ resolve({ code, stdout, stderr });
38
+ });
39
+ });
40
+ }
41
+ async function testFraimInstallWithPinnedChalk() {
42
+ console.log(' 🧪 Testing FRAIM install with PINNED chalk (4.1.2)...');
43
+ const tempDir = fs_1.default.mkdtempSync(path_1.default.join(os_1.default.tmpdir(), 'fraim-install-pinned-'));
44
+ console.log(` 📂 Created temp dir: ${tempDir}`);
45
+ try {
46
+ // 1. Pack the current fraim-framework
47
+ console.log(' 📦 Packing fraim-framework...');
48
+ const projectRoot = process.cwd();
49
+ // Run npm pack in the project root
50
+ const packResult = (0, node_child_process_1.execSync)('npm pack', {
51
+ cwd: projectRoot,
52
+ encoding: 'utf-8'
53
+ });
54
+ const tarballName = packResult.trim().split('\n').pop()?.trim();
55
+ if (!tarballName) {
56
+ console.log(' ❌ Failed to get tarball name');
57
+ return false;
58
+ }
59
+ const tarballPath = path_1.default.join(projectRoot, tarballName);
60
+ console.log(` ✅ Created tarball: ${tarballName}`);
61
+ // 2. Create a test project
62
+ const testPackageJson = {
63
+ name: 'fraim-install-test',
64
+ version: '1.0.0',
65
+ private: true
66
+ };
67
+ fs_1.default.writeFileSync(path_1.default.join(tempDir, 'package.json'), JSON.stringify(testPackageJson, null, 2));
68
+ // 3. Install fraim-framework from the tarball
69
+ console.log(' 📥 Installing fraim-framework from tarball...');
70
+ const installResult = await runCommand('npm', ['install', tarballPath, '--silent'], tempDir);
71
+ if (installResult.code !== 0) {
72
+ console.log(' ❌ npm install failed');
73
+ console.log(` stderr: ${installResult.stderr.substring(0, 500)}`);
74
+ return false;
75
+ }
76
+ console.log(' ✅ fraim-framework installed successfully');
77
+ // 4. Check which version of chalk was installed
78
+ const chalkPackageJsonPath = path_1.default.join(tempDir, 'node_modules', 'chalk', 'package.json');
79
+ if (!fs_1.default.existsSync(chalkPackageJsonPath)) {
80
+ console.log(' ❌ chalk not found in node_modules');
81
+ return false;
82
+ }
83
+ const chalkPackageJson = JSON.parse(fs_1.default.readFileSync(chalkPackageJsonPath, 'utf-8'));
84
+ console.log(` 📋 Installed chalk version: ${chalkPackageJson.version}`);
85
+ // Verify it's v4.x
86
+ if (!chalkPackageJson.version.startsWith('4.')) {
87
+ console.log(` ❌ Expected chalk v4.x, got ${chalkPackageJson.version}`);
88
+ return false;
89
+ }
90
+ console.log(' ✅ Chalk v4 installed correctly');
91
+ // 5. Try to run fraim init (should work)
92
+ console.log(' 🚀 Running fraim init...');
93
+ const fraimBin = path_1.default.join(tempDir, 'node_modules', '.bin', 'fraim');
94
+ // Create a simple test by requiring the CLI directly
95
+ const testScript = `
96
+ const fraimCli = require('./node_modules/fraim-framework/dist/src/cli/fraim.js');
97
+ console.log('✅ fraim CLI loaded successfully');
98
+ `;
99
+ fs_1.default.writeFileSync(path_1.default.join(tempDir, 'test.js'), testScript);
100
+ const testResult = await runCommand('node', ['test.js'], tempDir);
101
+ if (testResult.code !== 0) {
102
+ console.log(' ❌ Failed to load fraim CLI');
103
+ console.log(` stderr: ${testResult.stderr.substring(0, 500)}`);
104
+ return false;
105
+ }
106
+ if (!testResult.stdout.includes('fraim CLI loaded successfully')) {
107
+ console.log(' ❌ fraim CLI did not load correctly');
108
+ return false;
109
+ }
110
+ console.log(' ✅ fraim CLI works with pinned chalk!');
111
+ // Cleanup tarball
112
+ fs_1.default.unlinkSync(tarballPath);
113
+ return true;
114
+ }
115
+ catch (error) {
116
+ console.error(' ❌ Test failed with error:', error);
117
+ return false;
118
+ }
119
+ finally {
120
+ // Cleanup
121
+ try {
122
+ fs_1.default.rmSync(tempDir, { recursive: true, force: true });
123
+ console.log(' 🧹 Cleaned up temp directory');
124
+ }
125
+ catch (e) {
126
+ console.log(' ⚠️ Could not clean up temp directory');
127
+ }
128
+ }
129
+ }
130
+ async function testFraimInstallWithUnpinnedChalk() {
131
+ console.log(' 🧪 Testing FRAIM install with UNPINNED chalk (^4.1.2)...');
132
+ console.log(' ⚠️ This simulates the original issue...');
133
+ const tempDir = fs_1.default.mkdtempSync(path_1.default.join(os_1.default.tmpdir(), 'fraim-install-unpinned-'));
134
+ console.log(` 📂 Created temp dir: ${tempDir}`);
135
+ try {
136
+ // 1. Temporarily modify package.json to use ^4.1.2
137
+ const projectRoot = process.cwd();
138
+ const packageJsonPath = path_1.default.join(projectRoot, 'package.json');
139
+ const originalPackageJson = fs_1.default.readFileSync(packageJsonPath, 'utf-8');
140
+ const packageJson = JSON.parse(originalPackageJson);
141
+ // Save original chalk version
142
+ const originalChalkVersion = packageJson.dependencies.chalk;
143
+ console.log(` 📋 Original chalk version: ${originalChalkVersion}`);
144
+ // Temporarily change to ^4.1.2
145
+ packageJson.dependencies.chalk = '^4.1.2';
146
+ fs_1.default.writeFileSync(packageJsonPath, JSON.stringify(packageJson, null, 2));
147
+ console.log(' 🔄 Temporarily changed chalk to ^4.1.2');
148
+ // 2. Pack with unpinned version
149
+ console.log(' 📦 Packing fraim-framework with unpinned chalk...');
150
+ const packResult = (0, node_child_process_1.execSync)('npm pack', {
151
+ cwd: projectRoot,
152
+ encoding: 'utf-8'
153
+ });
154
+ const tarballName = packResult.trim().split('\n').pop()?.trim();
155
+ if (!tarballName) {
156
+ console.log(' ❌ Failed to get tarball name');
157
+ // Restore original package.json
158
+ fs_1.default.writeFileSync(packageJsonPath, originalPackageJson);
159
+ return false;
160
+ }
161
+ const tarballPath = path_1.default.join(projectRoot, tarballName);
162
+ console.log(` ✅ Created tarball: ${tarballName}`);
163
+ // 3. Restore original package.json
164
+ fs_1.default.writeFileSync(packageJsonPath, originalPackageJson);
165
+ console.log(' ✅ Restored original package.json');
166
+ // 4. Create a test project
167
+ const testPackageJson = {
168
+ name: 'fraim-install-test-unpinned',
169
+ version: '1.0.0',
170
+ private: true
171
+ };
172
+ fs_1.default.writeFileSync(path_1.default.join(tempDir, 'package.json'), JSON.stringify(testPackageJson, null, 2));
173
+ // 5. Install fraim-framework from the tarball
174
+ console.log(' 📥 Installing fraim-framework with unpinned chalk...');
175
+ const installResult = await runCommand('npm', ['install', tarballPath, '--silent'], tempDir);
176
+ if (installResult.code !== 0) {
177
+ console.log(' ❌ npm install failed');
178
+ console.log(` stderr: ${installResult.stderr.substring(0, 500)}`);
179
+ fs_1.default.unlinkSync(tarballPath);
180
+ return false;
181
+ }
182
+ console.log(' ✅ fraim-framework installed');
183
+ // 6. Check which version of chalk was installed
184
+ const chalkPackageJsonPath = path_1.default.join(tempDir, 'node_modules', 'chalk', 'package.json');
185
+ if (!fs_1.default.existsSync(chalkPackageJsonPath)) {
186
+ console.log(' ❌ chalk not found in node_modules');
187
+ fs_1.default.unlinkSync(tarballPath);
188
+ return false;
189
+ }
190
+ const chalkPackageJson = JSON.parse(fs_1.default.readFileSync(chalkPackageJsonPath, 'utf-8'));
191
+ console.log(` 📋 Installed chalk version: ${chalkPackageJson.version}`);
192
+ // 7. Try to load fraim CLI
193
+ const testScript = `
194
+ const fraimCli = require('./node_modules/fraim-framework/dist/src/cli/fraim.js');
195
+ console.log('✅ fraim CLI loaded successfully');
196
+ `;
197
+ fs_1.default.writeFileSync(path_1.default.join(tempDir, 'test.js'), testScript);
198
+ const testResult = await runCommand('node', ['test.js'], tempDir);
199
+ // With ^4.1.2, it MIGHT install v5 in some scenarios, causing ERR_REQUIRE_ESM
200
+ if (testResult.code !== 0) {
201
+ if (testResult.stderr.includes('ERR_REQUIRE_ESM')) {
202
+ console.log(' ⚠️ Got ERR_REQUIRE_ESM error (this is the bug we fixed!)');
203
+ console.log(` 📋 Chalk version that caused issue: ${chalkPackageJson.version}`);
204
+ console.log(' ✅ Test successfully reproduced the original issue');
205
+ fs_1.default.unlinkSync(tarballPath);
206
+ return true; // This is expected - we reproduced the bug
207
+ }
208
+ else {
209
+ console.log(' ❌ Failed with unexpected error');
210
+ console.log(` stderr: ${testResult.stderr.substring(0, 500)}`);
211
+ fs_1.default.unlinkSync(tarballPath);
212
+ return false;
213
+ }
214
+ }
215
+ // If it worked, that's also fine - means npm resolved to v4
216
+ console.log(' ✅ fraim CLI works (npm resolved to v4)');
217
+ console.log(' ℹ️ Note: ^4.1.2 worked this time, but could fail in other environments');
218
+ // Cleanup tarball
219
+ fs_1.default.unlinkSync(tarballPath);
220
+ return true;
221
+ }
222
+ catch (error) {
223
+ console.error(' ❌ Test failed with error:', error);
224
+ return false;
225
+ }
226
+ finally {
227
+ // Cleanup
228
+ try {
229
+ fs_1.default.rmSync(tempDir, { recursive: true, force: true });
230
+ console.log(' 🧹 Cleaned up temp directory');
231
+ }
232
+ catch (e) {
233
+ console.log(' ⚠️ Could not clean up temp directory');
234
+ }
235
+ }
236
+ }
237
+ async function runFraimInstallTest(testCase) {
238
+ return await testCase.testFunction();
239
+ }
240
+ const testCases = [
241
+ {
242
+ name: 'FRAIM Install with Pinned Chalk',
243
+ description: 'Verifies fraim-framework installs correctly with chalk pinned to 4.1.2',
244
+ testFunction: testFraimInstallWithPinnedChalk,
245
+ tags: ['integration', 'install', 'chalk']
246
+ },
247
+ {
248
+ name: 'FRAIM Install with Unpinned Chalk',
249
+ description: 'Tests fraim-framework with ^4.1.2 to see if it can reproduce the issue',
250
+ testFunction: testFraimInstallWithUnpinnedChalk,
251
+ tags: ['integration', 'install', 'chalk', 'reproduction']
252
+ }
253
+ ];
254
+ (0, test_utils_1.runTests)(testCases, runFraimInstallTest, 'FRAIM Install Chalk Issue Test');
@@ -0,0 +1,46 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const node_test_1 = require("node:test");
7
+ const node_assert_1 = __importDefault(require("node:assert"));
8
+ const ide_detector_1 = require("../src/cli/setup/ide-detector");
9
+ const path_1 = __importDefault(require("path"));
10
+ const os_1 = __importDefault(require("os"));
11
+ (0, node_test_1.test)('expandPath should expand tilde to home directory', () => {
12
+ const result = (0, ide_detector_1.expandPath)('~/.fraim/config.json');
13
+ const expected = path_1.default.join(os_1.default.homedir(), '.fraim/config.json');
14
+ node_assert_1.default.strictEqual(result, expected);
15
+ });
16
+ (0, node_test_1.test)('expandPath should return absolute paths unchanged', () => {
17
+ const absolutePath = '/usr/local/bin/fraim';
18
+ const result = (0, ide_detector_1.expandPath)(absolutePath);
19
+ node_assert_1.default.strictEqual(result, absolutePath);
20
+ });
21
+ (0, node_test_1.test)('IDE_CONFIGS should contain all expected IDEs', () => {
22
+ const expectedIDEs = ['Claude Desktop', 'Antigravity', 'Kiro', 'Cursor', 'VSCode', 'Codex', 'Windsurf'];
23
+ const actualIDEs = ide_detector_1.IDE_CONFIGS.map(ide => ide.name);
24
+ expectedIDEs.forEach(expectedIDE => {
25
+ (0, node_assert_1.default)(actualIDEs.includes(expectedIDE), `Missing IDE: ${expectedIDE}`);
26
+ });
27
+ });
28
+ (0, node_test_1.test)('IDE_CONFIGS should have valid config types', () => {
29
+ const validConfigTypes = ['standard', 'kiro', 'codex', 'windsurf'];
30
+ ide_detector_1.IDE_CONFIGS.forEach(ide => {
31
+ (0, node_assert_1.default)(validConfigTypes.includes(ide.configType), `Invalid config type for ${ide.name}: ${ide.configType}`);
32
+ });
33
+ });
34
+ (0, node_test_1.test)('IDE_CONFIGS should have valid config formats', () => {
35
+ const validFormats = ['json', 'toml'];
36
+ ide_detector_1.IDE_CONFIGS.forEach(ide => {
37
+ (0, node_assert_1.default)(validFormats.includes(ide.configFormat), `Invalid config format for ${ide.name}: ${ide.configFormat}`);
38
+ });
39
+ });
40
+ (0, node_test_1.test)('detectInstalledIDEs should return empty array when no IDEs installed', () => {
41
+ // This test assumes no IDEs are installed in the test environment
42
+ // In a real environment, this might return actual IDEs
43
+ const result = (0, ide_detector_1.detectInstalledIDEs)();
44
+ (0, node_assert_1.default)(Array.isArray(result), 'Should return an array');
45
+ // We can't assert the exact length since it depends on the test environment
46
+ });
@@ -0,0 +1,121 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const node_test_1 = require("node:test");
7
+ const node_assert_1 = __importDefault(require("node:assert"));
8
+ const fs_1 = __importDefault(require("fs"));
9
+ const path_1 = __importDefault(require("path"));
10
+ const os_1 = __importDefault(require("os"));
11
+ const ide_detector_1 = require("../src/cli/setup/ide-detector");
12
+ const mcp_config_generator_1 = require("../src/cli/setup/mcp-config-generator");
13
+ (0, node_test_1.describe)('Improved Setup System', () => {
14
+ (0, node_test_1.it)('should detect IDEs with improved detection methods', () => {
15
+ const detectedIDEs = (0, ide_detector_1.detectInstalledIDEs)();
16
+ const allIDEs = (0, ide_detector_1.getAllSupportedIDEs)();
17
+ // Should have all IDE configs defined
18
+ (0, node_assert_1.default)(allIDEs.length >= 7, 'Should have at least 7 IDE configurations');
19
+ // Each IDE should have required properties
20
+ allIDEs.forEach(ide => {
21
+ (0, node_assert_1.default)(ide.name, 'IDE should have a name');
22
+ (0, node_assert_1.default)(ide.configPath, 'IDE should have a config path');
23
+ (0, node_assert_1.default)(ide.configFormat, 'IDE should have a config format');
24
+ (0, node_assert_1.default)(ide.configType, 'IDE should have a config type');
25
+ (0, node_assert_1.default)(typeof ide.detectMethod === 'function', 'IDE should have a detect method');
26
+ });
27
+ console.log(`✅ Found ${detectedIDEs.length} installed IDEs out of ${allIDEs.length} supported`);
28
+ });
29
+ (0, node_test_1.it)('should find IDEs by name correctly', () => {
30
+ const claude = (0, ide_detector_1.findIDEByName)('claude');
31
+ const cursor = (0, ide_detector_1.findIDEByName)('cursor');
32
+ const vscode = (0, ide_detector_1.findIDEByName)('vscode');
33
+ (0, node_assert_1.default)(claude?.name === 'Claude Desktop', 'Should find Claude Desktop');
34
+ (0, node_assert_1.default)(cursor?.name === 'Cursor', 'Should find Cursor');
35
+ (0, node_assert_1.default)(vscode?.name === 'VSCode', 'Should find VSCode');
36
+ // Test partial matching
37
+ const claudePartial = (0, ide_detector_1.findIDEByName)('clau');
38
+ (0, node_assert_1.default)(claudePartial?.name === 'Claude Desktop', 'Should find Claude with partial name');
39
+ console.log('✅ IDE name matching works correctly');
40
+ });
41
+ (0, node_test_1.it)('should expand paths correctly across platforms', () => {
42
+ const homePath = (0, ide_detector_1.expandPath)('~/test');
43
+ const expectedPath = path_1.default.join(os_1.default.homedir(), 'test');
44
+ node_assert_1.default.strictEqual(homePath, expectedPath, 'Should expand tilde to home directory');
45
+ const absolutePath = (0, ide_detector_1.expandPath)('/absolute/path');
46
+ node_assert_1.default.strictEqual(absolutePath, '/absolute/path', 'Should leave absolute paths unchanged');
47
+ console.log('✅ Path expansion works correctly');
48
+ });
49
+ (0, node_test_1.it)('should generate intelligent MCP configs for all IDE types', () => {
50
+ const testKey = 'fraim_test123';
51
+ const testToken = 'ghp_test123';
52
+ // Test all config types
53
+ const standardConfig = (0, mcp_config_generator_1.generateMCPConfig)('standard', testKey, testToken);
54
+ const kiroConfig = (0, mcp_config_generator_1.generateMCPConfig)('kiro', testKey, testToken);
55
+ const codexConfig = (0, mcp_config_generator_1.generateMCPConfig)('codex', testKey, testToken);
56
+ const windsurfConfig = (0, mcp_config_generator_1.generateMCPConfig)('windsurf', testKey, testToken);
57
+ // Standard config should use serverUrl
58
+ if (typeof standardConfig === 'object') {
59
+ (0, node_assert_1.default)(standardConfig.mcpServers, 'Standard config should have mcpServers');
60
+ (0, node_assert_1.default)(standardConfig.mcpServers.fraim.serverUrl, 'Standard config should use serverUrl');
61
+ }
62
+ // Kiro config should use url
63
+ if (typeof kiroConfig === 'object') {
64
+ (0, node_assert_1.default)(kiroConfig.mcpServers, 'Kiro config should have mcpServers');
65
+ (0, node_assert_1.default)(kiroConfig.mcpServers.fraim.url, 'Kiro config should use url');
66
+ }
67
+ // Codex config should be TOML string
68
+ (0, node_assert_1.default)(typeof codexConfig === 'string', 'Codex config should be TOML string');
69
+ (0, node_assert_1.default)(codexConfig.includes('[mcp_servers.fraim]'), 'Codex config should have TOML sections');
70
+ // Windsurf config should use command/args pattern
71
+ if (typeof windsurfConfig === 'object') {
72
+ (0, node_assert_1.default)(windsurfConfig.mcpServers, 'Windsurf config should have mcpServers');
73
+ (0, node_assert_1.default)(windsurfConfig.mcpServers.fraim.command, 'Windsurf config should use command');
74
+ }
75
+ console.log('✅ All MCP config types generate correctly');
76
+ });
77
+ (0, node_test_1.it)('should handle config merging intelligently', () => {
78
+ const testKey = 'fraim_test123';
79
+ const testToken = 'ghp_test123';
80
+ // Simulate existing config
81
+ const existingConfig = {
82
+ mcpServers: {
83
+ existing: {
84
+ command: 'existing-command'
85
+ }
86
+ },
87
+ otherSettings: {
88
+ theme: 'dark'
89
+ }
90
+ };
91
+ const newConfig = (0, mcp_config_generator_1.generateMCPConfig)('kiro', testKey, testToken);
92
+ // Merge configs (simulating what happens in setup)
93
+ const mergedConfig = {
94
+ ...existingConfig,
95
+ ...newConfig,
96
+ mcpServers: {
97
+ ...existingConfig.mcpServers,
98
+ ...newConfig.mcpServers
99
+ }
100
+ };
101
+ // Should preserve existing servers
102
+ (0, node_assert_1.default)(mergedConfig.mcpServers.existing, 'Should preserve existing MCP servers');
103
+ (0, node_assert_1.default)(mergedConfig.mcpServers.fraim, 'Should add new FRAIM server');
104
+ (0, node_assert_1.default)(mergedConfig.otherSettings, 'Should preserve other settings');
105
+ console.log('✅ Config merging preserves existing settings');
106
+ });
107
+ (0, node_test_1.it)('should validate setup requirements', () => {
108
+ // Test that we can detect missing global setup
109
+ const globalConfigPath = path_1.default.join(os_1.default.homedir(), '.fraim', 'config.json');
110
+ const hasGlobalSetup = fs_1.default.existsSync(globalConfigPath);
111
+ // This is informational - setup may or may not exist
112
+ console.log(`ℹ️ Global setup ${hasGlobalSetup ? 'exists' : 'not found'}`);
113
+ // Test that we can create temp directories for testing
114
+ const tempDir = path_1.default.join(os_1.default.tmpdir(), 'fraim-test-' + Date.now());
115
+ fs_1.default.mkdirSync(tempDir, { recursive: true });
116
+ (0, node_assert_1.default)(fs_1.default.existsSync(tempDir), 'Should be able to create temp directories');
117
+ // Cleanup
118
+ fs_1.default.rmSync(tempDir, { recursive: true, force: true });
119
+ console.log('✅ Setup validation works correctly');
120
+ });
121
+ });
@@ -0,0 +1,70 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const node_test_1 = require("node:test");
7
+ const node_assert_1 = __importDefault(require("node:assert"));
8
+ const mcp_config_generator_1 = require("../src/cli/setup/mcp-config-generator");
9
+ const testFraimKey = 'fraim_test123456789';
10
+ const testGithubToken = 'ghp_test123456789';
11
+ (0, node_test_1.test)('generateStandardMCPServers should create correct config', () => {
12
+ const config = (0, mcp_config_generator_1.generateStandardMCPServers)(testFraimKey, testGithubToken);
13
+ (0, node_assert_1.default)(config.mcpServers, 'Should have mcpServers property');
14
+ (0, node_assert_1.default)(config.mcpServers.fraim, 'Should have fraim server');
15
+ (0, node_assert_1.default)(config.mcpServers.git, 'Should have git server');
16
+ (0, node_assert_1.default)(config.mcpServers.github, 'Should have github server');
17
+ (0, node_assert_1.default)(config.mcpServers.playwright, 'Should have playwright server');
18
+ // Check fraim server config
19
+ node_assert_1.default.strictEqual(config.mcpServers.fraim.serverUrl, 'https://fraim.wellnessatwork.me');
20
+ node_assert_1.default.strictEqual(config.mcpServers.fraim.headers['x-api-key'], testFraimKey);
21
+ // Check github server config
22
+ node_assert_1.default.strictEqual(config.mcpServers.github.serverUrl, 'https://api.githubcopilot.com/mcp/');
23
+ node_assert_1.default.strictEqual(config.mcpServers.github.headers.Authorization, `Bearer ${testGithubToken}`);
24
+ });
25
+ (0, node_test_1.test)('generateKiroMCPServers should create correct config', () => {
26
+ const config = (0, mcp_config_generator_1.generateKiroMCPServers)(testFraimKey, testGithubToken);
27
+ (0, node_assert_1.default)(config.mcpServers, 'Should have mcpServers property');
28
+ // Check that Kiro uses 'url' instead of 'serverUrl'
29
+ (0, node_assert_1.default)(config.mcpServers.fraim.url, 'Fraim should use url property');
30
+ (0, node_assert_1.default)(config.mcpServers.github.url, 'GitHub should use url property');
31
+ (0, node_assert_1.default)(!config.mcpServers.fraim.serverUrl, 'Fraim should not have serverUrl property');
32
+ (0, node_assert_1.default)(!config.mcpServers.github.serverUrl, 'GitHub should not have serverUrl property');
33
+ node_assert_1.default.strictEqual(config.mcpServers.fraim.url, 'https://fraim.wellnessatwork.me');
34
+ node_assert_1.default.strictEqual(config.mcpServers.github.url, 'https://api.githubcopilot.com/mcp/');
35
+ });
36
+ (0, node_test_1.test)('generateCodexMCPServers should create correct TOML config', () => {
37
+ const config = (0, mcp_config_generator_1.generateCodexMCPServers)(testFraimKey, testGithubToken);
38
+ (0, node_assert_1.default)(typeof config === 'string', 'Should return a string for TOML');
39
+ (0, node_assert_1.default)(config.includes('[mcp_servers.fraim]'), 'Should contain fraim server section');
40
+ (0, node_assert_1.default)(config.includes('[mcp_servers.git]'), 'Should contain git server section');
41
+ (0, node_assert_1.default)(config.includes('[mcp_servers.github]'), 'Should contain github server section');
42
+ (0, node_assert_1.default)(config.includes('[mcp_servers.playwright]'), 'Should contain playwright server section');
43
+ (0, node_assert_1.default)(config.includes(testFraimKey), 'Should contain the FRAIM key');
44
+ });
45
+ (0, node_test_1.test)('generateWindsurfMCPServers should create correct config', () => {
46
+ const config = (0, mcp_config_generator_1.generateWindsurfMCPServers)(testFraimKey, testGithubToken);
47
+ (0, node_assert_1.default)(config.mcpServers, 'Should have mcpServers property');
48
+ // Check that Windsurf uses command/args pattern
49
+ (0, node_assert_1.default)(config.mcpServers.fraim.command, 'Fraim should have command property');
50
+ (0, node_assert_1.default)(config.mcpServers.fraim.args, 'Fraim should have args property');
51
+ (0, node_assert_1.default)(config.mcpServers.fraim.env, 'Fraim should have env property');
52
+ node_assert_1.default.strictEqual(config.mcpServers.fraim.command, 'npx');
53
+ (0, node_assert_1.default)(config.mcpServers.fraim.args.includes('@modelcontextprotocol/server-fetch'), 'Should use fetch server');
54
+ node_assert_1.default.strictEqual(config.mcpServers.fraim.env.FRAIM_API_KEY, testFraimKey);
55
+ });
56
+ (0, node_test_1.test)('generateMCPConfig should route to correct generator', () => {
57
+ const standardConfig = (0, mcp_config_generator_1.generateMCPConfig)('standard', testFraimKey, testGithubToken);
58
+ const kiroConfig = (0, mcp_config_generator_1.generateMCPConfig)('kiro', testFraimKey, testGithubToken);
59
+ const codexConfig = (0, mcp_config_generator_1.generateMCPConfig)('codex', testFraimKey, testGithubToken);
60
+ const windsurfConfig = (0, mcp_config_generator_1.generateMCPConfig)('windsurf', testFraimKey, testGithubToken);
61
+ (0, node_assert_1.default)(standardConfig.mcpServers.fraim.serverUrl, 'Standard should use serverUrl');
62
+ (0, node_assert_1.default)(kiroConfig.mcpServers.fraim.url, 'Kiro should use url');
63
+ (0, node_assert_1.default)(typeof codexConfig === 'string', 'Codex should return TOML string');
64
+ (0, node_assert_1.default)(windsurfConfig.mcpServers.fraim.command, 'Windsurf should use command');
65
+ });
66
+ (0, node_test_1.test)('generateMCPConfig should throw for invalid config type', () => {
67
+ node_assert_1.default.throws(() => {
68
+ (0, mcp_config_generator_1.generateMCPConfig)('invalid', testFraimKey, testGithubToken);
69
+ }, /Unsupported config type/);
70
+ });