@kaddo/cli 2.7.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.
Files changed (4) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +443 -0
  3. package/dist/index.js +6944 -0
  4. package/package.json +58 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Judlup Luna
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,443 @@
1
+ <p align="center">
2
+ <img src="https://raw.githubusercontent.com/Kaddo-kdd/kaddo/main/assets/banner.png" alt="Kaddo — Knowledge Driven Development Toolkit" width="100%" />
3
+ </p>
4
+
5
+ # Kaddo — Knowledge Driven Development
6
+
7
+ > Observable knowledge for evolving software with humans and AI.
8
+
9
+ Kaddo is an open source CLI toolkit based on **Knowledge Driven Development (KDD)**. It helps teams keep the minimum necessary context alive next to the code — without turning development into bureaucracy.
10
+
11
+ ## Why Kaddo
12
+
13
+ Projects fail or degrade because knowledge is scattered across meetings, chats, tickets, emails, and outdated documents. With AI, this problem gets worse: agents build on assumptions when they lack context.
14
+
15
+ Kaddo puts knowledge first, then lets AI help you build.
16
+
17
+ **The central question:** *How does Kaddo know the right knowledge was impacted by this change?*
18
+
19
+ ## What Kaddo is not
20
+
21
+ - Not a code generator
22
+ - Not an agent framework
23
+ - Not a replacement for Jira, Linear, or documentation tools
24
+ - Not a platform
25
+
26
+ Kaddo occupies a different layer:
27
+
28
+ ```
29
+ Execution tools
30
+
31
+ Agent frameworks
32
+
33
+ Specifications
34
+
35
+ Kaddo
36
+
37
+ Product knowledge
38
+ ```
39
+
40
+ ## Install
41
+
42
+ ```bash
43
+ npx @kaddo/cli init
44
+ ```
45
+
46
+ Or install globally:
47
+
48
+ ```bash
49
+ npm install -g @kaddo/cli
50
+ kaddo --help
51
+ ```
52
+
53
+ ## Commands
54
+
55
+ ### `kaddo init`
56
+
57
+ Initialize Kaddo in the current project.
58
+
59
+ ```bash
60
+ kaddo init
61
+ ```
62
+
63
+ Creates:
64
+ ```
65
+ architecture/
66
+ knowledge.md ← current state of the product
67
+ roadmap.md ← intentions and priorities
68
+ work-items/ ← one file per work item
69
+ .kaddo/
70
+ config.yml ← project config
71
+ ```
72
+
73
+ ---
74
+
75
+ ### `kaddo scan`
76
+
77
+ Detect your project stack deterministically.
78
+
79
+ ```bash
80
+ kaddo scan
81
+ ```
82
+
83
+ Detects language, framework, package manager, code dirs, migration dirs, contract files, infra and test dirs. Suggests domains for human confirmation — never assumes.
84
+
85
+ It also persists a reusable baseline of the project:
86
+
87
+ - **`.kaddo/scan.json`** — structured, machine-readable (for the CLI and future context-pack commands).
88
+ - **`architecture/inventory.md`** — human-readable inventory you can paste into an LLM chat.
89
+
90
+ Scan detects signals and asks confirmation questions — it never claims to understand your business capabilities or architecture.
91
+
92
+ ---
93
+
94
+ ## CLI + LLM Agents
95
+
96
+ Kaddo works in two layers:
97
+
98
+ - **The CLI** handles deterministic work: initializing the knowledge repository,
99
+ scanning the codebase, creating work items, reading git diff and detecting possible
100
+ knowledge drift. No AI needed.
101
+ - **Your LLM** handles interpretation: using Kaddo agents to extract capabilities,
102
+ reconstruct architecture, identify risks and propose a roadmap from the project context.
103
+
104
+ > Kaddo does not try to make the CLI "understand everything". The CLI collects and
105
+ > structures signals. The LLM agents turn those signals into product understanding.
106
+
107
+ ## From scan to knowledge baseline
108
+
109
+ `kaddo scan` gives Kaddo a technical inventory. But inventory is not understanding.
110
+
111
+ Kaddo does not start by creating tasks — it starts by understanding the state of the
112
+ project. For pre-AI and legacy projects, the next step is to turn that inventory into a
113
+ knowledge baseline using Kaddo agents in your preferred LLM chat (Claude, ChatGPT,
114
+ Cursor, Copilot, Windsurf…):
115
+
116
+ - capabilities
117
+ - modules
118
+ - risks and unknowns
119
+ - ownership candidates
120
+ - architecture notes
121
+ - roadmap candidates
122
+
123
+ Once the baseline exists and artifacts declare ownership, `create` and `guard` operate
124
+ on real context instead of starting from scratch.
125
+
126
+ ```bash
127
+ kaddo init # state: new | pre-ai | legacy, team size, structure
128
+ kaddo scan # deterministic technical inventory
129
+ kaddo context # assemble an LLM context pack for agent handoff
130
+ kaddo add agents # install agent prompt packs for your LLM chat
131
+ kaddo understand # guide the CLI → LLM handoff with a state-aware plan
132
+ # ── use your LLM with the context pack + agents to create the baseline + roadmap ──
133
+ kaddo create --from roadmap # turn a roadmap candidate into a real work item
134
+ kaddo owners suggest # declare code: ownership on the work item
135
+ kaddo guard # detect possible knowledge drift
136
+ kaddo explain # summarize what Kaddo currently knows
137
+ ```
138
+
139
+ The CLI prepares context; your LLM interprets it; Kaddo turns understanding into Work
140
+ Items; Guard warns on drift; Explain summarizes the state. Kaddo does not call an LLM.
141
+
142
+ ---
143
+
144
+ ### `kaddo context`
145
+
146
+ Assemble an LLM context pack for handoff to a chat agent (Claude, ChatGPT, Cursor, Copilot, Windsurf…).
147
+
148
+ ```bash
149
+ kaddo context
150
+ ```
151
+
152
+ Reads existing Kaddo artifacts — `.kaddo/config.yml`, `.kaddo/scan.json`,
153
+ `architecture/inventory.md`, `architecture/knowledge.md`, `architecture/roadmap.md` and
154
+ work-item front matter — and writes two files:
155
+
156
+ - **`.kaddo/context-pack.md`** — compact, LLM-friendly markdown to paste into a chat.
157
+ - **`.kaddo/context-pack.json`** — structured data for future tooling and automations.
158
+
159
+ The pack is **deterministic**. Kaddo does not call an LLM, require an API key, or
160
+ interpret your system — it assembles metadata and summaries, marks any missing context
161
+ explicitly, and recommends which agents to use based on your project state:
162
+
163
+ | State | Recommended handoff |
164
+ |---|---|
165
+ | `new` | roadmap-agent → architecture-agent |
166
+ | `pre-ai` | capability-agent → architecture-agent → roadmap-agent |
167
+ | `legacy` | legacy-agent → architecture-agent → capability-agent |
168
+
169
+ > `scan` collects technical signals. `context` packages those signals (plus knowledge and
170
+ > work items) for an LLM. `understand` ties it together — it refreshes the pack and tells
171
+ > you which agent to run next, in what order, for your project state.
172
+
173
+ ---
174
+
175
+ ### `kaddo add agents`
176
+
177
+ Install Kaddo agent prompt packs — versionable Markdown prompts you use **in your LLM
178
+ chat** (Claude, ChatGPT, Cursor, Copilot, Windsurf…). Kaddo does not execute them.
179
+
180
+ ```bash
181
+ kaddo add agents
182
+ ```
183
+
184
+ Creates `architecture/agents/` with:
185
+
186
+ - `capability-agent.md` — extract/propose system capabilities → `architecture/capabilities.md`
187
+ - `architecture-agent.md` — reconstruct the architecture baseline → `architecture/current-state.md`
188
+ - `roadmap-agent.md` — propose roadmap candidates → `architecture/roadmap.md`
189
+ - `legacy-agent.md` — surface risks/unknowns before changing legacy code
190
+ - `adr-agent.md` — propose candidate architecture decisions
191
+
192
+ Each prompt declares its role, required input, expected output, constraints, output format,
193
+ where to save the result, and a quality checklist. The primary input is always
194
+ `.kaddo/context-pack.md`.
195
+
196
+ **Workflow:**
197
+
198
+ ```bash
199
+ kaddo scan # technical signals
200
+ kaddo context # → .kaddo/context-pack.md
201
+ kaddo add agents # → architecture/agents/*.md
202
+ # then: paste context-pack.md + an agent prompt into your LLM chat
203
+ ```
204
+
205
+ Recommended agent order by project state:
206
+
207
+ | State | Order |
208
+ |---|---|
209
+ | `new` | roadmap-agent → architecture-agent |
210
+ | `pre-ai` | capability-agent → architecture-agent → roadmap-agent |
211
+ | `legacy` | legacy-agent → architecture-agent → capability-agent → roadmap-agent |
212
+
213
+ Existing agent files are never overwritten silently. `kaddo init` does not install agents —
214
+ add them only when you need them.
215
+
216
+ #### Roadmap agent output
217
+
218
+ The `roadmap-agent` is the bridge between understanding and execution. In your LLM chat it
219
+ produces a **structured** `architecture/roadmap.md`:
220
+
221
+ ```txt
222
+ context pack → roadmap agent → architecture/roadmap.md → kaddo create --from roadmap
223
+ ```
224
+
225
+ Each initiative (`RM-001`, …) includes a goal, related capabilities, impact, risk, a
226
+ suggested Knowledge Level (K1–K4), dependencies, and **candidate work items** (with type,
227
+ suggested knowledge level, expected value and notes), plus assumptions, suggested execution
228
+ order and the next recommended work item. Initiatives and work items are **candidates** for
229
+ human review — not final commitments — and priorities adapt to the project state. Turn a
230
+ candidate into a real Work Item with [`kaddo create --from roadmap`](#kaddo-create).
231
+
232
+ ---
233
+
234
+ ### `kaddo understand`
235
+
236
+ Guide the handoff from the CLI (deterministic context) to your LLM (interpretation).
237
+
238
+ ```bash
239
+ kaddo understand
240
+ ```
241
+
242
+ It refreshes the context pack, recommends which agents to use — in what order — based on
243
+ your project state, flags any agents not yet installed, and writes a reusable guide:
244
+
245
+ - **`.kaddo/context-pack.md`** / **`.kaddo/context-pack.json`** — the input for agents.
246
+ - **`.kaddo/understand.md`** — the step-by-step handoff guide (recommended flow, expected
247
+ outputs, copy/paste instructions).
248
+
249
+ `kaddo understand` is **deterministic** — it does not call an LLM, execute agents, or
250
+ auto-generate architecture artifacts. It works even when context is incomplete: if the scan
251
+ baseline or some agents are missing, it still produces a plan and tells you the next
252
+ concrete step (`kaddo scan` or `kaddo add agents`).
253
+
254
+ | State | Recommended flow |
255
+ |---|---|
256
+ | `new` | roadmap-agent → architecture-agent |
257
+ | `pre-ai` | capability-agent → architecture-agent → roadmap-agent |
258
+ | `legacy` | legacy-agent → architecture-agent → capability-agent → roadmap-agent |
259
+
260
+ ---
261
+
262
+ ### `kaddo create`
263
+
264
+ Create a Work Item with the minimum context for its Knowledge Level.
265
+
266
+ ```bash
267
+ kaddo create feature # K2: 4 questions
268
+ kaddo create bugfix # K2: 4 questions
269
+ kaddo create hotfix # K1: 2 questions
270
+ kaddo create spike # K3: 4 questions
271
+ ```
272
+
273
+ **From a roadmap candidate:**
274
+
275
+ ```bash
276
+ kaddo create --from roadmap # pick a candidate from architecture/roadmap.md
277
+ kaddo create feature --from roadmap # same, with a default type
278
+ ```
279
+
280
+ Reads `architecture/roadmap.md`, lets you select a candidate work item (`WI-CANDIDATE-001`,
281
+ …), and prefills the Work Item from the roadmap (title, type, suggested Knowledge Level,
282
+ expected value, notes, related capabilities/impact/risk/dependencies and the parent
283
+ initiative). It asks only for the required fields the candidate does not provide and keeps
284
+ source traceability in the front matter (`source: roadmap`, `source_id`, `source_initiative`).
285
+ This closes the loop `scan → context → agents → roadmap → work item`. If the roadmap is
286
+ missing or has no candidates, Kaddo shows a helpful message. No LLM is called.
287
+
288
+ **Knowledge Levels:**
289
+
290
+ | Level | When | Questions |
291
+ |---|---|---|
292
+ | K0 | Trivial change | None |
293
+ | K1 | Hotfix / simple fix | Problem + expected result |
294
+ | K2 | Feature or bugfix with functional impact | + impact + acceptance criteria |
295
+ | K3 | Capability or significant change | + design |
296
+ | K4 | Architecture change or migration | + risks |
297
+
298
+ The generated file includes front matter, Definition of Done, and a Learning section.
299
+
300
+ **To activate Guard Lite**, add code globs to the `code:` field of the generated front matter:
301
+
302
+ ```yaml
303
+ ---
304
+ type: feature
305
+ id: WI-001
306
+ code:
307
+ - src/payments/**
308
+ - src/shared/payment/**
309
+ ---
310
+ ```
311
+
312
+ ---
313
+
314
+ ### `kaddo guard`
315
+
316
+ Check if modified code has related artifacts that were not updated.
317
+
318
+ ```bash
319
+ kaddo guard # checks staged + unstaged files
320
+ kaddo guard --staged # checks only staged files
321
+ ```
322
+
323
+ Guard Lite reads `git diff`, finds artifacts with matching `code:` globs, and shows a **non-blocking FYI** if the artifact was not updated in the same diff.
324
+
325
+ ```
326
+ Touched files:
327
+ - src/payments/payments.service.ts
328
+
329
+ ⚠ Possible knowledge drift: WI-001 (feature, K2)
330
+ Changed code matching this artifact:
331
+ - src/payments/payments.service.ts
332
+ Declared ownership:
333
+ - src/payments/**
334
+ WI-001 was not updated in this diff.
335
+ Evidence: 1/1 globs matched · artifact K2 · domain: payments
336
+ Suggested action: review WI-001 and update it if the behavior changed,
337
+ or ignore this artifact below if the change does not affect the knowledge.
338
+ ```
339
+
340
+ Guard acts only on **declared ownership** (the `code:` globs) — it performs **no inference**
341
+ and is **advisory/non-blocking** (it never fails your command or CI). If the artifact was
342
+ also changed in the same diff, no FYI is shown. Guard is **silent** when no artifacts declare
343
+ ownership. No noise on day one.
344
+
345
+ ---
346
+
347
+ ## How ownership works
348
+
349
+ Ownership is declared in the front matter of each artifact — no central mapping file.
350
+
351
+ ```yaml
352
+ ---
353
+ type: feature
354
+ id: WI-001
355
+ title: "Add payment retry logic"
356
+ knowledge_level: K2
357
+ status: in-progress
358
+ code:
359
+ - src/payments/**
360
+ - src/shared/payment/**
361
+ summary: "Adds retry policy for failed payment attempts."
362
+ ---
363
+ ```
364
+
365
+ Kaddo builds a simple Knowledge Graph from these front matters at runtime:
366
+
367
+ ```
368
+ artifact → code globs → git diff intersection
369
+ ```
370
+
371
+ ### Declaring ownership with the assistant
372
+
373
+ You don't have to edit YAML by hand. The ownership assistant proposes `code:` globs and
374
+ updates the front matter for you:
375
+
376
+ ```bash
377
+ kaddo owners suggest
378
+ ```
379
+
380
+ It lists Work Items missing ownership, suggests candidate globs from `.kaddo/scan.json` and
381
+ the artifact's `domains`/`capabilities`, and lets you pick or type globs. It updates **only**
382
+ the front matter (the body is preserved), is fully **deterministic** (no LLM, no source
383
+ changes), and works with manual entry when no scan baseline exists.
384
+
385
+ ```
386
+ create work item → kaddo owners suggest → kaddo guard
387
+ ```
388
+
389
+ ---
390
+
391
+ ### `kaddo explain`
392
+
393
+ Summarize what Kaddo currently knows about the project — useful for onboarding,
394
+ handoff, project review or preparing an agent.
395
+
396
+ ```bash
397
+ kaddo explain # project explanation (human-readable)
398
+ kaddo explain --for agent # compact structured JSON
399
+ ```
400
+
401
+ Run without filters, it reports project metadata, detected stack (from
402
+ `.kaddo/scan.json`), knowledge status (inventory, context pack, capabilities,
403
+ architecture baseline, roadmap, agents), work items, **ownership coverage**, the
404
+ **missing knowledge** and **suggested next steps**. It also writes
405
+ `.kaddo/explain.md` and `.kaddo/explain.json`. No LLM is called.
406
+
407
+ `context` vs `explain`: `kaddo context` prepares input for an LLM agent;
408
+ `kaddo explain` summarizes what Kaddo already knows. The focused flags
409
+ (`--scope`, `--type`, `--since`) still explain a subset of artifacts.
410
+
411
+ ## Roadmap
412
+
413
+ The full knowledge loop ships today: `scan → context → agents → understand → roadmap →
414
+ create --from roadmap → owners → guard → explain`.
415
+
416
+ | Version | What shipped |
417
+ |---|---|
418
+ | v1.0 | `init`, `scan`, `create`, `guard` (Guard Lite) |
419
+ | v1.1 | `explain`, `status`, `learn`, Evidence Score |
420
+ | v1.2 | `classify` (Classification Drift), `history` |
421
+ | v1.4 | `guard --ci` (JSON output for CI/PR) |
422
+ | v2.0 | Optional module system (`kaddo add`) |
423
+ | v2.1 | Semantic plugins: `prisma`, `openapi` |
424
+ | v2.2 | Domain Owners (`kaddo owners`) |
425
+ | v2.3 | Multirepo Module Descriptor (`kaddo module`) |
426
+ | v2.4–2.5 | Modules: `contracts`, `capabilities`, `guard-advanced`, `agents`, `skills` |
427
+ | v2.6 | Knowledge loop: `context`, `understand`, `add agents`, roadmap output, `create --from roadmap`, Guard Lite end-to-end, `owners suggest`, project `explain` |
428
+ | v2.6 | Multirepo modules (`modules map/list`), global `standards`/`security`/`stack`/`git-strategy` artifacts, six operational agents |
429
+ | v2.6 | Central template registry (23 templates, five categories) |
430
+ | v2.6 | Demo example repositories, prompt flows and a diagram-first Visual Guide (docs) |
431
+ | v2.7 | Multirepo hardening: module artifacts from the template registry, module-aware `context`/`explain`, opt-in `guard --workspace` |
432
+
433
+ **Optional modules (installed with `kaddo add`):**
434
+
435
+ `adr` · `rfc` · `incident` · `migration` · `legacy` · `contracts` · `capabilities` · `guard-advanced` · `agents` · `skills` · `standards` · `security` · `stack` · `git-strategy`
436
+
437
+ ## Contributing
438
+
439
+ See [CONTRIBUTING.md](CONTRIBUTING.md).
440
+
441
+ ## License
442
+
443
+ MIT