fraim-framework 2.0.55 โ†’ 2.0.57

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 (120) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/dist/src/cli/commands/init-project.js +10 -4
  3. package/dist/src/cli/setup/mcp-config-generator.js +23 -15
  4. package/dist/src/local-mcp-server/stdio-server.js +207 -0
  5. package/dist/src/utils/validate-workflows.js +101 -0
  6. package/dist/src/utils/workflow-parser.js +81 -0
  7. package/package.json +16 -11
  8. package/registry/scripts/pdf-styles.css +172 -0
  9. package/registry/scripts/prep-issue.sh +46 -4
  10. package/registry/scripts/profile-server.ts +131 -130
  11. package/registry/stubs/workflows/customer-development/user-survey-dispatch.md +1 -1
  12. package/registry/stubs/workflows/customer-development/users-to-target.md +1 -1
  13. package/registry/stubs/workflows/product-building/design.md +1 -1
  14. package/registry/stubs/workflows/product-building/implement.md +1 -1
  15. package/Claude.md +0 -1
  16. package/dist/registry/ai-manager-rules/design-phases/design-completeness-review.md +0 -73
  17. package/dist/registry/ai-manager-rules/design-phases/design-design.md +0 -145
  18. package/dist/registry/ai-manager-rules/implement-phases/implement-code.md +0 -283
  19. package/dist/registry/ai-manager-rules/implement-phases/implement-completeness-review.md +0 -120
  20. package/dist/registry/ai-manager-rules/implement-phases/implement-regression.md +0 -173
  21. package/dist/registry/ai-manager-rules/implement-phases/implement-repro.md +0 -104
  22. package/dist/registry/ai-manager-rules/implement-phases/implement-scoping.md +0 -100
  23. package/dist/registry/ai-manager-rules/implement-phases/implement-smoke.md +0 -237
  24. package/dist/registry/ai-manager-rules/implement-phases/implement-spike.md +0 -121
  25. package/dist/registry/ai-manager-rules/implement-phases/implement-validate.md +0 -375
  26. package/dist/registry/ai-manager-rules/retrospective.md +0 -116
  27. package/dist/registry/ai-manager-rules/shared-phases/address-pr-feedback.md +0 -188
  28. package/dist/registry/ai-manager-rules/shared-phases/submit-pr.md +0 -202
  29. package/dist/registry/ai-manager-rules/shared-phases/wait-for-pr-review.md +0 -170
  30. package/dist/registry/ai-manager-rules/spec-phases/spec-competitor-analysis.md +0 -105
  31. package/dist/registry/ai-manager-rules/spec-phases/spec-completeness-review.md +0 -66
  32. package/dist/registry/ai-manager-rules/spec-phases/spec-spec.md +0 -139
  33. package/dist/registry/providers/ado.json +0 -19
  34. package/dist/registry/providers/github.json +0 -19
  35. package/dist/registry/scripts/cleanup-branch.js +0 -287
  36. package/dist/registry/scripts/evaluate-code-quality.js +0 -66
  37. package/dist/registry/scripts/exec-with-timeout.js +0 -142
  38. package/dist/registry/scripts/generate-engagement-emails.js +0 -705
  39. package/dist/registry/scripts/newsletter-helpers.js +0 -671
  40. package/dist/registry/scripts/profile-server.js +0 -388
  41. package/dist/registry/scripts/run-thank-you-workflow.js +0 -92
  42. package/dist/registry/scripts/send-newsletter-simple.js +0 -85
  43. package/dist/registry/scripts/send-thank-you-emails.js +0 -54
  44. package/dist/registry/scripts/validate-openapi-limits.js +0 -311
  45. package/dist/registry/scripts/validate-test-coverage.js +0 -262
  46. package/dist/registry/scripts/verify-test-coverage.js +0 -66
  47. package/dist/scripts/build-stub-registry.js +0 -108
  48. package/dist/src/ai-manager/ai-manager.js +0 -482
  49. package/dist/src/ai-manager/phase-flow.js +0 -357
  50. package/dist/src/ai-manager/types.js +0 -5
  51. package/dist/src/fraim-mcp-server.js +0 -1885
  52. package/dist/tests/debug-tools.js +0 -80
  53. package/dist/tests/shared-server-utils.js +0 -57
  54. package/dist/tests/test-add-ide.js +0 -283
  55. package/dist/tests/test-ai-coach-edge-cases.js +0 -420
  56. package/dist/tests/test-ai-coach-mcp-integration.js +0 -450
  57. package/dist/tests/test-ai-coach-performance.js +0 -328
  58. package/dist/tests/test-ai-coach-phase-content.js +0 -264
  59. package/dist/tests/test-ai-coach-workflows.js +0 -514
  60. package/dist/tests/test-cli.js +0 -228
  61. package/dist/tests/test-client-scripts-validation.js +0 -167
  62. package/dist/tests/test-complete-setup-flow.js +0 -110
  63. package/dist/tests/test-config-system.js +0 -279
  64. package/dist/tests/test-debug-session.js +0 -134
  65. package/dist/tests/test-end-to-end-hybrid-validation.js +0 -328
  66. package/dist/tests/test-enhanced-session-init.js +0 -188
  67. package/dist/tests/test-first-run-journey.js +0 -368
  68. package/dist/tests/test-fraim-issues.js +0 -59
  69. package/dist/tests/test-genericization.js +0 -44
  70. package/dist/tests/test-hybrid-script-execution.js +0 -340
  71. package/dist/tests/test-ide-detector.js +0 -46
  72. package/dist/tests/test-improved-setup.js +0 -121
  73. package/dist/tests/test-mcp-config-generator.js +0 -99
  74. package/dist/tests/test-mcp-connection.js +0 -107
  75. package/dist/tests/test-mcp-issue-integration.js +0 -156
  76. package/dist/tests/test-mcp-lifecycle-methods.js +0 -240
  77. package/dist/tests/test-mcp-shared-server.js +0 -308
  78. package/dist/tests/test-mcp-template-processing.js +0 -160
  79. package/dist/tests/test-modular-issue-tracking.js +0 -165
  80. package/dist/tests/test-node-compatibility.js +0 -95
  81. package/dist/tests/test-npm-install.js +0 -68
  82. package/dist/tests/test-package-size.js +0 -108
  83. package/dist/tests/test-pr-review-workflow.js +0 -307
  84. package/dist/tests/test-prep-issue.js +0 -129
  85. package/dist/tests/test-productivity-integration.js +0 -157
  86. package/dist/tests/test-script-location-independence.js +0 -198
  87. package/dist/tests/test-script-sync.js +0 -557
  88. package/dist/tests/test-server-utils.js +0 -32
  89. package/dist/tests/test-session-rehydration.js +0 -148
  90. package/dist/tests/test-setup-integration.js +0 -98
  91. package/dist/tests/test-setup-scenarios.js +0 -322
  92. package/dist/tests/test-standalone.js +0 -143
  93. package/dist/tests/test-stub-registry.js +0 -136
  94. package/dist/tests/test-sync-stubs.js +0 -143
  95. package/dist/tests/test-sync-version-update.js +0 -93
  96. package/dist/tests/test-telemetry.js +0 -193
  97. package/dist/tests/test-token-validator.js +0 -30
  98. package/dist/tests/test-user-journey.js +0 -236
  99. package/dist/tests/test-users-to-target-workflow.js +0 -253
  100. package/dist/tests/test-utils.js +0 -109
  101. package/dist/tests/test-wizard.js +0 -71
  102. package/dist/tests/test-workflow-discovery.js +0 -242
  103. package/labels.json +0 -52
  104. package/registry/agent-guardrails.md +0 -63
  105. package/registry/fraim.md +0 -48
  106. package/registry/stubs/workflows/customer-development/ai-coach-phases/phase1-customer-profiling.md +0 -11
  107. package/registry/stubs/workflows/customer-development/ai-coach-phases/phase1-survey-scoping.md +0 -11
  108. package/registry/stubs/workflows/customer-development/ai-coach-phases/phase2-platform-discovery.md +0 -11
  109. package/registry/stubs/workflows/customer-development/ai-coach-phases/phase2-survey-build-linkedin.md +0 -11
  110. package/registry/stubs/workflows/customer-development/ai-coach-phases/phase3-prospect-qualification.md +0 -11
  111. package/registry/stubs/workflows/customer-development/ai-coach-phases/phase3-survey-build-reddit.md +0 -11
  112. package/registry/stubs/workflows/customer-development/ai-coach-phases/phase4-inventory-compilation.md +0 -11
  113. package/registry/stubs/workflows/customer-development/ai-coach-phases/phase4-survey-build-x.md +0 -11
  114. package/registry/stubs/workflows/customer-development/ai-coach-phases/phase5-survey-build-facebook.md +0 -11
  115. package/registry/stubs/workflows/customer-development/ai-coach-phases/phase6-survey-build-custom.md +0 -11
  116. package/registry/stubs/workflows/customer-development/ai-coach-phases/phase7-survey-dispatch.md +0 -11
  117. package/registry/stubs/workflows/customer-development/templates/customer-persona-template.md +0 -11
  118. package/registry/stubs/workflows/customer-development/templates/search-strategy-template.md +0 -11
  119. package/setup.js +0 -171
  120. package/tsconfig.json +0 -23
