sdlc-framework 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 +321 -0
- package/bin/install.js +193 -0
- package/package.json +39 -0
- package/src/commands/close.md +200 -0
- package/src/commands/debug.md +124 -0
- package/src/commands/fast.md +149 -0
- package/src/commands/fix.md +104 -0
- package/src/commands/help.md +144 -0
- package/src/commands/hotfix.md +99 -0
- package/src/commands/impl.md +142 -0
- package/src/commands/init.md +93 -0
- package/src/commands/milestone.md +136 -0
- package/src/commands/pause.md +115 -0
- package/src/commands/research.md +136 -0
- package/src/commands/resume.md +103 -0
- package/src/commands/review.md +195 -0
- package/src/commands/spec.md +164 -0
- package/src/commands/status.md +118 -0
- package/src/commands/verify.md +153 -0
- package/src/references/clarification-strategy.md +352 -0
- package/src/references/engineering-laws.md +374 -0
- package/src/references/loop-phases.md +331 -0
- package/src/references/playwright-testing.md +298 -0
- package/src/references/prompt-detection.md +264 -0
- package/src/references/sub-agent-strategy.md +260 -0
- package/src/rules/commands.md +180 -0
- package/src/rules/style.md +354 -0
- package/src/rules/templates.md +238 -0
- package/src/rules/workflows.md +314 -0
- package/src/templates/HANDOFF.md +121 -0
- package/src/templates/LAWS.md +521 -0
- package/src/templates/PROJECT.md +112 -0
- package/src/templates/REVIEW.md +145 -0
- package/src/templates/ROADMAP.md +101 -0
- package/src/templates/SPEC.md +231 -0
- package/src/templates/STATE.md +106 -0
- package/src/templates/SUMMARY.md +126 -0
- package/src/workflows/close-phase.md +189 -0
- package/src/workflows/debug-flow.md +302 -0
- package/src/workflows/fast-forward.md +340 -0
- package/src/workflows/fix-findings.md +235 -0
- package/src/workflows/hotfix-flow.md +190 -0
- package/src/workflows/impl-phase.md +229 -0
- package/src/workflows/init-project.md +249 -0
- package/src/workflows/milestone-management.md +169 -0
- package/src/workflows/pause-work.md +153 -0
- package/src/workflows/research.md +219 -0
- package/src/workflows/resume-project.md +159 -0
- package/src/workflows/review-phase.md +337 -0
- package/src/workflows/spec-phase.md +379 -0
- package/src/workflows/transition-phase.md +203 -0
- package/src/workflows/verify-phase.md +280 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025
|
|
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,321 @@
|
|
|
1
|
+
<div align="center">
|
|
2
|
+
|
|
3
|
+
# SDLC
|
|
4
|
+
|
|
5
|
+
**Structured Development Lifecycle** — Closed-loop AI-assisted development for Claude Code.
|
|
6
|
+
|
|
7
|
+
[](LICENSE)
|
|
8
|
+
|
|
9
|
+
<br>
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
npx sdlc-framework
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
**Works on Mac, Windows, and Linux.**
|
|
16
|
+
|
|
17
|
+
<br>
|
|
18
|
+
|
|
19
|
+
*"Every step forces the next. Every law is enforced. Every loop closes."*
|
|
20
|
+
|
|
21
|
+
<br>
|
|
22
|
+
|
|
23
|
+
[Why SDLC](#why-sdlc) · [Getting Started](#getting-started) · [The Loop](#the-loop) · [Commands](#commands) · [Engineering Laws](#engineering-laws)
|
|
24
|
+
|
|
25
|
+
</div>
|
|
26
|
+
|
|
27
|
+
---
|
|
28
|
+
|
|
29
|
+
## Why SDLC
|
|
30
|
+
|
|
31
|
+
AI-assisted development has a quality problem. Research shows:
|
|
32
|
+
|
|
33
|
+
- **Context rot** — LLM accuracy drops 60% past certain thresholds (Chroma Research, 2025)
|
|
34
|
+
- **Security vulnerabilities 10x** — AI code produces 10x more security findings (Apiiro, 2025)
|
|
35
|
+
- **Rules get ignored** — Cursor, Windsurf, and other tools routinely ignore their own rules
|
|
36
|
+
- **Specs drift from code** — OpenSpec, SpecKit, and others can't keep specs and code aligned
|
|
37
|
+
- **Multi-agent chaos** — 17x compounding error rate when chaining unreliable agents (MAST, 2025)
|
|
38
|
+
- **No code review** — Most frameworks skip review entirely, shipping unchecked AI output
|
|
39
|
+
- **Manual testing** — Frameworks that include testing require humans to click through UIs
|
|
40
|
+
|
|
41
|
+
SDLC fixes all of this with five principles:
|
|
42
|
+
|
|
43
|
+
1. **Closed loop** — SPEC → IMPLEMENT → VERIFY → REVIEW → CLOSE. Every step forces the next. No orphan plans. No skipped reviews.
|
|
44
|
+
|
|
45
|
+
2. **Engineering Laws** — SOLID, DRY, YAGNI, Clean Code, Security, and Testing are enforced as blocking gates at review. Not suggestions. Laws.
|
|
46
|
+
|
|
47
|
+
3. **Automated verification** — Playwright MCP replaces manual UAT. Acceptance criteria become automated tests.
|
|
48
|
+
|
|
49
|
+
4. **Sub-agent driven development** — Implementation tasks run in parallel via dependency-ordered waves. Each agent gets the spec, the laws, and the boundaries.
|
|
50
|
+
|
|
51
|
+
5. **Clarification over assumption** — The spec phase asks questions with recommendations. No guessing. No "I assumed you wanted..."
|
|
52
|
+
|
|
53
|
+
---
|
|
54
|
+
|
|
55
|
+
## Who This Is For
|
|
56
|
+
|
|
57
|
+
**Developers using Claude Code** who want reliable, high-quality AI-assisted development.
|
|
58
|
+
|
|
59
|
+
- **Junior developers** — The framework explains every step. Follow the prompts.
|
|
60
|
+
- **Senior developers** — Engineering laws enforce the standards you care about. Fast-forward path for simple tasks.
|
|
61
|
+
- **Teams** — Consistent process across developers. Specs, reviews, and summaries create an audit trail.
|
|
62
|
+
|
|
63
|
+
---
|
|
64
|
+
|
|
65
|
+
## Getting Started
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
npx sdlc-framework
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
Choose global (all projects) or local (current project only). Verify with `/sdlc:help` in Claude Code.
|
|
72
|
+
|
|
73
|
+
### Quick Start
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
# 1. Initialize the framework
|
|
77
|
+
/sdlc:init
|
|
78
|
+
|
|
79
|
+
# 2. Define what to build (asks clarification questions)
|
|
80
|
+
/sdlc:spec
|
|
81
|
+
|
|
82
|
+
# 3. Build it (spawns parallel sub-agents)
|
|
83
|
+
/sdlc:impl
|
|
84
|
+
|
|
85
|
+
# 4. The framework forces verify → review → close automatically
|
|
86
|
+
# Just follow the NEXT ACTION REQUIRED prompts
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
### Just Tell It What To Do
|
|
90
|
+
|
|
91
|
+
```bash
|
|
92
|
+
/sdlc:fast add a loading spinner to the submit button
|
|
93
|
+
/sdlc:fast the login form crashes on empty password
|
|
94
|
+
/sdlc:fast refactor auth to use dependency injection
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
`/sdlc:fast` is the **default entry point**. Describe your work in plain language. The framework classifies it (feature, bug, refactor, etc.), estimates complexity, and either executes inline or routes to the right command. Simple work runs the full loop in one shot. Complex work routes to `/sdlc:spec` with pre-filled context.
|
|
98
|
+
|
|
99
|
+
### For Bugs
|
|
100
|
+
|
|
101
|
+
```bash
|
|
102
|
+
/sdlc:debug login form submits twice on slow connections
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
Follows: reproduce → isolate → root-cause → fix → verify.
|
|
106
|
+
|
|
107
|
+
---
|
|
108
|
+
|
|
109
|
+
## The Loop
|
|
110
|
+
|
|
111
|
+
```
|
|
112
|
+
┌──────────────────────────────────────────────────────────┐
|
|
113
|
+
│ SPEC ──→ IMPLEMENT ──→ VERIFY ──→ REVIEW ──→ CLOSE │
|
|
114
|
+
│ │ │ │
|
|
115
|
+
│ └──────────────── next cycle ←─────────────────┘ │
|
|
116
|
+
│ │
|
|
117
|
+
│ Define Build (parallel Auto-test Engineering │
|
|
118
|
+
│ work + sub-agents per (Playwright laws check │
|
|
119
|
+
│ ask Qs dependency wave) MCP + tests) (SOLID/DRY/..) │
|
|
120
|
+
└──────────────────────────────────────────────────────────┘
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
### SPEC — Define the work
|
|
124
|
+
|
|
125
|
+
- Asks clarification questions (no guessing)
|
|
126
|
+
- Presents options with trade-offs and recommendations
|
|
127
|
+
- Defines BDD acceptance criteria (Given/When/Then)
|
|
128
|
+
- Decomposes tasks with dependency graph for parallel execution
|
|
129
|
+
- **Spec integrity review** — checks completeness, consistency, feasibility
|
|
130
|
+
- **User approval gate** — spec must be explicitly approved before implementation starts
|
|
131
|
+
|
|
132
|
+
### IMPLEMENT — Build it
|
|
133
|
+
|
|
134
|
+
- Analyzes task dependencies (DAG)
|
|
135
|
+
- Spawns parallel sub-agents per wave
|
|
136
|
+
- Each agent gets: task spec, engineering laws, boundaries
|
|
137
|
+
- Tracks progress via todo list
|
|
138
|
+
|
|
139
|
+
### VERIFY — Test it
|
|
140
|
+
|
|
141
|
+
- Translates acceptance criteria to automated tests
|
|
142
|
+
- UI: Playwright MCP (navigate, click, assert)
|
|
143
|
+
- API: curl requests with assertions
|
|
144
|
+
- Logic: test suite execution
|
|
145
|
+
- Reports pass/fail per AC with evidence
|
|
146
|
+
|
|
147
|
+
### REVIEW — Check it
|
|
148
|
+
|
|
149
|
+
- Reviews all modified files against Engineering Laws
|
|
150
|
+
- Checks: SOLID, DRY, YAGNI, Clean Code, Security, Testing, Naming, Error Handling
|
|
151
|
+
- Severity levels: BLOCKER (must fix), WARNING (should fix), INFO (consider)
|
|
152
|
+
- Blockers prevent loop closure — routes to `/sdlc:fix` for systematic fixing
|
|
153
|
+
- `/sdlc:fix` analyzes fix dependencies, applies fixes (parallel where possible), auto re-reviews
|
|
154
|
+
|
|
155
|
+
### CLOSE — Ship it
|
|
156
|
+
|
|
157
|
+
- Reconciles spec vs actual implementation
|
|
158
|
+
- Records deviations, decisions, lessons
|
|
159
|
+
- Creates SUMMARY.md for audit trail
|
|
160
|
+
- Advances state to next cycle
|
|
161
|
+
|
|
162
|
+
---
|
|
163
|
+
|
|
164
|
+
## Commands
|
|
165
|
+
|
|
166
|
+
15 commands, grouped by purpose. Run `/sdlc:help` for the full reference.
|
|
167
|
+
|
|
168
|
+
### Core Loop
|
|
169
|
+
|
|
170
|
+
| Command | What it does | Forces next |
|
|
171
|
+
|---------|-------------|-------------|
|
|
172
|
+
| `/sdlc:spec` | Define work with acceptance criteria | → `/sdlc:impl` |
|
|
173
|
+
| `/sdlc:impl` | Build via parallel sub-agents | → `/sdlc:verify` |
|
|
174
|
+
| `/sdlc:verify` | Automated testing (Playwright MCP) | → `/sdlc:review` |
|
|
175
|
+
| `/sdlc:review` | Engineering laws compliance check | → `/sdlc:close` |
|
|
176
|
+
| `/sdlc:close` | Reconcile and close the loop | → `/sdlc:spec` |
|
|
177
|
+
|
|
178
|
+
### Quick Entry
|
|
179
|
+
|
|
180
|
+
| Command | What it does |
|
|
181
|
+
|---------|-------------|
|
|
182
|
+
| `/sdlc:fast <desc>` | **Default entry point.** Describe work → framework classifies, routes, or executes inline |
|
|
183
|
+
|
|
184
|
+
### Fix & Debug
|
|
185
|
+
|
|
186
|
+
| Command | What it does |
|
|
187
|
+
|---------|-------------|
|
|
188
|
+
| `/sdlc:fix` | Fix review blockers systematically, auto re-review |
|
|
189
|
+
| `/sdlc:debug <issue>` | Structured debugging: reproduce → isolate → fix → verify |
|
|
190
|
+
| `/sdlc:hotfix <issue>` | Emergency fix with minimal ceremony |
|
|
191
|
+
|
|
192
|
+
### Session
|
|
193
|
+
|
|
194
|
+
| Command | What it does |
|
|
195
|
+
|---------|-------------|
|
|
196
|
+
| `/sdlc:pause` | Save context for break |
|
|
197
|
+
| `/sdlc:resume` | Restore context, ONE next action |
|
|
198
|
+
| `/sdlc:status` | Show position + forced next action |
|
|
199
|
+
|
|
200
|
+
### Setup
|
|
201
|
+
|
|
202
|
+
| Command | What it does |
|
|
203
|
+
|---------|-------------|
|
|
204
|
+
| `/sdlc:init` | Initialize framework in project |
|
|
205
|
+
| `/sdlc:milestone` | Create or complete milestones |
|
|
206
|
+
| `/sdlc:research` | Deploy research sub-agents |
|
|
207
|
+
| `/sdlc:help` | Show command reference |
|
|
208
|
+
|
|
209
|
+
---
|
|
210
|
+
|
|
211
|
+
## Engineering Laws
|
|
212
|
+
|
|
213
|
+
Laws are enforced at `/sdlc:review`. Violations at `error` severity block `/sdlc:close`.
|
|
214
|
+
|
|
215
|
+
| Law | Default | What it enforces |
|
|
216
|
+
|-----|---------|-----------------|
|
|
217
|
+
| **SOLID** | error | Single Responsibility, Open/Closed, Liskov, Interface Segregation, Dependency Inversion |
|
|
218
|
+
| **DRY** | error | Search before create. No duplicate logic (3+ similar lines) |
|
|
219
|
+
| **YAGNI** | error | Only build what's in the spec. No speculative features |
|
|
220
|
+
| **CLEAN_CODE** | error | Max 40 lines/function, max 3 params, max 3 nesting levels |
|
|
221
|
+
| **SECURITY** | error | No hardcoded secrets, input validation, parameterized queries |
|
|
222
|
+
| **TESTING** | error | Every behavior change needs tests with meaningful assertions |
|
|
223
|
+
| **NAMING** | warning | Descriptive names, no abbreviations, self-documenting code |
|
|
224
|
+
| **ERROR_HANDLING** | error | No empty catch blocks, domain-specific exceptions, no swallowed errors |
|
|
225
|
+
|
|
226
|
+
Severity is configurable per project in `.sdlc/LAWS.md`:
|
|
227
|
+
- `error` — Blocks loop closure. Must fix.
|
|
228
|
+
- `warning` — Reported in review. Should fix.
|
|
229
|
+
- `info` — Noted only. Consider fixing.
|
|
230
|
+
|
|
231
|
+
---
|
|
232
|
+
|
|
233
|
+
## Project Structure
|
|
234
|
+
|
|
235
|
+
```
|
|
236
|
+
.sdlc/
|
|
237
|
+
├── PROJECT.md # Project context and requirements
|
|
238
|
+
├── STATE.md # Loop position + forced next action
|
|
239
|
+
├── ROADMAP.md # Milestones and phases
|
|
240
|
+
├── LAWS.md # Engineering laws (configurable severity)
|
|
241
|
+
├── phases/
|
|
242
|
+
│ └── 01-phase-name/
|
|
243
|
+
│ ├── 01-01-SPEC.md
|
|
244
|
+
│ ├── 01-01-REVIEW.md
|
|
245
|
+
│ └── 01-01-SUMMARY.md
|
|
246
|
+
└── research/ # Sub-agent research output
|
|
247
|
+
```
|
|
248
|
+
|
|
249
|
+
---
|
|
250
|
+
|
|
251
|
+
## How It Differs
|
|
252
|
+
|
|
253
|
+
### vs. PAUL
|
|
254
|
+
|
|
255
|
+
| Aspect | PAUL | SDLC |
|
|
256
|
+
|--------|------|------|
|
|
257
|
+
| Commands | 26 (cognitive overload) | 15 (focused) |
|
|
258
|
+
| Testing | Manual UAT | Automated (Playwright MCP) |
|
|
259
|
+
| Code review | None | Engineering Laws enforcement |
|
|
260
|
+
| Implementation | In-session | Sub-agent parallel waves |
|
|
261
|
+
| Next action | Suggested | **Forced** |
|
|
262
|
+
| Engineering standards | None | SOLID/DRY/YAGNI as blocking gates |
|
|
263
|
+
| Fast path | None | `/sdlc:fast` for small tasks |
|
|
264
|
+
| Debugging | None | `/sdlc:debug` structured flow |
|
|
265
|
+
|
|
266
|
+
### vs. GSD / Speckit / OpenSpec
|
|
267
|
+
|
|
268
|
+
| Problem | Others | SDLC |
|
|
269
|
+
|---------|--------|------|
|
|
270
|
+
| Context rot | No mitigation | Session budget tracking, forced pause |
|
|
271
|
+
| Rules ignored | Prompt-only | Post-generation validation at review |
|
|
272
|
+
| Spec drift | Manual reconciliation | Automated close-loop reconciliation |
|
|
273
|
+
| Security | Hope-based | Scanning as blocking gate |
|
|
274
|
+
| Multi-agent errors | 17x compounding | Dependency-ordered waves, bounded scope |
|
|
275
|
+
| Brownfield support | Greenfield focus | Incremental adoption, existing codebase first |
|
|
276
|
+
|
|
277
|
+
---
|
|
278
|
+
|
|
279
|
+
## Installation Options
|
|
280
|
+
|
|
281
|
+
```bash
|
|
282
|
+
npx sdlc-framework # Interactive (choose global/local)
|
|
283
|
+
npx sdlc-framework --global # Install to ~/.claude/
|
|
284
|
+
npx sdlc-framework --local # Install to ./.claude/
|
|
285
|
+
npx sdlc-framework --global --config-dir ~/.claude-custom
|
|
286
|
+
```
|
|
287
|
+
|
|
288
|
+
### Staying Updated
|
|
289
|
+
|
|
290
|
+
```bash
|
|
291
|
+
npx sdlc-framework@latest
|
|
292
|
+
```
|
|
293
|
+
|
|
294
|
+
---
|
|
295
|
+
|
|
296
|
+
## Troubleshooting
|
|
297
|
+
|
|
298
|
+
**Commands not found?**
|
|
299
|
+
- Restart Claude Code to reload slash commands
|
|
300
|
+
- Verify files exist in `~/.claude/commands/sdlc/`
|
|
301
|
+
|
|
302
|
+
**Loop position seems wrong?**
|
|
303
|
+
- Run `/sdlc:status` for current state
|
|
304
|
+
- Check `.sdlc/STATE.md` directly
|
|
305
|
+
|
|
306
|
+
**Resuming after a break?**
|
|
307
|
+
- Run `/sdlc:resume` — it reads state and handoffs automatically
|
|
308
|
+
|
|
309
|
+
---
|
|
310
|
+
|
|
311
|
+
## License
|
|
312
|
+
|
|
313
|
+
MIT License. See [LICENSE](LICENSE) for details.
|
|
314
|
+
|
|
315
|
+
---
|
|
316
|
+
|
|
317
|
+
<div align="center">
|
|
318
|
+
|
|
319
|
+
**AI writes code. SDLC makes it reliable.**
|
|
320
|
+
|
|
321
|
+
</div>
|
package/bin/install.js
ADDED
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const fs = require('fs')
|
|
4
|
+
const path = require('path')
|
|
5
|
+
const os = require('os')
|
|
6
|
+
const readline = require('readline')
|
|
7
|
+
|
|
8
|
+
const cyan = '\x1b[36m'
|
|
9
|
+
const green = '\x1b[32m'
|
|
10
|
+
const yellow = '\x1b[33m'
|
|
11
|
+
const dim = '\x1b[2m'
|
|
12
|
+
const reset = '\x1b[0m'
|
|
13
|
+
|
|
14
|
+
const pkg = require('../package.json')
|
|
15
|
+
|
|
16
|
+
const banner = `
|
|
17
|
+
${cyan} ███████╗██████╗ ██╗ ██████╗
|
|
18
|
+
██╔════╝██╔══██╗██║ ██╔════╝
|
|
19
|
+
███████╗██║ ██║██║ ██║
|
|
20
|
+
╚════██║██║ ██║██║ ██║
|
|
21
|
+
███████║██████╔╝███████╗╚██████╗
|
|
22
|
+
╚══════╝╚═════╝ ╚══════╝ ╚═════╝${reset}
|
|
23
|
+
|
|
24
|
+
SDLC Framework ${dim}v${pkg.version}${reset}
|
|
25
|
+
Structured Development Lifecycle for Claude Code
|
|
26
|
+
`
|
|
27
|
+
|
|
28
|
+
const args = process.argv.slice(2)
|
|
29
|
+
const hasGlobal = args.includes('--global') || args.includes('-g')
|
|
30
|
+
const hasLocal = args.includes('--local') || args.includes('-l')
|
|
31
|
+
|
|
32
|
+
function parseConfigDirArg() {
|
|
33
|
+
const idx = args.findIndex(a => a === '--config-dir' || a === '-c')
|
|
34
|
+
if (idx !== -1) {
|
|
35
|
+
const next = args[idx + 1]
|
|
36
|
+
if (!next || next.startsWith('-')) {
|
|
37
|
+
console.error(` ${yellow}--config-dir requires a path argument${reset}`)
|
|
38
|
+
process.exit(1)
|
|
39
|
+
}
|
|
40
|
+
return next
|
|
41
|
+
}
|
|
42
|
+
const eqArg = args.find(a => a.startsWith('--config-dir=') || a.startsWith('-c='))
|
|
43
|
+
if (eqArg) return eqArg.split('=')[1]
|
|
44
|
+
return null
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
const explicitConfigDir = parseConfigDirArg()
|
|
48
|
+
const hasHelp = args.includes('--help') || args.includes('-h')
|
|
49
|
+
|
|
50
|
+
console.log(banner)
|
|
51
|
+
|
|
52
|
+
if (hasHelp) {
|
|
53
|
+
console.log(` ${yellow}Usage:${reset} npx sdlc-framework [options]
|
|
54
|
+
|
|
55
|
+
${yellow}Options:${reset}
|
|
56
|
+
${cyan}-g, --global${reset} Install globally (to Claude config directory)
|
|
57
|
+
${cyan}-l, --local${reset} Install locally (to ./.claude in current directory)
|
|
58
|
+
${cyan}-c, --config-dir <path>${reset} Specify custom Claude config directory
|
|
59
|
+
${cyan}-h, --help${reset} Show this help message
|
|
60
|
+
|
|
61
|
+
${yellow}Examples:${reset}
|
|
62
|
+
${dim}# Install to default ~/.claude directory${reset}
|
|
63
|
+
npx sdlc-framework --global
|
|
64
|
+
|
|
65
|
+
${dim}# Install to custom config directory${reset}
|
|
66
|
+
npx sdlc-framework --global --config-dir ~/.claude-custom
|
|
67
|
+
|
|
68
|
+
${dim}# Install to current project only${reset}
|
|
69
|
+
npx sdlc-framework --local
|
|
70
|
+
|
|
71
|
+
${yellow}What gets installed:${reset}
|
|
72
|
+
commands/sdlc/ - Slash commands (/sdlc:init, /sdlc:spec, etc.)
|
|
73
|
+
sdlc-framework/ - Templates, workflows, references, rules
|
|
74
|
+
`)
|
|
75
|
+
process.exit(0)
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
function expandTilde(filePath) {
|
|
79
|
+
if (filePath && filePath.startsWith('~/')) {
|
|
80
|
+
return path.join(os.homedir(), filePath.slice(2))
|
|
81
|
+
}
|
|
82
|
+
return filePath
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
function copyWithPathReplacement(srcDir, destDir, pathPrefix) {
|
|
86
|
+
fs.mkdirSync(destDir, { recursive: true })
|
|
87
|
+
const entries = fs.readdirSync(srcDir, { withFileTypes: true })
|
|
88
|
+
|
|
89
|
+
for (const entry of entries) {
|
|
90
|
+
const srcPath = path.join(srcDir, entry.name)
|
|
91
|
+
const destPath = path.join(destDir, entry.name)
|
|
92
|
+
|
|
93
|
+
if (entry.isDirectory()) {
|
|
94
|
+
copyWithPathReplacement(srcPath, destPath, pathPrefix)
|
|
95
|
+
} else if (entry.name.endsWith('.md')) {
|
|
96
|
+
let content = fs.readFileSync(srcPath, 'utf8')
|
|
97
|
+
content = content.replace(/~\/\.claude\//g, pathPrefix)
|
|
98
|
+
fs.writeFileSync(destPath, content)
|
|
99
|
+
} else {
|
|
100
|
+
fs.copyFileSync(srcPath, destPath)
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
function install(isGlobal) {
|
|
106
|
+
const src = path.join(__dirname, '..')
|
|
107
|
+
const configDir = expandTilde(explicitConfigDir) || expandTilde(process.env.CLAUDE_CONFIG_DIR)
|
|
108
|
+
const defaultGlobalDir = configDir || path.join(os.homedir(), '.claude')
|
|
109
|
+
const claudeDir = isGlobal ? defaultGlobalDir : path.join(process.cwd(), '.claude')
|
|
110
|
+
|
|
111
|
+
const locationLabel = isGlobal
|
|
112
|
+
? claudeDir.replace(os.homedir(), '~')
|
|
113
|
+
: claudeDir.replace(process.cwd(), '.')
|
|
114
|
+
|
|
115
|
+
const pathPrefix = isGlobal
|
|
116
|
+
? (configDir ? `${claudeDir}/` : '~/.claude/')
|
|
117
|
+
: './.claude/'
|
|
118
|
+
|
|
119
|
+
console.log(` Installing to ${cyan}${locationLabel}${reset}\n`)
|
|
120
|
+
|
|
121
|
+
const commandsDir = path.join(claudeDir, 'commands')
|
|
122
|
+
fs.mkdirSync(commandsDir, { recursive: true })
|
|
123
|
+
|
|
124
|
+
const commandsSrc = path.join(src, 'src', 'commands')
|
|
125
|
+
const commandsDest = path.join(commandsDir, 'sdlc')
|
|
126
|
+
copyWithPathReplacement(commandsSrc, commandsDest, pathPrefix)
|
|
127
|
+
console.log(` ${green}✓${reset} Installed commands/sdlc`)
|
|
128
|
+
|
|
129
|
+
const skillDest = path.join(claudeDir, 'sdlc-framework')
|
|
130
|
+
fs.mkdirSync(skillDest, { recursive: true })
|
|
131
|
+
|
|
132
|
+
const srcDirs = ['templates', 'workflows', 'references', 'rules']
|
|
133
|
+
for (const dir of srcDirs) {
|
|
134
|
+
const dirSrc = path.join(src, 'src', dir)
|
|
135
|
+
const dirDest = path.join(skillDest, dir)
|
|
136
|
+
if (fs.existsSync(dirSrc)) {
|
|
137
|
+
copyWithPathReplacement(dirSrc, dirDest, pathPrefix)
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
console.log(` ${green}✓${reset} Installed sdlc-framework`)
|
|
141
|
+
|
|
142
|
+
console.log(`
|
|
143
|
+
${green}Done!${reset} Launch Claude Code and run ${cyan}/sdlc:help${reset}.
|
|
144
|
+
|
|
145
|
+
${yellow}Quick start:${reset}
|
|
146
|
+
${dim}1.${reset} /sdlc:init ${dim}— Initialize project${reset}
|
|
147
|
+
${dim}2.${reset} /sdlc:spec ${dim}— Define what to build${reset}
|
|
148
|
+
${dim}3.${reset} /sdlc:impl ${dim}— Build it (sub-agent parallel)${reset}
|
|
149
|
+
${dim}4.${reset} /sdlc:verify ${dim}— Playwright auto-test${reset}
|
|
150
|
+
${dim}5.${reset} /sdlc:review ${dim}— Engineering laws check${reset}
|
|
151
|
+
${dim}6.${reset} /sdlc:close ${dim}— Close the loop${reset}
|
|
152
|
+
|
|
153
|
+
${dim}Or for small tasks:${reset} /sdlc:fast "add logout button"
|
|
154
|
+
`)
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
function promptLocation() {
|
|
158
|
+
const rl = readline.createInterface({
|
|
159
|
+
input: process.stdin,
|
|
160
|
+
output: process.stdout
|
|
161
|
+
})
|
|
162
|
+
|
|
163
|
+
const configDir = expandTilde(explicitConfigDir) || expandTilde(process.env.CLAUDE_CONFIG_DIR)
|
|
164
|
+
const globalPath = configDir || path.join(os.homedir(), '.claude')
|
|
165
|
+
const globalLabel = globalPath.replace(os.homedir(), '~')
|
|
166
|
+
|
|
167
|
+
console.log(` ${yellow}Where would you like to install?${reset}
|
|
168
|
+
|
|
169
|
+
${cyan}1${reset}) Global ${dim}(${globalLabel})${reset} — available in all projects
|
|
170
|
+
${cyan}2${reset}) Local ${dim}(./.claude)${reset} — this project only
|
|
171
|
+
`)
|
|
172
|
+
|
|
173
|
+
rl.question(` Choice ${dim}[1]${reset}: `, (answer) => {
|
|
174
|
+
rl.close()
|
|
175
|
+
const choice = answer.trim() || '1'
|
|
176
|
+
const isGlobal = choice !== '2'
|
|
177
|
+
install(isGlobal)
|
|
178
|
+
})
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
if (hasGlobal && hasLocal) {
|
|
182
|
+
console.error(` ${yellow}Cannot specify both --global and --local${reset}`)
|
|
183
|
+
process.exit(1)
|
|
184
|
+
} else if (explicitConfigDir && hasLocal) {
|
|
185
|
+
console.error(` ${yellow}Cannot use --config-dir with --local${reset}`)
|
|
186
|
+
process.exit(1)
|
|
187
|
+
} else if (hasGlobal) {
|
|
188
|
+
install(true)
|
|
189
|
+
} else if (hasLocal) {
|
|
190
|
+
install(false)
|
|
191
|
+
} else {
|
|
192
|
+
promptLocation()
|
|
193
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "sdlc-framework",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Structured Development Lifecycle - A closed-loop AI-assisted development framework for Claude Code",
|
|
5
|
+
"bin": {
|
|
6
|
+
"sdlc-framework": "bin/install.js"
|
|
7
|
+
},
|
|
8
|
+
"files": [
|
|
9
|
+
"bin",
|
|
10
|
+
"src/commands",
|
|
11
|
+
"src/templates",
|
|
12
|
+
"src/references",
|
|
13
|
+
"src/workflows",
|
|
14
|
+
"src/rules"
|
|
15
|
+
],
|
|
16
|
+
"keywords": [
|
|
17
|
+
"claude",
|
|
18
|
+
"claude-code",
|
|
19
|
+
"sdlc",
|
|
20
|
+
"ai",
|
|
21
|
+
"structured-development",
|
|
22
|
+
"engineering-laws",
|
|
23
|
+
"code-review",
|
|
24
|
+
"playwright",
|
|
25
|
+
"sub-agent",
|
|
26
|
+
"solid",
|
|
27
|
+
"dry",
|
|
28
|
+
"yagni"
|
|
29
|
+
],
|
|
30
|
+
"author": "nadyshalaby",
|
|
31
|
+
"license": "MIT",
|
|
32
|
+
"repository": {
|
|
33
|
+
"type": "git",
|
|
34
|
+
"url": ""
|
|
35
|
+
},
|
|
36
|
+
"engines": {
|
|
37
|
+
"node": ">=16.7.0"
|
|
38
|
+
}
|
|
39
|
+
}
|