@kaddo/cli 3.51.0 → 3.53.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/dist/index.js +156 -96
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -4643,6 +4643,7 @@ var RECOMMENDED_BY_STATE = {
|
|
|
4643
4643
|
"adr-agent.md"
|
|
4644
4644
|
],
|
|
4645
4645
|
"pre-ai": [
|
|
4646
|
+
"business-agent.md",
|
|
4646
4647
|
"capability-agent.md",
|
|
4647
4648
|
"architecture-agent.md",
|
|
4648
4649
|
"roadmap-agent.md",
|
|
@@ -8856,23 +8857,33 @@ function resolveNextStep(dir, now = /* @__PURE__ */ new Date()) {
|
|
|
8856
8857
|
if (!exists(join(dir, ".kaddo", "context-pack.md"))) {
|
|
8857
8858
|
return { id: "context", phase: "Discovery", label: "Run `kaddo context` to prepare the LLM context pack.", command: "kaddo context", reason: "No context pack has been generated yet." };
|
|
8858
8859
|
}
|
|
8859
|
-
if (!exists(join(dir, ".kaddo", "understand.md"))) {
|
|
8860
|
-
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." };
|
|
8861
|
-
}
|
|
8862
8860
|
const discovery = state === "pre-ai" || state === "legacy";
|
|
8863
|
-
const
|
|
8864
|
-
|
|
8865
|
-
|
|
8866
|
-
|
|
8867
|
-
|
|
8868
|
-
|
|
8869
|
-
|
|
8870
|
-
|
|
8871
|
-
|
|
8872
|
-
|
|
8873
|
-
|
|
8874
|
-
|
|
8875
|
-
|
|
8861
|
+
const resolveAgent = (agent) => {
|
|
8862
|
+
const file = agent.endsWith(".md") ? agent : `${agent}.md`;
|
|
8863
|
+
const path6 = agentInstallPath(file);
|
|
8864
|
+
const installed = isFile(join(dir, path6));
|
|
8865
|
+
const group = agentGroupOf(file);
|
|
8866
|
+
return { agentPath: path6, agentInstalled: installed, installCommand: installed ? void 0 : `kaddo add agents --group ${group}` };
|
|
8867
|
+
};
|
|
8868
|
+
const refine = (id, agent, target, quality, verb = "complete") => {
|
|
8869
|
+
const ar = resolveAgent(agent);
|
|
8870
|
+
return {
|
|
8871
|
+
id,
|
|
8872
|
+
phase: "Knowledge Refinement",
|
|
8873
|
+
label: `Use ${agent} to ${verb} \`${target}\`.`,
|
|
8874
|
+
agent,
|
|
8875
|
+
target,
|
|
8876
|
+
agentPath: ar.agentPath,
|
|
8877
|
+
agentInstalled: ar.agentInstalled,
|
|
8878
|
+
installCommand: ar.installCommand,
|
|
8879
|
+
reason: `${target} is ${quality === "missing" ? "missing" : "still a bootstrap placeholder or too thin"}.`,
|
|
8880
|
+
instructions: [
|
|
8881
|
+
"The baseline file exists but does not yet hold real, project-specific knowledge.",
|
|
8882
|
+
`Use the ${agent} to replace the placeholders with real knowledge.`,
|
|
8883
|
+
"Do not write code."
|
|
8884
|
+
]
|
|
8885
|
+
};
|
|
8886
|
+
};
|
|
8876
8887
|
if (qBusiness !== "useful") return refine("refine-business", "business-agent", B, qBusiness);
|
|
8877
8888
|
if (qProduct !== "useful" || qCap !== "useful") {
|
|
8878
8889
|
if (qCap !== "useful") {
|
|
@@ -8885,6 +8896,9 @@ function resolveNextStep(dir, now = /* @__PURE__ */ new Date()) {
|
|
|
8885
8896
|
const agent = ctx.agents.includes("codebase-agent") ? "codebase-agent" : "architecture-agent";
|
|
8886
8897
|
return refine("refine-codebase", agent, CB, qCodebase);
|
|
8887
8898
|
}
|
|
8899
|
+
if (!exists(join(dir, ".kaddo", "understand.md"))) {
|
|
8900
|
+
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." };
|
|
8901
|
+
}
|
|
8888
8902
|
const oq = buildOpenQuestionsReport(dir, now);
|
|
8889
8903
|
if (oq.summary.blocking_open > 0) {
|
|
8890
8904
|
return { id: "questions", phase: "Knowledge Refinement", label: "Run `kaddo questions` to see source locations and resolution guidance, then resolve, assume or defer the blocking open questions.", command: "kaddo questions", reason: `${oq.summary.blocking_open} blocking open question(s) remain.` };
|
|
@@ -9665,7 +9679,11 @@ function mapNextStepId(id) {
|
|
|
9665
9679
|
"add-skills": "enable-kaddo",
|
|
9666
9680
|
scan: "scan-repository",
|
|
9667
9681
|
context: "scan-repository",
|
|
9668
|
-
|
|
9682
|
+
"refine-business": "define-business",
|
|
9683
|
+
"refine-product": "define-product",
|
|
9684
|
+
"refine-capabilities": "discover-capabilities",
|
|
9685
|
+
"refine-current-state": "describe-architecture",
|
|
9686
|
+
"refine-codebase": "describe-architecture"
|
|
9669
9687
|
};
|
|
9670
9688
|
return MAP[id] ?? id;
|
|
9671
9689
|
}
|
|
@@ -11034,9 +11052,22 @@ function renderContextPack(pack) {
|
|
|
11034
11052
|
if (isBootstrapIncomplete) {
|
|
11035
11053
|
parts.push("No agent handoff yet.\n");
|
|
11036
11054
|
parts.push("Run `kaddo bootstrap` first to create the baseline files.\n");
|
|
11055
|
+
} else if (rec.agent && rec.agentInstalled === false) {
|
|
11056
|
+
parts.push(`Recommended agent: ${rec.agent.replace(/\.md$/, "")}
|
|
11057
|
+
`);
|
|
11058
|
+
parts.push("**Agent is not installed.**\n");
|
|
11059
|
+
if (rec.installCommand) {
|
|
11060
|
+
parts.push(`Run \`${rec.installCommand}\` to install it.
|
|
11061
|
+
`);
|
|
11062
|
+
}
|
|
11063
|
+
parts.push("Then run `kaddo context` and `kaddo understand`.\n");
|
|
11037
11064
|
} else {
|
|
11038
11065
|
parts.push(`Recommended next for the **${pack.phase.phase}** phase:
|
|
11039
11066
|
`);
|
|
11067
|
+
if (rec.agentPath) {
|
|
11068
|
+
parts.push(`Agent prompt: \`${rec.agentPath}\`
|
|
11069
|
+
`);
|
|
11070
|
+
}
|
|
11040
11071
|
parts.push(handoff.recommendedAgents.map((a, i) => `${i + 1}. ${a}`).join("\n") + "\n");
|
|
11041
11072
|
if (handoff.nextSteps.length > 0) {
|
|
11042
11073
|
parts.push("Next step:\n");
|
|
@@ -11264,72 +11295,85 @@ function renderUnderstand(plan) {
|
|
|
11264
11295
|
parts.push(`Use \`${plan.contextPackPath}\` as the primary input${scanNote}.
|
|
11265
11296
|
`);
|
|
11266
11297
|
if (!isBootstrap) {
|
|
11267
|
-
const
|
|
11268
|
-
if (
|
|
11269
|
-
|
|
11270
|
-
|
|
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}\`
|
|
11298
|
+
const agentMissing = rec && rec.agent && rec.agentInstalled === false;
|
|
11299
|
+
if (agentMissing) {
|
|
11300
|
+
parts.push("## Missing Agent\n");
|
|
11301
|
+
parts.push(`${agentName(rec.agent)} is not installed.
|
|
11283
11302
|
`);
|
|
11284
|
-
|
|
11285
|
-
|
|
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.
|
|
11303
|
+
if (rec.installCommand) {
|
|
11304
|
+
parts.push(`Run \`${rec.installCommand}\` to install it.
|
|
11328
11305
|
`);
|
|
11329
11306
|
}
|
|
11307
|
+
parts.push("Then run:\n");
|
|
11308
|
+
parts.push("1. `kaddo context`\n2. `kaddo understand`\n");
|
|
11330
11309
|
} else {
|
|
11331
|
-
|
|
11310
|
+
const agentPaths = [];
|
|
11311
|
+
if (plan.recommendedPaths && plan.recommendedPaths.length > 0) {
|
|
11312
|
+
agentPaths.push(...plan.recommendedPaths);
|
|
11313
|
+
} else if (steps.length > 0) {
|
|
11314
|
+
agentPaths.push(...steps.map((s) => agentInstallPath(s.agent)));
|
|
11315
|
+
}
|
|
11316
|
+
if (plan.recommendedSkillPaths && plan.recommendedSkillPaths.length > 0) {
|
|
11317
|
+
agentPaths.push(...plan.recommendedSkillPaths);
|
|
11318
|
+
}
|
|
11319
|
+
agentPaths.push(plan.contextPackPath);
|
|
11320
|
+
parts.push("## Agent Prompts\n");
|
|
11321
|
+
if (agentPaths.length > 1) {
|
|
11322
|
+
parts.push("Use:\n");
|
|
11323
|
+
parts.push(agentPaths.map((p2) => `- \`${p2}\``).join("\n") + "\n");
|
|
11324
|
+
} else {
|
|
11325
|
+
parts.push(`- \`${plan.contextPackPath}\`
|
|
11332
11326
|
`);
|
|
11327
|
+
}
|
|
11328
|
+
if (steps.length > 0) {
|
|
11329
|
+
parts.push("## Expected Outputs\n");
|
|
11330
|
+
parts.push(steps.map((s) => `- \`${s.output}\``).join("\n") + "\n");
|
|
11331
|
+
} else if (rec) {
|
|
11332
|
+
parts.push("## Expected Outputs\n");
|
|
11333
|
+
const outputs = [];
|
|
11334
|
+
if (rec.target) outputs.push(`- \`${rec.target}\``);
|
|
11335
|
+
if (rec.id === "refine-work-item" || rec.id === "resolve-blocker")
|
|
11336
|
+
outputs.push("- Refined Work Item content.");
|
|
11337
|
+
if (rec.id === "create-work-item")
|
|
11338
|
+
outputs.push("- A new Work Item under `knowledge/delivery/work-items/`.");
|
|
11339
|
+
if (rec.id === "implement")
|
|
11340
|
+
outputs.push("- Implementation plan or code changes guided by the Work Item.");
|
|
11341
|
+
if (rec.id === "guard")
|
|
11342
|
+
outputs.push("- Updated knowledge artifacts reflecting recent code changes.");
|
|
11343
|
+
if (rec.id === "install-adapter")
|
|
11344
|
+
outputs.push("- An adapter configured and injected (`kaddo adapters list`).");
|
|
11345
|
+
if (outputs.length > 0) {
|
|
11346
|
+
parts.push("The LLM should produce:\n");
|
|
11347
|
+
parts.push(outputs.join("\n") + "\n");
|
|
11348
|
+
} else {
|
|
11349
|
+
parts.push("_See the primary recommendation above._\n");
|
|
11350
|
+
}
|
|
11351
|
+
}
|
|
11352
|
+
parts.push("## Copy/Paste Instructions\n");
|
|
11353
|
+
if (steps.length > 0) {
|
|
11354
|
+
const first2 = steps[0];
|
|
11355
|
+
parts.push(
|
|
11356
|
+
[
|
|
11357
|
+
`Start with **${agentName(first2.agent)}**:`,
|
|
11358
|
+
"",
|
|
11359
|
+
"1. Open your preferred LLM chat (Claude, ChatGPT, Cursor, Copilot, Windsurf\u2026).",
|
|
11360
|
+
`2. Paste the context pack: \`${plan.contextPackPath}\``,
|
|
11361
|
+
`3. Paste the agent prompt: \`${agentInstallPath(first2.agent)}\``,
|
|
11362
|
+
`4. Ask the LLM to produce: \`${first2.output}\``,
|
|
11363
|
+
`5. Save the result in: \`${first2.output}\``
|
|
11364
|
+
].join("\n") + "\n"
|
|
11365
|
+
);
|
|
11366
|
+
} else if (agentPaths.length > 1) {
|
|
11367
|
+
parts.push("Paste the following into your LLM chat:\n");
|
|
11368
|
+
parts.push(agentPaths.map((p2, i) => `${i + 1}. \`${p2}\``).join("\n") + "\n");
|
|
11369
|
+
if (rec?.agent) {
|
|
11370
|
+
parts.push(`Ask the LLM to follow the ${agentName(rec.agent)} instructions.
|
|
11371
|
+
`);
|
|
11372
|
+
}
|
|
11373
|
+
} else {
|
|
11374
|
+
parts.push(`Paste \`${plan.contextPackPath}\` into your LLM chat.
|
|
11375
|
+
`);
|
|
11376
|
+
}
|
|
11333
11377
|
}
|
|
11334
11378
|
}
|
|
11335
11379
|
parts.push("## Next Steps\n");
|
|
@@ -11391,25 +11435,36 @@ function renderUnderstandTerminal(plan) {
|
|
|
11391
11435
|
lines.push(" 3. kaddo context");
|
|
11392
11436
|
lines.push(" 4. kaddo understand");
|
|
11393
11437
|
} else {
|
|
11394
|
-
const
|
|
11395
|
-
if (
|
|
11396
|
-
lines.push(
|
|
11397
|
-
|
|
11398
|
-
|
|
11399
|
-
|
|
11400
|
-
|
|
11401
|
-
lines.push("");
|
|
11402
|
-
lines.push(
|
|
11403
|
-
lines.push("");
|
|
11404
|
-
lines.push(` Context: ${plan.contextPackPath}`);
|
|
11405
|
-
lines.push(` Agent prompt: ${agentInstallPath(first2.agent)}`);
|
|
11406
|
-
lines.push(` Expected output: ${first2.output}`);
|
|
11407
|
-
lines.push("");
|
|
11408
|
-
lines.push("Instructions:");
|
|
11409
|
-
lines.push(" Open your preferred LLM chat, paste the context pack, then paste the agent");
|
|
11410
|
-
lines.push(" prompt. Ask the LLM to generate the expected output and save it in the target file.");
|
|
11438
|
+
const agentMissing = rec && rec.agent && rec.agentInstalled === false;
|
|
11439
|
+
if (agentMissing) {
|
|
11440
|
+
lines.push(`Missing agent: ${agentName(rec.agent)}`);
|
|
11441
|
+
if (rec.installCommand) {
|
|
11442
|
+
lines.push(`Run: ${rec.installCommand}`);
|
|
11443
|
+
}
|
|
11444
|
+
lines.push("Then run:");
|
|
11445
|
+
lines.push(" 1. kaddo context");
|
|
11446
|
+
lines.push(" 2. kaddo understand");
|
|
11411
11447
|
} else {
|
|
11412
|
-
|
|
11448
|
+
const first2 = steps[0];
|
|
11449
|
+
if (first2) {
|
|
11450
|
+
lines.push("Foundational knowledge still needed:");
|
|
11451
|
+
steps.forEach((s, i) => {
|
|
11452
|
+
const flag = s.installed ? "" : " (not installed)";
|
|
11453
|
+
lines.push(` ${i + 1}. ${agentName(s.agent)} \u2192 ${s.output}${flag}`);
|
|
11454
|
+
});
|
|
11455
|
+
lines.push("");
|
|
11456
|
+
lines.push(`First step: use ${agentName(first2.agent)}.`);
|
|
11457
|
+
lines.push("");
|
|
11458
|
+
lines.push(` Context: ${plan.contextPackPath}`);
|
|
11459
|
+
lines.push(` Agent prompt: ${agentInstallPath(first2.agent)}`);
|
|
11460
|
+
lines.push(` Expected output: ${first2.output}`);
|
|
11461
|
+
lines.push("");
|
|
11462
|
+
lines.push("Instructions:");
|
|
11463
|
+
lines.push(" Open your preferred LLM chat, paste the context pack, then paste the agent");
|
|
11464
|
+
lines.push(" prompt. Ask the LLM to generate the expected output and save it in the target file.");
|
|
11465
|
+
} else {
|
|
11466
|
+
lines.push("Foundational knowledge looks complete \u2014 see the phase recommendation below.");
|
|
11467
|
+
}
|
|
11413
11468
|
}
|
|
11414
11469
|
}
|
|
11415
11470
|
lines.push("");
|
|
@@ -11524,6 +11579,11 @@ function runUnderstand() {
|
|
|
11524
11579
|
for (const r of assessment.reasons) console.log(` - ${r}`);
|
|
11525
11580
|
}
|
|
11526
11581
|
if (rec.agent) console.log(`Recommended: ${rec.agent}`);
|
|
11582
|
+
if (rec.agent && rec.agentInstalled === false) {
|
|
11583
|
+
console.log(` \u26A0 Agent not installed. Run: ${rec.installCommand ?? "kaddo add agents"}`);
|
|
11584
|
+
} else if (rec.agentPath) {
|
|
11585
|
+
console.log(` Agent prompt: ${rec.agentPath}`);
|
|
11586
|
+
}
|
|
11527
11587
|
if (rec.skill) console.log(`Recommended skill: ${rec.skill}`);
|
|
11528
11588
|
console.log(`Next step: ${rec.label}`);
|
|
11529
11589
|
if (rec.reason) console.log(`Why: ${rec.reason}`);
|