@@ -1,66 +0,0 @@
1
- # Phase: Spec-Completeness-Review
2
-
3
- ## INTENT
4
- To verify that the specification is complete and includes high-fidelity HTML mocks when UI changes are involved.
5
-
6
- ## OUTCOME
7
- Confirmation that:
8
- - Specification document is complete and follows template
9
- - High-fidelity HTML mocks exist for UI changes (not markdown code blocks)
10
- - Mocks are accessible and render properly in browser
11
- - All requirements from original issue are addressed
12
-
13
- ## WORKFLOW
14
-
15
- ### Step 1: Check Specification Completeness
16
- - Verify spec document exists at `docs/feature specs/{issue_number}-*.md`
17
- - Confirm all template sections are complete (not placeholder text)
18
- - Check that customer, desired outcome, and user experience are well-defined
19
-
20
- ### Step 2: Validate Mocks (if UI changes)
21
- **If the feature involves UI changes:**
22
- - Check that HTML mock files exist in `docs/feature specs/mocks/`
23
- - Verify mocks are named `{issue_number}-*.html`
24
- - Confirm mocks are actual HTML files (not markdown code blocks)
25
- - **Ask agent to open mocks in browser** to verify they render properly
26
- - Check that mocks show different states/views of the feature
27
-
28
- **If no UI changes:**
29
- - Confirm this is documented in the spec
30
- - Verify the feature is purely backend/API
31
-
32
- ### Step 3: Requirements Coverage
33
- - Review original GitHub issue requirements
34
- - Confirm all requirements are addressed in the specification
35
- - Check that acceptance criteria are covered
36
-
37
- ## VALIDATION
38
-
39
- ### Phase Complete When:
40
- - โœ… Specification document complete and professional quality
41
- - โœ… High-fidelity HTML mocks created (if UI changes required)
42
- - โœ… Agent has opened mocks in browser and confirmed they render
43
- - โœ… All original issue requirements addressed
44
- - โœ… Ready for design phase
45
-
46
- ### Phase Incomplete If:
47
- - โŒ Specification incomplete or poor quality
48
- - โŒ UI changes specified but no HTML mocks provided
49
- - โŒ Mocks don't render properly in browser
50
- - โŒ Original requirements not fully addressed
51
-
52
- ### Report Back:
53
- ```javascript
54
- seekCoachingOnNextStep({
55
- workflowType: "spec",
56
- issueNumber: "{issue_number}",
57
- currentPhase: "spec-completeness-review",
58
- status: "complete",
59
- evidence: {
60
- specComplete: true,
61
- mockFilesCreated: ["docs/feature specs/mocks/21-view1.html", "21-view2.html"],
62
- browserValidated: true,
63
- requirementsCovered: true
64
- }
65
- })
66
- ```
@@ -1,139 +0,0 @@
1
- # Phase: Spec-Spec
2
-
3
- ## INTENT
4
- To create a comprehensive feature specification that clearly defines customer needs, desired outcomes, user experience, and validation criteria.
5
-
6
- ## OUTCOME
7
- A complete specification document that:
8
- - Identifies the target customer and their needs
9
- - Defines the desired outcome and success criteria
10
- - Describes the user experience in detail
11
- - Includes high-fidelity mocks for UI changes
12
- - Provides a comprehensive validation plan
13
- - Analyzes alternatives and competitive landscape
14
-
15
- ## PRINCIPLES
16
- - **Customer-First**: Start with customer identification and needs
17
- - **Outcome-Driven**: Focus on what the customer wants to achieve
18
- - **Experience-Detailed**: Provide step-by-step user workflows
19
- - **Validation-Ready**: Include specific, executable validation steps
20
- - **Template-Compliant**: Follow FEATURESPEC template structure
21
-
22
- ## WORKFLOW
23
-
24
- ### Step 1: Get Repository Context and Issue Details
25
-
26
- **GitHub Repository Context**: Before using GitHub MCP tools, read the local `.fraim/config.json` file to get the repository context:
27
- - Use `git.repoOwner` for the GitHub repository owner
28
- - Use `git.repoName` for the GitHub repository name
29
- - These values are required for GitHub MCP API calls (owner/repo parameters)
30
-
31
- **Read Issue Details**: Use GitHub MCP tools to get the complete issue information:
32
- - Read the full issue description, title, and labels
33
- - Check for linked documents or references
34
- - Review any comments or discussion threads
35
- - Note any existing requirements or context
36
- - Understand the customer problem being addressed
37
-
38
- ### Step 2: Load Template and Rules
39
- - Call `get_fraim_file({ path: "templates/specs/FEATURESPEC-TEMPLATE.md" })`
40
- - Call `get_fraim_file({ path: "rules/communication.md" })`
41
- - Call `get_fraim_file({ path: "rules/pr-workflow-completeness.md" })`
42
-
43
- ### Step 3: Check for PR Feedback
44
-
45
- **CRITICAL**: Before creating specification, check for feedback:
46
- - **PR Review Feedback**: `docs/evidence/{issue_number}-spec-feedback.md`
47
-
48
- **If PR feedback exists:**
49
- - **MUST address all UNADDRESSED items** before proceeding
50
- - Update feedback file after addressing each item
51
- - Change status from UNADDRESSED to ADDRESSED with resolution details
52
- - Cannot skip or defer feedback items
53
- - Phase cannot complete until all feedback is addressed
54
-
55
- **PR Feedback File Format** (if exists):
56
- ```markdown
57
- ### Comment X - ADDRESSED
58
- - **Author**: reviewer_name
59
- - **Comment**: Original feedback
60
- - **Status**: ADDRESSED
61
- - **Resolution**: How you addressed this feedback
62
- ```
63
-
64
- ### Step 4: Create Specification Document
65
- - Create spec file at `docs/feature specs/{issue_number}-{kebab-case-title}.md`
66
- - Follow FEATURESPEC template structure exactly
67
- - Include all required sections:
68
- - Customer identification
69
- - Customer's desired outcome
70
- - Customer problem definition
71
- - User experience with detailed workflows
72
- - Validation plan
73
- - Alternatives analysis
74
- - Competitive landscape
75
-
76
- ### Step 4: Create High-Fidelity Mocks (if UI changes)
77
- If the feature involves UI changes:
78
- - Create HTML/CSS mocks in `docs/feature specs/mocks/`
79
- - Name files: `{issue_number}-{descriptive-name}.html`
80
- - Include at least 3 different views/states
81
- - Link mocks in the specification document
82
- - **Note**: Markdown code blocks are NOT sufficient - must be actual HTML files
83
-
84
- ### Step 5: Validate Completeness
85
- - Ensure all template sections are complete
86
- - Verify customer focus is clear and specific
87
- - Check that user experience includes step-by-step workflows
88
- - Confirm validation plan is actionable and executable
89
- - Review alternatives and competitive analysis
90
-
91
- ### Step 6: Apply Labels
92
- - Label the GitHub issue with `phase:spec`
93
- - This will trigger automatic PR creation/update
94
-
95
- ## VALIDATION
96
-
97
- ### Phase Complete When:
98
- - โœ… Specification document created using FEATURESPEC template
99
- - โœ… All required sections completed with substantial content
100
- - โœ… Customer and desired outcome clearly identified
101
- - โœ… User experience includes detailed step-by-step workflows
102
- - โœ… High-fidelity mocks created (if UI changes required)
103
- - โœ… Validation plan includes specific, executable steps
104
- - โœ… Alternatives and competitive landscape analyzed
105
- - โœ… **PR feedback addressed** (if `docs/evidence/{issue_number}-spec-feedback.md` exists)
106
- - โœ… Issue labeled with `phase:spec`
107
-
108
- ### Phase Incomplete If:
109
- - โŒ Specification document missing or incomplete
110
- - โŒ Template structure not followed
111
- - โŒ Customer identification vague or missing
112
- - โŒ User experience lacks detailed workflows
113
- - โŒ UI changes specified but no HTML mocks provided
114
- - โŒ Validation plan not actionable
115
- - โŒ Alternatives or competitive analysis missing
116
- - โŒ **PR feedback not addressed** (UNADDRESSED items remain in feedback file)
117
-
118
- ### Report Back:
119
- When you complete this phase, call:
120
-
121
- ```javascript
122
- seekCoachingOnNextStep({
123
- workflowType: "spec",
124
- issueNumber: "{issue_number}",
125
- currentPhase: "spec-spec",
126
- status: "complete",
127
- evidence: {
128
- specDocument: "docs/feature specs/{issue_number}-{title}.md",
129
- templateUsed: "FEATURESPEC-TEMPLATE.md",
130
- mockFiles: ["docs/feature specs/mocks/{issue_number}-view1.html", "..."],
131
- namingConvention: "{issue_number}-{kebab-case-title}.md",
132
- issueLabeled: "phase:spec"
133
- },
134
- findings: {
135
- completedSections: ["Customer identification", "Customer desired outcome", "..."],
136
- keyInsights: ["Key insight 1", "Key insight 2", "..."]
137
- }
138
- })
139
- ```
@@ -1,19 +0,0 @@
1
- {
2
- "get_issue": "mcp_ado_get_work_item({ organization: '{{repository.organization}}', project: '{{repository.project}}', workItemId: {{issue_number}} })",
3
- "update_issue_status": "mcp_ado_update_work_item({ organization: '{{repository.organization}}', project: '{{repository.project}}', workItemId: {{issue_number}}, state: 'Active' })",
4
- "create_pr": "mcp_ado_create_pull_request({ organization: '{{repository.organization}}', project: '{{repository.project}}', repository: '{{repository.name}}', title: '{{title}}', sourceBranch: '{{branch}}', targetBranch: 'main', description: '{{body}}' })",
5
- "get_pr": "mcp_ado_get_pull_request({ organization: '{{repository.organization}}', project: '{{repository.project}}', repository: '{{repository.name}}', pullRequestId: {{pr_number}} })",
6
- "get_pr_comments": "mcp_ado_get_pr_comments({ organization: '{{repository.organization}}', project: '{{repository.project}}', repository: '{{repository.name}}', pullRequestId: {{pr_number}} })",
7
- "get_pr_review_comments": "mcp_ado_get_pr_review_comments({ organization: '{{repository.organization}}', project: '{{repository.project}}', repository: '{{repository.name}}', pullRequestId: {{pr_number}} })",
8
- "get_pr_reviews": "mcp_ado_get_pr_reviews({ organization: '{{repository.organization}}', project: '{{repository.project}}', repository: '{{repository.name}}', pullRequestId: {{pr_number}} })",
9
- "add_pr_comment": "mcp_ado_add_pr_comment({ organization: '{{repository.organization}}', project: '{{repository.project}}', repository: '{{repository.name}}', pullRequestId: {{pr_number}}, content: '{{comment}}' })",
10
- "merge_pr": "mcp_ado_merge_pull_request({ organization: '{{repository.organization}}', project: '{{repository.project}}', repository: '{{repository.name}}', pullRequestId: {{pr_number}} })",
11
- "create_branch": "git checkout -b feature/{{issue_number}}-{{slug}}",
12
- "switch_branch": "git checkout {{branch}}",
13
- "commit_changes": "git add . && git commit -m '{{message}}'",
14
- "push_branch": "git push origin {{branch}}",
15
- "list_issues": "mcp_ado_list_work_items({ organization: '{{repository.organization}}', project: '{{repository.project}}', state: 'Active' })",
16
- "create_issue": "mcp_ado_create_work_item({ organization: '{{repository.organization}}', project: '{{repository.project}}', workItemType: 'Bug', title: '{{title}}', description: '{{body}}' })",
17
- "add_issue_comment": "mcp_ado_add_work_item_comment({ organization: '{{repository.organization}}', project: '{{repository.project}}', workItemId: {{issue_number}}, text: '{{comment}}' })",
18
- "assign_issue": "mcp_ado_update_work_item({ organization: '{{repository.organization}}', project: '{{repository.project}}', workItemId: {{issue_number}}, assignedTo: '{{assignee}}' })"
19
- }
@@ -1,19 +0,0 @@
1
- {
2
- "get_issue": "mcp_github_issue_read({ owner: '{{repository.owner}}', repo: '{{repository.name}}', issue_number: {{issue_number}}, method: 'get' })",
3
- "update_issue_status": "mcp_github_issue_write({ owner: '{{repository.owner}}', repo: '{{repository.name}}', issue_number: {{issue_number}}, method: 'update', labels: ['status:in-progress'] })",
4
- "create_pr": "mcp_github_create_pull_request({ owner: '{{repository.owner}}', repo: '{{repository.name}}', title: '{{title}}', head: '{{branch}}', base: 'main', body: '{{body}}' })",
5
- "get_pr": "mcp_github_pull_request_read({ owner: '{{repository.owner}}', repo: '{{repository.name}}', pullNumber: {{pr_number}}, method: 'get' })",
6
- "get_pr_comments": "mcp_github_pull_request_read({ owner: '{{repository.owner}}', repo: '{{repository.name}}', pullNumber: {{pr_number}}, method: 'get_comments' })",
7
- "get_pr_review_comments": "mcp_github_pull_request_read({ owner: '{{repository.owner}}', repo: '{{repository.name}}', pullNumber: {{pr_number}}, method: 'get_review_comments' })",
8
- "get_pr_reviews": "mcp_github_pull_request_read({ owner: '{{repository.owner}}', repo: '{{repository.name}}', pullNumber: {{pr_number}}, method: 'get_reviews' })",
9
- "add_pr_comment": "mcp_github_add_issue_comment({ owner: '{{repository.owner}}', repo: '{{repository.name}}', issue_number: {{pr_number}}, body: '{{comment}}' })",
10
- "merge_pr": "mcp_github_merge_pull_request({ owner: '{{repository.owner}}', repo: '{{repository.name}}', pullNumber: {{pr_number}} })",
11
- "create_branch": "git checkout -b feature/{{issue_number}}-{{slug}}",
12
- "switch_branch": "git checkout {{branch}}",
13
- "commit_changes": "git add . && git commit -m '{{message}}'",
14
- "push_branch": "git push origin {{branch}}",
15
- "list_issues": "mcp_github_list_issues({ owner: '{{repository.owner}}', repo: '{{repository.name}}', state: 'OPEN' })",
16
- "create_issue": "mcp_github_issue_write({ owner: '{{repository.owner}}', repo: '{{repository.name}}', method: 'create', title: '{{title}}', body: '{{body}}' })",
17
- "add_issue_comment": "mcp_github_add_issue_comment({ owner: '{{repository.owner}}', repo: '{{repository.name}}', issue_number: {{issue_number}}, body: '{{comment}}' })",
18
- "assign_issue": "mcp_github_issue_write({ owner: '{{repository.owner}}', repo: '{{repository.name}}', issue_number: {{issue_number}}, method: 'update', assignees: ['{{assignee}}'] })"
19
- }
@@ -1,287 +0,0 @@
1
- #!/usr/bin/env npx tsx
2
- "use strict";
3
- var __importDefault = (this && this.__importDefault) || function (mod) {
4
- return (mod && mod.__esModule) ? mod : { "default": mod };
5
- };
6
- Object.defineProperty(exports, "__esModule", { value: true });
7
- const child_process_1 = require("child_process");
8
- const fs_1 = require("fs");
9
- const path_1 = require("path");
10
- const dotenv_1 = __importDefault(require("dotenv"));
11
- // Load environment variables
12
- dotenv_1.default.config({ override: true });
13
- // Self-contained utility functions (no FRAIM internal imports)
14
- function extractIssueNumber(branchName) {
15
- const match = branchName.match(/(\d+)/);
16
- return match ? match[1] : '';
17
- }
18
- function getCurrentGitBranch() {
19
- try {
20
- return (0, child_process_1.execSync)('git branch --show-current', { encoding: 'utf8' }).trim();
21
- }
22
- catch (error) {
23
- return 'unknown';
24
- }
25
- }
26
- function loadClientConfig() {
27
- const configPath = (0, path_1.join)(process.cwd(), '.fraim', 'config.json');
28
- if (!(0, fs_1.existsSync)(configPath)) {
29
- throw new Error('.fraim/config.json not found. Run fraim init first.');
30
- }
31
- return JSON.parse((0, fs_1.readFileSync)(configPath, 'utf-8'));
32
- }
33
- function getEnvOr(keys, fallback) {
34
- for (const key of keys) {
35
- const value = process.env[key];
36
- if (value && value.length)
37
- return value;
38
- }
39
- return fallback;
40
- }
41
- class BranchCleanup {
42
- constructor(options = {}) {
43
- this.options = {
44
- branchName: options.branchName,
45
- force: options.force || false,
46
- skipProjectCleanup: options.skipProjectCleanup || false,
47
- skipGit: options.skipGit || false,
48
- };
49
- }
50
- async insertYourCodeHere(branchName) {
51
- const branchPattern = "branch_" + extractIssueNumber(branchName) + "%";
52
- this.log(`Attempting to fetch and run DB cleanup for pattern: ${branchPattern}`);
53
- // Historically this called: npx tsx scripts/database/cleanup-mongo-schemas.ts
54
- // In FRAIM 2.0, we should fetch it if possible, or skip if it's an internal-only script
55
- // that doesn't exist in the registry but was incorrectly referenced.
56
- // NOTE: In this specific case, cleanup-mongo-schemas.ts is likely an internal script.
57
- // If it's not in the registry, get_fraim_file will fail.
58
- // For now, we fix the path to be more agnostic or explicitly documented as a dependency.
59
- try {
60
- // NOTE: Users should define their own cleanup script location in .fraim/config.json
61
- // or the agent should fetch it. For now, we try to run it from a standard location
62
- // if it exists, but we don't hardcode it as a requirement for the script to run.
63
- const cleanupScript = process.env.FRAIM_PROJECT_CLEANUP_SCRIPT || (['scripts', 'database', 'cleanup-mongo-schemas.ts'].join('/'));
64
- this.log(`Checking for project cleanup script: ${cleanupScript}`);
65
- await this.executeCommand(`npx tsx ${cleanupScript} "${branchPattern}"`, 'Run project-specific cleanup script');
66
- }
67
- catch (e) {
68
- this.log('Skipping project-specific cleanup (script not found or failed).', 'info');
69
- }
70
- }
71
- log(message, level = 'info') {
72
- const timestamp = new Date().toISOString();
73
- const prefix = {
74
- info: 'โ„น๏ธ ',
75
- warn: 'โš ๏ธ ',
76
- error: 'โŒ',
77
- success: 'โœ…'
78
- }[level];
79
- console.log(`${prefix} [${timestamp}] ${message}`);
80
- }
81
- async executeCommand(command, description) {
82
- this.log(`Executing: ${description}`);
83
- try {
84
- const result = (0, child_process_1.execSync)(command, {
85
- encoding: 'utf8',
86
- stdio: 'pipe',
87
- cwd: process.cwd()
88
- });
89
- this.log(`Success: ${description}`, 'success');
90
- return result;
91
- }
92
- catch (error) {
93
- this.log(`Failed: ${description} - ${error.message}`, 'error');
94
- throw error;
95
- }
96
- }
97
- async getCurrentBranch() {
98
- try {
99
- const result = await this.executeCommand('git branch --show-current', 'Get current branch');
100
- return result.trim();
101
- }
102
- catch (error) {
103
- this.log('Could not determine current branch', 'warn');
104
- return 'unknown';
105
- }
106
- }
107
- async getBranchName() {
108
- if (this.options.branchName) {
109
- return this.options.branchName;
110
- }
111
- const currentBranch = await this.getCurrentBranch();
112
- if (currentBranch === 'master' || currentBranch === 'main') {
113
- throw new Error('Cannot cleanup master/main branch. Please specify a feature branch name.');
114
- }
115
- return currentBranch;
116
- }
117
- async checkBranchExists(branchName, remote = false) {
118
- try {
119
- const command = remote
120
- ? `git ls-remote --heads origin ${branchName}`
121
- : `git branch --list ${branchName}`;
122
- const result = await this.executeCommand(command, `Check if ${remote ? 'remote' : 'local'} branch exists`);
123
- return result.trim().length > 0;
124
- }
125
- catch (error) {
126
- return false;
127
- }
128
- }
129
- async doProjectSpecificCleanup(branchName) {
130
- try {
131
- if (this.options.skipProjectCleanup) {
132
- this.log('Skipping project-specific cleanup', 'warn');
133
- return;
134
- }
135
- this.log('Starting project-specific cleanup...');
136
- await this.insertYourCodeHere(branchName);
137
- this.log('Project-specific cleanup completed successfully', 'success');
138
- }
139
- catch (error) {
140
- this.log(`Project-specific cleanup failed: ${error.message}`, 'error');
141
- if (!this.options.force) {
142
- throw error;
143
- }
144
- }
145
- }
146
- async cleanupGitBranches(branchName) {
147
- if (this.options.skipGit) {
148
- this.log('Skipping Git cleanup', 'warn');
149
- return;
150
- }
151
- this.log(`Starting Git branch cleanup for: ${branchName}`);
152
- // Check if we're on the branch we want to delete
153
- const currentBranch = await this.getCurrentBranch();
154
- if (currentBranch === branchName) {
155
- this.log(`Currently on branch ${branchName}, switching to master first`, 'warn');
156
- await this.executeCommand('git checkout master', 'Switch to master branch');
157
- }
158
- // Delete remote branch
159
- const remoteExists = await this.checkBranchExists(branchName, true);
160
- if (remoteExists) {
161
- this.log(`Deleting remote branch: origin/${branchName}`);
162
- await this.executeCommand(`git push origin --delete ${branchName}`, `Delete remote branch ${branchName}`);
163
- }
164
- else {
165
- this.log(`Remote branch origin/${branchName} does not exist`, 'info');
166
- }
167
- // Delete local branch
168
- const localExists = await this.checkBranchExists(branchName, false);
169
- if (localExists) {
170
- this.log(`Deleting local branch: ${branchName}`);
171
- await this.executeCommand(`git branch -D ${branchName}`, `Delete local branch ${branchName}`);
172
- }
173
- else {
174
- this.log(`Local branch ${branchName} does not exist`, 'info');
175
- }
176
- // Clean up any untracked files
177
- this.log('Cleaning up untracked files...');
178
- await this.executeCommand('git clean -fd', 'Remove untracked files and directories');
179
- // Reset any uncommitted changes
180
- this.log('Resetting uncommitted changes...');
181
- await this.executeCommand('git reset --hard HEAD', 'Reset to HEAD');
182
- this.log('Git branch cleanup completed', 'success');
183
- }
184
- async verifyCleanup(branchName) {
185
- this.log('Verifying cleanup...');
186
- // Verify branch deletion
187
- const remoteExists = await this.checkBranchExists(branchName, true);
188
- const localExists = await this.checkBranchExists(branchName, false);
189
- if (remoteExists || localExists) {
190
- this.log(`Warning: Branch ${branchName} still exists (remote: ${remoteExists}, local: ${localExists})`, 'warn');
191
- }
192
- else {
193
- this.log(`Branch ${branchName} successfully deleted`, 'success');
194
- }
195
- // Verify we're on master
196
- const currentBranch = await this.getCurrentBranch();
197
- if (currentBranch === 'master' || currentBranch === 'main') {
198
- this.log('Currently on master/main branch', 'success');
199
- }
200
- else {
201
- this.log(`Warning: Not on master branch, currently on ${currentBranch}`, 'warn');
202
- }
203
- this.log('Cleanup verification completed', 'success');
204
- }
205
- async cleanup() {
206
- try {
207
- this.log('๐Ÿš€ Starting branch cleanup process...');
208
- const branchName = await this.getBranchName();
209
- this.log(`Target branch: ${branchName}`);
210
- // Step 1: Project-specific cleanup
211
- await this.doProjectSpecificCleanup(branchName);
212
- // Step 2: Git branch cleanup
213
- await this.cleanupGitBranches(branchName);
214
- // Step 3: Verification
215
- await this.verifyCleanup(branchName);
216
- this.log('๐ŸŽ‰ Branch cleanup completed successfully!', 'success');
217
- }
218
- catch (error) {
219
- this.log(`Cleanup failed: ${error.message}`, 'error');
220
- if (!this.options.force) {
221
- process.exit(1);
222
- }
223
- }
224
- }
225
- }
226
- // Parse command line arguments
227
- const args = process.argv.slice(2);
228
- const options = {};
229
- // Parse arguments
230
- for (let i = 0; i < args.length; i++) {
231
- const arg = args[i];
232
- switch (arg) {
233
- case '--branch':
234
- case '-b':
235
- options.branchName = args[++i];
236
- break;
237
- case '--force':
238
- case '-f':
239
- options.force = true;
240
- break;
241
- case '--skip-project-cleanup':
242
- options.skipProjectCleanup = true;
243
- break;
244
- case '--skip-git':
245
- options.skipGit = true;
246
- break;
247
- case '--help':
248
- case '-h':
249
- console.log(`
250
- ๐Ÿงน Branch Cleanup Script
251
-
252
- Usage:
253
- npx tsx scripts/cleanup-branch.ts [options]
254
-
255
- Options:
256
- --branch, -b <name> Specific branch name to cleanup (default: current branch)
257
- --force, -f Continue even if some operations fail
258
- --skip-project-cleanup Skip project-specific cleanup
259
- --skip-git Skip Git branch deletion
260
- --help, -h Show this help message
261
-
262
- Examples:
263
- # Cleanup current branch with default settings
264
- npx tsx <cleanup-script-path>
265
-
266
- # Cleanup specific branch
267
- npx tsx <cleanup-script-path> --branch feature/123
268
-
269
- # Force cleanup even if some operations fail
270
- npx tsx <cleanup-script-path> --force
271
-
272
- # Skip project-specific cleanup (only do Git cleanup)
273
- npx tsx <cleanup-script-path> --skip-project-cleanup
274
-
275
- This script performs the following cleanup operations:
276
- 1. ๐Ÿ—„๏ธ Project-specific cleanup (calls configured cleanup script)
277
- 2. ๐ŸŒฟ Git branch deletion (remote and local)
278
- 3. โœ… Verification of cleanup completion
279
-
280
- โš ๏ธ WARNING: This script will permanently delete branches and data!
281
- `);
282
- process.exit(0);
283
- }
284
- }
285
- // Run the cleanup
286
- const cleanup = new BranchCleanup(options);
287
- cleanup.cleanup();
@@ -1,66 +0,0 @@
1
- #!/usr/bin/env node
2
- "use strict";
3
- /**
4
- * Code Quality Evaluator (Diagnostic Tool)
5
- *
6
- * Runs code quality checks and outputs results to the console.
7
- * Used by the evaluate-code-quality bootstrapping workflow.
8
- *
9
- * Usage: npx tsx <this-script>
10
- */
11
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
12
- if (k2 === undefined) k2 = k;
13
- var desc = Object.getOwnPropertyDescriptor(m, k);
14
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
15
- desc = { enumerable: true, get: function() { return m[k]; } };
16
- }
17
- Object.defineProperty(o, k2, desc);
18
- }) : (function(o, m, k, k2) {
19
- if (k2 === undefined) k2 = k;
20
- o[k2] = m[k];
21
- }));
22
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
23
- Object.defineProperty(o, "default", { enumerable: true, value: v });
24
- }) : function(o, v) {
25
- o["default"] = v;
26
- });
27
- var __importStar = (this && this.__importStar) || (function () {
28
- var ownKeys = function(o) {
29
- ownKeys = Object.getOwnPropertyNames || function (o) {
30
- var ar = [];
31
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
32
- return ar;
33
- };
34
- return ownKeys(o);
35
- };
36
- return function (mod) {
37
- if (mod && mod.__esModule) return mod;
38
- var result = {};
39
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
40
- __setModuleDefault(result, mod);
41
- return result;
42
- };
43
- })();
44
- Object.defineProperty(exports, "__esModule", { value: true });
45
- const path = __importStar(require("path"));
46
- const child_process_1 = require("child_process");
47
- const REGISTRY_SCRIPTS_DIR = __dirname;
48
- const QUALITY_CHECK_SCRIPT = path.join(REGISTRY_SCRIPTS_DIR, 'code-quality-check.sh');
49
- function evaluateQuality() {
50
- console.log('๐Ÿš€ Starting Code Quality Evaluation...');
51
- console.log('๐Ÿ“Š Running code-quality-check.sh...\n');
52
- // Run the existing quality check script and pipe output directly to terminal
53
- const child = (0, child_process_1.spawn)('bash', [QUALITY_CHECK_SCRIPT, 'pre-pr'], {
54
- stdio: 'inherit',
55
- shell: false
56
- });
57
- child.on('exit', (code) => {
58
- if (code === 0) {
59
- console.log('\nโœ… Code quality check completed successfully.');
60
- }
61
- else {
62
- console.log(`\nโŒ Code quality check failed with exit code ${code}.`);
63
- }
64
- });
65
- }
66
- evaluateQuality();