fraim-framework 2.0.36 → 2.0.37
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/bin/fraim.js +5 -52
- package/dist/registry/scripts/build-scripts-generator.js +205 -0
- package/dist/registry/scripts/fraim-config.js +61 -0
- package/dist/registry/scripts/generic-issues-api.js +100 -0
- package/dist/registry/scripts/openapi-generator.js +664 -0
- package/dist/registry/scripts/performance/profile-server.js +390 -0
- package/dist/scripts/build-stub-registry.js +108 -0
- package/dist/src/cli/commands/doctor.js +5 -5
- package/dist/src/cli/commands/sync.js +33 -19
- package/dist/test-utils.js +96 -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 +2 -18
- package/dist/tests/test-chalk-resolution-issue.js +304 -0
- package/dist/tests/test-fraim-install-chalk-issue.js +254 -0
- package/dist/tests/test-npm-resolution-diagnostic.js +140 -0
- package/dist/tests/test-package-size.js +88 -0
- package/dist/tests/test-prep-issue.js +34 -1
- package/dist/tests/test-stub-registry.js +120 -0
- package/dist/tests/test-sync-stubs.js +143 -0
- package/package.json +6 -8
- package/registry/agent-guardrails.md +62 -62
- package/registry/scripts/code-quality-check.sh +559 -559
- package/registry/scripts/detect-tautological-tests.sh +38 -38
- package/registry/scripts/prep-issue.sh +61 -30
- package/registry/scripts/validate-openapi-limits.ts +366 -366
- package/registry/scripts/validate-test-coverage.ts +280 -280
- package/registry/scripts/verify-pr-comments.sh +70 -70
- package/registry/stubs/workflows/bootstrap/create-architecture.md +11 -0
- package/registry/stubs/workflows/bootstrap/detect-broken-windows.md +11 -0
- package/registry/stubs/workflows/bootstrap/evaluate-code-quality.md +11 -0
- package/registry/stubs/workflows/bootstrap/verify-test-coverage.md +11 -0
- package/registry/stubs/workflows/business-development/create-business-plan.md +11 -0
- package/registry/stubs/workflows/business-development/ideate-business-opportunity.md +11 -0
- package/registry/stubs/workflows/business-development/price-product.md +18 -0
- package/registry/stubs/workflows/convert-to-pdf.md +11 -0
- package/registry/stubs/workflows/customer-development/insight-analysis.md +11 -0
- package/registry/stubs/workflows/customer-development/insight-triage.md +11 -0
- package/registry/stubs/workflows/customer-development/interview-preparation.md +11 -0
- package/registry/stubs/workflows/customer-development/linkedin-outreach.md +11 -0
- package/registry/stubs/workflows/customer-development/strategic-brainstorming.md +11 -0
- package/registry/stubs/workflows/customer-development/thank-customers.md +11 -0
- package/registry/stubs/workflows/customer-development/weekly-newsletter.md +11 -0
- package/registry/stubs/workflows/deploy/cloud-deployment.md +11 -0
- package/registry/stubs/workflows/improve-fraim/contribute.md +11 -0
- package/registry/stubs/workflows/improve-fraim/file-issue.md +11 -0
- package/registry/stubs/workflows/marketing/content-creation.md +11 -0
- package/registry/stubs/workflows/marketing/hbr-article.md +11 -0
- package/registry/stubs/workflows/marketing/launch-checklist.md +11 -0
- package/registry/stubs/workflows/marketing/marketing-strategy.md +11 -0
- package/registry/stubs/workflows/marketing/storytelling.md +11 -0
- package/registry/stubs/workflows/performance/analyze-performance.md +11 -0
- package/registry/stubs/workflows/product-building/design.md +11 -0
- package/registry/stubs/workflows/product-building/implement.md +12 -0
- package/registry/stubs/workflows/product-building/iterate-on-pr-comments.md +11 -0
- package/registry/stubs/workflows/product-building/prep-issue.md +11 -0
- package/registry/stubs/workflows/product-building/prototype.md +11 -0
- package/registry/stubs/workflows/product-building/resolve.md +11 -0
- package/registry/stubs/workflows/product-building/retrospect.md +11 -0
- package/registry/stubs/workflows/product-building/spec.md +11 -0
- package/registry/stubs/workflows/product-building/test.md +11 -0
- package/registry/stubs/workflows/quality-assurance/browser-validation.md +11 -0
- package/registry/stubs/workflows/quality-assurance/iterative-improvement-cycle.md +11 -0
- package/registry/stubs/workflows/replicate/replicate-discovery.md +11 -0
- package/registry/stubs/workflows/replicate/replicate-to-issues.md +11 -0
- package/registry/stubs/workflows/reviewer/review-implementation-vs-design-spec.md +11 -0
- package/registry/stubs/workflows/reviewer/review-implementation-vs-feature-spec.md +11 -0
- package/registry/stubs/workflows/startup-credits/aws-activate-application.md +11 -0
- package/registry/stubs/workflows/startup-credits/google-cloud-application.md +11 -0
- package/registry/stubs/workflows/startup-credits/microsoft-azure-application.md +11 -0
- package/.github/workflows/ci.yml +0 -65
- package/.github/workflows/deploy-fraim.yml +0 -87
- package/.github/workflows/phase-change.yml +0 -251
- package/.github/workflows/status-change.yml +0 -68
- package/.github/workflows/sync-on-pr-review.yml +0 -66
- package/examples/simple-webapp/TESTING.md +0 -62
- package/examples/simple-webapp/example-test.ts +0 -186
- package/registry/github/workflows/ci.yml +0 -51
- package/registry/github/workflows/phase-change.yml +0 -251
- package/registry/github/workflows/status-change.yml +0 -68
- package/registry/github/workflows/sync-on-pr-review.yml +0 -66
- package/registry/mcp-template.jsonc +0 -29
- package/registry/rules/agent-success-criteria.md +0 -52
- package/registry/rules/agent-testing-guidelines.md +0 -502
- package/registry/rules/architecture.md +0 -52
- package/registry/rules/communication.md +0 -122
- package/registry/rules/continuous-learning.md +0 -55
- package/registry/rules/debugging-multitenancy-issues.md +0 -85
- package/registry/rules/ephemeral-execution.md +0 -57
- package/registry/rules/git-safe-commands.md +0 -34
- package/registry/rules/hitl-ppe-record-analysis.md +0 -302
- package/registry/rules/integrity-and-test-ethics.md +0 -275
- package/registry/rules/local-development.md +0 -254
- package/registry/rules/merge-requirements.md +0 -231
- package/registry/rules/simplicity.md +0 -118
- package/registry/rules/software-development-lifecycle.md +0 -105
- package/registry/rules/spike-first-development.md +0 -205
- package/registry/rules/successful-debugging-patterns.md +0 -491
- package/registry/rules/telemetry.md +0 -67
- package/registry/templates/bootstrap/ARCHITECTURE-TEMPLATE.md +0 -53
- package/registry/templates/bootstrap/CODE-QUALITY-REPORT-TEMPLATE.md +0 -37
- package/registry/templates/bootstrap/TEST-COVERAGE-REPORT-TEMPLATE.md +0 -35
- package/registry/templates/business-development/IDEATION-REPORT-TEMPLATE.md +0 -29
- package/registry/templates/business-development/PRICING-STRATEGY-TEMPLATE.md +0 -126
- package/registry/templates/customer-development/customer-interview-template.md +0 -99
- package/registry/templates/customer-development/follow-up-email-templates.md +0 -132
- package/registry/templates/customer-development/insight-analysis-template.md +0 -74
- package/registry/templates/customer-development/strategic-recommendations-template.md +0 -53
- package/registry/templates/customer-development/thank-you-email-template.html +0 -124
- package/registry/templates/customer-development/thank-you-note-template.md +0 -16
- package/registry/templates/customer-development/triage-log-template.md +0 -278
- package/registry/templates/customer-development/weekly-newsletter-template.html +0 -204
- package/registry/templates/evidence/Design-Evidence.md +0 -30
- package/registry/templates/evidence/Implementation-BugEvidence.md +0 -86
- package/registry/templates/evidence/Implementation-FeatureEvidence.md +0 -121
- package/registry/templates/evidence/Spec-Evidence.md +0 -19
- package/registry/templates/help/HelpNeeded.md +0 -14
- package/registry/templates/marketing/HBR-ARTICLE-TEMPLATE.md +0 -66
- package/registry/templates/replicate/implementation-checklist.md +0 -39
- package/registry/templates/replicate/use-cases-template.md +0 -88
- package/registry/templates/retrospective/RETROSPECTIVE-TEMPLATE.md +0 -55
- package/registry/templates/specs/BUGSPEC-TEMPLATE.md +0 -37
- package/registry/templates/specs/FEATURESPEC-TEMPLATE.md +0 -29
- package/registry/templates/specs/TECHSPEC-TEMPLATE.md +0 -39
- package/registry/workflows/bootstrap/create-architecture.md +0 -38
- package/registry/workflows/bootstrap/evaluate-code-quality.md +0 -36
- package/registry/workflows/bootstrap/verify-test-coverage.md +0 -37
- package/registry/workflows/business-development/create-business-plan.md +0 -737
- package/registry/workflows/business-development/ideate-business-opportunity.md +0 -55
- package/registry/workflows/business-development/price-product.md +0 -325
- package/registry/workflows/convert-to-pdf.md +0 -235
- package/registry/workflows/customer-development/insight-analysis.md +0 -156
- package/registry/workflows/customer-development/insight-triage.md +0 -933
- package/registry/workflows/customer-development/interview-preparation.md +0 -421
- package/registry/workflows/customer-development/linkedin-outreach.md +0 -593
- package/registry/workflows/customer-development/strategic-brainstorming.md +0 -146
- package/registry/workflows/customer-development/thank-customers.md +0 -203
- package/registry/workflows/customer-development/weekly-newsletter.md +0 -366
- package/registry/workflows/deploy/cloud-deployment.md +0 -310
- package/registry/workflows/improve-fraim/contribute.md +0 -32
- package/registry/workflows/improve-fraim/file-issue.md +0 -32
- package/registry/workflows/marketing/content-creation.md +0 -37
- package/registry/workflows/marketing/hbr-article.md +0 -73
- package/registry/workflows/marketing/launch-checklist.md +0 -37
- package/registry/workflows/marketing/marketing-strategy.md +0 -45
- package/registry/workflows/performance/analyze-performance.md +0 -65
- package/registry/workflows/product-building/design.md +0 -130
- package/registry/workflows/product-building/implement.md +0 -315
- package/registry/workflows/product-building/iterate-on-pr-comments.md +0 -70
- package/registry/workflows/product-building/prep-issue.md +0 -43
- package/registry/workflows/product-building/prototype.md +0 -60
- package/registry/workflows/product-building/resolve.md +0 -164
- package/registry/workflows/product-building/retrospect.md +0 -86
- package/registry/workflows/product-building/spec.md +0 -117
- package/registry/workflows/product-building/test.md +0 -120
- package/registry/workflows/quality-assurance/browser-validation.md +0 -221
- package/registry/workflows/quality-assurance/iterative-improvement-cycle.md +0 -562
- package/registry/workflows/replicate/replicate-discovery.md +0 -336
- package/registry/workflows/replicate/replicate-to-issues.md +0 -319
- package/registry/workflows/reviewer/review-implementation-vs-design-spec.md +0 -632
- package/registry/workflows/reviewer/review-implementation-vs-feature-spec.md +0 -669
- package/registry/workflows/startup-credits/aws-activate-application.md +0 -535
- package/registry/workflows/startup-credits/google-cloud-application.md +0 -647
- package/registry/workflows/startup-credits/microsoft-azure-application.md +0 -538
package/bin/fraim.js
CHANGED
|
@@ -1,55 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
/**
|
|
4
|
+
* FRAIM CLI Entry Point
|
|
5
|
+
* This wrapper loads and executes the compiled CLI from dist/
|
|
6
|
+
*/
|
|
5
7
|
|
|
6
|
-
|
|
7
|
-
const fs = require('fs');
|
|
8
|
-
|
|
9
|
-
// Point to the compiled CLI file
|
|
10
|
-
// Try multiple possible locations for the CLI
|
|
11
|
-
const possiblePaths = [
|
|
12
|
-
path.join(__dirname, '..', 'dist', 'src', 'cli', 'fraim.js'),
|
|
13
|
-
path.join(__dirname, 'dist', 'src', 'cli', 'fraim.js'),
|
|
14
|
-
path.join(__dirname, '..', 'src', 'cli', 'fraim.js')
|
|
15
|
-
];
|
|
16
|
-
|
|
17
|
-
let cliPath = null;
|
|
18
|
-
for (const testPath of possiblePaths) {
|
|
19
|
-
if (fs.existsSync(testPath)) {
|
|
20
|
-
cliPath = testPath;
|
|
21
|
-
break;
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
function loadCli() {
|
|
26
|
-
if (!cliPath) {
|
|
27
|
-
const error = new Error('Could not find FRAIM CLI at any of these locations:\n' +
|
|
28
|
-
possiblePaths.map(p => ' - ' + p).join('\n') +
|
|
29
|
-
'\nMake sure to run "npm run build" first');
|
|
30
|
-
error.code = 'CLI_NOT_FOUND';
|
|
31
|
-
throw error;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
try {
|
|
35
|
-
return require(cliPath);
|
|
36
|
-
} catch (error) {
|
|
37
|
-
const newError = new Error('Error loading FRAIM CLI: ' + error.message + '\nCLI path: ' + cliPath);
|
|
38
|
-
newError.code = 'CLI_LOAD_ERROR';
|
|
39
|
-
newError.originalError = error;
|
|
40
|
-
throw newError;
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
// If this file is being executed directly (not required), run the CLI
|
|
45
|
-
if (require.main === module) {
|
|
46
|
-
try {
|
|
47
|
-
loadCli();
|
|
48
|
-
} catch (error) {
|
|
49
|
-
console.error('Error:', error.message);
|
|
50
|
-
process.exit(1);
|
|
51
|
-
}
|
|
52
|
-
} else {
|
|
53
|
-
// If this file is being required, export the loadCli function
|
|
54
|
-
module.exports = { loadCli, cliPath };
|
|
55
|
-
}
|
|
8
|
+
require('../dist/src/cli/fraim.js');
|
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
/**
|
|
4
|
+
* FRAIM Build Scripts Generator
|
|
5
|
+
*
|
|
6
|
+
* Generates generic build scripts and validation patterns.
|
|
7
|
+
* These are generic enough to apply to any project.
|
|
8
|
+
*
|
|
9
|
+
* Usage:
|
|
10
|
+
* npx tsx scripts/build-scripts-generator.ts
|
|
11
|
+
*/
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
exports.generatePackageScripts = generatePackageScripts;
|
|
14
|
+
exports.generateCodeQualityScript = generateCodeQualityScript;
|
|
15
|
+
exports.generateCopyScripts = generateCopyScripts;
|
|
16
|
+
exports.generateBuildScripts = generateBuildScripts;
|
|
17
|
+
const fs_1 = require("fs");
|
|
18
|
+
const path_1 = require("path");
|
|
19
|
+
const config_loader_js_1 = require("../../src/fraim/config-loader.js");
|
|
20
|
+
/**
|
|
21
|
+
* Generate package.json scripts section
|
|
22
|
+
*/
|
|
23
|
+
function generatePackageScripts(config) {
|
|
24
|
+
return {
|
|
25
|
+
"build": "tsc && npm run validate:openapi",
|
|
26
|
+
"validate:openapi": "npx tsx " + "reg" + "istry/scripts/validate-openapi-limits.ts",
|
|
27
|
+
"start": "node dist/src/server.js",
|
|
28
|
+
"start:mcp": "node dist/src/mcp-server.js",
|
|
29
|
+
"dev": "npx tsx --watch src/server.ts",
|
|
30
|
+
"dev:mcp": "tsx src/mcp-server.ts",
|
|
31
|
+
"generate:openapi": "npx tsx " + "reg" + "istry/scripts/openapi-generator.ts",
|
|
32
|
+
"test": "npx tsx --test test*.ts",
|
|
33
|
+
"lint": "eslint *.ts",
|
|
34
|
+
"lint:fix": "eslint *.ts --fix"
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Generate code quality check script (generic version)
|
|
39
|
+
*/
|
|
40
|
+
function generateCodeQualityScript(outputDir) {
|
|
41
|
+
if (!(0, fs_1.existsSync)(outputDir)) {
|
|
42
|
+
(0, fs_1.mkdirSync)(outputDir, { recursive: true });
|
|
43
|
+
}
|
|
44
|
+
const scriptContent = `#!/bin/bash
|
|
45
|
+
|
|
46
|
+
# FRAIM Generic Code Quality Check
|
|
47
|
+
# Validates code quality, build, and ChatGPT limits
|
|
48
|
+
|
|
49
|
+
set -e
|
|
50
|
+
|
|
51
|
+
MODE=\${1:-full}
|
|
52
|
+
FAILED=0
|
|
53
|
+
WARNINGS=0
|
|
54
|
+
|
|
55
|
+
echo "================================================"
|
|
56
|
+
echo "🔍 CODE QUALITY CHECK ($MODE mode)"
|
|
57
|
+
echo "================================================"
|
|
58
|
+
echo ""
|
|
59
|
+
|
|
60
|
+
# Build check
|
|
61
|
+
if [ "$MODE" = "full" ] || [ "$MODE" = "build" ]; then
|
|
62
|
+
echo "📦 Building project..."
|
|
63
|
+
if npm run build; then
|
|
64
|
+
echo "✅ Build passed"
|
|
65
|
+
else
|
|
66
|
+
echo "❌ Build failed"
|
|
67
|
+
FAILED=1
|
|
68
|
+
fi
|
|
69
|
+
echo ""
|
|
70
|
+
fi
|
|
71
|
+
|
|
72
|
+
# Lint check
|
|
73
|
+
if [ "$MODE" = "full" ] || [ "$MODE" = "lint" ]; then
|
|
74
|
+
echo "🔍 Linting code..."
|
|
75
|
+
if npm run lint; then
|
|
76
|
+
echo "✅ Lint passed"
|
|
77
|
+
else
|
|
78
|
+
echo "⚠️ Lint warnings (non-blocking)"
|
|
79
|
+
WARNINGS=1
|
|
80
|
+
fi
|
|
81
|
+
echo ""
|
|
82
|
+
fi
|
|
83
|
+
|
|
84
|
+
# OpenAPI validation (ChatGPT limits)
|
|
85
|
+
if [ "$MODE" = "full" ] || [ "$MODE" = "openapi" ]; then
|
|
86
|
+
echo "📋 Validating OpenAPI and ChatGPT limits..."
|
|
87
|
+
if npm run validate:openapi; then
|
|
88
|
+
echo "✅ OpenAPI validation passed"
|
|
89
|
+
else
|
|
90
|
+
echo "❌ OpenAPI validation failed"
|
|
91
|
+
FAILED=1
|
|
92
|
+
fi
|
|
93
|
+
echo ""
|
|
94
|
+
fi
|
|
95
|
+
|
|
96
|
+
# Summary
|
|
97
|
+
echo "================================================"
|
|
98
|
+
echo "📊 QUALITY CHECK SUMMARY ($MODE mode)"
|
|
99
|
+
echo "================================================"
|
|
100
|
+
echo ""
|
|
101
|
+
|
|
102
|
+
if [ $FAILED -eq 1 ]; then
|
|
103
|
+
echo "❌ CHECKS FAILED"
|
|
104
|
+
echo ""
|
|
105
|
+
echo "Fix the errors above before proceeding."
|
|
106
|
+
exit 1
|
|
107
|
+
elif [ $WARNINGS -eq 1 ]; then
|
|
108
|
+
echo "⚠️ CHECKS PASSED WITH WARNINGS"
|
|
109
|
+
echo ""
|
|
110
|
+
echo "Review warnings above."
|
|
111
|
+
exit 0
|
|
112
|
+
else
|
|
113
|
+
echo "✅ ALL CHECKS PASSED"
|
|
114
|
+
echo ""
|
|
115
|
+
exit 0
|
|
116
|
+
fi
|
|
117
|
+
`;
|
|
118
|
+
const scriptPath = (0, path_1.join)(outputDir, 'code-quality-check.sh');
|
|
119
|
+
(0, fs_1.writeFileSync)(scriptPath, scriptContent);
|
|
120
|
+
// Make executable (Unix)
|
|
121
|
+
if (process.platform !== 'win32') {
|
|
122
|
+
const { execSync } = require('child_process');
|
|
123
|
+
execSync(`chmod +x ${scriptPath}`);
|
|
124
|
+
}
|
|
125
|
+
console.log(`✅ Generated code quality check script at ${scriptPath}`);
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Generate build copy scripts (generic)
|
|
129
|
+
*/
|
|
130
|
+
function generateCopyScripts(outputDir) {
|
|
131
|
+
if (!(0, fs_1.existsSync)(outputDir)) {
|
|
132
|
+
(0, fs_1.mkdirSync)(outputDir, { recursive: true });
|
|
133
|
+
}
|
|
134
|
+
// Copy AI agents script (if .fraim exists)
|
|
135
|
+
const copyAiAgents = `#!/usr/bin/env node
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* Copy registry directory to dist
|
|
139
|
+
* Generic build script for FRAIM projects
|
|
140
|
+
*/
|
|
141
|
+
|
|
142
|
+
const fs = require('fs');
|
|
143
|
+
const path = require('path');
|
|
144
|
+
|
|
145
|
+
const sourceDir = path.join(__dirname, '..', '..', 'registry');
|
|
146
|
+
const destDir = path.join(__dirname, '..', '..', 'dist', 'registry');
|
|
147
|
+
|
|
148
|
+
if (fs.existsSync(sourceDir)) {
|
|
149
|
+
// Recursive copy
|
|
150
|
+
function copyRecursive(src, dest) {
|
|
151
|
+
if (!fs.existsSync(dest)) {
|
|
152
|
+
fs.mkdirSync(dest, { recursive: true });
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
const entries = fs.readdirSync(src, { withFileTypes: true });
|
|
156
|
+
|
|
157
|
+
for (const entry of entries) {
|
|
158
|
+
const srcPath = path.join(src, entry.name);
|
|
159
|
+
const destPath = path.join(dest, entry.name);
|
|
160
|
+
|
|
161
|
+
if (entry.isDirectory()) {
|
|
162
|
+
copyRecursive(srcPath, destPath);
|
|
163
|
+
} else {
|
|
164
|
+
fs.copyFileSync(srcPath, destPath);
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
copyRecursive(sourceDir, destDir);
|
|
170
|
+
console.log('✅ Copied registry to dist/registry');
|
|
171
|
+
} else {
|
|
172
|
+
console.log('ℹ️ registry directory not found, skipping');
|
|
173
|
+
}
|
|
174
|
+
`;
|
|
175
|
+
(0, fs_1.writeFileSync)((0, path_1.join)(outputDir, 'copy-ai-agents.js'), copyAiAgents);
|
|
176
|
+
console.log(`✅ Generated copy-ai-agents.js`);
|
|
177
|
+
}
|
|
178
|
+
/**
|
|
179
|
+
* Main generator function
|
|
180
|
+
*/
|
|
181
|
+
function generateBuildScripts(config, outputDir = "scr" + "ipts/build") {
|
|
182
|
+
console.log('🚀 FRAIM Build Scripts Generator\n');
|
|
183
|
+
console.log(`📁 Output directory: ${outputDir}\n`);
|
|
184
|
+
// Ensure output directory exists
|
|
185
|
+
if (!(0, fs_1.existsSync)(outputDir)) {
|
|
186
|
+
(0, fs_1.mkdirSync)(outputDir, { recursive: true });
|
|
187
|
+
}
|
|
188
|
+
// Generate code quality check
|
|
189
|
+
console.log('📝 Generating code quality check script...');
|
|
190
|
+
generateCodeQualityScript(outputDir);
|
|
191
|
+
// Generate build scripts
|
|
192
|
+
console.log('\n📝 Generating build scripts...');
|
|
193
|
+
generateCopyScripts(outputDir);
|
|
194
|
+
console.log('\n✅ Build scripts generation complete!');
|
|
195
|
+
console.log('\n📋 Next steps:');
|
|
196
|
+
console.log('1. Add scripts to package.json');
|
|
197
|
+
console.log('2. Run: npm run validate:openapi');
|
|
198
|
+
console.log('3. Run: ./scripts/build/code-quality-check.sh');
|
|
199
|
+
}
|
|
200
|
+
// Run if executed directly
|
|
201
|
+
// @ts-ignore
|
|
202
|
+
if (import.meta.url === `file://${process.argv[1]}`) {
|
|
203
|
+
const config = (0, config_loader_js_1.loadFraimConfig)();
|
|
204
|
+
generateBuildScripts(config);
|
|
205
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.fraimConfig = void 0;
|
|
4
|
+
exports.formatExecutiveDisplayName = formatExecutiveDisplayName;
|
|
5
|
+
exports.formatPersonaSignature = formatPersonaSignature;
|
|
6
|
+
const config_loader_1 = require("../../src/fraim/config-loader");
|
|
7
|
+
const config = (0, config_loader_1.loadFraimConfig)();
|
|
8
|
+
const envOr = (keys, fallback) => {
|
|
9
|
+
for (const key of keys) {
|
|
10
|
+
const value = process.env[key];
|
|
11
|
+
if (value && value.length) {
|
|
12
|
+
return value;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
return fallback;
|
|
16
|
+
};
|
|
17
|
+
const personaName = config.persona.name;
|
|
18
|
+
const personaDisplayNameDefault = config.persona.displayNamePattern.replace('{executiveName}', 'Your');
|
|
19
|
+
exports.fraimConfig = {
|
|
20
|
+
repoOwner: config.git.repoOwner || 'mathursrus',
|
|
21
|
+
repoName: config.git.repoName || 'fraim-repo',
|
|
22
|
+
projectName: config.project.name,
|
|
23
|
+
personaName,
|
|
24
|
+
personaPronouns: envOr(['FRAIM_PERSONA_PRONOUNS'], 'they/them'), // Could add to config if needed
|
|
25
|
+
personaDisplayName: envOr(['FRAIM_PERSONA_DISPLAY_NAME'], personaDisplayNameDefault),
|
|
26
|
+
personaDisplayNamePattern: config.persona.displayNamePattern,
|
|
27
|
+
personaThankYouSignature: config.persona.emailSignature,
|
|
28
|
+
defaultEmail: envOr(['FRAIM_DEFAULT_EMAIL'], 'agent@example.com'),
|
|
29
|
+
prodDefaultEmail: envOr(['PROD_FRAIM_DEFAULT_EMAIL'], 'agent@example.com'),
|
|
30
|
+
defaultAccessToken: envOr(['FRAIM_DEFAULT_ACCESS_TOKEN'], ''),
|
|
31
|
+
defaultRefreshToken: envOr(['FRAIM_DEFAULT_REFRESH_TOKEN'], ''),
|
|
32
|
+
prodAccessToken: envOr(['PROD_FRAIM_DEFAULT_ACCESS_TOKEN'], ''),
|
|
33
|
+
prodRefreshToken: envOr(['PROD_FRAIM_DEFAULT_REFRESH_TOKEN'], ''),
|
|
34
|
+
defaultOAuthClientId: envOr(['FRAIM_DEFAULT_OAUTH_CLIENT_ID'], ''),
|
|
35
|
+
defaultOAuthClientSecret: envOr(['FRAIM_DEFAULT_OAUTH_CLIENT_SECRET'], ''),
|
|
36
|
+
prodOAuthClientId: envOr(['PROD_FRAIM_DEFAULT_OAUTH_CLIENT_ID'], ''),
|
|
37
|
+
prodOAuthClientSecret: envOr(['PROD_FRAIM_DEFAULT_OAUTH_CLIENT_SECRET'], ''),
|
|
38
|
+
identityCollection: config.database?.identityCollection || 'Identity',
|
|
39
|
+
executiveCollection: config.database?.executiveCollection || 'Executive',
|
|
40
|
+
newsletterTitle: config.marketing?.newsletterTitle || 'Weekly Update',
|
|
41
|
+
newsletterCtaText: config.marketing?.newsletterCtaText || 'Learn More',
|
|
42
|
+
newsletterUrl: config.marketing?.newsletterUrl || envOr(['FRAIM_NEWSLETTER_URL'], ''),
|
|
43
|
+
issueRepoUrl: config.git.url || `https://github.com/${config.git.repoOwner}/${config.git.repoName}.git`,
|
|
44
|
+
identityTokensCollection: config.database?.tokensCollection || 'Tokens',
|
|
45
|
+
webAppUrl: config.marketing?.websiteUrl || envOr(['FRAIM_WEB_APP_URL'], 'http://localhost:3000'),
|
|
46
|
+
chatUrl: config.marketing?.chatUrl || envOr(['FRAIM_CHAT_URL'], ''),
|
|
47
|
+
azure: {
|
|
48
|
+
prodAppName: envOr(['FRAIM_AZURE_PROD_APP_NAME'], 'fraim-app-prod'),
|
|
49
|
+
prodResourceGroup: envOr(['FRAIM_AZURE_PROD_RESOURCE_GROUP'], 'fraim-prod-rg'),
|
|
50
|
+
preprodAppName: envOr(['FRAIM_AZURE_PREPROD_APP_NAME'], 'fraim-app-pre-prod'),
|
|
51
|
+
preprodResourceGroup: envOr(['FRAIM_AZURE_PREPROD_RESOURCE_GROUP'], 'fraim-pre-prod-rg'),
|
|
52
|
+
localAppName: envOr(['FRAIM_AZURE_LOCAL_APP_NAME'], 'local'),
|
|
53
|
+
localResourceGroup: envOr(['FRAIM_AZURE_LOCAL_RESOURCE_GROUP'], 'local')
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
function formatExecutiveDisplayName(executiveName) {
|
|
57
|
+
return config.persona.displayNamePattern.replace('{executiveName}', executiveName);
|
|
58
|
+
}
|
|
59
|
+
function formatPersonaSignature() {
|
|
60
|
+
return `With gratitude,\n${exports.fraimConfig.personaThankYouSignature}\n${personaName} - Your AI Executive Assistant\n\n`;
|
|
61
|
+
}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* FRAIM Generic Issues API
|
|
4
|
+
*
|
|
5
|
+
* Generic issue filing endpoint that works for any project.
|
|
6
|
+
* Can be invoked through ChatGPT OpenAPI or MCP.
|
|
7
|
+
*
|
|
8
|
+
* Usage:
|
|
9
|
+
* 1. Import this file
|
|
10
|
+
* 2. Mount the router in your Express app
|
|
11
|
+
* 3. Configure GitHub repository in .fraim/config.json
|
|
12
|
+
*/
|
|
13
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
+
exports.issuesRouter = void 0;
|
|
15
|
+
const express_1 = require("express");
|
|
16
|
+
const issues_js_1 = require("../../src/fraim/issues.js");
|
|
17
|
+
const config_loader_js_1 = require("../../src/fraim/config-loader.js");
|
|
18
|
+
const issuesRouter = (0, express_1.Router)();
|
|
19
|
+
exports.issuesRouter = issuesRouter;
|
|
20
|
+
/**
|
|
21
|
+
* POST /issues/create - Create a GitHub issue
|
|
22
|
+
*
|
|
23
|
+
* Generic endpoint that works for any FRAIM project.
|
|
24
|
+
* Repository owner and name are read from .fraim/config.json
|
|
25
|
+
*/
|
|
26
|
+
issuesRouter.post('/create', async (req, res) => {
|
|
27
|
+
try {
|
|
28
|
+
// Load project configuration
|
|
29
|
+
const config = (0, config_loader_js_1.loadFraimConfig)();
|
|
30
|
+
const repoOwner = config.git?.repoOwner || process.env.GITHUB_OWNER || 'your-org';
|
|
31
|
+
const repoName = config.git?.repoName || process.env.GITHUB_REPO || 'your-repo';
|
|
32
|
+
// Get user context (if available - project-specific)
|
|
33
|
+
// Projects can customize this based on their auth system
|
|
34
|
+
const userId = req.userContext?.userId ||
|
|
35
|
+
req.executiveContext?.executiveId ||
|
|
36
|
+
req.headers['x-user-id'];
|
|
37
|
+
const userEmail = req.userContext?.email ||
|
|
38
|
+
req.executiveContext?.executiveEmail ||
|
|
39
|
+
req.headers['x-user-email'];
|
|
40
|
+
const userName = req.userContext?.name ||
|
|
41
|
+
req.executiveContext?.executiveName ||
|
|
42
|
+
req.headers['x-user-name'];
|
|
43
|
+
const { title, body, labels } = req.body;
|
|
44
|
+
if (!title || !body) {
|
|
45
|
+
return res.status(400).json({
|
|
46
|
+
success: false,
|
|
47
|
+
error: 'Missing required fields: title, body'
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
// Check if GitHub token is configured
|
|
51
|
+
if (!process.env.GITHUB_TOKEN && !process.env.GIT_TOKEN && !process.env.GITHUB_PAT) {
|
|
52
|
+
return res.status(500).json({
|
|
53
|
+
success: false,
|
|
54
|
+
error: 'GitHub integration not configured. Please set GITHUB_TOKEN environment variable.'
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
// Build issue body with user context (if available)
|
|
58
|
+
let issueBody = body;
|
|
59
|
+
if (userName || userEmail || userId) {
|
|
60
|
+
issueBody = `**Reported by:** ${userName || 'Unknown'}${userEmail ? ` (${userEmail})` : ''}${userId ? `\n**User ID:** ${userId}` : ''}\n\n**Issue Details:**\n${body}\n\n---\n*This issue was automatically created through the API.*`;
|
|
61
|
+
}
|
|
62
|
+
// Create the issue using shared function
|
|
63
|
+
const result = await (0, issues_js_1.fileFraimIssue)({
|
|
64
|
+
title: title,
|
|
65
|
+
body: issueBody,
|
|
66
|
+
labels: labels || ['user-reported']
|
|
67
|
+
});
|
|
68
|
+
if (!result.success) {
|
|
69
|
+
return res.status(500).json({
|
|
70
|
+
success: false,
|
|
71
|
+
error: result.message
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
return res.json({
|
|
75
|
+
success: true,
|
|
76
|
+
message: 'Issue created successfully',
|
|
77
|
+
issueNumber: result.issueNumber,
|
|
78
|
+
issueUrl: result.htmlUrl,
|
|
79
|
+
title: title
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
catch (error) {
|
|
83
|
+
console.error('❌ Unexpected error creating Git issue:', error);
|
|
84
|
+
return res.status(500).json({
|
|
85
|
+
success: false,
|
|
86
|
+
error: error.message || 'Failed to create Git issue'
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
});
|
|
90
|
+
/**
|
|
91
|
+
* GET /issues/list - List issues
|
|
92
|
+
*
|
|
93
|
+
* Not implemented in this generic version.
|
|
94
|
+
*/
|
|
95
|
+
issuesRouter.get('/list', async (req, res) => {
|
|
96
|
+
return res.status(501).json({
|
|
97
|
+
success: false,
|
|
98
|
+
error: 'Listing issues is not supported in this generic API version yet.'
|
|
99
|
+
});
|
|
100
|
+
});
|