@kaddo/cli 3.35.0 → 3.36.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 (3) hide show
  1. package/README.md +1 -0
  2. package/dist/index.js +428 -50
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -531,6 +531,7 @@ create --from roadmap → owners → guard → explain`.
531
531
  | v3.33 | Open questions resolution tracking: mark questions `[open]`/`[resolved]`/`[assumed]`/`[deferred]` (EN+ES); only `open` blocks readiness, so assumed/resolved/deferred decisions stop false blocks. `kaddo questions` shows status counts + `resolution_status` in JSON |
532
532
  | v3.34 | Pre-AI onboarding: `kaddo onboarding` (alias `onboard`) / `kaddo report onboarding` — read-only diagnosis of an existing project's readiness (scan/understand/knowledge/questions/roadmap/work-items/adapters) with a single recommended next step; `--json` |
533
533
  | v3.35 | Folded onboarding into `kaddo explain`: removed `kaddo onboarding`/`onboard`/`report onboarding`; project readiness + single recommended next step now live in `kaddo explain` (human `## Project Readiness` + `readiness` in agent JSON) |
534
+ | v3.36 | State-aware bootstrap: `kaddo bootstrap` creates the full knowledge baseline for any `project.state` (new/pre-ai/legacy) with state-specific templates — no more new-only warning; idempotent, never overwrites, ensures `tech/decisions/` and `delivery/work-items/` |
534
535
 
535
536
  **Optional modules (installed with `kaddo add`):**
536
537
 
package/dist/index.js CHANGED
@@ -6230,7 +6230,7 @@ ${items.map((i) => `- ${i}`).join("\n")}
6230
6230
  `;
6231
6231
  }
6232
6232
  function renderCapsuleMarkdown(c) {
6233
- const fm = [
6233
+ const fm2 = [
6234
6234
  "---",
6235
6235
  "type: knowledge-capsule",
6236
6236
  `system: ${c.system}`,
@@ -6242,7 +6242,7 @@ function renderCapsuleMarkdown(c) {
6242
6242
  "---"
6243
6243
  ].join("\n");
6244
6244
  const parts = [
6245
- fm,
6245
+ fm2,
6246
6246
  "",
6247
6247
  `# ${c.system} \u2014 Knowledge Capsule`,
6248
6248
  "",
@@ -6723,9 +6723,9 @@ var QUALITY_NOTE = {
6723
6723
  sparse: "The graph has many nodes but few meaningful edges.",
6724
6724
  empty: "The graph has almost no relationships."
6725
6725
  };
