specpilot 1.1.1 ā 1.1.3
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 +136 -25
- package/dist/cli.js +12 -0
- package/dist/cli.js.map +1 -1
- package/dist/commands/add-specs.d.ts +9 -0
- package/dist/commands/add-specs.d.ts.map +1 -0
- package/dist/commands/add-specs.js +132 -0
- package/dist/commands/add-specs.js.map +1 -0
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +86 -2
- package/dist/commands/init.js.map +1 -1
- package/dist/utils/codeAnalyzer.d.ts +37 -0
- package/dist/utils/codeAnalyzer.d.ts.map +1 -0
- package/dist/utils/codeAnalyzer.js +224 -0
- package/dist/utils/codeAnalyzer.js.map +1 -0
- package/dist/utils/projectDetector.d.ts +20 -0
- package/dist/utils/projectDetector.d.ts.map +1 -0
- package/dist/utils/projectDetector.js +152 -0
- package/dist/utils/projectDetector.js.map +1 -0
- package/dist/utils/specGenerator.d.ts +21 -0
- package/dist/utils/specGenerator.d.ts.map +1 -1
- package/dist/utils/specGenerator.js +14 -1
- package/dist/utils/specGenerator.js.map +1 -1
- package/dist/utils/templateEngine.d.ts +5 -0
- package/dist/utils/templateEngine.d.ts.map +1 -1
- package/dist/utils/templateEngine.js +56 -7
- package/dist/utils/templateEngine.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -2,6 +2,47 @@
|
|
|
2
2
|
|
|
3
3
|
A CLI tool for initializing specification-driven development projects with flexible, production-ready structures.
|
|
4
4
|
|
|
5
|
+
## Table of Contents
|
|
6
|
+
|
|
7
|
+
- [Quick Start](#quick-start)
|
|
8
|
+
- [Description](#description)
|
|
9
|
+
- [Why SpecPilot?](#why-specpilot)
|
|
10
|
+
- [The Problem with Traditional Development](#the-problem-with-traditional-development)
|
|
11
|
+
- [The SpecPilot Solution](#the-specpilot-solution)
|
|
12
|
+
- [šļø Analogy: Building a House](#ļø-analogy-building-a-house)
|
|
13
|
+
- [š” Example: Building a Task Management App](#-example-building-a-task-management-app)
|
|
14
|
+
- [š Why SDD is the Future](#-why-sdd-is-the-future)
|
|
15
|
+
- [Prerequisites](#prerequisites)
|
|
16
|
+
- [Installation](#installation)
|
|
17
|
+
- [Usage Examples](#usage-examples)
|
|
18
|
+
- [Basic Project Initialization](#basic-project-initialization)
|
|
19
|
+
- [Additional Commands](#additional-commands)
|
|
20
|
+
- [Configuration](#configuration)
|
|
21
|
+
- [Global Configuration](#global-configuration)
|
|
22
|
+
- [Project Configuration](#project-configuration)
|
|
23
|
+
- [Templates](#templates)
|
|
24
|
+
- [Available Templates](#available-templates)
|
|
25
|
+
- [Custom Templates](#custom-templates)
|
|
26
|
+
- [Features](#features)
|
|
27
|
+
- [Project Structure](#project-structure)
|
|
28
|
+
- [Troubleshooting](#troubleshooting)
|
|
29
|
+
- [Common Issues](#common-issues)
|
|
30
|
+
- [Debug Mode](#debug-mode)
|
|
31
|
+
- [Getting Help](#getting-help)
|
|
32
|
+
- [Getting Started](#getting-started)
|
|
33
|
+
- [Best Practices](#best-practices)
|
|
34
|
+
- [How to Contribute](#how-to-contribute)
|
|
35
|
+
- [Version History](#version-history)
|
|
36
|
+
- [MIT License](#mit-license)
|
|
37
|
+
- [Extended Configuration](#extended-configuration)
|
|
38
|
+
- [CI/CD Integration](#cicd-integration)
|
|
39
|
+
- [Team Collaboration](#team-collaboration)
|
|
40
|
+
- [Enterprise Integration](#enterprise-integration)
|
|
41
|
+
- [API Usage](#api-usage)
|
|
42
|
+
- [Contributing](#contributing)
|
|
43
|
+
- [Development Setup](#development-setup)
|
|
44
|
+
- [License](#license)
|
|
45
|
+
|
|
5
46
|
## Quick Start
|
|
6
47
|
|
|
7
48
|
```bash
|
|
@@ -70,12 +111,29 @@ cd task-manager
|
|
|
70
111
|
|
|
71
112
|
**SpecPilot gives you a professional project foundation in seconds, so you can focus on building great features instead of figuring out folder structures.**
|
|
72
113
|
|
|
114
|
+
## Prerequisites
|
|
115
|
+
|
|
116
|
+
- **Node.js**: 16.0.0 or higher (18+ recommended)
|
|
117
|
+
- **npm**: 8.0.0 or higher (or yarn 1.22+)
|
|
118
|
+
- **Git**: For version control (recommended)
|
|
119
|
+
- **Operating System**: Windows, macOS, or Linux
|
|
120
|
+
|
|
73
121
|
## Installation
|
|
74
122
|
|
|
75
123
|
```bash
|
|
76
124
|
npm install -g specpilot
|
|
77
125
|
```
|
|
78
126
|
|
|
127
|
+
### Verify Installation
|
|
128
|
+
|
|
129
|
+
```bash
|
|
130
|
+
specpilot --version
|
|
131
|
+
# Should output: 1.1.2 (or current version)
|
|
132
|
+
|
|
133
|
+
specpilot --help
|
|
134
|
+
# Shows available commands
|
|
135
|
+
```
|
|
136
|
+
|
|
79
137
|
## Usage Examples
|
|
80
138
|
|
|
81
139
|
### Basic Project Initialization
|
|
@@ -100,6 +158,12 @@ specpilot init my-project --no-prompts
|
|
|
100
158
|
### Additional Commands
|
|
101
159
|
|
|
102
160
|
```bash
|
|
161
|
+
# Add .specs folder to an existing project
|
|
162
|
+
specpilot add-specs
|
|
163
|
+
specpilot add-specs --lang typescript --framework react
|
|
164
|
+
specpilot add-specs --no-analysis # Skip codebase analysis
|
|
165
|
+
specpilot add-specs --no-prompts # Non-interactive mode
|
|
166
|
+
|
|
103
167
|
# Validate project specs
|
|
104
168
|
specpilot validate --verbose
|
|
105
169
|
specpilot validate --fix
|
|
@@ -168,17 +232,23 @@ ai-context:
|
|
|
168
232
|
|
|
169
233
|
#### TypeScript
|
|
170
234
|
|
|
171
|
-
-
|
|
172
|
-
-
|
|
235
|
+
- **Generic**: Basic TypeScript project structure
|
|
236
|
+
- **React**: React application with modern tooling
|
|
237
|
+
- **Express**: REST API server setup
|
|
173
238
|
|
|
174
239
|
#### Python
|
|
175
240
|
|
|
176
|
-
-
|
|
177
|
-
-
|
|
241
|
+
- **Generic**: Basic Python project structure
|
|
242
|
+
- **FastAPI**: Modern API development
|
|
243
|
+
- **Django**: Web application framework
|
|
244
|
+
|
|
245
|
+
> **Note**: Run `specpilot list` to see all currently available templates and their status.
|
|
178
246
|
|
|
179
247
|
### Custom Templates
|
|
180
248
|
|
|
181
|
-
|
|
249
|
+
> **Coming Soon**: Custom template support is planned for future releases. Currently, SpecPilot uses built-in templates optimized for specification-driven development.
|
|
250
|
+
|
|
251
|
+
**Planned custom template structure:**
|
|
182
252
|
|
|
183
253
|
```text
|
|
184
254
|
~/.specpilot-templates/
|
|
@@ -192,10 +262,13 @@ Create custom templates in `~/.specpilot-templates/`:
|
|
|
192
262
|
|
|
193
263
|
- **Flexible Structure**: Generates `.specs` with customizable, production-ready layout
|
|
194
264
|
- **Language Support**: Templates for TypeScript and Python
|
|
265
|
+
- **Existing Project Support**: Add `.specs` to existing projects with `add-specs` command
|
|
266
|
+
- **Intelligent Analysis**: Auto-detect language/framework, scan TODOs/FIXMEs, analyze tests
|
|
195
267
|
- **Spec Validation**: Built-in validation with optional auto-fix
|
|
196
268
|
- **AI Integration**: Dedicated prompts tracking for development cycles
|
|
197
269
|
- **Migration Support**: Helps transition older structures
|
|
198
270
|
- **Template Listing**: Discover available language/framework combinations
|
|
271
|
+
- **Developer Attribution**: Prompts for developer name and personalizes generated specs
|
|
199
272
|
|
|
200
273
|
## Project Structure
|
|
201
274
|
|
|
@@ -239,10 +312,10 @@ specpilot list
|
|
|
239
312
|
|
|
240
313
|
```bash
|
|
241
314
|
# Run with detailed error output
|
|
242
|
-
specpilot
|
|
315
|
+
specpilot validate --verbose
|
|
243
316
|
|
|
244
317
|
# Auto-fix common issues
|
|
245
|
-
specpilot
|
|
318
|
+
specpilot validate --fix
|
|
246
319
|
```
|
|
247
320
|
|
|
248
321
|
#### Migration Issues
|
|
@@ -259,13 +332,13 @@ specpilot migrate --from complex --to simple --backup
|
|
|
259
332
|
|
|
260
333
|
```bash
|
|
261
334
|
# Enable debug logging
|
|
262
|
-
DEBUG=specpilot specpilot my-project
|
|
335
|
+
DEBUG=specpilot specpilot init my-project
|
|
263
336
|
|
|
264
337
|
# Verbose output
|
|
265
|
-
specpilot
|
|
338
|
+
specpilot validate --verbose
|
|
266
339
|
|
|
267
|
-
#
|
|
268
|
-
specpilot
|
|
340
|
+
# Check what templates are available
|
|
341
|
+
specpilot list --verbose
|
|
269
342
|
```
|
|
270
343
|
|
|
271
344
|
### Getting Help
|
|
@@ -297,9 +370,11 @@ specpilot specify --help
|
|
|
297
370
|
|
|
298
371
|
- **Start with specifications**: Define what you're building before coding
|
|
299
372
|
- **Keep prompts updated**: Log all AI interactions for future reference
|
|
300
|
-
- **Validate regularly**: Use `specpilot
|
|
301
|
-
- **
|
|
373
|
+
- **Validate regularly**: Use `specpilot validate` during development
|
|
374
|
+
- **Follow the subfolder structure**: Organize specs in `project/`, `architecture/`, `planning/`, `quality/`, `development/`
|
|
375
|
+
- **Use stable IDs**: Reference requirements and tasks by their IDs (e.g., `REQ-001`, `TASK-002`)
|
|
302
376
|
- **Version control everything**: Include `.specs/` in your git repository
|
|
377
|
+
- **Update metadata**: Keep `lastUpdated` and `version` fields current in spec files
|
|
303
378
|
|
|
304
379
|
## How to Contribute
|
|
305
380
|
|
|
@@ -332,21 +407,24 @@ jobs:
|
|
|
332
407
|
steps:
|
|
333
408
|
- uses: actions/checkout@v3
|
|
334
409
|
- uses: actions/setup-node@v3
|
|
410
|
+
with:
|
|
411
|
+
node-version: '18'
|
|
335
412
|
- run: npm install -g specpilot
|
|
336
|
-
- run: specpilot
|
|
413
|
+
- run: specpilot validate --verbose
|
|
337
414
|
```
|
|
338
415
|
|
|
339
416
|
### Team Collaboration
|
|
340
417
|
|
|
341
418
|
```bash
|
|
342
|
-
# Initialize for team
|
|
343
|
-
specpilot team-project --lang typescript --
|
|
419
|
+
# Initialize project for team collaboration
|
|
420
|
+
specpilot init team-project --lang typescript --framework react
|
|
344
421
|
|
|
345
|
-
#
|
|
346
|
-
|
|
422
|
+
# Share specs folder structure with team
|
|
423
|
+
git add .specs/
|
|
424
|
+
git commit -m "feat: add specification-driven development structure"
|
|
347
425
|
|
|
348
|
-
#
|
|
349
|
-
specpilot
|
|
426
|
+
# Team members can validate specs consistently
|
|
427
|
+
specpilot validate --verbose
|
|
350
428
|
```
|
|
351
429
|
|
|
352
430
|
### Enterprise Integration
|
|
@@ -355,28 +433,61 @@ Your organization can wrap SpecPilot with internal tooling and templates. For no
|
|
|
355
433
|
|
|
356
434
|
### API Usage
|
|
357
435
|
|
|
358
|
-
Programmatic API is
|
|
436
|
+
> **Coming Soon**: Programmatic API support is planned for future releases. Currently, SpecPilot is designed as a CLI-first tool.
|
|
437
|
+
|
|
438
|
+
**Planned programmatic usage:**
|
|
439
|
+
```javascript
|
|
440
|
+
// Future API (not yet available)
|
|
441
|
+
const { initProject, validateSpecs } = require("specpilot");
|
|
442
|
+
|
|
443
|
+
await initProject({
|
|
444
|
+
name: "my-project",
|
|
445
|
+
language: "typescript",
|
|
446
|
+
framework: "react"
|
|
447
|
+
});
|
|
448
|
+
```
|
|
449
|
+
|
|
450
|
+
For now, use the CLI commands or shell integration:
|
|
451
|
+
```bash
|
|
452
|
+
# Use in shell scripts
|
|
453
|
+
specpilot init my-project --lang typescript --no-prompts
|
|
454
|
+
specpilot validate --fix
|
|
455
|
+
```
|
|
359
456
|
|
|
360
457
|
## Contributing
|
|
361
458
|
|
|
362
|
-
This project follows specification-driven development.
|
|
459
|
+
This project follows specification-driven development principles. Please review our [`.specs/`](.specs/) folder for detailed contribution guidelines, architecture decisions, and development context.
|
|
460
|
+
|
|
461
|
+
### Quick Contribution Guide
|
|
462
|
+
|
|
463
|
+
1. **Read the specs**: Review [`.specs/project/requirements.md`](.specs/project/requirements.md) and [`.specs/architecture/architecture.md`](.specs/architecture/architecture.md)
|
|
464
|
+
2. **Check current tasks**: See [`.specs/planning/tasks.md`](.specs/planning/tasks.md) for open issues
|
|
465
|
+
3. **Follow conventions**: Use the metadata format documented in [`.specs/development/docs.md`](.specs/development/docs.md)
|
|
466
|
+
4. **Update specs**: Modify relevant spec files when making changes
|
|
467
|
+
5. **Validate**: Run `specpilot validate` before committing
|
|
363
468
|
|
|
364
469
|
### Development Setup
|
|
365
470
|
|
|
366
471
|
```bash
|
|
367
472
|
# Clone and setup
|
|
368
|
-
git clone https://github.com/
|
|
369
|
-
cd
|
|
473
|
+
git clone https://github.com/girishr/SpecPilot.git
|
|
474
|
+
cd SpecPilot
|
|
370
475
|
npm install
|
|
371
476
|
|
|
372
477
|
# Run in development mode
|
|
373
|
-
npm run dev
|
|
478
|
+
npm run dev -- init test-project --lang typescript
|
|
374
479
|
|
|
375
480
|
# Run tests
|
|
376
481
|
npm test
|
|
377
482
|
|
|
483
|
+
# Run tests with coverage
|
|
484
|
+
npm run test:coverage
|
|
485
|
+
|
|
378
486
|
# Build for production
|
|
379
487
|
npm run build
|
|
488
|
+
|
|
489
|
+
# Test CLI locally
|
|
490
|
+
node cli.js init my-test --lang python
|
|
380
491
|
```
|
|
381
492
|
|
|
382
493
|
## License
|
package/dist/cli.js
CHANGED
|
@@ -7,6 +7,7 @@ const validate_1 = require("./commands/validate");
|
|
|
7
7
|
const migrate_1 = require("./commands/migrate");
|
|
8
8
|
const list_1 = require("./commands/list");
|
|
9
9
|
const specify_1 = require("./commands/specify");
|
|
10
|
+
const add_specs_1 = require("./commands/add-specs");
|
|
10
11
|
const packageJson = require('../package.json');
|
|
11
12
|
commander_1.program
|
|
12
13
|
.name('specpilot')
|
|
@@ -62,6 +63,17 @@ commander_1.program
|
|
|
62
63
|
.option('--no-prompts', 'Skip interactive prompts')
|
|
63
64
|
.option('-u, --update', 'Regenerate specs with new description')
|
|
64
65
|
.action(specify_1.specifyCommand);
|
|
66
|
+
// Add-specs command
|
|
67
|
+
commander_1.program
|
|
68
|
+
.command('add-specs')
|
|
69
|
+
.alias('add')
|
|
70
|
+
.description('Add .specs folder to an existing project')
|
|
71
|
+
.option('-l, --lang <language>', 'Programming language (typescript, python)')
|
|
72
|
+
.option('-f, --framework <framework>', 'Framework (react, express, django, etc.)')
|
|
73
|
+
.option('--no-analysis', 'Skip codebase analysis')
|
|
74
|
+
.option('--deep-analysis', 'Perform thorough codebase analysis')
|
|
75
|
+
.option('--no-prompts', 'Skip interactive prompts')
|
|
76
|
+
.action(add_specs_1.addSpecsCommand);
|
|
65
77
|
// Parse command line arguments
|
|
66
78
|
commander_1.program.parse();
|
|
67
79
|
//# sourceMappingURL=cli.js.map
|
package/dist/cli.js.map
CHANGED
|
@@ -1 +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;
|
|
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;AACpD,oDAAuD;AAEvD,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,yBAAyB,CAAC;KAC7C,MAAM,CAAC,uBAAuB,EAAE,2CAA2C,EAAE,YAAY,CAAC;KAC1F,MAAM,CAAC,6BAA6B,EAAE,kDAAkD,CAAC;KACzF,MAAM,CAAC,uBAAuB,EAAE,kBAAkB,EAAE,GAAG,CAAC;KACxD,MAAM,CAAC,qBAAqB,EAAE,uBAAuB,EAAE,QAAQ,CAAC;KAChE,MAAM,CAAC,cAAc,EAAE,0BAA0B,CAAC;KAClD,MAA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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,oBAAoB;AACpB,mBAAO;KACJ,OAAO,CAAC,WAAW,CAAC;KACpB,KAAK,CAAC,KAAK,CAAC;KACZ,WAAW,CAAC,0CAA0C,CAAC;KACvD,MAAM,CAAC,uBAAuB,EAAE,2CAA2C,CAAC;KAC5E,MAAM,CAAC,6BAA6B,EAAE,0CAA0C,CAAC;KACjF,MAAM,CAAC,eAAe,EAAE,wBAAwB,CAAC;KACjD,MAAM,CAAC,iBAAiB,EAAE,oCAAoC,CAAC;KAC/D,MAAM,CAAC,cAAc,EAAE,0BAA0B,CAAC;KAClD,MAAM,CAAC,2BAAe,CAAC,CAAC;AAE3B,+BAA+B;AAC/B,mBAAO,CAAC,KAAK,EAAE,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export interface AddSpecsOptions {
|
|
2
|
+
lang?: string;
|
|
3
|
+
framework?: string;
|
|
4
|
+
noAnalysis: boolean;
|
|
5
|
+
deepAnalysis: boolean;
|
|
6
|
+
prompts: boolean;
|
|
7
|
+
}
|
|
8
|
+
export declare function addSpecsCommand(options: AddSpecsOptions): Promise<void>;
|
|
9
|
+
//# sourceMappingURL=add-specs.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"add-specs.d.ts","sourceRoot":"","sources":["../../src/commands/add-specs.ts"],"names":[],"mappings":"AAWA,MAAM,WAAW,eAAe;IAC9B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,OAAO,CAAC;IACpB,YAAY,EAAE,OAAO,CAAC;IACtB,OAAO,EAAE,OAAO,CAAC;CAClB;AAED,wBAAsB,eAAe,CAAC,OAAO,EAAE,eAAe,iBA+H7D"}
|
|
@@ -0,0 +1,132 @@
|
|
|
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.addSpecsCommand = addSpecsCommand;
|
|
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 projectDetector_1 = require("../utils/projectDetector");
|
|
12
|
+
const codeAnalyzer_1 = require("../utils/codeAnalyzer");
|
|
13
|
+
const templateEngine_1 = require("../utils/templateEngine");
|
|
14
|
+
const specGenerator_1 = require("../utils/specGenerator");
|
|
15
|
+
const logger_1 = require("../utils/logger");
|
|
16
|
+
async function addSpecsCommand(options) {
|
|
17
|
+
const logger = new logger_1.Logger();
|
|
18
|
+
try {
|
|
19
|
+
logger.info('š Analyzing existing project...');
|
|
20
|
+
const projectDir = process.cwd();
|
|
21
|
+
const specsDir = (0, path_1.join)(projectDir, '.specs');
|
|
22
|
+
// Check if .specs already exists
|
|
23
|
+
if ((0, fs_1.existsSync)(specsDir)) {
|
|
24
|
+
logger.error('ā .specs folder already exists in this directory');
|
|
25
|
+
logger.info('š” Use `specpilot validate` to check existing specs');
|
|
26
|
+
process.exit(1);
|
|
27
|
+
}
|
|
28
|
+
// Detect project information
|
|
29
|
+
const detector = new projectDetector_1.ProjectDetector();
|
|
30
|
+
let projectInfo = await detector.detectProject(projectDir);
|
|
31
|
+
if (!projectInfo && !options.lang) {
|
|
32
|
+
logger.error('ā Could not auto-detect project type');
|
|
33
|
+
logger.info('š” Please specify language: --lang typescript or --lang python');
|
|
34
|
+
process.exit(1);
|
|
35
|
+
}
|
|
36
|
+
// Use provided options or detected values
|
|
37
|
+
const language = options.lang || projectInfo?.language || 'typescript';
|
|
38
|
+
let framework = options.framework || projectInfo?.framework;
|
|
39
|
+
// Validate language
|
|
40
|
+
const supportedLanguages = ['typescript', 'javascript', 'python'];
|
|
41
|
+
if (!supportedLanguages.includes(language)) {
|
|
42
|
+
logger.error(`ā Language "${language}" is not supported`);
|
|
43
|
+
logger.info(`š” Supported languages: ${supportedLanguages.join(', ')}`);
|
|
44
|
+
process.exit(1);
|
|
45
|
+
}
|
|
46
|
+
// Prompt for missing information
|
|
47
|
+
if (!framework && options.prompts) {
|
|
48
|
+
const frameworks = getFrameworksForLanguage(language);
|
|
49
|
+
if (frameworks.length > 0) {
|
|
50
|
+
const response = await inquirer_1.default.prompt([{
|
|
51
|
+
type: 'list',
|
|
52
|
+
name: 'framework',
|
|
53
|
+
message: 'Choose a framework:',
|
|
54
|
+
choices: ['none', ...frameworks]
|
|
55
|
+
}]);
|
|
56
|
+
framework = response.framework === 'none' ? undefined : response.framework;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
// Get developer name
|
|
60
|
+
let developerName = projectInfo?.author || 'Your Name';
|
|
61
|
+
if (options.prompts) {
|
|
62
|
+
const nameResponse = await inquirer_1.default.prompt([{
|
|
63
|
+
type: 'input',
|
|
64
|
+
name: 'developerName',
|
|
65
|
+
message: 'Enter your name (for spec file attribution):',
|
|
66
|
+
default: developerName
|
|
67
|
+
}]);
|
|
68
|
+
developerName = nameResponse.developerName.trim() || developerName;
|
|
69
|
+
}
|
|
70
|
+
// Analyze codebase if requested
|
|
71
|
+
let analysis = null;
|
|
72
|
+
if (!options.noAnalysis) {
|
|
73
|
+
logger.info('š Analyzing codebase...');
|
|
74
|
+
const analyzer = new codeAnalyzer_1.CodeAnalyzer();
|
|
75
|
+
analysis = await analyzer.analyzeCodebase(projectDir);
|
|
76
|
+
// Show analysis summary
|
|
77
|
+
if (projectInfo) {
|
|
78
|
+
logger.info(chalk_1.default.green(`ā
Detected ${projectInfo.language}${projectInfo.framework ? `/${projectInfo.framework}` : ''} project`));
|
|
79
|
+
}
|
|
80
|
+
if (analysis.todos.length > 0) {
|
|
81
|
+
logger.info(chalk_1.default.yellow(`š Found ${analysis.todos.length} TODOs/FIXMEs`));
|
|
82
|
+
}
|
|
83
|
+
if (analysis.tests.testCount > 0) {
|
|
84
|
+
logger.info(chalk_1.default.cyan(`š§Ŗ Detected ${analysis.tests.framework || 'unknown'} testing framework with ${analysis.tests.testCount} tests`));
|
|
85
|
+
}
|
|
86
|
+
if (analysis.architecture.components.length > 0) {
|
|
87
|
+
logger.info(chalk_1.default.blue(`šļø Extracted ${analysis.architecture.components.length} components`));
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
// Initialize template engine and spec generator
|
|
91
|
+
const templateEngine = new templateEngine_1.TemplateEngine();
|
|
92
|
+
const specGenerator = new specGenerator_1.SpecGenerator(templateEngine);
|
|
93
|
+
// Generate .specs directory structure
|
|
94
|
+
const projectName = projectInfo?.name || 'my-project';
|
|
95
|
+
const description = projectInfo?.description ||
|
|
96
|
+
`A ${language} project${framework ? ` using ${framework}` : ''}`;
|
|
97
|
+
await specGenerator.generateSpecs({
|
|
98
|
+
projectName,
|
|
99
|
+
language,
|
|
100
|
+
framework,
|
|
101
|
+
targetDir: projectDir,
|
|
102
|
+
specsName: '.specs',
|
|
103
|
+
author: developerName,
|
|
104
|
+
description,
|
|
105
|
+
analysis: (!options.noAnalysis && analysis) ? analysis : undefined
|
|
106
|
+
});
|
|
107
|
+
logger.success('ā
.specs folder created successfully!');
|
|
108
|
+
logger.info(`š Location: ${specsDir}`);
|
|
109
|
+
// Show next steps
|
|
110
|
+
console.log(chalk_1.default.cyan('\nš Next steps:'));
|
|
111
|
+
console.log(` # Review and customize your specs:`);
|
|
112
|
+
console.log(` ${chalk_1.default.dim('cd')} .specs`);
|
|
113
|
+
console.log(` ${chalk_1.default.dim('#')} Edit project/requirements.md`);
|
|
114
|
+
console.log(` ${chalk_1.default.dim('#')} Update project/project.yaml`);
|
|
115
|
+
if (analysis && analysis.todos.length > 0) {
|
|
116
|
+
console.log(` ${chalk_1.default.dim('#')} Check planning/tasks.md for discovered TODOs`);
|
|
117
|
+
}
|
|
118
|
+
console.log(` \n specpilot validate ${chalk_1.default.dim('# Validate your specifications')}`);
|
|
119
|
+
}
|
|
120
|
+
catch (error) {
|
|
121
|
+
logger.error(`ā Failed to add specs: ${error instanceof Error ? error.message : 'Unknown error'}`);
|
|
122
|
+
process.exit(1);
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
function getFrameworksForLanguage(language) {
|
|
126
|
+
const frameworks = {
|
|
127
|
+
typescript: ['react', 'express', 'next', 'nest', 'vue', 'angular'],
|
|
128
|
+
python: ['fastapi', 'django', 'flask', 'streamlit']
|
|
129
|
+
};
|
|
130
|
+
return frameworks[language] || [];
|
|
131
|
+
}
|
|
132
|
+
//# sourceMappingURL=add-specs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"add-specs.js","sourceRoot":"","sources":["../../src/commands/add-specs.ts"],"names":[],"mappings":";;;;;AAmBA,0CA+HC;AAjJD,+BAA4B;AAC5B,2BAAgC;AAChC,kDAA0B;AAC1B,wDAAgC;AAChC,8DAA2D;AAC3D,wDAAqD;AACrD,4DAAyD;AACzD,0DAAuD;AACvD,4CAAyC;AAUlC,KAAK,UAAU,eAAe,CAAC,OAAwB;IAC5D,MAAM,MAAM,GAAG,IAAI,eAAM,EAAE,CAAC;IAE5B,IAAI,CAAC;QACH,MAAM,CAAC,IAAI,CAAC,kCAAkC,CAAC,CAAC;QAEhD,MAAM,UAAU,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC;QACjC,MAAM,QAAQ,GAAG,IAAA,WAAI,EAAC,UAAU,EAAE,QAAQ,CAAC,CAAC;QAE5C,iCAAiC;QACjC,IAAI,IAAA,eAAU,EAAC,QAAQ,CAAC,EAAE,CAAC;YACzB,MAAM,CAAC,KAAK,CAAC,kDAAkD,CAAC,CAAC;YACjE,MAAM,CAAC,IAAI,CAAC,qDAAqD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E,CAAC,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,CAAC;QAClE,MAAM,EAAE,CAAC,SAAS,EAAE,QAAQ,EAAE,OAAO,EAAE,WAAW,CAAC;KACpD,CAAC;IAEF,OAAO,UAAU,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC;AACpC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../src/commands/init.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../src/commands/init.ts"],"names":[],"mappings":"AAUA,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,EAAE,OAAO,EAAE,WAAW,iBAqInE"}
|
package/dist/commands/init.js
CHANGED
|
@@ -1,4 +1,37 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
2
35
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
36
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
37
|
};
|
|
@@ -8,6 +41,7 @@ const path_1 = require("path");
|
|
|
8
41
|
const fs_1 = require("fs");
|
|
9
42
|
const chalk_1 = __importDefault(require("chalk"));
|
|
10
43
|
const inquirer_1 = __importDefault(require("inquirer"));
|
|
44
|
+
const yaml = __importStar(require("js-yaml"));
|
|
11
45
|
const templateEngine_1 = require("../utils/templateEngine");
|
|
12
46
|
const specGenerator_1 = require("../utils/specGenerator");
|
|
13
47
|
const logger_1 = require("../utils/logger");
|
|
@@ -29,7 +63,7 @@ async function initCommand(name, options) {
|
|
|
29
63
|
process.exit(1);
|
|
30
64
|
}
|
|
31
65
|
// Validate supported language
|
|
32
|
-
const supportedLanguages = ['typescript', 'python'];
|
|
66
|
+
const supportedLanguages = ['typescript', 'javascript', 'python'];
|
|
33
67
|
if (!supportedLanguages.includes(options.lang)) {
|
|
34
68
|
logger.error(`ā Language "${options.lang}" is not supported`);
|
|
35
69
|
logger.info(`š” Supported languages: ${supportedLanguages.join(', ')}`);
|
|
@@ -49,11 +83,60 @@ async function initCommand(name, options) {
|
|
|
49
83
|
framework = response.framework === 'none' ? undefined : response.framework;
|
|
50
84
|
}
|
|
51
85
|
}
|
|
86
|
+
// Get developer name for spec attribution
|
|
87
|
+
let developerName = 'Your Name'; // default
|
|
88
|
+
if (options.prompts) {
|
|
89
|
+
const nameResponse = await inquirer_1.default.prompt([{
|
|
90
|
+
type: 'input',
|
|
91
|
+
name: 'developerName',
|
|
92
|
+
message: 'Enter your name (for spec file attribution):',
|
|
93
|
+
default: 'Your Name'
|
|
94
|
+
}]);
|
|
95
|
+
developerName = nameResponse.developerName.trim() || 'Your Name';
|
|
96
|
+
}
|
|
52
97
|
// Create project directory
|
|
53
98
|
const targetDir = (0, path_1.join)(options.dir, projectName);
|
|
54
99
|
if (!(0, fs_1.existsSync)(targetDir)) {
|
|
55
100
|
(0, fs_1.mkdirSync)(targetDir, { recursive: true });
|
|
56
101
|
}
|
|
102
|
+
// Check for existing .specs folder
|
|
103
|
+
const specsDir = (0, path_1.join)(targetDir, options.specsName);
|
|
104
|
+
if ((0, fs_1.existsSync)(specsDir)) {
|
|
105
|
+
logger.error(`ā Cannot initialize: ${options.specsName} folder already exists in ${targetDir}`);
|
|
106
|
+
// Try to read existing project info
|
|
107
|
+
const projectYamlPath = (0, path_1.join)(specsDir, 'project', 'project.yaml');
|
|
108
|
+
const requirementsMdPath = (0, path_1.join)(specsDir, 'project', 'requirements.md');
|
|
109
|
+
let projectInfo = '';
|
|
110
|
+
if ((0, fs_1.existsSync)(projectYamlPath)) {
|
|
111
|
+
try {
|
|
112
|
+
const projectData = yaml.load((0, fs_1.readFileSync)(projectYamlPath, 'utf8'));
|
|
113
|
+
projectInfo += `\nš Existing Project: ${projectData.name || 'Unknown'}`;
|
|
114
|
+
projectInfo += `\nš Version: ${projectData.version || 'Unknown'}`;
|
|
115
|
+
projectInfo += `\nš» Language: ${projectData.language || 'Unknown'}`;
|
|
116
|
+
projectInfo += `\nšļø Framework: ${projectData.framework || 'Unknown'}`;
|
|
117
|
+
projectInfo += `\nš¤ Author: ${projectData.author || 'Unknown'}`;
|
|
118
|
+
}
|
|
119
|
+
catch (error) {
|
|
120
|
+
projectInfo += '\nā ļø Could not read project.yaml';
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
if ((0, fs_1.existsSync)(requirementsMdPath)) {
|
|
124
|
+
try {
|
|
125
|
+
const requirementsContent = (0, fs_1.readFileSync)(requirementsMdPath, 'utf8');
|
|
126
|
+
const lines = requirementsContent.split('\n').slice(0, 5); // First 5 lines
|
|
127
|
+
projectInfo += `\nš Requirements Preview:\n${lines.join('\n')}`;
|
|
128
|
+
}
|
|
129
|
+
catch (error) {
|
|
130
|
+
projectInfo += '\nā ļø Could not read requirements.md';
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
logger.info(chalk_1.default.yellow(projectInfo));
|
|
134
|
+
logger.info(chalk_1.default.cyan('\nš” To continue with this project:'));
|
|
135
|
+
logger.info(` cd ${targetDir}`);
|
|
136
|
+
logger.info(` specpilot validate # Check current specs`);
|
|
137
|
+
logger.info(` # Edit ${options.specsName}/project/requirements.md`);
|
|
138
|
+
process.exit(1);
|
|
139
|
+
}
|
|
57
140
|
// Initialize template engine and spec generator
|
|
58
141
|
const templateEngine = new templateEngine_1.TemplateEngine();
|
|
59
142
|
const specGenerator = new specGenerator_1.SpecGenerator(templateEngine);
|
|
@@ -63,7 +146,8 @@ async function initCommand(name, options) {
|
|
|
63
146
|
language: options.lang,
|
|
64
147
|
framework,
|
|
65
148
|
targetDir,
|
|
66
|
-
specsName: options.specsName
|
|
149
|
+
specsName: options.specsName,
|
|
150
|
+
author: developerName
|
|
67
151
|
});
|
|
68
152
|
logger.success(`ā
Project "${projectName}" initialized successfully!`);
|
|
69
153
|
logger.info(`š Location: ${targetDir}`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init.js","sourceRoot":"","sources":["../../src/commands/init.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"init.js","sourceRoot":"","sources":["../../src/commands/init.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkBA,kCAqIC;AAtJD,+BAA4B;AAC5B,2BAAyD;AACzD,kDAA0B;AAC1B,wDAAgC;AAChC,8CAAgC;AAChC,4DAAyD;AACzD,0DAAuD;AACvD,4CAAyC;AAUlC,KAAK,UAAU,WAAW,CAAC,IAAY,EAAE,OAAoB;IAClE,MAAM,MAAM,GAAG,IAAI,eAAM,EAAE,CAAC;IAE5B,IAAI,CAAC;QACH,MAAM,CAAC,IAAI,CAAC,gCAAgC,CAAC,CAAC;QAE9C,wBAAwB;QACxB,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC;YAChC,MAAM,CAAC,KAAK,CAAC,gDAAgD,CAAC,CAAC;YAC/D,MAAM,CAAC,IAAI,CAAC,yCAAyC,CAAC,CAAC;YACvD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;QAED,MAAM,WAAW,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC;QAEhC,2DAA2D;QAC3D,IAAI,cAAc,CAAC,IAAI,CAAC,WAAW,CAAC,EAAE,CAAC;YACrC,MAAM,CAAC,KAAK,CAAC,gEAAgE,CAAC,CAAC;YAC/E,MAAM,CAAC,IAAI,CAAC,+DAA+D,CAAC,CAAC;YAC7E,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;QAED,8BAA8B;QAC9B,MAAM,kBAAkB,GAAG,CAAC,YAAY,EAAE,YAAY,EAAE,QAAQ,CAAC,CAAC;QAClE,IAAI,CAAC,kBAAkB,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC;YAC/C,MAAM,CAAC,KAAK,CAAC,eAAe,O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em {
|
|
2
|
+
file: string;
|
|
3
|
+
line: number;
|
|
4
|
+
type: 'TODO' | 'FIXME' | 'HACK' | 'NOTE';
|
|
5
|
+
text: string;
|
|
6
|
+
}
|
|
7
|
+
export interface TestInfo {
|
|
8
|
+
framework?: string;
|
|
9
|
+
testFiles: string[];
|
|
10
|
+
testCount: number;
|
|
11
|
+
hasE2E: boolean;
|
|
12
|
+
hasUnit: boolean;
|
|
13
|
+
hasIntegration: boolean;
|
|
14
|
+
}
|
|
15
|
+
export interface ArchitectureInfo {
|
|
16
|
+
components: string[];
|
|
17
|
+
directories: string;
|
|
18
|
+
fileTypes: Record<string, number>;
|
|
19
|
+
}
|
|
20
|
+
export interface AnalysisResult {
|
|
21
|
+
todos: TodoItem[];
|
|
22
|
+
tests: TestInfo;
|
|
23
|
+
architecture: ArchitectureInfo;
|
|
24
|
+
}
|
|
25
|
+
export declare class CodeAnalyzer {
|
|
26
|
+
private excludeDirs;
|
|
27
|
+
private codeExtensions;
|
|
28
|
+
analyzeCodebase(projectDir?: string): Promise<AnalysisResult>;
|
|
29
|
+
private findTodos;
|
|
30
|
+
private analyzeTests;
|
|
31
|
+
private findTestFiles;
|
|
32
|
+
private isTestFile;
|
|
33
|
+
private detectTestFramework;
|
|
34
|
+
private extractArchitecture;
|
|
35
|
+
private buildDirectoryTree;
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=codeAnalyzer.d.ts.map
|