@kaddo/cli 3.112.0 → 3.112.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 +94 -76
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1390,8 +1390,8 @@ function loadConfig(dir) {
|
|
|
1390
1390
|
const parsed = configSchema.safeParse(raw ?? {});
|
|
1391
1391
|
if (!parsed.success) {
|
|
1392
1392
|
const issues = parsed.error.issues.map((i) => {
|
|
1393
|
-
const
|
|
1394
|
-
return
|
|
1393
|
+
const path12 = i.path.join(".");
|
|
1394
|
+
return path12 ? ` - ${path12}: ${i.message}` : ` - ${i.message}`;
|
|
1395
1395
|
}).join("\n");
|
|
1396
1396
|
throw new ConfigError(`Invalid .kaddo/config.yml:
|
|
1397
1397
|
${issues}`);
|
|
@@ -7044,10 +7044,10 @@ function analyzeGuard(touchedFiles, artifacts, silentWithoutOwnership) {
|
|
|
7044
7044
|
import { parse as parseYaml5, stringify as stringifyYaml3 } from "yaml";
|
|
7045
7045
|
var IGNORE_FILE = ".kaddo/ignores.yml";
|
|
7046
7046
|
function loadIgnores(dir) {
|
|
7047
|
-
const
|
|
7048
|
-
if (!exists(
|
|
7047
|
+
const path12 = join(dir, IGNORE_FILE);
|
|
7048
|
+
if (!exists(path12)) return [];
|
|
7049
7049
|
try {
|
|
7050
|
-
const raw = readFile(
|
|
7050
|
+
const raw = readFile(path12);
|
|
7051
7051
|
const parsed = parseYaml5(raw);
|
|
7052
7052
|
return Array.isArray(parsed) ? parsed : [];
|
|
7053
7053
|
} catch {
|
|
@@ -7055,7 +7055,7 @@ function loadIgnores(dir) {
|
|
|
7055
7055
|
}
|
|
7056
7056
|
}
|
|
7057
7057
|
function saveIgnore(dir, entry) {
|
|
7058
|
-
const
|
|
7058
|
+
const path12 = join(dir, IGNORE_FILE);
|
|
7059
7059
|
const existing = loadIgnores(dir);
|
|
7060
7060
|
const idx = existing.findIndex((e) => e.artifact_id === entry.artifact_id);
|
|
7061
7061
|
if (idx >= 0) {
|
|
@@ -7063,17 +7063,17 @@ function saveIgnore(dir, entry) {
|
|
|
7063
7063
|
} else {
|
|
7064
7064
|
existing.push(entry);
|
|
7065
7065
|
}
|
|
7066
|
-
writeFile(
|
|
7066
|
+
writeFile(path12, stringifyYaml3(existing));
|
|
7067
7067
|
}
|
|
7068
7068
|
function isIgnored(ignores, artifactId) {
|
|
7069
7069
|
return ignores.find((e) => e.artifact_id === artifactId);
|
|
7070
7070
|
}
|
|
7071
7071
|
function removeIgnore(dir, artifactId) {
|
|
7072
|
-
const
|
|
7072
|
+
const path12 = join(dir, IGNORE_FILE);
|
|
7073
7073
|
const existing = loadIgnores(dir);
|
|
7074
7074
|
const filtered = existing.filter((e) => e.artifact_id !== artifactId);
|
|
7075
7075
|
if (filtered.length === existing.length) return false;
|
|
7076
|
-
writeFile(
|
|
7076
|
+
writeFile(path12, stringifyYaml3(filtered));
|
|
7077
7077
|
return true;
|
|
7078
7078
|
}
|
|
7079
7079
|
|
|
@@ -7095,11 +7095,11 @@ function moduleArtifactCoverage(dir, id) {
|
|
|
7095
7095
|
};
|
|
7096
7096
|
}
|
|
7097
7097
|
function loadMappedModules(dir) {
|
|
7098
|
-
const
|
|
7099
|
-
if (!exists(
|
|
7098
|
+
const path12 = join(dir, DESCRIPTOR_PATH);
|
|
7099
|
+
if (!exists(path12)) return [];
|
|
7100
7100
|
let parsed;
|
|
7101
7101
|
try {
|
|
7102
|
-
parsed = parseYaml6(readFile(
|
|
7102
|
+
parsed = parseYaml6(readFile(path12));
|
|
7103
7103
|
} catch {
|
|
7104
7104
|
return [];
|
|
7105
7105
|
}
|
|
@@ -7843,7 +7843,7 @@ function buildGuardHistory(dir) {
|
|
|
7843
7843
|
const d = hotspotDir(t.code_path);
|
|
7844
7844
|
hotspotMap.set(d, (hotspotMap.get(d) ?? 0) + 1);
|
|
7845
7845
|
}
|
|
7846
|
-
const hotspots = [...hotspotMap.entries()].map(([
|
|
7846
|
+
const hotspots = [...hotspotMap.entries()].map(([path12, warnings]) => ({ path: path12, warnings })).sort((a, b) => b.warnings - a.warnings);
|
|
7847
7847
|
return {
|
|
7848
7848
|
available: true,
|
|
7849
7849
|
total_runs: sorted.length,
|
|
@@ -10481,10 +10481,10 @@ function slugify2(name) {
|
|
|
10481
10481
|
return name.trim().toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "");
|
|
10482
10482
|
}
|
|
10483
10483
|
function readModulesDescriptor(dir) {
|
|
10484
|
-
const
|
|
10485
|
-
if (!exists(
|
|
10484
|
+
const path12 = join(dir, DESCRIPTOR_PATH2);
|
|
10485
|
+
if (!exists(path12)) return { version: 1, modules: [] };
|
|
10486
10486
|
try {
|
|
10487
|
-
const parsed = parseYaml10(readFile(
|
|
10487
|
+
const parsed = parseYaml10(readFile(path12));
|
|
10488
10488
|
return { version: parsed.version ?? 1, modules: parsed.modules ?? [] };
|
|
10489
10489
|
} catch {
|
|
10490
10490
|
return { version: 1, modules: [] };
|
|
@@ -10864,7 +10864,7 @@ function sectionParagraph(md, title) {
|
|
|
10864
10864
|
}
|
|
10865
10865
|
return "";
|
|
10866
10866
|
}
|
|
10867
|
-
function parseCapsule(id,
|
|
10867
|
+
function parseCapsule(id, path12, md) {
|
|
10868
10868
|
const { data } = matter3(md);
|
|
10869
10869
|
const updatedAt = data.updated_at ? String(data.updated_at) : void 0;
|
|
10870
10870
|
let ageDays = null;
|
|
@@ -10874,7 +10874,7 @@ function parseCapsule(id, path11, md) {
|
|
|
10874
10874
|
}
|
|
10875
10875
|
return {
|
|
10876
10876
|
id,
|
|
10877
|
-
path:
|
|
10877
|
+
path: path12,
|
|
10878
10878
|
system: data.system ? String(data.system) : id,
|
|
10879
10879
|
owner: data.owner ? String(data.owner) : void 0,
|
|
10880
10880
|
updatedAt,
|
|
@@ -11135,9 +11135,9 @@ function buildGraph(dir, config, opts = {}, now = /* @__PURE__ */ new Date()) {
|
|
|
11135
11135
|
];
|
|
11136
11136
|
const presentLayers = [];
|
|
11137
11137
|
for (const layer2 of layerDocs) {
|
|
11138
|
-
const
|
|
11139
|
-
if (
|
|
11140
|
-
addNode({ id: layer2.id, type: layer2.type, label: layer2.label, path:
|
|
11138
|
+
const path12 = layer2.files.map((f) => `${KNOWLEDGE3}/${f}`).find((rel) => exists(join(dir, rel)));
|
|
11139
|
+
if (path12) {
|
|
11140
|
+
addNode({ id: layer2.id, type: layer2.type, label: layer2.label, path: path12 });
|
|
11141
11141
|
presentLayers.push(layer2.id);
|
|
11142
11142
|
}
|
|
11143
11143
|
}
|
|
@@ -12700,10 +12700,10 @@ function resolveNextStep(dir, now = /* @__PURE__ */ new Date()) {
|
|
|
12700
12700
|
const q = (rel) => analyzeKnowledgeArtifact(dir, rel);
|
|
12701
12701
|
const resolveAgent = (agent) => {
|
|
12702
12702
|
const file = agent.endsWith(".md") ? agent : `${agent}.md`;
|
|
12703
|
-
const
|
|
12704
|
-
const installed = isFile(join(dir,
|
|
12703
|
+
const path12 = agentInstallPath(file);
|
|
12704
|
+
const installed = isFile(join(dir, path12));
|
|
12705
12705
|
const group = agentGroupOf(file);
|
|
12706
|
-
return { agentPath:
|
|
12706
|
+
return { agentPath: path12, agentInstalled: installed, installCommand: installed ? void 0 : `kaddo add agents --group ${group}` };
|
|
12707
12707
|
};
|
|
12708
12708
|
const moduleRepo = isModule(config);
|
|
12709
12709
|
const coreRepo = isCore(config);
|
|
@@ -16442,15 +16442,21 @@ function runStatus() {
|
|
|
16442
16442
|
}
|
|
16443
16443
|
|
|
16444
16444
|
// src/commands/learn.ts
|
|
16445
|
+
import fs3 from "fs";
|
|
16446
|
+
import path7 from "path";
|
|
16445
16447
|
import matter9 from "gray-matter";
|
|
16446
16448
|
var ARCH_DIR9 = "knowledge";
|
|
16447
16449
|
var WORK_ITEMS_DIR2 = "knowledge/delivery/work-items";
|
|
16448
16450
|
function findWorkItemFile(dir, id) {
|
|
16449
|
-
const
|
|
16450
|
-
|
|
16451
|
-
|
|
16452
|
-
|
|
16453
|
-
|
|
16451
|
+
const wis = discoverWorkItems(dir);
|
|
16452
|
+
const match = wis.find((w) => w.id.toLowerCase() === id.toLowerCase()) ?? wis.find((w) => path7.basename(w.filePath).toLowerCase().includes(id.toLowerCase()));
|
|
16453
|
+
return match ? match.filePath : null;
|
|
16454
|
+
}
|
|
16455
|
+
function completedPathFor(filePath) {
|
|
16456
|
+
const folder = lifecycleFolderOf(filePath);
|
|
16457
|
+
if (!folder || folder === "completed") return filePath;
|
|
16458
|
+
const completedDir = path7.dirname(filePath).replace(new RegExp(`[/\\\\]${folder}$`), path7.sep + "completed");
|
|
16459
|
+
return path7.join(completedDir, path7.basename(filePath));
|
|
16454
16460
|
}
|
|
16455
16461
|
function updateWorkItemFile(filePath, learning) {
|
|
16456
16462
|
const raw = readFile(filePath);
|
|
@@ -16480,7 +16486,15 @@ ${learning.trim()}
|
|
|
16480
16486
|
`;
|
|
16481
16487
|
}
|
|
16482
16488
|
const newRaw = matter9.stringify(updatedContent, data);
|
|
16489
|
+
const targetPath = completedPathFor(filePath);
|
|
16490
|
+
if (targetPath !== filePath) {
|
|
16491
|
+
ensureDir(path7.dirname(targetPath));
|
|
16492
|
+
writeFile(targetPath, newRaw);
|
|
16493
|
+
fs3.unlinkSync(filePath);
|
|
16494
|
+
return targetPath;
|
|
16495
|
+
}
|
|
16483
16496
|
writeFile(filePath, newRaw);
|
|
16497
|
+
return filePath;
|
|
16484
16498
|
}
|
|
16485
16499
|
async function runLearn(artifactId, opts = {}) {
|
|
16486
16500
|
const dir = cwd();
|
|
@@ -16489,9 +16503,8 @@ async function runLearn(artifactId, opts = {}) {
|
|
|
16489
16503
|
process.exit(1);
|
|
16490
16504
|
}
|
|
16491
16505
|
intro("kaddo learn");
|
|
16492
|
-
const
|
|
16493
|
-
|
|
16494
|
-
(a) => (a.status === "in-progress" || a.status === "completed" || a.status === "done") && a.type !== "current-state" && a.type !== "roadmap"
|
|
16506
|
+
const closable = discoverWorkItems(dir).filter(
|
|
16507
|
+
(a) => a.lifecycle === "in-progress" || a.lifecycle === "completed"
|
|
16495
16508
|
);
|
|
16496
16509
|
if (closable.length === 0) {
|
|
16497
16510
|
log.warn("No in-progress or completed work items found.");
|
|
@@ -16563,9 +16576,14 @@ async function runLearn(artifactId, opts = {}) {
|
|
|
16563
16576
|
}
|
|
16564
16577
|
enrichedLearning += "\n\n> " + notes.join(" ");
|
|
16565
16578
|
}
|
|
16566
|
-
updateWorkItemFile(filePath, enrichedLearning);
|
|
16579
|
+
const finalPath = updateWorkItemFile(filePath, enrichedLearning);
|
|
16567
16580
|
log.success(`${targetId} marked as completed`);
|
|
16568
|
-
|
|
16581
|
+
if (finalPath !== filePath) {
|
|
16582
|
+
log.success(`Moved file:`);
|
|
16583
|
+
log.info(` ${path7.relative(dir, filePath)}`);
|
|
16584
|
+
log.info(` \u2192 ${path7.relative(dir, finalPath)}`);
|
|
16585
|
+
}
|
|
16586
|
+
log.success(`Learning recorded in ${path7.relative(dir, finalPath)}`);
|
|
16569
16587
|
if (hasExceptions) {
|
|
16570
16588
|
log.warn("Learning captured from a Work Item completed with validation exceptions.");
|
|
16571
16589
|
}
|
|
@@ -17713,8 +17731,8 @@ function runGraphExport(opts = {}) {
|
|
|
17713
17731
|
|
|
17714
17732
|
// src/core/system-topology.ts
|
|
17715
17733
|
import { parse as parseYaml17, stringify as stringifyYaml8 } from "yaml";
|
|
17716
|
-
import
|
|
17717
|
-
import
|
|
17734
|
+
import fs4 from "fs";
|
|
17735
|
+
import path8 from "path";
|
|
17718
17736
|
import crypto from "crypto";
|
|
17719
17737
|
var TOPOLOGY_FILE = "knowledge/tech/system-topology.yml";
|
|
17720
17738
|
var SYSTEM_ENTITY_KINDS = /* @__PURE__ */ new Set([
|
|
@@ -17880,14 +17898,14 @@ function serializeTopology(entities, relationships) {
|
|
|
17880
17898
|
return stringifyYaml8(doc);
|
|
17881
17899
|
}
|
|
17882
17900
|
function atomicWrite(filePath, content) {
|
|
17883
|
-
|
|
17901
|
+
fs4.mkdirSync(path8.dirname(filePath), { recursive: true });
|
|
17884
17902
|
const tmp = `${filePath}.${process.pid}.${Date.now()}.tmp`;
|
|
17885
|
-
|
|
17903
|
+
fs4.writeFileSync(tmp, content, "utf-8");
|
|
17886
17904
|
try {
|
|
17887
|
-
|
|
17905
|
+
fs4.renameSync(tmp, filePath);
|
|
17888
17906
|
} catch (err) {
|
|
17889
17907
|
try {
|
|
17890
|
-
|
|
17908
|
+
fs4.rmSync(tmp, { force: true });
|
|
17891
17909
|
} catch {
|
|
17892
17910
|
}
|
|
17893
17911
|
throw err;
|
|
@@ -17997,8 +18015,8 @@ import matter12 from "gray-matter";
|
|
|
17997
18015
|
import { parse as parseYaml18, stringify as stringifyYaml9 } from "yaml";
|
|
17998
18016
|
|
|
17999
18017
|
// src/core/work-item-write.ts
|
|
18000
|
-
import
|
|
18001
|
-
import
|
|
18018
|
+
import fs5 from "fs";
|
|
18019
|
+
import path9 from "path";
|
|
18002
18020
|
import crypto2 from "crypto";
|
|
18003
18021
|
import matter11 from "gray-matter";
|
|
18004
18022
|
var WORK_ITEMS_DIR3 = "knowledge/delivery/work-items";
|
|
@@ -18021,7 +18039,7 @@ function nextWorkItemId2(dir) {
|
|
|
18021
18039
|
let max = 0;
|
|
18022
18040
|
const walk = (d) => {
|
|
18023
18041
|
if (!exists(d)) return;
|
|
18024
|
-
for (const entry of
|
|
18042
|
+
for (const entry of fs5.readdirSync(d)) {
|
|
18025
18043
|
const full = join(d, entry);
|
|
18026
18044
|
if (isFile(full)) {
|
|
18027
18045
|
const m = entry.match(/WI-(\d+)/);
|
|
@@ -18035,14 +18053,14 @@ function nextWorkItemId2(dir) {
|
|
|
18035
18053
|
return `WI-${String(max + 1).padStart(3, "0")}`;
|
|
18036
18054
|
}
|
|
18037
18055
|
function atomicWrite2(filePath, content) {
|
|
18038
|
-
|
|
18056
|
+
fs5.mkdirSync(path9.dirname(filePath), { recursive: true });
|
|
18039
18057
|
const tmp = `${filePath}.${process.pid}.${Date.now()}.tmp`;
|
|
18040
|
-
|
|
18058
|
+
fs5.writeFileSync(tmp, content, "utf-8");
|
|
18041
18059
|
try {
|
|
18042
|
-
|
|
18060
|
+
fs5.renameSync(tmp, filePath);
|
|
18043
18061
|
} catch (err) {
|
|
18044
18062
|
try {
|
|
18045
|
-
|
|
18063
|
+
fs5.rmSync(tmp, { force: true });
|
|
18046
18064
|
} catch {
|
|
18047
18065
|
}
|
|
18048
18066
|
throw err;
|
|
@@ -18851,8 +18869,8 @@ async function handleJiraResponse(res) {
|
|
|
18851
18869
|
}
|
|
18852
18870
|
return await res.json();
|
|
18853
18871
|
}
|
|
18854
|
-
async function jiraFetch(baseUrl,
|
|
18855
|
-
const url = new URL(
|
|
18872
|
+
async function jiraFetch(baseUrl, path12, auth, timeoutMs, params) {
|
|
18873
|
+
const url = new URL(path12, baseUrl + "/");
|
|
18856
18874
|
if (params) for (const [k, v] of Object.entries(params)) url.searchParams.set(k, v);
|
|
18857
18875
|
const controller = new AbortController();
|
|
18858
18876
|
const timer = setTimeout(() => controller.abort(), timeoutMs);
|
|
@@ -18870,8 +18888,8 @@ async function jiraFetch(baseUrl, path11, auth, timeoutMs, params) {
|
|
|
18870
18888
|
clearTimeout(timer);
|
|
18871
18889
|
}
|
|
18872
18890
|
}
|
|
18873
|
-
async function jiraPost(baseUrl,
|
|
18874
|
-
const url = new URL(
|
|
18891
|
+
async function jiraPost(baseUrl, path12, auth, timeoutMs, body) {
|
|
18892
|
+
const url = new URL(path12, baseUrl + "/");
|
|
18875
18893
|
const controller = new AbortController();
|
|
18876
18894
|
const timer = setTimeout(() => controller.abort(), timeoutMs);
|
|
18877
18895
|
try {
|
|
@@ -20530,7 +20548,7 @@ function runAdr(opts = {}) {
|
|
|
20530
20548
|
}
|
|
20531
20549
|
|
|
20532
20550
|
// src/commands/tech.ts
|
|
20533
|
-
import
|
|
20551
|
+
import fs6 from "fs";
|
|
20534
20552
|
var DISCOVERY_FILES = ["architecture-notes.md", "decision-candidates.md"];
|
|
20535
20553
|
var DISCOVERY_DIR = "knowledge/tech/discovery";
|
|
20536
20554
|
function runTechOrganize(dir = cwd()) {
|
|
@@ -20547,7 +20565,7 @@ function runTechOrganize(dir = cwd()) {
|
|
|
20547
20565
|
continue;
|
|
20548
20566
|
}
|
|
20549
20567
|
ensureDir(join(dir, DISCOVERY_DIR));
|
|
20550
|
-
|
|
20568
|
+
fs6.renameSync(from, to);
|
|
20551
20569
|
moved.push(`knowledge/tech/${file} \u2192 ${DISCOVERY_DIR}/${file}`);
|
|
20552
20570
|
}
|
|
20553
20571
|
if (moved.length > 0) {
|
|
@@ -20629,8 +20647,8 @@ function runAssetsUpdate(kind, opts = {}) {
|
|
|
20629
20647
|
}
|
|
20630
20648
|
|
|
20631
20649
|
// src/commands/ready.ts
|
|
20632
|
-
import
|
|
20633
|
-
import
|
|
20650
|
+
import fs7 from "fs";
|
|
20651
|
+
import path10 from "path";
|
|
20634
20652
|
import matter14 from "gray-matter";
|
|
20635
20653
|
function validateReadiness(content, frontmatter) {
|
|
20636
20654
|
const warnings = [];
|
|
@@ -20693,10 +20711,10 @@ function transitionToReady(filePath) {
|
|
|
20693
20711
|
const posix = filePath.replace(/\\/g, "/");
|
|
20694
20712
|
let newPath = filePath;
|
|
20695
20713
|
if (posix.includes("/work-items/draft/")) {
|
|
20696
|
-
const readyDir =
|
|
20714
|
+
const readyDir = path10.dirname(filePath).replace(/[/\\]draft$/, path10.sep + "ready");
|
|
20697
20715
|
ensureDir(readyDir);
|
|
20698
|
-
const fileName =
|
|
20699
|
-
newPath =
|
|
20716
|
+
const fileName = path10.basename(filePath);
|
|
20717
|
+
newPath = path10.join(readyDir, fileName);
|
|
20700
20718
|
}
|
|
20701
20719
|
return { newPath, newContent };
|
|
20702
20720
|
}
|
|
@@ -20764,11 +20782,11 @@ async function runReady(id, opts = {}) {
|
|
|
20764
20782
|
const { newPath, newContent } = transitionToReady(wi.filePath);
|
|
20765
20783
|
if (newPath !== wi.filePath) {
|
|
20766
20784
|
writeFile(newPath, newContent);
|
|
20767
|
-
|
|
20785
|
+
fs7.unlinkSync(wi.filePath);
|
|
20768
20786
|
log.success(`Updated status: ready`);
|
|
20769
20787
|
log.success(`Moved file:`);
|
|
20770
|
-
log.info(` ${
|
|
20771
|
-
log.info(` \u2192 ${
|
|
20788
|
+
log.info(` ${path10.relative(dir, wi.filePath)}`);
|
|
20789
|
+
log.info(` \u2192 ${path10.relative(dir, newPath)}`);
|
|
20772
20790
|
} else {
|
|
20773
20791
|
writeFile(wi.filePath, newContent);
|
|
20774
20792
|
log.success(`Updated status: ready`);
|
|
@@ -20779,7 +20797,7 @@ async function runReady(id, opts = {}) {
|
|
|
20779
20797
|
}
|
|
20780
20798
|
|
|
20781
20799
|
// src/commands/admin.ts
|
|
20782
|
-
import
|
|
20800
|
+
import path11 from "path";
|
|
20783
20801
|
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
20784
20802
|
import net from "net";
|
|
20785
20803
|
function isPortAvailable(port, host) {
|
|
@@ -20794,17 +20812,17 @@ function isPortAvailable(port, host) {
|
|
|
20794
20812
|
});
|
|
20795
20813
|
}
|
|
20796
20814
|
function resolveStaticDir() {
|
|
20797
|
-
const __dirname =
|
|
20815
|
+
const __dirname = path11.dirname(fileURLToPath2(import.meta.url));
|
|
20798
20816
|
const candidates = [
|
|
20799
20817
|
// Monorepo development: prefer the freshly built admin over the copy bundled into the CLI dist.
|
|
20800
20818
|
// The CLI build copies admin/dist into dist/admin-dist, but that copy can be stale when the admin
|
|
20801
20819
|
// was rebuilt after the CLI (build order is not guaranteed in `pnpm -r build`). Serving the admin
|
|
20802
20820
|
// package's own dist first ensures `kaddo admin` always shows the current frontend in dev. This
|
|
20803
20821
|
// path does not exist in a published npm install (admin is private), so it falls back below.
|
|
20804
|
-
|
|
20805
|
-
|
|
20822
|
+
path11.resolve(__dirname, "..", "..", "admin", "dist"),
|
|
20823
|
+
path11.resolve(__dirname, "..", "node_modules", "@kaddo", "admin", "dist"),
|
|
20806
20824
|
// Bundled inside CLI dist (npm install)
|
|
20807
|
-
|
|
20825
|
+
path11.resolve(__dirname, "admin-dist")
|
|
20808
20826
|
];
|
|
20809
20827
|
for (const c of candidates) {
|
|
20810
20828
|
if (exists(join(c, "index.html"))) return c;
|
|
@@ -20846,8 +20864,8 @@ async function runAdmin(opts = {}) {
|
|
|
20846
20864
|
}
|
|
20847
20865
|
let adminServer;
|
|
20848
20866
|
try {
|
|
20849
|
-
const __dirname =
|
|
20850
|
-
const bundled =
|
|
20867
|
+
const __dirname = path11.dirname(fileURLToPath2(import.meta.url));
|
|
20868
|
+
const bundled = path11.resolve(__dirname, "admin-server", "index.js");
|
|
20851
20869
|
if (exists(bundled)) {
|
|
20852
20870
|
const { pathToFileURL } = await import("url");
|
|
20853
20871
|
adminServer = await import(pathToFileURL(bundled).href);
|
|
@@ -20904,7 +20922,7 @@ async function runAdmin(opts = {}) {
|
|
|
20904
20922
|
|
|
20905
20923
|
// src/core/work-item-import.ts
|
|
20906
20924
|
import crypto3 from "crypto";
|
|
20907
|
-
import
|
|
20925
|
+
import fs8 from "fs";
|
|
20908
20926
|
import matter16 from "gray-matter";
|
|
20909
20927
|
|
|
20910
20928
|
// src/core/work-items.ts
|
|
@@ -20984,8 +21002,8 @@ function parseGraphReason(v) {
|
|
|
20984
21002
|
if (!v || typeof v !== "object") return null;
|
|
20985
21003
|
const o = v;
|
|
20986
21004
|
const relationship = typeof o.relationship === "string" && o.relationship.trim() ? o.relationship.trim() : null;
|
|
20987
|
-
const
|
|
20988
|
-
return relationship ||
|
|
21005
|
+
const path12 = Array.isArray(o.path) ? o.path.map(String).filter(Boolean) : [];
|
|
21006
|
+
return relationship || path12.length ? { relationship, path: path12 } : null;
|
|
20989
21007
|
}
|
|
20990
21008
|
function parseExplain(o) {
|
|
20991
21009
|
const refs = Array.isArray(o.evidence) ? o.evidence : Array.isArray(o.evidence_refs) ? o.evidence_refs : [];
|
|
@@ -21679,7 +21697,7 @@ function importWorkItem(dir, opts) {
|
|
|
21679
21697
|
};
|
|
21680
21698
|
}
|
|
21681
21699
|
if (opts.onConflict === "replace") {
|
|
21682
|
-
|
|
21700
|
+
fs8.rmSync(existing.filePath, { force: true });
|
|
21683
21701
|
replacedWorkItem = existing.workItemId;
|
|
21684
21702
|
}
|
|
21685
21703
|
}
|
|
@@ -22276,9 +22294,9 @@ function markRegistered(dir, identity) {
|
|
|
22276
22294
|
ensureDir(join(dir, TELEMETRY_DIR));
|
|
22277
22295
|
writeFile(identityPath(dir), JSON.stringify(identity, null, 2));
|
|
22278
22296
|
}
|
|
22279
|
-
function signPayload(identity, method,
|
|
22297
|
+
function signPayload(identity, method, path12, timestamp, nonce, bodySha256) {
|
|
22280
22298
|
const canonical = `${method}
|
|
22281
|
-
${
|
|
22299
|
+
${path12}
|
|
22282
22300
|
${identity.installationId}
|
|
22283
22301
|
${timestamp}
|
|
22284
22302
|
${nonce}
|
|
@@ -23089,8 +23107,8 @@ var capsuleCmd = program.command("capsule").description("Export this project as
|
|
|
23089
23107
|
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) => {
|
|
23090
23108
|
runCapsuleExport(opts);
|
|
23091
23109
|
});
|
|
23092
|
-
capsuleCmd.command("add <path>").description("Register an external Knowledge Capsule as project context (.kaddo/external.yml)").action((
|
|
23093
|
-
runCapsuleAdd(
|
|
23110
|
+
capsuleCmd.command("add <path>").description("Register an external Knowledge Capsule as project context (.kaddo/external.yml)").action((path12) => {
|
|
23111
|
+
runCapsuleAdd(path12);
|
|
23094
23112
|
});
|
|
23095
23113
|
var graphCmd = program.command("graph").description("Export the lightweight, file-based knowledge graph of the project");
|
|
23096
23114
|
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) => {
|