@kaddo/cli 3.27.3 → 3.28.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.
- package/README.md +2 -0
- package/dist/index.js +58 -36
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -521,6 +521,8 @@ create --from roadmap → owners → guard → explain`.
|
|
|
521
521
|
| v3.27.1 | Codex adapter command fallbacks: AGENTS.md tells Codex to try `corepack pnpm exec` / `pnpm exec` / `npx` kaddo when the global binary isn't on PATH |
|
|
522
522
|
| v3.27.2 | Codex adapter safe merge: `kaddo adapters install codex --inject` adds/updates only a delimited Kaddo block in an existing AGENTS.md, preserving team content |
|
|
523
523
|
| v3.27.3 | Codex adapter reference stabilization: package-manager-aware command fallbacks (lockfile detection) + Adapter Contract & Custom Adapters docs (reference for future adapters) |
|
|
524
|
+
| v3.28 | Claude Code adapter: `kaddo adapters install claude` (alias `kaddo export claude`) generates a `CLAUDE.md` projection reusing the shared adapter common core (`--dry-run`/`--force`) |
|
|
525
|
+
| v3.28.1 | Claude adapter safe merge: `--inject` works for `CLAUDE.md` too; adapter markers are now target-neutral (`KADDO ADAPTER`) and legacy Codex markers auto-migrate on update |
|
|
524
526
|
|
|
525
527
|
**Optional modules (installed with `kaddo add`):**
|
|
526
528
|
|
package/dist/index.js
CHANGED
|
@@ -12404,11 +12404,13 @@ var ROLE_HINTS = {
|
|
|
12404
12404
|
"graph-agent": "use to turn graph hints into front matter.",
|
|
12405
12405
|
"capsule-agent": "use to refine a Knowledge Capsule for sharing."
|
|
12406
12406
|
};
|
|
12407
|
-
|
|
12407
|
+
var TARGET_FILE = { codex: "AGENTS.md", claude: "CLAUDE.md" };
|
|
12408
|
+
function renderAdapterMarkdown(ctx, target) {
|
|
12409
|
+
const file = TARGET_FILE[target];
|
|
12408
12410
|
const L = [];
|
|
12409
|
-
L.push(
|
|
12411
|
+
L.push(`<!-- Generated by \`kaddo adapters install ${target}\`. Kaddo is the source of truth \u2014`);
|
|
12410
12412
|
L.push(" regenerate this file instead of editing it by hand. Do not treat it as primary. -->");
|
|
12411
|
-
L.push(
|
|
12413
|
+
L.push(`# ${file}`, "");
|
|
12412
12414
|
L.push("## Project guidance", "");
|
|
12413
12415
|
if (ctx.projectName) L.push(`Project: **${ctx.projectName}**${ctx.projectType ? ` (${ctx.projectType})` : ""}.`, "");
|
|
12414
12416
|
L.push("This repository uses **Kaddo** for Knowledge Driven Development. Kaddo keeps business,");
|
|
@@ -12511,13 +12513,25 @@ function renderAgentsMd(ctx) {
|
|
|
12511
12513
|
L.push("");
|
|
12512
12514
|
return L.join("\n");
|
|
12513
12515
|
}
|
|
12514
|
-
var KADDO_BEGIN_MARKER = "<!-- BEGIN KADDO
|
|
12515
|
-
var KADDO_END_MARKER = "<!-- END KADDO
|
|
12516
|
-
var
|
|
12516
|
+
var KADDO_BEGIN_MARKER = "<!-- BEGIN KADDO ADAPTER -->";
|
|
12517
|
+
var KADDO_END_MARKER = "<!-- END KADDO ADAPTER -->";
|
|
12518
|
+
var LEGACY_BEGIN_MARKER = "<!-- BEGIN KADDO CODEX ADAPTER -->";
|
|
12519
|
+
var LEGACY_END_MARKER = "<!-- END KADDO CODEX ADAPTER -->";
|
|
12520
|
+
var GENERATED_HEADER = "Generated by `kaddo adapters install ";
|
|
12521
|
+
function findMarker(content, neutral, legacy) {
|
|
12522
|
+
const a = content.indexOf(neutral);
|
|
12523
|
+
const b = content.indexOf(legacy);
|
|
12524
|
+
if (a === -1) return b;
|
|
12525
|
+
if (b === -1) return a;
|
|
12526
|
+
return Math.min(a, b);
|
|
12527
|
+
}
|
|
12528
|
+
function markerLength(content, neutral, legacy) {
|
|
12529
|
+
return content.includes(neutral) ? neutral.length : legacy.length;
|
|
12530
|
+
}
|
|
12517
12531
|
function detectAgentsState(content) {
|
|
12518
12532
|
if (content === null) return "missing";
|
|
12519
|
-
const hasBegin = content.includes(KADDO_BEGIN_MARKER);
|
|
12520
|
-
const hasEnd = content.includes(KADDO_END_MARKER);
|
|
12533
|
+
const hasBegin = content.includes(KADDO_BEGIN_MARKER) || content.includes(LEGACY_BEGIN_MARKER);
|
|
12534
|
+
const hasEnd = content.includes(KADDO_END_MARKER) || content.includes(LEGACY_END_MARKER);
|
|
12521
12535
|
if (hasBegin !== hasEnd) return "invalid_kaddo_block";
|
|
12522
12536
|
if (hasBegin && hasEnd) return "existing_with_kaddo_block";
|
|
12523
12537
|
if (content.includes(GENERATED_HEADER)) return "generated_by_kaddo";
|
|
@@ -12574,15 +12588,15 @@ function renderKaddoBlock(ctx) {
|
|
|
12574
12588
|
}
|
|
12575
12589
|
function injectKaddoBlock(existing, ctx) {
|
|
12576
12590
|
const block = renderKaddoBlock(ctx);
|
|
12577
|
-
const begin = existing
|
|
12578
|
-
const end = existing
|
|
12591
|
+
const begin = findMarker(existing, KADDO_BEGIN_MARKER, LEGACY_BEGIN_MARKER);
|
|
12592
|
+
const end = findMarker(existing, KADDO_END_MARKER, LEGACY_END_MARKER);
|
|
12579
12593
|
if (begin === -1 !== (end === -1)) {
|
|
12580
12594
|
throw new Error("Invalid Kaddo adapter block: found one marker without its pair.");
|
|
12581
12595
|
}
|
|
12582
12596
|
if (begin !== -1 && end !== -1) {
|
|
12583
12597
|
if (end < begin) throw new Error("Invalid Kaddo adapter block: END marker before BEGIN marker.");
|
|
12584
12598
|
const before = existing.slice(0, begin);
|
|
12585
|
-
const after = existing.slice(end + KADDO_END_MARKER
|
|
12599
|
+
const after = existing.slice(end + markerLength(existing, KADDO_END_MARKER, LEGACY_END_MARKER));
|
|
12586
12600
|
return { content: `${before}${block}${after}`, status: "updated" };
|
|
12587
12601
|
}
|
|
12588
12602
|
const sep = existing.endsWith("\n") ? "\n" : "\n\n";
|
|
@@ -12592,77 +12606,85 @@ ${sep}${block}
|
|
|
12592
12606
|
}
|
|
12593
12607
|
|
|
12594
12608
|
// src/commands/adapters.ts
|
|
12609
|
+
var TARGETS2 = {
|
|
12610
|
+
codex: { target: "codex", file: "AGENTS.md", label: "Codex", supportsInject: true },
|
|
12611
|
+
claude: { target: "claude", file: "CLAUDE.md", label: "Claude Code", supportsInject: true }
|
|
12612
|
+
};
|
|
12595
12613
|
function runAdaptersInstall(adapter, opts = {}) {
|
|
12596
12614
|
const dir = cwd();
|
|
12597
12615
|
requireConfig(dir);
|
|
12598
|
-
|
|
12599
|
-
|
|
12616
|
+
const spec = TARGETS2[adapter];
|
|
12617
|
+
if (!spec) {
|
|
12618
|
+
console.error(`Unknown adapter: "${adapter}". Available: ${Object.keys(TARGETS2).join(", ")}.`);
|
|
12600
12619
|
process.exit(1);
|
|
12620
|
+
return;
|
|
12601
12621
|
}
|
|
12602
12622
|
const ctx = buildCodexAdapterContext(dir);
|
|
12603
|
-
const rel =
|
|
12623
|
+
const rel = spec.file;
|
|
12604
12624
|
const full = join(dir, rel);
|
|
12605
12625
|
const existed = exists(full);
|
|
12606
12626
|
const existing = existed ? readFile(full) : null;
|
|
12607
|
-
|
|
12627
|
+
const cmd = `kaddo adapters install ${adapter}`;
|
|
12628
|
+
if (opts.inject && spec.supportsInject) {
|
|
12608
12629
|
const state = detectAgentsState(existing);
|
|
12609
12630
|
if (state === "invalid_kaddo_block") {
|
|
12610
|
-
console.error(
|
|
12631
|
+
console.error(`Invalid Kaddo adapter block detected in ${rel}.`);
|
|
12611
12632
|
console.error("Found one marker without its pair. Fix the file manually or use --force to overwrite.");
|
|
12612
12633
|
console.error("Nothing changed.");
|
|
12613
12634
|
process.exit(1);
|
|
12635
|
+
return;
|
|
12614
12636
|
}
|
|
12615
12637
|
if (existing === null) {
|
|
12616
|
-
const content2 =
|
|
12638
|
+
const content2 = renderAdapterMarkdown(ctx, spec.target);
|
|
12617
12639
|
if (opts.dryRun) {
|
|
12618
|
-
console.log(
|
|
12640
|
+
console.log(`# ${rel} preview`, "");
|
|
12619
12641
|
console.log(content2);
|
|
12620
12642
|
return;
|
|
12621
12643
|
}
|
|
12622
|
-
intro2(
|
|
12644
|
+
intro2(`${cmd} --inject`);
|
|
12623
12645
|
writeFile(full, content2);
|
|
12624
|
-
log2.success(
|
|
12646
|
+
log2.success(`Created ${rel} for ${spec.label}.`);
|
|
12625
12647
|
printCommandFooter("adapters install codex");
|
|
12626
|
-
outro2(
|
|
12648
|
+
outro2(`${rel} ready.`);
|
|
12627
12649
|
return;
|
|
12628
12650
|
}
|
|
12629
12651
|
const merged = injectKaddoBlock(existing, ctx);
|
|
12630
12652
|
if (opts.dryRun) {
|
|
12631
|
-
console.log(
|
|
12653
|
+
console.log(`# ${rel} preview (inject)`, "");
|
|
12632
12654
|
console.log(merged.content);
|
|
12633
12655
|
return;
|
|
12634
12656
|
}
|
|
12635
|
-
intro2(
|
|
12657
|
+
intro2(`${cmd} --inject`);
|
|
12636
12658
|
writeFile(full, merged.content);
|
|
12637
12659
|
if (merged.status === "updated") {
|
|
12638
|
-
log2.success(
|
|
12660
|
+
log2.success(`Updated existing Kaddo guidance block in ${rel}.`);
|
|
12639
12661
|
} else {
|
|
12640
|
-
log2.success(
|
|
12662
|
+
log2.success(`Injected Kaddo guidance block into ${rel}.`);
|
|
12641
12663
|
}
|
|
12642
12664
|
log2.info("Content outside the Kaddo markers was preserved.");
|
|
12643
12665
|
printCommandFooter("adapters install codex");
|
|
12644
|
-
outro2(
|
|
12666
|
+
outro2(`${rel} ready.`);
|
|
12645
12667
|
return;
|
|
12646
12668
|
}
|
|
12647
|
-
const content =
|
|
12669
|
+
const content = renderAdapterMarkdown(ctx, spec.target);
|
|
12648
12670
|
if (opts.dryRun) {
|
|
12649
|
-
console.log(
|
|
12671
|
+
console.log(`# ${rel} preview`, "");
|
|
12650
12672
|
console.log(content);
|
|
12651
12673
|
return;
|
|
12652
12674
|
}
|
|
12653
|
-
intro2(
|
|
12675
|
+
intro2(cmd);
|
|
12654
12676
|
if (existed && !opts.force) {
|
|
12655
|
-
log2.warn(
|
|
12656
|
-
log2.info("Use `--inject` to add or update only the Kaddo block,");
|
|
12657
|
-
log2.info(
|
|
12677
|
+
log2.warn(`${rel} already exists.`);
|
|
12678
|
+
if (spec.supportsInject) log2.info("Use `--inject` to add or update only the Kaddo block,");
|
|
12679
|
+
log2.info(`Use \`--force\` to overwrite, or \`--dry-run\` to preview.`);
|
|
12658
12680
|
outro2("Nothing changed.");
|
|
12659
12681
|
return;
|
|
12660
12682
|
}
|
|
12661
12683
|
writeFile(full, content);
|
|
12662
|
-
log2.success(`${existed ? "Overwrote" : "Created"}
|
|
12684
|
+
log2.success(`${existed ? "Overwrote" : "Created"} ${rel} for ${spec.label}.`);
|
|
12663
12685
|
log2.info("Source: Kaddo project knowledge. Regenerate it instead of editing by hand.");
|
|
12664
12686
|
printCommandFooter("adapters install codex");
|
|
12665
|
-
outro2(
|
|
12687
|
+
outro2(`${rel} ready.`);
|
|
12666
12688
|
}
|
|
12667
12689
|
|
|
12668
12690
|
// src/index.ts
|
|
@@ -12719,10 +12741,10 @@ var questionsAction = (opts) => runQuestions(opts);
|
|
|
12719
12741
|
program.command("questions").description("Open-questions readiness gate: blocking/important/deferred decisions before the roadmap").option("--json", "Output JSON instead of a summary").option("--output <path>", "Write the report to a file (e.g. .kaddo/reports/questions-report.md)").action(questionsAction);
|
|
12720
12742
|
program.command("readiness").description("Alias for `kaddo questions`").option("--json", "Output JSON instead of a summary").option("--output <path>", "Write the report to a file").action(questionsAction);
|
|
12721
12743
|
var adaptersCmd = program.command("adapters").description("Generate adapters that project Kaddo knowledge for external coding agents");
|
|
12722
|
-
adaptersCmd.command("install <adapter>").description("Generate an adapter file (codex \u2192 AGENTS.md) from Kaddo knowledge").option("--force", "Overwrite an existing output file").option("--inject", "Add or update only the Kaddo block in an existing file, preserving the rest").option("--dry-run", "Print the content without writing files").action((adapter, opts) => {
|
|
12744
|
+
adaptersCmd.command("install <adapter>").description("Generate an adapter file (codex \u2192 AGENTS.md, claude \u2192 CLAUDE.md) from Kaddo knowledge").option("--force", "Overwrite an existing output file").option("--inject", "Add or update only the Kaddo block in an existing file, preserving the rest").option("--dry-run", "Print the content without writing files").action((adapter, opts) => {
|
|
12723
12745
|
runAdaptersInstall(adapter, opts);
|
|
12724
12746
|
});
|
|
12725
|
-
program.command("export <adapter>").description("Alias for `kaddo adapters install <adapter>` (codex \u2192 AGENTS.md)").option("--force", "Overwrite an existing output file").option("--inject", "Add or update only the Kaddo block in an existing file, preserving the rest").option("--dry-run", "Print the content without writing files").action((adapter, opts) => {
|
|
12747
|
+
program.command("export <adapter>").description("Alias for `kaddo adapters install <adapter>` (codex \u2192 AGENTS.md, claude \u2192 CLAUDE.md)").option("--force", "Overwrite an existing output file").option("--inject", "Add or update only the Kaddo block in an existing file, preserving the rest").option("--dry-run", "Print the content without writing files").action((adapter, opts) => {
|
|
12726
12748
|
runAdaptersInstall(adapter, opts);
|
|
12727
12749
|
});
|
|
12728
12750
|
program.command("guard").description("Check if modified code has related artifacts that were not updated").option("--staged", "Check only staged files").option("--no-interactive", "Disable interactive ignore prompts").option("--ci", "CI mode: output JSON, no prompts, non-blocking").option("--json", "Output JSON (alias for --ci)").option("--workspace", "Also check local mapped module repos from .kaddo/modules.yml (opt-in)").option("--include-archived", "Include archived Work Items in ownership matching (excluded by default)").option("--record", "Record this run to .kaddo/history/ for drift trend reporting").action(async (opts) => {
|