s9n-devops-agent 2.0.13 → 2.0.18-dev.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/House_Rules_Contracts/API_CONTRACT.md +612 -0
- package/House_Rules_Contracts/DATABASE_SCHEMA_CONTRACT.md +373 -0
- package/House_Rules_Contracts/DEVOPS_AGENT_INSTRUCTIONS.md +743 -0
- package/House_Rules_Contracts/FEATURES_CONTRACT.md +655 -0
- package/House_Rules_Contracts/INFRA_CONTRACT.md +638 -0
- package/House_Rules_Contracts/README.md +671 -0
- package/House_Rules_Contracts/SQL_CONTRACT.json +346 -0
- package/House_Rules_Contracts/THIRD_PARTY_INTEGRATIONS.md +604 -0
- package/bin/cs-devops-agent +20 -2
- package/houserules.md +1412 -0
- package/houserules_structured.md +1442 -0
- package/package.json +6 -2
- package/scripts/generate-ai-commit.js +135 -0
- package/scripts/local-install.sh +42 -0
- package/src/agent-chat.js +457 -0
- package/src/credentials-manager.js +1 -1
- package/src/cs-devops-agent-worker.js +84 -4
- package/src/house-rules-manager.js +4 -14
- package/src/instruction-formatter.js +9 -1
- package/src/session-coordinator.js +170 -15
- package/src/setup-cs-devops-agent.js +214 -236
- package/src/worktree-manager.js +2 -1
- package/start-devops-session.sh +9 -2
|
@@ -0,0 +1,655 @@
|
|
|
1
|
+
# Features Contract
|
|
2
|
+
|
|
3
|
+
**Last Updated:** 2024-12-02
|
|
4
|
+
**Version:** 1.0.0
|
|
5
|
+
**Status:** Initial Template
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## Purpose
|
|
10
|
+
|
|
11
|
+
This contract documents **all features and specifications** in the project. Coding agents **MUST check this file before implementing new features** to:
|
|
12
|
+
- **Prevent duplicate feature development**
|
|
13
|
+
- **Reuse existing functionality** instead of rebuilding
|
|
14
|
+
- **Maintain feature consistency** across the application
|
|
15
|
+
- **Avoid conflicting implementations** by multiple agents
|
|
16
|
+
- **Ensure all agents know what features exist** and how to use them
|
|
17
|
+
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
## Change Log
|
|
21
|
+
|
|
22
|
+
| Date | Version | Agent/Author | Changes | Impact |
|
|
23
|
+
|------|---------|--------------|---------|--------|
|
|
24
|
+
| 2024-12-02 | 1.0.0 | DevOps Agent | Initial template creation | N/A - Template only |
|
|
25
|
+
|
|
26
|
+
---
|
|
27
|
+
|
|
28
|
+
## Feature Overview
|
|
29
|
+
|
|
30
|
+
| Feature ID | Feature Name | Status | Owner Module | Priority | Completion |
|
|
31
|
+
|------------|--------------|--------|--------------|----------|------------|
|
|
32
|
+
| [F-001] | [Feature Name] | Active/Beta/Deprecated | [Module] | High/Medium/Low | 100% |
|
|
33
|
+
|
|
34
|
+
---
|
|
35
|
+
|
|
36
|
+
## Features
|
|
37
|
+
|
|
38
|
+
### Feature Template
|
|
39
|
+
|
|
40
|
+
#### Feature ID: [F-XXX] - [Feature Name]
|
|
41
|
+
|
|
42
|
+
**Added:** [YYYY-MM-DD]
|
|
43
|
+
**Last Modified:** [YYYY-MM-DD]
|
|
44
|
+
**Status:** `active` | `beta` | `deprecated` | `planned`
|
|
45
|
+
**Priority:** `critical` | `high` | `medium` | `low`
|
|
46
|
+
**Completion:** [0-100]%
|
|
47
|
+
|
|
48
|
+
**Description:**
|
|
49
|
+
[Detailed description of what this feature does and why it exists]
|
|
50
|
+
|
|
51
|
+
**User Story:**
|
|
52
|
+
As a [user type], I want to [action] so that [benefit].
|
|
53
|
+
|
|
54
|
+
**Acceptance Criteria:**
|
|
55
|
+
- [ ] Criterion 1
|
|
56
|
+
- [ ] Criterion 2
|
|
57
|
+
- [ ] Criterion 3
|
|
58
|
+
|
|
59
|
+
**Implementation Details:**
|
|
60
|
+
|
|
61
|
+
**Modules/Files:**
|
|
62
|
+
| File Path | Purpose | Lines of Code |
|
|
63
|
+
|-----------|---------|---------------|
|
|
64
|
+
| `src/features/[name]/index.js` | Main entry point | ~200 |
|
|
65
|
+
| `src/features/[name]/service.js` | Business logic | ~150 |
|
|
66
|
+
| `src/features/[name]/controller.js` | API controller | ~100 |
|
|
67
|
+
|
|
68
|
+
**API Endpoints:**
|
|
69
|
+
- `GET /api/v1/[resource]` - [Description] (see API_CONTRACT.md)
|
|
70
|
+
- `POST /api/v1/[resource]` - [Description] (see API_CONTRACT.md)
|
|
71
|
+
|
|
72
|
+
**Database Tables:**
|
|
73
|
+
- `[table_name]` - [Purpose] (see DATABASE_SCHEMA_CONTRACT.md)
|
|
74
|
+
|
|
75
|
+
**SQL Queries:**
|
|
76
|
+
- `get_[resource]_by_id` - [Purpose] (see SQL_CONTRACT.json)
|
|
77
|
+
- `create_[resource]` - [Purpose] (see SQL_CONTRACT.json)
|
|
78
|
+
|
|
79
|
+
**3rd Party Integrations:**
|
|
80
|
+
- `[Service Name]` - [How it's used] (see THIRD_PARTY_INTEGRATIONS.md)
|
|
81
|
+
|
|
82
|
+
**Dependencies:**
|
|
83
|
+
|
|
84
|
+
**Required Features:**
|
|
85
|
+
- [F-XXX] - [Feature Name] - [Why it's needed]
|
|
86
|
+
|
|
87
|
+
**Optional Features:**
|
|
88
|
+
- [F-XXX] - [Feature Name] - [Enhanced functionality if available]
|
|
89
|
+
|
|
90
|
+
**Used By Features:**
|
|
91
|
+
- [F-XXX] - [Feature Name] - [How it uses this feature]
|
|
92
|
+
|
|
93
|
+
**Configuration:**
|
|
94
|
+
|
|
95
|
+
**Environment Variables:**
|
|
96
|
+
- `FEATURE_[NAME]_ENABLED` - Enable/disable feature flag
|
|
97
|
+
- `FEATURE_[NAME]_[CONFIG]` - Feature-specific config
|
|
98
|
+
|
|
99
|
+
(See INFRA_CONTRACT.md for details)
|
|
100
|
+
|
|
101
|
+
**Feature Flags:**
|
|
102
|
+
```javascript
|
|
103
|
+
{
|
|
104
|
+
"feature_[name]_enabled": true,
|
|
105
|
+
"feature_[name]_beta_users": ["user_id_1", "user_id_2"],
|
|
106
|
+
"feature_[name]_rollout_percentage": 100
|
|
107
|
+
}
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
**User Interface:**
|
|
111
|
+
|
|
112
|
+
**Pages/Views:**
|
|
113
|
+
- `/[route]` - [Page description]
|
|
114
|
+
- `/[route]/[subroute]` - [Page description]
|
|
115
|
+
|
|
116
|
+
**Components:**
|
|
117
|
+
- `[ComponentName]` - `src/components/[name].jsx` - [Purpose]
|
|
118
|
+
|
|
119
|
+
**User Permissions:**
|
|
120
|
+
| Role | Access Level | Actions Allowed |
|
|
121
|
+
|------|--------------|-----------------|
|
|
122
|
+
| admin | Full | Create, Read, Update, Delete |
|
|
123
|
+
| user | Limited | Read, Update own |
|
|
124
|
+
| guest | Read-only | Read public only |
|
|
125
|
+
|
|
126
|
+
**Business Logic:**
|
|
127
|
+
|
|
128
|
+
**Key Workflows:**
|
|
129
|
+
1. [Step 1 description]
|
|
130
|
+
2. [Step 2 description]
|
|
131
|
+
3. [Step 3 description]
|
|
132
|
+
|
|
133
|
+
**Validation Rules:**
|
|
134
|
+
- [Field]: [Validation rule]
|
|
135
|
+
- [Field]: [Validation rule]
|
|
136
|
+
|
|
137
|
+
**Error Handling:**
|
|
138
|
+
| Error Scenario | Error Code | User Message | Handling |
|
|
139
|
+
|----------------|------------|--------------|----------|
|
|
140
|
+
| [Scenario] | [Code] | [Message] | [Action] |
|
|
141
|
+
|
|
142
|
+
**Testing:**
|
|
143
|
+
|
|
144
|
+
**Test Coverage:** [X]%
|
|
145
|
+
|
|
146
|
+
**Test Files:**
|
|
147
|
+
- `test_cases/features/[name].test.js` - Unit tests
|
|
148
|
+
- `test_cases/integration/[name].integration.test.js` - Integration tests
|
|
149
|
+
- `test_cases/e2e/[name].e2e.test.js` - End-to-end tests
|
|
150
|
+
|
|
151
|
+
**Test Scenarios:**
|
|
152
|
+
- [ ] Happy path: [Description]
|
|
153
|
+
- [ ] Edge case: [Description]
|
|
154
|
+
- [ ] Error handling: [Description]
|
|
155
|
+
- [ ] Performance: [Description]
|
|
156
|
+
|
|
157
|
+
**Performance:**
|
|
158
|
+
|
|
159
|
+
**Metrics:**
|
|
160
|
+
- Average response time: [X]ms
|
|
161
|
+
- Peak load capacity: [X] requests/second
|
|
162
|
+
- Database queries: [X] per request
|
|
163
|
+
- Memory usage: [X]MB
|
|
164
|
+
|
|
165
|
+
**Optimization Notes:**
|
|
166
|
+
- [Optimization applied]
|
|
167
|
+
- [Caching strategy]
|
|
168
|
+
- [Index usage]
|
|
169
|
+
|
|
170
|
+
**Security:**
|
|
171
|
+
|
|
172
|
+
**Security Measures:**
|
|
173
|
+
- Authentication required: YES/NO
|
|
174
|
+
- Authorization checks: [Description]
|
|
175
|
+
- Input validation: [Method]
|
|
176
|
+
- Output sanitization: [Method]
|
|
177
|
+
- Rate limiting: [X] requests/[timeframe]
|
|
178
|
+
|
|
179
|
+
**Sensitive Data:**
|
|
180
|
+
- [Data type]: [Encryption/Protection method]
|
|
181
|
+
|
|
182
|
+
**Monitoring & Analytics:**
|
|
183
|
+
|
|
184
|
+
**Metrics Tracked:**
|
|
185
|
+
- Feature usage count
|
|
186
|
+
- User engagement rate
|
|
187
|
+
- Error rate
|
|
188
|
+
- Performance metrics
|
|
189
|
+
|
|
190
|
+
**Alerts:**
|
|
191
|
+
- Error rate > [X]%
|
|
192
|
+
- Response time > [X]ms
|
|
193
|
+
- Usage spike/drop > [X]%
|
|
194
|
+
|
|
195
|
+
**Documentation:**
|
|
196
|
+
|
|
197
|
+
**User Documentation:**
|
|
198
|
+
- User guide: `docs/user-guide/[feature].md`
|
|
199
|
+
- FAQ: `docs/faq/[feature].md`
|
|
200
|
+
|
|
201
|
+
**Developer Documentation:**
|
|
202
|
+
- Technical spec: `docs/technical/[feature].md`
|
|
203
|
+
- API docs: `docs/api/[feature].md`
|
|
204
|
+
|
|
205
|
+
**Known Issues:**
|
|
206
|
+
|
|
207
|
+
| Issue ID | Description | Severity | Workaround | Status |
|
|
208
|
+
|----------|-------------|----------|------------|--------|
|
|
209
|
+
| [I-XXX] | [Description] | High/Medium/Low | [Workaround] | Open/In Progress/Resolved |
|
|
210
|
+
|
|
211
|
+
**Future Enhancements:**
|
|
212
|
+
|
|
213
|
+
| Enhancement ID | Description | Priority | Estimated Effort |
|
|
214
|
+
|----------------|-------------|----------|------------------|
|
|
215
|
+
| [E-XXX] | [Description] | High/Medium/Low | [X] days |
|
|
216
|
+
|
|
217
|
+
**Changelog:**
|
|
218
|
+
|
|
219
|
+
| Date | Version | Changes | Breaking |
|
|
220
|
+
|------|---------|---------|----------|
|
|
221
|
+
| 2024-01-15 | 1.0.0 | Initial implementation | N/A |
|
|
222
|
+
|
|
223
|
+
---
|
|
224
|
+
|
|
225
|
+
## Example Features
|
|
226
|
+
|
|
227
|
+
<!-- ======================================================================= -->
|
|
228
|
+
<!-- NOTE: The following is an EXAMPLE ONLY. Do not treat as real features. -->
|
|
229
|
+
<!-- ======================================================================= -->
|
|
230
|
+
|
|
231
|
+
### Feature ID: F-001 - User Authentication
|
|
232
|
+
|
|
233
|
+
**Added:** 2024-01-15
|
|
234
|
+
**Last Modified:** 2024-02-10
|
|
235
|
+
**Status:** `active`
|
|
236
|
+
**Priority:** `critical`
|
|
237
|
+
**Completion:** 100%
|
|
238
|
+
|
|
239
|
+
**Description:**
|
|
240
|
+
Secure user authentication system supporting email/password login, JWT token management, password reset, and session handling.
|
|
241
|
+
|
|
242
|
+
**User Story:**
|
|
243
|
+
As a user, I want to securely log in to my account so that I can access protected features and my personal data.
|
|
244
|
+
|
|
245
|
+
**Acceptance Criteria:**
|
|
246
|
+
- [x] Users can register with email and password
|
|
247
|
+
- [x] Users can log in with valid credentials
|
|
248
|
+
- [x] Users receive JWT token upon successful login
|
|
249
|
+
- [x] Users can reset forgotten passwords via email
|
|
250
|
+
- [x] Sessions expire after 24 hours
|
|
251
|
+
- [x] Failed login attempts are rate-limited
|
|
252
|
+
|
|
253
|
+
**Implementation Details:**
|
|
254
|
+
|
|
255
|
+
**Modules/Files:**
|
|
256
|
+
| File Path | Purpose | Lines of Code |
|
|
257
|
+
|-----------|---------|---------------|
|
|
258
|
+
| `src/features/auth/index.js` | Main auth module | 50 |
|
|
259
|
+
| `src/features/auth/service.js` | Auth business logic | 250 |
|
|
260
|
+
| `src/features/auth/controller.js` | API endpoints | 180 |
|
|
261
|
+
| `src/features/auth/middleware.js` | JWT verification | 80 |
|
|
262
|
+
| `src/features/auth/validators.js` | Input validation | 120 |
|
|
263
|
+
|
|
264
|
+
**API Endpoints:**
|
|
265
|
+
- `POST /api/v1/auth/register` - User registration (see API_CONTRACT.md)
|
|
266
|
+
- `POST /api/v1/auth/login` - User login (see API_CONTRACT.md)
|
|
267
|
+
- `POST /api/v1/auth/logout` - User logout (see API_CONTRACT.md)
|
|
268
|
+
- `POST /api/v1/auth/refresh` - Refresh JWT token (see API_CONTRACT.md)
|
|
269
|
+
- `POST /api/v1/auth/forgot-password` - Request password reset (see API_CONTRACT.md)
|
|
270
|
+
- `POST /api/v1/auth/reset-password` - Reset password (see API_CONTRACT.md)
|
|
271
|
+
|
|
272
|
+
**Database Tables:**
|
|
273
|
+
- `users` - User accounts and credentials (see DATABASE_SCHEMA_CONTRACT.md)
|
|
274
|
+
- `password_resets` - Password reset tokens (see DATABASE_SCHEMA_CONTRACT.md)
|
|
275
|
+
- `sessions` - Active user sessions (see DATABASE_SCHEMA_CONTRACT.md)
|
|
276
|
+
|
|
277
|
+
**SQL Queries:**
|
|
278
|
+
- `get_user_by_email` - User lookup (see SQL_CONTRACT.json)
|
|
279
|
+
- `insert_user` - Create new user (see SQL_CONTRACT.json)
|
|
280
|
+
- `update_user_password` - Update password (see SQL_CONTRACT.json)
|
|
281
|
+
- `create_password_reset_token` - Generate reset token (see SQL_CONTRACT.json)
|
|
282
|
+
|
|
283
|
+
**3rd Party Integrations:**
|
|
284
|
+
- `SendGrid` - Password reset emails (see THIRD_PARTY_INTEGRATIONS.md)
|
|
285
|
+
|
|
286
|
+
**Dependencies:**
|
|
287
|
+
|
|
288
|
+
**Required Features:**
|
|
289
|
+
- None (core feature)
|
|
290
|
+
|
|
291
|
+
**Used By Features:**
|
|
292
|
+
- [F-002] - User Profile Management
|
|
293
|
+
- [F-003] - User Dashboard
|
|
294
|
+
- [F-010] - Admin Panel
|
|
295
|
+
|
|
296
|
+
**Configuration:**
|
|
297
|
+
|
|
298
|
+
**Environment Variables:**
|
|
299
|
+
- `JWT_SECRET` - Secret key for JWT signing
|
|
300
|
+
- `JWT_EXPIRATION` - Token expiration time (default: 24h)
|
|
301
|
+
- `PASSWORD_RESET_EXPIRATION` - Reset token expiration (default: 1h)
|
|
302
|
+
- `MAX_LOGIN_ATTEMPTS` - Max failed attempts before lockout (default: 5)
|
|
303
|
+
- `LOCKOUT_DURATION` - Account lockout duration (default: 15min)
|
|
304
|
+
|
|
305
|
+
**Feature Flags:**
|
|
306
|
+
```javascript
|
|
307
|
+
{
|
|
308
|
+
"auth_email_verification_required": true,
|
|
309
|
+
"auth_2fa_enabled": false,
|
|
310
|
+
"auth_social_login_enabled": false
|
|
311
|
+
}
|
|
312
|
+
```
|
|
313
|
+
|
|
314
|
+
**Security:**
|
|
315
|
+
|
|
316
|
+
**Security Measures:**
|
|
317
|
+
- Passwords hashed with bcrypt (cost factor 10)
|
|
318
|
+
- JWT tokens signed with HS256
|
|
319
|
+
- Rate limiting: 5 login attempts per 15 minutes
|
|
320
|
+
- Password reset tokens expire in 1 hour
|
|
321
|
+
- HTTPS required for all auth endpoints
|
|
322
|
+
- Input validation on all fields
|
|
323
|
+
- SQL injection prevention via parameterized queries
|
|
324
|
+
|
|
325
|
+
**Testing:**
|
|
326
|
+
|
|
327
|
+
**Test Coverage:** 98%
|
|
328
|
+
|
|
329
|
+
**Test Files:**
|
|
330
|
+
- `test_cases/features/auth.test.js` - Unit tests (45 tests)
|
|
331
|
+
- `test_cases/integration/auth.integration.test.js` - Integration tests (20 tests)
|
|
332
|
+
- `test_cases/e2e/auth.e2e.test.js` - E2E tests (15 tests)
|
|
333
|
+
|
|
334
|
+
**Performance:**
|
|
335
|
+
- Login response time: 120ms average
|
|
336
|
+
- Registration response time: 180ms average
|
|
337
|
+
- Password reset email sent in <5s
|
|
338
|
+
|
|
339
|
+
**Monitoring:**
|
|
340
|
+
- Failed login attempts tracked
|
|
341
|
+
- Account lockouts logged
|
|
342
|
+
- Password reset requests monitored
|
|
343
|
+
- JWT token generation rate tracked
|
|
344
|
+
|
|
345
|
+
---
|
|
346
|
+
|
|
347
|
+
### Feature ID: F-002 - User Profile Management
|
|
348
|
+
|
|
349
|
+
**Added:** 2024-01-20
|
|
350
|
+
**Last Modified:** 2024-01-20
|
|
351
|
+
**Status:** `active`
|
|
352
|
+
**Priority:** `high`
|
|
353
|
+
**Completion:** 100%
|
|
354
|
+
|
|
355
|
+
**Description:**
|
|
356
|
+
Allows users to view and update their profile information including username, email, avatar, and preferences.
|
|
357
|
+
|
|
358
|
+
**User Story:**
|
|
359
|
+
As a user, I want to manage my profile information so that I can keep my account details up to date.
|
|
360
|
+
|
|
361
|
+
**Acceptance Criteria:**
|
|
362
|
+
- [x] Users can view their profile
|
|
363
|
+
- [x] Users can update username and email
|
|
364
|
+
- [x] Users can upload profile avatar
|
|
365
|
+
- [x] Users can update preferences
|
|
366
|
+
- [x] Email changes require verification
|
|
367
|
+
|
|
368
|
+
**Implementation Details:**
|
|
369
|
+
|
|
370
|
+
**Modules/Files:**
|
|
371
|
+
| File Path | Purpose | Lines of Code |
|
|
372
|
+
|-----------|---------|---------------|
|
|
373
|
+
| `src/features/profile/index.js` | Main profile module | 40 |
|
|
374
|
+
| `src/features/profile/service.js` | Profile business logic | 200 |
|
|
375
|
+
| `src/features/profile/controller.js` | API endpoints | 150 |
|
|
376
|
+
|
|
377
|
+
**API Endpoints:**
|
|
378
|
+
- `GET /api/v1/users/{id}` - Get user profile (see API_CONTRACT.md)
|
|
379
|
+
- `PUT /api/v1/users/{id}` - Update user profile (see API_CONTRACT.md)
|
|
380
|
+
- `POST /api/v1/users/{id}/avatar` - Upload avatar (see API_CONTRACT.md)
|
|
381
|
+
|
|
382
|
+
**Database Tables:**
|
|
383
|
+
- `users` - User profile data (see DATABASE_SCHEMA_CONTRACT.md)
|
|
384
|
+
- `user_preferences` - User settings (see DATABASE_SCHEMA_CONTRACT.md)
|
|
385
|
+
|
|
386
|
+
**3rd Party Integrations:**
|
|
387
|
+
- `AWS S3` - Avatar image storage (see THIRD_PARTY_INTEGRATIONS.md)
|
|
388
|
+
- `SendGrid` - Email change verification (see THIRD_PARTY_INTEGRATIONS.md)
|
|
389
|
+
|
|
390
|
+
**Dependencies:**
|
|
391
|
+
|
|
392
|
+
**Required Features:**
|
|
393
|
+
- [F-001] - User Authentication (for auth middleware)
|
|
394
|
+
|
|
395
|
+
**Used By Features:**
|
|
396
|
+
- [F-003] - User Dashboard
|
|
397
|
+
|
|
398
|
+
---
|
|
399
|
+
|
|
400
|
+
## Feature Categories
|
|
401
|
+
|
|
402
|
+
### Core Features (Critical)
|
|
403
|
+
- [F-001] - User Authentication
|
|
404
|
+
- [F-002] - User Profile Management
|
|
405
|
+
- [F-003] - User Dashboard
|
|
406
|
+
|
|
407
|
+
### User Features (High Priority)
|
|
408
|
+
- [F-010] - Feature X
|
|
409
|
+
- [F-011] - Feature Y
|
|
410
|
+
|
|
411
|
+
### Admin Features (Medium Priority)
|
|
412
|
+
- [F-020] - Admin Panel
|
|
413
|
+
- [F-021] - User Management
|
|
414
|
+
|
|
415
|
+
### Integration Features (Low Priority)
|
|
416
|
+
- [F-030] - Third-party Integration X
|
|
417
|
+
- [F-031] - Third-party Integration Y
|
|
418
|
+
|
|
419
|
+
---
|
|
420
|
+
|
|
421
|
+
## Feature Dependency Graph
|
|
422
|
+
|
|
423
|
+
```
|
|
424
|
+
[F-001] User Authentication
|
|
425
|
+
├── [F-002] User Profile Management
|
|
426
|
+
│ └── [F-003] User Dashboard
|
|
427
|
+
├── [F-010] Feature X
|
|
428
|
+
└── [F-020] Admin Panel
|
|
429
|
+
└── [F-021] User Management
|
|
430
|
+
```
|
|
431
|
+
|
|
432
|
+
---
|
|
433
|
+
|
|
434
|
+
## Feature Status Summary
|
|
435
|
+
|
|
436
|
+
| Status | Count | Features |
|
|
437
|
+
|--------|-------|----------|
|
|
438
|
+
| Active | X | [List] |
|
|
439
|
+
| Beta | X | [List] |
|
|
440
|
+
| Planned | X | [List] |
|
|
441
|
+
| Deprecated | X | [List] |
|
|
442
|
+
|
|
443
|
+
---
|
|
444
|
+
|
|
445
|
+
## Notes for Coding Agents
|
|
446
|
+
|
|
447
|
+
### 🚨 CRITICAL RULES:
|
|
448
|
+
|
|
449
|
+
1. **ALWAYS read this contract BEFORE implementing any feature**
|
|
450
|
+
2. **SEARCH this contract** to check if the feature already exists
|
|
451
|
+
3. **REUSE existing features** instead of rebuilding from scratch
|
|
452
|
+
4. **NEVER duplicate functionality** - extend existing features instead
|
|
453
|
+
5. **UPDATE this contract immediately** after implementing new features
|
|
454
|
+
6. **DOCUMENT all dependencies** - features, APIs, database, 3rd parties
|
|
455
|
+
7. **CROSS-REFERENCE all contracts:**
|
|
456
|
+
- API_CONTRACT.md for endpoints
|
|
457
|
+
- DATABASE_SCHEMA_CONTRACT.md for tables
|
|
458
|
+
- SQL_CONTRACT.json for queries
|
|
459
|
+
- THIRD_PARTY_INTEGRATIONS.md for external services
|
|
460
|
+
- INFRA_CONTRACT.md for environment variables
|
|
461
|
+
8. **INCREMENT version number** for any feature changes
|
|
462
|
+
9. **ADD changelog entry** with date, version, and changes
|
|
463
|
+
10. **PREVENT DUPLICATION** - This is the primary purpose of this contract!
|
|
464
|
+
|
|
465
|
+
### Workflow to Prevent Duplicate Features:
|
|
466
|
+
|
|
467
|
+
```
|
|
468
|
+
BEFORE IMPLEMENTING ANY FEATURE:
|
|
469
|
+
|
|
470
|
+
1. Read FEATURES_CONTRACT.md completely
|
|
471
|
+
2. Search for similar functionality by:
|
|
472
|
+
- Feature name/description
|
|
473
|
+
- User story
|
|
474
|
+
- API endpoints
|
|
475
|
+
- Database tables
|
|
476
|
+
- Business logic
|
|
477
|
+
|
|
478
|
+
3. If similar feature exists:
|
|
479
|
+
❌ DO NOT create duplicate feature
|
|
480
|
+
✅ USE the existing feature
|
|
481
|
+
✅ EXTEND the existing feature if needed
|
|
482
|
+
✅ ADD your use case to "Used By Features"
|
|
483
|
+
✅ DOCUMENT your usage in your module
|
|
484
|
+
|
|
485
|
+
4. If feature doesn't exist:
|
|
486
|
+
✅ CREATE new feature following template
|
|
487
|
+
✅ ASSIGN unique Feature ID (next available F-XXX)
|
|
488
|
+
✅ DOCUMENT all implementation details
|
|
489
|
+
✅ CROSS-REFERENCE all contracts
|
|
490
|
+
✅ ADD to appropriate category
|
|
491
|
+
✅ UPDATE dependency graph
|
|
492
|
+
✅ INCREMENT version number
|
|
493
|
+
✅ ADD changelog entry
|
|
494
|
+
|
|
495
|
+
5. If unsure:
|
|
496
|
+
⚠️ ASK the user before proceeding
|
|
497
|
+
⚠️ Document why you think it might be duplicate
|
|
498
|
+
⚠️ Suggest reusing existing feature if possible
|
|
499
|
+
```
|
|
500
|
+
|
|
501
|
+
### How to Search for Existing Features:
|
|
502
|
+
|
|
503
|
+
**By Functionality:**
|
|
504
|
+
- Search for keywords in feature descriptions
|
|
505
|
+
- Check user stories for similar use cases
|
|
506
|
+
- Look at acceptance criteria
|
|
507
|
+
|
|
508
|
+
**By Implementation:**
|
|
509
|
+
- Search for API endpoints in API_CONTRACT.md
|
|
510
|
+
- Search for database tables in DATABASE_SCHEMA_CONTRACT.md
|
|
511
|
+
- Search for SQL queries in SQL_CONTRACT.json
|
|
512
|
+
- Search for 3rd party services in THIRD_PARTY_INTEGRATIONS.md
|
|
513
|
+
|
|
514
|
+
**By Category:**
|
|
515
|
+
- Check feature categories for related features
|
|
516
|
+
- Review dependency graph for connected features
|
|
517
|
+
|
|
518
|
+
### Benefits of This Contract:
|
|
519
|
+
|
|
520
|
+
✅ **Prevents Duplicate Work** - Agents don't rebuild existing features
|
|
521
|
+
✅ **Prevents Code Conflicts** - Agents don't overwrite each other's code
|
|
522
|
+
✅ **Prevents Schema Conflicts** - Agents don't create duplicate tables
|
|
523
|
+
✅ **Prevents API Conflicts** - Agents don't create duplicate endpoints
|
|
524
|
+
✅ **Promotes Code Reuse** - Agents discover and use existing functionality
|
|
525
|
+
✅ **Maintains Consistency** - All agents follow same patterns
|
|
526
|
+
✅ **Enables Collaboration** - Agents know what others have built
|
|
527
|
+
✅ **Speeds Development** - Agents reuse instead of rebuild
|
|
528
|
+
|
|
529
|
+
---
|
|
530
|
+
|
|
531
|
+
## Initial Population Instructions
|
|
532
|
+
|
|
533
|
+
**For DevOps Agent / Coding Agents:**
|
|
534
|
+
|
|
535
|
+
When populating this template for the first time, follow this process:
|
|
536
|
+
|
|
537
|
+
### Phase 1: Identify All Features
|
|
538
|
+
|
|
539
|
+
1. **Scan codebase structure:**
|
|
540
|
+
- Look for feature folders: `src/features/`, `src/modules/`
|
|
541
|
+
- Identify distinct functional areas
|
|
542
|
+
- Group related files by feature
|
|
543
|
+
|
|
544
|
+
2. **Analyze API endpoints:**
|
|
545
|
+
- Review API_CONTRACT.md
|
|
546
|
+
- Group endpoints by feature
|
|
547
|
+
- Identify feature boundaries
|
|
548
|
+
|
|
549
|
+
3. **Analyze database schema:**
|
|
550
|
+
- Review DATABASE_SCHEMA_CONTRACT.md
|
|
551
|
+
- Group tables by feature domain
|
|
552
|
+
- Identify feature data models
|
|
553
|
+
|
|
554
|
+
4. **Review user-facing functionality:**
|
|
555
|
+
- Check frontend routes and pages
|
|
556
|
+
- Identify user workflows
|
|
557
|
+
- Map UI to backend features
|
|
558
|
+
|
|
559
|
+
5. **Create feature list:**
|
|
560
|
+
- Assign unique Feature IDs (F-001, F-002, etc.)
|
|
561
|
+
- Write feature names and descriptions
|
|
562
|
+
- Categorize by priority and status
|
|
563
|
+
|
|
564
|
+
### Phase 2: Document Each Feature
|
|
565
|
+
|
|
566
|
+
For each identified feature:
|
|
567
|
+
|
|
568
|
+
1. **Extract implementation details:**
|
|
569
|
+
- List all files/modules
|
|
570
|
+
- Document API endpoints (link to API_CONTRACT.md)
|
|
571
|
+
- Document database tables (link to DATABASE_SCHEMA_CONTRACT.md)
|
|
572
|
+
- Document SQL queries (link to SQL_CONTRACT.json)
|
|
573
|
+
- Document 3rd party integrations (link to THIRD_PARTY_INTEGRATIONS.md)
|
|
574
|
+
|
|
575
|
+
2. **Identify dependencies:**
|
|
576
|
+
- Which features does this depend on?
|
|
577
|
+
- Which features depend on this?
|
|
578
|
+
- Create dependency graph
|
|
579
|
+
|
|
580
|
+
3. **Document configuration:**
|
|
581
|
+
- Environment variables
|
|
582
|
+
- Feature flags
|
|
583
|
+
- Configuration files
|
|
584
|
+
|
|
585
|
+
4. **Add testing information:**
|
|
586
|
+
- Test files
|
|
587
|
+
- Test coverage
|
|
588
|
+
- Test scenarios
|
|
589
|
+
|
|
590
|
+
5. **Document user interface:**
|
|
591
|
+
- Pages/routes
|
|
592
|
+
- Components
|
|
593
|
+
- User permissions
|
|
594
|
+
|
|
595
|
+
### Phase 3: Cross-Reference All Contracts
|
|
596
|
+
|
|
597
|
+
1. **Link to API_CONTRACT.md:**
|
|
598
|
+
- List all endpoints used by feature
|
|
599
|
+
- Ensure endpoints are documented in API_CONTRACT.md
|
|
600
|
+
|
|
601
|
+
2. **Link to DATABASE_SCHEMA_CONTRACT.md:**
|
|
602
|
+
- List all tables used by feature
|
|
603
|
+
- Ensure tables are documented in DATABASE_SCHEMA_CONTRACT.md
|
|
604
|
+
|
|
605
|
+
3. **Link to SQL_CONTRACT.json:**
|
|
606
|
+
- List all queries used by feature
|
|
607
|
+
- Ensure queries are documented in SQL_CONTRACT.json
|
|
608
|
+
|
|
609
|
+
4. **Link to THIRD_PARTY_INTEGRATIONS.md:**
|
|
610
|
+
- List all integrations used by feature
|
|
611
|
+
- Ensure integrations are documented
|
|
612
|
+
|
|
613
|
+
5. **Link to INFRA_CONTRACT.md:**
|
|
614
|
+
- List all environment variables
|
|
615
|
+
- Ensure variables are documented
|
|
616
|
+
|
|
617
|
+
### Automated Script Approach:
|
|
618
|
+
|
|
619
|
+
Create a script that:
|
|
620
|
+
1. Scans `src/` directory for feature folders
|
|
621
|
+
2. Analyzes imports and dependencies
|
|
622
|
+
3. Extracts API routes from controllers
|
|
623
|
+
4. Identifies database models and queries
|
|
624
|
+
5. Generates initial feature list
|
|
625
|
+
6. Creates feature documentation templates
|
|
626
|
+
7. Prompts for manual review and completion
|
|
627
|
+
|
|
628
|
+
**Search Patterns:**
|
|
629
|
+
- Feature folders: `src/features/*`, `src/modules/*`
|
|
630
|
+
- Route definitions: `app.get(`, `router.post(`, `@app.route(`
|
|
631
|
+
- Database models: `class.*Model`, `Schema.define`, `CREATE TABLE`
|
|
632
|
+
- Feature flags: `feature_flags`, `isEnabled(`, `featureEnabled(`
|
|
633
|
+
- User stories: `docs/user-stories/`, `docs/requirements/`
|
|
634
|
+
|
|
635
|
+
---
|
|
636
|
+
|
|
637
|
+
## Feature Naming Convention
|
|
638
|
+
|
|
639
|
+
**Feature ID Format:** `F-XXX` (e.g., F-001, F-002, F-010)
|
|
640
|
+
|
|
641
|
+
**Numbering Scheme:**
|
|
642
|
+
- F-001 to F-009: Core/Critical features
|
|
643
|
+
- F-010 to F-019: User-facing features
|
|
644
|
+
- F-020 to F-029: Admin features
|
|
645
|
+
- F-030 to F-039: Integration features
|
|
646
|
+
- F-040 to F-049: Utility features
|
|
647
|
+
- F-050+: Custom/Future features
|
|
648
|
+
|
|
649
|
+
**Feature Name Format:** `[Noun] [Action/Type]`
|
|
650
|
+
- Good: "User Authentication", "Profile Management", "Payment Processing"
|
|
651
|
+
- Bad: "Auth", "Profiles", "Payments"
|
|
652
|
+
|
|
653
|
+
---
|
|
654
|
+
|
|
655
|
+
*This contract is a living document. Update it with every new feature implementation.*
|