ai-flow-dev 1.3.0 → 1.4.0
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/dist/cli.js +16 -7
- package/dist/cli.js.map +1 -1
- package/package.json +1 -1
- package/prompts/backend/flow-bootstrap-phase-8.md +198 -549
- package/prompts/backend/flow-bootstrap-phase-9.md +441 -58
- package/prompts/backend/flow-bootstrap.md +108 -107
- package/prompts/backend/flow-dev-feature.md +447 -68
- package/prompts/backend/flow-dev-fix.md +81 -8
- package/templates/{shared/AGENT.template.md → AGENT.template.md} +1 -1
- package/templates/mobile/AGENT.template.md +0 -251
|
@@ -229,7 +229,7 @@ Time: 4 minutes
|
|
|
229
229
|
|
|
230
230
|
```
|
|
231
231
|
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
232
|
-
📋 Fix Plan
|
|
232
|
+
📋 Fix Plan (COMPLEX Bug)
|
|
233
233
|
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
234
234
|
|
|
235
235
|
Issue: Memory leak in WebSocket connections
|
|
@@ -239,12 +239,85 @@ Root causes identified:
|
|
|
239
239
|
2. Connection map not clearing disconnected sockets
|
|
240
240
|
3. Redis subscriptions not being unsubscribed
|
|
241
241
|
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
5
|
|
242
|
+
**Affected files:**
|
|
243
|
+
- src/websocket/notificationSocket.ts (event listeners)
|
|
244
|
+
- src/services/ConnectionManager.ts (connection map)
|
|
245
|
+
- src/app.ts (Redis setup)
|
|
246
|
+
|
|
247
|
+
**Estimated:** 5 SP (~8-10 hours) • 10 tasks
|
|
248
|
+
|
|
249
|
+
**Fix plan:** (Test-First approach, execution order)
|
|
250
|
+
|
|
251
|
+
- [ ] [T001] [P] Write test for event listener cleanup • 1 SP (~1-2h)
|
|
252
|
+
File: tests/unit/websocket/disconnect-cleanup.spec.ts
|
|
253
|
+
Tests: Verify listeners removed, memory not retained
|
|
254
|
+
Dependencies: None (can run parallel with T003)
|
|
255
|
+
|
|
256
|
+
- [ ] [T002] Add socket.removeAllListeners() on disconnect • 1 SP (~1h)
|
|
257
|
+
File: src/websocket/notificationSocket.ts
|
|
258
|
+
Implements: Cleanup in disconnect event handler
|
|
259
|
+
Dependencies: None
|
|
260
|
+
|
|
261
|
+
- [ ] [T003] [P] Write test for connection map cleanup • 1 SP (~1h)
|
|
262
|
+
File: tests/unit/services/ConnectionManager.spec.ts
|
|
263
|
+
Tests: Verify Map.delete() called, connection removed
|
|
264
|
+
Dependencies: None (can run parallel with T001)
|
|
265
|
+
|
|
266
|
+
- [ ] [T004] Delete from activeConnections Map on disconnect • 1 SP (~30min)
|
|
267
|
+
File: src/services/ConnectionManager.ts
|
|
268
|
+
Implements: this.activeConnections.delete(socketId)
|
|
269
|
+
Dependencies: None
|
|
270
|
+
|
|
271
|
+
- [ ] [T005] Write test for Redis unsubscribe • 1 SP (~1h)
|
|
272
|
+
File: tests/integration/redis/subscription-cleanup.spec.ts
|
|
273
|
+
Tests: Redis UNSUBSCRIBE called, channels cleaned up
|
|
274
|
+
Dependencies: None
|
|
275
|
+
|
|
276
|
+
- [ ] [T006] Call redisClient.unsubscribe() on disconnect • 1 SP (~1h)
|
|
277
|
+
File: src/app.ts
|
|
278
|
+
Implements: Unsubscribe from all channels for this connection
|
|
279
|
+
Dependencies: None
|
|
280
|
+
|
|
281
|
+
- [ ] [T007] Write test for heartbeat mechanism • 1 SP (~1-2h)
|
|
282
|
+
File: tests/unit/websocket/heartbeat.spec.ts
|
|
283
|
+
Tests: Ping/pong, timeout detection, stale cleanup
|
|
284
|
+
Dependencies: None
|
|
285
|
+
|
|
286
|
+
- [ ] [T008] Implement heartbeat mechanism • 2 SP (~3-4h)
|
|
287
|
+
File: src/websocket/heartbeat.ts
|
|
288
|
+
Implements: Ping every 30s, timeout after 60s, auto-disconnect
|
|
289
|
+
Dependencies: None
|
|
290
|
+
|
|
291
|
+
- [ ] [T009] Add connection monitoring and metrics • 1 SP (~1-2h)
|
|
292
|
+
File: src/services/ConnectionMonitor.ts
|
|
293
|
+
Implements: Track active count, memory usage, alert on leaks
|
|
294
|
+
Dependencies: T004 (needs ConnectionManager cleanup)
|
|
295
|
+
|
|
296
|
+
- [ ] [T010] Integration test for complete cleanup flow • 1 SP (~1-2h)
|
|
297
|
+
File: tests/integration/websocket/full-cleanup.spec.ts
|
|
298
|
+
Tests: Connect 1000 clients, disconnect all, verify memory freed
|
|
299
|
+
Dependencies: T002, T004, T006, T008 (needs all fixes)
|
|
300
|
+
|
|
301
|
+
**Parallelization Notes:**
|
|
302
|
+
- T001, T003 can run in parallel (different test files)
|
|
303
|
+
- T002, T004, T006, T008 can run in parallel (different files)
|
|
304
|
+
- T010 (E2E test) depends on all fixes complete
|
|
305
|
+
|
|
306
|
+
**Task Execution Graph:**
|
|
307
|
+
|
|
308
|
+
```
|
|
309
|
+
T001 [P] ──┐
|
|
310
|
+
T003 [P] ──┼──> (Test tasks can run parallel)
|
|
311
|
+
T005 [P] ──┤
|
|
312
|
+
T007 [P] ──┘
|
|
313
|
+
|
|
314
|
+
T002 (notificationSocket.ts) ──┐
|
|
315
|
+
T004 (ConnectionManager.ts) ───┼──> T009 (Monitor) ──> T010 (E2E test)
|
|
316
|
+
T006 (app.ts) ──────────────────┤
|
|
317
|
+
T008 (heartbeat.ts) ────────────┘
|
|
318
|
+
```
|
|
319
|
+
|
|
320
|
+
**Estimated time:** 8-10 hours (with AI) | 2-3 days (manual)
|
|
248
321
|
|
|
249
322
|
Proceed with fix? (Y/n)
|
|
250
323
|
```
|
|
@@ -900,4 +973,4 @@ Time: 14 minutes
|
|
|
900
973
|
---
|
|
901
974
|
|
|
902
975
|
**BEGIN EXECUTION when user runs `/fix` or `/fix "description"`**
|
|
903
|
-
|
|
976
|
+
|
|
@@ -1,251 +0,0 @@
|
|
|
1
|
-
# AGENT.md
|
|
2
|
-
|
|
3
|
-
> Universal AI Assistant Configuration
|
|
4
|
-
>
|
|
5
|
-
> This file provides context for ALL AI development tools (Claude, Copilot, Cursor, Gemini, etc.)
|
|
6
|
-
|
|
7
|
-
---
|
|
8
|
-
|
|
9
|
-
## 📋 About This Project
|
|
10
|
-
|
|
11
|
-
**Project Name:** {{PROJECT_NAME}}
|
|
12
|
-
|
|
13
|
-
**Description:** {{PROJECT_DESCRIPTION}}
|
|
14
|
-
|
|
15
|
-
**Problem We're Solving:** {{PROBLEM_STATEMENT}}
|
|
16
|
-
|
|
17
|
-
**Target Users:** {{TARGET_USERS}}
|
|
18
|
-
|
|
19
|
-
### Technical Context
|
|
20
|
-
|
|
21
|
-
**Project Type:** Backend API/Service
|
|
22
|
-
**Architecture:** {{ARCHITECTURE_PATTERN}}
|
|
23
|
-
**Primary Language:** {{LANGUAGE}} {{LANGUAGE_VERSION}}
|
|
24
|
-
**Framework:** {{FRAMEWORK}}
|
|
25
|
-
**Database:** {{DATABASE}} with {{ORM}}
|
|
26
|
-
|
|
27
|
-
**Key Characteristics:**
|
|
28
|
-
- Authentication: {{AUTH_METHOD}}
|
|
29
|
-
- API Style: {{API_STYLE}}
|
|
30
|
-
- Deployment: {{DEPLOYMENT_PLATFORM}}
|
|
31
|
-
- Current Phase: {{PROJECT_PHASE}}
|
|
32
|
-
|
|
33
|
-
> This project uses AI-assisted development with comprehensive documentation.
|
|
34
|
-
> All files below provide context to AI assistants for consistent, high-quality code generation.
|
|
35
|
-
|
|
36
|
-
---
|
|
37
|
-
|
|
38
|
-
## 🏗️ Documentation Architecture
|
|
39
|
-
|
|
40
|
-
This project follows **AI-assisted development** with comprehensive documentation.
|
|
41
|
-
All documentation is structured to guide AI assistants in understanding the project deeply.
|
|
42
|
-
|
|
43
|
-
### 📚 Core Documentation (Read in Order)
|
|
44
|
-
|
|
45
|
-
1. **`ai-instructions.md`** ⭐ **START HERE**
|
|
46
|
-
|
|
47
|
-
- Tech stack and versions
|
|
48
|
-
- NEVER/ALWAYS rules
|
|
49
|
-
- Development workflow
|
|
50
|
-
- Priorities
|
|
51
|
-
|
|
52
|
-
2. **`project-brief.md`**
|
|
53
|
-
|
|
54
|
-
- Business context
|
|
55
|
-
- Objectives and scope
|
|
56
|
-
- Constraints and success metrics
|
|
57
|
-
|
|
58
|
-
3. **`README.md`**
|
|
59
|
-
|
|
60
|
-
- Quick start
|
|
61
|
-
- Installation and commands
|
|
62
|
-
- Project directory tour
|
|
63
|
-
|
|
64
|
-
4. **`docs/architecture.md`**
|
|
65
|
-
|
|
66
|
-
- System architecture pattern
|
|
67
|
-
- Component structure
|
|
68
|
-
- Request/response flow
|
|
69
|
-
|
|
70
|
-
5. **`docs/data-model.md`**
|
|
71
|
-
|
|
72
|
-
- Database schema
|
|
73
|
-
- Entity relationships
|
|
74
|
-
- Data patterns
|
|
75
|
-
|
|
76
|
-
6. **`docs/code-standards.md`**
|
|
77
|
-
|
|
78
|
-
- Naming conventions
|
|
79
|
-
- Code quality rules
|
|
80
|
-
- Error handling patterns
|
|
81
|
-
|
|
82
|
-
7. **`docs/testing.md`**
|
|
83
|
-
|
|
84
|
-
- Testing strategy
|
|
85
|
-
- Coverage requirements
|
|
86
|
-
- Test patterns
|
|
87
|
-
|
|
88
|
-
8. **`docs/operations.md`**
|
|
89
|
-
|
|
90
|
-
- Deployment procedures
|
|
91
|
-
- Monitoring and alerts
|
|
92
|
-
- Scaling strategy
|
|
93
|
-
|
|
94
|
-
9. **`docs/business-flows.md`**
|
|
95
|
-
|
|
96
|
-
- End-to-end business processes
|
|
97
|
-
- Key actors and systems
|
|
98
|
-
- Flow diagrams
|
|
99
|
-
|
|
100
|
-
10. **`docs/api.md`**
|
|
101
|
-
|
|
102
|
-
- Endpoint conventions
|
|
103
|
-
- Authentication and pagination rules
|
|
104
|
-
- Request/response examples
|
|
105
|
-
|
|
106
|
-
11. **`docs/contributing.md`**
|
|
107
|
-
|
|
108
|
-
- Development setup
|
|
109
|
-
- Contribution guidelines
|
|
110
|
-
- Code review process
|
|
111
|
-
|
|
112
|
-
12. **`specs/security.md`**
|
|
113
|
-
|
|
114
|
-
- Authentication/Authorization
|
|
115
|
-
- Security policies
|
|
116
|
-
- Compliance requirements
|
|
117
|
-
|
|
118
|
-
13. **`specs/configuration.md`**
|
|
119
|
-
|
|
120
|
-
- Environment variables
|
|
121
|
-
- External services
|
|
122
|
-
- Configuration by environment
|
|
123
|
-
|
|
124
|
-
14. **`.env.example`**
|
|
125
|
-
- Required environment variables
|
|
126
|
-
- Default/local values
|
|
127
|
-
- Secrets handling guidance
|
|
128
|
-
|
|
129
|
-
---
|
|
130
|
-
|
|
131
|
-
## ⚡ Quick Reference
|
|
132
|
-
|
|
133
|
-
### Tech Stack
|
|
134
|
-
|
|
135
|
-
**Backend:**
|
|
136
|
-
|
|
137
|
-
- Framework: {{FRAMEWORK}}
|
|
138
|
-
- Language: {{LANGUAGE}} {{LANGUAGE_VERSION}}
|
|
139
|
-
- Database: {{DATABASE}}
|
|
140
|
-
- ORM: {{ORM}}
|
|
141
|
-
- Authentication: {{AUTH_METHOD}}
|
|
142
|
-
- Caching: {{CACHE_STRATEGY}}
|
|
143
|
-
|
|
144
|
-
**Infrastructure:**
|
|
145
|
-
|
|
146
|
-
- Deployment: {{DEPLOYMENT_PLATFORM}}
|
|
147
|
-
- CI/CD: {{CICD_PLATFORM}}
|
|
148
|
-
- Monitoring: {{MONITORING_TOOLS}}
|
|
149
|
-
|
|
150
|
-
### Critical Rules
|
|
151
|
-
|
|
152
|
-
**❌ NEVER:**
|
|
153
|
-
{{NEVER_RULES}}
|
|
154
|
-
|
|
155
|
-
**✅ ALWAYS:**
|
|
156
|
-
{{ALWAYS_RULES}}
|
|
157
|
-
|
|
158
|
-
---
|
|
159
|
-
|
|
160
|
-
## 🤖 AI Assistant Workflow
|
|
161
|
-
|
|
162
|
-
When working on this project:
|
|
163
|
-
|
|
164
|
-
1. **Before starting ANY task:**
|
|
165
|
-
|
|
166
|
-
- Read `ai-instructions.md` for project-wide rules
|
|
167
|
-
- Check relevant documentation for the area you're working on
|
|
168
|
-
- Understand the business context from `project-brief.md`
|
|
169
|
-
|
|
170
|
-
2. **When implementing features:**
|
|
171
|
-
|
|
172
|
-
- Follow architecture patterns from `docs/architecture.md`
|
|
173
|
-
- Respect data models from `docs/data-model.md`
|
|
174
|
-
- Apply code standards from `docs/code-standards.md`
|
|
175
|
-
- Add tests according to `docs/testing.md`
|
|
176
|
-
|
|
177
|
-
3. **When handling security:**
|
|
178
|
-
|
|
179
|
-
- Consult `specs/security.md` for auth/authz
|
|
180
|
-
- Never hardcode secrets (use `specs/configuration.md`)
|
|
181
|
-
- Follow security headers and encryption requirements
|
|
182
|
-
|
|
183
|
-
4. **When deploying:**
|
|
184
|
-
- Follow procedures in `docs/operations.md`
|
|
185
|
-
- Update configuration per environment
|
|
186
|
-
- Check health endpoints
|
|
187
|
-
|
|
188
|
-
---
|
|
189
|
-
|
|
190
|
-
## 🛠️ Tool-Specific Configurations
|
|
191
|
-
|
|
192
|
-
Different AI tools have specific configuration files that extend this AGENT.md:
|
|
193
|
-
|
|
194
|
-
### Claude Code
|
|
195
|
-
|
|
196
|
-
- **File:** `.clauderules`
|
|
197
|
-
- **Purpose:** Claude-specific instructions and preferences
|
|
198
|
-
- **References:** This AGENT.md + project docs
|
|
199
|
-
|
|
200
|
-
### Cursor
|
|
201
|
-
|
|
202
|
-
- **File:** `.cursorrules`
|
|
203
|
-
- **Purpose:** Cursor-specific context and rules
|
|
204
|
-
- **References:** This AGENT.md + project docs
|
|
205
|
-
|
|
206
|
-
### GitHub Copilot
|
|
207
|
-
|
|
208
|
-
- **File:** `.github/copilot-instructions.md`
|
|
209
|
-
- **Purpose:** Copilot workspace instructions
|
|
210
|
-
- **References:** This AGENT.md + project docs
|
|
211
|
-
|
|
212
|
-
**All tool-specific configs reference this AGENT.md as the source of truth.**
|
|
213
|
-
|
|
214
|
-
---
|
|
215
|
-
|
|
216
|
-
## 📊 Project Status
|
|
217
|
-
|
|
218
|
-
**Current Phase:** {{PROJECT_PHASE}}
|
|
219
|
-
|
|
220
|
-
**Architecture:** {{ARCHITECTURE_PATTERN}}
|
|
221
|
-
|
|
222
|
-
**Compliance:** {{COMPLIANCE_REQUIREMENTS}}
|
|
223
|
-
|
|
224
|
-
---
|
|
225
|
-
|
|
226
|
-
## 🚀 Getting Started
|
|
227
|
-
|
|
228
|
-
### For AI Assistants
|
|
229
|
-
|
|
230
|
-
1. Read this AGENT.md completely
|
|
231
|
-
2. Read `ai-instructions.md` for critical rules
|
|
232
|
-
3. Familiarize with `docs/architecture.md`
|
|
233
|
-
4. Review `docs/code-standards.md` for coding patterns
|
|
234
|
-
5. Check `specs/security.md` before handling auth/sensitive data
|
|
235
|
-
|
|
236
|
-
### For Developers
|
|
237
|
-
|
|
238
|
-
See `README.md` for installation and setup instructions.
|
|
239
|
-
|
|
240
|
-
---
|
|
241
|
-
|
|
242
|
-
## 📝 Document Update Policy
|
|
243
|
-
|
|
244
|
-
- Documents are **living artifacts** - update as project evolves
|
|
245
|
-
- Breaking changes to architecture → Update `docs/architecture.md`
|
|
246
|
-
- New security requirements → Update `specs/security.md`
|
|
247
|
-
- Stack changes → Update `ai-instructions.md` AND this AGENT.md
|
|
248
|
-
|
|
249
|
-
**Last Updated:** {{GENERATION_DATE}}
|
|
250
|
-
|
|
251
|
-
**Generated by:** AI Flow v1.0.8
|