fraim-framework 2.0.47 → 2.0.49

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 (47) hide show
  1. package/dist/registry/ai-manager-rules/implement-phases/implement-code.md +7 -10
  2. package/dist/registry/ai-manager-rules/implement-phases/implement-smoke.md +14 -7
  3. package/dist/registry/ai-manager-rules/implement-phases/implement-validate.md +12 -8
  4. package/dist/registry/ai-manager-rules/shared-phases/address-pr-feedback.md +188 -0
  5. package/dist/registry/providers/ado.json +19 -0
  6. package/dist/registry/providers/github.json +19 -0
  7. package/dist/src/ai-manager/ai-manager.js +8 -1
  8. package/dist/src/ai-manager/phase-flow.js +36 -8
  9. package/dist/src/cli/commands/init-project.js +5 -4
  10. package/dist/src/cli/commands/init.js +8 -7
  11. package/dist/src/cli/setup/first-run.js +116 -29
  12. package/dist/src/fraim/config-loader.js +58 -23
  13. package/dist/src/fraim/db-service.js +46 -0
  14. package/dist/src/fraim/issue-tracking/ado-provider.js +304 -0
  15. package/dist/src/fraim/issue-tracking/factory.js +63 -0
  16. package/dist/src/fraim/issue-tracking/github-provider.js +200 -0
  17. package/dist/src/fraim/issue-tracking/types.js +7 -0
  18. package/dist/src/fraim/issue-tracking-config.js +83 -0
  19. package/dist/src/fraim/issues.js +25 -23
  20. package/dist/src/fraim/setup-wizard.js +5 -3
  21. package/dist/src/fraim/template-processor.js +156 -30
  22. package/dist/src/fraim/types.js +21 -23
  23. package/dist/src/fraim-mcp-server.js +350 -36
  24. package/dist/src/utils/git-utils.js +38 -3
  25. package/dist/src/utils/platform-detection.js +213 -0
  26. package/dist/tests/test-cli.js +6 -10
  27. package/dist/tests/test-debug-session.js +130 -0
  28. package/dist/tests/test-enhanced-session-init.js +184 -0
  29. package/dist/tests/test-first-run-interactive.js +1 -0
  30. package/dist/tests/test-first-run-journey.js +274 -54
  31. package/dist/tests/test-fraim-issues.js +1 -1
  32. package/dist/tests/test-genericization.js +5 -25
  33. package/dist/tests/test-mcp-issue-integration.js +6 -2
  34. package/dist/tests/test-mcp-template-processing.js +156 -0
  35. package/dist/tests/test-modular-issue-tracking.js +161 -0
  36. package/dist/tests/test-package-size.js +7 -0
  37. package/dist/tests/test-pr-review-workflow.js +10 -6
  38. package/dist/tests/test-session-rehydration.js +5 -1
  39. package/dist/tests/test-telemetry.js +4 -0
  40. package/dist/tests/test-workflow-discovery.js +242 -0
  41. package/package.json +3 -1
  42. package/registry/scripts/create-website-structure.js +17 -2
  43. package/registry/scripts/profile-server.ts +1 -0
  44. package/registry/stubs/workflows/compliance/soc2-evidence-generator.md +11 -0
  45. package/registry/stubs/workflows/learning/build-skillset.md +11 -0
  46. package/registry/stubs/workflows/legal/contract-review-analysis.md +11 -0
  47. package/registry/stubs/workflows/legal/saas-contract-development.md +11 -0
@@ -177,19 +177,16 @@ Tag tests appropriately to ensure proper test suite execution:
177
177
  - **`unit`**: Tests that verify individual functions or classes in isolation
178
178
  - **`e2e`**: End-to-end tests that verify complete user workflows
179
179
 
