km-spec-driven-development 0.1.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 +25 -0
- package/README.md +282 -0
- package/bin/km-spec +995 -0
- package/package.json +25 -0
- package/templates/.specs/codebase/CONVENTIONS.md +125 -0
- package/templates/.specs/features/.gitkeep +0 -0
- package/templates/.specs/project/PROJECT.md +36 -0
- package/templates/.specs/project/ROADMAP.md +26 -0
- package/templates/.specs/project/STATE.md +37 -0
- package/templates/.specs/quick/.gitkeep +0 -0
- package/templates/AGENTS.md +42 -0
- package/templates/SDD.md +1873 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
<<<<<<< HEAD
|
|
4
|
+
Copyright (c) 2026 Dionatan Melo
|
|
5
|
+
=======
|
|
6
|
+
Copyright (c) 2026 KM Spec Driven Development
|
|
7
|
+
>>>>>>> 727b0ce (Refactor code structure for improved readability and maintainability)
|
|
8
|
+
|
|
9
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
10
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
11
|
+
in the Software without restriction, including without limitation the rights
|
|
12
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
13
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
14
|
+
furnished to do so, subject to the following conditions:
|
|
15
|
+
|
|
16
|
+
The above copyright notice and this permission notice shall be included in all
|
|
17
|
+
copies or substantial portions of the Software.
|
|
18
|
+
|
|
19
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
20
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
21
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
22
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
23
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
24
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
25
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,282 @@
|
|
|
1
|
+
# KM Spec Driven Development
|
|
2
|
+
|
|
3
|
+
> A lightweight Spec Driven Development CLI for AI-assisted software projects.
|
|
4
|
+
|
|
5
|
+
```
|
|
6
|
+
_ __ __ __ ____
|
|
7
|
+
| |/ /| \/ | / ___| _ __ ___ ___
|
|
8
|
+
| ' / | |\/| |____\___ \| '_ \ / _ \/ __|
|
|
9
|
+
| . \ | | | |_____|__) | |_) | __/ (__
|
|
10
|
+
|_|\_\|_| |_| |____/| .__/ \___|\___|
|
|
11
|
+
|_|
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
## What is KM Spec Driven Development?
|
|
17
|
+
|
|
18
|
+
KM Spec Driven Development (KM SDD) is a methodology and CLI tool that creates a structured, persistent layer of Markdown documentation inside any software project. It gives AI agents a stable context they can read at the start of every session — without relying on chat history or inventing details about the codebase.
|
|
19
|
+
|
|
20
|
+
The `.specs/` folder acts as the single source of truth: what the project does, who it is for, how it is built, and what is left to do.
|
|
21
|
+
|
|
22
|
+
## Why it exists
|
|
23
|
+
|
|
24
|
+
AI agents lose context between sessions. They invent APIs, duplicate work, and make undocumented decisions. KM SDD solves this by establishing a persistent spec layer that any agent — Claude Code, Codex, Cursor, Copilot, or custom CLI agents — can read before starting work.
|
|
25
|
+
|
|
26
|
+
## Supported environments
|
|
27
|
+
|
|
28
|
+
- Linux
|
|
29
|
+
- macOS
|
|
30
|
+
- WSL (Windows Subsystem for Linux)
|
|
31
|
+
- Git Bash (basic support)
|
|
32
|
+
|
|
33
|
+
**The CLI is implemented in Bash and distributed via npm.** Node.js is only used as a distribution mechanism. No Node.js runtime logic is executed.
|
|
34
|
+
|
|
35
|
+
---
|
|
36
|
+
|
|
37
|
+
## Installation
|
|
38
|
+
|
|
39
|
+
### Global install via npm
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
npm install -g km-spec-driven-development
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
### Use without installing (npx)
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
npx km-spec-driven-development init
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
### Local development
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
git clone <repo>
|
|
55
|
+
cd km-spec-driven-development
|
|
56
|
+
chmod +x bin/km-spec
|
|
57
|
+
npm link
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
---
|
|
61
|
+
|
|
62
|
+
## Usage
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
km-spec <command> [options]
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
### Initialize a new project
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
km-spec init
|
|
72
|
+
km-spec init --force # overwrite existing files
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
### Fill in project context
|
|
76
|
+
|
|
77
|
+
```bash
|
|
78
|
+
km-spec project # configure PROJECT.md
|
|
79
|
+
km-spec roadmap # configure ROADMAP.md
|
|
80
|
+
km-spec state # update STATE.md with session notes
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
### Document the technical stack
|
|
84
|
+
|
|
85
|
+
```bash
|
|
86
|
+
km-spec stack # language, framework, runtime, database
|
|
87
|
+
km-spec architecture # modules, data flow, patterns
|
|
88
|
+
km-spec structure # folder layout and file placement rules
|
|
89
|
+
km-spec testing # test framework, patterns, validation gates
|
|
90
|
+
km-spec integrations # external APIs, SDKs, webhooks
|
|
91
|
+
km-spec concerns # risks, tech debt, fragile areas
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
### Create feature specs and quick tasks
|
|
95
|
+
|
|
96
|
+
```bash
|
|
97
|
+
km-spec feature "User Authentication"
|
|
98
|
+
km-spec feature "User Authentication" --force
|
|
99
|
+
km-spec quick "Fix login validation"
|
|
100
|
+
km-spec quick "Fix login validation" --force
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
### Inspect and validate
|
|
104
|
+
|
|
105
|
+
```bash
|
|
106
|
+
km-spec status # show status of all spec files
|
|
107
|
+
km-spec doctor # validate the full SDD setup
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
---
|
|
111
|
+
|
|
112
|
+
## Generated structure
|
|
113
|
+
|
|
114
|
+
Running `km-spec init` creates:
|
|
115
|
+
|
|
116
|
+
```txt
|
|
117
|
+
.
|
|
118
|
+
├── AGENTS.md — AI agent operating instructions
|
|
119
|
+
├── SDD.md — Full methodology reference
|
|
120
|
+
└── .specs/
|
|
121
|
+
├── project/
|
|
122
|
+
│ ├── PROJECT.md — Vision, goals, users, constraints
|
|
123
|
+
│ ├── ROADMAP.md — Milestones and feature priority
|
|
124
|
+
│ └── STATE.md — Persistent session memory
|
|
125
|
+
├── codebase/
|
|
126
|
+
│ └── CONVENTIONS.md — Stack, architecture, testing, AI rules
|
|
127
|
+
├── features/
|
|
128
|
+
│ └── [feature-name]/
|
|
129
|
+
│ ├── spec.md — Requirements and acceptance criteria
|
|
130
|
+
│ ├── tasks.md — Atomic tasks with traceability
|
|
131
|
+
│ └── validation.md — Validation evidence
|
|
132
|
+
└── quick/
|
|
133
|
+
└── [task-name].md — Quick tasks and bug fixes
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
---
|
|
137
|
+
|
|
138
|
+
## How to use with different stacks
|
|
139
|
+
|
|
140
|
+
KM SDD generates only Markdown files. It never modifies source code, package managers, frameworks, or runtimes. It works with any stack.
|
|
141
|
+
|
|
142
|
+
### PHP / Laravel
|
|
143
|
+
|
|
144
|
+
```bash
|
|
145
|
+
cd my-laravel-app
|
|
146
|
+
km-spec init
|
|
147
|
+
km-spec stack # Language: PHP, Framework: Laravel, ...
|
|
148
|
+
km-spec feature "User Registration"
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
### Python / Django / FastAPI
|
|
152
|
+
|
|
153
|
+
```bash
|
|
154
|
+
cd my-python-app
|
|
155
|
+
km-spec init
|
|
156
|
+
km-spec stack # Language: Python, Framework: FastAPI, ...
|
|
157
|
+
km-spec feature "REST API Endpoints"
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
### Node.js / Express / NestJS
|
|
161
|
+
|
|
162
|
+
```bash
|
|
163
|
+
cd my-node-app
|
|
164
|
+
km-spec init
|
|
165
|
+
km-spec stack # Language: TypeScript, Runtime: Node.js, ...
|
|
166
|
+
km-spec feature "Auth Middleware"
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
### Java / Spring
|
|
170
|
+
|
|
171
|
+
```bash
|
|
172
|
+
cd my-spring-app
|
|
173
|
+
km-spec init
|
|
174
|
+
km-spec stack # Language: Java, Framework: Spring Boot, ...
|
|
175
|
+
km-spec feature "Payment Service"
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
### Android / Kotlin
|
|
179
|
+
|
|
180
|
+
```bash
|
|
181
|
+
cd my-android-app
|
|
182
|
+
km-spec init
|
|
183
|
+
km-spec stack # Language: Kotlin, Framework: Android SDK, ...
|
|
184
|
+
km-spec feature "Push Notifications"
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
### Go
|
|
188
|
+
|
|
189
|
+
```bash
|
|
190
|
+
cd my-go-app
|
|
191
|
+
km-spec init
|
|
192
|
+
km-spec stack # Language: Go, Runtime: Go 1.22, ...
|
|
193
|
+
km-spec feature "gRPC Service"
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
### .NET / C#
|
|
197
|
+
|
|
198
|
+
```bash
|
|
199
|
+
cd my-dotnet-app
|
|
200
|
+
km-spec init
|
|
201
|
+
km-spec stack # Language: C#, Framework: ASP.NET Core, ...
|
|
202
|
+
km-spec feature "Background Job Service"
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
---
|
|
206
|
+
|
|
207
|
+
## How CONVENTIONS.md consolidates technical context
|
|
208
|
+
|
|
209
|
+
Instead of creating separate files like `STACK.md`, `ARCHITECTURE.md`, or `TESTING.md`, KM SDD consolidates everything into a single file:
|
|
210
|
+
|
|
211
|
+
```txt
|
|
212
|
+
.specs/codebase/CONVENTIONS.md
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
This file has 9 sections, each updated by a dedicated CLI command:
|
|
216
|
+
|
|
217
|
+
| Section | Command |
|
|
218
|
+
|---------|---------|
|
|
219
|
+
| 1. Technical Context | `km-spec stack` |
|
|
220
|
+
| 2. Architecture | `km-spec architecture` |
|
|
221
|
+
| 3. Project Structure | `km-spec structure` |
|
|
222
|
+
| 4. Coding Standards | *(edit manually)* |
|
|
223
|
+
| 5. Testing | `km-spec testing` |
|
|
224
|
+
| 6. Integrations | `km-spec integrations` |
|
|
225
|
+
| 7. Concerns | `km-spec concerns` |
|
|
226
|
+
| 8. AI Rules | *(pre-filled by init)* |
|
|
227
|
+
| 9. Optional Expansion | *(reference only)* |
|
|
228
|
+
|
|
229
|
+
If one section becomes too large, it can optionally be extracted to a dedicated file such as `.specs/codebase/ARCHITECTURE.md`. These expansion files are never generated by default.
|
|
230
|
+
|
|
231
|
+
---
|
|
232
|
+
|
|
233
|
+
## How AI agents use the specs
|
|
234
|
+
|
|
235
|
+
The `AGENTS.md` file at the project root instructs AI agents to read three files before doing any work:
|
|
236
|
+
|
|
237
|
+
1. `.specs/project/STATE.md` — current project state and last session notes
|
|
238
|
+
2. `.specs/project/PROJECT.md` — project goals, users, and constraints
|
|
239
|
+
3. `.specs/codebase/CONVENTIONS.md` — technical rules for every line of code
|
|
240
|
+
|
|
241
|
+
For Claude Code, add this to your `CLAUDE.md`:
|
|
242
|
+
|
|
243
|
+
```markdown
|
|
244
|
+
# Development Guide
|
|
245
|
+
This project uses Spec Driven Development. See `SDD.md` for the full methodology.
|
|
246
|
+
|
|
247
|
+
Always start a session by reading `.specs/project/STATE.md`.
|
|
248
|
+
All work follows the AI Development Harness in `SDD.md` Section 7.
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
---
|
|
252
|
+
|
|
253
|
+
## Local test commands
|
|
254
|
+
|
|
255
|
+
```bash
|
|
256
|
+
chmod +x bin/km-spec
|
|
257
|
+
npm link
|
|
258
|
+
km-spec
|
|
259
|
+
km-spec help
|
|
260
|
+
km-spec init
|
|
261
|
+
km-spec project
|
|
262
|
+
km-spec stack
|
|
263
|
+
km-spec feature "User Authentication"
|
|
264
|
+
km-spec quick "Fix login validation"
|
|
265
|
+
km-spec status
|
|
266
|
+
km-spec doctor
|
|
267
|
+
```
|
|
268
|
+
|
|
269
|
+
---
|
|
270
|
+
|
|
271
|
+
## Publish to npm
|
|
272
|
+
|
|
273
|
+
```bash
|
|
274
|
+
npm login
|
|
275
|
+
npm publish
|
|
276
|
+
```
|
|
277
|
+
|
|
278
|
+
---
|
|
279
|
+
|
|
280
|
+
## License
|
|
281
|
+
|
|
282
|
+
MIT
|