@kaddo/cli 3.38.0 → 3.39.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 (3) hide show
  1. package/README.md +2 -0
  2. package/dist/index.js +225 -30
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -535,6 +535,8 @@ create --from roadmap → owners → guard → explain`.
535
535
  | v3.37 | Placeholder-aware readiness: knowledge files are classified missing/placeholder/weak/useful; a bootstrap file isn't treated as ready knowledge. Layers downgrade to Placeholder/Weak, a new Knowledge Refinement phase recommends the right agent, and `create --from roadmap` is never suggested with 0 candidates |
536
536
  | v3.37.1 | Unified next-step: one shared resolver (`core/next-step.ts`) powers `context`, `understand` and `explain` (Phase + Readiness) so they never diverge; agent JSON exposes `nextStepRecommendation`. Fixes duplicate `capabilities` line in explain |
537
537
  | v3.38 | Open-question source locations: `kaddo questions` shows each question's `Source` (path:line), `Status`, `Severity`, `Note` + a copy/paste resolution example and localized how-to-resolve guide; JSON/report/MCP carry `sourcePath`, `line`, `raw`, `note` |
538
+ | v3.39 | Existing capability discovery: state-aware `capabilities.md` (pre-ai/legacy = evidence-backed Capability Inventory + Gaps + Roadmap Candidate Signals; legacy adds criticality/change-risk/modernization); capability-agent discovers with evidence, roadmap-agent treats capabilities as primary source |
539
+ | v3.39.1 | Domain-oriented capability inventory: pre-ai/legacy `capabilities.md` groups capabilities under `## Capability Domains` (functional domains, not technical folders); gaps/candidates name their `Domain`; roadmap-agent reads it as a domain map; work-item-agent recommends `related_domain` + `related_capability` |
538
540
 
539
541
  **Optional modules (installed with `kaddo add`):**
540
542
 
package/dist/index.js CHANGED
@@ -2207,6 +2207,32 @@ kaddo context
2207
2207
  Especially useful for pre-AI projects, legacy projects, existing codebases with little
2208
2208
  documentation, and projects where capabilities are not explicitly documented.
2209
2209
 
