@kaddo/cli 3.12.0 → 3.13.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/dist/index.js +118 -91
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1546,6 +1546,20 @@ var RESPONSIBILITY_MATRIX = {
|
|
|
1546
1546
|
cannotSuggest: ["branches", "commits", "pull requests", "code"],
|
|
1547
1547
|
next: ["kaddo create --from roadmap", "work-item-agent"]
|
|
1548
1548
|
},
|
|
1549
|
+
"backlog-agent": {
|
|
1550
|
+
agent: "backlog-agent",
|
|
1551
|
+
responsibleFor: ["Capturing ideas", "Structuring new work"],
|
|
1552
|
+
produces: ["knowledge/delivery/work-items/draft/", "roadmap candidates"],
|
|
1553
|
+
canSuggest: ["work-item-agent", "roadmap-agent"],
|
|
1554
|
+
cannotSuggest: [
|
|
1555
|
+
"code",
|
|
1556
|
+
"branches",
|
|
1557
|
+
"commits",
|
|
1558
|
+
"editing the roadmap automatically",
|
|
1559
|
+
"auto-executing other agents"
|
|
1560
|
+
],
|
|
1561
|
+
next: ["human decision (refine / add candidate / split / keep draft)"]
|
|
1562
|
+
},
|
|
1549
1563
|
"work-item-agent": {
|
|
1550
1564
|
agent: "work-item-agent",
|
|
1551
1565
|
responsibleFor: ["Work Item refinement"],
|
|
@@ -2249,12 +2263,6 @@ You do **not** suggest branches, commits or pull requests \u2014 implementation
|
|
|
2249
2263
|
branch suggestion) is the implementation-agent's responsibility, and only by respecting the
|
|
2250
2264
|
project Git strategy. Your job ends at a clear, traceable Work Item.
|
|
2251
2265
|
|
|
2252
|
-
## Git boundaries
|
|
2253
|
-
|
|
2254
|
-
Never run Git. Do not create or switch branches, create worktrees, stash, commit, push or merge.
|
|
2255
|
-
Work only inside the currently selected workspace. If a workspace or branch change is required,
|
|
2256
|
-
stop and ask the human.
|
|
2257
|
-
|
|
2258
2266
|
## Quality Checklist
|
|
2259
2267
|
|
|
2260
2268
|
- The problem is one clear sentence.
|
|
@@ -2820,10 +2828,8 @@ Conventional Commit message \u2014 as suggestions, never executed.
|
|
|
2820
2828
|
## Constraints
|
|
2821
2829
|
|
|
2822
2830
|
- Never run Git. Never commit, push or merge \u2014 suggest and wait for the human.
|
|
2823
|
-
- **Do not create
|
|
2824
|
-
|
|
2825
|
-
- **Work only inside the currently selected workspace** (repository root or the active Git
|
|
2826
|
-
worktree). If a branch or workspace change is required, stop and ask the human.
|
|
2831
|
+
- **Do not create or switch branches, or stash changes.** You may *suggest* a branch name; the
|
|
2832
|
+
human creates the branch. If a branch change is required, stop and ask the human.
|
|
2827
2833
|
- Respect \`knowledge/tech/git-strategy.md\` when it exists.
|
|
2828
2834
|
- Keep knowledge in sync with the code you change.
|
|
2829
2835
|
- Do not invent business facts.
|
|
@@ -2856,6 +2862,98 @@ Code, tests and migrations live in the repository. Knowledge updates go under \`
|
|
|
2856
2862
|
- Affected knowledge is updated.
|
|
2857
2863
|
- Commit is suggested and awaits human confirmation \u2014 never run automatically.
|
|
2858
2864
|
`;
|
|
2865
|
+
var BACKLOG_AGENT = `# Backlog Agent
|
|
2866
|
+
|
|
2867
|
+
## Role
|
|
2868
|
+
|
|
2869
|
+
You are the Kaddo Backlog Agent. Your job is to capture raw ideas, requests, meeting notes,
|
|
2870
|
+
conversations and transcripts and turn them into **structured backlog** compatible with Kaddo \u2014
|
|
2871
|
+
either a Work Item draft or a roadmap candidate.
|
|
2872
|
+
|
|
2873
|
+
You answer one question: **"where should this idea live?"** \u2014 not "how is it implemented?". You do
|
|
2874
|
+
not write code, you do not refine Work Items fully, and you never trigger the next step.
|
|
2875
|
+
|
|
2876
|
+
## When to Use
|
|
2877
|
+
|
|
2878
|
+
Use this agent whenever new work appears outside the roadmap: a one-line idea, a bullet list, a
|
|
2879
|
+
meeting transcript, a Slack/Teams/email thread. It sits before the work-item-agent:
|
|
2880
|
+
|
|
2881
|
+
\`Idea \u2192 backlog-agent \u2192 draft / roadmap candidate \u2192 (human decides) \u2192 work-item-agent\`
|
|
2882
|
+
|
|
2883
|
+
## Input Required
|
|
2884
|
+
|
|
2885
|
+
Provide \`.kaddo/context-pack.md\` as the primary input, plus the raw idea/notes/transcript. Use
|
|
2886
|
+
\`knowledge/business/business.md\`, \`knowledge/product/product.md\`, \`knowledge/product/capabilities.md\`,
|
|
2887
|
+
\`knowledge/tech/codebase.md\` and \`knowledge/delivery/roadmap.md\` when they exist to place the idea
|
|
2888
|
+
in the right initiative and avoid duplicates.
|
|
2889
|
+
|
|
2890
|
+
## Expected Output
|
|
2891
|
+
|
|
2892
|
+
One of:
|
|
2893
|
+
|
|
2894
|
+
1. A **Work Item draft** under \`knowledge/delivery/work-items/draft/\` when the scope is clear and
|
|
2895
|
+
small.
|
|
2896
|
+
2. A **roadmap candidate** (\`WI-CANDIDATE-XXX\`) to add later when the scope is too large.
|
|
2897
|
+
3. **Multiple** backlog items when the input contains several distinct ideas (split them).
|
|
2898
|
+
|
|
2899
|
+
## Instructions
|
|
2900
|
+
|
|
2901
|
+
1. Read the idea and the available knowledge.
|
|
2902
|
+
2. Decide: clear & small \u2192 Work Item draft; large \u2192 roadmap candidate; multiple ideas \u2192 split.
|
|
2903
|
+
3. For each item infer: initiative, domains, suggested type (feature/bugfix/hotfix/spike/chore),
|
|
2904
|
+
suggested Knowledge Level (K1\u2013K4) and a suggested priority.
|
|
2905
|
+
4. Detect duplicates, overlaps and obvious dependencies with existing knowledge.
|
|
2906
|
+
5. Place each item under the most appropriate initiative.
|
|
2907
|
+
6. End with the mandatory handoff (below) \u2014 the human decides the next step.
|
|
2908
|
+
|
|
2909
|
+
## Constraints
|
|
2910
|
+
|
|
2911
|
+
- Do not write code.
|
|
2912
|
+
- Do not fully refine Work Items (that is the work-item-agent).
|
|
2913
|
+
- Do not modify \`knowledge/delivery/roadmap.md\` automatically \u2014 propose the candidate.
|
|
2914
|
+
- Never run Git (no branches, commits, pushes, merges).
|
|
2915
|
+
- **Never auto-execute the next step.** Do not run the work-item-agent or implementation-agent.
|
|
2916
|
+
- Always require a human decision before anything continues.
|
|
2917
|
+
|
|
2918
|
+
## Output Format
|
|
2919
|
+
|
|
2920
|
+
\`\`\`markdown
|
|
2921
|
+
# Backlog capture
|
|
2922
|
+
|
|
2923
|
+
## Item 1 \u2014 <title>
|
|
2924
|
+
- Output: Work Item draft | Roadmap candidate
|
|
2925
|
+
- Suggested type: feature | bugfix | hotfix | spike | chore
|
|
2926
|
+
- Suggested Knowledge Level: K1 / K2 / K3 / K4
|
|
2927
|
+
- Initiative:
|
|
2928
|
+
- Domains:
|
|
2929
|
+
- Suggested priority:
|
|
2930
|
+
- Duplicates / overlaps / dependencies:
|
|
2931
|
+
- Summary:
|
|
2932
|
+
|
|
2933
|
+
## Handoff
|
|
2934
|
+
Created: WI-023 (draft) \xB7or\xB7 Roadmap candidate: WI-CANDIDATE-014
|
|
2935
|
+
|
|
2936
|
+
Suggested next actions (human decides \u2014 nothing runs automatically):
|
|
2937
|
+
1. Refine with the work-item-agent
|
|
2938
|
+
2. Add as a roadmap candidate
|
|
2939
|
+
3. Split into multiple items
|
|
2940
|
+
4. Keep as a draft
|
|
2941
|
+
\`\`\`
|
|
2942
|
+
|
|
2943
|
+
## Where to Save the Result
|
|
2944
|
+
|
|
2945
|
+
Save a Work Item draft under \`knowledge/delivery/work-items/draft/\`. For a roadmap candidate,
|
|
2946
|
+
propose the \`WI-CANDIDATE-XXX\` text for a human to add to \`knowledge/delivery/roadmap.md\` (do not
|
|
2947
|
+
edit the roadmap yourself).
|
|
2948
|
+
|
|
2949
|
+
## Quality Checklist
|
|
2950
|
+
|
|
2951
|
+
- The idea is captured without being implemented or fully refined.
|
|
2952
|
+
- Output is clearly a draft or a roadmap candidate.
|
|
2953
|
+
- Multiple ideas are split into separate items.
|
|
2954
|
+
- Duplicates, overlaps and dependencies are flagged.
|
|
2955
|
+
- The response ends with a human-decision handoff \u2014 no agent is auto-executed.
|
|
2956
|
+
`;
|
|
2859
2957
|
var AGENT_PROMPTS = [
|
|
2860
2958
|
{ fileName: "capability-agent.md", content: CAPABILITY_AGENT },
|
|
2861
2959
|
{ fileName: "architecture-agent.md", content: ARCHITECTURE_AGENT },
|
|
@@ -2873,7 +2971,9 @@ var AGENT_PROMPTS = [
|
|
|
2873
2971
|
{ fileName: "bootstrap-agent.md", content: BOOTSTRAP_AGENT },
|
|
2874
2972
|
{ fileName: "codebase-agent.md", content: CODEBASE_FOUNDATION_AGENT },
|
|
2875
2973
|
// Implementation (the only agent that may suggest a branch — VS-044)
|
|
2876
|
-
{ fileName: "implementation-agent.md", content: IMPLEMENTATION_AGENT }
|
|
2974
|
+
{ fileName: "implementation-agent.md", content: IMPLEMENTATION_AGENT },
|
|
2975
|
+
// Backlog capture (idea → draft / roadmap candidate — VS-050)
|
|
2976
|
+
{ fileName: "backlog-agent.md", content: BACKLOG_AGENT }
|
|
2877
2977
|
// Every official prompt ends with its responsibility boundaries + Agent Trace footer.
|
|
2878
2978
|
].map((p2) => ({ fileName: p2.fileName, content: withResponsibilityTrace(p2.fileName, p2.content) }));
|
|
2879
2979
|
|
|
@@ -2891,6 +2991,7 @@ var AGENT_GROUPS = {
|
|
|
2891
2991
|
"adr-agent.md"
|
|
2892
2992
|
],
|
|
2893
2993
|
delivery: [
|
|
2994
|
+
"backlog-agent.md",
|
|
2894
2995
|
"roadmap-agent.md",
|
|
2895
2996
|
"work-item-agent.md",
|
|
2896
2997
|
"implementation-agent.md",
|
|
@@ -2916,6 +3017,7 @@ var RECOMMENDED_BY_STATE = {
|
|
|
2916
3017
|
"architecture-agent.md",
|
|
2917
3018
|
"codebase-agent.md",
|
|
2918
3019
|
"roadmap-agent.md",
|
|
3020
|
+
"backlog-agent.md",
|
|
2919
3021
|
"work-item-agent.md",
|
|
2920
3022
|
"implementation-agent.md",
|
|
2921
3023
|
"adr-agent.md"
|
|
@@ -2924,6 +3026,7 @@ var RECOMMENDED_BY_STATE = {
|
|
|
2924
3026
|
"capability-agent.md",
|
|
2925
3027
|
"architecture-agent.md",
|
|
2926
3028
|
"roadmap-agent.md",
|
|
3029
|
+
"backlog-agent.md",
|
|
2927
3030
|
"work-item-agent.md",
|
|
2928
3031
|
"implementation-agent.md"
|
|
2929
3032
|
],
|
|
@@ -2932,6 +3035,7 @@ var RECOMMENDED_BY_STATE = {
|
|
|
2932
3035
|
"architecture-agent.md",
|
|
2933
3036
|
"capability-agent.md",
|
|
2934
3037
|
"roadmap-agent.md",
|
|
3038
|
+
"backlog-agent.md",
|
|
2935
3039
|
"work-item-agent.md",
|
|
2936
3040
|
"implementation-agent.md"
|
|
2937
3041
|
]
|
|
@@ -4969,42 +5073,6 @@ function assessPhase(input) {
|
|
|
4969
5073
|
return { phase, reasons, recommendedAgents: recommendedAgents2, nextStep };
|
|
4970
5074
|
}
|
|
4971
5075
|
|
|
4972
|
-
// src/core/workspace.ts
|
|
4973
|
-
import { dirname, resolve, basename } from "path";
|
|
4974
|
-
function findGitEntry(startDir) {
|
|
4975
|
-
let cur = resolve(startDir);
|
|
4976
|
-
while (true) {
|
|
4977
|
-
const g = join(cur, ".git");
|
|
4978
|
-
if (exists(g)) return { dir: cur, gitPath: g };
|
|
4979
|
-
const parent = dirname(cur);
|
|
4980
|
-
if (parent === cur) return null;
|
|
4981
|
-
cur = parent;
|
|
4982
|
-
}
|
|
4983
|
-
}
|
|
4984
|
-
function readBranch(gitDir) {
|
|
4985
|
-
try {
|
|
4986
|
-
const head = readFile(join(gitDir, "HEAD")).trim();
|
|
4987
|
-
const m = head.match(/^ref:\s*refs\/heads\/(.+)$/);
|
|
4988
|
-
if (m) return m[1].trim();
|
|
4989
|
-
return head ? head.slice(0, 12) : null;
|
|
4990
|
-
} catch {
|
|
4991
|
-
return null;
|
|
4992
|
-
}
|
|
4993
|
-
}
|
|
4994
|
-
function detectWorkspace(startDir) {
|
|
4995
|
-
const found = findGitEntry(startDir);
|
|
4996
|
-
if (!found) return { isGitRepo: false, root: null, branch: null, isWorktree: false };
|
|
4997
|
-
const { dir, gitPath } = found;
|
|
4998
|
-
if (!isFile(gitPath)) {
|
|
4999
|
-
return { isGitRepo: true, root: dir, branch: readBranch(gitPath), isWorktree: false };
|
|
5000
|
-
}
|
|
5001
|
-
let gitDir = gitPath;
|
|
5002
|
-
const m = readFile(gitPath).match(/gitdir:\s*(.+)/);
|
|
5003
|
-
if (m) gitDir = m[1].trim();
|
|
5004
|
-
const isWorktree = basename(dirname(gitDir)) === "worktrees";
|
|
5005
|
-
return { isGitRepo: true, root: dir, branch: readBranch(gitDir), isWorktree };
|
|
5006
|
-
}
|
|
5007
|
-
|
|
5008
5076
|
// src/core/knowledge-discovery.ts
|
|
5009
5077
|
var KNOWLEDGE = "knowledge";
|
|
5010
5078
|
var CONSOLIDATED_TYPE = {
|
|
@@ -5054,7 +5122,7 @@ function layerFromPath(filePath) {
|
|
|
5054
5122
|
if (p2.includes(`/${KNOWLEDGE}/delivery/`)) return "Delivery";
|
|
5055
5123
|
return null;
|
|
5056
5124
|
}
|
|
5057
|
-
function
|
|
5125
|
+
function basename(p2) {
|
|
5058
5126
|
return p2.replace(/\\/g, "/").split("/").pop() ?? p2;
|
|
5059
5127
|
}
|
|
5060
5128
|
function discoverLayers(dir) {
|
|
@@ -5071,9 +5139,9 @@ function discoverLayers(dir) {
|
|
|
5071
5139
|
const layer2 = layerForType(type) ?? layerFromPath(a.filePath);
|
|
5072
5140
|
if (!layer2) continue;
|
|
5073
5141
|
const slot = acc[layer2];
|
|
5074
|
-
slot.detected.add(
|
|
5142
|
+
slot.detected.add(basename(a.filePath));
|
|
5075
5143
|
if (layer2 === "Delivery") {
|
|
5076
|
-
if (type === "roadmap" ||
|
|
5144
|
+
if (type === "roadmap" || basename(a.filePath) === "roadmap.md") slot.hasRoadmap = true;
|
|
5077
5145
|
if (WORK_ITEM_TYPES2.has(type) || a.filePath.replace(/\\/g, "/").includes("/delivery/work-items/")) {
|
|
5078
5146
|
if (a.filePath.replace(/\\/g, "/").includes("/delivery/work-items/")) slot.hasWorkItem = true;
|
|
5079
5147
|
}
|
|
@@ -5256,7 +5324,6 @@ function buildProjectExplanation(dir) {
|
|
|
5256
5324
|
workItemsMissingOwnership: items.length - withOwnership
|
|
5257
5325
|
};
|
|
5258
5326
|
const domains = [...new Set(workItemArtifacts.flatMap((a) => a.domains))].filter(Boolean);
|
|
5259
|
-
const workspace = detectWorkspace(dir);
|
|
5260
5327
|
const roadmapPath = join(dir, ARCH_DIR4, "delivery", "roadmap.md");
|
|
5261
5328
|
const roadmapMd = exists(roadmapPath) ? readFile(roadmapPath) : null;
|
|
5262
5329
|
const roadmap = roadmapStats(roadmapMd, items.length);
|
|
@@ -5306,7 +5373,6 @@ function buildProjectExplanation(dir) {
|
|
|
5306
5373
|
workItems,
|
|
5307
5374
|
ownership,
|
|
5308
5375
|
domains,
|
|
5309
|
-
workspace,
|
|
5310
5376
|
layers,
|
|
5311
5377
|
roadmap,
|
|
5312
5378
|
mappedModules,
|
|
@@ -5339,21 +5405,6 @@ function renderExplanationHuman(exp) {
|
|
|
5339
5405
|
lines.push(`- Team: ${exp.project.teamSize}`);
|
|
5340
5406
|
lines.push(`- Structure: ${exp.project.structure}`);
|
|
5341
5407
|
lines.push("");
|
|
5342
|
-
lines.push("## Workspace");
|
|
5343
|
-
if (exp.workspace.isGitRepo) {
|
|
5344
|
-
lines.push(`- Repository root: ${exp.workspace.root ?? "unknown"}`);
|
|
5345
|
-
lines.push(`- Git worktree: ${exp.workspace.isWorktree ? "yes" : "no"}`);
|
|
5346
|
-
lines.push(`- Active branch: ${exp.workspace.branch ?? "unknown"}`);
|
|
5347
|
-
if (exp.workspace.isWorktree) {
|
|
5348
|
-
lines.push("");
|
|
5349
|
-
lines.push(
|
|
5350
|
-
"> Worktree detected. Run all Kaddo commands (scan, guard, owners suggest, explain) from this worktree while implementation is active, so they observe the same files the agent is changing."
|
|
5351
|
-
);
|
|
5352
|
-
}
|
|
5353
|
-
} else {
|
|
5354
|
-
lines.push("- Not a Git repository");
|
|
5355
|
-
}
|
|
5356
|
-
lines.push("");
|
|
5357
5408
|
lines.push("## Knowledge Layers");
|
|
5358
5409
|
lines.push(renderLayersMarkdown(exp.layers));
|
|
5359
5410
|
lines.push("");
|
|
@@ -5844,7 +5895,6 @@ function buildContextPack(dir, config, now = /* @__PURE__ */ new Date()) {
|
|
|
5844
5895
|
layers,
|
|
5845
5896
|
roadmap,
|
|
5846
5897
|
phase,
|
|
5847
|
-
workspace: detectWorkspace(dir),
|
|
5848
5898
|
deliveryMix,
|
|
5849
5899
|
mappedModules,
|
|
5850
5900
|
missing,
|
|
@@ -5882,23 +5932,6 @@ function renderContextPack(pack) {
|
|
|
5882
5932
|
`- Structure: ${project.structure}`
|
|
5883
5933
|
].join("\n") + "\n"
|
|
5884
5934
|
);
|
|
5885
|
-
parts.push("## Execution Context\n");
|
|
5886
|
-
if (pack.workspace.isGitRepo) {
|
|
5887
|
-
parts.push(
|
|
5888
|
-
[
|
|
5889
|
-
`- Repository root: ${pack.workspace.root ?? "unknown"}`,
|
|
5890
|
-
`- Current branch: ${pack.workspace.branch ?? "unknown"}`,
|
|
5891
|
-
`- Git worktree: ${pack.workspace.isWorktree ? "yes" : "no"}`
|
|
5892
|
-
].join("\n") + "\n"
|
|
5893
|
-
);
|
|
5894
|
-
if (pack.workspace.isWorktree) {
|
|
5895
|
-
parts.push(
|
|
5896
|
-
"You are inside a Git worktree. Work only in this workspace; run Kaddo commands from here.\n"
|
|
5897
|
-
);
|
|
5898
|
-
}
|
|
5899
|
-
} else {
|
|
5900
|
-
parts.push("- Not a Git repository\n");
|
|
5901
|
-
}
|
|
5902
5935
|
parts.push("## Current Phase\n");
|
|
5903
5936
|
parts.push(`Phase: ${pack.phase.phase}
|
|
5904
5937
|
`);
|
|
@@ -6333,12 +6366,6 @@ function runUnderstand() {
|
|
|
6333
6366
|
if (assessment.nextStep) {
|
|
6334
6367
|
console.log(`Next step: ${assessment.nextStep}`);
|
|
6335
6368
|
}
|
|
6336
|
-
if (exp.workspace.isWorktree) {
|
|
6337
|
-
console.log("");
|
|
6338
|
-
console.log(`Current implementation workspace: ${exp.workspace.branch ?? "(detached)"}`);
|
|
6339
|
-
console.log(" \u2192 You are inside a Git worktree. Run scan, owners suggest, guard and explain");
|
|
6340
|
-
console.log(" from this worktree so they reflect the code being changed here.");
|
|
6341
|
-
}
|
|
6342
6369
|
const active = activeWorkItems(dir);
|
|
6343
6370
|
if (active.length > 0) {
|
|
6344
6371
|
console.log("");
|