fraim-framework 2.0.27 → 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.
Files changed (98) hide show
  1. package/.github/workflows/deploy-fraim.yml +1 -1
  2. package/dist/registry/scripts/build-scripts-generator.js +205 -0
  3. package/dist/registry/scripts/cleanup-branch.js +258 -0
  4. package/dist/registry/scripts/evaluate-code-quality.js +66 -0
  5. package/dist/registry/scripts/exec-with-timeout.js +142 -0
  6. package/dist/registry/scripts/fraim-config.js +61 -0
  7. package/dist/registry/scripts/generate-engagement-emails.js +630 -0
  8. package/dist/registry/scripts/generic-issues-api.js +100 -0
  9. package/dist/registry/scripts/newsletter-helpers.js +731 -0
  10. package/dist/registry/scripts/openapi-generator.js +664 -0
  11. package/dist/registry/scripts/performance/profile-server.js +390 -0
  12. package/dist/registry/scripts/run-thank-you-workflow.js +92 -0
  13. package/dist/registry/scripts/send-newsletter-simple.js +85 -0
  14. package/dist/registry/scripts/send-thank-you-emails.js +54 -0
  15. package/dist/registry/scripts/validate-openapi-limits.js +311 -0
  16. package/dist/registry/scripts/validate-test-coverage.js +262 -0
  17. package/dist/registry/scripts/verify-test-coverage.js +66 -0
  18. package/dist/src/cli/commands/init.js +14 -14
  19. package/dist/src/cli/commands/sync.js +4 -4
  20. package/dist/src/cli/fraim.js +24 -22
  21. package/dist/src/cli/setup/first-run.js +13 -6
  22. package/dist/src/fraim/db-service.js +26 -15
  23. package/dist/src/fraim/issues.js +67 -0
  24. package/dist/src/fraim-mcp-server.js +272 -18
  25. package/dist/src/utils/git-utils.js +1 -1
  26. package/dist/tests/debug-tools.js +79 -0
  27. package/dist/tests/esm-compat.js +11 -0
  28. package/dist/tests/test-chalk-esm-issue.js +159 -0
  29. package/dist/tests/test-chalk-real-world.js +265 -0
  30. package/dist/tests/test-chalk-regression.js +327 -0
  31. package/dist/tests/test-chalk-resolution-issue.js +304 -0
  32. package/dist/tests/test-fraim-install-chalk-issue.js +254 -0
  33. package/dist/tests/test-fraim-issues.js +59 -0
  34. package/dist/tests/test-genericization.js +1 -1
  35. package/dist/tests/test-mcp-connection.js +166 -0
  36. package/dist/tests/test-mcp-issue-integration.js +144 -0
  37. package/dist/tests/test-mcp-lifecycle-methods.js +312 -0
  38. package/dist/tests/test-node-compatibility.js +71 -0
  39. package/dist/tests/test-npm-install.js +66 -0
  40. package/dist/tests/test-npm-resolution-diagnostic.js +140 -0
  41. package/dist/tests/test-session-rehydration.js +145 -0
  42. package/dist/tests/test-standalone.js +2 -8
  43. package/dist/tests/test-telemetry.js +190 -0
  44. package/package.json +10 -8
  45. package/registry/agent-guardrails.md +62 -54
  46. package/registry/rules/agent-success-criteria.md +52 -0
  47. package/registry/rules/agent-testing-guidelines.md +502 -502
  48. package/registry/rules/communication.md +121 -121
  49. package/registry/rules/continuous-learning.md +54 -54
  50. package/registry/rules/ephemeral-execution.md +10 -5
  51. package/registry/rules/hitl-ppe-record-analysis.md +302 -302
  52. package/registry/rules/local-development.md +251 -251
  53. package/registry/rules/software-development-lifecycle.md +104 -104
  54. package/registry/rules/successful-debugging-patterns.md +482 -478
  55. package/registry/rules/telemetry.md +67 -0
  56. package/registry/scripts/build-scripts-generator.ts +216 -215
  57. package/registry/scripts/cleanup-branch.ts +303 -284
  58. package/registry/scripts/code-quality-check.sh +559 -559
  59. package/registry/scripts/detect-tautological-tests.sh +38 -38
  60. package/registry/scripts/evaluate-code-quality.ts +1 -1
  61. package/registry/scripts/generate-engagement-emails.ts +744 -744
  62. package/registry/scripts/generic-issues-api.ts +110 -150
  63. package/registry/scripts/newsletter-helpers.ts +874 -874
  64. package/registry/scripts/openapi-generator.ts +695 -693
  65. package/registry/scripts/performance/profile-server.ts +5 -3
  66. package/registry/scripts/prep-issue.sh +468 -455
  67. package/registry/scripts/validate-openapi-limits.ts +366 -365
  68. package/registry/scripts/validate-test-coverage.ts +280 -280
  69. package/registry/scripts/verify-pr-comments.sh +70 -70
  70. package/registry/scripts/verify-test-coverage.ts +1 -1
  71. package/registry/templates/bootstrap/ARCHITECTURE-TEMPLATE.md +53 -53
  72. package/registry/templates/evidence/Implementation-BugEvidence.md +85 -85
  73. package/registry/templates/evidence/Implementation-FeatureEvidence.md +120 -120
  74. package/registry/templates/marketing/HBR-ARTICLE-TEMPLATE.md +66 -0
  75. package/registry/workflows/bootstrap/create-architecture.md +2 -2
  76. package/registry/workflows/bootstrap/evaluate-code-quality.md +3 -3
  77. package/registry/workflows/bootstrap/verify-test-coverage.md +2 -2
  78. package/registry/workflows/customer-development/insight-analysis.md +156 -156
  79. package/registry/workflows/customer-development/interview-preparation.md +421 -421
  80. package/registry/workflows/customer-development/strategic-brainstorming.md +146 -146
  81. package/registry/workflows/customer-development/thank-customers.md +193 -191
  82. package/registry/workflows/customer-development/weekly-newsletter.md +362 -352
  83. package/registry/workflows/improve-fraim/contribute.md +32 -0
  84. package/registry/workflows/improve-fraim/file-issue.md +32 -0
  85. package/registry/workflows/marketing/hbr-article.md +73 -0
  86. package/registry/workflows/performance/analyze-performance.md +63 -59
  87. package/registry/workflows/product-building/design.md +3 -2
  88. package/registry/workflows/product-building/implement.md +4 -3
  89. package/registry/workflows/product-building/prep-issue.md +28 -17
  90. package/registry/workflows/product-building/resolve.md +3 -2
  91. package/registry/workflows/product-building/retrospect.md +3 -2
  92. package/registry/workflows/product-building/spec.md +5 -4
  93. package/registry/workflows/product-building/test.md +3 -2
  94. package/registry/workflows/quality-assurance/iterative-improvement-cycle.md +562 -562
  95. package/registry/workflows/replicate/website-discovery-analysis.md +3 -3
  96. package/registry/workflows/reviewer/review-implementation-vs-design-spec.md +632 -632
  97. package/registry/workflows/reviewer/review-implementation-vs-feature-spec.md +669 -669
  98. package/tsconfig.json +2 -1
