fraim-framework 2.0.26 โ 2.0.30
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.
- package/.github/workflows/deploy-fraim.yml +1 -1
- package/dist/registry/scripts/build-scripts-generator.js +205 -0
- package/dist/registry/scripts/cleanup-branch.js +258 -0
- package/dist/registry/scripts/evaluate-code-quality.js +66 -0
- package/dist/registry/scripts/exec-with-timeout.js +142 -0
- package/dist/registry/scripts/fraim-config.js +61 -0
- package/dist/registry/scripts/generate-engagement-emails.js +630 -0
- package/dist/registry/scripts/generic-issues-api.js +100 -0
- package/dist/registry/scripts/newsletter-helpers.js +731 -0
- package/dist/registry/scripts/openapi-generator.js +664 -0
- package/dist/registry/scripts/performance/profile-server.js +390 -0
- package/dist/registry/scripts/run-thank-you-workflow.js +92 -0
- package/dist/registry/scripts/send-newsletter-simple.js +85 -0
- package/dist/registry/scripts/send-thank-you-emails.js +54 -0
- package/dist/registry/scripts/validate-openapi-limits.js +311 -0
- package/dist/registry/scripts/validate-test-coverage.js +262 -0
- package/dist/registry/scripts/verify-test-coverage.js +66 -0
- package/dist/src/cli/commands/init.js +14 -12
- package/dist/src/cli/commands/sync.js +19 -2
- package/dist/src/cli/fraim.js +24 -22
- package/dist/src/cli/setup/first-run.js +13 -6
- package/dist/src/fraim/config-loader.js +0 -8
- package/dist/src/fraim/db-service.js +26 -15
- package/dist/src/fraim/issues.js +67 -0
- package/dist/src/fraim/setup-wizard.js +1 -69
- package/dist/src/fraim/types.js +0 -11
- package/dist/src/fraim-mcp-server.js +272 -18
- package/dist/src/utils/git-utils.js +1 -1
- package/dist/src/utils/version-utils.js +32 -0
- package/dist/tests/debug-tools.js +79 -0
- package/dist/tests/esm-compat.js +11 -0
- package/dist/tests/test-chalk-esm-issue.js +159 -0
- package/dist/tests/test-chalk-real-world.js +265 -0
- package/dist/tests/test-chalk-regression.js +327 -0
- package/dist/tests/test-chalk-resolution-issue.js +304 -0
- package/dist/tests/test-cli.js +0 -2
- package/dist/tests/test-fraim-install-chalk-issue.js +254 -0
- package/dist/tests/test-fraim-issues.js +59 -0
- package/dist/tests/test-genericization.js +1 -3
- package/dist/tests/test-mcp-connection.js +166 -0
- package/dist/tests/test-mcp-issue-integration.js +144 -0
- package/dist/tests/test-mcp-lifecycle-methods.js +312 -0
- package/dist/tests/test-node-compatibility.js +71 -0
- package/dist/tests/test-npm-install.js +66 -0
- package/dist/tests/test-npm-resolution-diagnostic.js +140 -0
- package/dist/tests/test-session-rehydration.js +145 -0
- package/dist/tests/test-standalone.js +2 -8
- package/dist/tests/test-sync-version-update.js +93 -0
- package/dist/tests/test-telemetry.js +190 -0
- package/package.json +10 -8
- package/registry/agent-guardrails.md +62 -54
- package/registry/rules/agent-success-criteria.md +52 -0
- package/registry/rules/agent-testing-guidelines.md +502 -502
- package/registry/rules/communication.md +121 -121
- package/registry/rules/continuous-learning.md +54 -54
- package/registry/rules/ephemeral-execution.md +10 -5
- package/registry/rules/hitl-ppe-record-analysis.md +302 -302
- package/registry/rules/local-development.md +251 -251
- package/registry/rules/software-development-lifecycle.md +104 -104
- package/registry/rules/successful-debugging-patterns.md +482 -478
- package/registry/rules/telemetry.md +67 -0
- package/registry/scripts/build-scripts-generator.ts +216 -215
- package/registry/scripts/cleanup-branch.ts +303 -284
- package/registry/scripts/code-quality-check.sh +559 -559
- package/registry/scripts/detect-tautological-tests.sh +38 -38
- package/registry/scripts/evaluate-code-quality.ts +1 -1
- package/registry/scripts/generate-engagement-emails.ts +744 -744
- package/registry/scripts/generic-issues-api.ts +110 -150
- package/registry/scripts/newsletter-helpers.ts +874 -874
- package/registry/scripts/openapi-generator.ts +695 -693
- package/registry/scripts/performance/profile-server.ts +5 -3
- package/registry/scripts/prep-issue.sh +468 -455
- package/registry/scripts/validate-openapi-limits.ts +366 -365
- package/registry/scripts/validate-test-coverage.ts +280 -280
- package/registry/scripts/verify-pr-comments.sh +70 -70
- package/registry/scripts/verify-test-coverage.ts +1 -1
- package/registry/templates/bootstrap/ARCHITECTURE-TEMPLATE.md +53 -53
- package/registry/templates/evidence/Implementation-BugEvidence.md +85 -85
- package/registry/templates/evidence/Implementation-FeatureEvidence.md +120 -120
- package/registry/templates/marketing/HBR-ARTICLE-TEMPLATE.md +66 -0
- package/registry/workflows/bootstrap/create-architecture.md +2 -2
- package/registry/workflows/bootstrap/evaluate-code-quality.md +3 -3
- package/registry/workflows/bootstrap/verify-test-coverage.md +2 -2
- package/registry/workflows/customer-development/insight-analysis.md +156 -156
- package/registry/workflows/customer-development/interview-preparation.md +421 -421
- package/registry/workflows/customer-development/strategic-brainstorming.md +146 -146
- package/registry/workflows/customer-development/thank-customers.md +193 -191
- package/registry/workflows/customer-development/weekly-newsletter.md +362 -352
- package/registry/workflows/improve-fraim/contribute.md +32 -0
- package/registry/workflows/improve-fraim/file-issue.md +32 -0
- package/registry/workflows/marketing/hbr-article.md +73 -0
- package/registry/workflows/performance/analyze-performance.md +63 -59
- package/registry/workflows/product-building/design.md +3 -2
- package/registry/workflows/product-building/implement.md +4 -3
- package/registry/workflows/product-building/prep-issue.md +28 -17
- package/registry/workflows/product-building/resolve.md +3 -2
- package/registry/workflows/product-building/retrospect.md +3 -2
- package/registry/workflows/product-building/spec.md +5 -4
- package/registry/workflows/product-building/test.md +3 -2
- package/registry/workflows/quality-assurance/iterative-improvement-cycle.md +562 -562
- package/registry/workflows/replicate/website-discovery-analysis.md +3 -3
- package/registry/workflows/reviewer/review-implementation-vs-design-spec.md +632 -632
- package/registry/workflows/reviewer/review-implementation-vs-feature-spec.md +669 -669
- package/tsconfig.json +2 -1
|
@@ -0,0 +1,304 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Test to reproduce and verify the fix for the chalk v5 resolution issue
|
|
4
|
+
*
|
|
5
|
+
* This test creates a scenario where npm might resolve chalk to v5 by:
|
|
6
|
+
* 1. Creating a dependency that requires chalk v5
|
|
7
|
+
* 2. Testing if fraim-framework with ^4.1.2 gets upgraded
|
|
8
|
+
* 3. Testing if fraim-framework with 4.1.2 (pinned) stays at v4
|
|
9
|
+
*/
|
|
10
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
11
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
12
|
+
};
|
|
13
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
+
const node_child_process_1 = require("node:child_process");
|
|
15
|
+
const test_utils_1 = require("./test-utils");
|
|
16
|
+
const fs_1 = __importDefault(require("fs"));
|
|
17
|
+
const path_1 = __importDefault(require("path"));
|
|
18
|
+
const os_1 = __importDefault(require("os"));
|
|
19
|
+
async function runCommand(command, args, cwd) {
|
|
20
|
+
return new Promise((resolve) => {
|
|
21
|
+
const proc = (0, node_child_process_1.spawn)(command, args, {
|
|
22
|
+
cwd,
|
|
23
|
+
stdio: 'pipe',
|
|
24
|
+
shell: true
|
|
25
|
+
});
|
|
26
|
+
let stdout = '';
|
|
27
|
+
let stderr = '';
|
|
28
|
+
proc.stdout?.on('data', (data) => {
|
|
29
|
+
stdout += data.toString();
|
|
30
|
+
});
|
|
31
|
+
proc.stderr?.on('data', (data) => {
|
|
32
|
+
stderr += data.toString();
|
|
33
|
+
});
|
|
34
|
+
proc.on('close', (code) => {
|
|
35
|
+
resolve({ code, stdout, stderr });
|
|
36
|
+
});
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
async function testChalkResolutionWithConflict() {
|
|
40
|
+
console.log(' ๐งช Testing chalk resolution with conflicting dependency...');
|
|
41
|
+
const tempDir = fs_1.default.mkdtempSync(path_1.default.join(os_1.default.tmpdir(), 'chalk-conflict-'));
|
|
42
|
+
console.log(` ๐ Created temp dir: ${tempDir}`);
|
|
43
|
+
try {
|
|
44
|
+
// 1. Create a package that depends on chalk v5
|
|
45
|
+
console.log(' ๐ฆ Creating fake package that requires chalk v5...');
|
|
46
|
+
const fakePackageDir = path_1.default.join(tempDir, 'fake-chalk5-package');
|
|
47
|
+
fs_1.default.mkdirSync(fakePackageDir, { recursive: true });
|
|
48
|
+
const fakePackageJson = {
|
|
49
|
+
name: 'fake-chalk5-package',
|
|
50
|
+
version: '1.0.0',
|
|
51
|
+
dependencies: {
|
|
52
|
+
'chalk': '^5.0.0'
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
fs_1.default.writeFileSync(path_1.default.join(fakePackageDir, 'package.json'), JSON.stringify(fakePackageJson, null, 2));
|
|
56
|
+
// Create a simple index.js that uses chalk
|
|
57
|
+
fs_1.default.writeFileSync(path_1.default.join(fakePackageDir, 'index.js'), 'export { default as chalk } from "chalk";\n');
|
|
58
|
+
// 2. Pack fraim-framework with ^4.1.2 (unpinned)
|
|
59
|
+
console.log(' ๐ฆ Packing fraim-framework with ^4.1.2...');
|
|
60
|
+
const projectRoot = process.cwd();
|
|
61
|
+
const packageJsonPath = path_1.default.join(projectRoot, 'package.json');
|
|
62
|
+
const originalPackageJson = fs_1.default.readFileSync(packageJsonPath, 'utf-8');
|
|
63
|
+
const packageJson = JSON.parse(originalPackageJson);
|
|
64
|
+
// Temporarily change to ^4.1.2
|
|
65
|
+
packageJson.dependencies.chalk = '^4.1.2';
|
|
66
|
+
fs_1.default.writeFileSync(packageJsonPath, JSON.stringify(packageJson, null, 2));
|
|
67
|
+
const packResult = (0, node_child_process_1.execSync)('npm pack', {
|
|
68
|
+
cwd: projectRoot,
|
|
69
|
+
encoding: 'utf-8'
|
|
70
|
+
});
|
|
71
|
+
const tarballName = packResult.trim().split('\n').pop()?.trim();
|
|
72
|
+
if (!tarballName) {
|
|
73
|
+
fs_1.default.writeFileSync(packageJsonPath, originalPackageJson);
|
|
74
|
+
return false;
|
|
75
|
+
}
|
|
76
|
+
const tarballPath = path_1.default.join(projectRoot, tarballName);
|
|
77
|
+
// Restore original package.json
|
|
78
|
+
fs_1.default.writeFileSync(packageJsonPath, originalPackageJson);
|
|
79
|
+
// 3. Create test project that depends on BOTH packages
|
|
80
|
+
console.log(' ๐ง Creating test project with conflicting dependencies...');
|
|
81
|
+
const testPackageJson = {
|
|
82
|
+
name: 'chalk-conflict-test',
|
|
83
|
+
version: '1.0.0',
|
|
84
|
+
dependencies: {
|
|
85
|
+
'fake-chalk5-package': 'file:./fake-chalk5-package',
|
|
86
|
+
'fraim-framework': `file:${tarballPath}`
|
|
87
|
+
}
|
|
88
|
+
};
|
|
89
|
+
fs_1.default.writeFileSync(path_1.default.join(tempDir, 'package.json'), JSON.stringify(testPackageJson, null, 2));
|
|
90
|
+
// 4. Install dependencies - npm will try to resolve chalk
|
|
91
|
+
console.log(' ๐ฅ Installing with conflicting chalk requirements...');
|
|
92
|
+
console.log(' โ ๏ธ fake-chalk5-package wants chalk ^5.0.0');
|
|
93
|
+
console.log(' โ ๏ธ fraim-framework wants chalk ^4.1.2');
|
|
94
|
+
const installResult = await runCommand('npm', ['install'], tempDir);
|
|
95
|
+
if (installResult.code !== 0) {
|
|
96
|
+
console.log(' โ ๏ธ npm install failed (might be expected)');
|
|
97
|
+
console.log(` stderr: ${installResult.stderr.substring(0, 300)}`);
|
|
98
|
+
}
|
|
99
|
+
// 5. Check what version of chalk was installed for fraim-framework
|
|
100
|
+
const fraimChalkPath = path_1.default.join(tempDir, 'node_modules', 'fraim-framework', 'node_modules', 'chalk', 'package.json');
|
|
101
|
+
const rootChalkPath = path_1.default.join(tempDir, 'node_modules', 'chalk', 'package.json');
|
|
102
|
+
let fraimChalkVersion = null;
|
|
103
|
+
let rootChalkVersion = null;
|
|
104
|
+
if (fs_1.default.existsSync(fraimChalkPath)) {
|
|
105
|
+
const chalkPkg = JSON.parse(fs_1.default.readFileSync(fraimChalkPath, 'utf-8'));
|
|
106
|
+
fraimChalkVersion = chalkPkg.version;
|
|
107
|
+
console.log(` ๐ fraim-framework's chalk: ${fraimChalkVersion}`);
|
|
108
|
+
}
|
|
109
|
+
if (fs_1.default.existsSync(rootChalkPath)) {
|
|
110
|
+
const chalkPkg = JSON.parse(fs_1.default.readFileSync(rootChalkPath, 'utf-8'));
|
|
111
|
+
rootChalkVersion = chalkPkg.version;
|
|
112
|
+
console.log(` ๐ Root chalk: ${rootChalkVersion}`);
|
|
113
|
+
}
|
|
114
|
+
// 6. Try to load fraim CLI
|
|
115
|
+
console.log(' ๐ Testing if fraim CLI loads...');
|
|
116
|
+
const testScript = `
|
|
117
|
+
try {
|
|
118
|
+
const fraimCli = require('./node_modules/fraim-framework/dist/src/cli/fraim.js');
|
|
119
|
+
console.log('SUCCESS: fraim CLI loaded');
|
|
120
|
+
process.exit(0);
|
|
121
|
+
} catch (error) {
|
|
122
|
+
if (error.code === 'ERR_REQUIRE_ESM') {
|
|
123
|
+
console.log('ERROR: ERR_REQUIRE_ESM - chalk v5 was used!');
|
|
124
|
+
console.log('Chalk version caused issue:', error.message);
|
|
125
|
+
process.exit(1);
|
|
126
|
+
} else {
|
|
127
|
+
console.log('ERROR: Other error:', error.message);
|
|
128
|
+
process.exit(2);
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
`;
|
|
132
|
+
fs_1.default.writeFileSync(path_1.default.join(tempDir, 'test.js'), testScript);
|
|
133
|
+
const testResult = await runCommand('node', ['test.js'], tempDir);
|
|
134
|
+
if (testResult.code === 1) {
|
|
135
|
+
console.log(' โ REPRODUCED THE BUG! npm resolved chalk to v5');
|
|
136
|
+
console.log(' โ fraim-framework with ^4.1.2 got chalk v5 due to conflict');
|
|
137
|
+
console.log(' โ
This proves the issue exists with ^4.1.2');
|
|
138
|
+
// Cleanup
|
|
139
|
+
fs_1.default.unlinkSync(tarballPath);
|
|
140
|
+
return true; // We successfully reproduced the bug!
|
|
141
|
+
}
|
|
142
|
+
else if (testResult.code === 0) {
|
|
143
|
+
console.log(' โน๏ธ fraim CLI loaded successfully');
|
|
144
|
+
console.log(' โน๏ธ npm resolved the conflict without upgrading to v5');
|
|
145
|
+
console.log(' โน๏ธ This scenario didn\'t trigger the bug, but it could in other environments');
|
|
146
|
+
}
|
|
147
|
+
else {
|
|
148
|
+
console.log(' โ ๏ธ Got unexpected error');
|
|
149
|
+
console.log(` stdout: ${testResult.stdout}`);
|
|
150
|
+
}
|
|
151
|
+
// Cleanup
|
|
152
|
+
fs_1.default.unlinkSync(tarballPath);
|
|
153
|
+
return true;
|
|
154
|
+
}
|
|
155
|
+
catch (error) {
|
|
156
|
+
console.error(' โ Test failed with error:', error);
|
|
157
|
+
return false;
|
|
158
|
+
}
|
|
159
|
+
finally {
|
|
160
|
+
try {
|
|
161
|
+
fs_1.default.rmSync(tempDir, { recursive: true, force: true });
|
|
162
|
+
console.log(' ๐งน Cleaned up temp directory');
|
|
163
|
+
}
|
|
164
|
+
catch (e) {
|
|
165
|
+
console.log(' โ ๏ธ Could not clean up temp directory');
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
async function testChalkResolutionWithPinnedVersion() {
|
|
170
|
+
console.log(' ๐งช Testing chalk resolution with PINNED version (4.1.2)...');
|
|
171
|
+
const tempDir = fs_1.default.mkdtempSync(path_1.default.join(os_1.default.tmpdir(), 'chalk-pinned-'));
|
|
172
|
+
console.log(` ๐ Created temp dir: ${tempDir}`);
|
|
173
|
+
try {
|
|
174
|
+
// 1. Create a package that depends on chalk v5
|
|
175
|
+
console.log(' ๐ฆ Creating fake package that requires chalk v5...');
|
|
176
|
+
const fakePackageDir = path_1.default.join(tempDir, 'fake-chalk5-package');
|
|
177
|
+
fs_1.default.mkdirSync(fakePackageDir, { recursive: true });
|
|
178
|
+
const fakePackageJson = {
|
|
179
|
+
name: 'fake-chalk5-package',
|
|
180
|
+
version: '1.0.0',
|
|
181
|
+
dependencies: {
|
|
182
|
+
'chalk': '^5.0.0'
|
|
183
|
+
}
|
|
184
|
+
};
|
|
185
|
+
fs_1.default.writeFileSync(path_1.default.join(fakePackageDir, 'package.json'), JSON.stringify(fakePackageJson, null, 2));
|
|
186
|
+
fs_1.default.writeFileSync(path_1.default.join(fakePackageDir, 'index.js'), 'export { default as chalk } from "chalk";\n');
|
|
187
|
+
// 2. Pack fraim-framework with 4.1.2 (PINNED - current state)
|
|
188
|
+
console.log(' ๐ฆ Packing fraim-framework with pinned 4.1.2...');
|
|
189
|
+
const projectRoot = process.cwd();
|
|
190
|
+
const packResult = (0, node_child_process_1.execSync)('npm pack', {
|
|
191
|
+
cwd: projectRoot,
|
|
192
|
+
encoding: 'utf-8'
|
|
193
|
+
});
|
|
194
|
+
const tarballName = packResult.trim().split('\n').pop()?.trim();
|
|
195
|
+
if (!tarballName) {
|
|
196
|
+
return false;
|
|
197
|
+
}
|
|
198
|
+
const tarballPath = path_1.default.join(projectRoot, tarballName);
|
|
199
|
+
// 3. Create test project with conflicting dependencies
|
|
200
|
+
console.log(' ๐ง Creating test project with conflicting dependencies...');
|
|
201
|
+
const testPackageJson = {
|
|
202
|
+
name: 'chalk-pinned-test',
|
|
203
|
+
version: '1.0.0',
|
|
204
|
+
dependencies: {
|
|
205
|
+
'fake-chalk5-package': 'file:./fake-chalk5-package',
|
|
206
|
+
'fraim-framework': `file:${tarballPath}`
|
|
207
|
+
}
|
|
208
|
+
};
|
|
209
|
+
fs_1.default.writeFileSync(path_1.default.join(tempDir, 'package.json'), JSON.stringify(testPackageJson, null, 2));
|
|
210
|
+
// 4. Install dependencies
|
|
211
|
+
console.log(' ๐ฅ Installing with conflicting chalk requirements...');
|
|
212
|
+
console.log(' โ ๏ธ fake-chalk5-package wants chalk ^5.0.0');
|
|
213
|
+
console.log(' โ
fraim-framework wants chalk 4.1.2 (PINNED)');
|
|
214
|
+
const installResult = await runCommand('npm', ['install'], tempDir);
|
|
215
|
+
if (installResult.code !== 0) {
|
|
216
|
+
console.log(' โ ๏ธ npm install failed');
|
|
217
|
+
}
|
|
218
|
+
// 5. Check chalk versions
|
|
219
|
+
const fraimChalkPath = path_1.default.join(tempDir, 'node_modules', 'fraim-framework', 'node_modules', 'chalk', 'package.json');
|
|
220
|
+
const rootChalkPath = path_1.default.join(tempDir, 'node_modules', 'chalk', 'package.json');
|
|
221
|
+
let fraimChalkVersion = null;
|
|
222
|
+
let rootChalkVersion = null;
|
|
223
|
+
if (fs_1.default.existsSync(fraimChalkPath)) {
|
|
224
|
+
const chalkPkg = JSON.parse(fs_1.default.readFileSync(fraimChalkPath, 'utf-8'));
|
|
225
|
+
fraimChalkVersion = chalkPkg.version;
|
|
226
|
+
console.log(` ๐ fraim-framework's chalk: ${fraimChalkVersion}`);
|
|
227
|
+
}
|
|
228
|
+
if (fs_1.default.existsSync(rootChalkPath)) {
|
|
229
|
+
const chalkPkg = JSON.parse(fs_1.default.readFileSync(rootChalkPath, 'utf-8'));
|
|
230
|
+
rootChalkVersion = chalkPkg.version;
|
|
231
|
+
console.log(` ๐ Root chalk: ${rootChalkVersion}`);
|
|
232
|
+
}
|
|
233
|
+
// Verify fraim has v4
|
|
234
|
+
if (fraimChalkVersion && !fraimChalkVersion.startsWith('4.')) {
|
|
235
|
+
console.log(` โ PINNED version failed! Got chalk ${fraimChalkVersion}`);
|
|
236
|
+
fs_1.default.unlinkSync(tarballPath);
|
|
237
|
+
return false;
|
|
238
|
+
}
|
|
239
|
+
// 6. Try to load fraim CLI
|
|
240
|
+
console.log(' ๐ Testing if fraim CLI loads...');
|
|
241
|
+
const testScript = `
|
|
242
|
+
try {
|
|
243
|
+
const fraimCli = require('./node_modules/fraim-framework/dist/src/cli/fraim.js');
|
|
244
|
+
console.log('SUCCESS: fraim CLI loaded with pinned chalk');
|
|
245
|
+
process.exit(0);
|
|
246
|
+
} catch (error) {
|
|
247
|
+
if (error.code === 'ERR_REQUIRE_ESM') {
|
|
248
|
+
console.log('ERROR: ERR_REQUIRE_ESM even with pinned version!');
|
|
249
|
+
process.exit(1);
|
|
250
|
+
} else {
|
|
251
|
+
console.log('ERROR: Other error:', error.message);
|
|
252
|
+
process.exit(2);
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
`;
|
|
256
|
+
fs_1.default.writeFileSync(path_1.default.join(tempDir, 'test.js'), testScript);
|
|
257
|
+
const testResult = await runCommand('node', ['test.js'], tempDir);
|
|
258
|
+
if (testResult.code === 0) {
|
|
259
|
+
console.log(' โ
SUCCESS! Pinned version prevents chalk v5 upgrade');
|
|
260
|
+
console.log(' โ
fraim CLI works even with chalk v5 dependency nearby');
|
|
261
|
+
console.log(' โ
This proves the fix works!');
|
|
262
|
+
}
|
|
263
|
+
else if (testResult.code === 1) {
|
|
264
|
+
console.log(' โ FAILED! Even pinned version got chalk v5');
|
|
265
|
+
console.log(' โ The fix doesn\'t work!');
|
|
266
|
+
fs_1.default.unlinkSync(tarballPath);
|
|
267
|
+
return false;
|
|
268
|
+
}
|
|
269
|
+
// Cleanup
|
|
270
|
+
fs_1.default.unlinkSync(tarballPath);
|
|
271
|
+
return true;
|
|
272
|
+
}
|
|
273
|
+
catch (error) {
|
|
274
|
+
console.error(' โ Test failed with error:', error);
|
|
275
|
+
return false;
|
|
276
|
+
}
|
|
277
|
+
finally {
|
|
278
|
+
try {
|
|
279
|
+
fs_1.default.rmSync(tempDir, { recursive: true, force: true });
|
|
280
|
+
console.log(' ๐งน Cleaned up temp directory');
|
|
281
|
+
}
|
|
282
|
+
catch (e) {
|
|
283
|
+
console.log(' โ ๏ธ Could not clean up temp directory');
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
async function runChalkResolutionTest(testCase) {
|
|
288
|
+
return await testCase.testFunction();
|
|
289
|
+
}
|
|
290
|
+
const testCases = [
|
|
291
|
+
{
|
|
292
|
+
name: 'Chalk Resolution with Conflict (^4.1.2)',
|
|
293
|
+
description: 'Tests if ^4.1.2 allows npm to upgrade to chalk v5 when there\'s a conflicting dependency',
|
|
294
|
+
testFunction: testChalkResolutionWithConflict,
|
|
295
|
+
tags: ['chalk', 'resolution', 'conflict']
|
|
296
|
+
},
|
|
297
|
+
{
|
|
298
|
+
name: 'Chalk Resolution with Pinned Version (4.1.2)',
|
|
299
|
+
description: 'Tests if pinned 4.1.2 prevents npm from upgrading to chalk v5',
|
|
300
|
+
testFunction: testChalkResolutionWithPinnedVersion,
|
|
301
|
+
tags: ['chalk', 'resolution', 'pinned', 'fix']
|
|
302
|
+
}
|
|
303
|
+
];
|
|
304
|
+
(0, test_utils_1.runTests)(testCases, runChalkResolutionTest, 'Chalk Resolution Issue Test');
|
package/dist/tests/test-cli.js
CHANGED
|
@@ -110,8 +110,6 @@ async function testCliLifecycle() {
|
|
|
110
110
|
}
|
|
111
111
|
node_assert_1.default.ok(config.customizations, 'config.customizations should exist');
|
|
112
112
|
node_assert_1.default.strictEqual(config.customizations.workflowsPath, '.fraim/workflows');
|
|
113
|
-
node_assert_1.default.ok(config.architecture, 'architecture should be in generated config');
|
|
114
|
-
node_assert_1.default.ok(config.testing, 'testing should be in generated config');
|
|
115
113
|
node_assert_1.default.ok(!config.mcp, 'mcp should not be in generated config');
|
|
116
114
|
// 2. Test `fraim sync`
|
|
117
115
|
// We need a fake registry for sync to work against
|
|
@@ -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,59 @@
|
|
|
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 test_utils_1 = require("./test-utils");
|
|
7
|
+
const node_assert_1 = __importDefault(require("node:assert"));
|
|
8
|
+
const issues_1 = require("../src/fraim/issues");
|
|
9
|
+
async function testDryRun() {
|
|
10
|
+
console.log(' Testing dry-run issue creation...');
|
|
11
|
+
const result = await (0, issues_1.fileFraimIssue)({
|
|
12
|
+
title: 'Test Issue',
|
|
13
|
+
body: 'Test Body',
|
|
14
|
+
dryRun: true
|
|
15
|
+
});
|
|
16
|
+
node_assert_1.default.strictEqual(result.success, true, 'Dry run should succeed');
|
|
17
|
+
node_assert_1.default.strictEqual(result.dryRun, true, 'Result should indicate dry run');
|
|
18
|
+
node_assert_1.default.ok(result.message && result.message.includes('[DRY RUN]'), 'Message should indicate dry run');
|
|
19
|
+
return true;
|
|
20
|
+
}
|
|
21
|
+
async function testMissingToken() {
|
|
22
|
+
console.log(' Testing missing GITHUB_TOKEN...');
|
|
23
|
+
// Save original token
|
|
24
|
+
const originalToken = process.env.GITHUB_TOKEN;
|
|
25
|
+
delete process.env.GITHUB_TOKEN;
|
|
26
|
+
try {
|
|
27
|
+
const result = await (0, issues_1.fileFraimIssue)({
|
|
28
|
+
title: 'Test Issue',
|
|
29
|
+
body: 'Test Body'
|
|
30
|
+
});
|
|
31
|
+
node_assert_1.default.strictEqual(result.success, false, 'Should fail without token');
|
|
32
|
+
node_assert_1.default.strictEqual(result.message, 'GITHUB_TOKEN environment variable is required', 'Should return correct error message');
|
|
33
|
+
return true;
|
|
34
|
+
}
|
|
35
|
+
finally {
|
|
36
|
+
// Restore token
|
|
37
|
+
if (originalToken) {
|
|
38
|
+
process.env.GITHUB_TOKEN = originalToken;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
async function runIssueTest(testCase) {
|
|
43
|
+
return await testCase.testFunction();
|
|
44
|
+
}
|
|
45
|
+
const testCases = [
|
|
46
|
+
{
|
|
47
|
+
name: 'Dry Run Issue Creation',
|
|
48
|
+
description: 'Verifies that dry-run mode works and returns correct structure',
|
|
49
|
+
testFunction: testDryRun,
|
|
50
|
+
tags: ['issues', 'core']
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
name: 'Missing Token Validation',
|
|
54
|
+
description: 'Verifies that missing GITHUB_TOKEN causes failure',
|
|
55
|
+
testFunction: testMissingToken,
|
|
56
|
+
tags: ['issues', 'core']
|
|
57
|
+
}
|
|
58
|
+
];
|
|
59
|
+
(0, test_utils_1.runTests)(testCases, runIssueTest, 'Fraim Issue Logic Tests');
|
|
@@ -12,9 +12,7 @@ async function testConfigDefaults() {
|
|
|
12
12
|
try {
|
|
13
13
|
node_assert_1.default.strictEqual(types_1.DEFAULT_FRAIM_CONFIG.persona.name, 'AI Agent', 'Default persona name should be "AI Agent"');
|
|
14
14
|
node_assert_1.default.ok(types_1.DEFAULT_FRAIM_CONFIG.customizations?.workflowsPath, 'workflowsPath should exist');
|
|
15
|
-
|
|
16
|
-
node_assert_1.default.ok(types_1.DEFAULT_FRAIM_CONFIG.testing, 'testing should be restored');
|
|
17
|
-
node_assert_1.default.ok(!types_1.DEFAULT_FRAIM_CONFIG.mcp, 'mcp should still be removed');
|
|
15
|
+
// Architecture and Testing sections removed
|
|
18
16
|
return true;
|
|
19
17
|
}
|
|
20
18
|
catch (e) {
|