2210
+ ## State-aware modes (VS-074)
2211
+
2212
+ Adapt to \`project.state\` (from \`.kaddo/config.yml\`):
2213
+
2214
+ - **new \u2192 Planned Capability Definition.** Define the capabilities the product *should* have. Use
2215
+ \`[planned]\` items; evidence is not required yet.
2216
+ - **pre-ai \u2192 Existing Capability Discovery (Domain-Oriented Capability Inventory).** Document the
2217
+ capabilities the system *already has*, **grouped by functional domain**, with **evidence**, status
2218
+ and gaps \u2014 a photograph of what exists today, not a wishlist.
2219
+ - **legacy \u2192 Legacy Capability Discovery.** Same domain-oriented inventory plus **criticality**,
2220
+ **change risk**, **operational dependency** and **modernization notes** per domain/capability.
2221
+
2222
+ ## Capability status values
2223
+
2224
+ Classify every discovered capability with exactly one status:
2225
+
2226
+ - \`implemented\` \u2014 clearly present; **must have evidence**.
2227
+ - \`partial\` \u2014 exists but incomplete.
2228
+ - \`inferred\` \u2014 likely present from indirect signals; not yet confirmed.
2229
+ - \`risky\` \u2014 exists but carries technical/operational risk.
2230
+ - \`deprecated\` \u2014 present but obsolete / being replaced.
2231
+ - \`unknown\` \u2014 not enough evidence to classify.
2232
+
2233
+ Never mark a capability \`implemented\` without evidence. When evidence is indirect, use \`inferred\`.
2234
+ When there is no evidence at all, use \`unknown\` and write \`Evidence: - pending validation\`.
2235
+
2210
2236
  ## Input Required
2211
2237
 
2212
2238
  Provide \`.kaddo/context-pack.md\` as the primary input.
@@ -2230,14 +2256,22 @@ Analyze the context pack and identify:
2230
2256
  7. Suggested ownership.
2231
2257
  8. Candidate code globs if evident.
2232
2258
 
2259
+ For **pre-ai** and **legacy**, produce the domain-oriented inventory (see Output Format): a
2260
+ \`## Capability Domains\` section where each \`### Domain:\` groups capabilities by functional
2261
+ responsibility (with Purpose + Evidence summary), each \`#### Capability:\` has status + evidence, plus
2262
+ \`## Capability Gaps\` and \`## Roadmap Candidate Signals\` (signals only \u2014 never a formal roadmap). Every
2263
+ gap and candidate names its \`Domain\` and \`Related capability\`. For **legacy**, add \`Criticality\`,
2264
+ \`Change risk\`, \`Operational dependency\` and \`Modernization notes\`.
2265
+
2233
2266
  ## Constraints
2234
2267
 
2235
2268
  - Do not invent business context.
2236
- - Mark assumptions clearly.
2269
+ - Do not invent evidence; never mark \`implemented\` without a concrete path/route/table/function.
2270
+ - Mark assumptions clearly; use \`inferred\`/\`unknown\` when evidence is missing.
2237
2271
  - Prefer "candidate capability" when evidence is incomplete.
2238
2272
  - Do not produce implementation tasks.
2239
- - Do not generate a roadmap yet.
2240
- - Do not create ADRs.
2273
+ - Do not generate a roadmap yet \u2014 only \`[gap]\` and \`[candidate]\` signals.
2274
+ - Do not create ADRs or Work Items.
2241
2275
  - Do not write code.
2242
2276
 
2243
2277
  ## Output Format
@@ -2280,6 +2314,71 @@ Generated from Kaddo Context Pack.
2280
2314
  ## Suggested Next Step
2281
2315
  \`\`\`
2282
2316
 
2317
+ ### Output Format \u2014 pre-ai / legacy (Domain-Oriented Capability Inventory)
2318
+
2319
+ Group capabilities by **functional domain**, not by technical folder. Infer domains from the system
2320
+ (e.g. Loyalty, Billing & Subscriptions, Communications, Operations & Automation) \u2014 do not use a rigid
2321
+ universal taxonomy and do not use folders like \`src/components\` or \`src/app/api\` as domains. A single
2322
+ capability may have evidence across layers (frontend hook + API route + table + webhook).
2323
+
2324
+ \`\`\`markdown
2325
+ # Existing Capabilities
2326
+
2327
+ ## Capability Domains
2328
+
2329
+ ### Domain: <Domain name>
2330
+
2331
+ **Purpose:** <functional responsibility of this domain>
2332
+
2333
+ **Evidence summary:**
2334
+ - \`<path>\` / \`<route>\` / \`<table>\` / \`<function>\`
2335
+ <!-- legacy only: -->
2336
+ **Criticality:** low | medium | high
2337
+ **Change risk:** low | medium | high
2338
+ **Operational dependency:** <...>
2339
+
2340
+ #### Capability: <Capability name>
2341
+
2342
+ - Status: implemented | partial | inferred | risky | deprecated | unknown
2343
+ - Capability type: business | product | technical | integration | operational
2344
+ - User-facing: yes | no | internal
2345
+ - Evidence:
2346
+ - \`<path/to/file>\` / \`<route>\` / \`<table>\` / \`<function>\`
2347
+ - Related flows:
2348
+ - Related data:
2349
+ - Related integrations:
2350
+ - Current behavior:
2351
+ - Known constraints:
2352
+ - Risks or uncertainty:
2353
+ - Open questions:
2354
+ - [open] ...
2355
+ <!-- legacy only, per capability: Modernization notes -->
2356
+
2357
+ ## Capability Gaps
2358
+
2359
+ - [gap] <Gap description>
2360
+ - Domain: <Domain name>
2361
+ - Related capability: <name>
2362
+ - Impact: low | medium | high
2363
+ - Possible roadmap candidate: yes | no
2364
+
2365
+ ## Roadmap Candidate Signals
2366
+
2367
+ - [candidate] <Potential roadmap candidate>
2368
+ - Domain: <Domain name>
2369
+ - Related capability: <name>
2370
+ - Based on: partial capability | gap | risk | open question | business goal
2371
+ \`\`\`
2372
+
2373
+ ### Domain grouping rules
2374
+
2375
+ - Group by **functional responsibility**, never by technical folder.
2376
+ - A capability may span multiple layers \u2014 list all its evidence.
2377
+ - Keep the VS-074 evidence rule: \`implemented\` needs concrete evidence; indirect \u2192 \`inferred\`; none \u2192
2378
+ \`unknown\`. Never invent domains, paths, routes, tables or functions.
2379
+ - Every \`[gap]\` names its \`Domain\` and \`Related capability\`; every \`[candidate]\` names \`Domain\`,
2380
+ \`Related capability\` and \`Based on\`.
2381
+
2283
2382
  ## Where to Save the Result
2284
2383
 
2285
2384
  Save the output as \`knowledge/product/capabilities.md\`.
@@ -2396,12 +2495,34 @@ Use this agent after capabilities and architecture are understood (or at least a
2396
2495
 
2397
2496
  ## Input Required
2398
2497
 
2399
- Provide \`.kaddo/context-pack.md\` as the primary input.
2498
+ Provide \`.kaddo/context-pack.md\` as the primary input, and treat
2499
+ \`knowledge/product/capabilities.md\` as the **primary source for roadmap candidates** (VS-074).
2500
+
2501
+ Read \`capabilities.md\` as a **map of functional domains** (\`## Capability Domains\`). Derive roadmap
2502
+ candidates from the inventory, prioritizing:
2503
+
2504
+ - \`partial\` capabilities (finish what exists)
2505
+ - \`## Capability Gaps\` (\`[gap]\` items, especially Impact: high)
2506
+ - \`## Roadmap Candidate Signals\` (\`[candidate]\` items)
2507
+ - \`risky\` capabilities (especially in legacy \u2014 stabilize before extending)
2508
+ - resolved/assumed/deferred open questions and business goals
2509
+ - technical risks and decision candidates
2510
+
2511
+ Each roadmap candidate should reference its \`Domain\` and \`Related capability\`, e.g.:
2512
+
2513
+ \`\`\`md
2514
+ - [candidate] Harden idempotent payment webhook processing.
2515
+ - Domain: Billing & Subscriptions
2516
+ - Related capability: Payment Webhook Processing
2517
+ - Based on: risk
2518
+ \`\`\`
2519
+
2520
+ **Do not** build a roadmap from general ideas when \`capabilities.md\` is still a placeholder or weak:
2521
+ if capabilities are not yet discovered, recommend running the \`capability-agent\` first.
2400
2522
 
2401
2523
  Optionally provide (use whatever is available; mark anything missing as an assumption or
2402
2524
  open question):
2403
2525
 
2404
- - \`knowledge/product/capabilities.md\`
2405
2526
  - \`knowledge/tech/current-state.md\`
2406
2527
  - \`knowledge/legacy/risks.md\`
2407
2528
  - \`knowledge/legacy/unknowns.md\`
@@ -2809,6 +2930,11 @@ A refined Work Item intended to be saved under the lifecycle workspace:
2809
2930
  **Open questions:**
2810
2931
 
2811
2932
  **Suggested ownership (code globs):**
2933
+
2934
+ **Related domain / capability:** <!-- recommended (VS-074/074.1): the functional domain and the
2935
+ capability from knowledge/product/capabilities.md this Work Item advances, so work traces back to the
2936
+ system's functional map. Add \`related_domain: <domain>\` and \`related_capability: <name>\` to the front
2937
+ matter when known. -->
2812
2938
  \`\`\`
2813
2939
 
2814
2940
  ## Where to Save the Result
@@ -6992,6 +7118,12 @@ function isPlaceholderLine(line) {
6992
7118
  if (/^[-*]\s+(\[[^\]]+\]\s*)?_.+_$/.test(t)) return true;
6993
7119
  if (/^[-*]\s+\[[^\]]+\]\s*$/.test(t)) return true;
6994
7120
  if (/^_(?:Describe|List|Document|What|Which|Who|Use|To be defined|No production code)\b/i.test(t)) return true;
7121
+ if (/<[^>]+>/.test(t)) return true;
7122
+ if (/^[-*]\s+[^:]+:\s*$/.test(t)) return true;
7123
+ if (/^[-*]\s+[^:]+:\s*\S.*\s\|\s/.test(t)) return true;
7124
+ if (/^\*\*[^*]+:\*\*\s*$/.test(t)) return true;
7125
+ if (/^\*\*[^*]+:\*\*\s*_.*_$/.test(t)) return true;
7126
+ if (/^\*\*[^*]+:\*\*\s*\S.*\s\|\s/.test(t)) return true;
6995
7127
  return false;
6996
7128
  }
6997
7129
  function isStructuralLine(line, inFrontMatter) {
@@ -7817,10 +7949,11 @@ function resolveNextStep(dir, now = /* @__PURE__ */ new Date()) {
7817
7949
  if (!exists(join(dir, ".kaddo", "understand.md"))) {
7818
7950
  return { id: "understand", phase: "Discovery", label: "Run `kaddo understand` to summarize the project context.", command: "kaddo understand", reason: "No understand handoff has been generated yet." };
7819
7951
  }
7820
- const refine = (id, agent, target, quality) => ({
7952
+ const discovery = state === "pre-ai" || state === "legacy";
7953
+ const refine = (id, agent, target, quality, verb = "complete") => ({
7821
7954
  id,
7822
7955
  phase: "Knowledge Refinement",
7823
- label: `Use ${agent} to complete \`${target}\`.`,
7956
+ label: `Use ${agent} to ${verb} \`${target}\`.`,
7824
7957
  agent,