@@ -1,150 +1,110 @@
1
- /**
2
- * FRAIM Generic Issues API
3
- *
4
- * Generic issue filing endpoint that works for any project.
5
- * Can be invoked through ChatGPT OpenAPI or MCP.
6
- *
7
- * Usage:
8
- * 1. Import this file
9
- * 2. Mount the router in your Express app
10
- * 3. Configure GitHub repository in .fraim/config.json
11
- */
12
-
13
- import { Router, Request, Response } from 'express';
14
- import { githubIssuesService } from '../../../src/issues/github-issues-service.js';
15
- import { loadFraimConfig } from '../../../src/fraim/config-loader.js';
16
-
17
- const issuesRouter = Router();
18
-
19
- /**
20
- * POST /issues/create - Create a GitHub issue
21
- *
22
- * Generic endpoint that works for any FRAIM project.
23
- * Repository owner and name are read from .fraim/config.json
24
- */
25
- issuesRouter.post('/create', async (req: Request, res: Response) => {
26
- try {
27
- // Load project configuration
28
- const config = loadFraimConfig();
29
- const repoOwner = config.git?.repoOwner || process.env.GITHUB_OWNER || 'your-org';
30
- const repoName = config.git?.repoName || process.env.GITHUB_REPO || 'your-repo';
31
-
32
- // Get user context (if available - project-specific)
33
- // Projects can customize this based on their auth system
34
- const userId = (req as any).userContext?.userId ||
35
- (req as any).executiveContext?.executiveId ||
36
- req.headers['x-user-id'] as string;
37
- const userEmail = (req as any).userContext?.email ||
38
- (req as any).executiveContext?.executiveEmail ||
39
- req.headers['x-user-email'] as string;
40
- const userName = (req as any).userContext?.name ||
41
- (req as any).executiveContext?.executiveName ||
42
- req.headers['x-user-name'] as string;
43
-
44
- const { title, body, labels } = req.body;
45
-
46
- if (!title || !body) {
47
- return res.status(400).json({
48
- success: false,
49
- error: 'Missing required fields: title, body'
50
- });
51
- }
52
-
53
- // Check if GitHub token is configured
54
- if (!githubIssuesService.isAvailable()) {
55
- return res.status(500).json({
56
- success: false,
57
- error: 'GitHub integration not configured. Please set GITHUB_TOKEN, GIT_TOKEN, or GITHUB_PAT environment variable.'
58
- });
59
- }
60
-
61
- // Build issue body with user context (if available)
62
- let issueBody = body;
63
- if (userName || userEmail || userId) {
64
- 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.*`;
65
- }
66
-
67
- // Create the issue using shared service
68
- const result = await githubIssuesService.createIssue({
69
- owner: repoOwner,
70
- repo: repoName,
71
- title: title,
72
- body: issueBody,
73
- labels: labels || ['user-reported']
74
- });
75
-
76
- if (!result.success) {
77
- return res.status(500).json({
78
- success: false,
79
- error: result.error,
80
- details: result.errorDetails
81
- });
82
- }
83
-
84
- return res.json({
85
- success: true,
86
- message: 'Issue created successfully',
87
- issueNumber: result.issueNumber,
88
- issueUrl: result.issueUrl,
89
- title: title
90
- });
91
-
92
- } catch (error: any) {
93
- console.error(' Unexpected error creating Git issue:', error);
94
- return res.status(500).json({
95
- success: false,
96
- error: error.message || 'Failed to create Git issue'
97
- });
98
- }
99
- });
100
-
101
- /**
102
- * GET /issues/list - List issues (optional)
103
- *
104
- * Can be implemented if needed for the project
105
- */
106
- issuesRouter.get('/list', async (req: Request, res: Response) => {
107
- try {
108
- const config = loadFraimConfig();
109
- const repoOwner = config.git?.repoOwner || process.env.GITHUB_OWNER || 'your-org';
110
- const repoName = config.git?.repoName || process.env.GITHUB_REPO || 'your-repo';
111
-
112
- if (!githubIssuesService.isAvailable()) {
113
- return res.status(500).json({
114
- success: false,
115
- error: 'GitHub integration not configured'
116
- });
117
- }
118
-
119
- const { labels, state } = req.query;
120
-
121
- const result = await githubIssuesService.listIssues({
122
- owner: repoOwner,
123
- repo: repoName,
124
- labels: labels as string,
125
- state: (state as 'open' | 'closed' | 'all') || 'open'
126
- });
127
-
128
- if (!result.success) {
129
- return res.status(500).json({
130
- success: false,
131
- error: result.error
132
- });
133
- }
134
-
135
- return res.json({
136
- success: true,
137
- count: result.count,
138
- issues: result.issues
139
- });
140
-
141
- } catch (error: any) {
142
- console.error('❌ Unexpected error listing issues:', error);
143
- return res.status(500).json({
144
- success: false,
145
- error: error.message || 'Failed to list issues'
146
- });
147
- }
148
- });
149
-
150
- export { issuesRouter };
1
+ /**
2
+ * FRAIM Generic Issues API
3
+ *
4
+ * Generic issue filing endpoint that works for any project.
5
+ * Can be invoked through ChatGPT OpenAPI or MCP.
6
+ *
7
+ * Usage:
8
+ * 1. Import this file
9
+ * 2. Mount the router in your Express app
10
+ * 3. Configure GitHub repository in .fraim/config.json
11
+ */
12
+
13
+ import { Router, Request, Response } from 'express';
14
+ import { fileFraimIssue } from '../../src/fraim/issues.js';
15
+ import { loadFraimConfig } from '../../src/fraim/config-loader.js';
16
+
17
+ const issuesRouter = Router();
18
+
19
+ /**
20
+ * POST /issues/create - Create a GitHub issue
21
+ *
22
+ * Generic endpoint that works for any FRAIM project.
23
+ * Repository owner and name are read from .fraim/config.json
24
+ */
25
+ issuesRouter.post('/create', async (req: Request, res: Response) => {
26
+ try {
27
+ // Load project configuration
28
+ const config = loadFraimConfig();
29
+ const repoOwner = config.git?.repoOwner || process.env.GITHUB_OWNER || 'your-org';
30
+ const repoName = config.git?.repoName || process.env.GITHUB_REPO || 'your-repo';
31
+
32
+ // Get user context (if available - project-specific)
33
+ // Projects can customize this based on their auth system
34
+ const userId = (req as any).userContext?.userId ||
35
+ (req as any).executiveContext?.executiveId ||
36
+ req.headers['x-user-id'] as string;
37
+ const userEmail = (req as any).userContext?.email ||
38
+ (req as any).executiveContext?.executiveEmail ||
39
+ req.headers['x-user-email'] as string;
40
+ const userName = (req as any).userContext?.name ||
41
+ (req as any).executiveContext?.executiveName ||
42
+ req.headers['x-user-name'] as string;
43
+
44
+ const { title, body, labels } = req.body;
45
+
46
+ if (!title || !body) {
47
+ return res.status(400).json({
48
+ success: false,
49
+ error: 'Missing required fields: title, body'
50
+ });
51
+ }
52
+
53
+ // Check if GitHub token is configured
54
+ if (!process.env.GITHUB_TOKEN && !process.env.GIT_TOKEN && !process.env.GITHUB_PAT) {
55
+ return res.status(500).json({
56
+ success: false,
57
+ error: 'GitHub integration not configured. Please set GITHUB_TOKEN environment variable.'
58
+ });
59
+ }
60
+
61
+ // Build issue body with user context (if available)
62
+ let issueBody = body;
63
+ if (userName || userEmail || userId) {
64
+ 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.*`;
65
+ }
66
+
67
+ // Create the issue using shared function
68
+ const result = await fileFraimIssue({
69
+ title: title,
70
+ body: issueBody,
71
+ labels: labels || ['user-reported']
72
+ });
73
+
74
+ if (!result.success) {
75
+ return res.status(500).json({
76
+ success: false,
77
+ error: result.message
78
+ });
79
+ }
80
+
81
+ return res.json({
82
+ success: true,
83
+ message: 'Issue created successfully',
84
+ issueNumber: result.issueNumber,
85
+ issueUrl: result.htmlUrl,
86
+ title: title
87
+ });
88
+
89
+ } catch (error: any) {
90
+ console.error('❌ Unexpected error creating Git issue:', error);
91
+ return res.status(500).json({
92
+ success: false,
93
+ error: error.message || 'Failed to create Git issue'
94
+ });
95
+ }
96
+ });
97
+
98
+ /**
99
+ * GET /issues/list - List issues
100
+ *
101
+ * Not implemented in this generic version.
102
+ */
103
+ issuesRouter.get('/list', async (req: Request, res: Response) => {
104
+ return res.status(501).json({
105
+ success: false,
106
+ error: 'Listing issues is not supported in this generic API version yet.'
107
+ });
108
+ });
109
+
110
+ export { issuesRouter };