create-sdd-project 0.4.2 → 0.6.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/README.md CHANGED
@@ -1,6 +1,7 @@
1
1
  # SDD DevFlow
2
2
 
3
3
  [![npm version](https://img.shields.io/npm/v/create-sdd-project)](https://www.npmjs.com/package/create-sdd-project)
4
+ [![npm downloads](https://img.shields.io/npm/dm/create-sdd-project)](https://www.npmjs.com/package/create-sdd-project)
4
5
  [![license](https://img.shields.io/npm/l/create-sdd-project)](LICENSE)
5
6
  [![node](https://img.shields.io/node/v/create-sdd-project)](package.json)
6
7
 
@@ -16,7 +17,34 @@ A complete development methodology for Claude Code and Gemini that combines spec
16
17
  npx create-sdd-project my-app
17
18
  ```
18
19
 
19
- The interactive wizard asks about your stack, AI tools, and autonomy level. For defaults (fullstack Express+Next.js):
20
+ The interactive wizard asks about your stack, AI tools, and autonomy level:
21
+
22
+ ```
23
+ 🚀 Create SDD DevFlow Project
24
+
25
+ ── Step 1: Project Basics ──────────────────────
26
+ Project name: my-app
27
+ Brief project description: Task management API
28
+
29
+ ── Step 3: Project Type & Tech Stack ──────────
30
+ 1) Backend + Frontend (monorepo) ← default
31
+ 2) Backend only
32
+ 3) Frontend only
33
+
34
+ ── Step 4: AI Tools ────────────────────────────
35
+ 1) Claude Code + Gemini ← default
36
+ 2) Claude Code only
37
+ 3) Gemini only
38
+
39
+ ── Step 5: Workflow Configuration ──────────────
40
+ Autonomy level:
41
+ 1) L1 Full Control — Human approves every checkpoint
42
+ 2) L2 Trusted — Human reviews plans + merges only ← default
43
+ 3) L3 Autopilot — Human only approves merges
44
+ 4) L4 Full Auto — No human checkpoints, CI/CD gates only
45
+ ```
46
+
47
+ For defaults (fullstack Express+Next.js, L2 autonomy):
20
48
 
21
49
  ```bash
22
50
  npx create-sdd-project my-app --yes
@@ -29,18 +57,138 @@ cd your-existing-project
29
57
  npx create-sdd-project --init
