create-sdd-project 0.1.1 → 0.2.1

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.
Files changed (28) hide show
  1. package/README.md +45 -14
  2. package/bin/cli.js +54 -2
  3. package/lib/init-generator.js +730 -0
  4. package/lib/init-wizard.js +285 -0
  5. package/lib/prompts.js +96 -0
  6. package/lib/scanner.js +497 -0
  7. package/lib/wizard.js +1 -72
  8. package/package.json +7 -3
  9. package/template/.gemini/commands/fix-bug.toml +2 -0
  10. package/template/.gemini/commands/init-sprint.toml +2 -0
  11. package/template/.gemini/commands/next-task.toml +2 -0
  12. package/template/.gemini/commands/show-progress.toml +2 -0
  13. package/template/.gemini/commands/start-task.toml +2 -0
  14. package/template/.gemini/settings.json +1 -1
  15. package/template/.gemini/skills/bug-workflow/SKILL.md +108 -0
  16. package/template/.gemini/skills/development-workflow/SKILL.md +196 -0
  17. package/template/.gemini/skills/development-workflow/references/branching-strategy.md +59 -0
  18. package/template/.gemini/skills/development-workflow/references/complexity-guide.md +89 -0
  19. package/template/.gemini/skills/development-workflow/references/failure-handling.md +174 -0
  20. package/template/.gemini/skills/development-workflow/references/pr-template.md +80 -0
  21. package/template/.gemini/skills/development-workflow/references/sprint-init-template.md +82 -0
  22. package/template/.gemini/skills/development-workflow/references/ticket-template.md +71 -0
  23. package/template/.gemini/skills/development-workflow/references/workflow-example.md +87 -0
  24. package/template/.gemini/skills/project-memory/SKILL.md +137 -0
  25. package/template/.gemini/skills/project-memory/references/bugs_template.md +41 -0
  26. package/template/.gemini/skills/project-memory/references/decisions_template.md +67 -0
  27. package/template/.gemini/skills/project-memory/references/key_facts_template.md +81 -0
  28. package/template/docs/project_notes/pending-improvements.md +0 -50
package/README.md CHANGED
@@ -94,34 +94,59 @@ Tracks institutional knowledge across sessions in `docs/project_notes/`:
94
94
 
95
95
  ## Quick Start
96
96
 
97
- ### 1. Copy the template
97
+ ### Option A: New Project (recommended)
98
98
 
99
99
  ```bash
100
- cp -r template/ /path/to/your-project/
100
+ npx create-sdd-project my-app
101
101
  ```
102
102
 
103
- ### 2. Configure for your project
103
+ The interactive wizard guides you through:
104
+
105
+ 1. **Project basics** — name, description, business context
106
+ 2. **Tech stack** — backend (Express+Prisma+PG, Express+MongoDB, or custom), frontend (Next.js+Tailwind or custom), or both
107
+ 3. **Configuration** — AI tools (Claude/Gemini/both), autonomy level (L1-L4), branching strategy
104
108
 
105
- Look for `<!-- CONFIG: ... -->` comments in these files:
109
+ Non-interactive mode with defaults:
110
+ ```bash
111
+ npx create-sdd-project my-app --yes
112
+ ```
106
113
 
107
- | File | What to configure |
108
- |------|-------------------|
109
- | `CLAUDE.md` / `GEMINI.md` | Autonomy level (1-4) |
110
- | `ai-specs/specs/backend-standards.mdc` | Backend tech stack |
111
- | `ai-specs/specs/frontend-standards.mdc` | Frontend tech stack |
112
- | `docs/project_notes/key_facts.md` | Project name, ports, URLs, branching strategy |
113
- | `docs/specs/api-spec.yaml` | Server URLs |
114
- | `AGENTS.md` | Monorepo layout |
114
+ ### Option B: Existing Project
115
115
 
116
- ### 3. Initialize and start
116
+ Add SDD DevFlow to a project that already has code:
117
117
 
118
+ ```bash
119
+ cd your-existing-project
120
+ npx create-sdd-project --init
118
121
  ```
122
+
123
+ The `--init` flag:
124
+ - **Scans** your project: detects stack (Express, Next.js, Prisma, etc.), architecture (MVC, DDD, feature-based), tests, and existing docs
125
+ - **Adapts** standards files to match your real architecture (not generic DDD defaults)
126
+ - **Imports** existing OpenAPI/Swagger specs and references Prisma schemas
127
+ - **Audits** test coverage and suggests retrofit testing tasks if coverage is low
128
+ - **Never** modifies your existing code or overwrites existing files
129
+
130
+ ### After setup
131
+
132
+ ```
133
+ # Open in your AI coding tool and run:
119
134
  init sprint 0
120
135
  start task B0.1
121
136
  ```
