@kaddo/cli 3.13.0 → 3.13.2
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 +26 -98
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -2214,10 +2214,12 @@ A refined Work Item intended to be saved under the lifecycle workspace:
|
|
|
2214
2214
|
Keep \`chore\` for maintenance/tooling/config/infra work \u2014 never upgrade a chore to a feature.
|
|
2215
2215
|
4. Validate the Knowledge Level (K0\u2013K4) and propose a different one if needed.
|
|
2216
2216
|
5. Propose acceptance criteria.
|
|
2217
|
-
6. Propose Out of scope
|
|
2218
|
-
7. Propose
|
|
2219
|
-
|
|
2220
|
-
|
|
2217
|
+
6. Propose an Out of scope section.
|
|
2218
|
+
7. Propose **how to test it** \u2014 concrete validation steps (commands to run, manual steps, or
|
|
2219
|
+
test cases) that prove the change works once implemented. This is mandatory.
|
|
2220
|
+
8. Propose a Definition of Done.
|
|
2221
|
+
9. Identify open questions and assumptions.
|
|
2222
|
+
10. Suggest ownership candidates (code globs) if evident.
|
|
2221
2223
|
|
|
2222
2224
|
## Constraints
|
|
2223
2225
|
|
|
@@ -2241,7 +2243,11 @@ A refined Work Item intended to be saved under the lifecycle workspace:
|
|
|
2241
2243
|
|
|
2242
2244
|
**Out of scope:**
|
|
2243
2245
|
|
|
2244
|
-
**
|
|
2246
|
+
**How to test it (validation):**
|
|
2247
|
+
<!-- concrete steps to verify once implemented, e.g.:
|
|
2248
|
+
1. \`pnpm test path/to/spec\` (or the project's test command)
|
|
2249
|
+
2. Manual: <action> \u2192 expected <result>
|
|
2250
|
+
3. \`kaddo guard\` shows no unexpected drift -->
|
|
2245
2251
|
|
|
2246
2252
|
**Definition of Done:**
|
|
2247
2253
|
|
|
@@ -2261,13 +2267,7 @@ and \`blocked\` as active work; \`completed\` and \`archived\` are historical kn
|
|
|
2261
2267
|
When the Work Item is refined and ready to build, **hand off to the implementation-agent**.
|
|
2262
2268
|
You do **not** suggest branches, commits or pull requests \u2014 implementation (including any Git
|
|
2263
2269
|
branch suggestion) is the implementation-agent's responsibility, and only by respecting the
|
|
2264
|
-
project Git strategy. Your job ends at a clear, traceable Work Item
|
|
2265
|
-
|
|
2266
|
-
## Git boundaries
|
|
2267
|
-
|
|
2268
|
-
Never run Git. Do not create or switch branches, create worktrees, stash, commit, push or merge.
|
|
2269
|
-
Work only inside the currently selected workspace. If a workspace or branch change is required,
|
|
2270
|
-
stop and ask the human.
|
|
2270
|
+
project Git strategy. Your job ends at a clear, traceable Work Item that **states how to test it**.
|
|
2271
2271
|
|
|
2272
2272
|
## Quality Checklist
|
|
2273
2273
|
|
|
@@ -2275,7 +2275,8 @@ stop and ask the human.
|
|
|
2275
2275
|
- Large candidates are split.
|
|
2276
2276
|
- Knowledge Level is justified.
|
|
2277
2277
|
- Acceptance criteria are testable.
|
|
2278
|
-
- Out of scope
|
|
2278
|
+
- Out of scope is stated.
|
|
2279
|
+
- **How to test it** is concrete (commands, manual steps, or test cases).
|
|
2279
2280
|
- Open questions are explicit.
|
|
2280
2281
|
- Handoff: next step is the implementation-agent (never a branch or commit).
|
|
2281
2282
|
`;
|
|
@@ -2828,16 +2829,16 @@ Conventional Commit message \u2014 as suggestions, never executed.
|
|
|
2828
2829
|
4. Suggest running \`kaddo owners suggest\` and confirm the \`code:\` globs.
|
|
2829
2830
|
5. Suggest running \`kaddo guard\` before committing to detect knowledge drift.
|
|
2830
2831
|
6. Update affected knowledge (ADR / capabilities.md / current-state.md).
|
|
2831
|
-
7.
|
|
2832
|
+
7. **Explain how to test it** \u2014 the exact commands and/or manual steps to verify the change works
|
|
2833
|
+
(run the Work Item's "How to test it" steps and report the result).
|
|
2834
|
+
8. Suggest a Conventional Commit message and **wait for explicit human confirmation**. Never
|
|
2832
2835
|
commit, push or merge on your own.
|
|
2833
2836
|
|
|
2834
2837
|
## Constraints
|
|
2835
2838
|
|
|
2836
2839
|
- Never run Git. Never commit, push or merge \u2014 suggest and wait for the human.
|
|
2837
|
-
- **Do not create
|
|
2838
|
-
|
|
2839
|
-
- **Work only inside the currently selected workspace** (repository root or the active Git
|
|
2840
|
-
worktree). If a branch or workspace change is required, stop and ask the human.
|
|
2840
|
+
- **Do not create or switch branches, or stash changes.** You may *suggest* a branch name; the
|
|
2841
|
+
human creates the branch. If a branch change is required, stop and ask the human.
|
|
2841
2842
|
- Respect \`knowledge/tech/git-strategy.md\` when it exists.
|
|
2842
2843
|
- Keep knowledge in sync with the code you change.
|
|
2843
2844
|
- Do not invent business facts.
|
|
@@ -2853,6 +2854,9 @@ Conventional Commit message \u2014 as suggestions, never executed.
|
|
|
2853
2854
|
|
|
2854
2855
|
## Tests
|
|
2855
2856
|
|
|
2857
|
+
## How to test it
|
|
2858
|
+
<!-- exact commands and/or manual steps to verify, e.g. run the test suite, start the app then <action> -->
|
|
2859
|
+
|
|
2856
2860
|
## Knowledge to update
|
|
2857
2861
|
|
|
2858
2862
|
## Suggested commit (await human confirmation)
|
|
@@ -2866,6 +2870,7 @@ Code, tests and migrations live in the repository. Knowledge updates go under \`
|
|
|
2866
2870
|
|
|
2867
2871
|
- A branch is suggested per the Git strategy (never executed).
|
|
2868
2872
|
- Tests accompany the change.
|
|
2873
|
+
- **How to test it** is stated (exact commands / manual steps to verify).
|
|
2869
2874
|
- \`kaddo scan\` / \`owners suggest\` / \`guard\` are suggested at the right moments.
|
|
2870
2875
|
- Affected knowledge is updated.
|
|
2871
2876
|
- Commit is suggested and awaits human confirmation \u2014 never run automatically.
|
|
@@ -5081,42 +5086,6 @@ function assessPhase(input) {
|
|
|
5081
5086
|
return { phase, reasons, recommendedAgents: recommendedAgents2, nextStep };
|
|
5082
5087
|
}
|
|
5083
5088
|
|
|
5084
|
-
// src/core/workspace.ts
|
|
5085
|
-
import { dirname, resolve, basename } from "path";
|
|
5086
|
-
function findGitEntry(startDir) {
|
|
5087
|
-
let cur = resolve(startDir);
|
|
5088
|
-
while (true) {
|
|
5089
|
-
const g = join(cur, ".git");
|
|
5090
|
-
if (exists(g)) return { dir: cur, gitPath: g };
|
|
5091
|
-
const parent = dirname(cur);
|
|
5092
|
-
if (parent === cur) return null;
|
|
5093
|
-
cur = parent;
|
|
5094
|
-
}
|
|
5095
|
-
}
|
|
5096
|
-
function readBranch(gitDir) {
|
|
5097
|
-
try {
|
|
5098
|
-
const head = readFile(join(gitDir, "HEAD")).trim();
|
|
5099
|
-
const m = head.match(/^ref:\s*refs\/heads\/(.+)$/);
|
|
5100
|
-
if (m) return m[1].trim();
|
|
5101
|
-
return head ? head.slice(0, 12) : null;
|
|
5102
|
-
} catch {
|
|
5103
|
-
return null;
|
|
5104
|
-
}
|
|
5105
|
-
}
|
|
5106
|
-
function detectWorkspace(startDir) {
|
|
5107
|
-
const found = findGitEntry(startDir);
|
|
5108
|
-
if (!found) return { isGitRepo: false, root: null, branch: null, isWorktree: false };
|
|
5109
|
-
const { dir, gitPath } = found;
|
|
5110
|
-
if (!isFile(gitPath)) {
|
|
5111
|
-
return { isGitRepo: true, root: dir, branch: readBranch(gitPath), isWorktree: false };
|
|
5112
|
-
}
|
|
5113
|
-
let gitDir = gitPath;
|
|
5114
|
-
const m = readFile(gitPath).match(/gitdir:\s*(.+)/);
|
|
5115
|
-
if (m) gitDir = m[1].trim();
|
|
5116
|
-
const isWorktree = basename(dirname(gitDir)) === "worktrees";
|
|
5117
|
-
return { isGitRepo: true, root: dir, branch: readBranch(gitDir), isWorktree };
|
|
5118
|
-
}
|
|
5119
|
-
|
|
5120
5089
|
// src/core/knowledge-discovery.ts
|
|
5121
5090
|
var KNOWLEDGE = "knowledge";
|
|
5122
5091
|
var CONSOLIDATED_TYPE = {
|
|
@@ -5166,7 +5135,7 @@ function layerFromPath(filePath) {
|
|
|
5166
5135
|
if (p2.includes(`/${KNOWLEDGE}/delivery/`)) return "Delivery";
|
|
5167
5136
|
return null;
|
|
5168
5137
|
}
|
|
5169
|
-
function
|
|
5138
|
+
function basename(p2) {
|
|
5170
5139
|
return p2.replace(/\\/g, "/").split("/").pop() ?? p2;
|
|
5171
5140
|
}
|
|
5172
5141
|
function discoverLayers(dir) {
|
|
@@ -5183,9 +5152,9 @@ function discoverLayers(dir) {
|
|
|
5183
5152
|
const layer2 = layerForType(type) ?? layerFromPath(a.filePath);
|
|
5184
5153
|
if (!layer2) continue;
|
|
5185
5154
|
const slot = acc[layer2];
|
|
5186
|
-
slot.detected.add(
|
|
5155
|
+
slot.detected.add(basename(a.filePath));
|
|
5187
5156
|
if (layer2 === "Delivery") {
|
|
5188
|
-
if (type === "roadmap" ||
|
|
5157
|
+
if (type === "roadmap" || basename(a.filePath) === "roadmap.md") slot.hasRoadmap = true;
|
|
5189
5158
|
if (WORK_ITEM_TYPES2.has(type) || a.filePath.replace(/\\/g, "/").includes("/delivery/work-items/")) {
|
|
5190
5159
|
if (a.filePath.replace(/\\/g, "/").includes("/delivery/work-items/")) slot.hasWorkItem = true;
|
|
5191
5160
|
}
|
|
@@ -5368,7 +5337,6 @@ function buildProjectExplanation(dir) {
|
|
|
5368
5337
|
workItemsMissingOwnership: items.length - withOwnership
|
|
5369
5338
|
};
|
|
5370
5339
|
const domains = [...new Set(workItemArtifacts.flatMap((a) => a.domains))].filter(Boolean);
|
|
5371
|
-
const workspace = detectWorkspace(dir);
|
|
5372
5340
|
const roadmapPath = join(dir, ARCH_DIR4, "delivery", "roadmap.md");
|
|
5373
5341
|
const roadmapMd = exists(roadmapPath) ? readFile(roadmapPath) : null;
|
|
5374
5342
|
const roadmap = roadmapStats(roadmapMd, items.length);
|
|
@@ -5418,7 +5386,6 @@ function buildProjectExplanation(dir) {
|
|
|
5418
5386
|
workItems,
|
|
5419
5387
|
ownership,
|
|
5420
5388
|
domains,
|
|
5421
|
-
workspace,
|
|
5422
5389
|
layers,
|
|
5423
5390
|
roadmap,
|
|
5424
5391
|
mappedModules,
|
|
@@ -5451,21 +5418,6 @@ function renderExplanationHuman(exp) {
|
|
|
5451
5418
|
lines.push(`- Team: ${exp.project.teamSize}`);
|
|
5452
5419
|
lines.push(`- Structure: ${exp.project.structure}`);
|
|
5453
5420
|
lines.push("");
|
|
5454
|
-
lines.push("## Workspace");
|
|
5455
|
-
if (exp.workspace.isGitRepo) {
|
|
5456
|
-
lines.push(`- Repository root: ${exp.workspace.root ?? "unknown"}`);
|
|
5457
|
-
lines.push(`- Git worktree: ${exp.workspace.isWorktree ? "yes" : "no"}`);
|
|
5458
|
-
lines.push(`- Active branch: ${exp.workspace.branch ?? "unknown"}`);
|
|
5459
|
-
if (exp.workspace.isWorktree) {
|
|
5460
|
-
lines.push("");
|
|
5461
|
-
lines.push(
|
|
5462
|
-
"> 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."
|
|
5463
|
-
);
|
|
5464
|
-
}
|
|
5465
|
-
} else {
|
|
5466
|
-
lines.push("- Not a Git repository");
|
|
5467
|
-
}
|
|
5468
|
-
lines.push("");
|
|
5469
5421
|
lines.push("## Knowledge Layers");
|
|
5470
5422
|
lines.push(renderLayersMarkdown(exp.layers));
|
|
5471
5423
|
lines.push("");
|
|
@@ -5956,7 +5908,6 @@ function buildContextPack(dir, config, now = /* @__PURE__ */ new Date()) {
|
|
|
5956
5908
|
layers,
|
|
5957
5909
|
roadmap,
|
|
5958
5910
|
phase,
|
|
5959
|
-
workspace: detectWorkspace(dir),
|
|
5960
5911
|
deliveryMix,
|
|
5961
5912
|
mappedModules,
|
|
5962
5913
|
missing,
|
|
@@ -5994,23 +5945,6 @@ function renderContextPack(pack) {
|
|
|
5994
5945
|
`- Structure: ${project.structure}`
|
|
5995
5946
|
].join("\n") + "\n"
|
|
5996
5947
|
);
|
|
5997
|
-
parts.push("## Execution Context\n");
|
|
5998
|
-
if (pack.workspace.isGitRepo) {
|
|
5999
|
-
parts.push(
|
|
6000
|
-
[
|
|
6001
|
-
`- Repository root: ${pack.workspace.root ?? "unknown"}`,
|
|
6002
|
-
`- Current branch: ${pack.workspace.branch ?? "unknown"}`,
|
|
6003
|
-
`- Git worktree: ${pack.workspace.isWorktree ? "yes" : "no"}`
|
|
6004
|
-
].join("\n") + "\n"
|
|
6005
|
-
);
|
|
6006
|
-
if (pack.workspace.isWorktree) {
|
|
6007
|
-
parts.push(
|
|
6008
|
-
"You are inside a Git worktree. Work only in this workspace; run Kaddo commands from here.\n"
|
|
6009
|
-
);
|
|
6010
|
-
}
|
|
6011
|
-
} else {
|
|
6012
|
-
parts.push("- Not a Git repository\n");
|
|
6013
|
-
}
|
|
6014
5948
|
parts.push("## Current Phase\n");
|
|
6015
5949
|
parts.push(`Phase: ${pack.phase.phase}
|
|
6016
5950
|
`);
|
|
@@ -6445,12 +6379,6 @@ function runUnderstand() {
|
|
|
6445
6379
|
if (assessment.nextStep) {
|
|
6446
6380
|
console.log(`Next step: ${assessment.nextStep}`);
|
|
6447
6381
|
}
|
|
6448
|
-
if (exp.workspace.isWorktree) {
|
|
6449
|
-
console.log("");
|
|
6450
|
-
console.log(`Current implementation workspace: ${exp.workspace.branch ?? "(detached)"}`);
|
|
6451
|
-
console.log(" \u2192 You are inside a Git worktree. Run scan, owners suggest, guard and explain");
|
|
6452
|
-
console.log(" from this worktree so they reflect the code being changed here.");
|
|
6453
|
-
}
|
|
6454
6382
|
const active = activeWorkItems(dir);
|
|
6455
6383
|
if (active.length > 0) {
|
|
6456
6384
|
console.log("");
|