30
58
  ```
31
59
 
32
- Scans your project, detects your stack and architecture, and installs SDD files adapted to your project. Never modifies existing code or overwrites existing files.
60
+ The scanner detects your stack and installs adapted SDD files:
61
+
62
+ ```
63
+ 🔍 Scanning project...
64
+
65
+ Project: my-api
66
+ Language: TypeScript
67
+ Backend: Express + Mongoose + MongoDB
68
+ Frontend: Not detected
69
+ Architecture: Layered (controllers + handlers + managers)
70
+ Tests: Jest (3 test files)
71
+ Monorepo: No
72
+
73
+ Adding SDD DevFlow to my-api...
74
+
75
+ ✓ Installing Claude Code config (agents, skills, commands, hooks)
76
+ ✓ Installing Gemini config (agents, skills, commands)
77
+ ✓ Creating ai-specs/specs/ (4 standards files)
78
+ ✓ Creating docs/project_notes/ (product tracker, memory)
79
+ ✓ Creating AGENTS.md
80
+ ✓ Setting autonomy level: L2 (Trusted)
81
+
82
+ Done! Next steps:
83
+ git add -A && git commit -m "chore: add SDD DevFlow to existing project"
84
+ # Open in your AI coding tool and run: add feature "your first feature"
85
+ ```
86
+
87
+ Never modifies existing code or overwrites existing files.
88
+
89
+ ### Upgrade
90
+
91
+ When a new version of SDD DevFlow is released, upgrade your project's template files:
92
+
93
+ ```bash
94
+ cd your-existing-project
95
+ npx create-sdd-project@latest --upgrade
96
+ ```
97
+
98
+ ```
99
+ 🔄 SDD DevFlow Upgrade
100
+
101
+ Current version: 0.4.2
102
+ New version: 0.5.0
103
+ AI tools: Claude Code + Gemini
104
+ Project type: backend
105
+
106
+ Will replace:
107
+ ✓ .claude/ (agents, skills, hooks)
108
+ ✓ .gemini/ (agents, skills, commands)
109
+ ✓ AGENTS.md, CLAUDE.md / GEMINI.md
110
+ ✓ .env.example
111
+
112
+ Will preserve:
113
+ ⊘ .claude/settings.local.json (personal settings)
114
+ ⊘ docs/project_notes/* (project memory)
115
+ ⊘ docs/specs/* (your specs)
116
+ ⊘ docs/tickets/* (your tickets)
117
+ ⊘ .gitignore
118
+
119
+ Standards:
120
+ ✓ ai-specs/specs/base-standards.mdc — unchanged, will update
121
+ ⚠ ai-specs/specs/backend-standards.mdc — modified by you, preserved
122
+
123
+ Proceed? (y/N)
124
+ ```
125
+
126
+ **What gets upgraded:**
127
+ - Agent definitions, skills, hooks, and commands
128
+ - `AGENTS.md`, `CLAUDE.md`, `GEMINI.md`, `.env.example`
129
+ - Standards files (`.mdc`) — only if you haven't customized them
130
+
131
+ **What is always preserved:**
132
+ - Your project documentation (`docs/project_notes/`, `docs/specs/`, `docs/tickets/`)
133
+ - Custom agents you added to `.claude/agents/` or `.gemini/agents/`
134
+ - Custom commands in `.claude/commands/`
135
+ - Personal settings (`.claude/settings.local.json`)
136
+ - Your `.gitignore`
137
+ - Autonomy level setting
138
+
139
+ For non-interactive upgrades (CI/scripts): `npx create-sdd-project@latest --upgrade --yes`
140
+
141
+ ### Doctor (Diagnose Installation)
142
+
143
+ Check that your SDD installation is healthy:
144
+
145
+ ```bash
146
+ cd your-project
147
+ npx create-sdd-project --doctor
148
+ ```
149
+
150
+ ```
151
+ 🩺 SDD DevFlow Doctor
152
+
153
+ ✓ SDD installed (v0.5.0)
154
+ ✓ Version up to date (0.5.0)
155
+ ✓ AI tools: Claude Code + Gemini
156
+ ✓ Top-level configs present (AGENTS.md, CLAUDE.md, GEMINI.md)
157
+ ✓ Agents: 8/8 present
158
+ ✓ Project type coherence: OK (fullstack)
159
+ ✓ Cross-tool consistency: Claude and Gemini in sync
160
+ ✓ Standards: 4/4 present
161
+ ✓ Hooks: quick-scan.sh executable, jq installed, settings.json valid
162
+ ✓ Project memory: 4/4 files present
163
+
164
+ Overall: HEALTHY
165
+ ```
166
+
167
+ **What it checks:** SDD files present, version, agents for your project type, no stray frontend agents in backend projects (and vice versa), Claude and Gemini agents in sync, standards files, hooks and dependencies (`jq`), settings.json integrity, project memory files.
168
+
169
+ Exit code 1 if errors found — useful for CI pipelines.
33
170
 
34
171
  ### After Setup
35
172
 
36
- Open in your AI coding tool and run:
173
+ Open your project in Claude Code or Gemini and start building:
37
174
 
175
+ **Claude Code:**
38
176
  ```
39
- add feature "your first feature"
40
- start task F001
177
+ /add-feature "user authentication with JWT"
178
+ /start-task F001
179
+ /show-progress
180
+ /next-task
41
181
  ```
42
182
 
43
- The workflow skill guides you through each step with checkpoints based on your autonomy level.
183
+ **Gemini:**
184
+ ```
185
+ /add-feature "user authentication with JWT"
186
+ /start-task F001
187
+ /show-progress
188
+ /next-task
189
+ ```
190
+
191
+ The workflow skill guides you through each step — from spec writing to implementation to code review — with checkpoints based on your autonomy level.
44
192
 
45
193
  ---
46
194
 
@@ -149,7 +297,7 @@ When running `--init` on an existing project, the scanner automatically detects:
149
297
  | **Component libraries** | Radix UI, Headless UI, Material UI, Chakra UI, Ant Design |
150
298
  | **State management** | Zustand, Redux, Jotai, TanStack Query, Recoil, Pinia, MobX |
151
299
  | **Testing** | Jest, Vitest, Mocha (unit) + Playwright, Cypress (e2e) |
152
- | **Architecture** | MVC, DDD, feature-based, handler-based, flat |
300
+ | **Architecture** | MVC, DDD, feature-based, handler-based, layered, flat |
153
301
  | **Project type** | Monorepo (workspaces, Lerna, Turbo, pnpm) or single-package |
154
302
 
155
303
  Standards files are adapted to match your actual architecture — not generic defaults.
@@ -203,7 +351,7 @@ Configurable via the wizard or `<!-- CONFIG -->` comments in template files:
203
351
 
204
352
  - **Backend**: Node.js + Express + Prisma + PostgreSQL
205
353
  - **Frontend**: Next.js (App Router) + Tailwind CSS + Radix UI + Zustand
206
- - **Shared Types**: Zod schemas with `z.infer<>` for TypeScript types
354
+ - **Shared Types**: Validation schemas with TypeScript type inference
207
355
  - **Testing**: Jest (unit) + Playwright (e2e)
208
356
  - **Methodology**: TDD + DDD + Spec-Driven Development
209
357
 
@@ -214,7 +362,7 @@ These 6 principles apply to ALL tasks, ALL agents, ALL complexity levels:
214
362
  1. **Spec First** — No implementation without an approved specification
215
363
  2. **Small Tasks** — Work in baby steps, one at a time
216
364
  3. **Test-Driven Development** — Write tests before implementation
217
- 4. **Type Safety** — Strict TypeScript, no `any`, runtime validation with Zod
365
+ 4. **Type Safety** — Strict TypeScript, no `any`, runtime validation at boundaries
218
366
  5. **English Only** — All code, comments, docs, commits, and tickets in English
219
367
  6. **Reuse Over Recreate** — Always check existing code before proposing new files
220
368
 
@@ -224,21 +372,25 @@ These 6 principles apply to ALL tasks, ALL agents, ALL complexity levels:
224
372
  - Node.js 18+
225
373
  - `jq` (for quick-scan hook): `brew install jq` (macOS) or `apt install jq` (Linux)
226
374
 
227
- ## Manual Setup (Alternative)
375
+ ## Manual Setup
228
376
 
229
- If you prefer manual configuration over the CLI wizard:
377
+ If you prefer manual configuration over the CLI wizard, copy the template directory and look for `<!-- CONFIG: ... -->` comments in the files to customize:
230
378
 
231
379
  ```bash
232
- cp -r template/ /path/to/your-project/
380
+ cp -r node_modules/create-sdd-project/template/ /path/to/your-project/
233
381
  ```
234
382
 
235
- Then look for `<!-- CONFIG: ... -->` comments in the files to customize.
236
-
237
383
  ## Roadmap
238
384
 
239
- - **Agent Teams**: Parallel execution of independent tasks (waiting for Claude Code Agent Teams to stabilize)
240
- - **PM Agent + L5 Autonomous**: AI-driven feature orchestration with human review at milestone boundaries
385
+ - **Monorepo improvements**: Better support for pnpm workspaces and Turbo
386
+ - **SDD Upgrade/Migration**: Version bumps for projects already using SDD
241
387
  - **Retrofit Testing**: Automated test generation for existing projects with low coverage
388
+ - **Agent Teams**: Parallel execution of independent tasks
389
+ - **PM Agent + L5 Autonomous**: AI-driven feature orchestration with human review at milestone boundaries
390
+
391
+ ## Contributing
392
+
393
+ Found a bug or have a suggestion? [Open an issue on GitHub](https://github.com/pbojeda/sdd-devflow/issues).
242
394
 
243
395
  ## License
244
396
 
package/bin/cli.js CHANGED
@@ -8,14 +8,40 @@ const args = process.argv.slice(2);
8
8
  const projectName = args.find((a) => !a.startsWith('-'));
9
9
  const useDefaults = args.includes('--yes') || args.includes('-y');
10
10
  const isInit = args.includes('--init');
11
+ const isUpgrade = args.includes('--upgrade');
12
+ const isDoctor = args.includes('--doctor');
13
+ const isForce = args.includes('--force');
11
14
 
12
15
  async function main() {
16
+ if (isDoctor) {
17
+ return runDoctorCmd();
18
+ }
19
+ if (isUpgrade) {
20
+ return runUpgrade();
21
+ }
13
22
  if (isInit) {
14
23
  return runInit();
15
24
  }
16
25
  return runCreate();
17
26
  }
18
27
 
28
+ function runDoctorCmd() {
29
+ const { runDoctor, printResults } = require('../lib/doctor');
30
+
31
+ const cwd = process.cwd();
32
+
33
+ // Validate: must be in an existing project
34
+ if (!fs.existsSync(path.join(cwd, 'package.json'))) {
35
+ console.error('Error: No package.json found in current directory.');
36
+ console.error('The --doctor flag must be run from inside an existing project.');
37
+ process.exit(1);
38
+ }
39
+
40
+ const results = runDoctor(cwd);
41
+ const exitCode = printResults(results);
42
+ process.exit(exitCode);
43
+ }
44
+
19
45
  async function runCreate() {
20
46
  const { runWizard, buildDefaultConfig } = require('../lib/wizard');
21
47
  const { generate } = require('../lib/generator');
@@ -90,6 +116,106 @@ async function runInit() {
90
116
  generateInit(config);
91
117
  }
92
118
 
119
+ async function runUpgrade() {
120
+ const { scan } = require('../lib/scanner');
121
+ const { buildInitDefaultConfig } = require('../lib/init-wizard');
122
+ const readline = require('readline');
123
+ const {
124
+ generateUpgrade,
125
+ readInstalledVersion,
126
+ getPackageVersion,
127
+ detectAiTools,
128
+ detectProjectType,
129
+ readAutonomyLevel,
130
+ collectCustomAgents,
131
+ collectCustomCommands,
132
+ buildSummary,
133
+ } = require('../lib/upgrade-generator');
134
+
135
+ const cwd = process.cwd();
136
+
137
+ // Validate: must be in an existing project
138
+ if (!fs.existsSync(path.join(cwd, 'package.json'))) {
139
+ console.error('Error: No package.json found in current directory.');
140
+ console.error('The --upgrade flag must be run from inside an existing project.');
141
+ process.exit(1);
142
+ }
143
+
144
+ // Validate: SDD must be installed
145
+ if (!fs.existsSync(path.join(cwd, 'ai-specs'))) {
146
+ console.error('Error: ai-specs/ directory not found.');
147
+ console.error('SDD DevFlow does not appear to be installed. Use --init first.');
148
+ process.exit(1);
149
+ }
150
+
151
+ // Validate: no project name with --upgrade
152
+ if (projectName) {
153
+ console.error('Error: Cannot specify a project name with --upgrade.');
154
+ console.error('Usage: create-sdd-project --upgrade');
155
+ process.exit(1);
156
+ }
157
+
158
+ // Read current state
159
+ const installedVersion = readInstalledVersion(cwd);
160
+ const packageVersion = getPackageVersion();
161
+
162
+ // Same version check
163
+ if (installedVersion === packageVersion && !isForce) {
164
+ console.log(`\nSDD DevFlow is already at version ${packageVersion}.`);
165
+ console.log('Use --force to re-install the same version.\n');
166
+ return;
167
+ }
168
+
169
+ // Scan project
170
+ const scanResult = scan(cwd);
171
+
172
+ // Detect current config from installed files
173
+ const aiTools = detectAiTools(cwd);
174
+ const projectType = detectProjectType(cwd);
175
+ const autonomy = readAutonomyLevel(cwd);
176
+ const customAgents = collectCustomAgents(cwd);
177
+ const customCommands = collectCustomCommands(cwd);
178
+ const settingsLocal = fs.existsSync(path.join(cwd, '.claude', 'settings.local.json'));
179
+
180
+ // Build config (reuse init defaults as base)
181
+ const config = buildInitDefaultConfig(scanResult);
182
+ config.aiTools = aiTools;
183
+ config.projectType = projectType;
184
+ config.autonomyLevel = autonomy.level;
185
+ config.autonomyName = autonomy.name;
186
+ config.installedVersion = installedVersion;
187
+
188
+ // Build and show summary
189
+ const state = {
190
+ installedVersion,
191
+ packageVersion,
192
+ aiTools,
193
+ projectType,
194
+ customAgents,
195
+ customCommands,
196
+ settingsLocal,
197
+ standardsStatus: [], // computed during generation
198
+ };
199
+
200
+ if (!useDefaults) {
201
+ console.log('\n' + buildSummary(state));
202
+ console.log('');
203
+
204
+ const rl = readline.createInterface({ input: process.stdin, output: process.stdout });
205
+ const answer = await new Promise((resolve) => {
206
+ rl.question(' Proceed? (y/N) ', resolve);
207
+ });
208
+ rl.close();
209
+
210
+ if (answer.toLowerCase() !== 'y' && answer.toLowerCase() !== 'yes') {
211
+ console.log('\nUpgrade cancelled.\n');
212
+ return;
213
+ }
214
+ }
215
+
216
+ generateUpgrade(config);
217
+ }
218
+
93
219
  main().catch((err) => {
94
220
  console.error('\nError:', err.message);
95
221
  process.exit(1);
package/lib/config.js CHANGED
@@ -93,6 +93,16 @@ const BRANCHING_STRATEGIES = [
93
93
  const FRONTEND_AGENTS = ['frontend-developer.md', 'frontend-planner.md'];
94
94
  const BACKEND_AGENTS = ['backend-developer.md', 'backend-planner.md', 'database-architect.md'];
95
95
 
96
+ // All template-provided agent files (for upgrade: detect custom agents)
97
+ const TEMPLATE_AGENTS = [
98
+ ...FRONTEND_AGENTS,
99
+ ...BACKEND_AGENTS,
100
+ 'spec-creator.md',
101
+ 'code-review-specialist.md',
102
+ 'production-code-validator.md',
103
+ 'qa-engineer.md',
104
+ ];
105
+
96
106
  module.exports = {
97
107
  DEFAULTS,
98
108
  PROJECT_TYPES,
@@ -103,4 +113,5 @@ module.exports = {
103
113
  BRANCHING_STRATEGIES,
104
114
  FRONTEND_AGENTS,
105
115
  BACKEND_AGENTS,
116
+ TEMPLATE_AGENTS,
106
117
  };