180
- **Smoke Test Execution Rules:**
181
- If ANY tests are tagged "smoke" or you're modifying core functionality:
182
- 1. **MANDATORY**: Run full smoke test suite: `npm run test-smoke-ci`
183
- 2. **MANDATORY**: Include smoke test output in evidence
184
- 3. **MANDATORY**: All smoke tests must pass before proceeding
185
- 4. **BLOCKING**: Smoke test failures block phase completion
186
-
187
180
  ### Step 7: Basic Compilation Check
188
181
 
189
182
  **Verify code compiles:**
190
- ```bash
191
- npx tsc --noEmit --skipLibCheck
192
- ```
183
+
184
+ **Build Commands**: Always check `.fraim/config.json` first for `customizations.validation.buildCommand`, use that if available, otherwise default to `npm run build`.
185
+
186
+ **What to Look For**:
187
+ - Exit code 0 (success)
188
+ - No TypeScript compilation errors
189
+ - Clean build output
193
190
 
194
191
  **Must exit with code 0** (no errors)
195
192
 
@@ -23,16 +23,17 @@ All technical checks pass, confirming:
23
23
 
24
24
  ### Step 0: Read Project Validation Commands 📖
25
25
 
26
- **FIRST**: Read your project's validation commands from `.fraim/config.json`:
26
+ **FIRST**: Check your project's custom commands:
27
27
 
28
28
  ```bash
29
- # Read the config to get project-specific validation commands
30
- cat .fraim/config.json
31
- ```
29
+ # Check for custom build command
30
+ cat .fraim/config.json | grep -A 3 "buildCommand"
32
31
 
33
- Look for `customizations.validation.buildCommand` and `customizations.validation.smokeTestCommand`.
32
+ # Check for custom smoke test command
33
+ cat .fraim/config.json | grep -A 3 "smokeTestCommand"
34
+ ```
34
35
 
35
- **Use these commands instead of the generic ones below if they exist.**
36
+ **Use the configured commands if they exist, otherwise use the defaults shown below.**
36
37
 
37
38
  ### Step 1: Build Compilation Check ✅
38
39
 
@@ -43,7 +44,9 @@ Look for `customizations.validation.buildCommand` and `customizations.validation
43
44
 
44
45
  **Commands to Run** (use customizations.validation.buildCommand from config if available):
45
46
  ```bash
46
- # Run build (use customizations.validation.buildCommand if available, otherwise default)
47
+ # Use project-specific build command from .fraim/config.json if available:
48
+ # - Look for customizations.validation.buildCommand
49
+ # - Use that command if available, otherwise default to:
47
50
  npm run build
48
51
  ```
49
52
 
@@ -164,6 +167,7 @@ npm run build && npm test && git status
164
167
 
165
168
  ### Technical Standards
166
169
  - Read `.fraim/config.json` for the architecture document path (`customizations.architectureDoc`), then read the local architecture document to understand the full technical standards
170
+ - **Config Commands**: Always check `.fraim/config.json` first for `customizations.validation.buildCommand` and `customizations.validation.smokeTestCommand`, use those if available, otherwise use defaults
167
171
  - Use Successful Debugging Patterns from `rules/successful-debugging-patterns.md` via `get_fraim_file`
168
172
  - When using git commands directly (if MCP tools unavailable), read `rules/git-safe-commands.md` via `get_fraim_file`
169
173
 
@@ -181,6 +185,9 @@ npm run build && npm test && git status
181
185
 
182
186
  **Run smoke tests specifically:**
183
187
  ```bash
188
+ # Use project-specific command from .fraim/config.json if available
189
+ # Check: cat .fraim/config.json | grep "smokeTestCommand"
190
+ # Use configured command or default to:
184
191
  npm run test-smoke-ci
185
192
  ```
186
193
 
@@ -18,6 +18,10 @@ This is THE critical phase where you prove your implementation actually works. N
18
18
 
19
19
  ## RULES FOR THIS PHASE
20
20
 
21
+ ### Config-Aware Testing
22
+ **CRITICAL**: Always check `.fraim/config.json` first for project-specific test commands:
23
+ - `customizations.validation.testSuiteCommand` - Use this for comprehensive testing (default: `npm test`)
24
+
21
25
  ### Success Criteria
