fraim-framework 2.0.43 → 2.0.45

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 (73) hide show
  1. package/bin/fraim.js +1 -1
  2. package/dist/registry/ai-manager-rules/design-phases/design-completeness-review.md +73 -0
  3. package/dist/registry/ai-manager-rules/design-phases/design-design.md +145 -0
  4. package/dist/registry/ai-manager-rules/design-phases/design.md +108 -0
  5. package/dist/registry/ai-manager-rules/design-phases/finalize.md +60 -0
  6. package/dist/registry/ai-manager-rules/design-phases/validate.md +125 -0
  7. package/dist/registry/ai-manager-rules/implement-phases/code.md +323 -0
  8. package/dist/registry/ai-manager-rules/implement-phases/completeness-review.md +94 -0
  9. package/dist/registry/ai-manager-rules/implement-phases/finalize.md +177 -0
  10. package/dist/registry/ai-manager-rules/implement-phases/implement-code.md +286 -0
  11. package/dist/registry/ai-manager-rules/implement-phases/implement-completeness-review.md +120 -0
  12. package/dist/registry/ai-manager-rules/implement-phases/implement-regression.md +173 -0
  13. package/dist/registry/ai-manager-rules/implement-phases/implement-repro.md +104 -0
  14. package/dist/registry/ai-manager-rules/implement-phases/implement-scoping.md +100 -0
  15. package/dist/registry/ai-manager-rules/implement-phases/implement-smoke.md +230 -0
  16. package/dist/registry/ai-manager-rules/implement-phases/implement-spike.md +121 -0
  17. package/dist/registry/ai-manager-rules/implement-phases/implement-validate.md +371 -0
  18. package/dist/registry/ai-manager-rules/implement-phases/quality-review.md +304 -0
  19. package/dist/registry/ai-manager-rules/implement-phases/regression.md +159 -0
  20. package/dist/registry/ai-manager-rules/implement-phases/repro.md +101 -0
  21. package/dist/registry/ai-manager-rules/implement-phases/scoping.md +93 -0
  22. package/dist/registry/ai-manager-rules/implement-phases/smoke.md +225 -0
  23. package/dist/registry/ai-manager-rules/implement-phases/spike.md +118 -0
  24. package/dist/registry/ai-manager-rules/implement-phases/validate.md +347 -0
  25. package/dist/registry/ai-manager-rules/shared-phases/finalize.md +169 -0
  26. package/dist/registry/ai-manager-rules/shared-phases/submit-pr.md +202 -0
  27. package/dist/registry/ai-manager-rules/shared-phases/wait-for-pr-review.md +170 -0
  28. package/dist/registry/ai-manager-rules/spec-phases/finalize.md +60 -0
  29. package/dist/registry/ai-manager-rules/spec-phases/spec-completeness-review.md +66 -0
  30. package/dist/registry/ai-manager-rules/spec-phases/spec-spec.md +139 -0
  31. package/dist/registry/ai-manager-rules/spec-phases/spec.md +102 -0
  32. package/dist/registry/ai-manager-rules/spec-phases/validate.md +118 -0
  33. package/dist/src/ai-manager/ai-manager.js +380 -119
  34. package/dist/src/ai-manager/evidence-validator.js +309 -0
  35. package/dist/src/ai-manager/phase-flow.js +244 -0
  36. package/dist/src/ai-manager/types.js +5 -0
  37. package/dist/src/fraim-mcp-server.js +45 -153
  38. package/dist/src/static-website-middleware.js +75 -0
  39. package/dist/tests/test-ai-coach-edge-cases.js +415 -0
  40. package/dist/tests/test-ai-coach-mcp-integration.js +432 -0
  41. package/dist/tests/test-ai-coach-performance.js +328 -0
  42. package/dist/tests/test-ai-coach-phase-content.js +264 -0
  43. package/dist/tests/test-ai-coach-workflows.js +487 -0
  44. package/dist/tests/test-ai-manager-phase-protocol.js +147 -0
  45. package/dist/tests/test-ai-manager.js +60 -71
  46. package/dist/tests/test-evidence-validation.js +221 -0
  47. package/dist/tests/test-mcp-lifecycle-methods.js +18 -23
  48. package/dist/tests/test-pr-review-integration.js +1 -0
  49. package/dist/tests/test-pr-review-workflow.js +299 -0
  50. package/dist/website/.nojekyll +0 -0
  51. package/dist/website/404.html +101 -0
  52. package/dist/website/CNAME +1 -0
  53. package/dist/website/README.md +22 -0
  54. package/dist/website/demo.html +604 -0
  55. package/dist/website/images/.gitkeep +1 -0
  56. package/dist/website/images/fraim-logo.png +0 -0
  57. package/dist/website/index.html +290 -0
  58. package/dist/website/pricing.html +414 -0
  59. package/dist/website/script.js +55 -0
  60. package/dist/website/styles.css +2647 -0
  61. package/package.json +2 -1
  62. package/registry/agent-guardrails.md +1 -1
  63. package/registry/stubs/workflows/brainstorming/blue-sky-brainstorming.md +11 -0
  64. package/registry/stubs/workflows/brainstorming/codebase-brainstorming.md +11 -0
  65. package/registry/stubs/workflows/compliance/detect-compliance-requirements.md +11 -0
  66. package/registry/stubs/workflows/compliance/generate-audit-evidence.md +11 -0
  67. package/registry/stubs/workflows/learning/synthesize-learnings.md +11 -0
  68. package/registry/stubs/workflows/legal/nda.md +11 -0
  69. package/registry/stubs/workflows/legal/patent-filing.md +11 -0
  70. package/registry/stubs/workflows/legal/trademark-filing.md +11 -0
  71. package/registry/stubs/workflows/marketing/domain-registration.md +11 -0
  72. package/registry/stubs/workflows/product-building/design.md +1 -1
  73. package/registry/stubs/workflows/product-building/implement.md +1 -2