6726
- function yamlBlock(fm) {
6726
+ function yamlBlock(fm2) {
6727
6727
  const lines = ["```yaml"];
6728
- for (const [k, vals] of Object.entries(fm)) {
6728
+ for (const [k, vals] of Object.entries(fm2)) {
6729
6729
  lines.push(`${k}:`);
6730
6730
  for (const v of vals) lines.push(` - ${v}`);
6731
6731
  }
@@ -8240,9 +8240,9 @@ function readConfig(dir) {
8240
8240
  }
8241
8241
  function filterBySince(artifacts, since) {
8242
8242
  return artifacts.filter((a) => {
8243
- const fm = a;
8244
- if (!fm.created_at) return true;
8245
- return fm.created_at >= since;
8243
+ const fm2 = a;
8244
+ if (!fm2.created_at) return true;
8245
+ return fm2.created_at >= since;
8246
8246
  });
8247
8247
  }
8248
8248
  function filterByScope(artifacts, scope) {
@@ -9102,6 +9102,12 @@ function runUnderstand() {
9102
9102
  if (assessment.nextStep) {
9103
9103
  console.log(`Next step: ${assessment.nextStep}`);
9104
9104
  }
9105
+ const readiness = exp.readiness;
9106
+ if (readiness.overall === "initialized" || readiness.overall === "bootstrap-incomplete") {
9107
+ console.log("");
9108
+ console.log(`Project readiness: ${readiness.overall}.`);
9109
+ console.log(` \u2192 ${readiness.recommended_next_step.label}`);
9110
+ }
9105
9111
  const installedSkills = discoverInstalledSkills(dir);
9106
9112
  if (installedSkills.length > 0 && assessment.recommendedAgents.length > 0) {
9107
9113
  const recSkills = skillsForAgents(installedSkills, assessment.recommendedAgents);
@@ -11835,48 +11841,429 @@ function runModulesList(dir = cwd()) {
11835
11841
  console.log("");
11836
11842
  }
11837
11843
 
11844
+ // src/core/bootstrap-templates.ts
11845
+ function fm(type, state) {
11846
+ return `---
11847
+ type: ${type}
11848
+ project_state: ${state}
11849
+ ---
11850
+
11851
+ `;
11852
+ }
11853
+ var T = {
11854
+ business: {
11855
+ new: `# Business Context
11856
+
11857
+ ## Problem
11858
+
11859
+ _What problem are we solving?_
11860
+
11861
+ ## Users
11862
+
11863
+ _Who will use this product?_
11864
+
11865
+ ## Business goals
11866
+
11867
+ _What outcomes matter?_
11868
+
11869
+ ## Constraints
11870
+
11871
+ _Business, operational or regulatory constraints._
11872
+ `,
11873
+ "pre-ai": `# Business Context
11874
+
11875
+ ## What this product appears to support
11876
+
11877
+ _Describe the business purpose based on confirmed knowledge._
11878
+
11879
+ ## Users or roles
11880
+
11881
+ _List known users or roles. Mark unknowns explicitly._
11882
+
11883
+ ## Existing business rules
11884
+
11885
+ _Document confirmed business rules._
11886
+
11887
+ ## Open questions
11888
+
11889
+ - [open] _What business context still needs confirmation?_
11890
+ `,
11891
+ legacy: `# Business Context
11892
+
11893
+ ## Critical business purpose
11894
+
11895
+ _What critical business process does this system support?_
11896
+
11897
+ ## Users and operational dependency
11898
+
11899
+ _Who depends on this system?_
11900
+
11901
+ ## Business continuity constraints
11902
+
11903
+ _What cannot be interrupted?_
11904
+
11905
+ ## Open questions
11906
+
11907
+ - [open] _What business risk still needs confirmation?_
11908
+ `
11909
+ },
11910
+ product: {
11911
+ new: `# Product Context
11912
+
11913
+ ## Product vision
11914
+
11915
+ _What are we building?_
11916
+
11917
+ ## User journeys
11918
+
11919
+ _Main user journeys._
11920
+
11921
+ ## Scope
11922
+
11923
+ _What is in scope and out of scope?_
11924
+
11925
+ ## Success criteria
11926
+
11927
+ _How will we know this product is working?_
11928
+ `,
11929
+ "pre-ai": `# Product Context
11930
+
11931
+ ## Existing product behavior
11932
+
11933
+ _Describe what the product currently does._
11934
+
11935
+ ## Main flows
11936
+
11937
+ _List confirmed user or system flows._
11938
+
11939
+ ## Inferred or uncertain behavior
11940
+
11941
+ _Document uncertain behavior as assumptions, not facts._
11942
+
11943
+ ## Open questions
11944
+
11945
+ - [open] _What product behavior still needs confirmation?_
11946
+ `,
11947
+ legacy: `# Product Context
11948
+
11949
+ ## Existing behavior
11950
+
11951
+ _What does the legacy system do today?_
11952
+
11953
+ ## Critical flows
11954
+
11955
+ _Which flows are business-critical?_
11956
+
11957
+ ## Known pain points
11958
+
11959
+ _What problems are known?_
11960
+
11961
+ ## Out of scope
11962
+
11963
+ _What should not be changed yet?_
11964
+ `
11965
+ },
11966
+ capabilities: {
11967
+ new: `# Capabilities
11968
+
11969
+ ## Planned capabilities
11970
+
11971
+ - [planned] _Capability name_
11972
+
11973
+ ## Capability map
11974
+
11975
+ _Document the product capabilities that should exist._
11976
+
11977
+ ## Open questions
11978
+
11979
+ - [open] _What capability decisions are still unclear?_
11980
+ `,
11981
+ "pre-ai": `# Existing Capabilities
11982
+
11983
+ ## Observed capabilities
11984
+
11985
+ - [observed] _Capability observed in the existing system._
11986
+
11987
+ ## Partial capabilities
11988
+
11989
+ - [partial] _Capability that appears incomplete or uncertain._
11990
+
11991
+ ## Assumptions
11992
+
11993
+ - [assumed] _Safe assumption to confirm later._
11994
+
11995
+ ## Open questions
11996
+
11997
+ - [open] _What capability is unclear?_
11998
+ `,
11999
+ legacy: `# Legacy Capabilities
12000
+
12001
+ ## Critical capabilities
12002
+
12003
+ - [critical] _Capability that must keep working._
12004
+
12005
+ ## Risky capabilities
12006
+
12007
+ - [risky] _Capability that is hard to change or poorly understood._
12008
+
12009
+ ## Replacement candidates
12010
+
12011
+ - [candidate] _Capability that may be modernized later._
12012
+
12013
+ ## Open questions
12014
+
12015
+ - [open] _What capability risk is unclear?_
12016
+ `
12017
+ },
12018
+ codebase: {
12019
+ new: `# Codebase Map
12020
+
12021
+ ## Repository structure
12022
+
12023
+ _No production code yet. Describe the intended structure as it emerges._
12024
+
12025
+ ## Entry points
12026
+
12027
+ _To be defined._
12028
+
12029
+ ## How to run
12030
+
12031
+ _To be defined._
12032
+
12033
+ ## How to test
12034
+
12035
+ _To be defined._
12036
+
12037
+ ## Open questions
12038
+
12039
+ - [open] _What structural decisions are still open?_
12040
+ `,
12041
+ "pre-ai": `# Codebase Map
12042
+
12043
+ ## Repository structure
12044
+
12045
+ _Describe the main folders and their purpose._
12046
+
12047
+ ## Entry points
12048
+
12049
+ _List known entry points._
12050
+
12051
+ ## Important modules
12052
+
12053
+ _List modules or areas that appear important._
12054
+
12055
+ ## How to run
12056
+
12057
+ _Document commands to run the project._
12058
+
12059
+ ## How to test
12060
+
12061
+ _Document how this project is tested. If unknown, mark as open._
12062
+
12063
+ ## Open questions
12064
+
12065
+ - [open] _What part of the codebase still needs explanation?_
12066
+ `,
12067
+ legacy: `# Codebase Map
12068
+
12069
+ ## Repository structure
12070
+
12071
+ _Describe the main folders and their purpose._
12072
+
12073
+ ## Entry points
12074
+
12075
+ _List known entry points._
12076
+
12077
+ ## Fragile / delicate areas
12078
+
12079
+ _List modules that are risky to change._
12080
+
12081
+ ## How to run
12082
+
12083
+ _Document commands to run the project._
12084
+
12085
+ ## How to test
12086
+
12087
+ _Document how this project is tested. If unknown, mark as open._
12088
+
12089
+ ## Open questions
12090
+
12091
+ - [open] _What part of the codebase still needs explanation?_
12092
+ `
12093
+ },
12094
+ "current-state": {
12095
+ new: `# Current State
12096
+
12097
+ ## Initial technical direction
12098
+
12099
+ _What technical direction has been decided?_
12100
+
12101
+ ## Known constraints
12102
+
12103
+ _What constraints shape implementation?_
12104
+
12105
+ ## Unknowns
12106
+
12107
+ - [open] _What technical questions remain open?_
12108
+ `,
12109
+ "pre-ai": `# Current State
12110
+
12111
+ ## What exists today
12112
+
12113
+ _Describe the confirmed current state of the system._
12114
+
12115
+ ## Observed technical signals
12116
+
12117
+ _Use \`kaddo scan\` output to document language, framework, package manager, source directories and infrastructure._
12118
+
12119
+ ## Inferred architecture
12120
+
12121
+ _Document inferred architecture carefully. Mark uncertainty._
12122
+
12123
+ ## Known constraints
12124
+
12125
+ _List technical, operational, business or infrastructure constraints._
12126
+
12127
+ ## Risks of interpretation
12128
+
12129
+ _What could an agent misunderstand?_
12130
+
12131
+ ## Open questions
12132
+
12133
+ - [open] _What technical decisions still need confirmation?_
12134
+ `,
12135
+ legacy: `# Legacy Current State
12136
+
12137
+ ## Current architecture
12138
+
12139
+ _Describe the existing architecture._
12140
+
12141
+ ## Critical dependencies
12142
+
12143
+ _List systems, databases, integrations or manual operations this system depends on._
12144
+
12145
+ ## Known risks
12146
+
12147
+ _List known technical or operational risks._
12148
+
12149
+ ## Change constraints
12150
+
12151
+ _What should not be changed without validation?_
12152
+
12153
+ ## Modernization notes
12154
+
12155
+ _Initial notes about possible modernization paths._
12156
+
12157
+ ## Open questions
12158
+
12159
+ - [open] _What legacy risk still needs confirmation?_
12160
+ `
12161
+ },
12162
+ roadmap: {
12163
+ new: `# Roadmap
12164
+
12165
+ ## Now
12166
+
12167
+ _First outcomes to pursue._
12168
+
12169
+ ## Next
12170
+
12171
+ _What comes after._
12172
+
12173
+ ## Later
12174
+
12175
+ _Deferred ideas._
12176
+ `,
12177
+ "pre-ai": `# Roadmap
12178
+
12179
+ ## Now
12180
+
12181
+ _First outcomes to pursue for this existing project._
12182
+
12183
+ ## Next
12184
+
12185
+ _What comes after._
12186
+
12187
+ ## Later
12188
+
12189
+ _Deferred ideas._
12190
+ `,
12191
+ legacy: `# Modernization Roadmap
12192
+
12193
+ ## Stabilize
12194
+
12195
+ _What must be made safe first._
12196
+
12197
+ ## Modernize
12198
+
12199
+ _Controlled modernization steps._
12200
+
12201
+ ## Later
12202
+
12203
+ _Deferred modernization ideas._
12204
+ `
12205
+ }
12206
+ };
12207
+ function baselineTemplate(kind, state) {
12208
+ const st = state === "pre-ai" || state === "legacy" ? state : "new";
12209
+ return fm(kind, st) + T[kind][st];
12210
+ }
12211
+
11838
12212
  // src/commands/bootstrap.ts
11839
12213
  var CONFIG_PATH8 = ".kaddo/config.yml";
11840
- var TARGETS = [
11841
- // Minimum sufficient knowledge: one consolidated file per layer. Specialized
11842
- // artifacts (problem.md, users.md, capabilities.md, …) appear later, as the project
11843
- // matures, via agents and refinement — not at bootstrap.
11844
- { layer: "Business", path: "knowledge/business/business.md", templateId: "business" },
11845
- { layer: "Product", path: "knowledge/product/product.md", templateId: "product" },
11846
- { layer: "Tech", path: "knowledge/tech/codebase.md", templateId: "codebase" }
12214
+ var FILE_TARGETS = [
12215
+ { path: "knowledge/business/business.md", kind: "business" },
12216
+ { path: "knowledge/product/product.md", kind: "product" },
12217
+ { path: "knowledge/product/capabilities.md", kind: "capabilities" },
12218
+ { path: "knowledge/tech/codebase.md", kind: "codebase" },
12219
+ { path: "knowledge/tech/current-state.md", kind: "current-state" },
12220
+ { path: "knowledge/delivery/roadmap.md", kind: "roadmap" }
11847
12221
  ];
11848
- var BOOTSTRAP_LAYERS = ["Business", "Product", "Tech"];
12222
+ var DIR_TARGETS = ["knowledge/tech/decisions", "knowledge/delivery/work-items"];
12223
+ function withLanguageDirective(content, language) {
12224
+ if (language !== "es") return content;
12225
+ const note = "> Idioma del proyecto: **espa\xF1ol**. Escribe este conocimiento en espa\xF1ol. Mant\xE9n en ingl\xE9s el c\xF3digo, los nombres de archivo, los comandos y las claves de configuraci\xF3n.\n";
12226
+ const fm2 = content.match(/^---\n[\s\S]*?\n---\n/);
12227
+ if (fm2) return content.slice(0, fm2[0].length) + "\n" + note + content.slice(fm2[0].length);
12228
+ return `${note}
12229
+ ${content}`;
12230
+ }
11849
12231
  function bootstrap(dir) {
11850
12232
  const written = [];
11851
12233
  const skipped = [];
12234
+ const createdDirs = [];
12235
+ let state = "new";
11852
12236
  let language = "en";
11853
12237
  try {
11854
12238
  const config = loadConfig(dir);
11855
- if (config) language = projectLanguage(config);
12239
+ if (config) {
12240
+ state = config.project.state;
12241
+ language = projectLanguage(config);
12242
+ }
11856
12243
  } catch {
11857
12244
  }
11858
- for (const target of TARGETS) {
12245
+ for (const target of FILE_TARGETS) {
11859
12246
  const full = join(dir, target.path);
11860
12247
  if (exists(full)) {
11861
12248
  skipped.push(target.path);
11862
12249
  continue;
11863
12250
  }
11864
- const tpl = getTemplate(target.templateId);
11865
- const base = tpl ? tpl.content : "";
11866
- const content = withLanguageDirective(base, language);
12251
+ const content = withLanguageDirective(baselineTemplate(target.kind, state), language);
11867
12252
  writeFile(full, content.endsWith("\n") ? content : `${content}
11868
12253
  `);
11869
12254
  written.push(target.path);
11870
12255
  }
11871
- return { written, skipped, layers: BOOTSTRAP_LAYERS };
11872
- }
11873
- function withLanguageDirective(content, language) {
11874
- if (language !== "es") return content;
11875
- const note = "> Idioma del proyecto: **espa\xF1ol**. Escribe este conocimiento en espa\xF1ol. Mant\xE9n en ingl\xE9s el c\xF3digo, los nombres de archivo, los comandos y las claves de configuraci\xF3n.\n";
11876
- const fm = content.match(/^---\n[\s\S]*?\n---\n/);
11877
- if (fm) return content.slice(0, fm[0].length) + "\n" + note + content.slice(fm[0].length);
11878
- return `${note}
11879
- ${content}`;
12256
+ for (const d of DIR_TARGETS) {
12257
+ const full = join(dir, d);
12258
+ if (exists(full)) {
12259
+ skipped.push(`${d}/`);
12260
+ continue;
12261
+ }
12262
+ ensureDir(full);
12263
+ writeFile(join(full, ".gitkeep"), "");
12264
+ createdDirs.push(`${d}/`);
12265
+ }
12266
+ return { state, written, skipped, createdDirs };
11880
12267
  }
11881
12268
  async function runBootstrap(dir = cwd()) {
11882
12269
  intro2("kaddo bootstrap");
@@ -11885,46 +12272,37 @@ async function runBootstrap(dir = cwd()) {
11885
12272
  console.error("Run `kaddo init` first.");
11886
12273
  process.exit(1);
11887
12274
  }
11888
- let state = "unknown";
12275
+ let state = "new";
11889
12276
  try {
11890
12277
  const config = loadConfig(dir);
11891
- state = config?.project.state ?? "unknown";
12278
+ state = config?.project.state ?? "new";
11892
12279
  } catch (err) {
11893
- const message = err instanceof ConfigError ? err.message : String(err);
11894
- console.error(message);
12280
+ console.error(err instanceof ConfigError ? err.message : String(err));
11895
12281
  process.exit(1);
11896
12282
  }
11897
- log2.info(`Project state: ${state}`);
11898
- log2.info("Base layers: Business \u2192 Product \u2192 Tech \u2192 Delivery");
11899
- if (state !== "new") {
11900
- log2.warn("This project is not marked as new. Bootstrap is designed for new projects.");
11901
- const ok = await confirm2({ message: "Continue anyway?", initialValue: false });
11902
- if (!ok) {
11903
- outro2("Bootstrap cancelled.");
11904
- return;
11905
- }
11906
- }
12283
+ const stateLabel3 = state === "pre-ai" ? "pre-ai" : state;
12284
+ log2.info(`Project state: ${stateLabel3}`);
12285
+ log2.info(`Creating ${stateLabel3} knowledge baseline.`);
12286
+ log2.info("Existing files will not be overwritten.");
11907
12287
  const result = bootstrap(dir);
11908
12288
  console.log("");
11909
- console.log("Bootstrap layers:");
11910
- for (const layer2 of result.layers) console.log(` \u2713 ${layer2}`);
11911
- console.log("");
11912
- if (result.written.length > 0) {
12289
+ if (result.written.length > 0 || result.createdDirs.length > 0) {
11913
12290
  console.log("Created:");
11914
12291
  for (const p2 of result.written) console.log(` - ${p2}`);
12292
+ for (const d of result.createdDirs) console.log(` - ${d}`);
11915
12293
  }
11916
12294
  if (result.skipped.length > 0) {
11917
12295
  console.log("");
11918
- console.log("Kept existing (skipped):");
12296
+ console.log("Skipped (kept existing):");
11919
12297
  for (const p2 of result.skipped) console.log(` - ${p2}`);
11920
12298
  }
11921
12299
  console.log("");
11922
- console.log("");
11923
12300
  log2.info(
11924
12301
  "When you pass the context pack to your LLM/coding agent, it must never commit, push or merge without your confirmation \u2014 and create a branch before implementing."
11925
12302
  );
12303
+ printCommandFooter("bootstrap");
11926
12304
  outro2(
11927
- "Minimal knowledge base ready (Business \u2192 Product \u2192 Tech). Run `kaddo context` and `kaddo add agents`, then refine with the business-agent, bootstrap-agent and codebase-agent. Roadmap and work items come next under knowledge/delivery/."
12305
+ `${stateLabel3} knowledge baseline ready. Next: \`kaddo add agents\` (then \`kaddo add skills\`), and refine the knowledge with the relevant agents.`
11928
12306
  );
11929
12307
  }
11930
12308
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kaddo/cli",
3
- "version": "3.35.0",
3
+ "version": "3.36.0",
4
4
  "description": "Knowledge Driven Development toolkit",
5
5
  "license": "MIT",
6
6
  "repository": {