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