122
137
 
123
138
  The workflow skill will guide you through each step with checkpoints based on your autonomy level.
124
139
 
140
+ ### Manual Setup (alternative)
141
+
142
+ If you prefer manual configuration, copy the template directly:
143
+
144
+ ```bash
145
+ cp -r template/ /path/to/your-project/
146
+ ```
147
+
148
+ Then look for `<!-- CONFIG: ... -->` comments in the files to customize.
149
+
125
150
  ## Template Structure
126
151
 
127
152
  ```
@@ -145,6 +170,12 @@ project/
145
170
 
146
171
  ├── .gemini/
147
172
  │ ├── agents/ # 9 agents (Gemini format)
173
+ │ ├── skills/
174
+ │ │ ├── development-workflow/ # Main task workflow (Steps 0-6)
175
+ │ │ │ └── references/ # Templates, guides, examples
176
+ │ │ ├── bug-workflow/ # Bug triage and resolution
177
+ │ │ └── project-memory/ # Memory system setup
178
+ │ ├── commands/ # Slash command shortcuts
148
179
  │ ├── settings.json # Gemini configuration
149
180
  │ └── styles/default.md # Response style
150
181
 
@@ -197,7 +228,7 @@ These 6 principles apply to ALL tasks, ALL agents, ALL complexity levels:
197
228
 
198
229
  - **Agent Teams**: Parallel execution of independent tasks (waiting for Claude Code Agent Teams to stabilize)
199
230
  - **PM Agent + L5 Autonomous**: AI-driven sprint orchestration with human review at sprint boundaries
200
- - **Setup Script + npx**: Interactive installer (`npx create-sdd-project`) for automated setup
231
+ - **Retrofit Testing**: Automated test generation for existing projects with low coverage
201
232
 
202
233
  ## License
203
234
 
package/bin/cli.js CHANGED
@@ -2,14 +2,24 @@
2
2
  'use strict';
3
3
 
4
4
  const fs = require('fs');
5
- const { runWizard, buildDefaultConfig } = require('../lib/wizard');
6
- const { generate } = require('../lib/generator');
5
+ const path = require('path');
7
6
 
8
7
  const args = process.argv.slice(2);
9
8
  const projectName = args.find((a) => !a.startsWith('-'));
10
9
  const useDefaults = args.includes('--yes') || args.includes('-y');
10
+ const isInit = args.includes('--init');
11
11
 
12
12
  async function main() {
13
+ if (isInit) {
14
+ return runInit();
15
+ }
16
+ return runCreate();
17
+ }
18
+
19
+ async function runCreate() {
20
+ const { runWizard, buildDefaultConfig } = require('../lib/wizard');
21
+ const { generate } = require('../lib/generator');
22
+
13
23
  let config;
14
24
 
15
25
  if (useDefaults) {
@@ -38,6 +48,48 @@ async function main() {
38
48
  generate(config);
39
49
  }
40
50
 
51
+ async function runInit() {
52
+ const { scan } = require('../lib/scanner');
53
+ const { runInitWizard, buildInitDefaultConfig } = require('../lib/init-wizard');
54
+ const { generateInit } = require('../lib/init-generator');
55
+
56
+ const cwd = process.cwd();
57
+
58
+ // Validate: must be in an existing project
59
+ if (!fs.existsSync(path.join(cwd, 'package.json'))) {
60
+ console.error('Error: No package.json found in current directory.');
61
+ console.error('The --init flag must be run from inside an existing project.');
62
+ console.error('\nTo create a new project, run: create-sdd-project <project-name>');
63
+ process.exit(1);
64
+ }
65
+
66
+ // Validate: SDD not already installed
67
+ if (fs.existsSync(path.join(cwd, 'ai-specs'))) {
68
+ console.error('Error: ai-specs/ directory already exists.');
69
+ console.error('SDD DevFlow appears to already be installed in this project.');
70
+ process.exit(1);
71
+ }
72
+
73
+ // Validate: no project name with --init
74
+ if (projectName) {
75
+ console.error('Error: Cannot specify a project name with --init.');
76
+ console.error('Usage: create-sdd-project --init');
77
+ process.exit(1);
78
+ }
79
+
80
+ // Scan the project
81
+ const scanResult = scan(cwd);
82
+
83
+ let config;
84
+ if (useDefaults) {
85
+ config = buildInitDefaultConfig(scanResult);
86
+ } else {
87
+ config = await runInitWizard(scanResult);
88
+ }
89
+
90
+ generateInit(config);
91
+ }
92
+
41
93
  main().catch((err) => {
42
94
  console.error('\nError:', err.message);
43
95
  process.exit(1);