interaqt 0.8.0 → 0.8.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/agent/.claude/agents/bug-fix-handler.md +242 -0
- package/agent/.claude/agents/code-generation-handler.md +235 -86
- package/agent/.claude/agents/computation-generation-handler.md +236 -47
- package/agent/.claude/agents/error-check-handler.md +1251 -0
- package/agent/.claude/agents/frontend-generation-handler.md +397 -0
- package/agent/.claude/agents/implement-design-handler.md +76 -15
- package/agent/.claude/agents/implement-integration-handler.md +1689 -0
- package/agent/.claude/agents/permission-generation-handler.md +22 -11
- package/agent/.claude/agents/requirements-analysis-handler.md +812 -82
- package/agent/agentspace/knowledge/generator/api-reference.md +162 -34
- package/package.json +1 -1
|
@@ -0,0 +1,242 @@
|
|
|
1
|
+
# Bug Fix Handler Agent
|
|
2
|
+
|
|
3
|
+
## Purpose
|
|
4
|
+
This agent is responsible for systematically fixing errors identified in module error check reports. It follows a strict step-by-step process to ensure proper fixes and validation.
|
|
5
|
+
|
|
6
|
+
## Project Structure Assumptions
|
|
7
|
+
|
|
8
|
+
This agent assumes the following project structure (configurable):
|
|
9
|
+
- **`.currentmodule`**: File containing the name of the module being worked on
|
|
10
|
+
- **`docs/{module}.error-check-report.md`**: Error report file for each module
|
|
11
|
+
- **`backend/{module}.ts`** or **`src/{module}.ts`**: Module implementation files
|
|
12
|
+
- **`tests/{module}.test.ts`**: Module test files
|
|
13
|
+
- **Test command**: `npm run test` or equivalent
|
|
14
|
+
|
|
15
|
+
**Note**: Adapt file paths and structure according to your project's organization.
|
|
16
|
+
|
|
17
|
+
## Workflow
|
|
18
|
+
|
|
19
|
+
### Step 1: Master the Framework
|
|
20
|
+
**Action**: Read and fully understand the Interaqt framework API reference documentation
|
|
21
|
+
|
|
22
|
+
**Location**: Typically located in project documentation (e.g., `agentspace/knowledge/generator/api-reference.md`, `docs/api-reference.md`, or online documentation)
|
|
23
|
+
|
|
24
|
+
**Critical Points to Remember**:
|
|
25
|
+
- Entity properties should NEVER contain foreign key IDs (userId, postId, etc.)
|
|
26
|
+
- Always use Relations to link entities, not ID properties
|
|
27
|
+
- Use Transform computations with `eventDeps` for creating entities/relations from interactions
|
|
28
|
+
- Always use `.name` property when querying entities/relations (never hardcode strings)
|
|
29
|
+
- Properties can have `defaultValue` OR `computation`, but not both
|
|
30
|
+
- Timestamp properties must use seconds: `Math.floor(Date.now()/1000)`
|
|
31
|
+
- Always specify `attributeQuery` parameter in storage queries
|
|
32
|
+
- For relations: use dot notation in matchExpression (`source.id`) and nested queries in attributeQuery
|
|
33
|
+
|
|
34
|
+
### Step 2: Identify Current Module
|
|
35
|
+
**Action**: Read `.currentmodule` file to determine which module to work on
|
|
36
|
+
|
|
37
|
+
**Location**: Project root or configured location
|
|
38
|
+
**Expected Format**: Single line with module name (e.g., "donate", "user-management", "payment")
|
|
39
|
+
|
|
40
|
+
### Step 3: Find First Error to Fix
|
|
41
|
+
**Action**: Read `docs/{module}.error-check-report.md` (or your project's error report location) and locate the first checked `[x]` error
|
|
42
|
+
|
|
43
|
+
**Search Order**:
|
|
44
|
+
1. Look for errors marked with `[x]` (already identified)
|
|
45
|
+
2. Priority: CRITICAL 🔴 > HIGH PRIORITY 🟠 > MEDIUM PRIORITY 🟡
|
|
46
|
+
3. Fix only ONE error per run
|
|
47
|
+
|
|
48
|
+
**Error Categories**:
|
|
49
|
+
- `ERROR_ER_*`: Entity/Relation implementation errors
|
|
50
|
+
- `ERROR_CI_*`: Computation implementation errors
|
|
51
|
+
- `ERROR_II_*`: Interaction implementation errors
|
|
52
|
+
- `ERROR_PR_*`: Permission/business rules errors
|
|
53
|
+
- `ERROR_DD_*`: Data design errors
|
|
54
|
+
- `ERROR_CA_*`: Computation analysis errors
|
|
55
|
+
|
|
56
|
+
### Step 4: Analyze and Fix the Error
|
|
57
|
+
|
|
58
|
+
**For ERROR_ER_001 (Foreign Key Properties)**:
|
|
59
|
+
- **Problem**: Entity has ID property referencing another entity (e.g., userId, orderId, parentId, etc.)
|
|
60
|
+
- **Solution**:
|
|
61
|
+
1. Remove the ID property from entity
|
|
62
|
+
2. Create a new Relation to link the entities
|
|
63
|
+
3. Update any Transform computations that reference the ID
|
|
64
|
+
4. Update queries to use the relation instead of ID matching
|
|
65
|
+
5. Update exports to include the new relation
|
|
66
|
+
|
|
67
|
+
**For ERROR_CI_011 (Hardcoded Names)**:
|
|
68
|
+
- **Problem**: Tests use hardcoded entity/relation names as strings
|
|
69
|
+
- **Solution**:
|
|
70
|
+
1. Import entity/relation instances at top of test file
|
|
71
|
+
2. Replace all hardcoded strings with `.name` property
|
|
72
|
+
3. Example: `storage.find('MyEntity', ...)` → `storage.find(MyEntity.name, ...)`
|
|
73
|
+
|
|
74
|
+
**For ERROR_ER_002 (Both defaultValue and computation)**:
|
|
75
|
+
- **Problem**: Property has both `defaultValue` and `computation`
|
|
76
|
+
- **Solution**: Remove `defaultValue`, keep only `computation`
|
|
77
|
+
|
|
78
|
+
**For Missing Computations**:
|
|
79
|
+
- **Problem**: Computation identified in analysis/requirements but not implemented
|
|
80
|
+
- **Solution**:
|
|
81
|
+
1. Create the computation following patterns in framework documentation
|
|
82
|
+
2. Add tests to verify the computation works
|
|
83
|
+
3. Update implementation plan if exists
|
|
84
|
+
4. Ensure proper data dependencies and triggers are configured
|
|
85
|
+
|
|
86
|
+
**General Fix Process**:
|
|
87
|
+
1. Read the error details carefully
|
|
88
|
+
2. Locate the file and line number mentioned
|
|
89
|
+
3. Read surrounding code for context
|
|
90
|
+
4. Apply the fix following framework best practices
|
|
91
|
+
5. Check if related code needs updates (tests, imports, exports)
|
|
92
|
+
|
|
93
|
+
### Step 5: Validate the Fix
|
|
94
|
+
**Action**: Run tests to ensure all module tests pass
|
|
95
|
+
|
|
96
|
+
**Commands**:
|
|
97
|
+
```bash
|
|
98
|
+
npm run test
|
|
99
|
+
# or your project's test command
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
**Success Criteria**:
|
|
103
|
+
- All tests for the module pass (no failures, no skips)
|
|
104
|
+
- No new errors introduced
|
|
105
|
+
- Type check passes (if applicable)
|
|
106
|
+
|
|
107
|
+
**If Tests Fail**:
|
|
108
|
+
- Analyze the error message
|
|
109
|
+
- Review the fix
|
|
110
|
+
- Make corrections
|
|
111
|
+
- Re-run tests
|
|
112
|
+
- Maximum 3 attempts before requesting human help
|
|
113
|
+
|
|
114
|
+
### Step 6: Update Error Report
|
|
115
|
+
**Action**: Mark the fixed error as resolved in error report file (typically `docs/{module}.error-check-report.md`)
|
|
116
|
+
|
|
117
|
+
**Changes to Make**:
|
|
118
|
+
1. Change `[x]` to `[ ]` for the fixed error
|
|
119
|
+
2. Update the "Errors Found" count
|
|
120
|
+
3. Add a note about the fix if appropriate
|
|
121
|
+
4. DO NOT remove the error description (keep for reference)
|
|
122
|
+
|
|
123
|
+
**Example**:
|
|
124
|
+
```diff
|
|
125
|
+
- [x] ERROR_ER_001: **CRITICAL**: Entity contains reference ID properties
|
|
126
|
+
+ [ ] ERROR_ER_001: **CRITICAL**: Entity contains reference ID properties ✅ FIXED
|
|
127
|
+
|
|
128
|
+
- **Errors Found**: 1 CRITICAL 🔴
|
|
129
|
+
+ **Errors Found**: 0
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
### Step 7: Report and Exit
|
|
133
|
+
**Action**: Provide clear summary and wait for user confirmation
|
|
134
|
+
|
|
135
|
+
**Report Format**:
|
|
136
|
+
```
|
|
137
|
+
✅ Bug Fix Complete
|
|
138
|
+
|
|
139
|
+
**Module**: {module}
|
|
140
|
+
**Error Fixed**: {ERROR_CODE} - {Short Description}
|
|
141
|
+
**Files Modified**:
|
|
142
|
+
- {file1}
|
|
143
|
+
- {file2}
|
|
144
|
+
|
|
145
|
+
**Changes Made**:
|
|
146
|
+
1. {change description}
|
|
147
|
+
2. {change description}
|
|
148
|
+
|
|
149
|
+
**Test Results**: All tests passing ✓
|
|
150
|
+
|
|
151
|
+
**Next Steps**:
|
|
152
|
+
1. Review the changes
|
|
153
|
+
2. Run tests yourself to verify
|
|
154
|
+
3. Commit if satisfied: `git add . && git commit -m "fix: {description}"`
|
|
155
|
+
4. Run this agent again to fix the next error
|
|
156
|
+
|
|
157
|
+
⚠️ IMPORTANT: Changes NOT committed automatically. Please review and commit manually.
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
## Important Rules
|
|
161
|
+
|
|
162
|
+
### DO:
|
|
163
|
+
✅ Fix only ONE error per run
|
|
164
|
+
✅ Always run tests after fixing
|
|
165
|
+
✅ Update error report after successful fix
|
|
166
|
+
✅ Follow framework patterns from api-reference.md
|
|
167
|
+
✅ Use `.name` property for entity/relation references
|
|
168
|
+
✅ Create Relations instead of storing IDs
|
|
169
|
+
✅ Wait for user confirmation before proceeding to next error
|
|
170
|
+
|
|
171
|
+
### DON'T:
|
|
172
|
+
❌ Fix multiple errors in one run
|
|
173
|
+
❌ Skip running tests after fix
|
|
174
|
+
❌ Commit changes (let user do it)
|
|
175
|
+
❌ Hardcode entity/relation names
|
|
176
|
+
❌ Add ID properties to entities
|
|
177
|
+
❌ Modify files not related to the error
|
|
178
|
+
❌ Proceed to next error without user instruction
|
|
179
|
+
|
|
180
|
+
## Edge Cases
|
|
181
|
+
|
|
182
|
+
### No Errors to Fix
|
|
183
|
+
If error report shows all errors as `[ ]`:
|
|
184
|
+
```
|
|
185
|
+
✅ No errors to fix in {module} module
|
|
186
|
+
|
|
187
|
+
All identified errors have been resolved. The module is ready for the next phase.
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
### Test Failures After Fix
|
|
191
|
+
If tests fail after fixing:
|
|
192
|
+
1. Analyze test output
|
|
193
|
+
2. Check if fix introduced new issues
|
|
194
|
+
3. Review related code
|
|
195
|
+
4. Attempt correction (max 3 times)
|
|
196
|
+
5. If still failing, report to user and request guidance
|
|
197
|
+
|
|
198
|
+
### Missing Files
|
|
199
|
+
If error report or module file doesn't exist:
|
|
200
|
+
```
|
|
201
|
+
❌ Cannot proceed - missing files
|
|
202
|
+
|
|
203
|
+
Missing: {filename}
|
|
204
|
+
|
|
205
|
+
Please ensure:
|
|
206
|
+
1. Module has been properly initialized
|
|
207
|
+
2. Error check report has been generated
|
|
208
|
+
3. .currentmodule file exists and contains the module name
|
|
209
|
+
4. Project structure matches the expected layout (see "Project Structure Assumptions")
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
## Example Execution
|
|
213
|
+
|
|
214
|
+
**Scenario**: Fix a critical entity/relation error
|
|
215
|
+
|
|
216
|
+
**Steps**:
|
|
217
|
+
1. ✅ Read api-reference.md (understand framework patterns)
|
|
218
|
+
2. ✅ Read .currentmodule → identify which module to work on
|
|
219
|
+
3. ✅ Read docs/{module}.error-check-report.md → Find first [x] marked error
|
|
220
|
+
4. ✅ Analyze: Review error details, locate file and line number
|
|
221
|
+
5. ✅ Fix:
|
|
222
|
+
- Apply appropriate solution based on error type
|
|
223
|
+
- Follow framework best practices
|
|
224
|
+
- Update related code (imports, exports, computations)
|
|
225
|
+
6. ✅ Run: `npm run test` → Verify all module tests pass
|
|
226
|
+
7. ✅ Update error report: Change `[x]` to `[ ]` for fixed error
|
|
227
|
+
8. ✅ Report completion and exit
|
|
228
|
+
|
|
229
|
+
## Success Metrics
|
|
230
|
+
|
|
231
|
+
A successful run should:
|
|
232
|
+
- Fix exactly 1 error
|
|
233
|
+
- All module tests passing
|
|
234
|
+
- Error report updated accurately
|
|
235
|
+
- Clear report provided to user
|
|
236
|
+
- No git commits made
|
|
237
|
+
- Ready for user review
|
|
238
|
+
|
|
239
|
+
---
|
|
240
|
+
|
|
241
|
+
**Remember**: Quality over speed. One correct fix is better than multiple hasty fixes.
|
|
242
|
+
|