fraim-framework 2.0.56 → 2.0.58
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/CHANGELOG.md +10 -0
- package/bin/fraim-mcp.js +14 -0
- package/bin/fraim.js +23 -0
- package/dist/src/cli/commands/init-project.js +10 -4
- package/dist/src/cli/commands/mcp.js +65 -0
- package/dist/src/cli/setup/mcp-config-generator.js +19 -16
- package/dist/src/fraim/issue-tracking/ado-provider.js +304 -0
- package/dist/src/fraim/issue-tracking/factory.js +63 -0
- package/dist/src/fraim/issue-tracking/github-provider.js +200 -0
- package/dist/src/fraim/issue-tracking/types.js +7 -0
- package/dist/src/fraim/issue-tracking-config.js +83 -0
- package/dist/src/local-mcp-server/stdio-server.js +207 -0
- package/dist/src/utils/workflow-parser.js +81 -0
- package/package.json +17 -12
- package/registry/scripts/pdf-styles.css +172 -0
- package/registry/scripts/prep-issue.sh +46 -4
- package/registry/scripts/profile-server.ts +131 -130
- package/registry/stubs/workflows/customer-development/user-survey-dispatch.md +1 -1
- package/registry/stubs/workflows/customer-development/users-to-target.md +1 -1
- package/registry/stubs/workflows/product-building/design.md +1 -1
- package/registry/stubs/workflows/product-building/implement.md +1 -1
- package/Claude.md +0 -1
- package/dist/registry/ai-manager-rules/customer-development-phases/phase1-customer-profiling.md +0 -101
- package/dist/registry/ai-manager-rules/customer-development-phases/phase2-platform-discovery.md +0 -235
- package/dist/registry/ai-manager-rules/customer-development-phases/phase3-prospect-qualification.md +0 -243
- package/dist/registry/ai-manager-rules/customer-development-phases/phase4-inventory-compilation.md +0 -206
- package/dist/registry/ai-manager-rules/design-phases/design-completeness-review.md +0 -73
- package/dist/registry/ai-manager-rules/design-phases/design-design.md +0 -145
- package/dist/registry/ai-manager-rules/implement-phases/implement-code.md +0 -283
- package/dist/registry/ai-manager-rules/implement-phases/implement-completeness-review.md +0 -120
- package/dist/registry/ai-manager-rules/implement-phases/implement-regression.md +0 -173
- package/dist/registry/ai-manager-rules/implement-phases/implement-repro.md +0 -104
- package/dist/registry/ai-manager-rules/implement-phases/implement-scoping.md +0 -100
- package/dist/registry/ai-manager-rules/implement-phases/implement-smoke.md +0 -237
- package/dist/registry/ai-manager-rules/implement-phases/implement-spike.md +0 -121
- package/dist/registry/ai-manager-rules/implement-phases/implement-validate.md +0 -375
- package/dist/registry/ai-manager-rules/retrospective.md +0 -116
- package/dist/registry/ai-manager-rules/shared-phases/address-pr-feedback.md +0 -188
- package/dist/registry/ai-manager-rules/shared-phases/submit-pr.md +0 -202
- package/dist/registry/ai-manager-rules/shared-phases/wait-for-pr-review.md +0 -170
- package/dist/registry/ai-manager-rules/spec-phases/spec-competitor-analysis.md +0 -105
- package/dist/registry/ai-manager-rules/spec-phases/spec-completeness-review.md +0 -66
- package/dist/registry/ai-manager-rules/spec-phases/spec-spec.md +0 -139
- package/dist/registry/ai-manager-rules/user-survey-phases/phase1-survey-scoping.md +0 -60
- package/dist/registry/ai-manager-rules/user-survey-phases/phase2-survey-build-linkedin.md +0 -23
- package/dist/registry/ai-manager-rules/user-survey-phases/phase3-survey-build-reddit.md +0 -22
- package/dist/registry/ai-manager-rules/user-survey-phases/phase4-survey-build-x.md +0 -21
- package/dist/registry/ai-manager-rules/user-survey-phases/phase5-survey-build-facebook.md +0 -19
- package/dist/registry/ai-manager-rules/user-survey-phases/phase6-survey-build-custom.md +0 -15
- package/dist/registry/ai-manager-rules/user-survey-phases/phase7-survey-dispatch.md +0 -45
- package/dist/registry/providers/ado.json +0 -19
- package/dist/registry/providers/github.json +0 -19
- package/dist/registry/scripts/cleanup-branch.js +0 -287
- package/dist/registry/scripts/evaluate-code-quality.js +0 -66
- package/dist/registry/scripts/exec-with-timeout.js +0 -142
- package/dist/registry/scripts/generate-engagement-emails.js +0 -705
- package/dist/registry/scripts/newsletter-helpers.js +0 -671
- package/dist/registry/scripts/profile-server.js +0 -388
- package/dist/registry/scripts/run-thank-you-workflow.js +0 -92
- package/dist/registry/scripts/send-newsletter-simple.js +0 -85
- package/dist/registry/scripts/send-thank-you-emails.js +0 -54
- package/dist/registry/scripts/validate-openapi-limits.js +0 -311
- package/dist/registry/scripts/validate-test-coverage.js +0 -262
- package/dist/registry/scripts/verify-test-coverage.js +0 -66
- package/dist/registry/templates/bootstrap/ARCHITECTURE-TEMPLATE.md +0 -53
- package/dist/registry/templates/bootstrap/CODE-QUALITY-REPORT-TEMPLATE.md +0 -37
- package/dist/registry/templates/bootstrap/TEST-COVERAGE-REPORT-TEMPLATE.md +0 -35
- package/dist/registry/templates/business-development/IDEATION-REPORT-TEMPLATE.md +0 -29
- package/dist/registry/templates/business-development/PRICING-STRATEGY-TEMPLATE.md +0 -126
- package/dist/registry/templates/customer-development/customer-interview-template.md +0 -99
- package/dist/registry/templates/customer-development/customer-persona-template.md +0 -69
- package/dist/registry/templates/customer-development/follow-up-email-templates.md +0 -132
- package/dist/registry/templates/customer-development/insight-analysis-template.md +0 -74
- package/dist/registry/templates/customer-development/prospect-inventory-template.csv +0 -3
- package/dist/registry/templates/customer-development/search-strategy-template.md +0 -123
- package/dist/registry/templates/customer-development/strategic-recommendations-template.md +0 -53
- package/dist/registry/templates/customer-development/thank-you-email-template.html +0 -124
- package/dist/registry/templates/customer-development/thank-you-note-template.md +0 -16
- package/dist/registry/templates/customer-development/triage-log-template.md +0 -278
- package/dist/registry/templates/customer-development/weekly-newsletter-template.html +0 -204
- package/dist/registry/templates/evidence/Design-Evidence.md +0 -30
- package/dist/registry/templates/evidence/Implementation-BugEvidence.md +0 -94
- package/dist/registry/templates/evidence/Implementation-FeatureEvidence.md +0 -129
- package/dist/registry/templates/evidence/Spec-Evidence.md +0 -19
- package/dist/registry/templates/help/HelpNeeded.md +0 -14
- package/dist/registry/templates/legal/NDA-TEMPLATE.md +0 -170
- package/dist/registry/templates/legal/PATENT-TEMPLATE.md +0 -372
- package/dist/registry/templates/legal/TRADEMARK-TEMPLATE.md +0 -339
- package/dist/registry/templates/legal/contract-review-checklist.md +0 -193
- package/dist/registry/templates/legal/review-report-template.md +0 -198
- package/dist/registry/templates/legal/saas-terms-template.md +0 -174
- package/dist/registry/templates/legal/sow-template.md +0 -117
- package/dist/registry/templates/legal/template-variables.md +0 -131
- package/dist/registry/templates/marketing/DOMAIN-REGISTRATION-TEMPLATE.md +0 -194
- package/dist/registry/templates/marketing/HBR-ARTICLE-TEMPLATE.md +0 -66
- package/dist/registry/templates/marketing/STORYTELLING-TEMPLATE.md +0 -130
- package/dist/registry/templates/marketing/WEBSITE-TEMPLATE.md +0 -262
- package/dist/registry/templates/marketing/github-pages-workflow.yml +0 -64
- package/dist/registry/templates/replicate/implementation-checklist.md +0 -39
- package/dist/registry/templates/replicate/use-cases-template.md +0 -88
- package/dist/registry/templates/retrospective/RETROSPECTIVE-TEMPLATE.md +0 -55
- package/dist/registry/templates/specs/BUGSPEC-TEMPLATE.md +0 -37
- package/dist/registry/templates/specs/FEATURESPEC-TEMPLATE.md +0 -66
- package/dist/registry/templates/specs/TECHSPEC-TEMPLATE.md +0 -39
- package/dist/registry/workflows/bootstrap/create-architecture.md +0 -38
- package/dist/registry/workflows/bootstrap/detect-broken-windows.md +0 -300
- package/dist/registry/workflows/bootstrap/evaluate-code-quality.md +0 -35
- package/dist/registry/workflows/bootstrap/verify-test-coverage.md +0 -36
- package/dist/registry/workflows/brainstorming/blue-sky-brainstorming.md +0 -211
- package/dist/registry/workflows/brainstorming/codebase-brainstorming.md +0 -165
- package/dist/registry/workflows/business-development/create-business-plan.md +0 -737
- package/dist/registry/workflows/business-development/ideate-business-opportunity.md +0 -55
- package/dist/registry/workflows/business-development/price-product.md +0 -325
- package/dist/registry/workflows/compliance/detect-compliance-requirements.md +0 -78
- package/dist/registry/workflows/compliance/generate-audit-evidence.md +0 -75
- package/dist/registry/workflows/compliance/soc2-evidence-generator.md +0 -332
- package/dist/registry/workflows/customer-development/insight-analysis.md +0 -156
- package/dist/registry/workflows/customer-development/insight-triage.md +0 -938
- package/dist/registry/workflows/customer-development/interview-preparation.md +0 -452
- package/dist/registry/workflows/customer-development/linkedin-outreach.md +0 -593
- package/dist/registry/workflows/customer-development/strategic-brainstorming.md +0 -146
- package/dist/registry/workflows/customer-development/thank-customers.md +0 -203
- package/dist/registry/workflows/customer-development/user-survey-dispatch.md +0 -60
- package/dist/registry/workflows/customer-development/users-to-target.md +0 -112
- package/dist/registry/workflows/customer-development/weekly-newsletter.md +0 -366
- package/dist/registry/workflows/deploy/cloud-deployment.md +0 -310
- package/dist/registry/workflows/improve-fraim/contribute.md +0 -32
- package/dist/registry/workflows/improve-fraim/file-issue.md +0 -32
- package/dist/registry/workflows/learning/build-skillset.md +0 -212
- package/dist/registry/workflows/learning/synthesize-learnings.md +0 -284
- package/dist/registry/workflows/legal/contract-review-analysis.md +0 -382
- package/dist/registry/workflows/legal/nda.md +0 -69
- package/dist/registry/workflows/legal/patent-filing.md +0 -76
- package/dist/registry/workflows/legal/saas-contract-development.md +0 -213
- package/dist/registry/workflows/legal/trademark-filing.md +0 -77
- package/dist/registry/workflows/marketing/content-creation.md +0 -37
- package/dist/registry/workflows/marketing/convert-to-pdf.md +0 -235
- package/dist/registry/workflows/marketing/create-modern-website.md +0 -456
- package/dist/registry/workflows/marketing/domain-registration.md +0 -323
- package/dist/registry/workflows/marketing/hbr-article.md +0 -73
- package/dist/registry/workflows/marketing/launch-checklist.md +0 -37
- package/dist/registry/workflows/marketing/marketing-strategy.md +0 -45
- package/dist/registry/workflows/marketing/storytelling.md +0 -65
- package/dist/registry/workflows/performance/analyze-performance.md +0 -65
- package/dist/registry/workflows/product-building/design.md +0 -103
- package/dist/registry/workflows/product-building/implement.md +0 -74
- package/dist/registry/workflows/product-building/iterate-on-pr-comments.md +0 -70
- package/dist/registry/workflows/product-building/prep-issue.md +0 -41
- package/dist/registry/workflows/product-building/prototype.md +0 -65
- package/dist/registry/workflows/product-building/resolve.md +0 -168
- package/dist/registry/workflows/product-building/retrospect.md +0 -86
- package/dist/registry/workflows/product-building/spec.md +0 -181
- package/dist/registry/workflows/product-building/test.md +0 -125
- package/dist/registry/workflows/productivity-report/productivity-report.md +0 -263
- package/dist/registry/workflows/quality-assurance/browser-validation.md +0 -221
- package/dist/registry/workflows/quality-assurance/iterative-improvement-cycle.md +0 -562
- package/dist/registry/workflows/replicate/replicate-discovery.md +0 -336
- package/dist/registry/workflows/replicate/replicate-to-issues.md +0 -324
- package/dist/registry/workflows/reviewer/review-implementation-vs-design-spec.md +0 -638
- package/dist/registry/workflows/reviewer/review-implementation-vs-feature-spec.md +0 -675
- package/dist/registry/workflows/startup-credits/aws-activate-application.md +0 -535
- package/dist/registry/workflows/startup-credits/google-cloud-application.md +0 -647
- package/dist/registry/workflows/startup-credits/microsoft-azure-application.md +0 -538
- package/dist/scripts/build-stub-registry.js +0 -108
- package/dist/src/ai-manager/ai-manager.js +0 -480
- package/dist/src/ai-manager/phase-flow.js +0 -357
- package/dist/src/ai-manager/types.js +0 -5
- package/dist/src/fraim-mcp-server.js +0 -1885
- package/dist/tests/debug-tools.js +0 -80
- package/dist/tests/shared-server-utils.js +0 -57
- package/dist/tests/test-add-ide.js +0 -283
- package/dist/tests/test-ai-coach-edge-cases.js +0 -420
- package/dist/tests/test-ai-coach-mcp-integration.js +0 -450
- package/dist/tests/test-ai-coach-performance.js +0 -328
- package/dist/tests/test-ai-coach-phase-content.js +0 -264
- package/dist/tests/test-ai-coach-workflows.js +0 -514
- package/dist/tests/test-cli.js +0 -228
- package/dist/tests/test-client-scripts-validation.js +0 -167
- package/dist/tests/test-complete-setup-flow.js +0 -110
- package/dist/tests/test-config-system.js +0 -279
- package/dist/tests/test-debug-session.js +0 -134
- package/dist/tests/test-end-to-end-hybrid-validation.js +0 -328
- package/dist/tests/test-enhanced-session-init.js +0 -188
- package/dist/tests/test-first-run-journey.js +0 -368
- package/dist/tests/test-fraim-issues.js +0 -59
- package/dist/tests/test-genericization.js +0 -44
- package/dist/tests/test-hybrid-script-execution.js +0 -340
- package/dist/tests/test-ide-detector.js +0 -46
- package/dist/tests/test-improved-setup.js +0 -121
- package/dist/tests/test-mcp-config-generator.js +0 -99
- package/dist/tests/test-mcp-connection.js +0 -107
- package/dist/tests/test-mcp-issue-integration.js +0 -156
- package/dist/tests/test-mcp-lifecycle-methods.js +0 -240
- package/dist/tests/test-mcp-shared-server.js +0 -308
- package/dist/tests/test-mcp-template-processing.js +0 -160
- package/dist/tests/test-modular-issue-tracking.js +0 -165
- package/dist/tests/test-node-compatibility.js +0 -95
- package/dist/tests/test-npm-install.js +0 -68
- package/dist/tests/test-package-size.js +0 -108
- package/dist/tests/test-pr-review-workflow.js +0 -307
- package/dist/tests/test-prep-issue.js +0 -129
- package/dist/tests/test-productivity-integration.js +0 -157
- package/dist/tests/test-script-location-independence.js +0 -198
- package/dist/tests/test-script-sync.js +0 -557
- package/dist/tests/test-server-utils.js +0 -32
- package/dist/tests/test-session-rehydration.js +0 -148
- package/dist/tests/test-setup-integration.js +0 -98
- package/dist/tests/test-setup-scenarios.js +0 -322
- package/dist/tests/test-standalone.js +0 -143
- package/dist/tests/test-stub-registry.js +0 -136
- package/dist/tests/test-sync-stubs.js +0 -143
- package/dist/tests/test-sync-version-update.js +0 -93
- package/dist/tests/test-telemetry.js +0 -193
- package/dist/tests/test-token-validator.js +0 -30
- package/dist/tests/test-user-journey.js +0 -236
- package/dist/tests/test-users-to-target-workflow.js +0 -253
- package/dist/tests/test-utils.js +0 -109
- package/dist/tests/test-wizard.js +0 -71
- package/dist/tests/test-workflow-discovery.js +0 -242
- package/labels.json +0 -52
- package/registry/agent-guardrails.md +0 -63
- package/registry/fraim.md +0 -48
- package/setup.js +0 -171
- package/tsconfig.json +0 -23
|
@@ -1,107 +0,0 @@
|
|
|
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 axios_1 = __importDefault(require("axios"));
|
|
7
|
-
const test_utils_1 = require("./test-utils");
|
|
8
|
-
const node_assert_1 = __importDefault(require("node:assert"));
|
|
9
|
-
const db_service_js_1 = require("../src/fraim/db-service.js");
|
|
10
|
-
const shared_server_utils_1 = require("./shared-server-utils");
|
|
11
|
-
async function testMcpConnection() {
|
|
12
|
-
console.log(' 🚀 Testing MCP Connection Reliability...');
|
|
13
|
-
const BASE_URL = (0, shared_server_utils_1.getTestServerUrl)();
|
|
14
|
-
const MCP_URL = (0, shared_server_utils_1.getMcpEndpoint)();
|
|
15
|
-
const TEST_API_KEY = 'test-fraim-key-mcp-conn';
|
|
16
|
-
let dbService;
|
|
17
|
-
try {
|
|
18
|
-
// Wait for server to be ready
|
|
19
|
-
await (0, shared_server_utils_1.waitForServer)();
|
|
20
|
-
console.log(' Server started!');
|
|
21
|
-
// 0. Setup DB and Key
|
|
22
|
-
dbService = new db_service_js_1.FraimDbService();
|
|
23
|
-
await dbService.connect();
|
|
24
|
-
const db = dbService.db;
|
|
25
|
-
await db.collection('fraim_api_keys').deleteOne({ key: TEST_API_KEY });
|
|
26
|
-
await db.collection('fraim_api_keys').insertOne({
|
|
27
|
-
key: TEST_API_KEY,
|
|
28
|
-
userId: 'test-user-mcp',
|
|
29
|
-
orgId: 'test-org',
|
|
30
|
-
isActive: true,
|
|
31
|
-
createdAt: new Date()
|
|
32
|
-
});
|
|
33
|
-
const authHeaders = { 'x-api-key': TEST_API_KEY };
|
|
34
|
-
// 1. Test notifications/initialized
|
|
35
|
-
console.log(' Testing notifications/initialized...');
|
|
36
|
-
const initRes = await axios_1.default.post(MCP_URL, {
|
|
37
|
-
jsonrpc: '2.0',
|
|
38
|
-
method: 'notifications/initialized',
|
|
39
|
-
params: {}
|
|
40
|
-
}, { headers: authHeaders });
|
|
41
|
-
node_assert_1.default.strictEqual(initRes.status, 200, 'Should return 200 OK for notifications/initialized');
|
|
42
|
-
node_assert_1.default.strictEqual(initRes.data.result, true, 'Should return result: true');
|
|
43
|
-
console.log(' ✅ notifications/initialized handled correctly.');
|
|
44
|
-
// 2. Test DELETE request (simulate disconnect crash)
|
|
45
|
-
console.log(' Testing DELETE request (simulate disconnect crash)...');
|
|
46
|
-
await axios_1.default.delete(MCP_URL, {
|
|
47
|
-
headers: authHeaders,
|
|
48
|
-
validateStatus: (status) => true // Accept any status
|
|
49
|
-
});
|
|
50
|
-
console.log(' ✅ DELETE request completed without network error (Server survived).');
|
|
51
|
-
// 3. Verify Server is STILL ALIVE after DELETE
|
|
52
|
-
const healthRes = await axios_1.default.get(`${BASE_URL}/health`);
|
|
53
|
-
node_assert_1.default.strictEqual(healthRes.status, 200, 'Server should be alive after DELETE request');
|
|
54
|
-
console.log(' ✅ Server verified alive after malformed request.');
|
|
55
|
-
// 4. Test SSE Endpoint Handshake
|
|
56
|
-
console.log(' Testing SSE Handshake...');
|
|
57
|
-
try {
|
|
58
|
-
const sseRes = await axios_1.default.get(MCP_URL, {
|
|
59
|
-
headers: {
|
|
60
|
-
'Accept': 'text/event-stream',
|
|
61
|
-
...authHeaders
|
|
62
|
-
},
|
|
63
|
-
validateStatus: () => true,
|
|
64
|
-
timeout: 5000 // 5 second timeout to prevent hanging
|
|
65
|
-
});
|
|
66
|
-
console.log(' ✅ SSE Handshake verified with absolute URL.');
|
|
67
|
-
}
|
|
68
|
-
catch (error) {
|
|
69
|
-
// SSE streams may abort in test environments, which is acceptable
|
|
70
|
-
if (error.message.includes('stream has been aborted') || error.message.includes('timeout')) {
|
|
71
|
-
console.log(' ✅ SSE Handshake attempted (stream aborted/timeout is acceptable in test environment).');
|
|
72
|
-
}
|
|
73
|
-
else {
|
|
74
|
-
throw error; // Re-throw unexpected errors
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
return true;
|
|
78
|
-
}
|
|
79
|
-
catch (error) {
|
|
80
|
-
console.error(' ❌ Test failed:', error.message);
|
|
81
|
-
return false;
|
|
82
|
-
}
|
|
83
|
-
finally {
|
|
84
|
-
// Clean up DB
|
|
85
|
-
if (dbService) {
|
|
86
|
-
try {
|
|
87
|
-
const db = dbService.db;
|
|
88
|
-
await db.collection('fraim_api_keys').deleteOne({ key: TEST_API_KEY });
|
|
89
|
-
await dbService.close();
|
|
90
|
-
}
|
|
91
|
-
catch (e) {
|
|
92
|
-
console.warn(' ⚠️ DB cleanup failed:', e);
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
const testCases = [
|
|
98
|
-
{
|
|
99
|
-
name: 'MCP Connection Reliability',
|
|
100
|
-
testFunction: testMcpConnection
|
|
101
|
-
}
|
|
102
|
-
];
|
|
103
|
-
// Custom test runner function for MCP connection tests
|
|
104
|
-
async function runMcpConnectionTest(testCase) {
|
|
105
|
-
return await testCase.testFunction();
|
|
106
|
-
}
|
|
107
|
-
(0, test_utils_1.runTests)(testCases, runMcpConnectionTest, 'MCP Connection Tests');
|
|
@@ -1,156 +0,0 @@
|
|
|
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_child_process_1 = require("node:child_process");
|
|
7
|
-
const axios_1 = __importDefault(require("axios"));
|
|
8
|
-
const db_service_js_1 = require("../src/fraim/db-service.js");
|
|
9
|
-
const test_utils_1 = require("./test-utils");
|
|
10
|
-
const node_assert_1 = __importDefault(require("node:assert"));
|
|
11
|
-
const tree_kill_1 = __importDefault(require("tree-kill"));
|
|
12
|
-
const test_server_utils_1 = require("./test-server-utils");
|
|
13
|
-
async function testFileIssueToolAPI() {
|
|
14
|
-
console.log(' 🚀 Testing File Issue Tool via MCP API...');
|
|
15
|
-
let fraimProcess;
|
|
16
|
-
let dbService;
|
|
17
|
-
const PORT = Math.floor(Math.random() * 1000) + 10000; // Random port to avoid conflicts
|
|
18
|
-
const TEST_API_KEY = 'test-fraim-key-issues';
|
|
19
|
-
const BASE_URL = `http://localhost:${PORT}`;
|
|
20
|
-
try {
|
|
21
|
-
// 1. Seed API key
|
|
22
|
-
dbService = new db_service_js_1.FraimDbService();
|
|
23
|
-
await dbService.connect();
|
|
24
|
-
const db = dbService.db;
|
|
25
|
-
await db.collection('fraim_api_keys').updateOne({ key: TEST_API_KEY }, {
|
|
26
|
-
$set: {
|
|
27
|
-
userId: 'test-user@ashley.ai',
|
|
28
|
-
orgId: 'test-org',
|
|
29
|
-
isActive: true,
|
|
30
|
-
createdAt: new Date()
|
|
31
|
-
}
|
|
32
|
-
}, { upsert: true });
|
|
33
|
-
// 2. Start server
|
|
34
|
-
console.log(` Starting server on port ${PORT}...`);
|
|
35
|
-
const npxCommand = process.platform === 'win32' ? 'npx.cmd' : 'npx';
|
|
36
|
-
const serverScript = (0, test_server_utils_1.getServerScriptPath)();
|
|
37
|
-
fraimProcess = (0, node_child_process_1.spawn)(npxCommand, ['node', `"${serverScript}"`], {
|
|
38
|
-
env: {
|
|
39
|
-
...process.env,
|
|
40
|
-
FRAIM_MCP_PORT: PORT.toString(),
|
|
41
|
-
FRAIM_SKIP_INDEX_ON_START: 'true'
|
|
42
|
-
},
|
|
43
|
-
stdio: 'pipe', // Using pipe to keep output cleaner, assuming debug isn't needed unless failure
|
|
44
|
-
shell: true
|
|
45
|
-
});
|
|
46
|
-
// 3. Wait for start
|
|
47
|
-
console.log(' Waiting for server to start...');
|
|
48
|
-
let started = false;
|
|
49
|
-
for (let i = 0; i < 20; i++) {
|
|
50
|
-
try {
|
|
51
|
-
await axios_1.default.get(`${BASE_URL}/health`, { timeout: 1000 });
|
|
52
|
-
started = true;
|
|
53
|
-
console.log(' Server started!');
|
|
54
|
-
break;
|
|
55
|
-
}
|
|
56
|
-
catch (e) {
|
|
57
|
-
await new Promise(resolve => setTimeout(resolve, 1000));
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
if (!started) {
|
|
61
|
-
console.error(' ❌ Server failed to start');
|
|
62
|
-
return false;
|
|
63
|
-
}
|
|
64
|
-
// 4. Perform Handshake (Required for Session)
|
|
65
|
-
console.log(' Performing Handshake (fraim_connect)...');
|
|
66
|
-
await axios_1.default.post(`${BASE_URL}/mcp`, {
|
|
67
|
-
jsonrpc: '2.0',
|
|
68
|
-
id: 0,
|
|
69
|
-
method: 'tools/call',
|
|
70
|
-
params: {
|
|
71
|
-
name: 'fraim_connect',
|
|
72
|
-
arguments: {
|
|
73
|
-
agent: {
|
|
74
|
-
name: 'Claude',
|
|
75
|
-
model: 'claude-3.5-sonnet'
|
|
76
|
-
},
|
|
77
|
-
machine: { hostname: 'test-host', platform: process.platform },
|
|
78
|
-
repo: { url: 'https://github.com/test/repo' }
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
}, {
|
|
82
|
-
headers: { 'x-api-key': TEST_API_KEY }
|
|
83
|
-
});
|
|
84
|
-
// 5. Test file_issue tool call (Dry Run)
|
|
85
|
-
console.log(' Testing file_issue tool (dry run)...');
|
|
86
|
-
const response = await axios_1.default.post(`${BASE_URL}/mcp`, {
|
|
87
|
-
jsonrpc: '2.0',
|
|
88
|
-
id: 1,
|
|
89
|
-
method: 'tools/call',
|
|
90
|
-
params: {
|
|
91
|
-
name: 'file_issue',
|
|
92
|
-
arguments: {
|
|
93
|
-
title: 'Integration Test Issue',
|
|
94
|
-
body: 'This is an integration test',
|
|
95
|
-
dryRun: true
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
}, {
|
|
99
|
-
headers: { 'x-api-key': TEST_API_KEY },
|
|
100
|
-
timeout: 10000
|
|
101
|
-
});
|
|
102
|
-
node_assert_1.default.strictEqual(response.status, 200);
|
|
103
|
-
node_assert_1.default.ok(response.data.result, 'Should have result');
|
|
104
|
-
node_assert_1.default.ok(response.data.result.content, 'Should have content');
|
|
105
|
-
// Handle potential version mismatch warning
|
|
106
|
-
// The server may prepend a warning message if versions don't match
|
|
107
|
-
let contentText = response.data.result.content[0].text;
|
|
108
|
-
// If first content is a version warning, use the second content item
|
|
109
|
-
if (contentText.includes('FRAIM Update Available')) {
|
|
110
|
-
console.log(' ℹ️ Version update notice detected (expected in test environment)');
|
|
111
|
-
node_assert_1.default.ok(response.data.result.content.length > 1, 'Should have result after warning');
|
|
112
|
-
contentText = response.data.result.content[1].text;
|
|
113
|
-
}
|
|
114
|
-
const resultJson = JSON.parse(contentText);
|
|
115
|
-
node_assert_1.default.strictEqual(resultJson.success, true);
|
|
116
|
-
node_assert_1.default.strictEqual(resultJson.dryRun, true);
|
|
117
|
-
node_assert_1.default.ok(resultJson.message.includes('[DRY RUN]'));
|
|
118
|
-
node_assert_1.default.ok(resultJson.message.includes('Integration Test Issue'));
|
|
119
|
-
console.log(' ✅ file_issue tool verified successfully');
|
|
120
|
-
return true;
|
|
121
|
-
}
|
|
122
|
-
catch (error) {
|
|
123
|
-
console.error(' ❌ Test failed:', error);
|
|
124
|
-
if (axios_1.default.isAxiosError(error) && error.response) {
|
|
125
|
-
console.error(' Response data:', error.response.data);
|
|
126
|
-
}
|
|
127
|
-
return false;
|
|
128
|
-
}
|
|
129
|
-
finally {
|
|
130
|
-
console.log(' Cleaning up...');
|
|
131
|
-
if (dbService) {
|
|
132
|
-
const db = dbService.db;
|
|
133
|
-
if (db) {
|
|
134
|
-
await db.collection('fraim_api_keys').deleteOne({ key: TEST_API_KEY }).catch(() => { });
|
|
135
|
-
}
|
|
136
|
-
await dbService.close().catch(() => { });
|
|
137
|
-
}
|
|
138
|
-
if (fraimProcess && fraimProcess.pid) {
|
|
139
|
-
const pid = fraimProcess.pid;
|
|
140
|
-
await new Promise((resolve) => (0, tree_kill_1.default)(pid, 'SIGKILL', () => resolve()));
|
|
141
|
-
console.log(` Terminated server process ${pid}`);
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
async function runTest(testCase) {
|
|
146
|
-
return await testCase.testFunction();
|
|
147
|
-
}
|
|
148
|
-
const testCases = [
|
|
149
|
-
{
|
|
150
|
-
name: 'File Issue Integration Test',
|
|
151
|
-
description: 'Tests file_issue tool via real MCP server request',
|
|
152
|
-
testFunction: testFileIssueToolAPI,
|
|
153
|
-
tags: ['integration', 'issues']
|
|
154
|
-
}
|
|
155
|
-
];
|
|
156
|
-
(0, test_utils_1.runTests)(testCases, runTest, 'Fraim Issue API Integration');
|
|
@@ -1,240 +0,0 @@
|
|
|
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 axios_1 = __importDefault(require("axios"));
|
|
7
|
-
const test_utils_1 = require("./test-utils");
|
|
8
|
-
const node_assert_1 = __importDefault(require("node:assert"));
|
|
9
|
-
const db_service_js_1 = require("../src/fraim/db-service.js");
|
|
10
|
-
const shared_server_utils_1 = require("./shared-server-utils");
|
|
11
|
-
/**
|
|
12
|
-
* Test that resources/list and prompts/list work without session
|
|
13
|
-
* This verifies the fix for the MCP telemetry blocking issue
|
|
14
|
-
*/
|
|
15
|
-
async function testMcpLifecycleMethods() {
|
|
16
|
-
console.log(' 🚀 Testing MCP Lifecycle Methods (resources/list, prompts/list)...');
|
|
17
|
-
const MCP_URL = (0, shared_server_utils_1.getMcpEndpoint)();
|
|
18
|
-
const TEST_API_KEY = 'test-fraim-key-lifecycle';
|
|
19
|
-
let dbService;
|
|
20
|
-
try {
|
|
21
|
-
// Wait for server to be ready
|
|
22
|
-
await (0, shared_server_utils_1.waitForServer)();
|
|
23
|
-
console.log(' Server is ready!');
|
|
24
|
-
// 0. Setup DB and Key
|
|
25
|
-
dbService = new db_service_js_1.FraimDbService();
|
|
26
|
-
await dbService.connect();
|
|
27
|
-
const db = dbService.db;
|
|
28
|
-
await db.collection('fraim_api_keys').deleteOne({ key: TEST_API_KEY });
|
|
29
|
-
await db.collection('fraim_api_keys').insertOne({
|
|
30
|
-
key: TEST_API_KEY,
|
|
31
|
-
userId: 'test-user-lifecycle',
|
|
32
|
-
orgId: 'test-org',
|
|
33
|
-
isActive: true,
|
|
34
|
-
createdAt: new Date()
|
|
35
|
-
});
|
|
36
|
-
const authHeaders = { 'x-api-key': TEST_API_KEY };
|
|
37
|
-
// 2. Test initialize (should work without session)
|
|
38
|
-
console.log(' Testing initialize...');
|
|
39
|
-
const initRes = await axios_1.default.post(MCP_URL, {
|
|
40
|
-
jsonrpc: '2.0',
|
|
41
|
-
method: 'initialize',
|
|
42
|
-
params: {
|
|
43
|
-
protocolVersion: '2024-11-05',
|
|
44
|
-
capabilities: {},
|
|
45
|
-
clientInfo: { name: 'test-client', version: '1.0.0' }
|
|
46
|
-
},
|
|
47
|
-
id: 1
|
|
48
|
-
}, { headers: authHeaders });
|
|
49
|
-
node_assert_1.default.strictEqual(initRes.status, 200, 'initialize should return 200');
|
|
50
|
-
node_assert_1.default.ok(initRes.data.result, 'initialize should return result');
|
|
51
|
-
node_assert_1.default.ok(initRes.data.result.serverInfo, 'initialize should return serverInfo');
|
|
52
|
-
console.log(' ✅ initialize works without session');
|
|
53
|
-
// 3. Test tools/list (should work without session)
|
|
54
|
-
console.log(' Testing tools/list...');
|
|
55
|
-
const toolsRes = await axios_1.default.post(MCP_URL, {
|
|
56
|
-
jsonrpc: '2.0',
|
|
57
|
-
method: 'tools/list',
|
|
58
|
-
params: {},
|
|
59
|
-
id: 2
|
|
60
|
-
}, { headers: authHeaders });
|
|
61
|
-
node_assert_1.default.strictEqual(toolsRes.status, 200, 'tools/list should return 200');
|
|
62
|
-
node_assert_1.default.ok(toolsRes.data.result, 'tools/list should return result');
|
|
63
|
-
node_assert_1.default.ok(Array.isArray(toolsRes.data.result.tools), 'tools/list should return tools array');
|
|
64
|
-
node_assert_1.default.ok(toolsRes.data.result.tools.length > 0, 'tools/list should return at least one tool');
|
|
65
|
-
console.log(` ✅ tools/list works without session (${toolsRes.data.result.tools.length} tools)`);
|
|
66
|
-
// 4. Test resources/list (THE FIX - should work without session)
|
|
67
|
-
console.log(' Testing resources/list (THE FIX)...');
|
|
68
|
-
const resourcesRes = await axios_1.default.post(MCP_URL, {
|
|
69
|
-
jsonrpc: '2.0',
|
|
70
|
-
method: 'resources/list',
|
|
71
|
-
params: {},
|
|
72
|
-
id: 3
|
|
73
|
-
}, { headers: authHeaders });
|
|
74
|
-
node_assert_1.default.strictEqual(resourcesRes.status, 200, 'resources/list should return 200');
|
|
75
|
-
node_assert_1.default.ok(resourcesRes.data.result, 'resources/list should return result');
|
|
76
|
-
node_assert_1.default.ok(Array.isArray(resourcesRes.data.result.resources), 'resources/list should return resources array');
|
|
77
|
-
node_assert_1.default.strictEqual(resourcesRes.data.result.resources.length, 0, 'resources/list should return empty array');
|
|
78
|
-
console.log(' ✅ resources/list works without session (returns empty array)');
|
|
79
|
-
// 5. Test prompts/list (THE FIX - should work without session)
|
|
80
|
-
console.log(' Testing prompts/list (THE FIX)...');
|
|
81
|
-
const promptsRes = await axios_1.default.post(MCP_URL, {
|
|
82
|
-
jsonrpc: '2.0',
|
|
83
|
-
method: 'prompts/list',
|
|
84
|
-
params: {},
|
|
85
|
-
id: 4
|
|
86
|
-
}, { headers: authHeaders });
|
|
87
|
-
node_assert_1.default.strictEqual(promptsRes.status, 200, 'prompts/list should return 200');
|
|
88
|
-
node_assert_1.default.ok(promptsRes.data.result, 'prompts/list should return result');
|
|
89
|
-
node_assert_1.default.ok(Array.isArray(promptsRes.data.result.prompts), 'prompts/list should return prompts array');
|
|
90
|
-
node_assert_1.default.strictEqual(promptsRes.data.result.prompts.length, 0, 'prompts/list should return empty array');
|
|
91
|
-
console.log(' ✅ prompts/list works without session (returns empty array)');
|
|
92
|
-
// 6. Test that non-lifecycle methods still require session
|
|
93
|
-
console.log(' Testing that non-lifecycle methods require session...');
|
|
94
|
-
// Test approach: Call get_fraim_workflow without any API key headers
|
|
95
|
-
// This should work in test mode since auth is bypassed, but it demonstrates
|
|
96
|
-
// that the tool works when called properly
|
|
97
|
-
const workflowRes = await axios_1.default.post(MCP_URL, {
|
|
98
|
-
jsonrpc: '2.0',
|
|
99
|
-
method: 'tools/call',
|
|
100
|
-
params: {
|
|
101
|
-
name: 'get_fraim_workflow',
|
|
102
|
-
arguments: { workflow: 'spec' }
|
|
103
|
-
},
|
|
104
|
-
id: 5
|
|
105
|
-
}); // No headers - should still work in test mode
|
|
106
|
-
node_assert_1.default.strictEqual(workflowRes.status, 200, 'get_fraim_workflow should work in test mode');
|
|
107
|
-
node_assert_1.default.ok(workflowRes.data.result, 'get_fraim_workflow should return result');
|
|
108
|
-
console.log(' ✅ get_fraim_workflow works (session enforcement verified in production)');
|
|
109
|
-
// Note: In production, this would require a session, but in test mode
|
|
110
|
-
// the auth middleware is bypassed for easier testing. The session enforcement
|
|
111
|
-
// is tested in integration tests with real authentication.
|
|
112
|
-
// 7. Test complete MCP initialization sequence
|
|
113
|
-
console.log(' Testing complete MCP initialization sequence...');
|
|
114
|
-
const sequence = [
|
|
115
|
-
{ method: 'initialize', id: 10 },
|
|
116
|
-
{ method: 'notifications/initialized', id: 11 },
|
|
117
|
-
{ method: 'tools/list', id: 12 },
|
|
118
|
-
{ method: 'resources/list', id: 13 },
|
|
119
|
-
{ method: 'prompts/list', id: 14 }
|
|
120
|
-
];
|
|
121
|
-
for (const step of sequence) {
|
|
122
|
-
const res = await axios_1.default.post(MCP_URL, {
|
|
123
|
-
jsonrpc: '2.0',
|
|
124
|
-
method: step.method,
|
|
125
|
-
params: {},
|
|
126
|
-
id: step.id
|
|
127
|
-
}, { headers: authHeaders });
|
|
128
|
-
node_assert_1.default.strictEqual(res.status, 200, `${step.method} should return 200 in sequence`);
|
|
129
|
-
console.log(` ✅ ${step.method} succeeded in sequence`);
|
|
130
|
-
}
|
|
131
|
-
console.log(' ✅ Complete MCP initialization sequence works without session');
|
|
132
|
-
return true;
|
|
133
|
-
}
|
|
134
|
-
catch (error) {
|
|
135
|
-
console.error(' ❌ Test failed:', error.message);
|
|
136
|
-
if (error.response?.data) {
|
|
137
|
-
console.error(' 🔍 Server Error Detail:', JSON.stringify(error.response.data, null, 2));
|
|
138
|
-
}
|
|
139
|
-
return false;
|
|
140
|
-
}
|
|
141
|
-
finally {
|
|
142
|
-
if (dbService) {
|
|
143
|
-
try {
|
|
144
|
-
const db = dbService.db;
|
|
145
|
-
await db.collection('fraim_api_keys').deleteOne({ key: TEST_API_KEY });
|
|
146
|
-
await dbService.close();
|
|
147
|
-
}
|
|
148
|
-
catch (e) {
|
|
149
|
-
console.warn(' ⚠️ DB cleanup failed:', e);
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
/**
|
|
155
|
-
* Test that bootstrap tools work without session
|
|
156
|
-
*/
|
|
157
|
-
async function testBootstrapTools() {
|
|
158
|
-
console.log(' 🚀 Testing Bootstrap Tools (without session)...');
|
|
159
|
-
const MCP_URL = (0, shared_server_utils_1.getMcpEndpoint)();
|
|
160
|
-
const TEST_API_KEY = 'test-fraim-key-bootstrap';
|
|
161
|
-
let dbService;
|
|
162
|
-
try {
|
|
163
|
-
// Wait for server to be ready
|
|
164
|
-
await (0, shared_server_utils_1.waitForServer)();
|
|
165
|
-
console.log(' Server is ready!');
|
|
166
|
-
// 0. Setup DB and Key
|
|
167
|
-
dbService = new db_service_js_1.FraimDbService();
|
|
168
|
-
await dbService.connect();
|
|
169
|
-
const db = dbService.db;
|
|
170
|
-
await db.collection('fraim_api_keys').deleteOne({ key: TEST_API_KEY });
|
|
171
|
-
await db.collection('fraim_api_keys').insertOne({
|
|
172
|
-
key: TEST_API_KEY,
|
|
173
|
-
userId: 'test-user-bootstrap',
|
|
174
|
-
orgId: 'test-org',
|
|
175
|
-
isActive: true,
|
|
176
|
-
createdAt: new Date()
|
|
177
|
-
});
|
|
178
|
-
const authHeaders = { 'x-api-key': TEST_API_KEY };
|
|
179
|
-
// Test bootstrap tools that should work without session
|
|
180
|
-
const bootstrapTools = [
|
|
181
|
-
{ name: 'get_fraim_init', args: {} },
|
|
182
|
-
{ name: 'list_fraim_workflows', args: {} },
|
|
183
|
-
{ name: 'fraim_get_local_config', args: {} }
|
|
184
|
-
];
|
|
185
|
-
for (const tool of bootstrapTools) {
|
|
186
|
-
console.log(` Testing ${tool.name}...`);
|
|
187
|
-
const res = await axios_1.default.post(MCP_URL, {
|
|
188
|
-
jsonrpc: '2.0',
|
|
189
|
-
method: 'tools/call',
|
|
190
|
-
params: {
|
|
191
|
-
name: tool.name,
|
|
192
|
-
arguments: tool.args
|
|
193
|
-
},
|
|
194
|
-
id: 1
|
|
195
|
-
}, { headers: authHeaders });
|
|
196
|
-
node_assert_1.default.strictEqual(res.status, 200, `${tool.name} should return 200 without session`);
|
|
197
|
-
node_assert_1.default.ok(res.data.result, `${tool.name} should return result`);
|
|
198
|
-
console.log(` ✅ ${tool.name} works without session`);
|
|
199
|
-
}
|
|
200
|
-
return true;
|
|
201
|
-
}
|
|
202
|
-
catch (error) {
|
|
203
|
-
console.error(' ❌ Test failed:', error.message);
|
|
204
|
-
if (error.response?.data) {
|
|
205
|
-
console.error(' 🔍 Server Error Detail:', JSON.stringify(error.response.data, null, 2));
|
|
206
|
-
}
|
|
207
|
-
return false;
|
|
208
|
-
}
|
|
209
|
-
finally {
|
|
210
|
-
if (dbService) {
|
|
211
|
-
try {
|
|
212
|
-
const db = dbService.db;
|
|
213
|
-
await db.collection('fraim_api_keys').deleteOne({ key: TEST_API_KEY });
|
|
214
|
-
await dbService.close();
|
|
215
|
-
}
|
|
216
|
-
catch (e) {
|
|
217
|
-
console.warn(' ⚠️ DB cleanup failed:', e);
|
|
218
|
-
}
|
|
219
|
-
}
|
|
220
|
-
}
|
|
221
|
-
}
|
|
222
|
-
const testCases = [
|
|
223
|
-
{
|
|
224
|
-
name: 'MCP Lifecycle Methods',
|
|
225
|
-
description: 'Tests that resources/list and prompts/list work without session (fix for telemetry blocking)',
|
|
226
|
-
testFunction: testMcpLifecycleMethods,
|
|
227
|
-
tags: ['mcp', 'lifecycle', 'telemetry']
|
|
228
|
-
},
|
|
229
|
-
{
|
|
230
|
-
name: 'Bootstrap Tools',
|
|
231
|
-
description: 'Tests that bootstrap tools work without session',
|
|
232
|
-
testFunction: testBootstrapTools,
|
|
233
|
-
tags: ['mcp', 'bootstrap', 'telemetry']
|
|
234
|
-
}
|
|
235
|
-
];
|
|
236
|
-
(0, test_utils_1.runTests)(testCases, async (t) => t.testFunction(), 'MCP Lifecycle Methods & Bootstrap Tools')
|
|
237
|
-
.catch((err) => {
|
|
238
|
-
console.error('Test runner failed:', err);
|
|
239
|
-
throw err;
|
|
240
|
-
});
|