specpilot 1.1.0 → 1.1.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/README.md +170 -150
- package/dist/cli.js +2 -2
- package/dist/cli.js.map +1 -1
- package/dist/commands/init.d.ts +1 -1
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +21 -3
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/list.d.ts.map +1 -1
- package/dist/commands/list.js +0 -3
- package/dist/commands/list.js.map +1 -1
- package/dist/utils/specGenerator.d.ts +4 -22
- package/dist/utils/specGenerator.d.ts.map +1 -1
- package/dist/utils/specGenerator.js +189 -1088
- package/dist/utils/specGenerator.js.map +1 -1
- package/dist/utils/specValidator.d.ts +1 -0
- package/dist/utils/specValidator.d.ts.map +1 -1
- package/dist/utils/specValidator.js +64 -21
- package/dist/utils/specValidator.js.map +1 -1
- package/dist/utils/templateEngine.d.ts.map +1 -1
- package/dist/utils/templateEngine.js +22 -5
- package/dist/utils/templateEngine.js.map +1 -1
- package/dist/utils/templateRegistry.d.ts.map +1 -1
- package/dist/utils/templateRegistry.js +0 -14
- package/dist/utils/templateRegistry.js.map +1 -1
- package/package.json +1 -1
|
@@ -9,25 +9,31 @@ class SpecGenerator {
|
|
|
9
9
|
}
|
|
10
10
|
async generateSpecs(options) {
|
|
11
11
|
const specsDir = (0, path_1.join)(options.targetDir, options.specsName);
|
|
12
|
-
// Create .specs
|
|
12
|
+
// Create .specs and subfolders
|
|
13
13
|
(0, fs_1.mkdirSync)(specsDir, { recursive: true });
|
|
14
|
+
const subfolders = ['project', 'architecture', 'planning', 'quality', 'development'];
|
|
15
|
+
subfolders.forEach(sub => (0, fs_1.mkdirSync)((0, path_1.join)(specsDir, sub), { recursive: true }));
|
|
14
16
|
const context = {
|
|
15
17
|
projectName: options.projectName,
|
|
16
18
|
language: options.language,
|
|
17
19
|
framework: options.framework,
|
|
18
20
|
author: options.author || 'Your Name',
|
|
19
|
-
description: options.description || `A ${options.language} project${options.framework ? ` using ${options.framework}` : ''}
|
|
21
|
+
description: options.description || `A ${options.language} project${options.framework ? ` using ${options.framework}` : ''}`,
|
|
22
|
+
lastUpdated: '2025-10-05',
|
|
23
|
+
contributors: [options.author || 'Your Name']
|
|
20
24
|
};
|
|
21
|
-
//
|
|
22
|
-
await this.generateProjectYaml(specsDir, context);
|
|
23
|
-
await this.
|
|
24
|
-
await this.
|
|
25
|
-
await this.generateApiYaml(specsDir, context);
|
|
26
|
-
await this.
|
|
27
|
-
await this.
|
|
28
|
-
await this.
|
|
29
|
-
await this.
|
|
30
|
-
await this.
|
|
25
|
+
// Write spec files in correct subfolders
|
|
26
|
+
await this.generateProjectYaml((0, path_1.join)(specsDir, 'project'), context);
|
|
27
|
+
await this.generateRequirementsMd((0, path_1.join)(specsDir, 'project'), context);
|
|
28
|
+
await this.generateArchitectureMd((0, path_1.join)(specsDir, 'architecture'), context);
|
|
29
|
+
await this.generateApiYaml((0, path_1.join)(specsDir, 'architecture'), context);
|
|
30
|
+
await this.generateTasksMd((0, path_1.join)(specsDir, 'planning'), context);
|
|
31
|
+
await this.generateRoadmapMd((0, path_1.join)(specsDir, 'planning'), context);
|
|
32
|
+
await this.generateDocsMd((0, path_1.join)(specsDir, 'development'), context);
|
|
33
|
+
await this.generateContextMd((0, path_1.join)(specsDir, 'development'), context);
|
|
34
|
+
await this.generateProjectPlanMd((0, path_1.join)(specsDir, 'project'), context);
|
|
35
|
+
await this.generatePromptsMd((0, path_1.join)(specsDir, 'development'), context);
|
|
36
|
+
await this.generateTestsMd((0, path_1.join)(specsDir, 'quality'), context);
|
|
31
37
|
await this.generateSpecUpdateTemplateMd(specsDir, context);
|
|
32
38
|
}
|
|
33
39
|
async generateProjectYaml(specsDir, context) {
|
|
@@ -41,1176 +47,271 @@ class SpecGenerator {
|
|
|
41
47
|
(0, fs_1.writeFileSync)((0, path_1.join)(specsDir, 'architecture.md'), content);
|
|
42
48
|
}
|
|
43
49
|
async generateRequirementsMd(specsDir, context) {
|
|
44
|
-
const content =
|
|
50
|
+
const content = `---
|
|
51
|
+
title: Requirements
|
|
52
|
+
project: {{projectName}}
|
|
53
|
+
language: {{language}}
|
|
54
|
+
framework: {{framework}}
|
|
55
|
+
lastUpdated: {{currentDate}}
|
|
56
|
+
sourceOfTruth: project/project.yaml
|
|
57
|
+
---
|
|
58
|
+
|
|
59
|
+
# {{projectName}} Requirements
|
|
45
60
|
|
|
46
61
|
## Project Overview
|
|
47
62
|
{{description}}
|
|
48
63
|
|
|
49
64
|
## Functional Requirements
|
|
65
|
+
[TODO: Add requirements with proper template]
|
|
50
66
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
- Success criteria: [measurable outcome]
|
|
56
|
-
|
|
57
|
-
2. **Feature 2**: [Describe secondary functionality]
|
|
58
|
-
- User can [specific action]
|
|
59
|
-
- System should [expected behavior]
|
|
60
|
-
- Success criteria: [measurable outcome]
|
|
61
|
-
|
|
62
|
-
## Non-Functional Requirements
|
|
63
|
-
|
|
64
|
-
### Performance
|
|
65
|
-
- Response time: < 200ms for API calls
|
|
66
|
-
- Throughput: Support [X] concurrent users
|
|
67
|
-
- Scalability: Horizontal scaling capability
|
|
68
|
-
|
|
69
|
-
### Security
|
|
70
|
-
- Authentication and authorization
|
|
71
|
-
- Data encryption at rest and in transit
|
|
72
|
-
- Input validation and sanitization
|
|
73
|
-
|
|
74
|
-
### Reliability
|
|
75
|
-
- 99.9% uptime availability
|
|
76
|
-
- Graceful error handling
|
|
77
|
-
- Automated backup and recovery
|
|
78
|
-
|
|
79
|
-
### Usability
|
|
80
|
-
- Intuitive user interface
|
|
81
|
-
- Responsive design for mobile devices
|
|
82
|
-
- Accessibility compliance (WCAG 2.1)
|
|
83
|
-
|
|
84
|
-
## Technical Requirements
|
|
85
|
-
|
|
86
|
-
### ${context.language} Specific
|
|
87
|
-
${this.getTechnicalRequirements(context.language, context.framework)}
|
|
88
|
-
|
|
89
|
-
## User Stories
|
|
90
|
-
|
|
91
|
-
### Epic 1: Core Functionality
|
|
92
|
-
- **US-001**: As a [user type], I want to [action] so that [benefit]
|
|
93
|
-
- **AC1**: Given [precondition], when [action], then [expected result]
|
|
94
|
-
- **AC2**: Given [precondition], when [action], then [expected result]
|
|
95
|
-
|
|
96
|
-
### Epic 2: Additional Features
|
|
97
|
-
- **US-002**: As a [user type], I want to [action] so that [benefit]
|
|
98
|
-
- **AC1**: Given [precondition], when [action], then [expected result]
|
|
99
|
-
|
|
100
|
-
## Acceptance Criteria
|
|
101
|
-
All features must:
|
|
102
|
-
- Have comprehensive test coverage (>90%)
|
|
103
|
-
- Pass security review
|
|
104
|
-
- Meet performance benchmarks
|
|
105
|
-
- Include proper documentation
|
|
106
|
-
|
|
107
|
-
## Constraints and Assumptions
|
|
108
|
-
- **Budget**: [if applicable]
|
|
109
|
-
- **Timeline**: [project deadlines]
|
|
110
|
-
- **Technology**: Must use ${context.language}${context.framework ? ` with ${context.framework}` : ''}
|
|
111
|
-
- **Compliance**: [regulatory requirements]
|
|
67
|
+
## Cross-References
|
|
68
|
+
- Architecture: ../architecture/architecture.md
|
|
69
|
+
- API: ../architecture/api.yaml
|
|
70
|
+
- Project config: ../project/project.yaml
|
|
112
71
|
|
|
113
72
|
---
|
|
114
73
|
*Last updated: {{currentDate}}*`;
|
|
115
74
|
const rendered = this.templateEngine.renderFromString(content, context);
|
|
116
75
|
(0, fs_1.writeFileSync)((0, path_1.join)(specsDir, 'requirements.md'), rendered);
|
|
117
76
|
}
|
|
118
|
-
getTechnicalRequirements(language, framework) {
|
|
119
|
-
if (language === 'typescript') {
|
|
120
|
-
return `- TypeScript strict mode enabled
|
|
121
|
-
- Modern ES2020+ features
|
|
122
|
-
- Node.js LTS version
|
|
123
|
-
${framework === 'react' ? '- React 18+ with hooks' : ''}
|
|
124
|
-
${framework === 'express' ? '- Express.js with middleware' : ''}
|
|
125
|
-
- Comprehensive type definitions`;
|
|
126
|
-
}
|
|
127
|
-
if (language === 'python') {
|
|
128
|
-
return `- Python 3.9+ compatibility
|
|
129
|
-
- Type hints throughout codebase
|
|
130
|
-
- Virtual environment management
|
|
131
|
-
${framework === 'django' ? '- Django 4.0+ framework' : ''}
|
|
132
|
-
${framework === 'fastapi' ? '- FastAPI with async support' : ''}
|
|
133
|
-
- PEP 8 code style compliance`;
|
|
134
|
-
}
|
|
135
|
-
if (language === 'java') {
|
|
136
|
-
return `- Java 17+ LTS version
|
|
137
|
-
- Maven or Gradle build system
|
|
138
|
-
${framework === 'spring-boot' ? '- Spring Boot 3.0+' : ''}
|
|
139
|
-
- JUnit 5 for testing
|
|
140
|
-
- SonarQube code quality`;
|
|
141
|
-
}
|
|
142
|
-
return `- ${language} best practices
|
|
143
|
-
- Comprehensive testing
|
|
144
|
-
- Code quality standards`;
|
|
145
|
-
}
|
|
146
77
|
async generateApiYaml(specsDir, context) {
|
|
147
78
|
const content = `# {{projectName}} API Specification
|
|
148
|
-
|
|
79
|
+
# meta: project={{projectName}} language={{language}} framework={{framework}} updated={{currentDate}}
|
|
149
80
|
openapi: 3.0.3
|
|
150
81
|
info:
|
|
151
82
|
title: {{projectName}} API
|
|
152
83
|
description: {{description}}
|
|
153
|
-
version: 1.
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
summary: Health check endpoint
|
|
167
|
-
description: Returns the health status of the API
|
|
168
|
-
responses:
|
|
169
|
-
'200':
|
|
170
|
-
description: API is healthy
|
|
171
|
-
content:
|
|
172
|
-
application/json:
|
|
173
|
-
schema:
|
|
174
|
-
type: object
|
|
175
|
-
properties:
|
|
176
|
-
status:
|
|
177
|
-
type: string
|
|
178
|
-
example: "healthy"
|
|
179
|
-
timestamp:
|
|
180
|
-
type: string
|
|
181
|
-
format: date-time
|
|
182
|
-
|
|
183
|
-
# Add your API endpoints here
|
|
184
|
-
/users:
|
|
185
|
-
get:
|
|
186
|
-
summary: Get users
|
|
187
|
-
description: Retrieve a list of users
|
|
188
|
-
parameters:
|
|
189
|
-
- name: limit
|
|
190
|
-
in: query
|
|
191
|
-
schema:
|
|
192
|
-
type: integer
|
|
193
|
-
default: 10
|
|
194
|
-
- name: offset
|
|
195
|
-
in: query
|
|
196
|
-
schema:
|
|
197
|
-
type: integer
|
|
198
|
-
default: 0
|
|
199
|
-
responses:
|
|
200
|
-
'200':
|
|
201
|
-
description: List of users
|
|
202
|
-
content:
|
|
203
|
-
application/json:
|
|
204
|
-
schema:
|
|
205
|
-
type: object
|
|
206
|
-
properties:
|
|
207
|
-
users:
|
|
208
|
-
type: array
|
|
209
|
-
items:
|
|
210
|
-
$ref: '#/components/schemas/User'
|
|
211
|
-
total:
|
|
212
|
-
type: integer
|
|
213
|
-
|
|
214
|
-
components:
|
|
215
|
-
schemas:
|
|
216
|
-
User:
|
|
217
|
-
type: object
|
|
218
|
-
required:
|
|
219
|
-
- id
|
|
220
|
-
- email
|
|
221
|
-
properties:
|
|
222
|
-
id:
|
|
223
|
-
type: string
|
|
224
|
-
format: uuid
|
|
225
|
-
email:
|
|
226
|
-
type: string
|
|
227
|
-
format: email
|
|
228
|
-
name:
|
|
229
|
-
type: string
|
|
230
|
-
created_at:
|
|
231
|
-
type: string
|
|
232
|
-
format: date-time
|
|
233
|
-
|
|
234
|
-
Error:
|
|
235
|
-
type: object
|
|
236
|
-
required:
|
|
237
|
-
- message
|
|
238
|
-
- code
|
|
239
|
-
properties:
|
|
240
|
-
message:
|
|
241
|
-
type: string
|
|
242
|
-
code:
|
|
243
|
-
type: string
|
|
244
|
-
details:
|
|
245
|
-
type: object
|
|
246
|
-
|
|
247
|
-
securitySchemes:
|
|
248
|
-
BearerAuth:
|
|
249
|
-
type: http
|
|
250
|
-
scheme: bearer
|
|
251
|
-
bearerFormat: JWT
|
|
252
|
-
|
|
253
|
-
security:
|
|
254
|
-
- BearerAuth: []
|
|
255
|
-
|
|
84
|
+
version: 1.1.1
|
|
85
|
+
`;
|
|
86
|
+
const rendered = this.templateEngine.renderFromString(content, context);
|
|
87
|
+
(0, fs_1.writeFileSync)((0, path_1.join)(specsDir, 'api.yaml'), rendered);
|
|
88
|
+
}
|
|
89
|
+
async generateTasksMd(specsDir, context) {
|
|
90
|
+
const content = `---
|
|
91
|
+
title: Tasks
|
|
92
|
+
project: {{projectName}}
|
|
93
|
+
language: {{language}}
|
|
94
|
+
framework: {{framework}}
|
|
95
|
+
lastUpdated: {{currentDate}}
|
|
96
|
+
sourceOfTruth: project/project.yaml
|
|
256
97
|
---
|
|
257
|
-
# Data Models and Schemas
|
|
258
98
|
|
|
259
|
-
|
|
99
|
+
# {{projectName}} Task Management
|
|
260
100
|
|
|
261
|
-
|
|
262
|
-
\`\`\`sql
|
|
263
|
-
CREATE TABLE users (
|
|
264
|
-
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
|
265
|
-
email VARCHAR(255) UNIQUE NOT NULL,
|
|
266
|
-
name VARCHAR(255),
|
|
267
|
-
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
|
268
|
-
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
|
|
269
|
-
);
|
|
270
|
-
\`\`\`
|
|
101
|
+
## Project Status: 🟡 In Progress
|
|
271
102
|
|
|
272
|
-
##
|
|
103
|
+
## Current Sprint
|
|
104
|
+
- [ ] Setup project foundation
|
|
105
|
+
- [ ] Implement core features
|
|
273
106
|
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
"timestamp": "2024-01-01T00:00:00Z",
|
|
279
|
-
"payload": {
|
|
280
|
-
"user_id": "uuid",
|
|
281
|
-
"email": "user@example.com"
|
|
282
|
-
}
|
|
283
|
-
}
|
|
284
|
-
\`\`\`
|
|
107
|
+
## Cross-References
|
|
108
|
+
- Roadmap: ./roadmap.md
|
|
109
|
+
- Requirements: ../project/requirements.md
|
|
110
|
+
- Project config: ../project/project.yaml
|
|
285
111
|
|
|
286
112
|
---
|
|
287
113
|
*Last updated: {{currentDate}}*`;
|
|
288
114
|
const rendered = this.templateEngine.renderFromString(content, context);
|
|
289
|
-
(0, fs_1.writeFileSync)((0, path_1.join)(specsDir, '
|
|
115
|
+
(0, fs_1.writeFileSync)((0, path_1.join)(specsDir, 'tasks.md'), rendered);
|
|
290
116
|
}
|
|
291
|
-
async
|
|
292
|
-
const content =
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
- **Scope**: Individual functions, classes, and modules
|
|
301
|
-
- **Framework**: ${this.getTestFramework(context.language)}
|
|
302
|
-
- **Coverage Target**: >90%
|
|
303
|
-
- **Location**: Alongside source code in \`__tests__\` directories
|
|
304
|
-
|
|
305
|
-
### Integration Tests (20%)
|
|
306
|
-
- **Scope**: Component interactions and external dependencies
|
|
307
|
-
- **Framework**: ${this.getIntegrationTestFramework(context.language)}
|
|
308
|
-
- **Coverage**: Critical user paths and API endpoints
|
|
309
|
-
- **Location**: \`tests/integration/\`
|
|
310
|
-
|
|
311
|
-
### End-to-End Tests (10%)
|
|
312
|
-
- **Scope**: Complete user workflows
|
|
313
|
-
- **Framework**: ${this.getE2ETestFramework(context.language, context.framework)}
|
|
314
|
-
- **Coverage**: Critical business scenarios
|
|
315
|
-
- **Location**: \`tests/e2e/\`
|
|
316
|
-
|
|
317
|
-
## Test Categories
|
|
318
|
-
|
|
319
|
-
### Functional Testing
|
|
320
|
-
- ✅ **Feature tests**: Core functionality works as expected
|
|
321
|
-
- ✅ **API tests**: All endpoints return correct responses
|
|
322
|
-
- ✅ **Data validation**: Input validation and sanitization
|
|
323
|
-
- ✅ **Error handling**: Proper error responses and logging
|
|
324
|
-
|
|
325
|
-
### Non-Functional Testing
|
|
326
|
-
- ✅ **Performance**: Response times and throughput
|
|
327
|
-
- ✅ **Security**: Authentication, authorization, and input validation
|
|
328
|
-
- ✅ **Load**: System behavior under expected load
|
|
329
|
-
- ✅ **Stress**: System behavior under extreme conditions
|
|
330
|
-
|
|
331
|
-
## Test Data Management
|
|
332
|
-
- **Test fixtures**: Predefined data sets for consistent testing
|
|
333
|
-
- **Data factories**: Generate test data programmatically
|
|
334
|
-
- **Database seeding**: Set up test databases with known state
|
|
335
|
-
- **Cleanup**: Ensure tests don't interfere with each other
|
|
336
|
-
|
|
337
|
-
## Continuous Integration
|
|
338
|
-
|
|
339
|
-
### Pre-commit Hooks
|
|
340
|
-
- Run linting and basic tests
|
|
341
|
-
- Ensure code quality standards
|
|
342
|
-
|
|
343
|
-
### CI Pipeline
|
|
344
|
-
1. **Static Analysis**: Code quality and security scanning
|
|
345
|
-
2. **Unit Tests**: Fast feedback on individual components
|
|
346
|
-
3. **Integration Tests**: Verify component interactions
|
|
347
|
-
4. **E2E Tests**: Validate complete user workflows
|
|
348
|
-
5. **Performance Tests**: Monitor regression in performance
|
|
349
|
-
|
|
350
|
-
## Test Environment
|
|
351
|
-
|
|
352
|
-
### Local Development
|
|
353
|
-
- Docker containers for dependencies
|
|
354
|
-
- Test database separate from development
|
|
355
|
-
- Mock external services
|
|
356
|
-
|
|
357
|
-
### CI/CD Environment
|
|
358
|
-
- Isolated test databases
|
|
359
|
-
- Service mocks and stubs
|
|
360
|
-
- Parallel test execution
|
|
361
|
-
|
|
362
|
-
## Acceptance Criteria
|
|
117
|
+
async generateRoadmapMd(specsDir, context) {
|
|
118
|
+
const content = `---
|
|
119
|
+
title: Roadmap
|
|
120
|
+
project: {{projectName}}
|
|
121
|
+
language: {{language}}
|
|
122
|
+
framework: {{framework}}
|
|
123
|
+
lastUpdated: {{currentDate}}
|
|
124
|
+
sourceOfTruth: project/project.yaml
|
|
125
|
+
---
|
|
363
126
|
|
|
364
|
-
|
|
365
|
-
- [ ] Unit tests covering happy path and edge cases
|
|
366
|
-
- [ ] Integration tests for external dependencies
|
|
367
|
-
- [ ] API tests for all endpoints
|
|
368
|
-
- [ ] Error scenario tests
|
|
369
|
-
- [ ] Performance benchmarks
|
|
127
|
+
# {{projectName}} Development Roadmap
|
|
370
128
|
|
|
371
|
-
##
|
|
129
|
+
## Project Phases
|
|
372
130
|
|
|
373
|
-
###
|
|
374
|
-
- [
|
|
375
|
-
- [ ]
|
|
376
|
-
- [ ] Code coverage meets threshold
|
|
377
|
-
- [ ] Performance tests within acceptable limits
|
|
378
|
-
- [ ] Security tests pass
|
|
131
|
+
### Phase 1: Foundation
|
|
132
|
+
- [x] Project initialization
|
|
133
|
+
- [ ] Core development
|
|
379
134
|
|
|
380
|
-
|
|
381
|
-
-
|
|
382
|
-
-
|
|
383
|
-
- Regular review of test coverage
|
|
384
|
-
- Performance trend analysis
|
|
135
|
+
## Cross-References
|
|
136
|
+
- Tasks: ./tasks.md
|
|
137
|
+
- Requirements: ../project/requirements.md
|
|
385
138
|
|
|
386
139
|
---
|
|
387
140
|
*Last updated: {{currentDate}}*`;
|
|
388
141
|
const rendered = this.templateEngine.renderFromString(content, context);
|
|
389
|
-
(0, fs_1.writeFileSync)((0, path_1.join)(specsDir, '
|
|
390
|
-
}
|
|
391
|
-
getTestFramework(language) {
|
|
392
|
-
const frameworks = {
|
|
393
|
-
typescript: 'Jest with ts-jest',
|
|
394
|
-
python: 'pytest',
|
|
395
|
-
java: 'JUnit 5'
|
|
396
|
-
};
|
|
397
|
-
return frameworks[language] || 'Framework specific to language';
|
|
142
|
+
(0, fs_1.writeFileSync)((0, path_1.join)(specsDir, 'roadmap.md'), rendered);
|
|
398
143
|
}
|
|
399
|
-
|
|
400
|
-
const
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
if (framework === 'react' || framework === 'next')
|
|
409
|
-
return 'Playwright or Cypress';
|
|
410
|
-
if (language === 'python')
|
|
411
|
-
return 'Selenium with pytest';
|
|
412
|
-
if (language === 'java')
|
|
413
|
-
return 'Selenium WebDriver';
|
|
414
|
-
return 'Playwright or Selenium';
|
|
415
|
-
}
|
|
416
|
-
async generateTasksMd(specsDir, context) {
|
|
417
|
-
const content = `# {{projectName}} Task Management
|
|
418
|
-
|
|
419
|
-
## Project Status: 🟡 In Progress
|
|
420
|
-
|
|
421
|
-
## Current Sprint
|
|
422
|
-
|
|
423
|
-
### In Progress
|
|
424
|
-
- [ ] **Setup project foundation**
|
|
425
|
-
- Initialize ${context.language} project structure
|
|
426
|
-
- Configure development environment
|
|
427
|
-
- Set up basic CI/CD pipeline
|
|
428
|
-
|
|
429
|
-
### Ready for Development
|
|
430
|
-
- [ ] **Implement core features**
|
|
431
|
-
- Define main application logic
|
|
432
|
-
- Set up data models and schemas
|
|
433
|
-
- Create API endpoints (if applicable)
|
|
434
|
-
|
|
435
|
-
### Blocked
|
|
436
|
-
- [ ] **External integrations**
|
|
437
|
-
- Waiting for third-party API access
|
|
438
|
-
- Pending security review approval
|
|
439
|
-
|
|
440
|
-
## Backlog
|
|
441
|
-
|
|
442
|
-
### Phase 1: Foundation
|
|
443
|
-
- [ ] Project setup and configuration
|
|
444
|
-
- [ ] Development environment setup
|
|
445
|
-
- [ ] Basic project structure
|
|
446
|
-
- [ ] Initial documentation
|
|
447
|
-
|
|
448
|
-
### Phase 2: Core Development
|
|
449
|
-
- [ ] Implement primary features
|
|
450
|
-
- [ ] Database setup and migrations
|
|
451
|
-
- [ ] API development
|
|
452
|
-
- [ ] User interface (if applicable)
|
|
453
|
-
|
|
454
|
-
### Phase 3: Testing & Quality
|
|
455
|
-
- [ ] Unit test implementation
|
|
456
|
-
- [ ] Integration testing
|
|
457
|
-
- [ ] Performance optimization
|
|
458
|
-
- [ ] Security review
|
|
459
|
-
|
|
460
|
-
### Phase 4: Deployment
|
|
461
|
-
- [ ] Production environment setup
|
|
462
|
-
- [ ] Deployment pipeline
|
|
463
|
-
- [ ] Monitoring and logging
|
|
464
|
-
- [ ] Documentation finalization
|
|
465
|
-
|
|
466
|
-
## Completed
|
|
467
|
-
|
|
468
|
-
### ✅ Project Initialization
|
|
469
|
-
- [x] Created project specifications
|
|
470
|
-
- [x] Set up ${context.language} development environment
|
|
471
|
-
- [x] Initial .specs/ structure created
|
|
472
|
-
- [x] Basic project configuration
|
|
144
|
+
async generateDocsMd(specsDir, context) {
|
|
145
|
+
const content = `---
|
|
146
|
+
title: Development Docs
|
|
147
|
+
project: {{projectName}}
|
|
148
|
+
language: {{language}}
|
|
149
|
+
framework: {{framework}}
|
|
150
|
+
lastUpdated: {{currentDate}}
|
|
151
|
+
sourceOfTruth: project/project.yaml
|
|
152
|
+
---
|
|
473
153
|
|
|
474
|
-
|
|
154
|
+
# {{projectName}} Development Documentation
|
|
475
155
|
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
- Update this file regularly during development
|
|
479
|
-
- Use proper branch naming: feature/task-description
|
|
480
|
-
- Ensure all tasks have acceptance criteria
|
|
156
|
+
## Getting Started
|
|
157
|
+
[TODO: Add development setup instructions]
|
|
481
158
|
|
|
482
|
-
|
|
483
|
-
-
|
|
484
|
-
-
|
|
485
|
-
-
|
|
486
|
-
-
|
|
159
|
+
## Cross-References
|
|
160
|
+
- Context: ./context.md
|
|
161
|
+
- Roadmap: ../planning/roadmap.md
|
|
162
|
+
- Tasks: ../planning/tasks.md
|
|
163
|
+
- Project config: ../project/project.yaml
|
|
487
164
|
|
|
488
165
|
---
|
|
489
166
|
*Last updated: {{currentDate}}*`;
|
|
490
167
|
const rendered = this.templateEngine.renderFromString(content, context);
|
|
491
|
-
(0, fs_1.writeFileSync)((0, path_1.join)(specsDir, '
|
|
168
|
+
(0, fs_1.writeFileSync)((0, path_1.join)(specsDir, 'docs.md'), rendered);
|
|
492
169
|
}
|
|
493
170
|
async generateContextMd(specsDir, context) {
|
|
494
|
-
const content =
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
### Architecture Patterns
|
|
504
|
-
- **Primary Pattern**: [To be determined based on requirements]
|
|
505
|
-
- **Data Flow**: [To be defined during architecture phase]
|
|
506
|
-
- **State Management**: [Framework-specific approach]
|
|
507
|
-
|
|
508
|
-
### Development Patterns
|
|
509
|
-
|
|
510
|
-
#### Code Organization
|
|
511
|
-
- Follow ${context.language} best practices
|
|
512
|
-
- Maintain clear separation of concerns
|
|
513
|
-
- Use dependency injection where applicable
|
|
514
|
-
- Implement proper error handling
|
|
515
|
-
|
|
516
|
-
#### Testing Strategy
|
|
517
|
-
- Test-driven development (TDD) preferred
|
|
518
|
-
- Comprehensive test coverage (>90%)
|
|
519
|
-
- Mock external dependencies
|
|
520
|
-
- Use factories for test data
|
|
521
|
-
|
|
522
|
-
## Common Issues and Solutions
|
|
523
|
-
|
|
524
|
-
### Issue: [Placeholder - will be filled during development]
|
|
525
|
-
- **Problem**: [Description of the issue]
|
|
526
|
-
- **Solution**: [How it was resolved]
|
|
527
|
-
- **Prevention**: [How to avoid in future]
|
|
528
|
-
|
|
529
|
-
### Issue: Development Environment Setup
|
|
530
|
-
- **Problem**: Inconsistent development environments across team
|
|
531
|
-
- **Solution**: Use Docker containers and/or detailed setup documentation
|
|
532
|
-
- **Prevention**: Automated environment setup scripts
|
|
533
|
-
|
|
534
|
-
## Lessons Learned
|
|
535
|
-
|
|
536
|
-
### Development Process
|
|
537
|
-
- Start with specifications before coding
|
|
538
|
-
- Regular validation of requirements
|
|
539
|
-
- Maintain up-to-date documentation
|
|
540
|
-
- **MANDATE**: Always update prompts.md with AI interactions
|
|
541
|
-
|
|
542
|
-
### Technical Learnings
|
|
543
|
-
- [To be populated during development]
|
|
544
|
-
- Focus on maintainable, readable code
|
|
545
|
-
- Proper error handling from the beginning
|
|
546
|
-
- Performance considerations early in design
|
|
547
|
-
- **MANDATE**: Update .specs/ folder files with every development milestone and code change
|
|
548
|
-
|
|
549
|
-
## Team Knowledge
|
|
550
|
-
|
|
551
|
-
### Onboarding Guide
|
|
552
|
-
1. Review all .specs/ files
|
|
553
|
-
2. Set up local development environment
|
|
554
|
-
3. Run existing tests to verify setup
|
|
555
|
-
4. Review coding standards and practices
|
|
556
|
-
5. Understand deployment process
|
|
557
|
-
|
|
558
|
-
### Contact Information
|
|
559
|
-
- **Project Lead**: {{author}}
|
|
560
|
-
- **Technical Lead**: [To be assigned]
|
|
561
|
-
- **Product Owner**: [To be assigned]
|
|
562
|
-
|
|
563
|
-
## External Resources
|
|
564
|
-
|
|
565
|
-
### Documentation Links
|
|
566
|
-
- [Framework documentation]
|
|
567
|
-
- [Language-specific resources]
|
|
568
|
-
- [Third-party service documentation]
|
|
171
|
+
const content = `---
|
|
172
|
+
title: Development Context
|
|
173
|
+
project: {{projectName}}
|
|
174
|
+
language: {{language}}
|
|
175
|
+
framework: {{framework}}
|
|
176
|
+
lastUpdated: {{currentDate}}
|
|
177
|
+
sourceOfTruth: project/project.yaml
|
|
178
|
+
---
|
|
569
179
|
|
|
570
|
-
|
|
571
|
-
- **Version Control**: Git
|
|
572
|
-
- **CI/CD**: [To be configured]
|
|
573
|
-
- **Monitoring**: [To be set up]
|
|
574
|
-
- **Deployment**: [To be configured]
|
|
180
|
+
# {{projectName}} Development Context
|
|
575
181
|
|
|
576
|
-
##
|
|
182
|
+
## Project Memory
|
|
183
|
+
[TODO: Add project context and decisions]
|
|
577
184
|
|
|
578
|
-
|
|
579
|
-
-
|
|
580
|
-
-
|
|
581
|
-
-
|
|
185
|
+
## Cross-References
|
|
186
|
+
- Docs: ./docs.md
|
|
187
|
+
- Roadmap: ../planning/roadmap.md
|
|
188
|
+
- Project config: ../project/project.yaml
|
|
582
189
|
|
|
583
190
|
---
|
|
584
191
|
*Last updated: {{currentDate}}*`;
|
|
585
192
|
const rendered = this.templateEngine.renderFromString(content, context);
|
|
586
193
|
(0, fs_1.writeFileSync)((0, path_1.join)(specsDir, 'context.md'), rendered);
|
|
587
194
|
}
|
|
588
|
-
async
|
|
589
|
-
const content =
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
## Latest Entries
|
|
597
|
-
|
|
598
|
-
### Project Initialization ({{currentDate}})
|
|
599
|
-
|
|
600
|
-
#### Prompt: Initial Project Setup
|
|
601
|
-
**Prompt**: "Create a new ${context.language} project${context.framework ? ` using ${context.framework}` : ''} with specification-driven development structure"
|
|
602
|
-
|
|
603
|
-
**Context**: Starting new project with SpecPilot SDD CLI tool
|
|
604
|
-
|
|
605
|
-
**Response**:
|
|
606
|
-
- Generated complete .specs/ directory structure
|
|
607
|
-
- Created 8 core specification files
|
|
608
|
-
- Set up ${context.language} project foundation
|
|
609
|
-
- Implemented mandate for prompt tracking
|
|
610
|
-
|
|
611
|
-
**Files Modified**: All .specs/ files created
|
|
612
|
-
|
|
613
|
-
**Next Actions**: Begin development according to requirements.md
|
|
614
|
-
|
|
615
|
-
---
|
|
616
|
-
|
|
617
|
-
## Development Sessions
|
|
618
|
-
|
|
619
|
-
### Session 1: Project Foundation
|
|
620
|
-
**Date**: {{currentDate}}
|
|
621
|
-
**Duration**: [To be filled]
|
|
622
|
-
**Participants**: {{author}}, AI Assistant
|
|
623
|
-
|
|
624
|
-
#### Prompts and Responses
|
|
625
|
-
|
|
626
|
-
1. **Setup Request**
|
|
627
|
-
- **Prompt**: "Initialize {{projectName}} with ${context.language}"
|
|
628
|
-
- **Response**: Created project structure and specifications
|
|
629
|
-
- **Outcome**: Foundation established
|
|
630
|
-
|
|
631
|
-
#### Decisions Made
|
|
632
|
-
- Use specification-driven development approach
|
|
633
|
-
- Implement simplified .specs/ structure
|
|
634
|
-
- Enforce prompt tracking mandate
|
|
635
|
-
|
|
636
|
-
#### Issues Encountered
|
|
637
|
-
- None during initialization
|
|
638
|
-
|
|
195
|
+
async generateProjectPlanMd(specsDir, context) {
|
|
196
|
+
const content = `---
|
|
197
|
+
title: Project Plan
|
|
198
|
+
project: {{projectName}}
|
|
199
|
+
language: {{language}}
|
|
200
|
+
framework: {{framework}}
|
|
201
|
+
lastUpdated: {{currentDate}}
|
|
202
|
+
sourceOfTruth: project/project.yaml
|
|
639
203
|
---
|
|
640
204
|
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
### Session [N]: [Session Title]
|
|
644
|
-
**Date**: [YYYY-MM-DD]
|
|
645
|
-
**Duration**: [Time spent]
|
|
646
|
-
**Participants**: [Team members, AI interactions]
|
|
205
|
+
# {{projectName}} Project Plan
|
|
647
206
|
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
1. **[Prompt Category]**
|
|
651
|
-
- **Prompt**: "[Exact prompt text]"
|
|
652
|
-
- **Context**: "[Why this prompt was needed]"
|
|
653
|
-
- **Response**: "[Summary of AI response]"
|
|
654
|
-
- **Code Generated**: "[File paths and brief description]"
|
|
655
|
-
- **Outcome**: "[Result of the interaction]"
|
|
656
|
-
|
|
657
|
-
#### Decisions Made
|
|
658
|
-
- [List any architectural or design decisions]
|
|
659
|
-
- [Include rationale for each decision]
|
|
660
|
-
|
|
661
|
-
#### Issues Encountered
|
|
662
|
-
- [Any problems that came up]
|
|
663
|
-
- [Solutions implemented]
|
|
664
|
-
|
|
665
|
-
#### Files Modified
|
|
666
|
-
- [List of files changed]
|
|
667
|
-
- [Brief description of changes]
|
|
207
|
+
## Project Overview
|
|
208
|
+
[TODO: Add project planning details]
|
|
668
209
|
|
|
669
|
-
|
|
670
|
-
-
|
|
671
|
-
-
|
|
210
|
+
## Cross-References
|
|
211
|
+
- Roadmap: ../planning/roadmap.md
|
|
212
|
+
- Tasks: ../planning/tasks.md
|
|
672
213
|
|
|
673
214
|
---
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
### 🧪 Testing
|
|
688
|
-
- Test creation
|
|
689
|
-
- Test strategy discussions
|
|
690
|
-
- Bug investigations
|
|
691
|
-
|
|
692
|
-
### 📚 Documentation
|
|
693
|
-
- Documentation updates
|
|
694
|
-
- API documentation
|
|
695
|
-
- User guides
|
|
696
|
-
|
|
697
|
-
### 🚀 Deployment
|
|
698
|
-
- CI/CD setup
|
|
699
|
-
- Production deployments
|
|
700
|
-
- Infrastructure changes
|
|
701
|
-
|
|
702
|
-
### 🐛 Debugging
|
|
703
|
-
- Problem investigation
|
|
704
|
-
- Error resolution
|
|
705
|
-
- Performance issues
|
|
706
|
-
|
|
215
|
+
*Last updated: {{currentDate}}*`;
|
|
216
|
+
const rendered = this.templateEngine.renderFromString(content, context);
|
|
217
|
+
(0, fs_1.writeFileSync)((0, path_1.join)(specsDir, 'project-plan.md'), rendered);
|
|
218
|
+
}
|
|
219
|
+
async generatePromptsMd(specsDir, context) {
|
|
220
|
+
const content = `---
|
|
221
|
+
title: Prompts Log
|
|
222
|
+
project: {{projectName}}
|
|
223
|
+
language: {{language}}
|
|
224
|
+
framework: {{framework}}
|
|
225
|
+
lastUpdated: {{currentDate}}
|
|
226
|
+
sourceOfTruth: project/project.yaml
|
|
707
227
|
---
|
|
708
228
|
|
|
709
|
-
|
|
229
|
+
# Development Prompts Log
|
|
710
230
|
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
2. **Include full context**: Not just the prompt, but why it was needed
|
|
714
|
-
3. **Record outcomes**: What was actually implemented or decided
|
|
715
|
-
4. **Link to code changes**: Reference specific files and commits
|
|
716
|
-
5. **Maintain chronological order**: Latest entries at the top
|
|
231
|
+
## Overview
|
|
232
|
+
This file (prompts.md) contains ALL AI interactions for {{projectName}}. Update .specs/prompts.md with every AI interaction.
|
|
717
233
|
|
|
718
|
-
|
|
719
|
-
1. **Remind about this file**: Always mention updating prompts.md
|
|
720
|
-
2. **Provide structured responses**: Use the template format
|
|
721
|
-
3. **Include relevant context**: Reference previous decisions when applicable
|
|
722
|
-
4. **Track dependencies**: Note when prompts relate to previous work
|
|
234
|
+
**🚨 MANDATE**: Update with every AI interaction.
|
|
723
235
|
|
|
724
|
-
|
|
725
|
-
-
|
|
726
|
-
-
|
|
727
|
-
- ✅ Full context provided for each prompt
|
|
728
|
-
- ✅ Outcomes and decisions recorded
|
|
729
|
-
- ✅ Files and changes referenced
|
|
236
|
+
## Cross-References
|
|
237
|
+
- Context: ./context.md
|
|
238
|
+
- Project config: ../project/project.yaml
|
|
730
239
|
|
|
731
240
|
---
|
|
732
241
|
*Last updated: {{currentDate}}*`;
|
|
733
242
|
const rendered = this.templateEngine.renderFromString(content, context);
|
|
734
243
|
(0, fs_1.writeFileSync)((0, path_1.join)(specsDir, 'prompts.md'), rendered);
|
|
735
244
|
}
|
|
736
|
-
async
|
|
737
|
-
const content =
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
${this.getPrerequisites(context.language, context.framework)}
|
|
746
|
-
|
|
747
|
-
### Installation
|
|
748
|
-
\`\`\`bash
|
|
749
|
-
# Clone the repository
|
|
750
|
-
git clone [repository-url]
|
|
751
|
-
cd {{projectName}}
|
|
752
|
-
|
|
753
|
-
# Install dependencies
|
|
754
|
-
${this.getInstallCommand(context.language)}
|
|
755
|
-
|
|
756
|
-
# Set up environment
|
|
757
|
-
${this.getEnvironmentSetup(context.language)}
|
|
758
|
-
\`\`\`
|
|
759
|
-
|
|
760
|
-
### Development Workflow
|
|
761
|
-
|
|
762
|
-
#### 1. Specification Review
|
|
763
|
-
- Review .specs/requirements.md for current requirements
|
|
764
|
-
- Check .specs/architecture.md for technical decisions
|
|
765
|
-
- Understand API contracts in .specs/api.yaml
|
|
766
|
-
|
|
767
|
-
#### 2. Development Process
|
|
768
|
-
1. Create feature branch: \`git checkout -b feature/description\`
|
|
769
|
-
2. Update specifications if needed
|
|
770
|
-
3. Implement feature following TDD approach
|
|
771
|
-
4. Update tests and documentation
|
|
772
|
-
5. Submit pull request with specification updates
|
|
773
|
-
|
|
774
|
-
#### 3. Code Standards
|
|
775
|
-
${this.getCodeStandards(context.language)}
|
|
776
|
-
|
|
777
|
-
#### 4. Testing Requirements
|
|
778
|
-
- Unit tests: >90% coverage
|
|
779
|
-
- Integration tests for external dependencies
|
|
780
|
-
- End-to-end tests for critical paths
|
|
781
|
-
- Performance benchmarks for key operations
|
|
782
|
-
|
|
783
|
-
### 🚨 MANDATORY: AI Interaction Tracking
|
|
784
|
-
6. **MANDATE: Track ALL AI Prompts**: Update .specs/prompts.md with every AI interaction, including timestamps and context
|
|
785
|
-
- **Required for all team members**
|
|
786
|
-
- **Include full prompt and response context**
|
|
787
|
-
- **Maintain chronological order**
|
|
788
|
-
- **Link to code changes and decisions**
|
|
789
|
-
|
|
790
|
-
### Spec Update Mandate & Enforcement
|
|
791
|
-
|
|
792
|
-
#### **MANDATE: .specs Folder Updates**
|
|
793
|
-
All developers MUST update relevant \`.specs/\` files before each commit. This is non-negotiable for maintaining specification-driven development integrity.
|
|
794
|
-
|
|
795
|
-
#### **Pre-Commit Spec Update Checklist**
|
|
796
|
-
Before each commit, verify and update:
|
|
797
|
-
|
|
798
|
-
- [ ] **\`tasks.md\`**: Move completed tasks, update progress status
|
|
799
|
-
- [ ] **\`context.md\`**: Add lessons learned, important decisions, challenges overcome
|
|
800
|
-
- [ ] **\`docs.md\`**: Update procedures if development processes changed
|
|
801
|
-
- [ ] **\`prompts.md\`**: Log all AI interactions (automated, but verify completeness)
|
|
802
|
-
- [ ] **\`requirements.md\`**: Update if new features or changes affect requirements
|
|
803
|
-
- [ ] **\`architecture.md\`**: Update if code structure or design patterns changed
|
|
804
|
-
- [ ] **\`api.yaml\`**: Update if CLI interface or commands modified
|
|
805
|
-
- [ ] **\`tests.md\`**: Update if testing approach or coverage changed
|
|
806
|
-
- [ ] **File Metadata**: Update footer sections (dates, counts, status summaries) in all modified files
|
|
807
|
-
|
|
808
|
-
#### **Enforcement Mechanisms**
|
|
809
|
-
|
|
810
|
-
##### **Pre-Commit Hook**
|
|
811
|
-
A git hook script enforces spec updates:
|
|
812
|
-
|
|
813
|
-
\`\`\`bash
|
|
814
|
-
#!/bin/bash
|
|
815
|
-
# .git/hooks/pre-commit
|
|
816
|
-
|
|
817
|
-
echo "🔍 Checking .specs/ folder updates..."
|
|
818
|
-
|
|
819
|
-
# Check if any .specs files were modified
|
|
820
|
-
SPECS_CHANGED=\$(git diff --cached --name-only | grep "^\.specs/" | wc -l)
|
|
821
|
-
|
|
822
|
-
if [ "\$SPECS_CHANGED" -eq "0" ]; then
|
|
823
|
-
echo "⚠️ WARNING: No .specs/ files changed in this commit"
|
|
824
|
-
echo " Consider updating relevant specification files"
|
|
825
|
-
echo " Press Ctrl+C to abort and update specs, or Enter to continue"
|
|
826
|
-
read -p ""
|
|
827
|
-
fi
|
|
828
|
-
|
|
829
|
-
echo "✅ Pre-commit check complete"
|
|
830
|
-
\`\`\`
|
|
831
|
-
|
|
832
|
-
##### **Spec Update Template**
|
|
833
|
-
Use this template when updating specs:
|
|
834
|
-
|
|
835
|
-
\`\`\`markdown
|
|
836
|
-
## Spec Update: [Brief Description of Changes]
|
|
837
|
-
|
|
838
|
-
### Files Updated
|
|
839
|
-
- [ ] tasks.md: [What changed]
|
|
840
|
-
- [ ] context.md: [Decisions/learnings added]
|
|
841
|
-
- [ ] [other files]: [Changes made]
|
|
842
|
-
|
|
843
|
-
### Context
|
|
844
|
-
[Why these updates were needed]
|
|
845
|
-
|
|
846
|
-
### Impact
|
|
847
|
-
[How this affects the project]
|
|
848
|
-
\`\`\`
|
|
849
|
-
|
|
850
|
-
##### **CI/CD Integration**
|
|
851
|
-
Future enhancement: Add automated checks in CI pipeline to validate spec completeness.
|
|
852
|
-
|
|
853
|
-
#### **Violation Consequences**
|
|
854
|
-
|
|
855
|
-
- Code reviews will check for spec updates
|
|
856
|
-
- Incomplete specs may require commit amendments
|
|
857
|
-
- Repeated violations may affect contribution permissions
|
|
858
|
-
|
|
859
|
-
## Project Structure
|
|
860
|
-
|
|
861
|
-
\`\`\`
|
|
862
|
-
${this.getProjectStructure(context.language, context.framework)}
|
|
863
|
-
\`\`\`
|
|
864
|
-
|
|
865
|
-
## Available Scripts
|
|
866
|
-
|
|
867
|
-
${this.getAvailableScripts(context.language, context.framework)}
|
|
868
|
-
|
|
869
|
-
## Environment Configuration
|
|
870
|
-
|
|
871
|
-
### Development
|
|
872
|
-
\`\`\`env
|
|
873
|
-
NODE_ENV=development
|
|
874
|
-
DATABASE_URL=postgresql://localhost/{{lowercase projectName}}_dev
|
|
875
|
-
API_KEY=dev-api-key
|
|
876
|
-
LOG_LEVEL=debug
|
|
877
|
-
\`\`\`
|
|
878
|
-
|
|
879
|
-
### Production
|
|
880
|
-
\`\`\`env
|
|
881
|
-
NODE_ENV=production
|
|
882
|
-
DATABASE_URL=${this.getDatabaseUrl(context.language)}
|
|
883
|
-
API_KEY=prod-api-key
|
|
884
|
-
LOG_LEVEL=info
|
|
885
|
-
\`\`\`
|
|
886
|
-
|
|
887
|
-
## API Documentation
|
|
888
|
-
|
|
889
|
-
### Base URL
|
|
890
|
-
- **Development**: \`http://localhost:3000\`
|
|
891
|
-
- **Production**: \`https://api.{{lowercase projectName}}.com\`
|
|
892
|
-
|
|
893
|
-
### Authentication
|
|
894
|
-
${this.getAuthenticationDocs(context.framework)}
|
|
895
|
-
|
|
896
|
-
### Rate Limiting
|
|
897
|
-
- 100 requests per minute per IP
|
|
898
|
-
- 1000 requests per hour per authenticated user
|
|
899
|
-
|
|
900
|
-
## Database
|
|
901
|
-
|
|
902
|
-
### Migrations
|
|
903
|
-
\`\`\`bash
|
|
904
|
-
${this.getMigrationCommands(context.language, context.framework)}
|
|
905
|
-
\`\`\`
|
|
906
|
-
|
|
907
|
-
### Backup and Recovery
|
|
908
|
-
\`\`\`bash
|
|
909
|
-
${this.getBackupCommands(context.language)}
|
|
910
|
-
\`\`\`
|
|
911
|
-
|
|
912
|
-
## Deployment
|
|
913
|
-
|
|
914
|
-
### CI/CD Pipeline
|
|
915
|
-
1. **Code Quality**: Linting, type checking, security scanning
|
|
916
|
-
2. **Testing**: Unit, integration, and e2e tests
|
|
917
|
-
3. **Build**: Compile and package application
|
|
918
|
-
4. **Deploy**: Automated deployment to staging/production
|
|
919
|
-
|
|
920
|
-
### Production Deployment
|
|
921
|
-
\`\`\`bash
|
|
922
|
-
# Build for production
|
|
923
|
-
${this.getBuildCommand(context.language)}
|
|
924
|
-
|
|
925
|
-
# Deploy to production
|
|
926
|
-
${this.getDeployCommand(context.language)}
|
|
927
|
-
\`\`\`
|
|
928
|
-
|
|
929
|
-
### Monitoring and Logging
|
|
930
|
-
- **Application Logs**: Structured JSON logging
|
|
931
|
-
- **Error Tracking**: [Error tracking service]
|
|
932
|
-
- **Performance Monitoring**: [APM service]
|
|
933
|
-
- **Health Checks**: \`/api/health\` endpoint
|
|
934
|
-
|
|
935
|
-
## Troubleshooting
|
|
936
|
-
|
|
937
|
-
### Common Issues
|
|
938
|
-
|
|
939
|
-
#### Development Environment
|
|
940
|
-
**Issue**: Dependencies not installing
|
|
941
|
-
**Solution**:
|
|
942
|
-
\`\`\`bash
|
|
943
|
-
${this.getTroubleshootingCommands(context.language)}
|
|
944
|
-
\`\`\`
|
|
945
|
-
|
|
946
|
-
#### Database Connection
|
|
947
|
-
**Issue**: Cannot connect to database
|
|
948
|
-
**Solutions**:
|
|
949
|
-
- Verify database is running
|
|
950
|
-
- Check connection string in environment
|
|
951
|
-
- Ensure proper permissions
|
|
952
|
-
|
|
953
|
-
#### Build Failures
|
|
954
|
-
**Issue**: Build process fails
|
|
955
|
-
**Solutions**:
|
|
956
|
-
- Check for TypeScript/syntax errors
|
|
957
|
-
- Verify all dependencies are installed
|
|
958
|
-
- Clear build cache and rebuild
|
|
959
|
-
|
|
960
|
-
## AI Integration Guidelines
|
|
961
|
-
|
|
962
|
-
### Development with AI Assistants
|
|
963
|
-
- **MANDATE: Automatic prompt logging** - Log all AI interactions to .specs/prompts.md
|
|
964
|
-
- **MANDATE: Complete context inclusion** - Include full prompt and response
|
|
965
|
-
- **MANDATE: Chronological order** - Maintain timeline of all interactions
|
|
966
|
-
- **MANDATE: Full traceability** - Link prompts to specific development phases
|
|
967
|
-
|
|
968
|
-
### Best Practices
|
|
969
|
-
1. Provide clear context in prompts
|
|
970
|
-
2. Reference existing specifications
|
|
971
|
-
3. Ask for code that follows project standards
|
|
972
|
-
4. Request tests along with implementation
|
|
973
|
-
5. Always update documentation
|
|
974
|
-
|
|
975
|
-
## Team Collaboration
|
|
976
|
-
|
|
977
|
-
### Code Reviews
|
|
978
|
-
- All changes require peer review
|
|
979
|
-
- Focus on specification compliance
|
|
980
|
-
- Verify test coverage and quality
|
|
981
|
-
- Check for security vulnerabilities
|
|
982
|
-
|
|
983
|
-
### Communication
|
|
984
|
-
- Use project management tool for task tracking
|
|
985
|
-
- Update .specs/tasks.md regularly
|
|
986
|
-
- Document decisions in .specs/context.md
|
|
987
|
-
- Maintain .specs/prompts.md for AI interactions
|
|
245
|
+
async generateTestsMd(specsDir, context) {
|
|
246
|
+
const content = `---
|
|
247
|
+
title: Test Strategy
|
|
248
|
+
project: {{projectName}}
|
|
249
|
+
language: {{language}}
|
|
250
|
+
framework: {{framework}}
|
|
251
|
+
lastUpdated: {{currentDate}}
|
|
252
|
+
sourceOfTruth: project/project.yaml
|
|
253
|
+
---
|
|
988
254
|
|
|
989
|
-
|
|
255
|
+
# {{projectName}} Test Strategy
|
|
990
256
|
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
${context.framework ? `- [${context.framework} Documentation](${this.getFrameworkDocsUrl(context.framework)})` : ''}
|
|
994
|
-
- [Project API Documentation](./api.yaml)
|
|
257
|
+
## Overview
|
|
258
|
+
[TODO: Add testing strategy and approach]
|
|
995
259
|
|
|
996
|
-
|
|
997
|
-
-
|
|
998
|
-
-
|
|
999
|
-
- **Linting**: ${this.getLintingTools(context.language)}
|
|
1000
|
-
- **Version Control**: Git with conventional commits
|
|
260
|
+
## Cross-References
|
|
261
|
+
- Requirements: ../project/requirements.md
|
|
262
|
+
- Project config: ../project/project.yaml
|
|
1001
263
|
|
|
1002
264
|
---
|
|
1003
265
|
*Last updated: {{currentDate}}*`;
|
|
1004
266
|
const rendered = this.templateEngine.renderFromString(content, context);
|
|
1005
|
-
(0, fs_1.writeFileSync)((0, path_1.join)(specsDir, '
|
|
267
|
+
(0, fs_1.writeFileSync)((0, path_1.join)(specsDir, 'tests.md'), rendered);
|
|
1006
268
|
}
|
|
1007
269
|
async generateSpecUpdateTemplateMd(specsDir, context) {
|
|
1008
|
-
const content =
|
|
270
|
+
const content = `---
|
|
271
|
+
fileID: spec-update-template
|
|
272
|
+
lastUpdated: {{currentDate}}
|
|
273
|
+
version: 1.1.1
|
|
274
|
+
contributors: ["SpecPilot"]
|
|
275
|
+
relatedFiles:
|
|
276
|
+
- "project/project.yaml"
|
|
277
|
+
- "development/prompts.md"
|
|
278
|
+
---
|
|
1009
279
|
|
|
1010
|
-
|
|
280
|
+
# Spec Update Template
|
|
1011
281
|
|
|
1012
|
-
|
|
1013
|
-
|
|
282
|
+
## Purpose
|
|
283
|
+
This template provides a standardized format for updating specification files within the .specs folder structure.
|
|
1014
284
|
|
|
1015
|
-
|
|
1016
|
-
- [ ] \`tasks.md\`: [What changed - e.g., moved completed tasks, updated progress]
|
|
1017
|
-
- [ ] \`context.md\`: [Decisions/learnings added - e.g., lessons from implementation]
|
|
1018
|
-
- [ ] \`docs.md\`: [Procedure updates - e.g., new development workflow steps]
|
|
1019
|
-
- [ ] \`prompts.md\`: [AI interactions logged - e.g., architecture discussions]
|
|
1020
|
-
- [ ] \`requirements.md\`: [New/changed requirements - e.g., added feature specs]
|
|
1021
|
-
- [ ] \`architecture.md\`: [Design changes - e.g., new component structure]
|
|
1022
|
-
- [ ] \`api.yaml\`: [Interface changes - e.g., new CLI commands]
|
|
1023
|
-
- [ ] \`tests.md\`: [Testing updates - e.g., new test coverage requirements]
|
|
1024
|
-
- [ ] \`project.yaml\`: [Project config changes - e.g., new rules added]
|
|
285
|
+
## Instructions
|
|
1025
286
|
|
|
1026
|
-
###
|
|
1027
|
-
|
|
287
|
+
### 1. Update Front-matter
|
|
288
|
+
- Update \`lastUpdated\` field with current timestamp
|
|
289
|
+
- Increment \`version\` following semantic versioning
|
|
290
|
+
- Add your name to \`contributors\` array
|
|
291
|
+
- Update \`relatedFiles\` if dependencies change
|
|
1028
292
|
|
|
1029
|
-
###
|
|
1030
|
-
|
|
293
|
+
### 2. Document Changes
|
|
294
|
+
- Clearly describe what was modified and why
|
|
295
|
+
- Reference related tasks or issues
|
|
296
|
+
- Update cross-references to maintain consistency
|
|
1031
297
|
|
|
1032
|
-
###
|
|
1033
|
-
-
|
|
298
|
+
### 3. Validation
|
|
299
|
+
- Ensure YAML front-matter is valid
|
|
300
|
+
- Verify all cross-references use correct subfolder paths
|
|
301
|
+
- Check that version numbers are consistent across related files
|
|
1034
302
|
|
|
1035
|
-
|
|
1036
|
-
|
|
303
|
+
## Subfolder Structure
|
|
304
|
+
- \`project/\` - Core project configuration and requirements
|
|
305
|
+
- \`architecture/\` - System design and API specifications
|
|
306
|
+
- \`planning/\` - Development planning and roadmaps
|
|
307
|
+
- \`quality/\` - Testing strategies and quality assurance
|
|
308
|
+
- \`development/\` - Development logs and task tracking
|
|
1037
309
|
|
|
1038
310
|
---
|
|
1039
311
|
*Generated by SpecPilot on {{currentDate}}*`;
|
|
1040
312
|
const rendered = this.templateEngine.renderFromString(content, context);
|
|
1041
313
|
(0, fs_1.writeFileSync)((0, path_1.join)(specsDir, 'spec-update-template.md'), rendered);
|
|
1042
314
|
}
|
|
1043
|
-
getPrerequisites(language, framework) {
|
|
1044
|
-
if (language === 'typescript') {
|
|
1045
|
-
return `- Node.js 18+ LTS
|
|
1046
|
-
- npm or yarn package manager
|
|
1047
|
-
- Git for version control
|
|
1048
|
-
${framework === 'react' ? '- Modern web browser for development' : ''}`;
|
|
1049
|
-
}
|
|
1050
|
-
if (language === 'python') {
|
|
1051
|
-
return `- Python 3.9+
|
|
1052
|
-
- pip package manager
|
|
1053
|
-
- Virtual environment (venv or conda)
|
|
1054
|
-
- Git for version control`;
|
|
1055
|
-
}
|
|
1056
|
-
if (language === 'java') {
|
|
1057
|
-
return `- Java 17+ JDK
|
|
1058
|
-
- Maven 3.8+ or Gradle 7+
|
|
1059
|
-
- Git for version control
|
|
1060
|
-
- IDE (IntelliJ IDEA or Eclipse recommended)`;
|
|
1061
|
-
}
|
|
1062
|
-
return `- ${language} development environment
|
|
1063
|
-
- Package manager
|
|
1064
|
-
- Git for version control`;
|
|
1065
|
-
}
|
|
1066
|
-
getInstallCommand(language) {
|
|
1067
|
-
if (language === 'typescript')
|
|
1068
|
-
return 'npm install';
|
|
1069
|
-
if (language === 'python')
|
|
1070
|
-
return 'pip install -r requirements.txt';
|
|
1071
|
-
if (language === 'java')
|
|
1072
|
-
return 'mvn install';
|
|
1073
|
-
return '# Install dependencies';
|
|
1074
|
-
}
|
|
1075
|
-
getEnvironmentSetup(language) {
|
|
1076
|
-
if (language === 'typescript')
|
|
1077
|
-
return 'cp .env.example .env';
|
|
1078
|
-
if (language === 'python')
|
|
1079
|
-
return 'python -m venv venv && source venv/bin/activate';
|
|
1080
|
-
if (language === 'java')
|
|
1081
|
-
return '# Set JAVA_HOME if needed';
|
|
1082
|
-
return '# Set up environment variables';
|
|
1083
|
-
}
|
|
1084
|
-
getCodeStandards(language) {
|
|
1085
|
-
if (language === 'typescript') {
|
|
1086
|
-
return `- Use TypeScript strict mode
|
|
1087
|
-
- Follow ESLint configuration
|
|
1088
|
-
- Use Prettier for formatting
|
|
1089
|
-
- Prefer functional programming patterns
|
|
1090
|
-
- Comprehensive JSDoc comments`;
|
|
1091
|
-
}
|
|
1092
|
-
if (language === 'python') {
|
|
1093
|
-
return `- Follow PEP 8 style guide
|
|
1094
|
-
- Use type hints throughout
|
|
1095
|
-
- Docstrings for all functions/classes
|
|
1096
|
-
- Use Black for code formatting
|
|
1097
|
-
- Maximum line length: 88 characters`;
|
|
1098
|
-
}
|
|
1099
|
-
if (language === 'java') {
|
|
1100
|
-
return `- Follow Google Java Style Guide
|
|
1101
|
-
- Use Checkstyle for enforcement
|
|
1102
|
-
- Comprehensive Javadoc comments
|
|
1103
|
-
- Prefer composition over inheritance
|
|
1104
|
-
- Use modern Java features (17+)`;
|
|
1105
|
-
}
|
|
1106
|
-
return `- Follow ${language} best practices
|
|
1107
|
-
- Consistent code formatting
|
|
1108
|
-
- Comprehensive documentation`;
|
|
1109
|
-
}
|
|
1110
|
-
getProjectStructure(language, framework) {
|
|
1111
|
-
if (language === 'typescript' && framework === 'react') {
|
|
1112
|
-
return `├── src/
|
|
1113
|
-
│ ├── components/
|
|
1114
|
-
│ ├── hooks/
|
|
1115
|
-
│ ├── pages/
|
|
1116
|
-
│ ├── services/
|
|
1117
|
-
│ ├── utils/
|
|
1118
|
-
│ └── types/
|
|
1119
|
-
├── public/
|
|
1120
|
-
├── tests/
|
|
1121
|
-
└── .specs/`;
|
|
1122
|
-
}
|
|
1123
|
-
if (language === 'typescript' && framework === 'express') {
|
|
1124
|
-
return `├── src/
|
|
1125
|
-
│ ├── controllers/
|
|
1126
|
-
│ ├── middleware/
|
|
1127
|
-
│ ├── models/
|
|
1128
|
-
│ ├── routes/
|
|
1129
|
-
│ ├── services/
|
|
1130
|
-
│ └── utils/
|
|
1131
|
-
├── tests/
|
|
1132
|
-
└── .specs/`;
|
|
1133
|
-
}
|
|
1134
|
-
return `├── src/
|
|
1135
|
-
│ ├── [source files]
|
|
1136
|
-
├── tests/
|
|
1137
|
-
└── .specs/`;
|
|
1138
|
-
}
|
|
1139
|
-
getAvailableScripts(language, framework) {
|
|
1140
|
-
if (language === 'typescript') {
|
|
1141
|
-
return `\`\`\`bash
|
|
1142
|
-
npm run dev # Start development server
|
|
1143
|
-
npm run build # Build for production
|
|
1144
|
-
npm run test # Run test suite
|
|
1145
|
-
npm run lint # Run linting
|
|
1146
|
-
npm run type-check # TypeScript type checking
|
|
1147
|
-
\`\`\``;
|
|
1148
|
-
}
|
|
1149
|
-
return `\`\`\`bash
|
|
1150
|
-
# Add project-specific scripts here
|
|
1151
|
-
\`\`\``;
|
|
1152
|
-
}
|
|
1153
|
-
getDatabaseUrl(language) {
|
|
1154
|
-
return 'postgresql://user:pass@host/db';
|
|
1155
|
-
}
|
|
1156
|
-
getAuthenticationDocs(framework) {
|
|
1157
|
-
return `Bearer token authentication required for protected endpoints.
|
|
1158
|
-
Include in header: \`Authorization: Bearer <token>\``;
|
|
1159
|
-
}
|
|
1160
|
-
getMigrationCommands(language, framework) {
|
|
1161
|
-
return `# Run migrations
|
|
1162
|
-
# Add database migration commands here`;
|
|
1163
|
-
}
|
|
1164
|
-
getBackupCommands(language) {
|
|
1165
|
-
return `# Create backup
|
|
1166
|
-
# Add backup commands here`;
|
|
1167
|
-
}
|
|
1168
|
-
getBuildCommand(language) {
|
|
1169
|
-
if (language === 'typescript')
|
|
1170
|
-
return 'npm run build';
|
|
1171
|
-
if (language === 'python')
|
|
1172
|
-
return 'python -m build';
|
|
1173
|
-
if (language === 'java')
|
|
1174
|
-
return 'mvn package';
|
|
1175
|
-
return '# Build command';
|
|
1176
|
-
}
|
|
1177
|
-
getDeployCommand(language) {
|
|
1178
|
-
return '# Deploy command - configure based on deployment target';
|
|
1179
|
-
}
|
|
1180
|
-
getTroubleshootingCommands(language) {
|
|
1181
|
-
if (language === 'typescript') {
|
|
1182
|
-
return `rm -rf node_modules package-lock.json
|
|
1183
|
-
npm install`;
|
|
1184
|
-
}
|
|
1185
|
-
return '# Troubleshooting commands';
|
|
1186
|
-
}
|
|
1187
|
-
getLanguageDocsUrl(language) {
|
|
1188
|
-
const urls = {
|
|
1189
|
-
typescript: 'https://www.typescriptlang.org/docs/',
|
|
1190
|
-
python: 'https://docs.python.org/',
|
|
1191
|
-
java: 'https://docs.oracle.com/en/java/'
|
|
1192
|
-
};
|
|
1193
|
-
return urls[language] || '#';
|
|
1194
|
-
}
|
|
1195
|
-
getFrameworkDocsUrl(framework) {
|
|
1196
|
-
const urls = {
|
|
1197
|
-
react: 'https://react.dev/',
|
|
1198
|
-
express: 'https://expressjs.com/',
|
|
1199
|
-
django: 'https://docs.djangoproject.com/',
|
|
1200
|
-
fastapi: 'https://fastapi.tiangolo.com/',
|
|
1201
|
-
'spring-boot': 'https://spring.io/projects/spring-boot'
|
|
1202
|
-
};
|
|
1203
|
-
return urls[framework || ''] || '#';
|
|
1204
|
-
}
|
|
1205
|
-
getLintingTools(language) {
|
|
1206
|
-
if (language === 'typescript')
|
|
1207
|
-
return 'ESLint + Prettier';
|
|
1208
|
-
if (language === 'python')
|
|
1209
|
-
return 'flake8 + black';
|
|
1210
|
-
if (language === 'java')
|
|
1211
|
-
return 'Checkstyle + SpotBugs';
|
|
1212
|
-
return 'Language-specific linting tools';
|
|
1213
|
-
}
|
|
1214
315
|
}
|
|
1215
316
|
exports.SpecGenerator = SpecGenerator;
|
|
1216
317
|
//# sourceMappingURL=specGenerator.js.map
|