22
26
  Read `registry/rules/agent-success-criteria.md` via `get_fraim_file` for the complete framework. Focus on:
23
27
  - **Integrity** (honest reporting of validation results - never claim something works if you didn't test it)
@@ -86,17 +90,17 @@ grep -r "as any" src/ || echo "✅ No type bypassing found"
86
90
 
87
91
  **Commands to Run** (check .fraim/config.json for project-specific commands first):
88
92
  ```bash
89
- # 1. FIRST: Read your project's validation commands from .fraim/config.json
90
- cat .fraim/config.json | grep -A 10 "validation"
93
+ # 1. FIRST: Check for custom test commands
94
+ cat .fraim/config.json | grep -A 5 "validation"
91
95
 
92
- # 2. Run the comprehensive test suite (this runs ALL tests)
96
+ # 2. Run comprehensive test suite for current work
97
+ # Use customizations.validation.testSuiteCommand if available, otherwise:
93
98
  npm test
94
99
 
95
- # 3. Also run smoke tests specifically to verify core functionality
96
- npm run test-smoke-ci
97
-
98
- # 4. Run all tests in CI mode for complete coverage
99
- npm run test-all-ci
100
+ # 3. Run targeted tests for your specific changes (if applicable)
101
+ # Example: If you modified user authentication, run auth-related tests
102
+ # npm run test -- --grep "auth"
103
+ # OR: npm run test test-{issue-number}-*.ts
100
104
  ```
101
105
 
102
106
  **What to Look For**:
@@ -0,0 +1,188 @@
1
+ # Phase: address-pr-feedback
2
+
3
+ ## INTENT
4
+ To systematically address all PR feedback items by making targeted changes, replying to comments, and preparing for re-validation.
5
+
6
+ ## OUTCOME
7
+ All PR feedback addressed with:
8
+ - Targeted changes made for each feedback item
9
+ - Feedback file updated with resolutions
10
+ - PR comments replied to with explanations
11
+ - Changes validated and ready for re-review
12
+
13
+ ## RULES FOR THIS PHASE
14
+
15
+ ### Success Criteria
16
+ Read `registry/rules/agent-success-criteria.md` via `get_fraim_file` for the complete framework. Focus especially on:
17
+ - **Integrity** (document all changes made)
18
+ - **Correctness** (address feedback accurately)
19
+ - **Completeness** (address every UNADDRESSED item)
20
+
21
+ ### Simplicity Principles
22
+ Read `registry/rules/simplicity.md` via `get_fraim_file` for complete guidelines. Critical for feedback phase:
23
+ - **Targeted Changes**: Make minimal changes to address specific feedback
24
+ - **Manual Validation**: Test changes manually before updating PR
25
+ - **Clear Communication**: Reply to each comment with clear explanations
26
+
27
+ ## PRINCIPLES
28
+ - **Feedback-Driven**: Address only the specific issues raised in PR comments
29
+ - **Minimal Changes**: Avoid scope creep or unnecessary refactoring
30
+ - **Clear Communication**: Explain resolutions clearly to reviewers
31
+ - **Validation**: Ensure changes work before updating PR
32
+
33
+ ## 📋 WORKFLOW
34
+
35
+ ### Step 1: Read PR Feedback File
36
+
37
+ **MANDATORY**: Read the feedback file created by `wait-for-pr-review`:
38
+ - File location: `docs/evidence/{issue_number}-{workflow_type}-feedback.md`
39
+ - Identify all UNADDRESSED feedback items
40
+ - Understand the context and requirements for each item
41
+
42
+ ### Step 2: Address Each Feedback Item
43
+
44
+ **For each UNADDRESSED item:**
45
+
46
+ 1. **Understand the Feedback**:
47
+ - Read the comment carefully
48
+ - Identify what specific change is requested
49
+ - Determine the scope of the change needed
50
+
51
+ 2. **Make Targeted Changes**:
52
+ - Make minimal, focused changes to address the specific feedback
53
+ - Avoid unrelated changes or improvements
54
+ - Keep changes as small as possible while fully addressing the feedback
55
+
56
+ 3. **Update Feedback File**:
57
+ - Change status from UNADDRESSED to ADDRESSED
58
+ - Document your resolution approach
59
+ - Include details of what you changed
60
+
61
+ **Feedback File Update Format**:
62
+ ```markdown
63
+ ### Comment X - ADDRESSED
64
+ - **Author**: reviewer_name
65
+ - **Type**: pr_comment|review_comment|review
66
+ - **File**: file_path (if applicable)
67
+ - **Line**: line_number (if applicable)
68
+ - **Comment**: Original feedback text
69
+ - **Status**: ADDRESSED
70
+ - **Resolution**: Detailed explanation of how you addressed this feedback
71
+ - **Changes Made**: Specific files/lines modified
72
+ ```
73
+
74
+ ### Step 3: Validate Changes
75
+
76
+ **Test your changes:**
77
+ - Run compilation check: `npx tsc --noEmit --skipLibCheck`
78
+ - Run relevant tests to ensure no regressions
79
+ - Test manually if the feedback involves UI/API behavior
80
+ - Verify the specific issue mentioned in feedback is resolved
81
+
82
+ ### Step 4: Reply to PR Comments
83
+
84
+ **For each addressed comment:**
85
+ - Reply to the original PR comment
86
+ - Explain what you changed and how it addresses their concern
87
+ - Reference specific files/lines if helpful
88
+ - Be clear and professional in your communication
89
+
90
+ **Example reply format**:
91
+ ```
92
+ ✅ **Addressed**: [Brief description of what you changed]
93
+
94
+ **Changes made**:
95
+ - [Specific change 1]
96
+ - [Specific change 2]
97
+
98
+ **Files modified**: `path/to/file.ts`, `path/to/test.ts`
99
+
100
+ This should resolve the [specific issue mentioned]. Please let me know if you need any clarification!
101
+ ```
102
+
103
+ ### Step 5: Commit and Push Changes
104
+
105
+ **Commit your changes:**
106
+ - Use clear commit messages that reference the feedback
107
+ - Example: `Address PR feedback: Fix error handling in auth service`
108
+ - Push changes to the PR branch
109
+
110
+ ## 📸 EVIDENCE REQUIREMENTS
111
+
112
+ You MUST provide concrete evidence for all claims:
113
+
114
+ 1. **All Feedback Addressed**: Every UNADDRESSED item in feedback file is now ADDRESSED
115
+ 2. **Changes Made**: Specific code changes made for each feedback item
116
+ 3. **Validation Complete**: Tests pass and changes work as expected
117
+ 4. **PR Updated**: Changes committed, pushed, and comments replied to
118
+
119
+ ## VALIDATION
120
+
121
+ ### Phase Complete When:
122
+ - ✅ All UNADDRESSED items in feedback file are now ADDRESSED
123
+ - ✅ Feedback file updated with resolution details for each item
124
+ - ✅ Targeted changes made to address each specific feedback
125
+ - ✅ Changes validated (compilation, tests, manual testing)
126
+ - ✅ PR comments replied to with clear explanations
127
+ - ✅ Changes committed and pushed to PR branch
128
+
129
+ ### Phase Incomplete If:
130
+ - ❌ Any UNADDRESSED items remain in feedback file
131
+ - ❌ Changes don't actually address the feedback given
132
+ - ❌ Tests failing after changes
133
+ - ❌ Compilation errors introduced
134
+ - ❌ PR comments not replied to
135
+ - ❌ Changes not committed/pushed
136
+
137
+ ### Report Back:
138
+ When you complete this phase, call:
139
+
140
+ ```javascript
141
+ seekCoachingOnNextStep({
142
+ workflowType: "{workflow_type}",
143
+ issueNumber: "{issue_number}",
144
+ currentPhase: "address-pr-feedback",
145
+ status: "complete",
146
+ findings: {
147
+ feedbackItemsAddressed: {total_items_addressed},
148
+ changesValidated: true
149
+ },
150
+ evidence: {
151
+ feedbackFileUpdated: "All UNADDRESSED items now ADDRESSED with resolutions",
152
+ changesMade: "Brief summary of changes made",
153
+ validationResults: "Compilation and tests pass",
154
+ prCommentsReplied: "Replied to all PR comments with explanations"
155
+ }
156
+ })
157
+ ```
158
+
159
+ If feedback addressing incomplete, iterate:
160
+ ```javascript
161
+ seekCoachingOnNextStep({
162
+ workflowType: "{workflow_type}",
163
+ issueNumber: "{issue_number}",
164
+ currentPhase: "address-pr-feedback",
165
+ status: "incomplete",
166
+ findings: {
167
+ uncertainties: ["Issues encountered", "What needs to be fixed"]
168
+ }
169
+ })
170
+ ```
171
+
172
+ ## SCRIPTS
173
+
174
+ **Compile TypeScript:**
175
+ ```bash
176
+ npx tsc --noEmit --skipLibCheck
177
+ ```
178
+
179
+ **Run tests:**
180
+ ```bash
181
+ npm test
182
+ ```
183
+
184
+ **Check git status:**
185
+ ```bash
186
+ git status
187
+ git diff
188
+ ```
@@ -0,0 +1,19 @@
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
+ }
@@ -0,0 +1,19 @@
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
+ }
@@ -50,11 +50,12 @@ class AICoach {
50
50
  * Handle coaching request from agent
51
51
  */
52
52
  async handleCoachingRequest(args) {
53
- // console.log(`🤖 AI Coach: Providing guidance for ${args.workflowType} workflow, phase: ${args.currentPhase}, status: ${args.status}`);
53
+ console.log(`🤖 AI Coach: Providing guidance for ${args.workflowType} workflow, phase: ${args.currentPhase}, status: ${args.status}`);
54
54
  // Validate required parameters
55
55
  const requiredParams = ['workflowType', 'currentPhase', 'status'];
56
56
  const missingParams = requiredParams.filter(param => !args[param]);
57
57
  if (missingParams.length > 0) {
58
+ console.log(`❌ AI Coach: Missing required parameters: ${missingParams.join(', ')}`);
58
59
  throw new Error(`Missing required parameters: ${missingParams.join(', ')}`);
59
60
  }
60
61
  // Handle missing or empty issue number gracefully
@@ -78,10 +79,12 @@ Example: \`seekCoachingOnNextStep({ workflowType: "${args.workflowType}", issueN
78
79
  // Validate workflow type
79
80
  const validWorkflowTypes = ['implement', 'spec', 'design', 'test'];
80
81
  if (!validWorkflowTypes.includes(args.workflowType)) {
82
+ console.log(`❌ AI Coach: Invalid workflow type: ${args.workflowType}`);
81
83
  throw new Error(`Invalid workflow type: ${args.workflowType}. Valid types: ${validWorkflowTypes.join(', ')}`);
82
84
  }
83
85
  // Validate phase for workflow type
84
86
  const issueType = this.extractIssueType(args.findings, args.evidence);
87
+ console.log(`🔍 AI Coach: Extracted issue type: ${issueType}`);
85
88
  if (!(0, phase_flow_js_1.isPhaseValidForWorkflow)(args.currentPhase, args.workflowType, issueType)) {
86
89
  // Special handling for implement workflow to provide better error messages
87
90
  if (args.workflowType === 'implement') {
@@ -132,15 +135,19 @@ ${this.getValidPhasesForIssueType(issueType).join(' → ')}
132
135
  }
133
136
  }
134
137
  if (args.status === 'complete') {
138
+ console.log(`✅ AI Coach: Generating completion message`);
135
139
  return await this.generateCompletionMessage(args);
136
140
  }
137
141
  else if (args.status === 'incomplete') {
142
+ console.log(`🤝 AI Coach: Generating help message`);
138
143
  return await this.generateHelpMessage(args);
139
144
  }
140
145
  else if (args.status === 'failure') {
146
+ console.log(`❌ AI Coach: Generating failure message`);
141
147
  return await this.generateFailureMessage(args);
142
148
  }
143
149
  else {
150
+ console.log(`📖 AI Coach: Getting phase instructions for ${args.currentPhase}`);
144
151
  return await this.getPhaseInstructions(args.currentPhase, args.workflowType);
145
152
  }
146
153
  }
@@ -61,6 +61,25 @@ const TEST_PHASE_FLOW = [
61
61
  * @returns Next phase or null if at end of workflow
62
62
  */
63
63
  function getNextPhase(currentPhase, workflowType, issueType) {
64
+ // Special handling for address-pr-feedback phase
65
+ if (currentPhase === 'address-pr-feedback') {
66
+ // Success path: After addressing feedback, go back to appropriate validation phase
67
+ if (workflowType === 'implement') {
68
+ return 'implement-validate';
69
+ }
70
+ else if (workflowType === 'spec') {
71
+ return 'spec-completeness-review';
72
+ }
73
+ else if (workflowType === 'design') {
74
+ return 'design-completeness-review';
75
+ }
76
+ else if (workflowType === 'test') {
77
+ return 'test-validate';
78
+ }
79
+ else {
80
+ throw new Error(`Unknown workflow type: ${workflowType}`);
81
+ }
82
+ }
64
83
  let flow;
65
84
  if (workflowType === 'implement') {
66
85
  if (!issueType) {
@@ -121,10 +140,11 @@ function isPhaseValidForWorkflow(phase, workflowType, issueType) {
121
140
  * Get the phase to return to when a phase fails
122
141
  * @param failedPhase - The phase that failed
123
142
  * @param workflowType - Type of workflow
124
- * @param issueType - Type of issue (only used for implement workflow)
143
+ * @param issueType - Type of issue (currently unused - failure handling is the same for bug/feature)
125
144
  * @returns Phase to return to
126
145
  */
127
- function getPhaseOnFailure(failedPhase, workflowType, issueType) {
146
+ function getPhaseOnFailure(failedPhase, workflowType, issueType // eslint-disable-line @typescript-eslint/no-unused-vars
147
+ ) {
128
148
  if (workflowType === 'implement') {
129
149
  // Implement workflow failure handling
130
150
  switch (failedPhase) {
@@ -147,9 +167,11 @@ function getPhaseOnFailure(failedPhase, workflowType, issueType) {
147
167
  case 'submit-pr':
148
168
  return 'implement-completeness-review'; // PR submission issues, review completeness
149
169
  case 'wait-for-pr-review':
150
- // This phase determines where to go based on PR comment analysis
151
- // Will be handled by the PR comment analysis logic
152
- return 'implement-code'; // Default fallback for PR feedback
170
+ // PR feedback should go to address-pr-feedback phase
171
+ return 'address-pr-feedback';
172
+ case 'address-pr-feedback':
173
+ // If addressing PR feedback fails, retry the same phase
174
+ return 'address-pr-feedback';
153
175
  default:
154
176
  return 'implement-code'; // Default fallback
155
177
  }
@@ -164,7 +186,9 @@ function getPhaseOnFailure(failedPhase, workflowType, issueType) {
164
186
  case 'submit-pr':
165
187
  return 'spec-completeness-review';
166
188
  case 'wait-for-pr-review':
167
- return 'spec-spec'; // PR feedback usually means spec changes needed
189
+ return 'address-pr-feedback'; // PR feedback goes to address phase
190
+ case 'address-pr-feedback':
191
+ return 'address-pr-feedback'; // Retry addressing feedback
168
192
  default:
169
193
  return 'spec-spec';
170
194
  }
@@ -179,7 +203,9 @@ function getPhaseOnFailure(failedPhase, workflowType, issueType) {
179
203
  case 'submit-pr':
180
204
  return 'design-completeness-review';
181
205
  case 'wait-for-pr-review':
182
- return 'design-design'; // PR feedback usually means design changes needed
206
+ return 'address-pr-feedback'; // PR feedback goes to address phase
207
+ case 'address-pr-feedback':
208
+ return 'address-pr-feedback'; // Retry addressing feedback
183
209
  default:
184
210
  return 'design-design';
185
211
  }
@@ -194,7 +220,9 @@ function getPhaseOnFailure(failedPhase, workflowType, issueType) {
194
220
  case 'submit-pr':
195
221
  return 'test-validate';
196
222
  case 'wait-for-pr-review':
197
- return 'test-test'; // PR feedback usually means test changes needed
223
+ return 'address-pr-feedback'; // PR feedback goes to address phase
224
+ case 'address-pr-feedback':
225
+ return 'address-pr-feedback'; // Retry addressing feedback
198
226
  default:
199
227
  return 'test-test';
200
228
  }
@@ -46,10 +46,11 @@ const runInitProject = async () => {
46
46
  ...types_1.DEFAULT_FRAIM_CONFIG.project,
47
47
  name: remoteInfo.repo || path_1.default.basename(projectRoot)
48
48
  },
49
- git: {
50
- ...types_1.DEFAULT_FRAIM_CONFIG.git,
51
- repoOwner: remoteInfo.owner || types_1.DEFAULT_FRAIM_CONFIG.git.repoOwner,
52
- repoName: remoteInfo.repo || path_1.default.basename(projectRoot)
49
+ repository: {
50
+ provider: 'github',
51
+ owner: remoteInfo.owner || 'your-username',
52
+ name: remoteInfo.repo || path_1.default.basename(projectRoot),
53
+ defaultBranch: 'main'
53
54
  }
54
55
  };
55
56
  fs_1.default.writeFileSync(configPath, JSON.stringify(config, null, 2));
@@ -10,7 +10,6 @@ const path_1 = __importDefault(require("path"));
10
10
  const chalk_1 = __importDefault(require("chalk"));
11
11
  const first_run_1 = require("../setup/first-run");
12
12
  const sync_1 = require("./sync");
13
- const types_1 = require("../../fraim/types");
14
13
  const git_utils_1 = require("../../utils/git-utils");
15
14
  const version_utils_1 = require("../../utils/version-utils");
16
15
  const script_sync_utils_1 = require("../../utils/script-sync-utils");
@@ -35,16 +34,18 @@ const runInit = async () => {
35
34
  process.exit(1);
36
35
  }
37
36
  const config = {
38
- ...types_1.DEFAULT_FRAIM_CONFIG,
39
37
  version: (0, version_utils_1.getFraimVersion)(),
40
38
  project: {
41
- ...types_1.DEFAULT_FRAIM_CONFIG.project,
42
39
  name: remoteInfo.repo
43
40
  },
44
- git: {
45
- ...types_1.DEFAULT_FRAIM_CONFIG.git,
46
- repoOwner: remoteInfo.owner || types_1.DEFAULT_FRAIM_CONFIG.git.repoOwner,
47
- repoName: remoteInfo.repo
41
+ repository: {
42
+ provider: 'github',
43
+ owner: remoteInfo.owner || 'your-username',
44
+ name: remoteInfo.repo,
45
+ defaultBranch: remoteInfo.defaultBranch || 'main'
46
+ },
47
+ customizations: {
48
+ workflowsPath: '.fraim/workflows'
48
49
  }
49
50
  };
50
51
  fs_1.default.writeFileSync(configPath, JSON.stringify(config, null, 2));