@kaddo/cli 3.132.0 → 3.134.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/admin-dist/assets/{architectureDiagram-3BPJPVTR-B0OuhO94.js → architectureDiagram-3BPJPVTR-CYNwLGE7.js} +1 -1
- package/dist/admin-dist/assets/{chunk-727SXJPM-CaqXII8F.js → chunk-727SXJPM-Cet603Hl.js} +1 -1
- package/dist/admin-dist/assets/{chunk-AQP2D5EJ-Bg4-fugM.js → chunk-AQP2D5EJ-8XEHPg3a.js} +1 -1
- package/dist/admin-dist/assets/{classDiagram-v2-Q7XG4LA2-CckXCSJd.js → classDiagram-4FO5ZUOK-Bhwb9850.js} +1 -1
- package/dist/admin-dist/assets/{classDiagram-4FO5ZUOK-CckXCSJd.js → classDiagram-v2-Q7XG4LA2-Bhwb9850.js} +1 -1
- package/dist/admin-dist/assets/{dagre-BM42HDAG-C0-ZkGqx.js → dagre-BM42HDAG-DqQXdP8F.js} +1 -1
- package/dist/admin-dist/assets/{diagram-2AECGRRQ-CXx8vdld.js → diagram-2AECGRRQ-B1bysbNR.js} +1 -1
- package/dist/admin-dist/assets/{diagram-5GNKFQAL-DsmIj164.js → diagram-5GNKFQAL-DRifvijh.js} +1 -1
- package/dist/admin-dist/assets/{diagram-LMA3HP47-BwY_Oswl.js → diagram-LMA3HP47-DajL2Tv-.js} +1 -1
- package/dist/admin-dist/assets/{diagram-OG6HWLK6-DZmoKiat.js → diagram-OG6HWLK6-WCJo9oL4.js} +1 -1
- package/dist/admin-dist/assets/{erDiagram-TEJ5UH35-DnkbNH-3.js → erDiagram-TEJ5UH35-DwgqKm6b.js} +1 -1
- package/dist/admin-dist/assets/{flowDiagram-I6XJVG4X-0M5AwmbD.js → flowDiagram-I6XJVG4X-M0kG8sQQ.js} +1 -1
- package/dist/admin-dist/assets/{ganttDiagram-6RSMTGT7-p0YbWB-q.js → ganttDiagram-6RSMTGT7-DtyZt9Ti.js} +1 -1
- package/dist/admin-dist/assets/index-CZVvIq5M.js +96 -0
- package/dist/admin-dist/assets/{infoDiagram-5YYISTIA-CizIjxWP.js → infoDiagram-5YYISTIA-Vwdw_1gf.js} +1 -1
- package/dist/admin-dist/assets/{ishikawaDiagram-YF4QCWOH-DZKlVu1h.js → ishikawaDiagram-YF4QCWOH-CIi6B5fy.js} +1 -1
- package/dist/admin-dist/assets/{kanban-definition-UN3LZRKU-G70NiHFN.js → kanban-definition-UN3LZRKU-5HNFMSQ7.js} +1 -1
- package/dist/admin-dist/assets/{linear-BBYNswBY.js → linear-D3H69r3G.js} +1 -1
- package/dist/admin-dist/assets/{mindmap-definition-RKZ34NQL-CSed8LsK.js → mindmap-definition-RKZ34NQL-BI0w0H_c.js} +1 -1
- package/dist/admin-dist/assets/{pieDiagram-4H26LBE5-BMiHTdzs.js → pieDiagram-4H26LBE5-5oMGjRSP.js} +1 -1
- package/dist/admin-dist/assets/{quadrantDiagram-W4KKPZXB-xAoJMAFV.js → quadrantDiagram-W4KKPZXB-Cf4_7xD4.js} +1 -1
- package/dist/admin-dist/assets/{requirementDiagram-4Y6WPE33-BqxSHuU_.js → requirementDiagram-4Y6WPE33-tKyHvrMo.js} +1 -1
- package/dist/admin-dist/assets/{sequenceDiagram-3UESZ5HK-CEQr2xzT.js → sequenceDiagram-3UESZ5HK-XJChOzcT.js} +1 -1
- package/dist/admin-dist/assets/{stateDiagram-AJRCARHV-DxYDejoz.js → stateDiagram-AJRCARHV-CG6QHhPz.js} +1 -1
- package/dist/admin-dist/assets/{stateDiagram-v2-BHNVJYJU-DXEhlcga.js → stateDiagram-v2-BHNVJYJU-COU53r4o.js} +1 -1
- package/dist/admin-dist/assets/{timeline-definition-PNZ67QCA-BAUnT8tD.js → timeline-definition-PNZ67QCA-CszwARJN.js} +1 -1
- package/dist/admin-dist/assets/{vennDiagram-CIIHVFJN-DAWIyWJZ.js → vennDiagram-CIIHVFJN-kMR7sGYN.js} +1 -1
- package/dist/admin-dist/assets/{wardleyDiagram-YWT4CUSO-B5sNcSKa.js → wardleyDiagram-YWT4CUSO-Cu44stm7.js} +1 -1
- package/dist/admin-dist/assets/{xychartDiagram-2RQKCTM6-0N6T1yeV.js → xychartDiagram-2RQKCTM6-DeU0-PgC.js} +1 -1
- package/dist/admin-dist/index.html +1 -1
- package/dist/admin-server/index.js +281 -6
- package/dist/core.js +469 -93
- package/dist/index.js +506 -141
- package/package.json +1 -1
- package/dist/admin-dist/assets/index-DE-FwnK7.js +0 -94
package/dist/index.js
CHANGED
|
@@ -144,10 +144,10 @@ Status: pending
|
|
|
144
144
|
`;
|
|
145
145
|
}
|
|
146
146
|
function ensurePocArtifact(dir, projectName) {
|
|
147
|
-
const
|
|
148
|
-
if (exists(
|
|
147
|
+
const path18 = join(dir, POC_ARTIFACT_PATH);
|
|
148
|
+
if (exists(path18)) return false;
|
|
149
149
|
ensureDir(join(dir, "knowledge", "delivery"));
|
|
150
|
-
writeFile(
|
|
150
|
+
writeFile(path18, pocTemplate(projectName));
|
|
151
151
|
return true;
|
|
152
152
|
}
|
|
153
153
|
var PLACEHOLDER = /^[_<].*[_>]$|^(describe|list|document|what|how)\b/i;
|
|
@@ -162,13 +162,13 @@ function meaningful(text2) {
|
|
|
162
162
|
});
|
|
163
163
|
}
|
|
164
164
|
function readPocSummary(dir) {
|
|
165
|
-
const
|
|
166
|
-
if (!exists(
|
|
165
|
+
const path18 = join(dir, POC_ARTIFACT_PATH);
|
|
166
|
+
if (!exists(path18)) {
|
|
167
167
|
return { exists: false, hypothesisDefined: false, successCriteriaCount: 0, constraintsDefined: false, nonGoalsDefined: false, conclusion: "pending" };
|
|
168
168
|
}
|
|
169
169
|
let markdown = "";
|
|
170
170
|
try {
|
|
171
|
-
markdown = readFile(
|
|
171
|
+
markdown = readFile(path18);
|
|
172
172
|
} catch {
|
|
173
173
|
return { exists: false, hypothesisDefined: false, successCriteriaCount: 0, constraintsDefined: false, nonGoalsDefined: false, conclusion: "pending" };
|
|
174
174
|
}
|
|
@@ -688,8 +688,8 @@ function loadConfig(dir) {
|
|
|
688
688
|
const parsed = configSchema.safeParse(raw ?? {});
|
|
689
689
|
if (!parsed.success) {
|
|
690
690
|
const issues = parsed.error.issues.map((i) => {
|
|
691
|
-
const
|
|
692
|
-
return
|
|
691
|
+
const path18 = i.path.join(".");
|
|
692
|
+
return path18 ? ` - ${path18}: ${i.message}` : ` - ${i.message}`;
|
|
693
693
|
}).join("\n");
|
|
694
694
|
throw new ConfigError(`Invalid .kaddo/config.yml:
|
|
695
695
|
${issues}`);
|
|
@@ -7146,6 +7146,7 @@ async function runCreateFromRoadmap(dir, cliType) {
|
|
|
7146
7146
|
|
|
7147
7147
|
// src/services/git.ts
|
|
7148
7148
|
import { execa } from "execa";
|
|
7149
|
+
import path3 from "path";
|
|
7149
7150
|
async function getModifiedFiles(mode = "head") {
|
|
7150
7151
|
try {
|
|
7151
7152
|
let args;
|
|
@@ -7206,6 +7207,41 @@ async function getUntrackedFiles() {
|
|
|
7206
7207
|
return [];
|
|
7207
7208
|
}
|
|
7208
7209
|
}
|
|
7210
|
+
async function observeGit(dir, maxCommits = 100, repositoryId) {
|
|
7211
|
+
const limit = Math.max(1, Math.min(maxCommits, 250));
|
|
7212
|
+
const inspectedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
7213
|
+
try {
|
|
7214
|
+
const root = await getGitRoot(dir);
|
|
7215
|
+
if (!root) return { availability: "unavailable", repository: null, commits: [], branches: [], inspectedAt, limit };
|
|
7216
|
+
const [log2, refs] = await Promise.all([
|
|
7217
|
+
execa("git", ["log", `--max-count=${limit}`, "--format=%H%x1f%an%x1f%aI%x1f%s", "--name-only"], { cwd: root, timeout: 5e3 }),
|
|
7218
|
+
execa("git", ["for-each-ref", "--format=%(refname:short)", "refs/heads"], { cwd: root, timeout: 5e3 })
|
|
7219
|
+
]);
|
|
7220
|
+
const commits = [];
|
|
7221
|
+
let current = null;
|
|
7222
|
+
for (const line of log2.stdout.split(/\r?\n/)) {
|
|
7223
|
+
const parts = line.split("");
|
|
7224
|
+
if (parts.length === 4) {
|
|
7225
|
+
if (current) commits.push(current);
|
|
7226
|
+
current = { sha: parts[0], author: parts[1], date: parts[2], subject: parts[3], files: [] };
|
|
7227
|
+
} else if (current && line.trim()) current.files.push(line.trim());
|
|
7228
|
+
}
|
|
7229
|
+
if (current) commits.push(current);
|
|
7230
|
+
return {
|
|
7231
|
+
// The display identity is supplied by the caller when a project observes
|
|
7232
|
+
// several repositories. A basename alone is ambiguous in a multirepo
|
|
7233
|
+
// workspace (for example, two independent `api` folders).
|
|
7234
|
+
availability: "available",
|
|
7235
|
+
repository: repositoryId ?? path3.basename(root),
|
|
7236
|
+
commits,
|
|
7237
|
+
branches: refs.stdout.split(/\r?\n/).map((name) => name.trim()).filter(Boolean).slice(0, 100).map((name) => ({ name })),
|
|
7238
|
+
inspectedAt,
|
|
7239
|
+
limit
|
|
7240
|
+
};
|
|
7241
|
+
} catch {
|
|
7242
|
+
return { availability: "partial", repository: null, commits: [], branches: [], inspectedAt, limit };
|
|
7243
|
+
}
|
|
7244
|
+
}
|
|
7209
7245
|
|
|
7210
7246
|
// src/services/artifact-reader.ts
|
|
7211
7247
|
import matter from "gray-matter";
|
|
@@ -7402,14 +7438,14 @@ function discoverWorkItems(dir) {
|
|
|
7402
7438
|
|
|
7403
7439
|
// src/core/diff-analysis.ts
|
|
7404
7440
|
import { minimatch } from "minimatch";
|
|
7405
|
-
import
|
|
7441
|
+
import path4 from "path";
|
|
7406
7442
|
function toPosix2(p) {
|
|
7407
7443
|
return p.replace(/\\/g, "/");
|
|
7408
7444
|
}
|
|
7409
7445
|
function normalizeTouchedPathForProject(touchedPath, gitRoot, projectRoot) {
|
|
7410
7446
|
const t = toPosix2(touchedPath).replace(/^\.\//, "").replace(/^\/+/, "");
|
|
7411
7447
|
if (!gitRoot) return t;
|
|
7412
|
-
const prefix = toPosix2(
|
|
7448
|
+
const prefix = toPosix2(path4.relative(gitRoot, projectRoot)).replace(/^\.\//, "").replace(/\/+$/, "");
|
|
7413
7449
|
if (prefix === "" || prefix === ".") return t;
|
|
7414
7450
|
if (prefix.startsWith("..")) return t;
|
|
7415
7451
|
if (t === prefix) return null;
|
|
@@ -7475,10 +7511,10 @@ function analyzeGuard(touchedFiles, artifacts, silentWithoutOwnership) {
|
|
|
7475
7511
|
import { parse as parseYaml5, stringify as stringifyYaml4 } from "yaml";
|
|
7476
7512
|
var IGNORE_FILE = ".kaddo/ignores.yml";
|
|
7477
7513
|
function loadIgnores(dir) {
|
|
7478
|
-
const
|
|
7479
|
-
if (!exists(
|
|
7514
|
+
const path18 = join(dir, IGNORE_FILE);
|
|
7515
|
+
if (!exists(path18)) return [];
|
|
7480
7516
|
try {
|
|
7481
|
-
const raw = readFile(
|
|
7517
|
+
const raw = readFile(path18);
|
|
7482
7518
|
const parsed = parseYaml5(raw);
|
|
7483
7519
|
return Array.isArray(parsed) ? parsed : [];
|
|
7484
7520
|
} catch {
|
|
@@ -7486,7 +7522,7 @@ function loadIgnores(dir) {
|
|
|
7486
7522
|
}
|
|
7487
7523
|
}
|
|
7488
7524
|
function saveIgnore(dir, entry) {
|
|
7489
|
-
const
|
|
7525
|
+
const path18 = join(dir, IGNORE_FILE);
|
|
7490
7526
|
const existing = loadIgnores(dir);
|
|
7491
7527
|
const idx = existing.findIndex((e) => e.artifact_id === entry.artifact_id);
|
|
7492
7528
|
if (idx >= 0) {
|
|
@@ -7494,17 +7530,17 @@ function saveIgnore(dir, entry) {
|
|
|
7494
7530
|
} else {
|
|
7495
7531
|
existing.push(entry);
|
|
7496
7532
|
}
|
|
7497
|
-
writeFile(
|
|
7533
|
+
writeFile(path18, stringifyYaml4(existing));
|
|
7498
7534
|
}
|
|
7499
7535
|
function isIgnored(ignores, artifactId) {
|
|
7500
7536
|
return ignores.find((e) => e.artifact_id === artifactId);
|
|
7501
7537
|
}
|
|
7502
7538
|
function removeIgnore(dir, artifactId) {
|
|
7503
|
-
const
|
|
7539
|
+
const path18 = join(dir, IGNORE_FILE);
|
|
7504
7540
|
const existing = loadIgnores(dir);
|
|
7505
7541
|
const filtered = existing.filter((e) => e.artifact_id !== artifactId);
|
|
7506
7542
|
if (filtered.length === existing.length) return false;
|
|
7507
|
-
writeFile(
|
|
7543
|
+
writeFile(path18, stringifyYaml4(filtered));
|
|
7508
7544
|
return true;
|
|
7509
7545
|
}
|
|
7510
7546
|
|
|
@@ -7526,11 +7562,11 @@ function moduleArtifactCoverage(dir, id) {
|
|
|
7526
7562
|
};
|
|
7527
7563
|
}
|
|
7528
7564
|
function loadMappedModules(dir) {
|
|
7529
|
-
const
|
|
7530
|
-
if (!exists(
|
|
7565
|
+
const path18 = join(dir, DESCRIPTOR_PATH);
|
|
7566
|
+
if (!exists(path18)) return [];
|
|
7531
7567
|
let parsed;
|
|
7532
7568
|
try {
|
|
7533
|
-
parsed = parseYaml6(readFile(
|
|
7569
|
+
parsed = parseYaml6(readFile(path18));
|
|
7534
7570
|
} catch {
|
|
7535
7571
|
return [];
|
|
7536
7572
|
}
|
|
@@ -7985,7 +8021,7 @@ function analyzeScopeCoverage(artifact, registeredModuleIds, frontendModuleIds)
|
|
|
7985
8021
|
}
|
|
7986
8022
|
|
|
7987
8023
|
// src/commands/guard.ts
|
|
7988
|
-
import
|
|
8024
|
+
import path5 from "path";
|
|
7989
8025
|
import { parse as parseYaml8 } from "yaml";
|
|
7990
8026
|
|
|
7991
8027
|
// src/plugins/prisma.ts
|
|
@@ -8274,7 +8310,7 @@ function buildGuardHistory(dir) {
|
|
|
8274
8310
|
const d = hotspotDir(t.code_path);
|
|
8275
8311
|
hotspotMap.set(d, (hotspotMap.get(d) ?? 0) + 1);
|
|
8276
8312
|
}
|
|
8277
|
-
const hotspots = [...hotspotMap.entries()].map(([
|
|
8313
|
+
const hotspots = [...hotspotMap.entries()].map(([path18, warnings]) => ({ path: path18, warnings })).sort((a, b) => b.warnings - a.warnings);
|
|
8278
8314
|
return {
|
|
8279
8315
|
available: true,
|
|
8280
8316
|
total_runs: sorted.length,
|
|
@@ -8396,7 +8432,7 @@ function printHeader(touchedFiles) {
|
|
|
8396
8432
|
function artifactLabel(artifact, dir) {
|
|
8397
8433
|
if (artifact.id) return artifact.id;
|
|
8398
8434
|
if (artifact.title) return artifact.title;
|
|
8399
|
-
const rel =
|
|
8435
|
+
const rel = path5.relative(dir, artifact.filePath).split(path5.sep).join("/");
|
|
8400
8436
|
return rel || artifact.filePath;
|
|
8401
8437
|
}
|
|
8402
8438
|
function printWorkspaceHeader(scan2) {
|
|
@@ -10532,7 +10568,7 @@ function getTemplate(id) {
|
|
|
10532
10568
|
}
|
|
10533
10569
|
|
|
10534
10570
|
// src/commands/modules-discover.ts
|
|
10535
|
-
import
|
|
10571
|
+
import path6 from "path";
|
|
10536
10572
|
import { parse as parseYaml9, stringify as stringifyYaml5 } from "yaml";
|
|
10537
10573
|
var CONFIG_PATH3 = ".kaddo/config.yml";
|
|
10538
10574
|
var MODULES_YML = ".kaddo/modules.yml";
|
|
@@ -10609,9 +10645,9 @@ function discoverModules(dir) {
|
|
|
10609
10645
|
const seenIds = /* @__PURE__ */ new Set();
|
|
10610
10646
|
const seenPaths = /* @__PURE__ */ new Set();
|
|
10611
10647
|
const results = [];
|
|
10612
|
-
const coreAbsPath =
|
|
10648
|
+
const coreAbsPath = path6.resolve(dir);
|
|
10613
10649
|
for (const root of roots) {
|
|
10614
|
-
const rootAbs =
|
|
10650
|
+
const rootAbs = path6.resolve(dir, root);
|
|
10615
10651
|
if (!exists(rootAbs) || !isDir(rootAbs)) continue;
|
|
10616
10652
|
let entries;
|
|
10617
10653
|
try {
|
|
@@ -10621,10 +10657,10 @@ function discoverModules(dir) {
|
|
|
10621
10657
|
}
|
|
10622
10658
|
for (const entry of entries) {
|
|
10623
10659
|
if (IGNORED_DIRS.has(entry)) continue;
|
|
10624
|
-
const candidateAbs =
|
|
10660
|
+
const candidateAbs = path6.resolve(rootAbs, entry);
|
|
10625
10661
|
if (!isDir(candidateAbs)) continue;
|
|
10626
10662
|
if (candidateAbs === coreAbsPath) continue;
|
|
10627
|
-
const relPath =
|
|
10663
|
+
const relPath = path6.relative(dir, candidateAbs).replace(/\\/g, "/");
|
|
10628
10664
|
const repoConfig = readRepoConfig(candidateAbs);
|
|
10629
10665
|
if (!repoConfig) {
|
|
10630
10666
|
results.push({
|
|
@@ -10707,7 +10743,7 @@ function discoverModules(dir) {
|
|
|
10707
10743
|
}
|
|
10708
10744
|
}
|
|
10709
10745
|
for (const m of existing.modules) {
|
|
10710
|
-
const absPath =
|
|
10746
|
+
const absPath = path6.resolve(dir, m.path);
|
|
10711
10747
|
if (!exists(absPath) && !results.some((r) => r.path === m.path)) {
|
|
10712
10748
|
results.push({
|
|
10713
10749
|
id: m.id,
|
|
@@ -10739,7 +10775,7 @@ function applyDiscovery(dir, discovered) {
|
|
|
10739
10775
|
path: d.path,
|
|
10740
10776
|
parent_system: d.parentSystem,
|
|
10741
10777
|
status: d.status,
|
|
10742
|
-
context: buildModuleContextPaths(
|
|
10778
|
+
context: buildModuleContextPaths(path6.resolve(dir, d.path))
|
|
10743
10779
|
};
|
|
10744
10780
|
if (existingIdx >= 0) {
|
|
10745
10781
|
yml.modules[existingIdx] = entry;
|
|
@@ -10801,7 +10837,7 @@ function runModulesValidate(dir = cwd()) {
|
|
|
10801
10837
|
}
|
|
10802
10838
|
console.log("");
|
|
10803
10839
|
for (const m of yml.modules) {
|
|
10804
|
-
const absPath =
|
|
10840
|
+
const absPath = path6.resolve(dir, m.path);
|
|
10805
10841
|
if (!exists(absPath)) {
|
|
10806
10842
|
console.log(`${m.id.padEnd(16)} missing`);
|
|
10807
10843
|
continue;
|
|
@@ -10912,10 +10948,10 @@ function slugify2(name) {
|
|
|
10912
10948
|
return name.trim().toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "");
|
|
10913
10949
|
}
|
|
10914
10950
|
function readModulesDescriptor(dir) {
|
|
10915
|
-
const
|
|
10916
|
-
if (!exists(
|
|
10951
|
+
const path18 = join(dir, DESCRIPTOR_PATH2);
|
|
10952
|
+
if (!exists(path18)) return { version: 1, modules: [] };
|
|
10917
10953
|
try {
|
|
10918
|
-
const parsed = parseYaml10(readFile(
|
|
10954
|
+
const parsed = parseYaml10(readFile(path18));
|
|
10919
10955
|
return { version: parsed.version ?? 1, modules: parsed.modules ?? [] };
|
|
10920
10956
|
} catch {
|
|
10921
10957
|
return { version: 1, modules: [] };
|
|
@@ -11295,7 +11331,7 @@ function sectionParagraph(md, title) {
|
|
|
11295
11331
|
}
|
|
11296
11332
|
return "";
|
|
11297
11333
|
}
|
|
11298
|
-
function parseCapsule(id,
|
|
11334
|
+
function parseCapsule(id, path18, md) {
|
|
11299
11335
|
const { data } = matter3(md);
|
|
11300
11336
|
const updatedAt = data.updated_at ? String(data.updated_at) : void 0;
|
|
11301
11337
|
let ageDays = null;
|
|
@@ -11305,7 +11341,7 @@ function parseCapsule(id, path16, md) {
|
|
|
11305
11341
|
}
|
|
11306
11342
|
return {
|
|
11307
11343
|
id,
|
|
11308
|
-
path:
|
|
11344
|
+
path: path18,
|
|
11309
11345
|
system: data.system ? String(data.system) : id,
|
|
11310
11346
|
owner: data.owner ? String(data.owner) : void 0,
|
|
11311
11347
|
updatedAt,
|
|
@@ -11532,6 +11568,7 @@ function computeInitiativeProgress(dir, ini) {
|
|
|
11532
11568
|
}
|
|
11533
11569
|
|
|
11534
11570
|
// src/core/delivery-planning.ts
|
|
11571
|
+
import { createHash } from "crypto";
|
|
11535
11572
|
import matter5 from "gray-matter";
|
|
11536
11573
|
var DELIVERY_PLANS_DIR = "knowledge/delivery/plans";
|
|
11537
11574
|
var EPICS_DIR = "knowledge/delivery/epics";
|
|
@@ -12286,9 +12323,9 @@ function buildGraph(dir, config, opts = {}, now = /* @__PURE__ */ new Date()) {
|
|
|
12286
12323
|
];
|
|
12287
12324
|
const presentLayers = [];
|
|
12288
12325
|
for (const layer2 of layerDocs) {
|
|
12289
|
-
const
|
|
12290
|
-
if (
|
|
12291
|
-
addNode({ id: layer2.id, type: layer2.type, label: layer2.label, path:
|
|
12326
|
+
const path18 = layer2.files.map((f) => `${KNOWLEDGE3}/${f}`).find((rel) => exists(join(dir, rel)));
|
|
12327
|
+
if (path18) {
|
|
12328
|
+
addNode({ id: layer2.id, type: layer2.type, label: layer2.label, path: path18 });
|
|
12292
12329
|
presentLayers.push(layer2.id);
|
|
12293
12330
|
}
|
|
12294
12331
|
}
|
|
@@ -13839,13 +13876,13 @@ function buildTechDecisions(dir) {
|
|
|
13839
13876
|
}
|
|
13840
13877
|
|
|
13841
13878
|
// src/core/poc-report.ts
|
|
13842
|
-
import { createHash } from "crypto";
|
|
13879
|
+
import { createHash as createHash2 } from "crypto";
|
|
13843
13880
|
import matter9 from "gray-matter";
|
|
13844
13881
|
var POC_REPORT_PREFIX = "poc-report-v";
|
|
13845
13882
|
var SECRET_LINE = /(^|\s)(?:[A-Z][A-Z0-9_]*(?:TOKEN|SECRET|PASSWORD|API_KEY|PRIVATE_KEY)|(?:token|secret|password|api[_-]?key))\s*[:=]\s*\S+/i;
|
|
13846
13883
|
var reportName = /^poc-report-v(\d{3,})\.md$/;
|
|
13847
13884
|
function sha(value) {
|
|
13848
|
-
return
|
|
13885
|
+
return createHash2("sha256").update(value).digest("hex");
|
|
13849
13886
|
}
|
|
13850
13887
|
function posix(value) {
|
|
13851
13888
|
return value.replace(/\\/g, "/");
|
|
@@ -13856,11 +13893,11 @@ function redactSecrets(value) {
|
|
|
13856
13893
|
return line.replace(/([:=]\s*)\S+.*/, "$1[redacted]");
|
|
13857
13894
|
}).join("\n");
|
|
13858
13895
|
}
|
|
13859
|
-
function source(dir,
|
|
13860
|
-
const absolute = join(dir,
|
|
13896
|
+
function source(dir, path18, kind) {
|
|
13897
|
+
const absolute = join(dir, path18);
|
|
13861
13898
|
if (!exists(absolute)) return null;
|
|
13862
13899
|
const raw = readFile(absolute);
|
|
13863
|
-
return { path: posix(
|
|
13900
|
+
return { path: posix(path18), kind, digest: sha(raw), content: redactSecrets(raw) };
|
|
13864
13901
|
}
|
|
13865
13902
|
function reportFiles(dir) {
|
|
13866
13903
|
const delivery = join(dir, "knowledge", "delivery");
|
|
@@ -13900,9 +13937,9 @@ function buildPocReportContext(dir) {
|
|
|
13900
13937
|
};
|
|
13901
13938
|
}
|
|
13902
13939
|
const sources = [];
|
|
13903
|
-
const add = (
|
|
13904
|
-
if (sources.some((item2) => item2.path === posix(
|
|
13905
|
-
const item = source(dir,
|
|
13940
|
+
const add = (path18, kind) => {
|
|
13941
|
+
if (sources.some((item2) => item2.path === posix(path18))) return;
|
|
13942
|
+
const item = source(dir, path18, kind);
|
|
13906
13943
|
if (item) sources.push(item);
|
|
13907
13944
|
};
|
|
13908
13945
|
add(POC_ARTIFACT_PATH, "poc");
|
|
@@ -13930,7 +13967,7 @@ function buildPocReportContext(dir) {
|
|
|
13930
13967
|
const sourceFingerprint = sha(sources.map((item) => `${item.path}\0${item.digest}`).join("\n"));
|
|
13931
13968
|
const status = !latestReport ? "missing" : latestReport.sourceFingerprint === sourceFingerprint ? "current" : "stale";
|
|
13932
13969
|
const currentManifest = Object.fromEntries(sources.map((item) => [item.path, item.digest]));
|
|
13933
|
-
const changesSinceLatest = status === "stale" ? [.../* @__PURE__ */ new Set([...Object.keys(currentManifest), ...Object.keys(latestReport?.sourceManifest ?? {})])].filter((
|
|
13970
|
+
const changesSinceLatest = status === "stale" ? [.../* @__PURE__ */ new Set([...Object.keys(currentManifest), ...Object.keys(latestReport?.sourceManifest ?? {})])].filter((path18) => currentManifest[path18] !== latestReport?.sourceManifest[path18]).sort() : [];
|
|
13934
13971
|
const sourceList = sources.map((item) => `- ${item.path} (${item.kind})`).join("\n") || "- No sources selected.";
|
|
13935
13972
|
return {
|
|
13936
13973
|
eligible: true,
|
|
@@ -14081,10 +14118,10 @@ function resolveNextStep(dir, now = /* @__PURE__ */ new Date()) {
|
|
|
14081
14118
|
const q = (rel) => analyzeKnowledgeArtifact(dir, rel);
|
|
14082
14119
|
const resolveAgent = (agent) => {
|
|
14083
14120
|
const file = agent.endsWith(".md") ? agent : `${agent}.md`;
|
|
14084
|
-
const
|
|
14085
|
-
const installed = isFile(join(dir,
|
|
14121
|
+
const path18 = agentInstallPath(file);
|
|
14122
|
+
const installed = isFile(join(dir, path18));
|
|
14086
14123
|
const group = agentGroupOf(file);
|
|
14087
|
-
return { agentPath:
|
|
14124
|
+
return { agentPath: path18, agentInstalled: installed, installCommand: installed ? void 0 : `kaddo add agents --group ${group}` };
|
|
14088
14125
|
};
|
|
14089
14126
|
const moduleRepo = isModule(config);
|
|
14090
14127
|
const coreRepo = isCore(config);
|
|
@@ -17637,7 +17674,7 @@ function runUnderstand() {
|
|
|
17637
17674
|
}
|
|
17638
17675
|
|
|
17639
17676
|
// src/core/classifier.ts
|
|
17640
|
-
import
|
|
17677
|
+
import path7 from "path";
|
|
17641
17678
|
var MIGRATION_PATTERNS = [
|
|
17642
17679
|
/supabase\/migrations\//,
|
|
17643
17680
|
/prisma\/migrations\//,
|
|
@@ -17676,7 +17713,7 @@ var DEP_PATTERNS = [
|
|
|
17676
17713
|
/^pom\.xml$/
|
|
17677
17714
|
];
|
|
17678
17715
|
function normalizePath2(p) {
|
|
17679
|
-
return p.split(
|
|
17716
|
+
return p.split(path7.sep).join("/");
|
|
17680
17717
|
}
|
|
17681
17718
|
function matchesAny2(file, patterns) {
|
|
17682
17719
|
const normalized = normalizePath2(file);
|
|
@@ -17919,7 +17956,7 @@ function runStatus() {
|
|
|
17919
17956
|
|
|
17920
17957
|
// src/commands/learn.ts
|
|
17921
17958
|
import fs3 from "fs";
|
|
17922
|
-
import
|
|
17959
|
+
import path8 from "path";
|
|
17923
17960
|
import matter13 from "gray-matter";
|
|
17924
17961
|
var ARCH_DIR9 = "knowledge";
|
|
17925
17962
|
var WORK_ITEMS_DIR2 = "knowledge/delivery/work-items";
|
|
@@ -17927,11 +17964,11 @@ function completedPathFor(filePath) {
|
|
|
17927
17964
|
const posix2 = filePath.replace(/\\/g, "/");
|
|
17928
17965
|
const m = posix2.match(/\/work-items\/(draft|ready|in-progress|blocked)\//);
|
|
17929
17966
|
if (!m) return filePath;
|
|
17930
|
-
const completedDir =
|
|
17967
|
+
const completedDir = path8.dirname(filePath).replace(
|
|
17931
17968
|
new RegExp(`[/\\\\]${m[1]}$`),
|
|
17932
|
-
|
|
17969
|
+
path8.sep + "completed"
|
|
17933
17970
|
);
|
|
17934
|
-
return
|
|
17971
|
+
return path8.join(completedDir, path8.basename(filePath));
|
|
17935
17972
|
}
|
|
17936
17973
|
function updateWorkItemFile(filePath, learning) {
|
|
17937
17974
|
const raw = readFile(filePath);
|
|
@@ -17963,7 +18000,7 @@ ${learning.trim()}
|
|
|
17963
18000
|
const newRaw = matter13.stringify(updatedContent, data);
|
|
17964
18001
|
const newPath = completedPathFor(filePath);
|
|
17965
18002
|
if (newPath !== filePath) {
|
|
17966
|
-
ensureDir(
|
|
18003
|
+
ensureDir(path8.dirname(newPath));
|
|
17967
18004
|
writeFile(newPath, newRaw);
|
|
17968
18005
|
fs3.unlinkSync(filePath);
|
|
17969
18006
|
} else {
|
|
@@ -18057,7 +18094,7 @@ async function runLearn(artifactId, opts = {}) {
|
|
|
18057
18094
|
}
|
|
18058
18095
|
const finalPath = updateWorkItemFile(filePath, enrichedLearning);
|
|
18059
18096
|
log.success(`${targetId} marked as completed`);
|
|
18060
|
-
log.success(`Learning recorded in ${finalPath.replace(dir +
|
|
18097
|
+
log.success(`Learning recorded in ${finalPath.replace(dir + path8.sep, "").replace(/\\/g, "/")}`);
|
|
18061
18098
|
if (hasExceptions) {
|
|
18062
18099
|
log.warn("Learning captured from a Work Item completed with validation exceptions.");
|
|
18063
18100
|
}
|
|
@@ -19363,7 +19400,7 @@ function runGraphExport(opts = {}) {
|
|
|
19363
19400
|
// src/core/system-topology.ts
|
|
19364
19401
|
import { parse as parseYaml17, stringify as stringifyYaml9 } from "yaml";
|
|
19365
19402
|
import fs4 from "fs";
|
|
19366
|
-
import
|
|
19403
|
+
import path9 from "path";
|
|
19367
19404
|
import crypto from "crypto";
|
|
19368
19405
|
var TOPOLOGY_FILE = "knowledge/tech/system-topology.yml";
|
|
19369
19406
|
var SYSTEM_ENTITY_KINDS = /* @__PURE__ */ new Set([
|
|
@@ -19529,7 +19566,7 @@ function serializeTopology(entities, relationships) {
|
|
|
19529
19566
|
return stringifyYaml9(doc);
|
|
19530
19567
|
}
|
|
19531
19568
|
function atomicWrite(filePath, content) {
|
|
19532
|
-
fs4.mkdirSync(
|
|
19569
|
+
fs4.mkdirSync(path9.dirname(filePath), { recursive: true });
|
|
19533
19570
|
const tmp = `${filePath}.${process.pid}.${Date.now()}.tmp`;
|
|
19534
19571
|
fs4.writeFileSync(tmp, content, "utf-8");
|
|
19535
19572
|
try {
|
|
@@ -19643,7 +19680,7 @@ async function runTopologyApply(file, opts = {}) {
|
|
|
19643
19680
|
|
|
19644
19681
|
// src/core/resource-write.ts
|
|
19645
19682
|
import fs5 from "fs";
|
|
19646
|
-
import
|
|
19683
|
+
import path10 from "path";
|
|
19647
19684
|
import matter15 from "gray-matter";
|
|
19648
19685
|
var RESOURCES_DIR = "knowledge/tech/resources";
|
|
19649
19686
|
var ResourceWriteError = class extends Error {
|
|
@@ -19782,7 +19819,7 @@ ${(input.purpose ?? "").trim() || "TODO: describe what this resource is for."}`;
|
|
|
19782
19819
|
const relPath = `${RESOURCES_DIR}/${slug4(title) || slug4(id)}.md`;
|
|
19783
19820
|
const filePath = join(dir, relPath);
|
|
19784
19821
|
if (exists(filePath)) throw new ResourceWriteError("DUPLICATE", `Resource file already exists: ${relPath}`);
|
|
19785
|
-
ensureDir(
|
|
19822
|
+
ensureDir(path10.dirname(filePath));
|
|
19786
19823
|
atomicWrite2(filePath, serialize(data, body));
|
|
19787
19824
|
return { id, path: relPath, findings };
|
|
19788
19825
|
}
|
|
@@ -20268,7 +20305,7 @@ var CANDIDATE_DISCOVERY_GUIDANCE = [
|
|
|
20268
20305
|
|
|
20269
20306
|
// src/core/deprecation-write.ts
|
|
20270
20307
|
import fs6 from "fs";
|
|
20271
|
-
import
|
|
20308
|
+
import path11 from "path";
|
|
20272
20309
|
import matter16 from "gray-matter";
|
|
20273
20310
|
var DeprecationWriteError = class extends Error {
|
|
20274
20311
|
constructor(code, message) {
|
|
@@ -20384,7 +20421,7 @@ ${(input.purpose ?? "").trim() || "TODO: describe what this plan retires and why
|
|
|
20384
20421
|
const relPath = `${DEPRECATION_PLANS_DIR}/${id}-${slug5(title) || "plan"}.md`;
|
|
20385
20422
|
const filePath = join(dir, relPath);
|
|
20386
20423
|
if (exists(filePath)) throw new DeprecationWriteError("DUPLICATE", `Plan file already exists: ${relPath}`);
|
|
20387
|
-
ensureDir(
|
|
20424
|
+
ensureDir(path11.dirname(filePath));
|
|
20388
20425
|
atomicWrite3(filePath, serialize2(data, body));
|
|
20389
20426
|
return { id, path: relPath, findings: [] };
|
|
20390
20427
|
}
|
|
@@ -20403,7 +20440,7 @@ function addTarget(dir, planId, input) {
|
|
|
20403
20440
|
}
|
|
20404
20441
|
data.targets = [...targets, raw];
|
|
20405
20442
|
atomicWrite3(filePath, serialize2(data, body));
|
|
20406
|
-
return { planId, targetId, path: `${DEPRECATION_PLANS_DIR}/${
|
|
20443
|
+
return { planId, targetId, path: `${DEPRECATION_PLANS_DIR}/${path11.basename(filePath)}`, findings };
|
|
20407
20444
|
}
|
|
20408
20445
|
function updateTarget(dir, planId, targetId, patch) {
|
|
20409
20446
|
const { filePath, data, body } = loadPlanRaw(dir, planId);
|
|
@@ -20419,7 +20456,7 @@ function updateTarget(dir, planId, targetId, patch) {
|
|
|
20419
20456
|
next[idx] = merged;
|
|
20420
20457
|
data.targets = next;
|
|
20421
20458
|
atomicWrite3(filePath, serialize2(data, body));
|
|
20422
|
-
return { planId, targetId: String(targets[idx].id), path: `${DEPRECATION_PLANS_DIR}/${
|
|
20459
|
+
return { planId, targetId: String(targets[idx].id), path: `${DEPRECATION_PLANS_DIR}/${path11.basename(filePath)}`, findings };
|
|
20423
20460
|
}
|
|
20424
20461
|
function removeTarget(dir, planId, targetId, opts = {}) {
|
|
20425
20462
|
const { filePath, data, body } = loadPlanRaw(dir, planId);
|
|
@@ -20432,7 +20469,7 @@ function removeTarget(dir, planId, targetId, opts = {}) {
|
|
|
20432
20469
|
}
|
|
20433
20470
|
data.targets = targets.filter((t) => String(t.id ?? "").toUpperCase() !== targetId.toUpperCase());
|
|
20434
20471
|
atomicWrite3(filePath, serialize2(data, body));
|
|
20435
|
-
return { removed: true, path: `${DEPRECATION_PLANS_DIR}/${
|
|
20472
|
+
return { removed: true, path: `${DEPRECATION_PLANS_DIR}/${path11.basename(filePath)}` };
|
|
20436
20473
|
}
|
|
20437
20474
|
|
|
20438
20475
|
// src/core/deprecation-runbook.ts
|
|
@@ -20515,7 +20552,7 @@ function buildProductionRunbookContext(dir, planId, targetId) {
|
|
|
20515
20552
|
blockers.push(`Dependency ${dependency.id} is not retired (current: ${dependency.lifecycle}).`);
|
|
20516
20553
|
}
|
|
20517
20554
|
}
|
|
20518
|
-
const
|
|
20555
|
+
const path18 = runbookPath(dir, target);
|
|
20519
20556
|
return {
|
|
20520
20557
|
eligible: blockers.length === 0,
|
|
20521
20558
|
plan: { id: plan.id, title: plan.title, purpose: plan.purpose },
|
|
@@ -20523,7 +20560,7 @@ function buildProductionRunbookContext(dir, planId, targetId) {
|
|
|
20523
20560
|
resource: target.resource ? getResource(dir, target.resource) : null,
|
|
20524
20561
|
dependencies,
|
|
20525
20562
|
blockers,
|
|
20526
|
-
nextPath:
|
|
20563
|
+
nextPath: path18,
|
|
20527
20564
|
nextStep: blockers.length > 0 ? "Resolve the listed safeguards; no production proposal can be persisted yet." : "Review the generated proposal, obtain human approval, execute manually, then record evidence and validate the observation window."
|
|
20528
20565
|
};
|
|
20529
20566
|
}
|
|
@@ -20616,8 +20653,8 @@ function renderRunbook(context) {
|
|
|
20616
20653
|
function createProductionRunbook(dir, planId, targetId) {
|
|
20617
20654
|
const context = buildProductionRunbookContext(dir, planId, targetId);
|
|
20618
20655
|
if (!context.eligible) throw new ProductionRunbookError(context.blockers.join(" "));
|
|
20619
|
-
const
|
|
20620
|
-
const id =
|
|
20656
|
+
const path18 = context.nextPath;
|
|
20657
|
+
const id = path18.split("/").pop()?.match(/^(RB-\d+)-/)?.[1] ?? "";
|
|
20621
20658
|
const content = matter17.stringify(renderRunbook(context), {
|
|
20622
20659
|
id,
|
|
20623
20660
|
type: PRODUCTION_RUNBOOK_ARTIFACT_TYPE,
|
|
@@ -20627,13 +20664,13 @@ function createProductionRunbook(dir, planId, targetId) {
|
|
|
20627
20664
|
resource: context.target.resource,
|
|
20628
20665
|
approval: { required: true, status: "pending", approved_by: null, approved_at: null }
|
|
20629
20666
|
});
|
|
20630
|
-
const absolute = join(dir,
|
|
20631
|
-
if (exists(absolute)) throw new ProductionRunbookError(`Runbook already exists: ${
|
|
20667
|
+
const absolute = join(dir, path18);
|
|
20668
|
+
if (exists(absolute)) throw new ProductionRunbookError(`Runbook already exists: ${path18}`);
|
|
20632
20669
|
writeFile(absolute, content);
|
|
20633
20670
|
return {
|
|
20634
20671
|
id,
|
|
20635
20672
|
title: `Production runbook \u2014 ${context.target.title ?? context.target.id}`,
|
|
20636
|
-
path:
|
|
20673
|
+
path: path18,
|
|
20637
20674
|
planId: context.plan.id,
|
|
20638
20675
|
targetId: context.target.id,
|
|
20639
20676
|
approval: { required: true, status: "pending", approvedBy: null, approvedAt: null },
|
|
@@ -20644,14 +20681,14 @@ function getProductionRunbook(dir, id) {
|
|
|
20644
20681
|
const root = join(dir, PRODUCTION_RUNBOOKS_DIR);
|
|
20645
20682
|
for (const name of readDir(root)) {
|
|
20646
20683
|
if (!name.toLowerCase().startsWith(`${id.toLowerCase()}-`) || !name.endsWith(".md")) continue;
|
|
20647
|
-
const
|
|
20648
|
-
const parsed = matter17(readFile(join(dir,
|
|
20684
|
+
const path18 = `${PRODUCTION_RUNBOOKS_DIR}/${name}`;
|
|
20685
|
+
const parsed = matter17(readFile(join(dir, path18)));
|
|
20649
20686
|
const data = parsed.data;
|
|
20650
20687
|
if (data.type !== PRODUCTION_RUNBOOK_ARTIFACT_TYPE) continue;
|
|
20651
20688
|
return {
|
|
20652
20689
|
id: stringValue(data.id) ?? id,
|
|
20653
20690
|
title: stringValue(data.title) ?? id,
|
|
20654
|
-
path:
|
|
20691
|
+
path: path18,
|
|
20655
20692
|
planId: stringValue(data.deprecation_plan) ?? "",
|
|
20656
20693
|
targetId: stringValue(data.deprecation_target) ?? "",
|
|
20657
20694
|
approval: parseApproval(data.approval),
|
|
@@ -20990,7 +21027,7 @@ ${runbook.id} \u2014 ${payload.valid ? "valid" : "invalid"}`);
|
|
|
20990
21027
|
|
|
20991
21028
|
// src/core/okf/export.ts
|
|
20992
21029
|
import fs7 from "fs";
|
|
20993
|
-
import
|
|
21030
|
+
import path12 from "path";
|
|
20994
21031
|
|
|
20995
21032
|
// src/core/okf/mapping.ts
|
|
20996
21033
|
import matter18 from "gray-matter";
|
|
@@ -22386,16 +22423,16 @@ function frontmatter(data) {
|
|
|
22386
22423
|
return lines.join("\n");
|
|
22387
22424
|
}
|
|
22388
22425
|
function relLink(fromPath, toPath) {
|
|
22389
|
-
const rel =
|
|
22426
|
+
const rel = path12.posix.relative(path12.posix.dirname(fromPath), toPath);
|
|
22390
22427
|
return rel.startsWith(".") ? rel : `./${rel}`;
|
|
22391
22428
|
}
|
|
22392
22429
|
function rewriteBodyLinks(body, sourcePath, srcToBundle, selfBundlePath) {
|
|
22393
|
-
const srcDir =
|
|
22430
|
+
const srcDir = path12.posix.dirname(sourcePath);
|
|
22394
22431
|
return body.replace(/\]\(([^)]+)\)/g, (whole, href) => {
|
|
22395
22432
|
const raw = href.trim();
|
|
22396
22433
|
const bare = raw.split("#")[0].split(" ")[0];
|
|
22397
22434
|
if (!bare || /^(https?:|mailto:|#)/.test(bare)) return whole;
|
|
22398
|
-
const candidate = bare.startsWith("/") ? bare.replace(/^\/+/, "") :
|
|
22435
|
+
const candidate = bare.startsWith("/") ? bare.replace(/^\/+/, "") : path12.posix.normalize(path12.posix.join(srcDir, bare));
|
|
22399
22436
|
const target = srcToBundle.get(candidate);
|
|
22400
22437
|
if (!target) return whole;
|
|
22401
22438
|
const anchor = raw.includes("#") ? "#" + raw.split("#").slice(1).join("#") : "";
|
|
@@ -22472,22 +22509,22 @@ function sensitiveLabels(content) {
|
|
|
22472
22509
|
return [...new Set(SENSITIVE_PATTERNS.filter((p) => p.re.test(content)).map((p) => p.label))];
|
|
22473
22510
|
}
|
|
22474
22511
|
function assertSafeDestination(dir, outputDir) {
|
|
22475
|
-
const root =
|
|
22476
|
-
const out =
|
|
22512
|
+
const root = path12.resolve(dir);
|
|
22513
|
+
const out = path12.resolve(outputDir);
|
|
22477
22514
|
const within = (child, parent) => {
|
|
22478
|
-
const rel =
|
|
22479
|
-
return rel === "" || !rel.startsWith("..") && !
|
|
22515
|
+
const rel = path12.relative(parent, child);
|
|
22516
|
+
return rel === "" || !rel.startsWith("..") && !path12.isAbsolute(rel);
|
|
22480
22517
|
};
|
|
22481
22518
|
if (out === root) throw new OkfExportError("UNSAFE_DESTINATION", "Refusing to export onto the project root.");
|
|
22482
22519
|
if (within(root, out)) throw new OkfExportError("UNSAFE_DESTINATION", "Refusing to export onto a parent of the project.");
|
|
22483
22520
|
for (const protectedDir of ["knowledge", "packages", "apps", "src", "node_modules", ".git"]) {
|
|
22484
|
-
const p =
|
|
22521
|
+
const p = path12.join(root, protectedDir);
|
|
22485
22522
|
if (out === p || within(out, p)) throw new OkfExportError("UNSAFE_DESTINATION", `Refusing to export into a protected directory: ${protectedDir}/`);
|
|
22486
22523
|
}
|
|
22487
22524
|
if (fs7.existsSync(out)) {
|
|
22488
22525
|
try {
|
|
22489
22526
|
const entries = fs7.readdirSync(out);
|
|
22490
|
-
const looksOkf = entries.includes("index.md") && /okf_version/.test(fs7.readFileSync(
|
|
22527
|
+
const looksOkf = entries.includes("index.md") && /okf_version/.test(fs7.readFileSync(path12.join(out, "index.md"), "utf-8"));
|
|
22491
22528
|
if (entries.length > 0 && !looksOkf) {
|
|
22492
22529
|
throw new OkfExportError("UNSAFE_DESTINATION", `Destination is not empty and is not an OKF bundle: ${outputDir}. Use an empty or dedicated directory.`);
|
|
22493
22530
|
}
|
|
@@ -22512,7 +22549,7 @@ function detectCollisions(concepts) {
|
|
|
22512
22549
|
}
|
|
22513
22550
|
function exportOkf(dir, opts = {}) {
|
|
22514
22551
|
const outRel = opts.output ?? OKF_DEFAULT_OUTPUT;
|
|
22515
|
-
const outputDir =
|
|
22552
|
+
const outputDir = path12.isAbsolute(outRel) ? outRel : path12.join(dir, outRel);
|
|
22516
22553
|
assertSafeDestination(dir, outputDir);
|
|
22517
22554
|
const extraWarnings = [];
|
|
22518
22555
|
const artifacts = discoverKnowledge(dir);
|
|
@@ -22568,7 +22605,7 @@ ${c.body ?? ""}`;
|
|
|
22568
22605
|
const dirs = /* @__PURE__ */ new Map();
|
|
22569
22606
|
const childDirs = /* @__PURE__ */ new Map();
|
|
22570
22607
|
for (const c of concepts) {
|
|
22571
|
-
const d =
|
|
22608
|
+
const d = path12.posix.dirname(c.path);
|
|
22572
22609
|
(dirs.get(d) ?? dirs.set(d, []).get(d)).push(c);
|
|
22573
22610
|
const segs = d === "." ? [] : d.split("/");
|
|
22574
22611
|
for (let i = 0; i < segs.length; i++) {
|
|
@@ -22594,8 +22631,8 @@ ${c.body ?? ""}`;
|
|
|
22594
22631
|
try {
|
|
22595
22632
|
fs7.rmSync(staging, { recursive: true, force: true });
|
|
22596
22633
|
for (const [rel, content] of files) {
|
|
22597
|
-
const full =
|
|
22598
|
-
fs7.mkdirSync(
|
|
22634
|
+
const full = path12.join(staging, rel);
|
|
22635
|
+
fs7.mkdirSync(path12.dirname(full), { recursive: true });
|
|
22599
22636
|
fs7.writeFileSync(full, content, "utf-8");
|
|
22600
22637
|
}
|
|
22601
22638
|
const backup = `${outputDir}.old-${process.pid}-${Date.now()}`;
|
|
@@ -22624,13 +22661,13 @@ ${c.body ?? ""}`;
|
|
|
22624
22661
|
|
|
22625
22662
|
// src/core/okf/validate.ts
|
|
22626
22663
|
import fs8 from "fs";
|
|
22627
|
-
import
|
|
22664
|
+
import path13 from "path";
|
|
22628
22665
|
import matter20 from "gray-matter";
|
|
22629
22666
|
function walk(root) {
|
|
22630
22667
|
const out = [];
|
|
22631
22668
|
const rec = (d) => {
|
|
22632
22669
|
for (const entry of fs8.readdirSync(d)) {
|
|
22633
|
-
const full =
|
|
22670
|
+
const full = path13.join(d, entry);
|
|
22634
22671
|
const st = fs8.statSync(full);
|
|
22635
22672
|
if (st.isDirectory()) rec(full);
|
|
22636
22673
|
else if (entry.endsWith(".md")) out.push(full);
|
|
@@ -22652,24 +22689,24 @@ function internalLinks(body) {
|
|
|
22652
22689
|
}
|
|
22653
22690
|
function validateOkf(dir, opts = {}) {
|
|
22654
22691
|
const loc = opts.location ?? OKF_DEFAULT_OUTPUT;
|
|
22655
|
-
const bundleDir =
|
|
22692
|
+
const bundleDir = path13.isAbsolute(loc) ? loc : path13.join(dir, loc);
|
|
22656
22693
|
const findings = [];
|
|
22657
22694
|
if (!fs8.existsSync(bundleDir)) {
|
|
22658
22695
|
findings.push({ level: "conformance", message: `OKF bundle directory not found: ${loc}. Run \`kaddo okf export\` first.` });
|
|
22659
22696
|
return { dir: bundleDir, conformant: false, conceptCount: 0, findings, counts: { conformance: 1, warning: 0, info: 0 } };
|
|
22660
22697
|
}
|
|
22661
22698
|
const files = walk(bundleDir);
|
|
22662
|
-
const rel = (f) =>
|
|
22699
|
+
const rel = (f) => path13.relative(bundleDir, f).split(path13.sep).join("/");
|
|
22663
22700
|
const present = new Set(files.map(rel));
|
|
22664
22701
|
const idToFile = /* @__PURE__ */ new Map();
|
|
22665
22702
|
let conceptCount = 0;
|
|
22666
|
-
const rootIndex =
|
|
22703
|
+
const rootIndex = path13.join(bundleDir, "index.md");
|
|
22667
22704
|
if (!fs8.existsSync(rootIndex)) {
|
|
22668
22705
|
findings.push({ level: "warning", message: "No root index.md \u2014 the bundle has no top-level navigation entry." });
|
|
22669
22706
|
}
|
|
22670
22707
|
for (const file of files) {
|
|
22671
22708
|
const r = rel(file);
|
|
22672
|
-
const isIndex =
|
|
22709
|
+
const isIndex = path13.basename(file) === "index.md";
|
|
22673
22710
|
let data = {};
|
|
22674
22711
|
try {
|
|
22675
22712
|
data = matter20(fs8.readFileSync(file, "utf-8")).data ?? {};
|
|
@@ -22700,7 +22737,7 @@ function validateOkf(dir, opts = {}) {
|
|
|
22700
22737
|
}
|
|
22701
22738
|
})();
|
|
22702
22739
|
for (const href of internalLinks(body)) {
|
|
22703
|
-
const resolved =
|
|
22740
|
+
const resolved = path13.posix.normalize(path13.posix.join(path13.posix.dirname(r), href));
|
|
22704
22741
|
if (!present.has(resolved)) findings.push({ level: "info", file: r, message: `Internal link not resolvable yet: ${href}` });
|
|
22705
22742
|
}
|
|
22706
22743
|
}
|
|
@@ -22770,7 +22807,7 @@ import { parse as parseYaml19, stringify as stringifyYaml10 } from "yaml";
|
|
|
22770
22807
|
|
|
22771
22808
|
// src/core/work-item-write.ts
|
|
22772
22809
|
import fs9 from "fs";
|
|
22773
|
-
import
|
|
22810
|
+
import path14 from "path";
|
|
22774
22811
|
import crypto2 from "crypto";
|
|
22775
22812
|
import matter21 from "gray-matter";
|
|
22776
22813
|
var WORK_ITEMS_DIR3 = "knowledge/delivery/work-items";
|
|
@@ -22782,6 +22819,7 @@ var WorkItemWriteError = class extends Error {
|
|
|
22782
22819
|
}
|
|
22783
22820
|
code;
|
|
22784
22821
|
};
|
|
22822
|
+
var EDITABLE_STATES = ["draft"];
|
|
22785
22823
|
function revisionOf(raw) {
|
|
22786
22824
|
return crypto2.createHash("sha256").update(raw, "utf-8").digest("hex");
|
|
22787
22825
|
}
|
|
@@ -22807,7 +22845,7 @@ function nextWorkItemId2(dir) {
|
|
|
22807
22845
|
return `WI-${String(max + 1).padStart(3, "0")}`;
|
|
22808
22846
|
}
|
|
22809
22847
|
function atomicWrite4(filePath, content) {
|
|
22810
|
-
fs9.mkdirSync(
|
|
22848
|
+
fs9.mkdirSync(path14.dirname(filePath), { recursive: true });
|
|
22811
22849
|
const tmp = `${filePath}.${process.pid}.${Date.now()}.tmp`;
|
|
22812
22850
|
fs9.writeFileSync(tmp, content, "utf-8");
|
|
22813
22851
|
try {
|
|
@@ -22820,6 +22858,16 @@ function atomicWrite4(filePath, content) {
|
|
|
22820
22858
|
throw err;
|
|
22821
22859
|
}
|
|
22822
22860
|
}
|
|
22861
|
+
function findArtifact(dir, id) {
|
|
22862
|
+
const match = discoverWorkItems(dir).find((a) => (a.id || a.title) === id);
|
|
22863
|
+
if (!match) throw new WorkItemWriteError("WORK_ITEM_NOT_FOUND", `Work Item "${id}" was not found.`);
|
|
22864
|
+
return { filePath: match.filePath, relPath: match.relPath };
|
|
22865
|
+
}
|
|
22866
|
+
function validModuleIds(dir) {
|
|
22867
|
+
const ids = /* @__PURE__ */ new Set(["core"]);
|
|
22868
|
+
for (const m of loadMappedModules(dir)) ids.add(m.id);
|
|
22869
|
+
return ids;
|
|
22870
|
+
}
|
|
22823
22871
|
var SECTION_ORDER = [
|
|
22824
22872
|
"Actor",
|
|
22825
22873
|
"Outcome",
|
|
@@ -22831,6 +22879,35 @@ var SECTION_ORDER = [
|
|
|
22831
22879
|
"Acceptance criteria"
|
|
22832
22880
|
];
|
|
22833
22881
|
var KNOWN_HEADINGS = new Set(SECTION_ORDER.map((s) => s.toLowerCase()));
|
|
22882
|
+
function parseBody(content) {
|
|
22883
|
+
const lines = content.split(/\r?\n/);
|
|
22884
|
+
const preamble = [];
|
|
22885
|
+
const sections = [];
|
|
22886
|
+
let current = null;
|
|
22887
|
+
let buffer = [];
|
|
22888
|
+
let seenHeading = false;
|
|
22889
|
+
const flush2 = () => {
|
|
22890
|
+
if (current) {
|
|
22891
|
+
current.body = buffer.join("\n").trim();
|
|
22892
|
+
sections.push(current);
|
|
22893
|
+
}
|
|
22894
|
+
buffer = [];
|
|
22895
|
+
};
|
|
22896
|
+
for (const line of lines) {
|
|
22897
|
+
const m = line.match(/^##\s+(.*?)\s*$/);
|
|
22898
|
+
if (m) {
|
|
22899
|
+
seenHeading = true;
|
|
22900
|
+
flush2();
|
|
22901
|
+
current = { heading: m[1].trim(), normalized: m[1].trim().toLowerCase(), body: "" };
|
|
22902
|
+
} else if (!seenHeading) {
|
|
22903
|
+
preamble.push(line);
|
|
22904
|
+
} else {
|
|
22905
|
+
buffer.push(line);
|
|
22906
|
+
}
|
|
22907
|
+
}
|
|
22908
|
+
flush2();
|
|
22909
|
+
return { preamble, sections };
|
|
22910
|
+
}
|
|
22834
22911
|
function renderList(items) {
|
|
22835
22912
|
return items.map((i) => `- ${i.trim()}`).filter((l) => l.trim() !== "-").join("\n");
|
|
22836
22913
|
}
|
|
@@ -22880,6 +22957,77 @@ function serialize3(data, body) {
|
|
|
22880
22957
|
${body.trim()}
|
|
22881
22958
|
`, data);
|
|
22882
22959
|
}
|
|
22960
|
+
function toInput(data, content) {
|
|
22961
|
+
const { sections } = parseBody(content);
|
|
22962
|
+
const sec = (name) => {
|
|
22963
|
+
const s = sections.find((x) => x.normalized === name);
|
|
22964
|
+
return s && s.body.trim() ? s.body.trim() : void 0;
|
|
22965
|
+
};
|
|
22966
|
+
const bullets = (name) => {
|
|
22967
|
+
const body = sec(name);
|
|
22968
|
+
if (!body) return [];
|
|
22969
|
+
return body.split(/\r?\n/).map((l) => l.replace(/^\s*[-*+]\s+(\[[ xX]\]\s*)?/, "").trim()).filter(Boolean);
|
|
22970
|
+
};
|
|
22971
|
+
const criteria = (() => {
|
|
22972
|
+
const body = sec("acceptance criteria");
|
|
22973
|
+
if (!body) return [];
|
|
22974
|
+
const out = [];
|
|
22975
|
+
for (const line of body.split(/\r?\n/)) {
|
|
22976
|
+
const m = line.match(/^\s*[-*+]\s+(.*)$/);
|
|
22977
|
+
if (!m) continue;
|
|
22978
|
+
let text2 = m[1].trim();
|
|
22979
|
+
let checked = null;
|
|
22980
|
+
const cb = text2.match(/^\[([ xX])\]\s*(.*)$/);
|
|
22981
|
+
if (cb) {
|
|
22982
|
+
checked = cb[1].toLowerCase() === "x";
|
|
22983
|
+
text2 = cb[2].trim();
|
|
22984
|
+
}
|
|
22985
|
+
if (text2) out.push({ text: text2, checked });
|
|
22986
|
+
}
|
|
22987
|
+
return out;
|
|
22988
|
+
})();
|
|
22989
|
+
const sc = data.scope_confidence;
|
|
22990
|
+
const mc = data.module_coverage;
|
|
22991
|
+
const ia = data.impact_analysis?.surfaces;
|
|
22992
|
+
return {
|
|
22993
|
+
title: String(data.title ?? ""),
|
|
22994
|
+
type: String(data.type ?? "feature"),
|
|
22995
|
+
summary: data.summary ? String(data.summary) : void 0,
|
|
22996
|
+
actor: sec("actor"),
|
|
22997
|
+
outcome: sec("outcome"),
|
|
22998
|
+
currentBehavior: sec("current behavior"),
|
|
22999
|
+
targetBehavior: sec("target behavior"),
|
|
23000
|
+
entryPoints: sec("entry points"),
|
|
23001
|
+
endToEndFlow: sec("end-to-end flow"),
|
|
23002
|
+
scopeConfidence: sc && sc.level ? { level: String(sc.level), reasons: Array.isArray(sc.reasons) ? sc.reasons.map(String) : [] } : null,
|
|
23003
|
+
scopeUnknowns: bullets("scope unknowns"),
|
|
23004
|
+
affectedModules: Array.isArray(data.affected_modules) ? data.affected_modules.map(String) : [],
|
|
23005
|
+
moduleCoverage: mc ? Object.entries(mc).map(([id, v]) => ({ id, status: String(v.status ?? ""), ...v.reason ? { reason: String(v.reason) } : {} })) : [],
|
|
23006
|
+
impactAnalysis: ia ? Object.entries(ia).map(([surface, v]) => ({ surface, status: String(v.status ?? ""), ...v.reason ? { reason: String(v.reason) } : {}, ...v.question ? { question: String(v.question) } : {} })) : [],
|
|
23007
|
+
acceptanceCriteria: criteria,
|
|
23008
|
+
decisions: Array.isArray(data.decisions) ? data.decisions.map(String) : [],
|
|
23009
|
+
relatedKnowledge: Array.isArray(data.related_knowledge) ? data.related_knowledge.map(String) : [],
|
|
23010
|
+
owners: Array.isArray(data.owners) ? data.owners.map(String) : [],
|
|
23011
|
+
contributors: Array.isArray(data.contributors) ? data.contributors.map(String) : []
|
|
23012
|
+
};
|
|
23013
|
+
}
|
|
23014
|
+
function getWorkItemForEdit(dir, id) {
|
|
23015
|
+
const { filePath, relPath } = findArtifact(dir, id);
|
|
23016
|
+
const raw = readFile(filePath);
|
|
23017
|
+
const { data, content } = matter21(raw);
|
|
23018
|
+
const status = lifecycleStateOf({ status: String(data.status ?? ""), filePath });
|
|
23019
|
+
const input = toInput(data, content);
|
|
23020
|
+
const editable = EDITABLE_STATES.includes(status);
|
|
23021
|
+
return {
|
|
23022
|
+
...input,
|
|
23023
|
+
id,
|
|
23024
|
+
status,
|
|
23025
|
+
revision: revisionOf(raw),
|
|
23026
|
+
path: relPath,
|
|
23027
|
+
editable,
|
|
23028
|
+
...editable ? {} : { editableReason: status === "ready" ? "This Work Item is Ready. Reopen it as Draft to edit its scope." : `This Work Item is ${status} and cannot be edited from the structured editor.` }
|
|
23029
|
+
};
|
|
23030
|
+
}
|
|
22883
23031
|
var CAPTURE_SECTIONS = [
|
|
22884
23032
|
{ field: "problem", heading: "Problem" },
|
|
22885
23033
|
{ field: "expected_result", heading: "Expected result" },
|
|
@@ -22948,6 +23096,85 @@ function createWorkItem(dir, opts) {
|
|
|
22948
23096
|
atomicWrite4(filePath, raw);
|
|
22949
23097
|
return { id, path: relPath, revision: revisionOf(raw) };
|
|
22950
23098
|
}
|
|
23099
|
+
function validateWorkItem(dir, id) {
|
|
23100
|
+
const { filePath } = findArtifact(dir, id);
|
|
23101
|
+
const raw = readFile(filePath);
|
|
23102
|
+
const { data, content } = matter21(raw);
|
|
23103
|
+
const input = toInput(data, content);
|
|
23104
|
+
const findings = [];
|
|
23105
|
+
const modules = validModuleIds(dir);
|
|
23106
|
+
for (const c of input.moduleCoverage) {
|
|
23107
|
+
if (c.status === "affected" && !input.affectedModules.includes(c.id)) {
|
|
23108
|
+
findings.push({ level: "blocking", message: `${c.id} is marked affected in module coverage but is missing from affected_modules.` });
|
|
23109
|
+
}
|
|
23110
|
+
}
|
|
23111
|
+
for (const m of input.affectedModules) {
|
|
23112
|
+
if (!modules.has(m)) findings.push({ level: "blocking", message: `Module "${m}" is not registered in this project.` });
|
|
23113
|
+
}
|
|
23114
|
+
if (!input.targetBehavior?.trim()) findings.push({ level: "warning", message: "Target behavior is not defined." });
|
|
23115
|
+
if (input.acceptanceCriteria.length === 0) findings.push({ level: "warning", message: "No acceptance criteria have been defined." });
|
|
23116
|
+
if (input.scopeConfidence?.level === "low") findings.push({ level: "warning", message: "Scope confidence is Low." });
|
|
23117
|
+
if (!input.scopeConfidence) findings.push({ level: "warning", message: "Scope confidence has not been assessed." });
|
|
23118
|
+
for (const c of input.moduleCoverage) {
|
|
23119
|
+
if (c.status === "reviewed-not-affected") findings.push({ level: "fyi", message: `${c.id} was reviewed and is not affected.` });
|
|
23120
|
+
}
|
|
23121
|
+
for (const s of input.impactAnalysis) {
|
|
23122
|
+
if (s.status === "unknown") findings.push({ level: "fyi", message: `Impact on ${s.surface} is unknown.` });
|
|
23123
|
+
}
|
|
23124
|
+
const topology = loadSystemTopology(dir);
|
|
23125
|
+
const entityById = new Map(topology.entities.map((e) => [e.id, e]));
|
|
23126
|
+
const fm2 = data;
|
|
23127
|
+
const idOf = (raw2) => typeof raw2 === "string" ? raw2 : raw2 && typeof raw2 === "object" ? String(raw2.id ?? "") : "";
|
|
23128
|
+
const affectedEntities = Array.isArray(fm2.affected_system_entities) ? fm2.affected_system_entities.map(idOf).filter(Boolean) : [];
|
|
23129
|
+
for (const eid of affectedEntities) {
|
|
23130
|
+
const e = entityById.get(eid);
|
|
23131
|
+
if (!e) {
|
|
23132
|
+
findings.push({ level: "blocking", message: `Affected system entity "${eid}" does not exist in the semantic topology.` });
|
|
23133
|
+
continue;
|
|
23134
|
+
}
|
|
23135
|
+
if (e.moduleId && !input.affectedModules.includes(e.moduleId)) {
|
|
23136
|
+
findings.push({ level: "warning", message: `System entity "${e.label}" belongs to module "${e.moduleId}", which is not in affected_modules.` });
|
|
23137
|
+
}
|
|
23138
|
+
}
|
|
23139
|
+
if (Array.isArray(fm2.reviewed_system_entities)) {
|
|
23140
|
+
for (const r of fm2.reviewed_system_entities) {
|
|
23141
|
+
const rid = r && typeof r === "object" ? String(r.id ?? "") : "";
|
|
23142
|
+
if (rid && !entityById.has(rid)) findings.push({ level: "warning", message: `Reviewed system entity "${rid}" does not exist in the semantic topology.` });
|
|
23143
|
+
}
|
|
23144
|
+
}
|
|
23145
|
+
const canMarkReady = !findings.some((f) => f.level === "blocking");
|
|
23146
|
+
return { findings, canMarkReady };
|
|
23147
|
+
}
|
|
23148
|
+
var ALLOWED = { draft: ["ready"], ready: ["draft", "in-progress"] };
|
|
23149
|
+
function transitionWorkItem(dir, id, to, expectedRevision) {
|
|
23150
|
+
const { filePath } = findArtifact(dir, id);
|
|
23151
|
+
const raw = readFile(filePath);
|
|
23152
|
+
if (revisionOf(raw) !== expectedRevision) {
|
|
23153
|
+
throw new WorkItemWriteError("WORK_ITEM_CONFLICT", "This Work Item changed outside Kaddo Admin. Reload the latest version before continuing.");
|
|
23154
|
+
}
|
|
23155
|
+
const { data, content } = matter21(raw);
|
|
23156
|
+
const from = lifecycleStateOf({ status: String(data.status ?? ""), filePath });
|
|
23157
|
+
if (!(ALLOWED[from] ?? []).includes(to)) {
|
|
23158
|
+
throw new WorkItemWriteError("INVALID_TRANSITION", `Cannot transition a ${from} Work Item to ${to}.`);
|
|
23159
|
+
}
|
|
23160
|
+
if (to === "ready") {
|
|
23161
|
+
const { canMarkReady } = validateWorkItem(dir, id);
|
|
23162
|
+
if (!canMarkReady) throw new WorkItemWriteError("INVALID_TRANSITION", "This Work Item has blocking issues and cannot be marked Ready.");
|
|
23163
|
+
}
|
|
23164
|
+
const nextData = { ...data, status: to };
|
|
23165
|
+
const nextRaw = serialize3(nextData, content);
|
|
23166
|
+
const filename = path14.basename(filePath);
|
|
23167
|
+
const targetRel = `${WORK_ITEMS_DIR3}/${to}/${filename}`;
|
|
23168
|
+
const targetPath = join(dir, targetRel);
|
|
23169
|
+
atomicWrite4(targetPath, nextRaw);
|
|
23170
|
+
if (path14.resolve(targetPath) !== path14.resolve(filePath)) {
|
|
23171
|
+
try {
|
|
23172
|
+
fs9.rmSync(filePath, { force: true });
|
|
23173
|
+
} catch {
|
|
23174
|
+
}
|
|
23175
|
+
}
|
|
23176
|
+
return { revision: revisionOf(nextRaw), status: to, path: targetRel };
|
|
23177
|
+
}
|
|
22951
23178
|
|
|
22952
23179
|
// ../integrations/src/errors.ts
|
|
22953
23180
|
var RETRYABLE = /* @__PURE__ */ new Set([
|
|
@@ -23633,8 +23860,8 @@ async function handleJiraResponse(res) {
|
|
|
23633
23860
|
}
|
|
23634
23861
|
return await res.json();
|
|
23635
23862
|
}
|
|
23636
|
-
async function jiraFetch(baseUrl,
|
|
23637
|
-
const url = new URL(
|
|
23863
|
+
async function jiraFetch(baseUrl, path18, auth, timeoutMs, params) {
|
|
23864
|
+
const url = new URL(path18, baseUrl + "/");
|
|
23638
23865
|
if (params) for (const [k, v] of Object.entries(params)) url.searchParams.set(k, v);
|
|
23639
23866
|
const controller = new AbortController();
|
|
23640
23867
|
const timer = setTimeout(() => controller.abort(), timeoutMs);
|
|
@@ -23652,8 +23879,8 @@ async function jiraFetch(baseUrl, path16, auth, timeoutMs, params) {
|
|
|
23652
23879
|
clearTimeout(timer);
|
|
23653
23880
|
}
|
|
23654
23881
|
}
|
|
23655
|
-
async function jiraPost(baseUrl,
|
|
23656
|
-
const url = new URL(
|
|
23882
|
+
async function jiraPost(baseUrl, path18, auth, timeoutMs, body) {
|
|
23883
|
+
const url = new URL(path18, baseUrl + "/");
|
|
23657
23884
|
const controller = new AbortController();
|
|
23658
23885
|
const timer = setTimeout(() => controller.abort(), timeoutMs);
|
|
23659
23886
|
try {
|
|
@@ -24608,7 +24835,7 @@ function runAssetsUpdate(kind, opts = {}) {
|
|
|
24608
24835
|
|
|
24609
24836
|
// src/commands/ready.ts
|
|
24610
24837
|
import fs11 from "fs";
|
|
24611
|
-
import
|
|
24838
|
+
import path15 from "path";
|
|
24612
24839
|
import matter23 from "gray-matter";
|
|
24613
24840
|
function validateReadiness(content, frontmatter2) {
|
|
24614
24841
|
const warnings = [];
|
|
@@ -24671,10 +24898,10 @@ function transitionToReady(filePath) {
|
|
|
24671
24898
|
const posix2 = filePath.replace(/\\/g, "/");
|
|
24672
24899
|
let newPath = filePath;
|
|
24673
24900
|
if (posix2.includes("/work-items/draft/")) {
|
|
24674
|
-
const readyDir =
|
|
24901
|
+
const readyDir = path15.dirname(filePath).replace(/[/\\]draft$/, path15.sep + "ready");
|
|
24675
24902
|
ensureDir(readyDir);
|
|
24676
|
-
const fileName =
|
|
24677
|
-
newPath =
|
|
24903
|
+
const fileName = path15.basename(filePath);
|
|
24904
|
+
newPath = path15.join(readyDir, fileName);
|
|
24678
24905
|
}
|
|
24679
24906
|
return { newPath, newContent };
|
|
24680
24907
|
}
|
|
@@ -24745,8 +24972,8 @@ async function runReady(id, opts = {}) {
|
|
|
24745
24972
|
fs11.unlinkSync(wi.filePath);
|
|
24746
24973
|
log.success(`Updated status: ready`);
|
|
24747
24974
|
log.success(`Moved file:`);
|
|
24748
|
-
log.info(` ${
|
|
24749
|
-
log.info(` \u2192 ${
|
|
24975
|
+
log.info(` ${path15.relative(dir, wi.filePath)}`);
|
|
24976
|
+
log.info(` \u2192 ${path15.relative(dir, newPath)}`);
|
|
24750
24977
|
} else {
|
|
24751
24978
|
writeFile(wi.filePath, newContent);
|
|
24752
24979
|
log.success(`Updated status: ready`);
|
|
@@ -24756,8 +24983,36 @@ async function runReady(id, opts = {}) {
|
|
|
24756
24983
|
outro(`Work Item ${wi.id} is ready.`);
|
|
24757
24984
|
}
|
|
24758
24985
|
|
|
24986
|
+
// src/commands/start.ts
|
|
24987
|
+
async function runStart(id, opts = {}) {
|
|
24988
|
+
intro(`kaddo start ${id}`);
|
|
24989
|
+
let edit;
|
|
24990
|
+
try {
|
|
24991
|
+
edit = getWorkItemForEdit(process.cwd(), id);
|
|
24992
|
+
} catch (error) {
|
|
24993
|
+
log.error(error.message);
|
|
24994
|
+
return;
|
|
24995
|
+
}
|
|
24996
|
+
if (edit.status !== "ready") {
|
|
24997
|
+
log.error(`Work Item ${id} is "${edit.status}". Only ready Work Items can be started.`);
|
|
24998
|
+
return;
|
|
24999
|
+
}
|
|
25000
|
+
if (!opts.yes && !await confirm({ message: "Start implementation and move this Work Item to in-progress?" })) {
|
|
25001
|
+
cancel("Cancelled.");
|
|
25002
|
+
return;
|
|
25003
|
+
}
|
|
25004
|
+
try {
|
|
25005
|
+
const result = transitionWorkItem(process.cwd(), id, "in-progress", edit.revision);
|
|
25006
|
+
log.success(`Updated status: ${result.status}`);
|
|
25007
|
+
log.success(`Moved file: ${result.path}`);
|
|
25008
|
+
outro(`Work Item ${id} is in progress.`);
|
|
25009
|
+
} catch (error) {
|
|
25010
|
+
log.error(error instanceof WorkItemWriteError ? error.message : error.message);
|
|
25011
|
+
}
|
|
25012
|
+
}
|
|
25013
|
+
|
|
24759
25014
|
// src/commands/admin.ts
|
|
24760
|
-
import
|
|
25015
|
+
import path16 from "path";
|
|
24761
25016
|
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
24762
25017
|
import net from "net";
|
|
24763
25018
|
function isPortAvailable(port, host) {
|
|
@@ -24772,17 +25027,17 @@ function isPortAvailable(port, host) {
|
|
|
24772
25027
|
});
|
|
24773
25028
|
}
|
|
24774
25029
|
function resolveStaticDir() {
|
|
24775
|
-
const __dirname =
|
|
25030
|
+
const __dirname = path16.dirname(fileURLToPath2(import.meta.url));
|
|
24776
25031
|
const candidates = [
|
|
24777
25032
|
// Monorepo development: prefer the freshly built admin over the copy bundled into the CLI dist.
|
|
24778
25033
|
// The CLI build copies admin/dist into dist/admin-dist, but that copy can be stale when the admin
|
|
24779
25034
|
// was rebuilt after the CLI (build order is not guaranteed in `pnpm -r build`). Serving the admin
|
|
24780
25035
|
// package's own dist first ensures `kaddo admin` always shows the current frontend in dev. This
|
|
24781
25036
|
// path does not exist in a published npm install (admin is private), so it falls back below.
|
|
24782
|
-
|
|
24783
|
-
|
|
25037
|
+
path16.resolve(__dirname, "..", "..", "admin", "dist"),
|
|
25038
|
+
path16.resolve(__dirname, "..", "node_modules", "@kaddo", "admin", "dist"),
|
|
24784
25039
|
// Bundled inside CLI dist (npm install)
|
|
24785
|
-
|
|
25040
|
+
path16.resolve(__dirname, "admin-dist")
|
|
24786
25041
|
];
|
|
24787
25042
|
for (const c of candidates) {
|
|
24788
25043
|
if (exists(join(c, "index.html"))) return c;
|
|
@@ -24824,8 +25079,8 @@ async function runAdmin(opts = {}) {
|
|
|
24824
25079
|
}
|
|
24825
25080
|
let adminServer;
|
|
24826
25081
|
try {
|
|
24827
|
-
const __dirname =
|
|
24828
|
-
const bundled =
|
|
25082
|
+
const __dirname = path16.dirname(fileURLToPath2(import.meta.url));
|
|
25083
|
+
const bundled = path16.resolve(__dirname, "admin-server", "index.js");
|
|
24829
25084
|
if (exists(bundled)) {
|
|
24830
25085
|
const { pathToFileURL } = await import("url");
|
|
24831
25086
|
adminServer = await import(pathToFileURL(bundled).href);
|
|
@@ -24917,7 +25172,9 @@ function toListItem(a) {
|
|
|
24917
25172
|
releaseStatus: a.releaseStatus || null,
|
|
24918
25173
|
affectedModules: a.affectedModules,
|
|
24919
25174
|
scopeConfidenceLevel: a.scopeConfidence?.level ?? null,
|
|
24920
|
-
initiative: a.initiative || null
|
|
25175
|
+
initiative: a.initiative || null,
|
|
25176
|
+
owners: Array.isArray(a.rawFrontmatter.owners) ? a.rawFrontmatter.owners.map(String).filter(Boolean) : [],
|
|
25177
|
+
contributors: Array.isArray(a.rawFrontmatter.contributors) ? a.rawFrontmatter.contributors.map(String).filter(Boolean) : []
|
|
24921
25178
|
};
|
|
24922
25179
|
}
|
|
24923
25180
|
function getWorkItem(dir, workItemId) {
|
|
@@ -24966,8 +25223,8 @@ function parseGraphReason(v) {
|
|
|
24966
25223
|
if (!v || typeof v !== "object") return null;
|
|
24967
25224
|
const o = v;
|
|
24968
25225
|
const relationship = typeof o.relationship === "string" && o.relationship.trim() ? o.relationship.trim() : null;
|
|
24969
|
-
const
|
|
24970
|
-
return relationship ||
|
|
25226
|
+
const path18 = Array.isArray(o.path) ? o.path.map(String).filter(Boolean) : [];
|
|
25227
|
+
return relationship || path18.length ? { relationship, path: path18 } : null;
|
|
24971
25228
|
}
|
|
24972
25229
|
function parseExplain(o) {
|
|
24973
25230
|
const refs = Array.isArray(o.evidence) ? o.evidence : Array.isArray(o.evidence_refs) ? o.evidence_refs : [];
|
|
@@ -25894,7 +26151,12 @@ function collectImplementationEvidence(dir, workItemId, input) {
|
|
|
25894
26151
|
} : {}
|
|
25895
26152
|
};
|
|
25896
26153
|
}
|
|
25897
|
-
return {
|
|
26154
|
+
return {
|
|
26155
|
+
repositories,
|
|
26156
|
+
...input.acVerifications.length > 0 ? {
|
|
26157
|
+
ac_verifications: input.acVerifications.map((verification) => ({ ...verification }))
|
|
26158
|
+
} : {}
|
|
26159
|
+
};
|
|
25898
26160
|
}
|
|
25899
26161
|
function verifyWorkItem(dir, workItemId, input) {
|
|
25900
26162
|
const evidence = collectImplementationEvidence(dir, workItemId, input);
|
|
@@ -25954,6 +26216,9 @@ function evaluateCompletion(verification) {
|
|
|
25954
26216
|
warnings.push(`Completion exception "${ex.id}" is still proposed (not yet accepted).`);
|
|
25955
26217
|
}
|
|
25956
26218
|
}
|
|
26219
|
+
if (verification.acSummary.total === 0) {
|
|
26220
|
+
blockers.push("No acceptance criteria were detected; completion evidence is insufficient.");
|
|
26221
|
+
}
|
|
25957
26222
|
if (verification.acSummary.failed > 0) {
|
|
25958
26223
|
const failedACs = verification.acVerifications.filter((ac) => ac.status === "failed");
|
|
25959
26224
|
for (const ac of failedACs) {
|
|
@@ -25965,10 +26230,16 @@ function evaluateCompletion(verification) {
|
|
|
25965
26230
|
blockers.push(f.message);
|
|
25966
26231
|
}
|
|
25967
26232
|
if (verification.acSummary.manualReview > 0) {
|
|
25968
|
-
|
|
26233
|
+
blockers.push(`${verification.acSummary.manualReview} AC(s) require manual review.`);
|
|
25969
26234
|
}
|
|
25970
26235
|
if (verification.acSummary.notVerified > 0) {
|
|
25971
|
-
|
|
26236
|
+
blockers.push(`${verification.acSummary.notVerified} AC(s) not yet verified.`);
|
|
26237
|
+
}
|
|
26238
|
+
if (verification.implementationStatus !== "completed") {
|
|
26239
|
+
blockers.push(`Implementation status is "${verification.implementationStatus}", not "completed".`);
|
|
26240
|
+
}
|
|
26241
|
+
if (!["passed", "accepted-with-exceptions"].includes(verification.validationStatus)) {
|
|
26242
|
+
blockers.push(`Validation status is "${verification.validationStatus}", not passed.`);
|
|
25972
26243
|
}
|
|
25973
26244
|
const warningFindings = verification.findings.filter((f) => f.severity === "warning");
|
|
25974
26245
|
for (const f of warningFindings) {
|
|
@@ -25985,8 +26256,8 @@ function evaluateCompletion(verification) {
|
|
|
25985
26256
|
}
|
|
25986
26257
|
let readiness;
|
|
25987
26258
|
if (blockers.length > 0) {
|
|
25988
|
-
const
|
|
25989
|
-
if (
|
|
26259
|
+
const needsEvidence = blockers.every((b) => b.startsWith("AC failed:") || b.includes("acceptance criteria") || b.includes("AC(s)") || b.startsWith("Implementation status") || b.startsWith("Validation status"));
|
|
26260
|
+
if (needsEvidence) {
|
|
25990
26261
|
readiness = "NEEDS_WORK";
|
|
25991
26262
|
reasons.push("Acceptance criteria have failures that must be addressed.");
|
|
25992
26263
|
} else {
|
|
@@ -26068,12 +26339,34 @@ function deriveImplementationStatus(repos) {
|
|
|
26068
26339
|
}
|
|
26069
26340
|
|
|
26070
26341
|
// src/commands/verify.ts
|
|
26342
|
+
function normalizeAC(text2) {
|
|
26343
|
+
return text2.trim().toLowerCase().replace(/\s+/g, " ");
|
|
26344
|
+
}
|
|
26345
|
+
function storedACVerifications(value) {
|
|
26346
|
+
if (!Array.isArray(value)) return /* @__PURE__ */ new Map();
|
|
26347
|
+
return new Map(value.filter((entry) => Boolean(entry) && typeof entry === "object").filter((entry) => typeof entry.criterion === "string").map((entry) => [normalizeAC(entry.criterion), entry]));
|
|
26348
|
+
}
|
|
26349
|
+
function buildACVerifications(acs, persisted) {
|
|
26350
|
+
const persistedACs = storedACVerifications(persisted);
|
|
26351
|
+
return acs.map((ac) => {
|
|
26352
|
+
const stored = persistedACs.get(normalizeAC(ac.criterion));
|
|
26353
|
+
const validStatus = stored?.status === "passed" || stored?.status === "failed" || stored?.status === "not-verified" || stored?.status === "manual-review-required" ? stored.status : "not-verified";
|
|
26354
|
+
const hasEvidence = typeof stored?.evidence === "string" && stored.evidence.trim().length > 0 && typeof stored?.reference === "string" && stored.reference.trim().length > 0;
|
|
26355
|
+
return {
|
|
26356
|
+
criterion: ac.criterion,
|
|
26357
|
+
status: validStatus === "passed" && !hasEvidence ? "not-verified" : validStatus,
|
|
26358
|
+
...typeof stored?.evidence === "string" ? { evidence: stored.evidence } : {},
|
|
26359
|
+
...typeof stored?.reference === "string" ? { reference: stored.reference } : {},
|
|
26360
|
+
...stored?.method === "automated" || stored?.method === "manual" ? { method: stored.method } : {}
|
|
26361
|
+
};
|
|
26362
|
+
});
|
|
26363
|
+
}
|
|
26071
26364
|
function extractACsFromBody(body) {
|
|
26072
26365
|
const lines = body.split(/\r?\n/);
|
|
26073
26366
|
let inAC = false;
|
|
26074
26367
|
const acs = [];
|
|
26075
26368
|
for (const line of lines) {
|
|
26076
|
-
if (/^#{1,6}\s+(acceptance\s+criteria|criterios\s+de\s+aceptaci[oó]n)
|
|
26369
|
+
if (/^#{1,6}\s+(?:\d+(?:\.\d+)*\.?\s+)?(acceptance\s+criteria|criterios\s+de\s+aceptaci[oó]n)\s*$/i.test(line)) {
|
|
26077
26370
|
inAC = true;
|
|
26078
26371
|
continue;
|
|
26079
26372
|
}
|
|
@@ -26142,11 +26435,7 @@ async function runVerify(workItemId, opts = {}) {
|
|
|
26142
26435
|
})) : void 0
|
|
26143
26436
|
};
|
|
26144
26437
|
}) : [{ repoId: "core", changedPaths, validations: [] }];
|
|
26145
|
-
const acVerifications = acs
|
|
26146
|
-
criterion: ac.criterion,
|
|
26147
|
-
status: ac.checked ? "passed" : "not-verified",
|
|
26148
|
-
...ac.checked ? { evidence: "Explicitly checked in the Work Item acceptance criteria." } : {}
|
|
26149
|
-
}));
|
|
26438
|
+
const acVerifications = buildACVerifications(acs, existingEvidence?.ac_verifications);
|
|
26150
26439
|
const input = {
|
|
26151
26440
|
repos,
|
|
26152
26441
|
acVerifications
|
|
@@ -26250,7 +26539,7 @@ async function runVerify(workItemId, opts = {}) {
|
|
|
26250
26539
|
}
|
|
26251
26540
|
|
|
26252
26541
|
// src/core/knowledge-consolidation.ts
|
|
26253
|
-
import { createHash as
|
|
26542
|
+
import { createHash as createHash3 } from "crypto";
|
|
26254
26543
|
import matter27 from "gray-matter";
|
|
26255
26544
|
var KNOWLEDGE6 = "knowledge";
|
|
26256
26545
|
var CONSOLIDATION_CATEGORIES = [
|
|
@@ -26270,7 +26559,7 @@ function relFromDir(dir, filePath) {
|
|
|
26270
26559
|
return f.startsWith(d + "/") ? f.slice(d.length + 1) : f;
|
|
26271
26560
|
}
|
|
26272
26561
|
function sha256(content) {
|
|
26273
|
-
return
|
|
26562
|
+
return createHash3("sha256").update(content, "utf-8").digest("hex");
|
|
26274
26563
|
}
|
|
26275
26564
|
var SHINGLE_SIZE = 6;
|
|
26276
26565
|
var MIN_SHARED_RUN = 6;
|
|
@@ -26321,15 +26610,15 @@ function longestSharedRun(a, b) {
|
|
|
26321
26610
|
let bestSnippet = "";
|
|
26322
26611
|
for (const block of a.blocks) {
|
|
26323
26612
|
let run = 0;
|
|
26324
|
-
let
|
|
26613
|
+
let runStart2 = 0;
|
|
26325
26614
|
for (let i = 0; i + SHINGLE_SIZE <= block.length; i++) {
|
|
26326
26615
|
const key = block.slice(i, i + SHINGLE_SIZE).join(" ");
|
|
26327
26616
|
if (b.set.has(key)) {
|
|
26328
|
-
if (run === 0)
|
|
26617
|
+
if (run === 0) runStart2 = i;
|
|
26329
26618
|
run += 1;
|
|
26330
26619
|
if (run > best) {
|
|
26331
26620
|
best = run;
|
|
26332
|
-
bestSnippet = block.slice(
|
|
26621
|
+
bestSnippet = block.slice(runStart2, runStart2 + SHINGLE_SIZE + run - 1).join(" ");
|
|
26333
26622
|
}
|
|
26334
26623
|
} else {
|
|
26335
26624
|
run = 0;
|
|
@@ -27386,9 +27675,9 @@ function markRegistered(dir, identity) {
|
|
|
27386
27675
|
ensureDir(join(dir, TELEMETRY_DIR));
|
|
27387
27676
|
writeFile(identityPath(dir), JSON.stringify(identity, null, 2));
|
|
27388
27677
|
}
|
|
27389
|
-
function signPayload(identity, method,
|
|
27678
|
+
function signPayload(identity, method, path18, timestamp, nonce, bodySha256) {
|
|
27390
27679
|
const canonical = `${method}
|
|
27391
|
-
${
|
|
27680
|
+
${path18}
|
|
27392
27681
|
${identity.installationId}
|
|
27393
27682
|
${timestamp}
|
|
27394
27683
|
${nonce}
|
|
@@ -27613,6 +27902,75 @@ function runTelemetryDisable() {
|
|
|
27613
27902
|
outro("Run `kaddo telemetry enable` to re-enable.");
|
|
27614
27903
|
}
|
|
27615
27904
|
|
|
27905
|
+
// src/core/collaboration.ts
|
|
27906
|
+
import path17 from "path";
|
|
27907
|
+
function matchesWorkItemReference(value, id) {
|
|
27908
|
+
return new RegExp(`(^|[^A-Za-z0-9_-])${id.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")}(?=$|[^A-Za-z0-9_-])`, "i").test(value);
|
|
27909
|
+
}
|
|
27910
|
+
async function observationsForProject(dir) {
|
|
27911
|
+
const corePath = path17.resolve(dir);
|
|
27912
|
+
const mapped = loadMappedModules(dir).filter((module) => Boolean(module.repoPath)).map((module) => ({ path: path17.resolve(corePath, module.repoPath), repositoryId: `module:${module.id}` }));
|
|
27913
|
+
const candidates = [{ path: corePath, repositoryId: "core" }, ...mapped];
|
|
27914
|
+
const resolved = await Promise.all(candidates.map(async (candidate) => ({ ...candidate, root: await getGitRoot(candidate.path) })));
|
|
27915
|
+
const repositories = /* @__PURE__ */ new Map();
|
|
27916
|
+
for (const item of resolved) if (item.root && !repositories.has(item.root)) repositories.set(item.root, { root: item.root, repositoryId: item.repositoryId });
|
|
27917
|
+
const observations = await Promise.all([...repositories.values()].map((repo) => observeGit(repo.root, 100, repo.repositoryId)));
|
|
27918
|
+
return observations;
|
|
27919
|
+
}
|
|
27920
|
+
async function collaborationForWorkItems(dir, ids) {
|
|
27921
|
+
const observations = await observationsForProject(dir);
|
|
27922
|
+
return ids.map((id) => {
|
|
27923
|
+
const wi = getWorkItem(dir, id);
|
|
27924
|
+
const linkedCommits = [];
|
|
27925
|
+
const relatedBranches = [];
|
|
27926
|
+
for (const observation of observations) {
|
|
27927
|
+
const repository = observation.repository ?? "local";
|
|
27928
|
+
for (const commit of observation.commits) {
|
|
27929
|
+
if (!matchesWorkItemReference(commit.subject, wi.id)) continue;
|
|
27930
|
+
linkedCommits.push({ repository, sha: commit.sha, author: commit.author, date: commit.date, subject: commit.subject, paths: commit.files.slice(0, 50), attribution: "explicit-reference", evidence: `Exact reference ${wi.id} in commit subject.` });
|
|
27931
|
+
}
|
|
27932
|
+
for (const branch of observation.branches) {
|
|
27933
|
+
if (!matchesWorkItemReference(branch.name, wi.id)) continue;
|
|
27934
|
+
relatedBranches.push({ repository, name: branch.name, attribution: "branch-associated", evidence: `Exact reference ${wi.id} in local branch name.` });
|
|
27935
|
+
}
|
|
27936
|
+
}
|
|
27937
|
+
const inspectedCommits = observations.reduce((total, observation) => total + observation.commits.length, 0);
|
|
27938
|
+
const available = observations.filter((observation) => observation.availability === "available").length;
|
|
27939
|
+
const availability = available === observations.length ? "available" : available > 0 ? "partial" : observations.some((observation) => observation.availability === "partial") ? "partial" : "unavailable";
|
|
27940
|
+
return {
|
|
27941
|
+
workItemId: wi.id,
|
|
27942
|
+
responsibility: { owners: wi.owners, contributors: wi.contributors },
|
|
27943
|
+
git: {
|
|
27944
|
+
availability,
|
|
27945
|
+
repositories: observations.flatMap((observation) => observation.repository ? [observation.repository] : []),
|
|
27946
|
+
observedAuthors: [...new Set(linkedCommits.map((commit) => commit.author))],
|
|
27947
|
+
linkedCommits,
|
|
27948
|
+
relatedBranches,
|
|
27949
|
+
unattributedActivityCount: Math.max(0, inspectedCommits - linkedCommits.length),
|
|
27950
|
+
inspectedAt: observations.map((observation) => observation.inspectedAt).sort().at(-1) ?? null,
|
|
27951
|
+
coverage: { maxCommits: observations[0]?.limit ?? 100, inspectedCommits, note: "Only the core repository and explicitly mapped module repositories were inspected with read-only Git metadata. File overlap never creates attribution." }
|
|
27952
|
+
}
|
|
27953
|
+
};
|
|
27954
|
+
});
|
|
27955
|
+
}
|
|
27956
|
+
async function getWorkItemCollaboration(dir, id) {
|
|
27957
|
+
return (await collaborationForWorkItems(dir, [id]))[0];
|
|
27958
|
+
}
|
|
27959
|
+
|
|
27960
|
+
// src/commands/collaboration.ts
|
|
27961
|
+
async function runCollaborationShow(dir, id) {
|
|
27962
|
+
try {
|
|
27963
|
+
console.log(JSON.stringify(await getWorkItemCollaboration(dir, id), null, 2));
|
|
27964
|
+
} catch (err) {
|
|
27965
|
+
if (err instanceof WorkItemNotFoundError) {
|
|
27966
|
+
console.error(err.message);
|
|
27967
|
+
process.exitCode = 1;
|
|
27968
|
+
return;
|
|
27969
|
+
}
|
|
27970
|
+
throw err;
|
|
27971
|
+
}
|
|
27972
|
+
}
|
|
27973
|
+
|
|
27616
27974
|
// src/core/initiative-analysis.ts
|
|
27617
27975
|
var SUCCESS_HEADING_RE = /^#{1,6}\s*(success criteria|criterios de[ét]xito|criterios de éxito)\s*$/i;
|
|
27618
27976
|
var HEADING_RE2 = /^#{1,6}\s+/;
|
|
@@ -27960,6 +28318,9 @@ program.command("create [type]").description("Create a work item (feature, bugfi
|
|
|
27960
28318
|
program.command("ready <id>").description("Mark a draft Work Item as ready for implementation after human review").option("--yes", "Skip confirmation prompt").action(async (id, opts) => {
|
|
27961
28319
|
await runReady(id, opts);
|
|
27962
28320
|
});
|
|
28321
|
+
program.command("start <id>").description("Start a ready Work Item and move it to in-progress").option("--yes", "Skip confirmation prompt").action(async (id, opts) => {
|
|
28322
|
+
await runStart(id, opts);
|
|
28323
|
+
});
|
|
27963
28324
|
var pocCmd = program.command("poc").description("Proof of Concept lifecycle helpers");
|
|
27964
28325
|
pocCmd.command("report").description("Prepare a deterministic final POC report handoff (no LLM call, no write)").option("--json", "Output the report context as JSON").action((opts) => {
|
|
27965
28326
|
runPocReport(opts);
|
|
@@ -27968,8 +28329,8 @@ var capsuleCmd = program.command("capsule").description("Export this project as
|
|
|
27968
28329
|
capsuleCmd.command("export").description("Write a Knowledge Capsule about this project to .kaddo/exports/").option("--scope <scope>", 'Export scope: "system" includes all mapped modules').option("--module <id>", "Export a capsule for a specific mapped module").action((opts) => {
|
|
27969
28330
|
runCapsuleExport(opts);
|
|
27970
28331
|
});
|
|
27971
|
-
capsuleCmd.command("add <path>").description("Register an external Knowledge Capsule as project context (.kaddo/external.yml)").action((
|
|
27972
|
-
runCapsuleAdd(
|
|
28332
|
+
capsuleCmd.command("add <path>").description("Register an external Knowledge Capsule as project context (.kaddo/external.yml)").action((path18) => {
|
|
28333
|
+
runCapsuleAdd(path18);
|
|
27973
28334
|
});
|
|
27974
28335
|
var graphCmd = program.command("graph").description("Export the lightweight, file-based knowledge graph of the project");
|
|
27975
28336
|
graphCmd.command("export").description("Write the knowledge graph to .kaddo/graph.json and .kaddo/graph.mmd").option("--scope <scope>", "Graph scope: active (default) or all").option("--format <format>", "Output format: json, mermaid (default: both)").action((opts) => {
|
|
@@ -28202,6 +28563,10 @@ initiativeCmd.command("analyze <id>").description("Analyze an initiative: succes
|
|
|
28202
28563
|
initiativeCmd.command("complete <id>").description("Review completion readiness and mark an initiative completed (human-confirmed)").option("--yes", "Skip the confirmation prompt").action(async (id, opts) => {
|
|
28203
28564
|
await runInitiativeComplete(id, opts);
|
|
28204
28565
|
});
|
|
28566
|
+
var collaborationCmd = program.command("collaboration").description("Read declared responsibility and bounded, read-only local Git evidence");
|
|
28567
|
+
collaborationCmd.command("show <id>").description("Show collaboration evidence for one Work Item").action(async (id) => {
|
|
28568
|
+
await runCollaborationShow(cwd(), id);
|
|
28569
|
+
});
|
|
28205
28570
|
var telemetryCmd = program.command("telemetry").description("Manage anonymous usage telemetry");
|
|
28206
28571
|
telemetryCmd.command("status").description("Show telemetry status (enabled, registered, pending events)").action(() => {
|
|
28207
28572
|
runTelemetryStatus();
|