7825
7958
  target,
7826
7959
  reason: `${target} is ${quality === "missing" ? "missing" : "still a bootstrap placeholder or too thin"}.`,
@@ -7832,8 +7965,10 @@ function resolveNextStep(dir, now = /* @__PURE__ */ new Date()) {
7832
7965
  });
7833
7966
  if (qBusiness !== "useful") return refine("refine-business", "business-agent", B, qBusiness);
7834
7967
  if (qProduct !== "useful" || qCap !== "useful") {
7835
- const target = qCap !== "useful" ? CAP : P;
7836
- return refine("refine-product", "capability-agent", target, qCap !== "useful" ? qCap : qProduct);
7968
+ if (qCap !== "useful") {
7969
+ return refine("refine-product", "capability-agent", CAP, qCap, discovery ? "discover and document existing system capabilities grouped by functional domains in" : "complete");
7970
+ }
7971
+ return refine("refine-product", "capability-agent", P, qProduct);
7837
7972
  }
7838
7973
  if (qCurrentState !== "useful") return refine("refine-current-state", "architecture-agent", CS, qCurrentState);
7839
7974
  if (qCodebase !== "useful") {
@@ -12157,39 +12292,99 @@ _Document the product capabilities that should exist._
12157
12292
  `,
12158
12293
  "pre-ai": `# Existing Capabilities
12159
12294
 
12160
- ## Observed capabilities
12161
-
12162
- - [observed] _Capability observed in the existing system._
12295
+ > Discover the capabilities the system already has, grouped by **functional domain** (not technical folders), evidence-backed. Use the capability-agent to fill this in \u2014 run \`kaddo add agents\`, then feed it the context pack.
12296
+
12297
+ ## Capability Domains
12298
+
12299
+ ### Domain: <Domain name>
12300
+
12301
+ **Purpose:** _What functional responsibility this domain covers._
12302
+
12303
+ **Evidence summary:**
12304
+ - _\`path\`, route, table or function._
12305
+
12306
+ #### Capability: <Capability name>
12307
+
12308
+ - Status: implemented | partial | inferred | risky | deprecated | unknown
12309
+ - Capability type: business | product | technical | integration | operational
12310
+ - User-facing: yes | no | internal
12311
+ - Evidence:
12312
+ - _\`path/to/file\`, route, table or function \u2014 or \`pending validation\`._
12313
+ - Related flows:
12314
+ - _..._
12315
+ - Related data:
12316
+ - _..._
12317
+ - Related integrations:
12318
+ - _..._
12319
+ - Current behavior:
12320
+ - _..._
12321
+ - Known constraints:
12322
+ - _..._
12323
+ - Risks or uncertainty:
12324
+ - _..._
12325
+ - Open questions:
12326
+ - [open] _..._
12327
+
12328
+ ## Capability Gaps
12329
+
12330
+ - [gap] _Gap description._
12331
+ - Domain: _<Domain name>_
12332
+ - Related capability: _<name>_
12333
+ - Impact: low | medium | high
12334
+ - Possible roadmap candidate: yes | no
12335
+
12336
+ ## Roadmap Candidate Signals
12337
+
12338
+ - [candidate] _Potential roadmap candidate._
12339
+ - Domain: _<Domain name>_
12340
+ - Related capability: _<name>_
12341
+ - Based on: partial capability | gap | risk | open question | business goal
12342
+ `,
12343
+ legacy: `# Legacy Capabilities
12163
12344
 
12164
- ## Partial capabilities
12345
+ > Discover existing capabilities grouped by **functional domain** (not technical folders), plus criticality, change risk and modernization signals. Use the capability-agent to fill this in.
12165
12346
 
12166
- - [partial] _Capability that appears incomplete or uncertain._
12347
+ ## Capability Domains
12167
12348
 
12168
- ## Assumptions
12349
+ ### Domain: <Domain name>
12169
12350
 
12170
- - [assumed] _Safe assumption to confirm later._
12351
+ **Purpose:** _What functional responsibility this domain covers._
12171
12352
 
12172
- ## Open questions
12353
+ **Criticality:** low | medium | high
12354
+ **Change risk:** low | medium | high
12355
+ **Operational dependency:** _..._
12173
12356
 
12174
- - [open] _What capability is unclear?_
12175
- `,
12176
- legacy: `# Legacy Capabilities
12177
-
12178
- ## Critical capabilities
12357
+ **Evidence summary:**
12358
+ - _\`path\`, route, table or function._
12179
12359
 
12180
- - [critical] _Capability that must keep working._
12360
+ #### Capability: <Capability name>
12181
12361
 
12182
- ## Risky capabilities
12362
+ - Status: implemented | partial | inferred | risky | deprecated | unknown
12363
+ - Capability type: business | product | technical | integration | operational
12364
+ - User-facing: yes | no | internal
12365
+ - Evidence:
12366
+ - _\`path/to/file\`, route, table or function \u2014 or \`pending validation\`._
12367
+ - Current behavior:
12368
+ - _..._
12369
+ - Modernization notes:
12370
+ - _..._
12371
+ - Open questions:
12372
+ - [open] _..._
12183
12373
 
12184
- - [risky] _Capability that is hard to change or poorly understood._
12374
+ ## Capability Gaps
12185
12375
 
12186
- ## Replacement candidates
12376
+ - [gap] _Gap description._
12377
+ - Domain: _<Domain name>_
12378
+ - Related capability: _<name>_
12379
+ - Impact: low | medium | high
12380
+ - Possible roadmap candidate: yes | no
12187
12381
 
12188
- - [candidate] _Capability that may be modernized later._
12189
-
12190
- ## Open questions
12382
+ ## Roadmap Candidate Signals
12191
12383
 
12192
- - [open] _What capability risk is unclear?_
12384
+ - [candidate] _Potential modernization or roadmap candidate._
12385
+ - Domain: _<Domain name>_
12386
+ - Related capability: _<name>_
12387
+ - Based on: partial capability | gap | risk | open question | business goal
12193
12388
  `
12194
12389
  },
12195
12390
  codebase: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kaddo/cli",
3
- "version": "3.38.0",
3
+ "version": "3.39.1",
4
4
  "description": "Knowledge Driven Development toolkit",
5
5
  "license": "MIT",
6
6
  "repository": {