aiwf 0.3.18 → 0.3.19
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/README.ko.md +84 -0
- package/README.md +87 -0
- package/ai-tools/README.md +105 -0
- package/ai-tools/augment/README.md +371 -0
- package/ai-tools/augment/config.json +30 -0
- package/ai-tools/augment/template/.augment/aiwf-integration.md +387 -0
- package/ai-tools/augment/template/.augment/augment.yaml +347 -0
- package/ai-tools/augment/template/augment.config.json +64 -0
- package/ai-tools/claude-code/README.md +151 -0
- package/ai-tools/claude-code/config.json +28 -0
- package/ai-tools/claude-code/template/CLAUDE.md +91 -0
- package/ai-tools/cursor/README.md +314 -0
- package/ai-tools/cursor/config.json +29 -0
- package/ai-tools/cursor/template/.cursorrules +362 -0
- package/ai-tools/github-copilot/README.md +195 -0
- package/ai-tools/github-copilot/config.json +24 -0
- package/ai-tools/github-copilot/template/.github/copilot-instructions.md +202 -0
- package/ai-tools/windsurf/README.md +355 -0
- package/ai-tools/windsurf/config.json +29 -0
- package/ai-tools/windsurf/template/.windsurf/aiwf-rules.md +260 -0
- package/ai-tools/windsurf/template/.windsurf/windsurf.config.js +312 -0
- package/ai-tools/windsurf/template/windsurf.config.json +63 -0
- package/docs/CODE_CLEANUP_GUIDE.ko.md +415 -0
- package/docs/CODE_CLEANUP_GUIDE.md +415 -0
- package/docs/VALIDATOR_API.ko.md +324 -0
- package/docs/VALIDATOR_API.md +324 -0
- package/package.json +3 -2
- package/src/cli/index.js +338 -0
- package/src/lib/backup-manager.js +4 -3
- package/src/lib/installer.js +126 -3
- package/src/lib/validator.js +78 -313
- package/src/utils/messages.js +16 -2
- package/src/utils/paths.js +1 -20
|
@@ -0,0 +1,314 @@
|
|
|
1
|
+
# Cursor AIWF Integration Template
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
This template optimizes Cursor IDE for AIWF projects, providing deep integration with Feature Ledger, AI Personas, and Sprint Management systems. It enhances Cursor's AI capabilities with AIWF's structured development approach.
|
|
6
|
+
|
|
7
|
+
## Features
|
|
8
|
+
|
|
9
|
+
- **Multi-File Context Awareness**: Cursor understands AIWF's interconnected structure
|
|
10
|
+
- **Feature Ledger Integration**: Automatic feature tracking and referencing
|
|
11
|
+
- **AI Persona Optimization**: Context-aware code suggestions based on active persona
|
|
12
|
+
- **Sprint Task Tracking**: Real-time task status integration
|
|
13
|
+
- **Context Compression**: Efficient handling of large codebases
|
|
14
|
+
- **Composer Enhancement**: AIWF-aware prompts and completions
|
|
15
|
+
|
|
16
|
+
## Installation
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
# Install Cursor template
|
|
20
|
+
aiwf ai-tool install cursor
|
|
21
|
+
|
|
22
|
+
# Or manually copy template files
|
|
23
|
+
cp -r .aiwf/ai-tools/cursor/template/.cursorrules .
|
|
24
|
+
cp -r .aiwf/ai-tools/cursor/template/.cursor .
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## Configuration
|
|
28
|
+
|
|
29
|
+
The template includes:
|
|
30
|
+
|
|
31
|
+
1. **.cursorrules**: Main configuration file
|
|
32
|
+
- AIWF integration rules
|
|
33
|
+
- Code generation patterns
|
|
34
|
+
- Best practices
|
|
35
|
+
- Project-specific guidelines
|
|
36
|
+
|
|
37
|
+
2. **.cursor/**: Directory for Cursor-specific settings
|
|
38
|
+
- Context providers
|
|
39
|
+
- Custom completions
|
|
40
|
+
- AIWF shortcuts
|
|
41
|
+
|
|
42
|
+
## Usage
|
|
43
|
+
|
|
44
|
+
### 1. Feature-Aware Development
|
|
45
|
+
|
|
46
|
+
Cursor automatically:
|
|
47
|
+
- Checks Feature Ledger before suggesting implementations
|
|
48
|
+
- Includes feature IDs in generated code
|
|
49
|
+
- Maintains feature traceability
|
|
50
|
+
|
|
51
|
+
```javascript
|
|
52
|
+
// Start typing a function
|
|
53
|
+
// Cursor suggests:
|
|
54
|
+
/**
|
|
55
|
+
* Feature: FL-001 - User Authentication
|
|
56
|
+
* Task: T13_S03
|
|
57
|
+
*/
|
|
58
|
+
function authenticateUser(credentials) {
|
|
59
|
+
// Feature-aware implementation
|
|
60
|
+
}
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
### 2. Composer Integration
|
|
64
|
+
|
|
65
|
+
Use AIWF context in Composer:
|
|
66
|
+
|
|
67
|
+
```
|
|
68
|
+
Composer> Implement the user profile feature following FL-002 specifications
|
|
69
|
+
|
|
70
|
+
Composer> Using architect persona, design the payment system architecture
|
|
71
|
+
|
|
72
|
+
Composer> Compress and analyze the authentication module for optimization
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
### 3. Multi-File Operations
|
|
76
|
+
|
|
77
|
+
Leverage Cursor's multi-file edit:
|
|
78
|
+
|
|
79
|
+
1. **Feature Implementation**
|
|
80
|
+
- Opens feature file, implementation, tests together
|
|
81
|
+
- Maintains consistency across files
|
|
82
|
+
- Updates documentation automatically
|
|
83
|
+
|
|
84
|
+
2. **Sprint Task Completion**
|
|
85
|
+
- Updates task status
|
|
86
|
+
- Modifies related files
|
|
87
|
+
- Commits with proper references
|
|
88
|
+
|
|
89
|
+
### 4. Context Management
|
|
90
|
+
|
|
91
|
+
Efficient context usage:
|
|
92
|
+
|
|
93
|
+
```javascript
|
|
94
|
+
// Large file handling
|
|
95
|
+
// @compress src/large-module.js
|
|
96
|
+
// Cursor automatically uses compressed version
|
|
97
|
+
|
|
98
|
+
// Feature reference
|
|
99
|
+
// @feature FL-001
|
|
100
|
+
// Cursor loads feature specification
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
### 5. AI Persona Integration
|
|
104
|
+
|
|
105
|
+
Switch personas for different contexts:
|
|
106
|
+
|
|
107
|
+
```javascript
|
|
108
|
+
// @persona architect
|
|
109
|
+
// Cursor provides architectural patterns and design suggestions
|
|
110
|
+
|
|
111
|
+
// @persona developer
|
|
112
|
+
// Cursor focuses on implementation details and optimization
|
|
113
|
+
|
|
114
|
+
// @persona reviewer
|
|
115
|
+
// Cursor highlights potential issues and suggests improvements
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
## Best Practices
|
|
119
|
+
|
|
120
|
+
### 1. Start with Context
|
|
121
|
+
|
|
122
|
+
Always provide AIWF context:
|
|
123
|
+
|
|
124
|
+
```javascript
|
|
125
|
+
/**
|
|
126
|
+
* Working on: Sprint S03
|
|
127
|
+
* Task: T13_S03 - AI Tool Integration
|
|
128
|
+
* Feature: FL-010 - Tool Templates
|
|
129
|
+
*/
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
### 2. Use Feature References
|
|
133
|
+
|
|
134
|
+
Reference features in all code:
|
|
135
|
+
|
|
136
|
+
```javascript
|
|
137
|
+
// Good
|
|
138
|
+
import { UserAuth } from './features/FL001-auth'; // Feature: FL-001
|
|
139
|
+
|
|
140
|
+
// Avoid
|
|
141
|
+
import { UserAuth } from './auth'; // No feature reference
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
### 3. Maintain Task Flow
|
|
145
|
+
|
|
146
|
+
Follow task lifecycle:
|
|
147
|
+
|
|
148
|
+
```bash
|
|
149
|
+
# Start work
|
|
150
|
+
aiwf task start T13_S03
|
|
151
|
+
|
|
152
|
+
# During development (in Cursor)
|
|
153
|
+
// Task: T13_S03 - Status: in_progress
|
|
154
|
+
|
|
155
|
+
# Complete work
|
|
156
|
+
aiwf task complete T13_S03
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
### 4. Leverage Compression
|
|
160
|
+
|
|
161
|
+
For large files:
|
|
162
|
+
|
|
163
|
+
```bash
|
|
164
|
+
# Compress before including in context
|
|
165
|
+
aiwf context compress src/large-component.js
|
|
166
|
+
|
|
167
|
+
# Reference in Cursor
|
|
168
|
+
// @compressed large-component.js
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
## Advanced Features
|
|
172
|
+
|
|
173
|
+
### 1. Custom Context Providers
|
|
174
|
+
|
|
175
|
+
Create `.cursor/providers.json`:
|
|
176
|
+
|
|
177
|
+
```json
|
|
178
|
+
{
|
|
179
|
+
"providers": [
|
|
180
|
+
{
|
|
181
|
+
"name": "feature-ledger",
|
|
182
|
+
"path": ".aiwf/feature-ledger/",
|
|
183
|
+
"pattern": "FL-*.json"
|
|
184
|
+
},
|
|
185
|
+
{
|
|
186
|
+
"name": "current-sprint",
|
|
187
|
+
"path": ".aiwf/03_SPRINTS/current/",
|
|
188
|
+
"pattern": "*.md"
|
|
189
|
+
}
|
|
190
|
+
]
|
|
191
|
+
}
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
### 2. AIWF Snippets
|
|
195
|
+
|
|
196
|
+
Define in `.cursor/snippets.json`:
|
|
197
|
+
|
|
198
|
+
```json
|
|
199
|
+
{
|
|
200
|
+
"aiwf-feature": {
|
|
201
|
+
"prefix": "aiwf-feat",
|
|
202
|
+
"body": [
|
|
203
|
+
"/**",
|
|
204
|
+
" * Feature: FL-${1:XXX} - ${2:Feature Name}",
|
|
205
|
+
" * Sprint: S${3:XX}",
|
|
206
|
+
" * Task: T${4:XX}_S${3:XX}",
|
|
207
|
+
" */"
|
|
208
|
+
]
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
### 3. Workspace Settings
|
|
214
|
+
|
|
215
|
+
Configure `.cursor/settings.json`:
|
|
216
|
+
|
|
217
|
+
```json
|
|
218
|
+
{
|
|
219
|
+
"aiwf": {
|
|
220
|
+
"autoCheckFeatureLedger": true,
|
|
221
|
+
"showTaskStatus": true,
|
|
222
|
+
"enablePersonaHints": true,
|
|
223
|
+
"contextCompression": {
|
|
224
|
+
"threshold": 1000,
|
|
225
|
+
"automatic": true
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
## Troubleshooting
|
|
232
|
+
|
|
233
|
+
### Common Issues
|
|
234
|
+
|
|
235
|
+
1. **Cursor not recognizing AIWF patterns**
|
|
236
|
+
- Ensure .cursorrules is in project root
|
|
237
|
+
- Restart Cursor to reload rules
|
|
238
|
+
- Check file permissions
|
|
239
|
+
|
|
240
|
+
2. **Feature references missing**
|
|
241
|
+
- Run `aiwf ledger sync`
|
|
242
|
+
- Verify Feature Ledger structure
|
|
243
|
+
- Update .cursorrules if needed
|
|
244
|
+
|
|
245
|
+
3. **Context overflow**
|
|
246
|
+
- Use compression for large files
|
|
247
|
+
- Reference features by ID
|
|
248
|
+
- Clear unnecessary context
|
|
249
|
+
|
|
250
|
+
### Debug Mode
|
|
251
|
+
|
|
252
|
+
Enable AIWF debug in Cursor:
|
|
253
|
+
|
|
254
|
+
```json
|
|
255
|
+
{
|
|
256
|
+
"aiwf.debug": true,
|
|
257
|
+
"aiwf.logLevel": "verbose"
|
|
258
|
+
}
|
|
259
|
+
```
|
|
260
|
+
|
|
261
|
+
## Integration Tips
|
|
262
|
+
|
|
263
|
+
### 1. Composer Workflows
|
|
264
|
+
|
|
265
|
+
Effective Composer prompts:
|
|
266
|
+
|
|
267
|
+
```
|
|
268
|
+
"Implement FL-001 authentication with test coverage"
|
|
269
|
+
"Using reviewer persona, analyze the payment module"
|
|
270
|
+
"Update all files related to task T13_S03"
|
|
271
|
+
```
|
|
272
|
+
|
|
273
|
+
### 2. Multi-File Patterns
|
|
274
|
+
|
|
275
|
+
Common multi-file operations:
|
|
276
|
+
|
|
277
|
+
- Feature + Tests + Docs
|
|
278
|
+
- API Route + Controller + Service + Tests
|
|
279
|
+
- Component + Styles + Tests + Story
|
|
280
|
+
|
|
281
|
+
### 3. Context Optimization
|
|
282
|
+
|
|
283
|
+
Manage context efficiently:
|
|
284
|
+
|
|
285
|
+
- Use feature IDs instead of full descriptions
|
|
286
|
+
- Compress files over 1000 lines
|
|
287
|
+
- Reference ADRs by number
|
|
288
|
+
- Include only active sprint tasks
|
|
289
|
+
|
|
290
|
+
## Updates
|
|
291
|
+
|
|
292
|
+
Keep template synchronized:
|
|
293
|
+
|
|
294
|
+
```bash
|
|
295
|
+
# Check for updates
|
|
296
|
+
aiwf ai-tool check cursor
|
|
297
|
+
|
|
298
|
+
# Update template
|
|
299
|
+
aiwf ai-tool update cursor
|
|
300
|
+
|
|
301
|
+
# Verify installation
|
|
302
|
+
aiwf ai-tool verify cursor
|
|
303
|
+
```
|
|
304
|
+
|
|
305
|
+
## Resources
|
|
306
|
+
|
|
307
|
+
- [Cursor Documentation](https://cursor.sh/docs)
|
|
308
|
+
- [AIWF Documentation](https://aiwf.dev/docs)
|
|
309
|
+
- [Integration Guide](https://aiwf.dev/guides/cursor)
|
|
310
|
+
- [Community Forum](https://forum.aiwf.dev/cursor)
|
|
311
|
+
|
|
312
|
+
---
|
|
313
|
+
|
|
314
|
+
*Cursor Integration Template v1.0.0*
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "cursor",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Cursor IDE integration template for AIWF",
|
|
5
|
+
"compatible_aiwf_version": ">=0.1.0",
|
|
6
|
+
"features": {
|
|
7
|
+
"feature_ledger": true,
|
|
8
|
+
"ai_persona": true,
|
|
9
|
+
"context_compression": true,
|
|
10
|
+
"offline_cache": true,
|
|
11
|
+
"multi_file_edit": true
|
|
12
|
+
},
|
|
13
|
+
"setup_commands": [],
|
|
14
|
+
"files_to_copy": [
|
|
15
|
+
{
|
|
16
|
+
"source": "template/.cursorrules",
|
|
17
|
+
"destination": ".cursorrules"
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
"source": "template/.cursor",
|
|
21
|
+
"destination": ".cursor"
|
|
22
|
+
}
|
|
23
|
+
],
|
|
24
|
+
"settings": {
|
|
25
|
+
"aiwf_context_provider": true,
|
|
26
|
+
"feature_aware_completions": true,
|
|
27
|
+
"sprint_task_tracking": true
|
|
28
|
+
}
|
|
29
|
+
}
|
|
@@ -0,0 +1,362 @@
|
|
|
1
|
+
# Cursor AI Rules for AIWF Projects
|
|
2
|
+
|
|
3
|
+
## Project Context
|
|
4
|
+
This project uses the AI Workflow Framework (AIWF) for structured development with AI assistance. Follow these rules to ensure Cursor provides AIWF-aware suggestions.
|
|
5
|
+
|
|
6
|
+
## Core Principles
|
|
7
|
+
|
|
8
|
+
### 1. Feature-Driven Development
|
|
9
|
+
- Always check Feature Ledger before implementing new features
|
|
10
|
+
- Reference Feature IDs (FL###) in all related code
|
|
11
|
+
- Maintain feature traceability throughout the codebase
|
|
12
|
+
|
|
13
|
+
### 2. Sprint-Aligned Coding
|
|
14
|
+
- Reference current sprint tasks in implementations
|
|
15
|
+
- Update task status as work progresses
|
|
16
|
+
- Follow sprint acceptance criteria strictly
|
|
17
|
+
|
|
18
|
+
### 3. Persona-Based Development
|
|
19
|
+
- Apply appropriate coding style based on active persona
|
|
20
|
+
- Switch personas for different types of work
|
|
21
|
+
- Document persona usage in code comments
|
|
22
|
+
|
|
23
|
+
## AIWF Integration Rules
|
|
24
|
+
|
|
25
|
+
### Feature References
|
|
26
|
+
```javascript
|
|
27
|
+
/**
|
|
28
|
+
* @feature FL001 - User Authentication System
|
|
29
|
+
* @task TX01_S01 - Implement login functionality
|
|
30
|
+
* @persona developer
|
|
31
|
+
*/
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
### Sprint Context
|
|
35
|
+
```javascript
|
|
36
|
+
// Sprint: S01_M02 - Authentication Foundation
|
|
37
|
+
// Task: TX01_S01
|
|
38
|
+
// Status: in_progress
|
|
39
|
+
// Acceptance Criteria:
|
|
40
|
+
// - [ ] User can log in with email/password
|
|
41
|
+
// - [ ] Sessions are managed securely
|
|
42
|
+
// - [ ] Rate limiting is implemented
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
### Error Handling with Context
|
|
46
|
+
```javascript
|
|
47
|
+
class FeatureError extends Error {
|
|
48
|
+
constructor(message, context) {
|
|
49
|
+
super(`[${context.featureId}/${context.taskId}] ${message}`);
|
|
50
|
+
this.feature = context.featureId;
|
|
51
|
+
this.task = context.taskId;
|
|
52
|
+
this.timestamp = new Date().toISOString();
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
## Code Generation Guidelines
|
|
58
|
+
|
|
59
|
+
### 1. Documentation Standards
|
|
60
|
+
Every function/class must include:
|
|
61
|
+
- Feature ID reference
|
|
62
|
+
- Task ID (if applicable)
|
|
63
|
+
- Active persona
|
|
64
|
+
- Brief description
|
|
65
|
+
- Example usage
|
|
66
|
+
|
|
67
|
+
### 2. Naming Conventions
|
|
68
|
+
- Features: `FL###_FeatureName`
|
|
69
|
+
- Tasks: `TX##_S##_TaskName`
|
|
70
|
+
- Sprints: `S##_M##_SprintName`
|
|
71
|
+
- Files: `feature-id_component-name.ext`
|
|
72
|
+
|
|
73
|
+
### 3. Import Organization
|
|
74
|
+
```javascript
|
|
75
|
+
// External dependencies
|
|
76
|
+
import express from 'express';
|
|
77
|
+
import jwt from 'jsonwebtoken';
|
|
78
|
+
|
|
79
|
+
// AIWF core imports
|
|
80
|
+
import { FeatureLedger } from '@aiwf/core';
|
|
81
|
+
import { TaskManager } from '@aiwf/tasks';
|
|
82
|
+
|
|
83
|
+
// Project imports
|
|
84
|
+
import { AuthService } from './services/auth.service';
|
|
85
|
+
|
|
86
|
+
// Feature-specific imports
|
|
87
|
+
import { FL001_UserAuth } from './features/FL001_user_auth';
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
## Persona-Specific Patterns
|
|
91
|
+
|
|
92
|
+
### Architect Persona
|
|
93
|
+
Focus on:
|
|
94
|
+
- System design patterns
|
|
95
|
+
- Architecture documentation
|
|
96
|
+
- Technology decisions
|
|
97
|
+
- Scalability considerations
|
|
98
|
+
|
|
99
|
+
```javascript
|
|
100
|
+
// Architect persona active
|
|
101
|
+
interface IAuthenticationStrategy {
|
|
102
|
+
authenticate(credentials: ICredentials): Promise<IAuthResult>;
|
|
103
|
+
refresh(token: string): Promise<IAuthResult>;
|
|
104
|
+
revoke(token: string): Promise<void>;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
// Suggest factory patterns, dependency injection, etc.
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
### Security Persona
|
|
111
|
+
Focus on:
|
|
112
|
+
- Input validation
|
|
113
|
+
- Security best practices
|
|
114
|
+
- Vulnerability prevention
|
|
115
|
+
- Audit logging
|
|
116
|
+
|
|
117
|
+
```javascript
|
|
118
|
+
// Security persona active
|
|
119
|
+
class SecureAuthService {
|
|
120
|
+
async authenticate(credentials) {
|
|
121
|
+
// Input sanitization
|
|
122
|
+
this.validator.sanitize(credentials);
|
|
123
|
+
|
|
124
|
+
// Rate limiting check
|
|
125
|
+
await this.rateLimiter.check(credentials.email);
|
|
126
|
+
|
|
127
|
+
// Secure password comparison
|
|
128
|
+
const isValid = await bcrypt.compare(
|
|
129
|
+
credentials.password,
|
|
130
|
+
hashedPassword
|
|
131
|
+
);
|
|
132
|
+
|
|
133
|
+
// Audit log
|
|
134
|
+
this.auditLogger.log('auth_attempt', {
|
|
135
|
+
email: credentials.email,
|
|
136
|
+
success: isValid,
|
|
137
|
+
ip: request.ip,
|
|
138
|
+
timestamp: new Date()
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
### Developer Persona
|
|
145
|
+
Focus on:
|
|
146
|
+
- Clean implementation
|
|
147
|
+
- Error handling
|
|
148
|
+
- Testing
|
|
149
|
+
- Performance
|
|
150
|
+
|
|
151
|
+
```javascript
|
|
152
|
+
// Developer persona active
|
|
153
|
+
class UserController {
|
|
154
|
+
constructor(
|
|
155
|
+
private authService: AuthService,
|
|
156
|
+
private logger: Logger
|
|
157
|
+
) {}
|
|
158
|
+
|
|
159
|
+
async login(req: Request, res: Response) {
|
|
160
|
+
try {
|
|
161
|
+
const result = await this.authService.authenticate(req.body);
|
|
162
|
+
|
|
163
|
+
res.json({
|
|
164
|
+
success: true,
|
|
165
|
+
data: result
|
|
166
|
+
});
|
|
167
|
+
|
|
168
|
+
this.logger.info('User logged in', { userId: result.user.id });
|
|
169
|
+
} catch (error) {
|
|
170
|
+
this.logger.error('Login failed', error);
|
|
171
|
+
|
|
172
|
+
res.status(401).json({
|
|
173
|
+
success: false,
|
|
174
|
+
error: 'Authentication failed'
|
|
175
|
+
});
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
## Testing Guidelines
|
|
182
|
+
|
|
183
|
+
### Test Structure
|
|
184
|
+
```javascript
|
|
185
|
+
describe('Feature FL001: User Authentication', () => {
|
|
186
|
+
describe('Task TX01_S01: Login Implementation', () => {
|
|
187
|
+
describe('Acceptance Criteria', () => {
|
|
188
|
+
it('should authenticate valid credentials', async () => {
|
|
189
|
+
// Test implementation
|
|
190
|
+
});
|
|
191
|
+
|
|
192
|
+
it('should reject invalid credentials', async () => {
|
|
193
|
+
// Test implementation
|
|
194
|
+
});
|
|
195
|
+
|
|
196
|
+
it('should enforce rate limiting', async () => {
|
|
197
|
+
// Test implementation
|
|
198
|
+
});
|
|
199
|
+
});
|
|
200
|
+
});
|
|
201
|
+
});
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
### Test Documentation
|
|
205
|
+
```javascript
|
|
206
|
+
/**
|
|
207
|
+
* Test Suite: User Authentication
|
|
208
|
+
* @feature FL001
|
|
209
|
+
* @sprint S01_M02
|
|
210
|
+
* @coverage Unit, Integration
|
|
211
|
+
*/
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
## Git Integration
|
|
215
|
+
|
|
216
|
+
### Commit Message Format
|
|
217
|
+
```
|
|
218
|
+
<type>(<feature-id>): <description>
|
|
219
|
+
|
|
220
|
+
<body>
|
|
221
|
+
|
|
222
|
+
Task: <task-id>
|
|
223
|
+
Sprint: <sprint-id>
|
|
224
|
+
Persona: <active-persona>
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
Example:
|
|
228
|
+
```
|
|
229
|
+
feat(FL001): implement JWT authentication
|
|
230
|
+
|
|
231
|
+
- Add token generation service
|
|
232
|
+
- Implement refresh token logic
|
|
233
|
+
- Add token validation middleware
|
|
234
|
+
|
|
235
|
+
Task: TX01_S01
|
|
236
|
+
Sprint: S01_M02
|
|
237
|
+
Persona: developer
|
|
238
|
+
```
|
|
239
|
+
|
|
240
|
+
### Branch Naming
|
|
241
|
+
```
|
|
242
|
+
feature/FL###-short-description
|
|
243
|
+
task/TX##-S##-task-name
|
|
244
|
+
bugfix/FL###-issue-description
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
## Code Review Checklist
|
|
248
|
+
|
|
249
|
+
When reviewing code, ensure:
|
|
250
|
+
- [ ] Feature ID is referenced
|
|
251
|
+
- [ ] Task requirements are met
|
|
252
|
+
- [ ] Appropriate persona patterns are used
|
|
253
|
+
- [ ] AIWF conventions are followed
|
|
254
|
+
- [ ] Documentation is complete
|
|
255
|
+
- [ ] Tests cover acceptance criteria
|
|
256
|
+
- [ ] Security considerations are addressed
|
|
257
|
+
- [ ] Performance impact is acceptable
|
|
258
|
+
|
|
259
|
+
## Quick Commands
|
|
260
|
+
|
|
261
|
+
Include these in comments for quick actions:
|
|
262
|
+
```javascript
|
|
263
|
+
// @aiwf-check-feature - Verify feature exists in ledger
|
|
264
|
+
// @aiwf-update-task - Update task progress
|
|
265
|
+
// @aiwf-switch-persona - Change active persona
|
|
266
|
+
// @aiwf-link-sprint - Link to current sprint
|
|
267
|
+
```
|
|
268
|
+
|
|
269
|
+
## AI Behavior Modifiers
|
|
270
|
+
|
|
271
|
+
### Context-Aware Suggestions
|
|
272
|
+
- Prioritize AIWF patterns
|
|
273
|
+
- Include feature/task references
|
|
274
|
+
- Apply persona-specific styles
|
|
275
|
+
- Maintain project consistency
|
|
276
|
+
|
|
277
|
+
### Auto-Complete Preferences
|
|
278
|
+
1. AIWF-specific imports first
|
|
279
|
+
2. Feature-based function names
|
|
280
|
+
3. Task-aligned variable names
|
|
281
|
+
4. Persona-appropriate patterns
|
|
282
|
+
|
|
283
|
+
## Integration Points
|
|
284
|
+
|
|
285
|
+
### Feature Ledger
|
|
286
|
+
```javascript
|
|
287
|
+
// Always validate against Feature Ledger
|
|
288
|
+
const ledger = new FeatureLedger();
|
|
289
|
+
const feature = await ledger.getFeature('FL001');
|
|
290
|
+
|
|
291
|
+
if (feature.status !== 'active') {
|
|
292
|
+
throw new FeatureError('Feature not active', {
|
|
293
|
+
featureId: 'FL001',
|
|
294
|
+
status: feature.status
|
|
295
|
+
});
|
|
296
|
+
}
|
|
297
|
+
```
|
|
298
|
+
|
|
299
|
+
### Task Management
|
|
300
|
+
```javascript
|
|
301
|
+
// Update task progress
|
|
302
|
+
const taskManager = new TaskManager();
|
|
303
|
+
await taskManager.updateProgress('TX01_S01', {
|
|
304
|
+
percentage: 75,
|
|
305
|
+
notes: 'Authentication implemented, testing remaining'
|
|
306
|
+
});
|
|
307
|
+
```
|
|
308
|
+
|
|
309
|
+
### Sprint Tracking
|
|
310
|
+
```javascript
|
|
311
|
+
// Get current sprint context
|
|
312
|
+
const sprint = await aiwf.getCurrentSprint();
|
|
313
|
+
console.log(`Working on: ${sprint.name} (${sprint.id})`);
|
|
314
|
+
```
|
|
315
|
+
|
|
316
|
+
## Performance Considerations
|
|
317
|
+
|
|
318
|
+
### Feature-Specific Optimization
|
|
319
|
+
```javascript
|
|
320
|
+
// Include performance metrics per feature
|
|
321
|
+
/**
|
|
322
|
+
* @feature FL001
|
|
323
|
+
* @performance Target: <100ms response time
|
|
324
|
+
* @performance Current: 85ms average
|
|
325
|
+
*/
|
|
326
|
+
```
|
|
327
|
+
|
|
328
|
+
### Caching Strategy
|
|
329
|
+
```javascript
|
|
330
|
+
// Feature-aware caching
|
|
331
|
+
const cacheKey = `feature:${featureId}:${userId}`;
|
|
332
|
+
const cached = await cache.get(cacheKey);
|
|
333
|
+
```
|
|
334
|
+
|
|
335
|
+
## Security Patterns
|
|
336
|
+
|
|
337
|
+
### Feature-Level Security
|
|
338
|
+
```javascript
|
|
339
|
+
// Apply security based on feature requirements
|
|
340
|
+
@FeatureSecurity('FL001', ['auth:read', 'auth:write'])
|
|
341
|
+
class AuthenticationEndpoint {
|
|
342
|
+
// Implementation
|
|
343
|
+
}
|
|
344
|
+
```
|
|
345
|
+
|
|
346
|
+
### Audit Logging
|
|
347
|
+
```javascript
|
|
348
|
+
// Include feature context in audit logs
|
|
349
|
+
auditLogger.log({
|
|
350
|
+
action: 'user.login',
|
|
351
|
+
feature: 'FL001',
|
|
352
|
+
task: 'TX01_S01',
|
|
353
|
+
user: userId,
|
|
354
|
+
timestamp: new Date(),
|
|
355
|
+
result: 'success'
|
|
356
|
+
});
|
|
357
|
+
```
|
|
358
|
+
|
|
359
|
+
---
|
|
360
|
+
|
|
361
|
+
*Cursor AI Rules for AIWF Integration v1.0.0*
|
|
362
|
+
*These rules ensure Cursor provides AIWF-aware code suggestions and maintains project consistency*
|