@kaddo/cli 3.50.0 → 3.51.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 (2) hide show
  1. package/dist/index.js +145 -120
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -10684,10 +10684,14 @@ function buildContextPack(dir, config, now = /* @__PURE__ */ new Date()) {
10684
10684
  if (techKnowledge.discovery.legacyLocation) {
10685
10685
  missing.push("Tech discovery files are in the legacy `knowledge/tech/` root. Run `kaddo tech organize` to move them to `knowledge/tech/discovery/`.");
10686
10686
  }
10687
+ const isBootstrap = nextStepRecommendation.id === "bootstrap";
10687
10688
  const unifiedPhase = {
10688
10689
  ...phase,
10690
+ phase: isBootstrap ? "Setup" : phase.phase,
10691
+ reasons: isBootstrap ? ["The knowledge baseline is incomplete."] : phase.reasons,
10689
10692
  nextStep: nextStepRecommendation.label,
10690
- recommendedAgents: nextStepRecommendation.agent ? [nextStepRecommendation.agent] : phase.recommendedAgents
10693
+ recommendedAgents: isBootstrap ? [] : nextStepRecommendation.agent ? [nextStepRecommendation.agent] : phase.recommendedAgents,
10694
+ llmInstructions: isBootstrap ? ["Run `kaddo bootstrap` before using agent handoff.", "Do not ask an LLM to generate baseline knowledge until bootstrap files exist."] : phase.llmInstructions
10691
10695
  };
10692
10696
  const deliveryState = { ...buildDeliveryState(dir), phase: nextStepRecommendation.phase };
10693
10697
  return {
@@ -10743,9 +10747,9 @@ function buildContextPack(dir, config, now = /* @__PURE__ */ new Date()) {
10743
10747
  // VS-052/VS-073.2: the handoff is driven by the unified next step, so the pack never contradicts
10744
10748
  // the Current Phase block above it.
10745
10749
  handoff: {
10746
- recommendedAgents: unifiedPhase.recommendedAgents.length > 0 ? unifiedPhase.recommendedAgents : recommendedAgentsForState(state),
10750
+ recommendedAgents: isBootstrap ? [] : unifiedPhase.recommendedAgents.length > 0 ? unifiedPhase.recommendedAgents : recommendedAgentsForState(state),
10747
10751
  nextSteps: [nextStepRecommendation.label],
10748
- instructions: unifiedPhase.llmInstructions.length > 0 ? unifiedPhase.llmInstructions : LLM_INSTRUCTIONS,
10752
+ instructions: isBootstrap ? ["No agent handoff yet.", "Run `kaddo bootstrap` first to create the baseline files."] : unifiedPhase.llmInstructions.length > 0 ? unifiedPhase.llmInstructions : LLM_INSTRUCTIONS,
10749
10753
  operatingRules: OPERATING_RULES
10750
10754
  }
10751
10755
  };
@@ -11259,75 +11263,87 @@ function renderUnderstand(plan) {
11259
11263
  const scanNote = plan.scanAvailable ? "" : " (incomplete \u2014 run `kaddo scan` first for a richer baseline)";
11260
11264
  parts.push(`Use \`${plan.contextPackPath}\` as the primary input${scanNote}.
11261
11265
  `);
11262
- const agentPaths = [];
11263
- if (plan.recommendedPaths && plan.recommendedPaths.length > 0) {
11264
- agentPaths.push(...plan.recommendedPaths);
11265
- } else if (steps.length > 0) {
11266
- agentPaths.push(...steps.map((s) => agentInstallPath(s.agent)));
11267
- }
11268
- if (plan.recommendedSkillPaths && plan.recommendedSkillPaths.length > 0) {
11269
- agentPaths.push(...plan.recommendedSkillPaths);
11270
- }
11271
- agentPaths.push(plan.contextPackPath);
11272
- parts.push("## Agent Prompts\n");
11273
- if (agentPaths.length > 1) {
11274
- parts.push("Use:\n");
11275
- parts.push(agentPaths.map((p2) => `- \`${p2}\``).join("\n") + "\n");
11276
- } else {
11277
- parts.push(`- \`${plan.contextPackPath}\`
11266
+ if (!isBootstrap) {
11267
+ const agentPaths = [];
11268
+ if (plan.recommendedPaths && plan.recommendedPaths.length > 0) {
11269
+ agentPaths.push(...plan.recommendedPaths);
11270
+ } else if (steps.length > 0) {
11271
+ agentPaths.push(...steps.map((s) => agentInstallPath(s.agent)));
11272
+ }
11273
+ if (plan.recommendedSkillPaths && plan.recommendedSkillPaths.length > 0) {
11274
+ agentPaths.push(...plan.recommendedSkillPaths);
11275
+ }
11276
+ agentPaths.push(plan.contextPackPath);
11277
+ parts.push("## Agent Prompts\n");
11278
+ if (agentPaths.length > 1) {
11279
+ parts.push("Use:\n");
11280
+ parts.push(agentPaths.map((p2) => `- \`${p2}\``).join("\n") + "\n");
11281
+ } else {
11282
+ parts.push(`- \`${plan.contextPackPath}\`
11278
11283
  `);
11279
- }
11280
- if (steps.length > 0) {
11281
- parts.push("## Expected Outputs\n");
11282
- parts.push(steps.map((s) => `- \`${s.output}\``).join("\n") + "\n");
11283
- } else if (rec) {
11284
- parts.push("## Expected Outputs\n");
11285
- const outputs = [];
11286
- if (rec.target) outputs.push(`- \`${rec.target}\``);
11287
- if (rec.id === "refine-work-item" || rec.id === "resolve-blocker")
11288
- outputs.push("- Refined Work Item content.");
11289
- if (rec.id === "create-work-item")
11290
- outputs.push("- A new Work Item under `knowledge/delivery/work-items/`.");
11291
- if (rec.id === "implement")
11292
- outputs.push("- Implementation plan or code changes guided by the Work Item.");
11293
- if (rec.id === "guard")
11294
- outputs.push("- Updated knowledge artifacts reflecting recent code changes.");
11295
- if (rec.id === "install-adapter")
11296
- outputs.push("- An adapter configured and injected (`kaddo adapters list`).");
11297
- if (outputs.length > 0) {
11298
- parts.push("The LLM should produce:\n");
11299
- parts.push(outputs.join("\n") + "\n");
11284
+ }
11285
+ if (steps.length > 0) {
11286
+ parts.push("## Expected Outputs\n");
11287
+ parts.push(steps.map((s) => `- \`${s.output}\``).join("\n") + "\n");
11288
+ } else if (rec) {
11289
+ parts.push("## Expected Outputs\n");
11290
+ const outputs = [];
11291
+ if (rec.target) outputs.push(`- \`${rec.target}\``);
11292
+ if (rec.id === "refine-work-item" || rec.id === "resolve-blocker")
11293
+ outputs.push("- Refined Work Item content.");
11294
+ if (rec.id === "create-work-item")
11295
+ outputs.push("- A new Work Item under `knowledge/delivery/work-items/`.");
11296
+ if (rec.id === "implement")
11297
+ outputs.push("- Implementation plan or code changes guided by the Work Item.");
11298
+ if (rec.id === "guard")
11299
+ outputs.push("- Updated knowledge artifacts reflecting recent code changes.");
11300
+ if (rec.id === "install-adapter")
11301
+ outputs.push("- An adapter configured and injected (`kaddo adapters list`).");
11302
+ if (outputs.length > 0) {
11303
+ parts.push("The LLM should produce:\n");
11304
+ parts.push(outputs.join("\n") + "\n");
11305
+ } else {
11306
+ parts.push("_See the primary recommendation above._\n");
11307
+ }
11308
+ }
11309
+ parts.push("## Copy/Paste Instructions\n");
11310
+ if (steps.length > 0) {
11311
+ const first2 = steps[0];
11312
+ parts.push(
11313
+ [
11314
+ `Start with **${agentName(first2.agent)}**:`,
11315
+ "",
11316
+ "1. Open your preferred LLM chat (Claude, ChatGPT, Cursor, Copilot, Windsurf\u2026).",
11317
+ `2. Paste the context pack: \`${plan.contextPackPath}\``,
11318
+ `3. Paste the agent prompt: \`${agentInstallPath(first2.agent)}\``,
11319
+ `4. Ask the LLM to produce: \`${first2.output}\``,
11320
+ `5. Save the result in: \`${first2.output}\``
11321
+ ].join("\n") + "\n"
11322
+ );
11323
+ } else if (agentPaths.length > 1) {
11324
+ parts.push("Paste the following into your LLM chat:\n");
11325
+ parts.push(agentPaths.map((p2, i) => `${i + 1}. \`${p2}\``).join("\n") + "\n");
11326
+ if (rec?.agent) {
11327
+ parts.push(`Ask the LLM to follow the ${agentName(rec.agent)} instructions.
11328
+ `);
11329
+ }
11300
11330
  } else {
11301
- parts.push("_See the primary recommendation above._\n");
11331
+ parts.push(`Paste \`${plan.contextPackPath}\` into your LLM chat.
11332
+ `);
11302
11333
  }
11303
11334
  }
11304
- parts.push("## Copy/Paste Instructions\n");
11305
- if (steps.length > 0) {
11306
- const first2 = steps[0];
11335
+ parts.push("## Next Steps\n");
11336
+ if (isBootstrap) {
11307
11337
  parts.push(
11308
11338
  [
11309
- `Start with **${agentName(first2.agent)}**:`,
11310
- "",
11311
- "1. Open your preferred LLM chat (Claude, ChatGPT, Cursor, Copilot, Windsurf\u2026).",
11312
- `2. Paste the context pack: \`${plan.contextPackPath}\``,
11313
- `3. Paste the agent prompt: \`${agentInstallPath(first2.agent)}\``,
11314
- `4. Ask the LLM to produce: \`${first2.output}\``,
11315
- `5. Save the result in: \`${first2.output}\``
11339
+ "1. Run `kaddo bootstrap`.",
11340
+ "2. Run `kaddo add agents`.",
11341
+ "3. Run `kaddo add skills`.",
11342
+ "4. Run `kaddo context`.",
11343
+ "5. Run `kaddo understand`."
11316
11344
  ].join("\n") + "\n"
11317
11345
  );
11318
- } else if (agentPaths.length > 1) {
11319
- parts.push("Paste the following into your LLM chat:\n");
11320
- parts.push(agentPaths.map((p2, i) => `${i + 1}. \`${p2}\``).join("\n") + "\n");
11321
- if (rec?.agent) {
11322
- parts.push(`Ask the LLM to follow the ${agentName(rec.agent)} instructions.
11323
- `);
11324
- }
11325
- } else {
11326
- parts.push(`Paste \`${plan.contextPackPath}\` into your LLM chat.
11327
- `);
11328
- }
11329
- parts.push("## Next Steps\n");
11330
- if (rec) {
11346
+ } else if (rec) {
11331
11347
  const nextLines = [];
11332
11348
  nextLines.push(`1. ${rec.label}`);
11333
11349
  let n = 2;
@@ -11368,7 +11384,12 @@ function renderUnderstandTerminal(plan) {
11368
11384
  lines.push("Reason: The knowledge baseline is incomplete.");
11369
11385
  lines.push("");
11370
11386
  lines.push("Agent handoff is not ready yet.");
11371
- lines.push("Run `kaddo bootstrap` first.");
11387
+ lines.push("");
11388
+ lines.push("Run `kaddo bootstrap` first. Then run:");
11389
+ lines.push(" 1. kaddo add agents");
11390
+ lines.push(" 2. kaddo add skills");
11391
+ lines.push(" 3. kaddo context");
11392
+ lines.push(" 4. kaddo understand");
11372
11393
  } else {
11373
11394
  const first2 = steps[0];
11374
11395
  if (first2) {
@@ -11483,73 +11504,77 @@ function runUnderstand() {
11483
11504
  writeFile(join(dir, ".kaddo", "context-pack.md"), renderContextPack(pack));
11484
11505
  log2.success("Refreshed .kaddo/context-pack.md");
11485
11506
  const plan = buildUnderstandPlan(dir, config);
11486
- if (plan.missingAgents.length > 0) {
11507
+ const earlyRec = resolveNextStep(dir);
11508
+ if (earlyRec.id !== "bootstrap" && plan.missingAgents.length > 0) {
11487
11509
  log2.warn(
11488
11510
  `Agents are not installed (${plan.missingAgents.map((a) => a.replace(/\.md$/, "")).join(", ")}). Run \`kaddo add agents\`.`
11489
11511
  );
11490
11512
  }
11513
+ plan.nextStepRecommendation = earlyRec;
11491
11514
  console.log(renderUnderstandTerminal(plan));
11492
11515
  console.log(`Project language: ${pack.project.language} (knowledge artifacts are written in this language)`);
11493
11516
  const exp = buildProjectExplanation(dir);
11494
11517
  const assessment = assessPhase(exp);
11495
11518
  const rec = exp.nextStepRecommendation;
11496
- console.log("");
11497
- console.log(`Current phase: ${assessment.phase}`);
11498
- if (assessment.reasons.length > 0) {
11499
- console.log("Reason:");
11500
- for (const r of assessment.reasons) console.log(` - ${r}`);
11501
- }
11502
- if (rec.agent) console.log(`Recommended: ${rec.agent}`);
11503
- if (rec.skill) console.log(`Recommended skill: ${rec.skill}`);
11504
- console.log(`Next step: ${rec.label}`);
11505
- if (rec.reason) console.log(`Why: ${rec.reason}`);
11506
- if (rec.secondary && rec.secondary.length > 0) {
11507
- console.log("Also:");
11508
- for (const s of rec.secondary) console.log(` - ${s.label}`);
11509
- }
11510
- const installedSkills = discoverInstalledSkills(dir);
11511
- if (installedSkills.length > 0 && assessment.recommendedAgents.length > 0) {
11512
- const recSkills = skillsForAgents(installedSkills, assessment.recommendedAgents);
11513
- if (recSkills.length > 0) {
11514
- console.log("Recommended skills:");
11515
- for (const s of recSkills) console.log(` - ${s}`);
11516
- }
11517
- }
11518
- const td = exp.techDecisions;
11519
- if (td.candidates > 0 && td.adrs === 0) {
11519
+ if (earlyRec.id !== "bootstrap") {
11520
11520
  console.log("");
11521
- console.log(`Tech decisions: ${td.candidates} decision candidate(s) not yet materialized as ADRs.`);
11522
- console.log(" \u2192 Use the adr-writing skill to create ADR drafts from `knowledge/tech/decision-candidates.md`");
11523
- console.log(" into `knowledge/tech/decisions/` before implementing affected technical Work Items (`kaddo adr`).");
11524
- }
11525
- const rqi = exp.roadmapQuality.initiatives;
11526
- if (rqi.needs_refinement) {
11527
- console.log("");
11528
- console.log(`Roadmap quality: ${rqi.grounded}/${rqi.total} initiatives grounded.`);
11529
- console.log(" \u2192 Use roadmap-agent to ground roadmap initiatives in capability domains, gaps and source signals");
11530
- console.log(" before `kaddo create --from roadmap`.");
11531
- } else if (rqi.total > 0 && rqi.grounded === rqi.total && exp.roadmap.materialized_work_items === 0) {
11532
- console.log("");
11533
- console.log("Roadmap initiatives are grounded. \u2192 Run `kaddo create --from roadmap` to materialize the first Work Item.");
11534
- }
11535
- const ia = exp.installedAssets;
11536
- const outdatedRecommended = ia.agents.items.filter(
11537
- (a) => (a.state === "outdated" || a.state === "unknown-version") && assessment.recommendedAgents.includes(a.name)
11538
- );
11539
- if (outdatedRecommended.length > 0) {
11540
- console.log("");
11541
- for (const a of outdatedRecommended) {
11542
- console.log(`Recommended agent ${a.name} is ${a.state} (installed ${a.installed ?? "unknown"}, available ${a.available}).`);
11521
+ console.log(`Current phase: ${assessment.phase}`);
11522
+ if (assessment.reasons.length > 0) {
11523
+ console.log("Reason:");
11524
+ for (const r of assessment.reasons) console.log(` - ${r}`);
11525
+ }
11526
+ if (rec.agent) console.log(`Recommended: ${rec.agent}`);
11527
+ if (rec.skill) console.log(`Recommended skill: ${rec.skill}`);
11528
+ console.log(`Next step: ${rec.label}`);
11529
+ if (rec.reason) console.log(`Why: ${rec.reason}`);
11530
+ if (rec.secondary && rec.secondary.length > 0) {
11531
+ console.log("Also:");
11532
+ for (const s of rec.secondary) console.log(` - ${s.label}`);
11533
+ }
11534
+ const installedSkills = discoverInstalledSkills(dir);
11535
+ if (installedSkills.length > 0 && assessment.recommendedAgents.length > 0) {
11536
+ const recSkills = skillsForAgents(installedSkills, assessment.recommendedAgents);
11537
+ if (recSkills.length > 0) {
11538
+ console.log("Recommended skills:");
11539
+ for (const s of recSkills) console.log(` - ${s}`);
11540
+ }
11543
11541
  }
11544
- console.log(" \u2192 Run `kaddo agents update` or review `kaddo agents status`.");
11545
- }
11546
- if (exp.externalCapsules.length > 0) {
11547
- console.log("");
11548
- console.log("External knowledge:");
11549
- for (const cap of exp.externalCapsules) {
11550
- console.log(` - ${cap.system}${cap.owner ? ` (owner: ${cap.owner})` : ""}`);
11542
+ const td = exp.techDecisions;
11543
+ if (td.candidates > 0 && td.adrs === 0) {
11544
+ console.log("");
11545
+ console.log(`Tech decisions: ${td.candidates} decision candidate(s) not yet materialized as ADRs.`);
11546
+ console.log(" \u2192 Use the adr-writing skill to create ADR drafts from `knowledge/tech/decision-candidates.md`");
11547
+ console.log(" into `knowledge/tech/decisions/` before implementing affected technical Work Items (`kaddo adr`).");
11548
+ }
11549
+ const rqi = exp.roadmapQuality.initiatives;
11550
+ if (rqi.needs_refinement) {
11551
+ console.log("");
11552
+ console.log(`Roadmap quality: ${rqi.grounded}/${rqi.total} initiatives grounded.`);
11553
+ console.log(" \u2192 Use roadmap-agent to ground roadmap initiatives in capability domains, gaps and source signals");
11554
+ console.log(" before `kaddo create --from roadmap`.");
11555
+ } else if (rqi.total > 0 && rqi.grounded === rqi.total && exp.roadmap.materialized_work_items === 0) {
11556
+ console.log("");
11557
+ console.log("Roadmap initiatives are grounded. \u2192 Run `kaddo create --from roadmap` to materialize the first Work Item.");
11558
+ }
11559
+ const ia = exp.installedAssets;
11560
+ const outdatedRecommended = ia.agents.items.filter(
11561
+ (a) => (a.state === "outdated" || a.state === "unknown-version") && assessment.recommendedAgents.includes(a.name)
11562
+ );
11563
+ if (outdatedRecommended.length > 0) {
11564
+ console.log("");
11565
+ for (const a of outdatedRecommended) {
11566
+ console.log(`Recommended agent ${a.name} is ${a.state} (installed ${a.installed ?? "unknown"}, available ${a.available}).`);
11567
+ }
11568
+ console.log(" \u2192 Run `kaddo agents update` or review `kaddo agents status`.");
11569
+ }
11570
+ if (exp.externalCapsules.length > 0) {
11571
+ console.log("");
11572
+ console.log("External knowledge:");
11573
+ for (const cap of exp.externalCapsules) {
11574
+ console.log(` - ${cap.system}${cap.owner ? ` (owner: ${cap.owner})` : ""}`);
11575
+ }
11576
+ console.log(" \u2192 Review the relevant capsule before changing integration behavior with it.");
11551
11577
  }
11552
- console.log(" \u2192 Review the relevant capsule before changing integration behavior with it.");
11553
11578
  }
11554
11579
  const graphHints = loadGraphHints(dir);
11555
11580
  if (assessment.phase === "Active Delivery" && graphHints && graphHints.activeWorkItemHints > 0) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kaddo/cli",
3
- "version": "3.50.0",
3
+ "version": "3.51.0",
4
4
  "description": "Knowledge Driven Development toolkit",
5
5
  "license": "MIT",
6
6
  "repository": {