@kaddo/cli 3.13.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 +5 -90
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -2263,12 +2263,6 @@ You do **not** suggest branches, commits or pull requests \u2014 implementation
|
|
|
2263
2263
|
branch suggestion) is the implementation-agent's responsibility, and only by respecting the
|
|
2264
2264
|
project Git strategy. Your job ends at a clear, traceable Work Item.
|
|
2265
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.
|
|
2271
|
-
|
|
2272
2266
|
## Quality Checklist
|
|
2273
2267
|
|
|
2274
2268
|
- The problem is one clear sentence.
|
|
@@ -2834,10 +2828,8 @@ Conventional Commit message \u2014 as suggestions, never executed.
|
|
|
2834
2828
|
## Constraints
|
|
2835
2829
|
|
|
2836
2830
|
- 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.
|
|
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.
|
|
2841
2833
|
- Respect \`knowledge/tech/git-strategy.md\` when it exists.
|
|
2842
2834
|
- Keep knowledge in sync with the code you change.
|
|
2843
2835
|
- Do not invent business facts.
|
|
@@ -5081,42 +5073,6 @@ function assessPhase(input) {
|
|
|
5081
5073
|
return { phase, reasons, recommendedAgents: recommendedAgents2, nextStep };
|
|
5082
5074
|
}
|
|
5083
5075
|
|
|
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
5076
|
// src/core/knowledge-discovery.ts
|
|
5121
5077
|
var KNOWLEDGE = "knowledge";
|
|
5122
5078
|
var CONSOLIDATED_TYPE = {
|
|
@@ -5166,7 +5122,7 @@ function layerFromPath(filePath) {
|
|
|
5166
5122
|
if (p2.includes(`/${KNOWLEDGE}/delivery/`)) return "Delivery";
|
|
5167
5123
|
return null;
|
|
5168
5124
|
}
|
|
5169
|
-
function
|
|
5125
|
+
function basename(p2) {
|
|
5170
5126
|
return p2.replace(/\\/g, "/").split("/").pop() ?? p2;
|
|
5171
5127
|
}
|
|
5172
5128
|
function discoverLayers(dir) {
|
|
@@ -5183,9 +5139,9 @@ function discoverLayers(dir) {
|
|
|
5183
5139
|
const layer2 = layerForType(type) ?? layerFromPath(a.filePath);
|
|
5184
5140
|
if (!layer2) continue;
|
|
5185
5141
|
const slot = acc[layer2];
|
|
5186
|
-
slot.detected.add(
|
|
5142
|
+
slot.detected.add(basename(a.filePath));
|
|
5187
5143
|
if (layer2 === "Delivery") {
|
|
5188
|
-
if (type === "roadmap" ||
|
|
5144
|
+
if (type === "roadmap" || basename(a.filePath) === "roadmap.md") slot.hasRoadmap = true;
|
|
5189
5145
|
if (WORK_ITEM_TYPES2.has(type) || a.filePath.replace(/\\/g, "/").includes("/delivery/work-items/")) {
|
|
5190
5146
|
if (a.filePath.replace(/\\/g, "/").includes("/delivery/work-items/")) slot.hasWorkItem = true;
|
|
5191
5147
|
}
|
|
@@ -5368,7 +5324,6 @@ function buildProjectExplanation(dir) {
|
|
|
5368
5324
|
workItemsMissingOwnership: items.length - withOwnership
|
|
5369
5325
|
};
|
|
5370
5326
|
const domains = [...new Set(workItemArtifacts.flatMap((a) => a.domains))].filter(Boolean);
|
|
5371
|
-
const workspace = detectWorkspace(dir);
|
|
5372
5327
|
const roadmapPath = join(dir, ARCH_DIR4, "delivery", "roadmap.md");
|
|
5373
5328
|
const roadmapMd = exists(roadmapPath) ? readFile(roadmapPath) : null;
|
|
5374
5329
|
const roadmap = roadmapStats(roadmapMd, items.length);
|
|
@@ -5418,7 +5373,6 @@ function buildProjectExplanation(dir) {
|
|
|
5418
5373
|
workItems,
|
|
5419
5374
|
ownership,
|
|
5420
5375
|
domains,
|
|
5421
|
-
workspace,
|
|
5422
5376
|
layers,
|
|
5423
5377
|
roadmap,
|
|
5424
5378
|
mappedModules,
|
|
@@ -5451,21 +5405,6 @@ function renderExplanationHuman(exp) {
|
|
|
5451
5405
|
lines.push(`- Team: ${exp.project.teamSize}`);
|
|
5452
5406
|
lines.push(`- Structure: ${exp.project.structure}`);
|
|
5453
5407
|
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
5408
|
lines.push("## Knowledge Layers");
|
|
5470
5409
|
lines.push(renderLayersMarkdown(exp.layers));
|
|
5471
5410
|
lines.push("");
|
|
@@ -5956,7 +5895,6 @@ function buildContextPack(dir, config, now = /* @__PURE__ */ new Date()) {
|
|
|
5956
5895
|
layers,
|
|
5957
5896
|
roadmap,
|
|
5958
5897
|
phase,
|
|
5959
|
-
workspace: detectWorkspace(dir),
|
|
5960
5898
|
deliveryMix,
|
|
5961
5899
|
mappedModules,
|
|
5962
5900
|
missing,
|
|
@@ -5994,23 +5932,6 @@ function renderContextPack(pack) {
|
|
|
5994
5932
|
`- Structure: ${project.structure}`
|
|
5995
5933
|
].join("\n") + "\n"
|
|
5996
5934
|
);
|
|
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
5935
|
parts.push("## Current Phase\n");
|
|
6015
5936
|
parts.push(`Phase: ${pack.phase.phase}
|
|
6016
5937
|
`);
|
|
@@ -6445,12 +6366,6 @@ function runUnderstand() {
|
|
|
6445
6366
|
if (assessment.nextStep) {
|
|
6446
6367
|
console.log(`Next step: ${assessment.nextStep}`);
|
|
6447
6368
|
}
|
|
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
6369
|
const active = activeWorkItems(dir);
|
|
6455
6370
|
if (active.length > 0) {
|
|
6456
6371
|
console.log("");
|