@@ -0,0 +1,286 @@
1
+ # Phase: Code
2
+
3
+ ## INTENT
4
+ To write the minimal, testable code needed to fix the bug or implement the feature, following approved designs and established patterns.
5
+
6
+ ## OUTCOME
7
+ Working implementation that:
8
+ - Fixes the bug or implements the feature
9
+ - Follows approved design/RFC
10
+ - Includes comprehensive tests
11
+ - Maintains code quality
12
+ - Is ready for validation
13
+
14
+ ## 🎯 SUCCESS MINDSET
15
+
16
+ **Your Goal**: Working application that users can actually use, not just passing tests.
17
+
18
+ **Critical Success Factors**:
19
+ - 🔍 **Manual validation is MANDATORY** - You WILL test in browser/API/CLI manually
20
+ - ⚠️ **Every error must be investigated** - No assumptions, no "that's probably fine"
21
+ - 🚫 **No placeholder code** - Implement complete solutions, no task placeholders or "for now" comments
22
+ - 📊 **100% test success required** - 91% is failure, 99% is failure, only 100% is success
23
+ - 🏗️ **Prototype-first** - Build simplest end-to-end solution, then engineer it properly
24
+
25
+ ## RULES FOR THIS PHASE
26
+
27
+ ### Success Criteria
28
+ Read `registry/rules/agent-success-criteria.md` via `get_fraim_file` for the complete framework. Focus especially on:
29
+ - **Integrity** (never claim tests pass if you didn't run them)
30
+ - **Correctness** (follow architecture, tests must pass, no `any` types)
31
+ - **Completeness** (implement everything in the issue description)
32
+
33
+ ### Simplicity Principles
34
+ Read `registry/rules/simplicity.md` via `get_fraim_file` for complete guidelines. Critical for coding phase:
35
+ - **Prototype-First Development**: Build simplest solution that works end-to-end, validate manually, then engineer correctly
36
+ - **Manual Validation Required**: Test with browser/curl before creating automated tests
37
+ - **Resource Waste Prevention**: Maximum 2 retries for expensive operations
38
+ - **NEVER use placeholder comments** like "For now", "task placeholders", "fix-me notes"
39
+
40
+ ### Architecture Compliance
41
+ Read `.fraim/config.json` for the architecture document path (`customizations.architectureDoc`), then read the local architecture document to understand the full architecture guidelines. Follow all architectural standards - no shortcuts.
42
+
43
+ ### Git Operations (if needed)
44
+ When using git commands directly (if MCP tools unavailable), read `rules/git-safe-commands.md` via `get_fraim_file` to avoid interactive commands that hang agents.
45
+
46
+ ### Failure Handling
47
+ - **If implementation fails**: Return to implement-scoping phase to re-understand requirements
48
+ - **If tests fail**: Fix implementation until all tests pass
49
+ - **If architecture violations**: Return to implement-scoping to understand constraints better
50
+
51
+ ## PRINCIPLES
52
+ - **Design-Driven**: Follow approved RFCs and design documents
53
+ - **Minimal Implementation**: Write only code needed for this issue
54
+ - **Test-First**: Write tests before or alongside implementation
55
+ - **Quality Focus**: Maintain code quality and follow patterns
56
+ - **Complete**: All aspects of design/spec implemented
57
+
58
+ ## 📋 ENHANCED WORKFLOW
59
+
60
+ ### Step 1: Prototype-First Development
61
+
62
+ **Build Simplest End-to-End Solution**:
63
+ - Focus on getting something working, not perfect
64
+ - Don't worry about code quality initially
65
+ - Prove the approach works before optimizing
66
+ - Get basic functionality working first
67
+
68
+ **Manual Validation (CRITICAL)**:
69
+ - Test every step manually using browser/curl/CLI
70
+ - Verify each acceptance criteria works
71
+ - Take screenshots/capture output as evidence
72
+ - Fix any issues found immediately
73
+
74
+ ### Step 2: Review Design/Spec
75
+
76
+ **For Bugs:**
77
+ - Review bug description and repro test
78
+ - Understand root cause
79
+ - Plan minimal fix
80
+
81
+ **For Features:**
82
+ - Review approved RFC/design document
83
+ - Review spike/POC findings (if applicable)
84
+ - Understand all acceptance criteria
85
+ - Plan implementation approach
86
+
87
+ ### Step 3: Check for Design and PR Feedback
88
+
89
+ **CRITICAL**: Before implementing, check for feedback:
90
+ - **Design Review Feedback**: `docs/evidence/{issue_number}-design-reviewer-feedback.md`
91
+ - **Feature Review Feedback**: `docs/evidence/{issue_number}-feature-reviewer-feedback.md`
92
+ - **PR Review Feedback**: `docs/evidence/{issue_number}-implement-feedback.md`
93
+
94
+ **If any feedback exists:**
95
+ - **MUST address all UNADDRESSED items** before proceeding
96
+ - Update feedback files after addressing each item
97
+ - Change status from UNADDRESSED to ADDRESSED with resolution details
98
+ - Cannot skip or defer feedback items
99
+ - Phase cannot complete until all feedback is addressed
100
+
101
+ **PR Feedback File Format** (if exists):
102
+ ```markdown
103
+ ### Comment X - ADDRESSED
104
+ - **Author**: reviewer_name
105
+ - **Comment**: Original feedback
106
+ - **Status**: ADDRESSED
107
+ - **Resolution**: How you addressed this feedback
108
+ ```
109
+
110
+ ### Step 4: Implement Changes
111
+
112
+ **For Bugs:**
113
+ - Make minimal changes to fix the issue
114
+ - Focus on root cause, not symptoms
115
+ - Avoid unrelated changes
116
+ - Keep diff small and focused
117
+
118
+ **For Features:**
119
+ - Implement all aspects from design/spec
120
+ - Follow existing patterns and architecture
121
+ - Create necessary files/modules
122
+ - Implement all API contracts
123
+ - Implement all data models
124
+ - Implement all user interfaces
125
+ - No placeholder code for core functionality
126
+
127
+ ### Step 5: Fix All Errors (MANDATORY)
128
+
129
+ **Error Investigation Requirements**:
130
+ - **Every error in logs must be investigated**
131
+ - **No error is "expected" until proven**
132
+ - **Fix root causes, not symptoms**
133
+ - **Document why any remaining errors are acceptable**
134
+
135
+ **Common Error Sources**:
136
+ - Server startup errors
137
+ - API connection errors
138
+ - Database connection errors
139
+ - TypeScript compilation errors
140
+ - Test execution errors
141
+
142
+ ### Step 6: Write Comprehensive Tests
143
+
144
+ **MANDATORY**: Every issue requires tests - no exceptions.
145
+
146
+ **For Bugs:**
147
+ - Verify repro test from implement-repro phase now passes
148
+ - Add additional edge case tests if needed
149
+ - Ensure tests cover the fix
150
+
151
+ **For Features:**
152
+ - Write tests for all acceptance criteria
153
+ - Test main user scenarios
154
+ - Test edge cases
155
+ - Test error conditions
156
+ - Read `.fraim/config.json` for the architecture document path (`customizations.architectureDoc`), then read the local architecture document to understand the full test architecture standards
157
+
158
+ **Test Requirements:**
159
+ - Use shared-server-utils.ts for server tests
160
+ - Unique API keys per test
161
+ - Proper cleanup in finally blocks
162
+ - No individual server instances
163
+ - Proper timeouts (5-10s for network calls)
164
+ - Tests must validate real functionality, not mocks
165
+ - No tests that default to passing
166
+
167
+ **Test Tagging Guidelines:**
168
+ Tag tests appropriately to ensure proper test suite execution:
169
+
170
+ - **`smoke`**: Tag tests as "smoke" if they verify:
171
+ - Core system functionality (CLI commands, server startup, basic workflows)
172
+ - Critical user journeys (init, sync, basic operations)
173
+ - Integration points between major components
174
+ - Functionality that, if broken, would make the system unusable
175
+
176
+ - **`integration`**: Tests that verify multiple components working together
177
+ - **`unit`**: Tests that verify individual functions or classes in isolation
178
+ - **`e2e`**: End-to-end tests that verify complete user workflows
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
+ ### Step 7: Basic Compilation Check
188
+
189
+ **Verify code compiles:**
190
+ ```bash
191
+ npx tsc --noEmit --skipLibCheck
192
+ ```
193
+
194
+ **Must exit with code 0** (no errors)
195
+
196
+ If compilation fails:
197
+ - Fix TypeScript errors
198
+ - Re-compile
199
+ - Iterate until clean
200
+
201
+ **Note**: Full validation, testing, and manual verification will be handled in subsequent phases (implement-validate, implement-smoke, implement-regression).
202
+
203
+ ## 📸 EVIDENCE REQUIREMENTS
204
+
205
+ You MUST provide concrete evidence for all claims:
206
+
207
+ 1. **Implementation Complete**: Code written per design/spec
208
+ 2. **Tests Written**: Comprehensive test coverage for new functionality
209
+ 3. **Compilation Success**: TypeScript compiles without errors
210
+ 4. **Basic Functionality**: Code implements the required features/fixes
211
+
212
+ **Note**: Screenshots, manual validation, server logs, and API responses will be captured in the implement-validate phase.
213
+
214
+ ## VALIDATION
215
+
216
+ ### Phase Complete When:
217
+ - ✅ Implementation complete per design/spec
218
+ - ✅ (Bugs) Minimal, focused changes
219
+ - ✅ (Features) All design aspects implemented
220
+ - ✅ Tests written for new functionality
221
+ - ✅ TypeScript compiles cleanly
222
+ - ✅ Design feedback addressed (if applicable)
223
+ - ✅ **PR feedback addressed** (if `docs/evidence/{issue_number}-implement-feedback.md` exists)
224
+ - ✅ Code implements required features/fixes
225
+
226
+ ### Phase Incomplete If:
227
+ - ❌ Design/spec not fully implemented
228
+ - ❌ No tests written for new functionality
229
+ - ❌ TypeScript compilation errors
230
+ - ❌ Design feedback not addressed
231
+ - ❌ **PR feedback not addressed** (UNADDRESSED items remain in feedback file)
232
+ - ❌ Code doesn't implement required functionality
233
+
234
+ ### Report Back:
235
+ When you complete this phase, call:
236
+
237
+ ```javascript
238
+ seekCoachingOnNextStep({
239
+ workflowType: "implement",
240
+ issueNumber: "{issue_number}",
241
+ currentPhase: "implement-code",
242
+ status: "complete",
243
+ findings: {
244
+ issueType: "bug", // or "feature" - Required for phase validation
245
+ evidence: "Brief summary of what you implemented and validated"
246
+ },
247
+ evidence: {
248
+ implementation: "Brief summary of what you implemented",
249
+ testsWritten: "Description of tests created for new functionality",
250
+ compilationStatus: "TypeScript compiles without errors",
251
+ feedbackAddressed: "All design/PR feedback addressed (if applicable)"
252
+ }
253
+ })
254
+ ```
255
+
256
+ If implementation incomplete, iterate:
257
+ ```javascript
258
+ seekCoachingOnNextStep({
259
+ workflowType: "implement",
260
+ issueNumber: "{issue_number}",
261
+ currentPhase: "implement-code",
262
+ status: "incomplete",
263
+ findings: {
264
+ issueType: "bug", // or "feature" - Required for phase validation
265
+ uncertainties: ["Issues encountered", "What needs to be fixed"]
266
+ }
267
+ })
268
+ ```
269
+ ```
270
+
271
+ ## SCRIPTS
272
+
273
+ **Run tests:**
274
+ ```bash
275
+ npm test -- path/to/test.test.ts
276
+ ```
277
+
278
+ **Compile TypeScript:**
279
+ ```bash
280
+ npx tsc --noEmit --skipLibCheck
281
+ ```
282
+
283
+ **Start dev server (for manual testing in validate phase):**
284
+ ```bash
285
+ npm run dev
286
+ ```
@@ -0,0 +1,120 @@
1
+ # Phase: Implement-Completeness-Review
2
+
3
+ ## INTENT
4
+ To verify that all design aspects have been implemented and that the work fully addresses the requirements from the design document or issue specification.
5
+
6
+ ## OUTCOME
7
+ Confirmation that:
8
+ - All design aspects implemented
9
+ - All acceptance criteria met
10
+ - Implementation matches design specifications
11
+ - Work is complete and ready for finalization
12
+
13
+ ## PRINCIPLES
14
+ - **Design Fidelity**: Implementation must match design specifications
15
+ - **Complete Coverage**: All design aspects must be addressed
16
+ - **Evidence-Based**: Use existing comprehensive review workflows
17
+
18
+ ## WORKFLOW
19
+
20
+ ### Step 1: Check for PR Feedback to Address
21
+
22
+ - Check for PR feedback file: `docs/evidence/{issue_number}-implement-feedback.md`
23
+ - If feedback file exists, verify all comments have been addressed before proceeding
24
+
25
+ **PR Feedback Validation:**
26
+ - Read the feedback file to see all previous review rounds
27
+ - Ensure all items marked as UNADDRESSED have been resolved
28
+ - Update feedback file with ADDRESSED status and resolution details
29
+ - Cannot proceed until all feedback items are properly addressed
30
+
31
+ **Expected behavior:**
32
+ - All UNADDRESSED items in feedback file must be resolved
33
+ - Each resolved item should have detailed resolution explanation
34
+ - Phase cannot complete with any remaining UNADDRESSED items
35
+
36
+ ### Step 2: Execute Design Review Workflow
37
+
38
+ Use the comprehensive design validation workflow:
39
+ - Read `registry/workflows/reviewer/review-implementation-vs-design-spec.md` via `get_fraim_file`
40
+ - Follow the complete systematic review process
41
+ - This workflow provides detailed checklists, validation steps, and templates
42
+ - Works for both bugs and features - all should be reviewed against their design spec
43
+
44
+ ### Step 3: Execute Review Workflow
45
+
46
+ **Follow the design review workflow completely:**
47
+ - Use all the checklists provided
48
+ - Execute all validation steps
49
+ - Create feedback documents using the templates
50
+ - Follow the iteration limits (max 3)
51
+
52
+ ### Step 4: Architecture Compliance
53
+
54
+ Read `.fraim/config.json` for the architecture document path (`customizations.architectureDoc`), then read the local architecture document to understand the full architecture guidelines. Verify implementation follows all design standards.
55
+
56
+ ## VALIDATION
57
+
58
+ ### Phase Complete When:
59
+ - ✅ PR comments addressed (if applicable)
60
+ - ✅ PR comment verification script passes (if applicable)
61
+ - ✅ Appropriate review workflow executed completely
62
+ - ✅ All workflow checklists completed
63
+ - ✅ All design aspects verified per workflow
64
+ - ✅ Evidence quality meets workflow standards
65
+ - ✅ Feedback documents created using workflow templates
66
+ - ✅ Architecture compliance verified
67
+
68
+ ### Phase Incomplete If:
69
+ - ❌ PR comments not properly addressed
70
+ - ❌ PR comment verification script fails
71
+ - ❌ Review workflow not followed completely
72
+ - ❌ Workflow checklists incomplete
73
+ - ❌ Design aspects not verified per workflow standards
74
+ - ❌ Evidence quality insufficient per workflow criteria
75
+ - ❌ Feedback documents missing or not using templates
76
+
77
+ ### Report Back:
78
+ When you complete this phase, call:
79
+
80
+ ```javascript
81
+ seekCoachingOnNextStep({
82
+ workflowType: "implement",
83
+ issueNumber: "{issue_number}",
84
+ currentPhase: "implement-completeness-review",
85
+ status: "complete",
86
+ findings: {
87
+ issueType: "bug" // or "feature" - Required for phase validation
88
+ },
89
+ evidence: {
90
+ reviewWorkflowUsed: "review-implementation-vs-design-spec", // Which workflow was used
91
+ workflowChecklistsComplete: "YES", // All checklists from workflow completed?
92
+ designAspectsVerified: "YES", // All design aspects verified per workflow?
93
+ evidenceQualityMet: "YES", // Evidence meets workflow standards?
94
+ feedbackDocumentsCreated: "YES", // Feedback documents created using templates?
95
+ architectureCompliant: "YES", // Architecture compliance verified?
96
+ reviewDecision: "APPROVE", // APPROVE/REQUEST_CHANGES/REJECT per workflow
97
+ summary: "Completed systematic design review using comprehensive workflow. All design aspects verified and documented."
98
+ }
99
+ })
100
+ ```
101
+
102
+ If review reveals issues:
103
+ ```javascript
104
+ seekCoachingOnNextStep({
105
+ workflowType: "implement",
106
+ issueNumber: "{issue_number}",
107
+ currentPhase: "implement-completeness-review",
108
+ status: "incomplete",
109
+ findings: {
110
+ issueType: "bug" // or "feature" - Required for phase validation
111
+ },
112
+ evidence: {
113
+ reviewWorkflowUsed: "review-implementation-vs-design-spec",
114
+ reviewDecision: "REQUEST_CHANGES", // or "REJECT"
115
+ issuesFound: ["Missing test case X per workflow checklist", "Design requirement Y not implemented"],
116
+ feedbackDocumentLocation: "docs/evidence/{issue}-design-reviewer-feedback.md",
117
+ nextAction: "Implementation agent must address feedback per workflow iteration process"
118
+ }
119
+ })
120
+ ```
@@ -0,0 +1,173 @@
1
+ # Phase: Regression
2
+
3
+ ## INTENT
4
+ For bugs: Verify the repro test now passes. For features: Write comprehensive regression tests to prevent future breakage.
5
+
6
+ ## OUTCOME
7
+ **For Bugs:**
8
+ - Repro test from implement-repro phase now PASSES
9
+ - Bug is confirmed fixed
10
+ - Test serves as regression protection
11
+
12
+ **For Features:**
13
+ - New regression tests written
14
+ - All key functionality covered
15
+ - Tests verify acceptance criteria
16
+ - All tests pass
17
+
18
+ **Note**: This phase focuses specifically on regression testing. Build validation and manual testing are handled in other phases.
19
+
20
+ ## PRINCIPLES
21
+ - **Test Quality**: Write meaningful tests, not checkbox tests
22
+ - **Coverage**: Test main scenarios and edge cases
23
+ - **Real Testing**: Test actual functionality, not mocks
24
+ - **Maintainable**: Tests should be clear and maintainable
25
+
26
+ ## WORKFLOW
27
+
28
+ ### For Bug Fixes:
29
+
30
+ #### Step 1: Run Repro Test
31
+ ```bash
32
+ npm test -- path/to/repro/test.test.ts
33
+ ```
34
+
35
+ #### Step 2: Verify Test Passes
36
+ - Test should now PASS (was failing in implement-repro phase)
37
+ - Confirms bug is fixed
38
+ - Test serves as regression protection
39
+
40
+ #### Step 3: If Test Still Fails
41
+ **Return to implement phase:**
42
+ - Bug is not actually fixed
43
+ - Review the fix
44
+ - Debug why test still fails
45
+ - Fix and re-validate
46
+
47
+ ### For Features:
48
+
49
+ #### Step 1: Identify Test Coverage Needed
50
+ Based on acceptance criteria:
51
+ - Main user scenarios
52
+ - Edge cases
53
+ - Error conditions
54
+ - Integration points
55
+
56
+ #### Step 2: Write Regression Tests
57
+ - Create tests for all key functionality
58
+ - Test main user workflows
59
+ - Cover edge cases
60
+ - Test error handling
61
+
62
+ #### Step 3: Follow Test Architecture
63
+ Read `.fraim/config.json` for the architecture document path (`customizations.architectureDoc`), then read the local architecture document to understand the full architecture guidelines. Key requirements:
64
+ - Use shared-server-utils.ts
65
+ - Unique API keys per test
66
+ - Proper cleanup in finally blocks
67
+ - No individual server instances
68
+ - Proper timeouts (5-10s for network calls)
69
+
70
+ #### Step 4: Run All New Tests
71
+ ```bash
72
+ npm test -- path/to/new/tests.test.ts
73
+ ```
74
+
75
+ Verify all tests pass
76
+
77
+ #### Step 5: Tag Tests Appropriately
78
+ - `smoke`: If testing core functionality
79
+ - `integration`: If testing multiple components
80
+ - `unit`: If testing individual functions
81
+ - `e2e`: If testing complete workflows
82
+
83
+ ## VALIDATION
84
+
85
+ ### Phase Complete When:
86
+
87
+ **For Bugs:**
88
+ - ✅ Repro test now PASSES
89
+ - ✅ Bug confirmed fixed
90
+ - ✅ Test output documented
91
+
92
+ **For Features:**
93
+ - ✅ Regression tests written
94
+ - ✅ All acceptance criteria covered
95
+ - ✅ Tests follow architecture standards
96
+ - ✅ All tests pass
97
+ - ✅ Tests appropriately tagged
98
+
99
+ ### Phase Incomplete If:
100
+ - ❌ (Bugs) Repro test still fails
101
+ - ❌ (Features) No regression tests written
102
+ - ❌ (Features) Tests don't cover acceptance criteria
103
+ - ❌ Any tests fail
104
+ - ❌ Tests violate architecture standards
105
+
106
+ ## RULES FOR THIS PHASE
107
+ - Read `.fraim/config.json` for the architecture document path (`customizations.architectureDoc`), then read the local architecture document to understand the full test architecture guidelines
108
+ - Use Successful Debugging Patterns from `rules/successful-debugging-patterns.md` via `get_fraim_file`
109
+ - Follow Git Safe Commands from `rules/git-safe-commands.md` via `get_fraim_file`
110
+
111
+ ### Failure Handling
112
+ - **If regression tests fail**: Return to implement-code phase
113
+ - **If test writing fails**: Return to implement-code phase to understand implementation better
114
+ - Fix the implementation first, then write proper regression tests
115
+
116
+ ## TEST QUALITY REQUIREMENTS
117
+ - Tests must validate real functionality, not mocked behavior
118
+ - No tests that default to passing without validation
119
+ - Use flow testing, not just static analysis
120
+ - Tests should fail if code is broken
121
+
122
+ ## SCRIPTS
123
+
124
+ **Run tests:**
125
+ ```bash
126
+ npm test -- path/to/test.test.ts
127
+ ```
128
+
129
+ **Run all tests:**
130
+ ```bash
131
+ npm test
132
+ ```
133
+
134
+ ### Report Back (Bugs):
135
+ When you complete this phase for a bug fix, call:
136
+
137
+ ```javascript
138
+ seekCoachingOnNextStep({
139
+ workflowType: "implement",
140
+ issueNumber: "{issue_number}",
141
+ currentPhase: "implement-regression",
142
+ status: "complete",
143
+ findings: {
144
+ issueType: "bug" // Required for phase validation
145
+ },
146
+ evidence: {
147
+ reproTestResult: "Repro test at test/sync.test.ts:45 now PASSES",
148
+ bugStatus: "Bug confirmed fixed",
149
+ regressionProtection: "Test serves as regression protection"
150
+ }
151
+ })
152
+ ```
153
+
154
+ ### Report Back (Features):
155
+ When you complete this phase for a feature, call:
156
+
157
+ ```javascript
158
+ seekCoachingOnNextStep({
159
+ workflowType: "implement",
160
+ issueNumber: "{issue_number}",
161
+ currentPhase: "implement-regression",
162
+ status: "complete",
163
+ findings: {
164
+ issueType: "feature" // Required for phase validation
165
+ },
166
+ evidence: {
167
+ testLocation: "test/auth.test.ts",
168
+ testCoverage: "All acceptance criteria covered",
169
+ testResults: "8/8 tests passing",
170
+ testTags: "Tagged as integration"
171
+ }
172
+ })
173
+ ```
@@ -0,0 +1,104 @@
1
+ # Phase: Implement-Repro
2
+
3
+ ## INTENT
4
+ To create a failing test that reproduces the reported bug, demonstrating that the issue exists and providing a clear success criterion for the fix.
5
+
6
+ ## OUTCOME
7
+ A test that:
8
+ - **FAILS** when run, reproducing the bug
9
+ - Clearly demonstrates the incorrect behavior
10
+ - Will pass once the bug is fixed
11
+ - Serves as a regression test
12
+
13
+ ## PRINCIPLES
14
+ - **Test-First**: Create the failing test before fixing
15
+ - **Actual Reproduction**: Use real reproduction, not hypothetical scenarios
16
+ - **Clear Failure**: Test should fail obviously and consistently
17
+ - **No Assumptions**: If reproduction steps are unclear, escalate to user
18
+ - **Minimal Test**: Focus on reproducing the specific bug
19
+
20
+ ## WORKFLOW
21
+
22
+ ### Step 1: Review Bug Spec
23
+ - Read the bug description thoroughly
24
+ - Note the reproduction steps
25
+ - Understand the expected vs actual behavior
26
+ - Identify the failure conditions
27
+
28
+ ### Step 2: Check Reproduction Steps
29
+ **If reproduction steps are clear:**
30
+ - Proceed to create test
31
+
32
+ **If reproduction steps are unclear or missing:**
33
+ - **DO NOT** hypothesize about the issue
34
+ - **ESCALATE** to user with specific questions:
35
+ - What exact steps trigger the bug?
36
+ - What is the expected behavior?
37
+ - What is the actual (incorrect) behavior?
38
+ - Are there specific inputs or conditions?
39
+
40
+ ### Step 3: Create Failing Test
41
+ - Choose appropriate test file location
42
+ - Write test that follows reproduction steps
43
+ - Test should demonstrate the bug clearly
44
+ - Use descriptive test name: `test: reproduces bug #{issue_number} - {description}`
45
+
46
+ ### Step 4: Run the Test
47
+ - Execute the test
48
+ - **Verify it FAILS** as expected
49
+ - Capture the failure output
50
+ - Confirm it fails for the right reason (reproducing the bug, not test errors)
51
+
52
+ ### Step 5: Document Test Location
53
+ In your evidence, include:
54
+ - Path to the test file
55
+ - Test name/description
56
+ - Failure output showing the bug
57
+ - Confirmation that test reproduces the issue
58
+
59
+ ## VALIDATION
60
+
61
+ ### Phase Complete When:
62
+ - ✅ Test created that reproduces the bug
63
+ - ✅ Test FAILS when run
64
+ - ✅ Failure clearly demonstrates the bug
65
+ - ✅ Test will pass once bug is fixed
66
+ - ✅ Test location documented
67
+
68
+ ### Phase Incomplete If:
69
+ - ❌ Test passes (not reproducing the bug)
70
+ - ❌ Test fails for wrong reason (test error, not bug)
71
+ - ❌ Reproduction steps were unclear and not escalated
72
+ - ❌ Test is hypothetical, not based on actual reproduction
73
+
74
+ ## RULES FOR THIS PHASE
75
+ - Read `.fraim/config.json` for the architecture document path (`customizations.architectureDoc`), then read the local architecture document to understand the full test architecture standards
76
+ - Use Successful Debugging Patterns from `rules/successful-debugging-patterns.md` via `get_fraim_file`
77
+ - Follow Git Safe Commands from `rules/git-safe-commands.md` via `get_fraim_file`
78
+
79
+ ## SCRIPTS
80
+ Run test:
81
+ ```bash
82
+ npm test -- path/to/test/file.test.ts
83
+ ```
84
+
85
+ ### Report Back:
86
+ When you complete this phase, call:
87
+
88
+ ```javascript
89
+ seekCoachingOnNextStep({
90
+ workflowType: "implement",
91
+ issueNumber: "{issue_number}",
92
+ currentPhase: "implement-repro",
93
+ status: "complete",
94
+ findings: {
95
+ issueType: "bug" // Required for phase validation
96
+ },
97
+ evidence: {
98
+ testLocation: "test/sync.test.ts:45",
99
+ testResult: "FAILS with timeout after 30s",
100
+ reproductionConfirmed: true,
101
+ testOutput: "Include actual test failure output here"
102
+ }
103
+ })
104
+ ```