specpilot 1.0.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/LICENSE +21 -0
- package/README.md +430 -0
- package/cli.js +3 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +67 -0
- package/dist/cli.js.map +1 -0
- package/dist/commands/init.d.ts +9 -0
- package/dist/commands/init.d.ts.map +1 -0
- package/dist/commands/init.js +72 -0
- package/dist/commands/init.js.map +1 -0
- package/dist/commands/list.d.ts +6 -0
- package/dist/commands/list.d.ts.map +1 -0
- package/dist/commands/list.js +53 -0
- package/dist/commands/list.js.map +1 -0
- package/dist/commands/migrate.d.ts +8 -0
- package/dist/commands/migrate.d.ts.map +1 -0
- package/dist/commands/migrate.js +55 -0
- package/dist/commands/migrate.js.map +1 -0
- package/dist/commands/specify.d.ts +8 -0
- package/dist/commands/specify.d.ts.map +1 -0
- package/dist/commands/specify.js +194 -0
- package/dist/commands/specify.js.map +1 -0
- package/dist/commands/validate.d.ts +7 -0
- package/dist/commands/validate.d.ts.map +1 -0
- package/dist/commands/validate.js +54 -0
- package/dist/commands/validate.js.map +1 -0
- package/dist/utils/logger.d.ts +8 -0
- package/dist/utils/logger.d.ts.map +1 -0
- package/dist/utils/logger.js +28 -0
- package/dist/utils/logger.js.map +1 -0
- package/dist/utils/projectMigrator.d.ts +25 -0
- package/dist/utils/projectMigrator.d.ts.map +1 -0
- package/dist/utils/projectMigrator.js +227 -0
- package/dist/utils/projectMigrator.js.map +1 -0
- package/dist/utils/specGenerator.d.ts +45 -0
- package/dist/utils/specGenerator.d.ts.map +1 -0
- package/dist/utils/specGenerator.js +1109 -0
- package/dist/utils/specGenerator.js.map +1 -0
- package/dist/utils/specValidator.d.ts +33 -0
- package/dist/utils/specValidator.d.ts.map +1 -0
- package/dist/utils/specValidator.js +425 -0
- package/dist/utils/specValidator.js.map +1 -0
- package/dist/utils/templateEngine.d.ts +22 -0
- package/dist/utils/templateEngine.d.ts.map +1 -0
- package/dist/utils/templateEngine.js +213 -0
- package/dist/utils/templateEngine.js.map +1 -0
- package/dist/utils/templateRegistry.d.ts +14 -0
- package/dist/utils/templateRegistry.d.ts.map +1 -0
- package/dist/utils/templateRegistry.js +101 -0
- package/dist/utils/templateRegistry.js.map +1 -0
- package/package.json +72 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 SpecPilot SDD CLI Contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,430 @@
|
|
|
1
|
+
# SpecPilot SDD CLI
|
|
2
|
+
|
|
3
|
+
A CLI tool for initializing specification-driven development projects with flexible, production-ready structures.
|
|
4
|
+
|
|
5
|
+
## Quick Start
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
# Install globally
|
|
9
|
+
npm install -g specpilot
|
|
10
|
+
|
|
11
|
+
# Initialize your first project
|
|
12
|
+
specpilot my-project --lang typescript --framework react
|
|
13
|
+
|
|
14
|
+
# Start coding with full control
|
|
15
|
+
cd my-project
|
|
16
|
+
# Your .specs/ folder is ready with guidelines, not prescriptions
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Description
|
|
20
|
+
|
|
21
|
+
`SpecPilot SDD CLI` is designed to give developers the freedom to decide and control their projects, not prescribe the entire implementation. My goal with this project is to provide a helping tool that offers basic guidelines for serious developers writing production code for critical development tasks who need better control over their project, its architecture, and its structure.
|
|
22
|
+
|
|
23
|
+
The tool generates customizable `.specs` directories that serve as flexible frameworks for specification-driven development, integrating seamlessly with AI-assisted coding workflows. It provides structure and guidance without dictating implementation, allowing you to maintain full ownership of your production code while establishing robust foundations for scalable, maintainable projects.
|
|
24
|
+
|
|
25
|
+
### Key Principles
|
|
26
|
+
|
|
27
|
+
- **Developer Freedom**: You control the architecture and implementation decisions
|
|
28
|
+
- **Production Focus**: Built for serious development tasks and enterprise-grade projects
|
|
29
|
+
- **AI Integration**: Includes dedicated `.specs/prompts/` folder to track all development prompts throughout your coding cycle
|
|
30
|
+
- **Flexible Structure**: Customizable specifications that adapt to your workflow
|
|
31
|
+
|
|
32
|
+
## Installation
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
npm install -g specpilot
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## Usage Examples
|
|
39
|
+
|
|
40
|
+
### Basic Project Initialization
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
# Initialize with default settings (.specs folder)
|
|
44
|
+
specpilot my-project
|
|
45
|
+
|
|
46
|
+
# Specify language and framework
|
|
47
|
+
specpilot my-project --lang typescript --framework react
|
|
48
|
+
specpilot my-project --lang python --framework django
|
|
49
|
+
specpilot my-project --lang java --framework spring
|
|
50
|
+
|
|
51
|
+
# Use custom spec directory name
|
|
52
|
+
specpilot my-project --spec-dir .project-specs
|
|
53
|
+
specpilot my-project --spec-dir docs/specifications
|
|
54
|
+
|
|
55
|
+
# Interactive mode (guided setup)
|
|
56
|
+
specpilot --interactive
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
### Advanced Usage
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
# Initialize with specific template
|
|
63
|
+
specpilot my-api --lang typescript --framework express --template rest-api
|
|
64
|
+
|
|
65
|
+
# Initialize for team collaboration
|
|
66
|
+
specpilot team-project --lang python --framework fastapi --collaboration
|
|
67
|
+
|
|
68
|
+
# Initialize with custom author and license
|
|
69
|
+
specpilot my-lib --lang typescript --author "Your Name" --license MIT
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
### Validation and Management
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
# Validate project specs
|
|
76
|
+
specpilot --validate
|
|
77
|
+
|
|
78
|
+
# Validate with strict rules and auto-fix
|
|
79
|
+
specpilot --validate --strict --fix
|
|
80
|
+
|
|
81
|
+
# Check for migration needs
|
|
82
|
+
specpilot --migrate
|
|
83
|
+
|
|
84
|
+
# Show migration history
|
|
85
|
+
specpilot --migrate --show-history
|
|
86
|
+
|
|
87
|
+
# List available templates
|
|
88
|
+
specpilot --list-templates
|
|
89
|
+
|
|
90
|
+
# Show template details
|
|
91
|
+
specpilot --template-info typescript-react
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
## Configuration
|
|
95
|
+
|
|
96
|
+
### Global Configuration
|
|
97
|
+
|
|
98
|
+
Create `~/.specpilot-config.yaml` for global defaults:
|
|
99
|
+
|
|
100
|
+
```yaml
|
|
101
|
+
defaults:
|
|
102
|
+
specDir: ".specs"
|
|
103
|
+
author: "Your Name"
|
|
104
|
+
license: "MIT"
|
|
105
|
+
aiTracking: true
|
|
106
|
+
|
|
107
|
+
templates:
|
|
108
|
+
typescript:
|
|
109
|
+
framework: "express"
|
|
110
|
+
python:
|
|
111
|
+
framework: "fastapi"
|
|
112
|
+
|
|
113
|
+
validation:
|
|
114
|
+
strict: true
|
|
115
|
+
autoFix: true
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
### Project Configuration
|
|
119
|
+
|
|
120
|
+
After initialization, customize `.specs/project.yaml`:
|
|
121
|
+
|
|
122
|
+
```yaml
|
|
123
|
+
project:
|
|
124
|
+
name: "my-project"
|
|
125
|
+
description: "My awesome project"
|
|
126
|
+
language: "typescript"
|
|
127
|
+
framework: "react"
|
|
128
|
+
version: "1.0.0"
|
|
129
|
+
|
|
130
|
+
rules:
|
|
131
|
+
- "Follow specification-driven development"
|
|
132
|
+
- "Maintain comprehensive documentation"
|
|
133
|
+
- "Use TypeScript strict mode"
|
|
134
|
+
|
|
135
|
+
ai-context:
|
|
136
|
+
- "Track all development prompts"
|
|
137
|
+
- "Maintain architectural decisions"
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
## Templates
|
|
141
|
+
|
|
142
|
+
### Available Templates
|
|
143
|
+
|
|
144
|
+
#### TypeScript
|
|
145
|
+
|
|
146
|
+
- **Generic**: Basic TypeScript project structure
|
|
147
|
+
- **React**: React application with modern tooling
|
|
148
|
+
- **Express**: REST API server setup
|
|
149
|
+
- **Library**: NPM package development
|
|
150
|
+
- **CLI**: Command-line tool development
|
|
151
|
+
|
|
152
|
+
#### Python
|
|
153
|
+
|
|
154
|
+
- **Generic**: Basic Python project structure
|
|
155
|
+
- **FastAPI**: Modern API development
|
|
156
|
+
- **Django**: Web application framework
|
|
157
|
+
- **Data Science**: Jupyter, pandas, scikit-learn setup
|
|
158
|
+
- **CLI**: Python command-line tools
|
|
159
|
+
|
|
160
|
+
#### Java
|
|
161
|
+
|
|
162
|
+
- **Generic**: Maven/Gradle project structure
|
|
163
|
+
- **Spring Boot**: Microservices development
|
|
164
|
+
- **Android**: Mobile app development
|
|
165
|
+
|
|
166
|
+
### Custom Templates
|
|
167
|
+
|
|
168
|
+
Create custom templates in `~/.specpilot-templates/`:
|
|
169
|
+
|
|
170
|
+
```text
|
|
171
|
+
~/.specpilot-templates/
|
|
172
|
+
āāā my-custom-template/
|
|
173
|
+
ā āāā template.yaml
|
|
174
|
+
ā āāā .specs/
|
|
175
|
+
ā āāā src/
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
## Features
|
|
179
|
+
|
|
180
|
+
- **Flexible Structure**: Generates `.specs` directories with customizable layouts
|
|
181
|
+
- **Language Support**: Templates for TypeScript, Python, Java, and more
|
|
182
|
+
- **Spec Validation**: Built-in validation with auto-fix capabilities
|
|
183
|
+
- **AI Integration**: Dedicated prompts tracking for development cycles
|
|
184
|
+
- **GitHub Ready**: Structures optimized for version control and collaboration
|
|
185
|
+
- **Migration Support**: Handles structure updates across versions
|
|
186
|
+
- **Custom Templates**: Support for organization-specific templates
|
|
187
|
+
- **Team Collaboration**: Built-in support for team development workflows
|
|
188
|
+
|
|
189
|
+
## Project Structure
|
|
190
|
+
|
|
191
|
+
After initialization, your project will have:
|
|
192
|
+
|
|
193
|
+
```text
|
|
194
|
+
project-root/
|
|
195
|
+
āāā .specs/ # Specification-driven structure
|
|
196
|
+
ā āāā config/ # Project configuration
|
|
197
|
+
ā āāā architecture/ # System design docs
|
|
198
|
+
ā āāā requirements/ # Feature and user story specs
|
|
199
|
+
ā āāā api/ # API specifications
|
|
200
|
+
ā āāā tests/ # Test plans and criteria
|
|
201
|
+
ā āāā tasks/ # Task tracking
|
|
202
|
+
ā āāā prompts/ # AI development prompts
|
|
203
|
+
ā āāā docs/ # Development guidelines
|
|
204
|
+
āāā src/ # Your source code
|
|
205
|
+
āāā README.md # This file
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
## Troubleshooting
|
|
209
|
+
|
|
210
|
+
### Common Issues
|
|
211
|
+
|
|
212
|
+
#### Permission Errors
|
|
213
|
+
|
|
214
|
+
```bash
|
|
215
|
+
# Fix permission issues
|
|
216
|
+
sudo chown -R $USER ~/.npm-global
|
|
217
|
+
npm config set prefix '~/.npm-global'
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
````text
|
|
221
|
+
# Configuration examples
|
|
222
|
+
|
|
223
|
+
#### Template Not Found
|
|
224
|
+
|
|
225
|
+
```bash
|
|
226
|
+
```bash
|
|
227
|
+
# List available templates
|
|
228
|
+
specpilot --list-templates
|
|
229
|
+
|
|
230
|
+
# Update templates
|
|
231
|
+
specpilot --update-templates
|
|
232
|
+
````
|
|
233
|
+
|
|
234
|
+
#### Validation Failures
|
|
235
|
+
|
|
236
|
+
```bash
|
|
237
|
+
# Run with detailed error output
|
|
238
|
+
specpilot --validate --verbose
|
|
239
|
+
|
|
240
|
+
# Auto-fix common issues
|
|
241
|
+
specpilot --validate --fix
|
|
242
|
+
```
|
|
243
|
+
|
|
244
|
+
#### Migration Issues
|
|
245
|
+
|
|
246
|
+
````bash
|
|
247
|
+
```bash
|
|
248
|
+
# Check current version
|
|
249
|
+
specpilot --version
|
|
250
|
+
|
|
251
|
+
# Force migration
|
|
252
|
+
specpilot --migrate --force
|
|
253
|
+
|
|
254
|
+
# Rollback migration
|
|
255
|
+
specpilot --migrate --rollback
|
|
256
|
+
````
|
|
257
|
+
|
|
258
|
+
### Debug Mode
|
|
259
|
+
|
|
260
|
+
```bash
|
|
261
|
+
# Enable debug logging
|
|
262
|
+
DEBUG=specpilot specpilot my-project
|
|
263
|
+
|
|
264
|
+
# Verbose output
|
|
265
|
+
specpilot my-project --verbose
|
|
266
|
+
|
|
267
|
+
# Dry run (show what would be created)
|
|
268
|
+
specpilot my-project --dry-run
|
|
269
|
+
```
|
|
270
|
+
|
|
271
|
+
### Getting Help
|
|
272
|
+
|
|
273
|
+
```bash
|
|
274
|
+
# Show help
|
|
275
|
+
specpilot --help
|
|
276
|
+
|
|
277
|
+
# Command-specific help
|
|
278
|
+
specpilot init --help
|
|
279
|
+
specpilot validate --help
|
|
280
|
+
```
|
|
281
|
+
|
|
282
|
+
## Getting Started
|
|
283
|
+
|
|
284
|
+
1. **Initialize your project**: `specpilot my-project --lang typescript`
|
|
285
|
+
2. **Review the generated `.specs` structure** - This provides your flexible framework
|
|
286
|
+
3. **Customize the specifications** in `.specs/project.yaml` according to your needs
|
|
287
|
+
4. **Document your architecture** in `.specs/architecture.md` (you control the design)
|
|
288
|
+
5. **Track all development prompts** in `.specs/prompts.md` throughout your coding cycle
|
|
289
|
+
6. **Define your requirements** in `.specs/requirements.md` and `.specs/tests.md`
|
|
290
|
+
7. **Start building** your production code in `src/` with full control over implementation
|
|
291
|
+
|
|
292
|
+
### Best Practices
|
|
293
|
+
|
|
294
|
+
- **Start with specifications**: Define what you're building before coding
|
|
295
|
+
- **Keep prompts updated**: Log all AI interactions for future reference
|
|
296
|
+
- **Validate regularly**: Use `specpilot --validate` during development
|
|
297
|
+
- **Customize templates**: Adapt the structure to your team's needs
|
|
298
|
+
- **Version control everything**: Include `.specs/` in your git repository
|
|
299
|
+
|
|
300
|
+
## How to Contribute
|
|
301
|
+
|
|
302
|
+
We welcome contributions! Please see our contributing guidelines:
|
|
303
|
+
|
|
304
|
+
1. **Fork the repository** and create a feature branch
|
|
305
|
+
2. **Follow the existing code style** and add tests for new features
|
|
306
|
+
3. **Update documentation** for any new functionality
|
|
307
|
+
4. **Submit a pull request** with a clear description of changes
|
|
308
|
+
|
|
309
|
+
### Local Development Setup
|
|
310
|
+
|
|
311
|
+
```bash
|
|
312
|
+
# Clone the repository
|
|
313
|
+
git clone https://github.com/specpilot/specpilot.git
|
|
314
|
+
cd specpilot
|
|
315
|
+
|
|
316
|
+
# Install dependencies
|
|
317
|
+
npm install
|
|
318
|
+
|
|
319
|
+
# Run in development mode
|
|
320
|
+
npm run dev -- my-test-project --lang typescript
|
|
321
|
+
|
|
322
|
+
# Run tests
|
|
323
|
+
npm test
|
|
324
|
+
|
|
325
|
+
# Build for production
|
|
326
|
+
npm run build
|
|
327
|
+
```
|
|
328
|
+
|
|
329
|
+
## Version History
|
|
330
|
+
|
|
331
|
+
See [CHANGELOG.md](CHANGELOG.md) for detailed version history.
|
|
332
|
+
|
|
333
|
+
## MIT License
|
|
334
|
+
|
|
335
|
+
MIT License - see [LICENSE](LICENSE) file for details.
|
|
336
|
+
|
|
337
|
+
## Extended Configuration
|
|
338
|
+
|
|
339
|
+
### CI/CD Integration
|
|
340
|
+
|
|
341
|
+
```yaml
|
|
342
|
+
# .github/workflows/specs-validation.yml
|
|
343
|
+
name: Validate Specs
|
|
344
|
+
on: [push, pull_request]
|
|
345
|
+
jobs:
|
|
346
|
+
validate:
|
|
347
|
+
runs-on: ubuntu-latest
|
|
348
|
+
steps:
|
|
349
|
+
- uses: actions/checkout@v3
|
|
350
|
+
- uses: actions/setup-node@v3
|
|
351
|
+
- run: npm install -g specpilot
|
|
352
|
+
- run: specpilot --validate --strict
|
|
353
|
+
```
|
|
354
|
+
|
|
355
|
+
### Team Collaboration
|
|
356
|
+
|
|
357
|
+
```bash
|
|
358
|
+
# Initialize for team with shared templates
|
|
359
|
+
specpilot team-project --lang typescript --template team-standard
|
|
360
|
+
|
|
361
|
+
# Sync team templates
|
|
362
|
+
specpilot --sync-templates --from git@github.com:company/templates.git
|
|
363
|
+
|
|
364
|
+
# Validate against team standards
|
|
365
|
+
specpilot --validate --team-rules
|
|
366
|
+
```
|
|
367
|
+
|
|
368
|
+
### Enterprise Integration
|
|
369
|
+
|
|
370
|
+
```bash
|
|
371
|
+
# Use corporate templates
|
|
372
|
+
specforge --template-repo https://internal.company.com/templates
|
|
373
|
+
|
|
374
|
+
# Apply company policies
|
|
375
|
+
specforge --apply-policies company-standards
|
|
376
|
+
|
|
377
|
+
# Generate compliance reports
|
|
378
|
+
specforge --compliance-report --output report.json
|
|
379
|
+
```
|
|
380
|
+
|
|
381
|
+
### API Usage
|
|
382
|
+
|
|
383
|
+
```javascript
|
|
384
|
+
// Use SpecPilot SDD CLI programmatically
|
|
385
|
+
const { initProject, validateSpecs } = require("specpilot");
|
|
386
|
+
|
|
387
|
+
// Initialize project
|
|
388
|
+
await initProject({
|
|
389
|
+
name: "my-project",
|
|
390
|
+
language: "typescript",
|
|
391
|
+
framework: "react",
|
|
392
|
+
specDir: ".specs",
|
|
393
|
+
});
|
|
394
|
+
|
|
395
|
+
// Validate specifications
|
|
396
|
+
const result = await validateSpecs("./my-project");
|
|
397
|
+
if (!result.valid) {
|
|
398
|
+
console.error("Validation errors:", result.errors);
|
|
399
|
+
}
|
|
400
|
+
```
|
|
401
|
+
|
|
402
|
+
## Contributing
|
|
403
|
+
|
|
404
|
+
This project follows specification-driven development. See `.specs` for contribution guidelines and development setup.
|
|
405
|
+
|
|
406
|
+
### Development Setup
|
|
407
|
+
|
|
408
|
+
```bash
|
|
409
|
+
# Clone and setup
|
|
410
|
+
git clone https://github.com/specpilot/specpilot.git
|
|
411
|
+
cd specpilot
|
|
412
|
+
npm install
|
|
413
|
+
|
|
414
|
+
# Run in development mode
|
|
415
|
+
npm run dev
|
|
416
|
+
|
|
417
|
+
# Run tests
|
|
418
|
+
npm test
|
|
419
|
+
|
|
420
|
+
# Build for production
|
|
421
|
+
npm run build
|
|
422
|
+
```
|
|
423
|
+
|
|
424
|
+
## License
|
|
425
|
+
|
|
426
|
+
MIT License - see LICENSE file for details.
|
|
427
|
+
|
|
428
|
+
---
|
|
429
|
+
|
|
430
|
+
_Built with specification-driven development principles for serious production projects._
|
package/cli.js
ADDED
package/dist/cli.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":""}
|
package/dist/cli.js
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
const commander_1 = require("commander");
|
|
5
|
+
const init_1 = require("./commands/init");
|
|
6
|
+
const validate_1 = require("./commands/validate");
|
|
7
|
+
const migrate_1 = require("./commands/migrate");
|
|
8
|
+
const list_1 = require("./commands/list");
|
|
9
|
+
const specify_1 = require("./commands/specify");
|
|
10
|
+
const packageJson = require('../package.json');
|
|
11
|
+
commander_1.program
|
|
12
|
+
.name('specpilot')
|
|
13
|
+
.description('CLI tool for initializing specification-driven development projects')
|
|
14
|
+
.version(packageJson.version);
|
|
15
|
+
// Initialize command
|
|
16
|
+
commander_1.program
|
|
17
|
+
.command('init')
|
|
18
|
+
.alias('i')
|
|
19
|
+
.description('Initialize a new SDD project')
|
|
20
|
+
.argument('[name]', 'Project name')
|
|
21
|
+
.option('-l, --lang <language>', 'Programming language (typescript, python, java)', 'typescript')
|
|
22
|
+
.option('-f, --framework <framework>', 'Framework (react, express, django, spring, etc.)')
|
|
23
|
+
.option('-d, --dir <directory>', 'Target directory', '.')
|
|
24
|
+
.option('--specs-name <name>', 'Name for specs folder', '.specs')
|
|
25
|
+
.option('--no-prompts', 'Skip interactive prompts')
|
|
26
|
+
.action(init_1.initCommand);
|
|
27
|
+
// Validate command
|
|
28
|
+
commander_1.program
|
|
29
|
+
.command('validate')
|
|
30
|
+
.alias('v')
|
|
31
|
+
.description('Validate project specifications')
|
|
32
|
+
.option('-d, --dir <directory>', 'Project directory', '.')
|
|
33
|
+
.option('--fix', 'Auto-fix common issues')
|
|
34
|
+
.option('--verbose', 'Show detailed validation results')
|
|
35
|
+
.action(validate_1.validateCommand);
|
|
36
|
+
// Migrate command
|
|
37
|
+
commander_1.program
|
|
38
|
+
.command('migrate')
|
|
39
|
+
.alias('m')
|
|
40
|
+
.description('Migrate from old project structure')
|
|
41
|
+
.option('-d, --dir <directory>', 'Project directory', '.')
|
|
42
|
+
.option('--from <structure>', 'Source structure (complex, project-spec)', 'complex')
|
|
43
|
+
.option('--to <structure>', 'Target structure (simple)', 'simple')
|
|
44
|
+
.option('--backup', 'Create backup before migration')
|
|
45
|
+
.action(migrate_1.migrateCommand);
|
|
46
|
+
// List templates command
|
|
47
|
+
commander_1.program
|
|
48
|
+
.command('list')
|
|
49
|
+
.alias('ls')
|
|
50
|
+
.description('List available templates')
|
|
51
|
+
.option('--lang <language>', 'Filter by language')
|
|
52
|
+
.option('--verbose', 'Show template details')
|
|
53
|
+
.action(list_1.listCommand);
|
|
54
|
+
// Specify command
|
|
55
|
+
commander_1.program
|
|
56
|
+
.command('specify')
|
|
57
|
+
.alias('spec')
|
|
58
|
+
.description('Specify project requirements from natural language description')
|
|
59
|
+
.argument('[description]', 'Natural language description of what to build')
|
|
60
|
+
.option('-d, --dir <directory>', 'Project directory', '.')
|
|
61
|
+
.option('--specs-name <name>', 'Name for specs folder', '.specs')
|
|
62
|
+
.option('--no-prompts', 'Skip interactive prompts')
|
|
63
|
+
.option('-u, --update', 'Regenerate specs with new description')
|
|
64
|
+
.action(specify_1.specifyCommand);
|
|
65
|
+
// Parse command line arguments
|
|
66
|
+
commander_1.program.parse();
|
|
67
|
+
//# sourceMappingURL=cli.js.map
|
package/dist/cli.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";;;AAEA,yCAAoC;AACpC,0CAA8C;AAC9C,kDAAsD;AACtD,gDAAoD;AACpD,0CAA8C;AAC9C,gDAAoD;AAEpD,MAAM,WAAW,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAC;AAE/C,mBAAO;KACJ,IAAI,CAAC,WAAW,CAAC;KACjB,WAAW,CAAC,qEAAqE,CAAC;KAClF,OAAO,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;AAEhC,qBAAqB;AACrB,mBAAO;KACJ,OAAO,CAAC,MAAM,CAAC;KACf,KAAK,CAAC,GAAG,CAAC;KACV,WAAW,CAAC,8BAA8B,CAAC;KAC3C,QAAQ,CAAC,QAAQ,EAAE,cAAc,CAAC;KAClC,MAAM,CAAC,uBAAuB,EAAE,iDAAiD,EAAE,YAAY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CAAC,SAAS,CAAC;KAClB,KAAK,CAAC,MAAM,CAAC;KACb,WAAW,CAAC,gEAAgE,CAAC;KAC7E,QAAQ,CAAC,eAAe,EAAE,+CAA+C,CAAC;KAC1E,MAAM,CAAC,uBAAuB,EAAE,mBAAmB,EAAE,GAAG,CAAC;KACzD,MAAM,CAAC,qBAAqB,EAAE,uBAAuB,EAAE,QAAQ,CAAC;KAChE,MAAM,CAAC,cAAc,EAAE,0BAA0B,CAAC;KAClD,MAAM,CAAC,cAAc,EAAE,uCAAuC,CAAC;KAC/D,MAAM,CAAC,wBAAc,CAAC,CAAC;AAE1B,+BAA+B;AAC/B,mBAAO,CAAC,KAAK,EAAE,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export interface InitOptions {
|
|
2
|
+
lang: string;
|
|
3
|
+
framework?: string;
|
|
4
|
+
dir: string;
|
|
5
|
+
specsName: string;
|
|
6
|
+
prompts: boolean;
|
|
7
|
+
}
|
|
8
|
+
export declare function initCommand(name: string | undefined, options: InitOptions): Promise<void>;
|
|
9
|
+
//# sourceMappingURL=init.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../src/commands/init.ts"],"names":[],"mappings":"AASA,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,GAAG,EAAE,MAAM,CAAC;IACZ,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,OAAO,CAAC;CAClB;AAED,wBAAsB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,EAAE,OAAO,EAAE,WAAW,iBAyD/E"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.initCommand = initCommand;
|
|
7
|
+
const path_1 = require("path");
|
|
8
|
+
const fs_1 = require("fs");
|
|
9
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
10
|
+
const inquirer_1 = __importDefault(require("inquirer"));
|
|
11
|
+
const templateEngine_1 = require("../utils/templateEngine");
|
|
12
|
+
const specGenerator_1 = require("../utils/specGenerator");
|
|
13
|
+
const logger_1 = require("../utils/logger");
|
|
14
|
+
async function initCommand(name, options) {
|
|
15
|
+
const logger = new logger_1.Logger();
|
|
16
|
+
try {
|
|
17
|
+
logger.info('š Initializing SDD project...');
|
|
18
|
+
const projectName = name || 'my-project';
|
|
19
|
+
// Get framework if not provided and prompts enabled
|
|
20
|
+
let framework = options.framework;
|
|
21
|
+
if (!framework && options.prompts) {
|
|
22
|
+
const frameworks = getFrameworksForLanguage(options.lang);
|
|
23
|
+
if (frameworks.length > 0) {
|
|
24
|
+
const response = await inquirer_1.default.prompt([{
|
|
25
|
+
type: 'list',
|
|
26
|
+
name: 'framework',
|
|
27
|
+
message: 'Choose a framework:',
|
|
28
|
+
choices: ['none', ...frameworks]
|
|
29
|
+
}]);
|
|
30
|
+
framework = response.framework === 'none' ? undefined : response.framework;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
// Create project directory
|
|
34
|
+
const targetDir = (0, path_1.join)(options.dir, projectName);
|
|
35
|
+
if (!(0, fs_1.existsSync)(targetDir)) {
|
|
36
|
+
(0, fs_1.mkdirSync)(targetDir, { recursive: true });
|
|
37
|
+
}
|
|
38
|
+
// Initialize template engine and spec generator
|
|
39
|
+
const templateEngine = new templateEngine_1.TemplateEngine();
|
|
40
|
+
const specGenerator = new specGenerator_1.SpecGenerator(templateEngine);
|
|
41
|
+
// Generate .specs directory structure
|
|
42
|
+
await specGenerator.generateSpecs({
|
|
43
|
+
projectName,
|
|
44
|
+
language: options.lang,
|
|
45
|
+
framework,
|
|
46
|
+
targetDir,
|
|
47
|
+
specsName: options.specsName
|
|
48
|
+
});
|
|
49
|
+
logger.success(`ā
Project "${projectName}" initialized successfully!`);
|
|
50
|
+
logger.info(`š Location: ${targetDir}`);
|
|
51
|
+
logger.info(`š Specs: ${(0, path_1.join)(targetDir, options.specsName)}`);
|
|
52
|
+
// Show next steps
|
|
53
|
+
console.log(chalk_1.default.cyan('\nš Next steps:'));
|
|
54
|
+
console.log(` cd ${projectName}`);
|
|
55
|
+
console.log(` # Edit ${options.specsName}/requirements.md to define your project`);
|
|
56
|
+
console.log(` # Update ${options.specsName}/project.yaml with your configuration`);
|
|
57
|
+
console.log(` specpilot validate # Validate your specifications`);
|
|
58
|
+
}
|
|
59
|
+
catch (error) {
|
|
60
|
+
logger.error(`ā Failed to initialize project: ${error instanceof Error ? error.message : 'Unknown error'}`);
|
|
61
|
+
process.exit(1);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
function getFrameworksForLanguage(language) {
|
|
65
|
+
const frameworks = {
|
|
66
|
+
typescript: ['react', 'express', 'next', 'nest', 'vue', 'angular'],
|
|
67
|
+
python: ['fastapi', 'django', 'flask', 'streamlit'],
|
|
68
|
+
java: ['spring-boot', 'spring-mvc', 'android']
|
|
69
|
+
};
|
|
70
|
+
return frameworks[language] || [];
|
|
71
|
+
}
|
|
72
|
+
//# sourceMappingURL=init.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"init.js","sourceRoot":"","sources":["../../src/commands/init.ts"],"names":[],"mappings":";;;;;AAiBA,kCAyDC;AAzED,+BAA4B;AAC5B,2BAA2C;AAC3C,kDAA0B;AAC1B,wDAAgC;AAChC,4DAAyD;AACzD,0DAAuD;AACvD,4CAAyC;AAUlC,KAAK,UAAU,WAAW,CAAC,IAAwB,EAAE,OAAoB;IAC9E,MAAM,MAAM,GAAG,IAAI,eAAM,EAAE,CAAC;IAE5B,IAAI,CAAC;QACH,MAAM,CAAC,IAAI,CAAC,gCAAgC,CAAC,CAAC;QAE9C,MA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