@kaddo/cli 3.130.1 → 3.132.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-Bo11OW9U.js → architectureDiagram-3BPJPVTR-B0OuhO94.js} +1 -1
- package/dist/admin-dist/assets/{chunk-727SXJPM-CB_snfdx.js → chunk-727SXJPM-CaqXII8F.js} +1 -1
- package/dist/admin-dist/assets/{chunk-AQP2D5EJ-iXesmqv5.js → chunk-AQP2D5EJ-Bg4-fugM.js} +1 -1
- package/dist/admin-dist/assets/{classDiagram-v2-Q7XG4LA2-DFyDxD2P.js → classDiagram-4FO5ZUOK-CckXCSJd.js} +1 -1
- package/dist/admin-dist/assets/{classDiagram-4FO5ZUOK-DFyDxD2P.js → classDiagram-v2-Q7XG4LA2-CckXCSJd.js} +1 -1
- package/dist/admin-dist/assets/{dagre-BM42HDAG-BIacW0zi.js → dagre-BM42HDAG-C0-ZkGqx.js} +1 -1
- package/dist/admin-dist/assets/{diagram-2AECGRRQ-CQVnvt-N.js → diagram-2AECGRRQ-CXx8vdld.js} +1 -1
- package/dist/admin-dist/assets/{diagram-5GNKFQAL-DqWk-Z-Z.js → diagram-5GNKFQAL-DsmIj164.js} +1 -1
- package/dist/admin-dist/assets/{diagram-LMA3HP47-BBhAk4-X.js → diagram-LMA3HP47-BwY_Oswl.js} +1 -1
- package/dist/admin-dist/assets/{diagram-OG6HWLK6-DnmE3vFU.js → diagram-OG6HWLK6-DZmoKiat.js} +1 -1
- package/dist/admin-dist/assets/{erDiagram-TEJ5UH35-DJhl8jCX.js → erDiagram-TEJ5UH35-DnkbNH-3.js} +1 -1
- package/dist/admin-dist/assets/{flowDiagram-I6XJVG4X-DwZzQud2.js → flowDiagram-I6XJVG4X-0M5AwmbD.js} +1 -1
- package/dist/admin-dist/assets/{ganttDiagram-6RSMTGT7-E69yQTGX.js → ganttDiagram-6RSMTGT7-p0YbWB-q.js} +1 -1
- package/dist/admin-dist/assets/index-DE-FwnK7.js +94 -0
- package/dist/admin-dist/assets/{infoDiagram-5YYISTIA-94YrTTgh.js → infoDiagram-5YYISTIA-CizIjxWP.js} +1 -1
- package/dist/admin-dist/assets/{ishikawaDiagram-YF4QCWOH-xzO-cnAK.js → ishikawaDiagram-YF4QCWOH-DZKlVu1h.js} +1 -1
- package/dist/admin-dist/assets/{kanban-definition-UN3LZRKU-ru_cyfqo.js → kanban-definition-UN3LZRKU-G70NiHFN.js} +1 -1
- package/dist/admin-dist/assets/{linear-DgOtx4_2.js → linear-BBYNswBY.js} +1 -1
- package/dist/admin-dist/assets/{mindmap-definition-RKZ34NQL-DGr4UIsB.js → mindmap-definition-RKZ34NQL-CSed8LsK.js} +1 -1
- package/dist/admin-dist/assets/{pieDiagram-4H26LBE5-BF15g-SL.js → pieDiagram-4H26LBE5-BMiHTdzs.js} +1 -1
- package/dist/admin-dist/assets/{quadrantDiagram-W4KKPZXB-Dv3CkCNK.js → quadrantDiagram-W4KKPZXB-xAoJMAFV.js} +1 -1
- package/dist/admin-dist/assets/{requirementDiagram-4Y6WPE33-BvHLMRCe.js → requirementDiagram-4Y6WPE33-BqxSHuU_.js} +1 -1
- package/dist/admin-dist/assets/{sequenceDiagram-3UESZ5HK-Br1GyFbO.js → sequenceDiagram-3UESZ5HK-CEQr2xzT.js} +1 -1
- package/dist/admin-dist/assets/{stateDiagram-AJRCARHV-CRp7EbQP.js → stateDiagram-AJRCARHV-DxYDejoz.js} +1 -1
- package/dist/admin-dist/assets/{stateDiagram-v2-BHNVJYJU-DS18qDqu.js → stateDiagram-v2-BHNVJYJU-DXEhlcga.js} +1 -1
- package/dist/admin-dist/assets/{timeline-definition-PNZ67QCA-DlyGqreD.js → timeline-definition-PNZ67QCA-BAUnT8tD.js} +1 -1
- package/dist/admin-dist/assets/{vennDiagram-CIIHVFJN-BzOZNZpO.js → vennDiagram-CIIHVFJN-DAWIyWJZ.js} +1 -1
- package/dist/admin-dist/assets/{wardleyDiagram-YWT4CUSO-qpgZw3hQ.js → wardleyDiagram-YWT4CUSO-B5sNcSKa.js} +1 -1
- package/dist/admin-dist/assets/{xychartDiagram-2RQKCTM6-cWhRyu8Q.js → xychartDiagram-2RQKCTM6-0N6T1yeV.js} +1 -1
- package/dist/admin-dist/index.html +1 -1
- package/dist/admin-server/index.js +105 -1
- package/dist/core.js +2980 -2567
- package/dist/index.js +1045 -425
- package/package.json +1 -1
- package/dist/admin-dist/assets/index-vrQlungT.js +0 -94
package/dist/index.js
CHANGED
|
@@ -3493,9 +3493,9 @@ var RESPONSIBILITY_MATRIX = {
|
|
|
3493
3493
|
},
|
|
3494
3494
|
"roadmap-agent": {
|
|
3495
3495
|
agent: "roadmap-agent",
|
|
3496
|
-
responsibleFor: ["Roadmap", "Initiatives", "Work Item candidates"],
|
|
3496
|
+
responsibleFor: ["Roadmap", "Initiatives", "Work Item candidates", "Delivery Plans and Epics (optional planning layer)"],
|
|
3497
3497
|
produces: ["knowledge/delivery/roadmap.md"],
|
|
3498
|
-
canSuggest: ["kaddo create --from roadmap", "work-item-agent"],
|
|
3498
|
+
canSuggest: ["kaddo create --from roadmap", "work-item-agent", "kaddo plan create", "kaddo epic create"],
|
|
3499
3499
|
cannotSuggest: ["branches", "commits", "pull requests", "code"],
|
|
3500
3500
|
next: ["kaddo create --from roadmap", "work-item-agent"]
|
|
3501
3501
|
},
|
|
@@ -8794,7 +8794,7 @@ function runIgnoreRemove(artifactId) {
|
|
|
8794
8794
|
}
|
|
8795
8795
|
|
|
8796
8796
|
// src/commands/explain.ts
|
|
8797
|
-
import
|
|
8797
|
+
import matter11 from "gray-matter";
|
|
8798
8798
|
import { parse as parseYaml13 } from "yaml";
|
|
8799
8799
|
|
|
8800
8800
|
// src/core/delivery-phase.ts
|
|
@@ -11460,6 +11460,9 @@ function parseInitiative(dir, filePath, raw) {
|
|
|
11460
11460
|
source: optStr(data.source) ?? null,
|
|
11461
11461
|
sourceId: optStr(data.source_id) ?? null,
|
|
11462
11462
|
createdAt: optStr(data.created_at) ?? null,
|
|
11463
|
+
epic: optStr(data.epic) ?? null,
|
|
11464
|
+
owners: strList(data.owners),
|
|
11465
|
+
contributors: strList(data.contributors),
|
|
11463
11466
|
externalLinks: parseExternalLinks(data),
|
|
11464
11467
|
candidates: parseCandidates(data),
|
|
11465
11468
|
filePath,
|
|
@@ -11528,8 +11531,295 @@ function computeInitiativeProgress(dir, ini) {
|
|
|
11528
11531
|
};
|
|
11529
11532
|
}
|
|
11530
11533
|
|
|
11531
|
-
// src/core/
|
|
11534
|
+
// src/core/delivery-planning.ts
|
|
11532
11535
|
import matter5 from "gray-matter";
|
|
11536
|
+
var DELIVERY_PLANS_DIR = "knowledge/delivery/plans";
|
|
11537
|
+
var EPICS_DIR = "knowledge/delivery/epics";
|
|
11538
|
+
var PLAN_STATES = ["draft", "in-progress", "completed", "cancelled"];
|
|
11539
|
+
var EPIC_STATES = ["planned", "in-progress", "completed", "cancelled"];
|
|
11540
|
+
function toPosix5(p) {
|
|
11541
|
+
return p.replace(/\\/g, "/");
|
|
11542
|
+
}
|
|
11543
|
+
function optStr2(v) {
|
|
11544
|
+
if (typeof v === "string" && v.trim()) return v.trim();
|
|
11545
|
+
if (typeof v === "number") return String(v);
|
|
11546
|
+
return void 0;
|
|
11547
|
+
}
|
|
11548
|
+
function strList2(v) {
|
|
11549
|
+
if (!Array.isArray(v)) return [];
|
|
11550
|
+
return v.map((x) => typeof x === "string" ? x.trim() : String(x)).filter(Boolean);
|
|
11551
|
+
}
|
|
11552
|
+
function relFrom(dir, filePath) {
|
|
11553
|
+
const d = toPosix5(dir);
|
|
11554
|
+
const f = toPosix5(filePath);
|
|
11555
|
+
return f.startsWith(d + "/") ? f.slice(d.length + 1) : f;
|
|
11556
|
+
}
|
|
11557
|
+
function parseMilestones(data) {
|
|
11558
|
+
const raw = data.milestones;
|
|
11559
|
+
if (!Array.isArray(raw)) return [];
|
|
11560
|
+
const out = [];
|
|
11561
|
+
for (const entry of raw) {
|
|
11562
|
+
if (!entry || typeof entry !== "object" || Array.isArray(entry)) continue;
|
|
11563
|
+
const o = entry;
|
|
11564
|
+
const id = optStr2(o.id);
|
|
11565
|
+
if (!id) continue;
|
|
11566
|
+
out.push({ id, title: optStr2(o.title) ?? id, exitCriteria: strList2(o.exit_criteria) });
|
|
11567
|
+
}
|
|
11568
|
+
return out;
|
|
11569
|
+
}
|
|
11570
|
+
function parseDeliveryPlan(dir, filePath, raw) {
|
|
11571
|
+
let parsed;
|
|
11572
|
+
try {
|
|
11573
|
+
parsed = matter5(raw, {});
|
|
11574
|
+
} catch {
|
|
11575
|
+
return null;
|
|
11576
|
+
}
|
|
11577
|
+
const data = parsed.data;
|
|
11578
|
+
if (optStr2(data.type) !== "delivery-plan") return null;
|
|
11579
|
+
const id = optStr2(data.id);
|
|
11580
|
+
if (!id) return null;
|
|
11581
|
+
const statusRaw = optStr2(data.status) ?? "draft";
|
|
11582
|
+
const status = PLAN_STATES.includes(statusRaw) ? statusRaw : "draft";
|
|
11583
|
+
return {
|
|
11584
|
+
id,
|
|
11585
|
+
title: optStr2(data.title) ?? id,
|
|
11586
|
+
status,
|
|
11587
|
+
objective: optStr2(data.objective) ?? null,
|
|
11588
|
+
milestones: parseMilestones(data),
|
|
11589
|
+
dependsOn: strList2(data.depends_on),
|
|
11590
|
+
successCriteria: strList2(data.success_criteria),
|
|
11591
|
+
risks: strList2(data.risks),
|
|
11592
|
+
references: strList2(data.references),
|
|
11593
|
+
filePath,
|
|
11594
|
+
relPath: relFrom(dir, filePath),
|
|
11595
|
+
body: parsed.content.trim(),
|
|
11596
|
+
rawFrontmatter: data
|
|
11597
|
+
};
|
|
11598
|
+
}
|
|
11599
|
+
function parseEpic(dir, filePath, raw) {
|
|
11600
|
+
let parsed;
|
|
11601
|
+
try {
|
|
11602
|
+
parsed = matter5(raw, {});
|
|
11603
|
+
} catch {
|
|
11604
|
+
return null;
|
|
11605
|
+
}
|
|
11606
|
+
const data = parsed.data;
|
|
11607
|
+
if (optStr2(data.type) !== "epic") return null;
|
|
11608
|
+
const id = optStr2(data.id);
|
|
11609
|
+
if (!id) return null;
|
|
11610
|
+
const statusRaw = optStr2(data.status) ?? "planned";
|
|
11611
|
+
const status = EPIC_STATES.includes(statusRaw) ? statusRaw : "planned";
|
|
11612
|
+
return {
|
|
11613
|
+
id,
|
|
11614
|
+
title: optStr2(data.title) ?? id,
|
|
11615
|
+
status,
|
|
11616
|
+
outcome: optStr2(data.outcome ?? data.expected_outcome) ?? null,
|
|
11617
|
+
plan: optStr2(data.plan) ?? null,
|
|
11618
|
+
milestone: optStr2(data.milestone) ?? null,
|
|
11619
|
+
dependsOn: strList2(data.depends_on),
|
|
11620
|
+
successCriteria: strList2(data.success_criteria),
|
|
11621
|
+
relatedCapabilities: strList2(data.related_capabilities),
|
|
11622
|
+
decisions: strList2(data.decisions),
|
|
11623
|
+
filePath,
|
|
11624
|
+
relPath: relFrom(dir, filePath),
|
|
11625
|
+
body: parsed.content.trim(),
|
|
11626
|
+
rawFrontmatter: data
|
|
11627
|
+
};
|
|
11628
|
+
}
|
|
11629
|
+
function discoverIn(dir, rel, parse2) {
|
|
11630
|
+
const d = join(dir, rel);
|
|
11631
|
+
if (!exists(d)) return [];
|
|
11632
|
+
const out = [];
|
|
11633
|
+
for (const entry of readDir(d)) {
|
|
11634
|
+
if (!entry.endsWith(".md")) continue;
|
|
11635
|
+
const full = join(d, entry);
|
|
11636
|
+
if (!isFile(full)) continue;
|
|
11637
|
+
const parsed = parse2(dir, full, readFile(full));
|
|
11638
|
+
if (parsed) out.push(parsed);
|
|
11639
|
+
}
|
|
11640
|
+
return out;
|
|
11641
|
+
}
|
|
11642
|
+
function discoverDeliveryPlans(dir) {
|
|
11643
|
+
return discoverIn(dir, DELIVERY_PLANS_DIR, parseDeliveryPlan).sort((a, b) => a.id.localeCompare(b.id));
|
|
11644
|
+
}
|
|
11645
|
+
function discoverEpics(dir) {
|
|
11646
|
+
return discoverIn(dir, EPICS_DIR, parseEpic).sort((a, b) => a.id.localeCompare(b.id));
|
|
11647
|
+
}
|
|
11648
|
+
function getPlan(dir, id) {
|
|
11649
|
+
const want = id.trim().toLowerCase();
|
|
11650
|
+
return discoverDeliveryPlans(dir).find((p) => p.id.toLowerCase() === want) ?? null;
|
|
11651
|
+
}
|
|
11652
|
+
function getEpic(dir, id) {
|
|
11653
|
+
const want = id.trim().toLowerCase();
|
|
11654
|
+
return discoverEpics(dir).find((e) => e.id.toLowerCase() === want) ?? null;
|
|
11655
|
+
}
|
|
11656
|
+
function nextId(ids, prefix) {
|
|
11657
|
+
let max = 0;
|
|
11658
|
+
for (const id of ids) {
|
|
11659
|
+
const m = id.match(new RegExp(`^${prefix}-(\\d+)$`, "i"));
|
|
11660
|
+
if (m) max = Math.max(max, Number.parseInt(m[1], 10));
|
|
11661
|
+
}
|
|
11662
|
+
return `${prefix}-${String(max + 1).padStart(3, "0")}`;
|
|
11663
|
+
}
|
|
11664
|
+
function nextPlanId(dir) {
|
|
11665
|
+
return nextId(discoverDeliveryPlans(dir).map((p) => p.id), "PLAN");
|
|
11666
|
+
}
|
|
11667
|
+
function nextEpicId(dir) {
|
|
11668
|
+
return nextId(discoverEpics(dir).map((e) => e.id), "EP");
|
|
11669
|
+
}
|
|
11670
|
+
function epicsInPlan(dir, planId) {
|
|
11671
|
+
return discoverEpics(dir).filter((e) => e.plan?.toLowerCase() === planId.toLowerCase());
|
|
11672
|
+
}
|
|
11673
|
+
function initiativesInEpic(dir, epicId) {
|
|
11674
|
+
return discoverInitiatives(dir).filter((i) => i.epic?.toLowerCase() === epicId.toLowerCase());
|
|
11675
|
+
}
|
|
11676
|
+
function wiEpic(wi) {
|
|
11677
|
+
return optStr2(wi.rawFrontmatter?.epic);
|
|
11678
|
+
}
|
|
11679
|
+
function workItemsInEpic(dir, epicId) {
|
|
11680
|
+
const iniIds = new Set(initiativesInEpic(dir, epicId).map((i) => i.id.toLowerCase()));
|
|
11681
|
+
return discoverWorkItems(dir).filter(
|
|
11682
|
+
(wi) => wiEpic(wi)?.toLowerCase() === epicId.toLowerCase() || wi.initiative && iniIds.has(wi.initiative.toLowerCase())
|
|
11683
|
+
);
|
|
11684
|
+
}
|
|
11685
|
+
function readinessOf(successCriteria, blockingDependencies, delivery) {
|
|
11686
|
+
const committedWorkComplete = delivery.total > 0 && delivery.completed === delivery.total;
|
|
11687
|
+
return {
|
|
11688
|
+
successCriteria,
|
|
11689
|
+
blockingDependencies,
|
|
11690
|
+
committedWorkComplete,
|
|
11691
|
+
// Needs real deliverables, declared criteria and no blocking dependency — never positive otherwise.
|
|
11692
|
+
meetsCompletionPreconditions: committedWorkComplete && successCriteria > 0 && blockingDependencies.length === 0,
|
|
11693
|
+
humanApprovalRequired: true
|
|
11694
|
+
// completion is never automatic
|
|
11695
|
+
};
|
|
11696
|
+
}
|
|
11697
|
+
function deliveryOf(wis, dir) {
|
|
11698
|
+
const byState = emptyLifecycleCounts();
|
|
11699
|
+
const completedIds = new Set(
|
|
11700
|
+
discoverWorkItems(dir).filter((w) => w.lifecycle === "completed").map((w) => w.id.toLowerCase())
|
|
11701
|
+
);
|
|
11702
|
+
let blocked = 0;
|
|
11703
|
+
for (const wi of wis) {
|
|
11704
|
+
const state = wi.lifecycle ?? "ready";
|
|
11705
|
+
byState[state]++;
|
|
11706
|
+
const deps = strList2(wi.rawFrontmatter?.depends_on);
|
|
11707
|
+
if (state !== "completed" && deps.some((d) => !completedIds.has(d.toLowerCase()))) blocked++;
|
|
11708
|
+
}
|
|
11709
|
+
return { total: wis.length, byState, blocked, completed: byState.completed };
|
|
11710
|
+
}
|
|
11711
|
+
function computeEpicProgress(dir, epic) {
|
|
11712
|
+
const inis = initiativesInEpic(dir, epic.id);
|
|
11713
|
+
const candidates = inis.reduce((n, i) => n + i.candidates.length, 0);
|
|
11714
|
+
const materialized = inis.reduce((n, i) => n + i.candidates.filter((c) => c.materializedAs).length, 0);
|
|
11715
|
+
const wis = workItemsInEpic(dir, epic.id);
|
|
11716
|
+
const delivery = deliveryOf(wis, dir);
|
|
11717
|
+
return {
|
|
11718
|
+
epic: epic.id,
|
|
11719
|
+
status: epic.status,
|
|
11720
|
+
planning: { initiatives: inis.length, candidates, materialized, remaining: Math.max(0, candidates - materialized) },
|
|
11721
|
+
delivery,
|
|
11722
|
+
readiness: readinessOf(epic.successCriteria.length, unmetDependencies(dir, epic.dependsOn), delivery)
|
|
11723
|
+
};
|
|
11724
|
+
}
|
|
11725
|
+
function computePlanProgress(dir, plan) {
|
|
11726
|
+
const epics = epicsInPlan(dir, plan.id);
|
|
11727
|
+
const byStatus = Object.fromEntries(EPIC_STATES.map((s) => [s, 0]));
|
|
11728
|
+
for (const e of epics) byStatus[e.status]++;
|
|
11729
|
+
const inis = /* @__PURE__ */ new Map();
|
|
11730
|
+
const wis = /* @__PURE__ */ new Map();
|
|
11731
|
+
for (const e of epics) {
|
|
11732
|
+
for (const i of initiativesInEpic(dir, e.id)) inis.set(i.id, i);
|
|
11733
|
+
for (const w of workItemsInEpic(dir, e.id)) wis.set(w.id, w);
|
|
11734
|
+
}
|
|
11735
|
+
const candidates = [...inis.values()].reduce((n, i) => n + i.candidates.length, 0);
|
|
11736
|
+
const materialized = [...inis.values()].reduce((n, i) => n + i.candidates.filter((c) => c.materializedAs).length, 0);
|
|
11737
|
+
const delivery = deliveryOf([...wis.values()], dir);
|
|
11738
|
+
return {
|
|
11739
|
+
plan: plan.id,
|
|
11740
|
+
status: plan.status,
|
|
11741
|
+
epics: { total: epics.length, byStatus },
|
|
11742
|
+
planning: { initiatives: inis.size, candidates, materialized, remaining: Math.max(0, candidates - materialized) },
|
|
11743
|
+
delivery,
|
|
11744
|
+
readiness: readinessOf(plan.successCriteria.length, unmetDependencies(dir, plan.dependsOn), delivery),
|
|
11745
|
+
milestones: plan.milestones.map((m) => ({ id: m.id, title: m.title, exitCriteria: m.exitCriteria.length }))
|
|
11746
|
+
};
|
|
11747
|
+
}
|
|
11748
|
+
function unmetDependencies(dir, deps) {
|
|
11749
|
+
if (deps.length === 0) return [];
|
|
11750
|
+
const done = /* @__PURE__ */ new Set();
|
|
11751
|
+
for (const e of discoverEpics(dir)) if (e.status === "completed") done.add(e.id.toLowerCase());
|
|
11752
|
+
for (const p of discoverDeliveryPlans(dir)) if (p.status === "completed") done.add(p.id.toLowerCase());
|
|
11753
|
+
for (const i of discoverInitiatives(dir)) if (i.status === "completed") done.add(i.id.toLowerCase());
|
|
11754
|
+
return deps.filter((d) => !done.has(d.toLowerCase()));
|
|
11755
|
+
}
|
|
11756
|
+
function findCycle(nodes, edges) {
|
|
11757
|
+
const state = /* @__PURE__ */ new Map();
|
|
11758
|
+
const stack = [];
|
|
11759
|
+
const dfs = (n) => {
|
|
11760
|
+
state.set(n, 1);
|
|
11761
|
+
stack.push(n);
|
|
11762
|
+
for (const m of edges.get(n) ?? []) {
|
|
11763
|
+
if (!nodes.includes(m)) continue;
|
|
11764
|
+
const s = state.get(m) ?? 0;
|
|
11765
|
+
if (s === 1) return [...stack.slice(stack.indexOf(m)), m];
|
|
11766
|
+
if (s === 0) {
|
|
11767
|
+
const c = dfs(m);
|
|
11768
|
+
if (c) return c;
|
|
11769
|
+
}
|
|
11770
|
+
}
|
|
11771
|
+
stack.pop();
|
|
11772
|
+
state.set(n, 2);
|
|
11773
|
+
return null;
|
|
11774
|
+
};
|
|
11775
|
+
for (const n of nodes) if ((state.get(n) ?? 0) === 0) {
|
|
11776
|
+
const c = dfs(n);
|
|
11777
|
+
if (c) return c;
|
|
11778
|
+
}
|
|
11779
|
+
return null;
|
|
11780
|
+
}
|
|
11781
|
+
function validatePlanningGraph(dir) {
|
|
11782
|
+
const plans = discoverDeliveryPlans(dir);
|
|
11783
|
+
const epics = discoverEpics(dir);
|
|
11784
|
+
const inis = discoverInitiatives(dir);
|
|
11785
|
+
const planIds = new Set(plans.map((p) => p.id.toLowerCase()));
|
|
11786
|
+
const epicIds = new Set(epics.map((e) => e.id.toLowerCase()));
|
|
11787
|
+
const iniIds = new Set(inis.map((i) => i.id.toLowerCase()));
|
|
11788
|
+
const findings = [];
|
|
11789
|
+
for (const p of plans) {
|
|
11790
|
+
const seen = /* @__PURE__ */ new Set();
|
|
11791
|
+
for (const m of p.milestones) {
|
|
11792
|
+
const key = m.id.toLowerCase();
|
|
11793
|
+
if (seen.has(key))
|
|
11794
|
+
findings.push({ level: "error", kind: "duplicate_milestone", subject: p.id, message: `Plan ${p.id} declares milestone ${m.id} more than once.` });
|
|
11795
|
+
seen.add(key);
|
|
11796
|
+
}
|
|
11797
|
+
}
|
|
11798
|
+
for (const e of epics) {
|
|
11799
|
+
if (e.plan && !planIds.has(e.plan.toLowerCase()))
|
|
11800
|
+
findings.push({ level: "error", kind: "invalid_reference", subject: e.id, message: `Epic ${e.id} references missing plan ${e.plan}.` });
|
|
11801
|
+
if (e.plan && e.milestone) {
|
|
11802
|
+
const plan = plans.find((p) => p.id.toLowerCase() === e.plan.toLowerCase());
|
|
11803
|
+
if (plan && !plan.milestones.some((m) => m.id.toLowerCase() === e.milestone.toLowerCase()))
|
|
11804
|
+
findings.push({ level: "error", kind: "invalid_reference", subject: e.id, message: `Epic ${e.id} references milestone ${e.milestone} not defined in ${e.plan}.` });
|
|
11805
|
+
}
|
|
11806
|
+
for (const d of e.dependsOn) if (!epicIds.has(d.toLowerCase()))
|
|
11807
|
+
findings.push({ level: "error", kind: "invalid_reference", subject: e.id, message: `Epic ${e.id} depends on missing Epic ${d}.` });
|
|
11808
|
+
}
|
|
11809
|
+
for (const i of inis) {
|
|
11810
|
+
if (i.epic && !epicIds.has(i.epic.toLowerCase()))
|
|
11811
|
+
findings.push({ level: "error", kind: "invalid_reference", subject: i.id, message: `Initiative ${i.id} references missing Epic ${i.epic}.` });
|
|
11812
|
+
}
|
|
11813
|
+
const epicEdges = new Map(epics.map((e) => [e.id.toLowerCase(), e.dependsOn.map((d) => d.toLowerCase())]));
|
|
11814
|
+
const epicCycle = findCycle([...epicIds], epicEdges);
|
|
11815
|
+
if (epicCycle) findings.push({ level: "error", kind: "dependency_cycle", subject: epicCycle[0], message: `Dependency cycle among Epics: ${epicCycle.join(" \u2192 ")}.` });
|
|
11816
|
+
for (const e of epics) for (const d of unmetDependencies(dir, e.dependsOn))
|
|
11817
|
+
findings.push({ level: "warning", kind: "pending_dependency", subject: e.id, message: `Epic ${e.id} is blocked by unfinished dependency ${d}.` });
|
|
11818
|
+
return findings;
|
|
11819
|
+
}
|
|
11820
|
+
|
|
11821
|
+
// src/core/resources.ts
|
|
11822
|
+
import matter6 from "gray-matter";
|
|
11533
11823
|
var RESOURCE_ARTIFACT_TYPE = "project-resource";
|
|
11534
11824
|
var RESOURCE_TYPES = [
|
|
11535
11825
|
"database",
|
|
@@ -11645,7 +11935,7 @@ function purposeFromBody(body) {
|
|
|
11645
11935
|
return text2 || null;
|
|
11646
11936
|
}
|
|
11647
11937
|
function toDetail(filePath, relPath, raw) {
|
|
11648
|
-
const parsed =
|
|
11938
|
+
const parsed = matter6(raw);
|
|
11649
11939
|
const fm2 = parsed.data ?? {};
|
|
11650
11940
|
const body = parsed.content.trim();
|
|
11651
11941
|
const id = str(fm2.id) ?? "";
|
|
@@ -11707,7 +11997,7 @@ function parseWorkItemResources(fm2) {
|
|
|
11707
11997
|
}
|
|
11708
11998
|
|
|
11709
11999
|
// src/core/deprecation.ts
|
|
11710
|
-
import
|
|
12000
|
+
import matter7 from "gray-matter";
|
|
11711
12001
|
var DEPRECATION_ARTIFACT_TYPE = "deprecation-plan";
|
|
11712
12002
|
var DEPRECATION_PLANS_DIR = "knowledge/legacy/deprecations";
|
|
11713
12003
|
var TARGET_TYPES = [
|
|
@@ -11898,7 +12188,7 @@ function getDeprecationPlan(dir, id) {
|
|
|
11898
12188
|
);
|
|
11899
12189
|
if (!match) return null;
|
|
11900
12190
|
const raw = readFile(match.filePath);
|
|
11901
|
-
const parsed =
|
|
12191
|
+
const parsed = matter7(raw);
|
|
11902
12192
|
const fm2 = parsed.data ?? {};
|
|
11903
12193
|
const body = parsed.content.trim();
|
|
11904
12194
|
const targets = parseTargets(fm2.targets);
|
|
@@ -11965,14 +12255,14 @@ var ALL_STATUSES = ["draft", "ready", "in-progress", "blocked", "completed"];
|
|
|
11965
12255
|
function scopeStatuses(scope) {
|
|
11966
12256
|
return scope === "all" ? { included: ALL_STATUSES, excluded: ["archived"] } : { included: ACTIVE_STATUSES, excluded: ["completed", "archived"] };
|
|
11967
12257
|
}
|
|
11968
|
-
function
|
|
12258
|
+
function toPosix6(p) {
|
|
11969
12259
|
return p.replace(/\\/g, "/");
|
|
11970
12260
|
}
|
|
11971
12261
|
function slug(s) {
|
|
11972
12262
|
return s.trim().toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "");
|
|
11973
12263
|
}
|
|
11974
12264
|
function isAdr(a) {
|
|
11975
|
-
return
|
|
12265
|
+
return toPosix6(a.filePath).includes("/tech/decisions/") && Boolean(a.type);
|
|
11976
12266
|
}
|
|
11977
12267
|
function buildGraph(dir, config, opts = {}, now = /* @__PURE__ */ new Date()) {
|
|
11978
12268
|
const scope = opts.scope ?? "active";
|
|
@@ -12083,6 +12373,27 @@ function buildGraph(dir, config, opts = {}, now = /* @__PURE__ */ new Date()) {
|
|
|
12083
12373
|
}
|
|
12084
12374
|
}
|
|
12085
12375
|
}
|
|
12376
|
+
for (const plan of discoverDeliveryPlans(dir)) {
|
|
12377
|
+
const planId = `delivery-plan:${slug(plan.id) || plan.id}`;
|
|
12378
|
+
addNode({ id: planId, type: "delivery-plan", label: `${plan.id} ${plan.title}`.trim(), path: plan.relPath, status: plan.status });
|
|
12379
|
+
for (const m of plan.milestones) {
|
|
12380
|
+
const milestoneId = `milestone:${slug(plan.id)}:${slug(m.id) || m.id}`;
|
|
12381
|
+
addNode({ id: milestoneId, type: "milestone", label: `${m.id} ${m.title}`.trim(), path: plan.relPath });
|
|
12382
|
+
addEdge(milestoneId, planId, "belongs_to");
|
|
12383
|
+
}
|
|
12384
|
+
}
|
|
12385
|
+
for (const epic of discoverEpics(dir)) {
|
|
12386
|
+
const epicNodeId = `epic:${slug(epic.id) || epic.id}`;
|
|
12387
|
+
addNode({ id: epicNodeId, type: "epic", label: `${epic.id} ${epic.title}`.trim(), path: epic.relPath, status: epic.status });
|
|
12388
|
+
if (epic.plan) {
|
|
12389
|
+
addEdge(epicNodeId, `delivery-plan:${slug(epic.plan)}`, "belongs_to");
|
|
12390
|
+
if (epic.milestone) addEdge(epicNodeId, `milestone:${slug(epic.plan)}:${slug(epic.milestone)}`, "belongs_to");
|
|
12391
|
+
}
|
|
12392
|
+
for (const dep of epic.dependsOn) addEdge(epicNodeId, `epic:${slug(dep)}`, "depends_on");
|
|
12393
|
+
}
|
|
12394
|
+
for (const ini of discoverInitiatives(dir)) {
|
|
12395
|
+
if (ini.epic) addEdge(`initiative:${slug(ini.id) || ini.id}`, `epic:${slug(ini.epic)}`, "belongs_to");
|
|
12396
|
+
}
|
|
12086
12397
|
for (const wi of selectedWIs) {
|
|
12087
12398
|
const id = wi.id || wi.title;
|
|
12088
12399
|
if (!id || !id.trim()) continue;
|
|
@@ -12254,14 +12565,14 @@ function loadGraphSummary(dir) {
|
|
|
12254
12565
|
|
|
12255
12566
|
// src/core/graph-hints.ts
|
|
12256
12567
|
var KNOWLEDGE4 = "knowledge";
|
|
12257
|
-
function
|
|
12568
|
+
function toPosix7(p) {
|
|
12258
12569
|
return p.replace(/\\/g, "/");
|
|
12259
12570
|
}
|
|
12260
12571
|
function slug2(s) {
|
|
12261
12572
|
return s.trim().toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "");
|
|
12262
12573
|
}
|
|
12263
12574
|
function isAdr2(a) {
|
|
12264
|
-
return
|
|
12575
|
+
return toPosix7(a.filePath).includes("/tech/decisions/") && Boolean(a.type);
|
|
12265
12576
|
}
|
|
12266
12577
|
function capabilityHeadings(dir) {
|
|
12267
12578
|
const p = join(dir, KNOWLEDGE4, "product", "capabilities.md");
|
|
@@ -12496,7 +12807,7 @@ function loadGraphHints(dir) {
|
|
|
12496
12807
|
}
|
|
12497
12808
|
|
|
12498
12809
|
// src/services/installed-skills.ts
|
|
12499
|
-
import
|
|
12810
|
+
import matter8 from "gray-matter";
|
|
12500
12811
|
var SKILLS_DIR = join("knowledge", "skills");
|
|
12501
12812
|
function discoverInstalledSkills(dir) {
|
|
12502
12813
|
const base = join(dir, SKILLS_DIR);
|
|
@@ -12506,7 +12817,7 @@ function discoverInstalledSkills(dir) {
|
|
|
12506
12817
|
const skillFile = join(base, entry, "skill.md");
|
|
12507
12818
|
if (!isFile(skillFile)) continue;
|
|
12508
12819
|
try {
|
|
12509
|
-
const { data } =
|
|
12820
|
+
const { data } = matter8(readFile(skillFile));
|
|
12510
12821
|
if (data.type && String(data.type) !== "skill") continue;
|
|
12511
12822
|
const id = String(data.id ?? entry);
|
|
12512
12823
|
out.push({
|
|
@@ -13529,7 +13840,7 @@ function buildTechDecisions(dir) {
|
|
|
13529
13840
|
|
|
13530
13841
|
// src/core/poc-report.ts
|
|
13531
13842
|
import { createHash } from "crypto";
|
|
13532
|
-
import
|
|
13843
|
+
import matter9 from "gray-matter";
|
|
13533
13844
|
var POC_REPORT_PREFIX = "poc-report-v";
|
|
13534
13845
|
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;
|
|
13535
13846
|
var reportName = /^poc-report-v(\d{3,})\.md$/;
|
|
@@ -13557,7 +13868,7 @@ function reportFiles(dir) {
|
|
|
13557
13868
|
const match = name.match(reportName);
|
|
13558
13869
|
if (!match) return [];
|
|
13559
13870
|
try {
|
|
13560
|
-
const parsed =
|
|
13871
|
+
const parsed = matter9(readFile(join(delivery, name)));
|
|
13561
13872
|
const fingerprint = typeof parsed.data.source_fingerprint === "string" ? parsed.data.source_fingerprint : "";
|
|
13562
13873
|
const manifest = parsed.data.source_manifest;
|
|
13563
13874
|
const sourceManifest = manifest && typeof manifest === "object" && !Array.isArray(manifest) ? Object.fromEntries(Object.entries(manifest).filter(([, digest]) => typeof digest === "string")) : {};
|
|
@@ -14203,7 +14514,7 @@ function deriveDeliveryCompletedStatus(dir) {
|
|
|
14203
14514
|
}
|
|
14204
14515
|
|
|
14205
14516
|
// src/core/assets.ts
|
|
14206
|
-
import
|
|
14517
|
+
import matter10 from "gray-matter";
|
|
14207
14518
|
function canonicalAgents() {
|
|
14208
14519
|
return AGENT_PROMPTS.map((a) => ({
|
|
14209
14520
|
name: a.fileName.replace(/\.md$/, ""),
|
|
@@ -14216,7 +14527,7 @@ function canonicalSkills() {
|
|
|
14216
14527
|
}
|
|
14217
14528
|
function versionOf(content) {
|
|
14218
14529
|
try {
|
|
14219
|
-
const v =
|
|
14530
|
+
const v = matter10(content).data.version;
|
|
14220
14531
|
return v === void 0 || v === null ? null : String(v);
|
|
14221
14532
|
} catch {
|
|
14222
14533
|
return null;
|
|
@@ -14371,19 +14682,19 @@ function parseWorkItemSource(frontmatter2) {
|
|
|
14371
14682
|
const rawSource = frontmatter2.source;
|
|
14372
14683
|
if (rawSource != null && typeof rawSource === "object" && !Array.isArray(rawSource)) {
|
|
14373
14684
|
const obj = rawSource;
|
|
14374
|
-
const t =
|
|
14685
|
+
const t = optStr3(obj.type);
|
|
14375
14686
|
const type = t && isValidSource(t) ? t : "unknown";
|
|
14376
14687
|
return {
|
|
14377
14688
|
type,
|
|
14378
|
-
id:
|
|
14379
|
-
title:
|
|
14380
|
-
context:
|
|
14381
|
-
provider:
|
|
14382
|
-
integration:
|
|
14383
|
-
url:
|
|
14384
|
-
imported_at:
|
|
14385
|
-
external_updated_at:
|
|
14386
|
-
synced_at:
|
|
14689
|
+
id: optStr3(obj.id) ?? optStr3(frontmatter2.source_id),
|
|
14690
|
+
title: optStr3(obj.title) ?? optStr3(frontmatter2.source_title),
|
|
14691
|
+
context: optStr3(obj.context) ?? optStr3(frontmatter2.source_context),
|
|
14692
|
+
provider: optStr3(obj.provider) ?? optStr3(frontmatter2.source_provider),
|
|
14693
|
+
integration: optStr3(obj.integration) ?? optStr3(frontmatter2.source_integration),
|
|
14694
|
+
url: optStr3(obj.url) ?? optStr3(frontmatter2.source_url),
|
|
14695
|
+
imported_at: optStr3(obj.imported_at) ?? optStr3(frontmatter2.source_imported_at),
|
|
14696
|
+
external_updated_at: optStr3(obj.external_updated_at) ?? optStr3(frontmatter2.source_external_updated_at),
|
|
14697
|
+
synced_at: optStr3(obj.synced_at) ?? optStr3(frontmatter2.source_synced_at),
|
|
14387
14698
|
inferred: obj.inferred === true || obj.inferred === "true",
|
|
14388
14699
|
reason: t && !isValidSource(t) ? `Invalid source type in object: "${t}".` : void 0
|
|
14389
14700
|
};
|
|
@@ -14392,28 +14703,28 @@ function parseWorkItemSource(frontmatter2) {
|
|
|
14392
14703
|
if (raw && isValidSource(raw)) {
|
|
14393
14704
|
return {
|
|
14394
14705
|
type: raw,
|
|
14395
|
-
id:
|
|
14396
|
-
title:
|
|
14397
|
-
context:
|
|
14398
|
-
provider:
|
|
14399
|
-
url:
|
|
14400
|
-
imported_at:
|
|
14401
|
-
external_updated_at:
|
|
14402
|
-
synced_at:
|
|
14706
|
+
id: optStr3(frontmatter2.source_id),
|
|
14707
|
+
title: optStr3(frontmatter2.source_title),
|
|
14708
|
+
context: optStr3(frontmatter2.source_context),
|
|
14709
|
+
provider: optStr3(frontmatter2.source_provider),
|
|
14710
|
+
url: optStr3(frontmatter2.source_url),
|
|
14711
|
+
imported_at: optStr3(frontmatter2.source_imported_at),
|
|
14712
|
+
external_updated_at: optStr3(frontmatter2.source_external_updated_at),
|
|
14713
|
+
synced_at: optStr3(frontmatter2.source_synced_at),
|
|
14403
14714
|
inferred: false
|
|
14404
14715
|
};
|
|
14405
14716
|
}
|
|
14406
14717
|
if (raw && !isValidSource(raw)) {
|
|
14407
14718
|
return {
|
|
14408
14719
|
type: "unknown",
|
|
14409
|
-
id:
|
|
14410
|
-
title:
|
|
14411
|
-
context:
|
|
14412
|
-
provider:
|
|
14413
|
-
url:
|
|
14414
|
-
imported_at:
|
|
14415
|
-
external_updated_at:
|
|
14416
|
-
synced_at:
|
|
14720
|
+
id: optStr3(frontmatter2.source_id),
|
|
14721
|
+
title: optStr3(frontmatter2.source_title),
|
|
14722
|
+
context: optStr3(frontmatter2.source_context),
|
|
14723
|
+
provider: optStr3(frontmatter2.source_provider),
|
|
14724
|
+
url: optStr3(frontmatter2.source_url),
|
|
14725
|
+
imported_at: optStr3(frontmatter2.source_imported_at),
|
|
14726
|
+
external_updated_at: optStr3(frontmatter2.source_external_updated_at),
|
|
14727
|
+
synced_at: optStr3(frontmatter2.source_synced_at),
|
|
14417
14728
|
inferred: true,
|
|
14418
14729
|
reason: `Invalid source value: "${raw}".`
|
|
14419
14730
|
};
|
|
@@ -14421,8 +14732,8 @@ function parseWorkItemSource(frontmatter2) {
|
|
|
14421
14732
|
if (frontmatter2.source_work_item_candidate || frontmatter2.source_roadmap_initiative) {
|
|
14422
14733
|
return {
|
|
14423
14734
|
type: "roadmap",
|
|
14424
|
-
id:
|
|
14425
|
-
title:
|
|
14735
|
+
id: optStr3(frontmatter2.source_id) ?? optStr3(frontmatter2.source_work_item_candidate),
|
|
14736
|
+
title: optStr3(frontmatter2.source_initiative_title),
|
|
14426
14737
|
inferred: true,
|
|
14427
14738
|
reason: "Inferred from legacy roadmap fields."
|
|
14428
14739
|
};
|
|
@@ -14430,7 +14741,7 @@ function parseWorkItemSource(frontmatter2) {
|
|
|
14430
14741
|
if (frontmatter2.source_id) {
|
|
14431
14742
|
return {
|
|
14432
14743
|
type: "unknown",
|
|
14433
|
-
id:
|
|
14744
|
+
id: optStr3(frontmatter2.source_id),
|
|
14434
14745
|
inferred: true,
|
|
14435
14746
|
reason: "Has source_id but no source type."
|
|
14436
14747
|
};
|
|
@@ -14446,7 +14757,7 @@ function renderSourceCompact(source2) {
|
|
|
14446
14757
|
if (source2.id) parts.push(source2.id);
|
|
14447
14758
|
return parts.join(" \xB7 ");
|
|
14448
14759
|
}
|
|
14449
|
-
function
|
|
14760
|
+
function optStr3(v) {
|
|
14450
14761
|
if (typeof v === "string" && v.trim()) return v.trim();
|
|
14451
14762
|
return void 0;
|
|
14452
14763
|
}
|
|
@@ -15767,7 +16078,7 @@ function readKnowledge(dir) {
|
|
|
15767
16078
|
if (!exists(knowledgePath)) return null;
|
|
15768
16079
|
try {
|
|
15769
16080
|
const raw = readFile(knowledgePath);
|
|
15770
|
-
const { data, content } =
|
|
16081
|
+
const { data, content } = matter11(raw);
|
|
15771
16082
|
return { content, data };
|
|
15772
16083
|
} catch {
|
|
15773
16084
|
return null;
|
|
@@ -15778,7 +16089,7 @@ function readRoadmap(dir) {
|
|
|
15778
16089
|
if (!exists(roadmapPath)) return null;
|
|
15779
16090
|
try {
|
|
15780
16091
|
const raw = readFile(roadmapPath);
|
|
15781
|
-
const { content } =
|
|
16092
|
+
const { content } = matter11(raw);
|
|
15782
16093
|
return content.trim();
|
|
15783
16094
|
} catch {
|
|
15784
16095
|
return null;
|
|
@@ -15947,7 +16258,7 @@ function runExplain(opts) {
|
|
|
15947
16258
|
}
|
|
15948
16259
|
|
|
15949
16260
|
// src/core/context-pack.ts
|
|
15950
|
-
import
|
|
16261
|
+
import matter12 from "gray-matter";
|
|
15951
16262
|
var CONTEXT_PACK_VERSION = "1";
|
|
15952
16263
|
var ARCH_DIR6 = "knowledge";
|
|
15953
16264
|
function readScanJson(dir) {
|
|
@@ -15960,7 +16271,7 @@ function readScanJson(dir) {
|
|
|
15960
16271
|
}
|
|
15961
16272
|
}
|
|
15962
16273
|
function firstParagraph2(markdown) {
|
|
15963
|
-
const body =
|
|
16274
|
+
const body = matter12(markdown).content.trim();
|
|
15964
16275
|
const para = body.split("\n\n").map((p) => p.trim()).find((p) => p && !p.startsWith("#"));
|
|
15965
16276
|
return para ?? "";
|
|
15966
16277
|
}
|
|
@@ -17609,7 +17920,7 @@ function runStatus() {
|
|
|
17609
17920
|
// src/commands/learn.ts
|
|
17610
17921
|
import fs3 from "fs";
|
|
17611
17922
|
import path7 from "path";
|
|
17612
|
-
import
|
|
17923
|
+
import matter13 from "gray-matter";
|
|
17613
17924
|
var ARCH_DIR9 = "knowledge";
|
|
17614
17925
|
var WORK_ITEMS_DIR2 = "knowledge/delivery/work-items";
|
|
17615
17926
|
function completedPathFor(filePath) {
|
|
@@ -17624,7 +17935,7 @@ function completedPathFor(filePath) {
|
|
|
17624
17935
|
}
|
|
17625
17936
|
function updateWorkItemFile(filePath, learning) {
|
|
17626
17937
|
const raw = readFile(filePath);
|
|
17627
|
-
const { data, content } =
|
|
17938
|
+
const { data, content } = matter13(raw);
|
|
17628
17939
|
data.status = "completed";
|
|
17629
17940
|
data.completed_at = (/* @__PURE__ */ new Date()).toISOString().split("T")[0];
|
|
17630
17941
|
let updatedContent = content;
|
|
@@ -17649,7 +17960,7 @@ ${learning.trim()}
|
|
|
17649
17960
|
${learning.trim()}
|
|
17650
17961
|
`;
|
|
17651
17962
|
}
|
|
17652
|
-
const newRaw =
|
|
17963
|
+
const newRaw = matter13.stringify(updatedContent, data);
|
|
17653
17964
|
const newPath = completedPathFor(filePath);
|
|
17654
17965
|
if (newPath !== filePath) {
|
|
17655
17966
|
ensureDir(path7.dirname(newPath));
|
|
@@ -17701,7 +18012,7 @@ async function runLearn(artifactId, opts = {}) {
|
|
|
17701
18012
|
process.exit(1);
|
|
17702
18013
|
}
|
|
17703
18014
|
const wiRaw = readFile(filePath);
|
|
17704
|
-
const wiData =
|
|
18015
|
+
const wiData = matter13(wiRaw).data;
|
|
17705
18016
|
if (!opts.force) {
|
|
17706
18017
|
const completionBlockers = [];
|
|
17707
18018
|
const releaseGates = Array.isArray(wiData.release_gates) ? wiData.release_gates : [];
|
|
@@ -17957,7 +18268,7 @@ function runAdd(moduleName, opts = {}, dir = cwd()) {
|
|
|
17957
18268
|
}
|
|
17958
18269
|
|
|
17959
18270
|
// src/core/ownership-suggest.ts
|
|
17960
|
-
import
|
|
18271
|
+
import matter14 from "gray-matter";
|
|
17961
18272
|
var SCAN_PATH = ".kaddo/scan.json";
|
|
17962
18273
|
function normalizeGlob(input) {
|
|
17963
18274
|
let g = input.trim().replace(/\\/g, "/");
|
|
@@ -18079,11 +18390,11 @@ function suggestGlobs(artifact, signals) {
|
|
|
18079
18390
|
return [...new Set(out)];
|
|
18080
18391
|
}
|
|
18081
18392
|
function applyOwnership(raw, globs, mode = "replace") {
|
|
18082
|
-
const parsed =
|
|
18393
|
+
const parsed = matter14(raw);
|
|
18083
18394
|
const existing = toStringArray3(parsed.data.code);
|
|
18084
18395
|
const next = mode === "append" ? [.../* @__PURE__ */ new Set([...existing, ...globs])] : [...new Set(globs)];
|
|
18085
18396
|
const data = { ...parsed.data, code: next };
|
|
18086
|
-
return
|
|
18397
|
+
return matter14.stringify(parsed.content, data);
|
|
18087
18398
|
}
|
|
18088
18399
|
|
|
18089
18400
|
// src/commands/owners.ts
|
|
@@ -19085,7 +19396,7 @@ var PROVENANCE = /* @__PURE__ */ new Set(["declared", "derived", "agent-reviewed
|
|
|
19085
19396
|
function isRelative(p) {
|
|
19086
19397
|
return typeof p === "string" && p.trim() !== "" && !/^([a-zA-Z]:[\\/]|\/)/.test(p) && !p.includes("..");
|
|
19087
19398
|
}
|
|
19088
|
-
function
|
|
19399
|
+
function strList3(v) {
|
|
19089
19400
|
return Array.isArray(v) ? v.map((x) => typeof x === "string" ? x.trim() : "").filter(Boolean) : [];
|
|
19090
19401
|
}
|
|
19091
19402
|
function loadSystemTopology(dir) {
|
|
@@ -19126,7 +19437,7 @@ function parseTopologyContent(raw, dir) {
|
|
|
19126
19437
|
const moduleRaw = typeof e.module === "string" ? e.module.trim() : void 0;
|
|
19127
19438
|
if (moduleRaw && !validModules.has(moduleRaw)) findings.push({ level: "warning", message: `Entity "${id}" references unregistered module "${moduleRaw}".` });
|
|
19128
19439
|
const rawImpl = e.implementation ?? e.implementation_refs;
|
|
19129
|
-
const implementation =
|
|
19440
|
+
const implementation = strList3(rawImpl).filter((p) => {
|
|
19130
19441
|
if (isRelative(p)) return true;
|
|
19131
19442
|
findings.push({ level: "warning", message: `Entity "${id}" implementation ref "${p}" is not a safe relative path and was dropped.` });
|
|
19132
19443
|
return false;
|
|
@@ -19134,7 +19445,7 @@ function parseTopologyContent(raw, dir) {
|
|
|
19134
19445
|
const prov = e.provenance;
|
|
19135
19446
|
const provOrigin = typeof prov === "string" ? prov : prov && typeof prov === "object" && typeof prov.origin === "string" ? String(prov.origin) : void 0;
|
|
19136
19447
|
const provenance = provOrigin && PROVENANCE.has(provOrigin) ? provOrigin : void 0;
|
|
19137
|
-
const evidence =
|
|
19448
|
+
const evidence = strList3(e.evidence ?? (prov && typeof prov === "object" ? prov.evidence_refs : void 0)).filter(isRelative);
|
|
19138
19449
|
seenIds.add(id);
|
|
19139
19450
|
entities.push({
|
|
19140
19451
|
id,
|
|
@@ -19143,7 +19454,7 @@ function parseTopologyContent(raw, dir) {
|
|
|
19143
19454
|
...typeof e.purpose === "string" && e.purpose.trim() ? { purpose: e.purpose.trim() } : {},
|
|
19144
19455
|
...moduleRaw && validModules.has(moduleRaw) ? { moduleId: moduleRaw } : {},
|
|
19145
19456
|
implementationRefs: implementation,
|
|
19146
|
-
knowledgeRefs:
|
|
19457
|
+
knowledgeRefs: strList3(e.knowledge ?? e.knowledge_refs),
|
|
19147
19458
|
...provenance ? { provenance } : {},
|
|
19148
19459
|
evidence
|
|
19149
19460
|
});
|
|
@@ -19177,7 +19488,7 @@ function parseTopologyContent(raw, dir) {
|
|
|
19177
19488
|
}
|
|
19178
19489
|
seenRels.add(key);
|
|
19179
19490
|
const prov = r.provenance;
|
|
19180
|
-
relationships.push({ from, to, type, evidence:
|
|
19491
|
+
relationships.push({ from, to, type, evidence: strList3(r.evidence ?? prov?.evidence_refs).filter(isRelative) });
|
|
19181
19492
|
}
|
|
19182
19493
|
return { entities, relationships, findings, ...sourceRevision ? { sourceRevision } : {} };
|
|
19183
19494
|
}
|
|
@@ -19333,7 +19644,7 @@ async function runTopologyApply(file, opts = {}) {
|
|
|
19333
19644
|
// src/core/resource-write.ts
|
|
19334
19645
|
import fs5 from "fs";
|
|
19335
19646
|
import path9 from "path";
|
|
19336
|
-
import
|
|
19647
|
+
import matter15 from "gray-matter";
|
|
19337
19648
|
var RESOURCES_DIR = "knowledge/tech/resources";
|
|
19338
19649
|
var ResourceWriteError = class extends Error {
|
|
19339
19650
|
constructor(code, message) {
|
|
@@ -19443,7 +19754,7 @@ function buildFrontmatter(id, input, base = {}) {
|
|
|
19443
19754
|
return data;
|
|
19444
19755
|
}
|
|
19445
19756
|
function serialize(data, body) {
|
|
19446
|
-
return
|
|
19757
|
+
return matter15.stringify(`
|
|
19447
19758
|
${body.trim()}
|
|
19448
19759
|
`, data);
|
|
19449
19760
|
}
|
|
@@ -19483,7 +19794,7 @@ function updateResource(dir, id, input) {
|
|
|
19483
19794
|
throw new ResourceWriteError("VALIDATION_FAILED", findings.filter((f) => f.level === "error").map((f) => f.message).join("; "));
|
|
19484
19795
|
}
|
|
19485
19796
|
const raw = readFile(match.filePath);
|
|
19486
|
-
const parsed =
|
|
19797
|
+
const parsed = matter15(raw);
|
|
19487
19798
|
const base = parsed.data ?? {};
|
|
19488
19799
|
const data = buildFrontmatter(match.id || id, input, base);
|
|
19489
19800
|
let body = parsed.content.trim();
|
|
@@ -19958,7 +20269,7 @@ var CANDIDATE_DISCOVERY_GUIDANCE = [
|
|
|
19958
20269
|
// src/core/deprecation-write.ts
|
|
19959
20270
|
import fs6 from "fs";
|
|
19960
20271
|
import path10 from "path";
|
|
19961
|
-
import
|
|
20272
|
+
import matter16 from "gray-matter";
|
|
19962
20273
|
var DeprecationWriteError = class extends Error {
|
|
19963
20274
|
constructor(code, message) {
|
|
19964
20275
|
super(message);
|
|
@@ -19976,14 +20287,14 @@ function atomicWrite3(filePath, content) {
|
|
|
19976
20287
|
fs6.renameSync(tmp, filePath);
|
|
19977
20288
|
}
|
|
19978
20289
|
function serialize2(data, body) {
|
|
19979
|
-
return
|
|
20290
|
+
return matter16.stringify(`
|
|
19980
20291
|
${body.trim()}
|
|
19981
20292
|
`, data);
|
|
19982
20293
|
}
|
|
19983
20294
|
function allPlanArtifacts(dir) {
|
|
19984
20295
|
return discoverKnowledge(dir).filter((a) => a.type === DEPRECATION_ARTIFACT_TYPE);
|
|
19985
20296
|
}
|
|
19986
|
-
function
|
|
20297
|
+
function nextPlanId2(dir, explicit) {
|
|
19987
20298
|
if (explicit && explicit.trim()) return explicit.trim();
|
|
19988
20299
|
let max = 0;
|
|
19989
20300
|
for (const a of allPlanArtifacts(dir)) {
|
|
@@ -20042,7 +20353,7 @@ function validateTargetInput(dir, raw) {
|
|
|
20042
20353
|
function loadPlanRaw(dir, planId) {
|
|
20043
20354
|
const match = allPlanArtifacts(dir).find((a) => a.id === planId || a.title === planId);
|
|
20044
20355
|
if (!match) throw new DeprecationWriteError("NOT_FOUND", `Deprecation Plan "${planId}" not found.`);
|
|
20045
|
-
const parsed =
|
|
20356
|
+
const parsed = matter16(readFile(match.filePath));
|
|
20046
20357
|
const data = { ...parsed.data ?? {} };
|
|
20047
20358
|
return { filePath: match.filePath, data, body: parsed.content.trim() };
|
|
20048
20359
|
}
|
|
@@ -20059,7 +20370,7 @@ function createPlan(dir, input) {
|
|
|
20059
20370
|
if (existing.some((a) => (a.title || "").toLowerCase() === title.toLowerCase())) {
|
|
20060
20371
|
throw new DeprecationWriteError("DUPLICATE", `A plan titled "${title}" already exists.`);
|
|
20061
20372
|
}
|
|
20062
|
-
const id =
|
|
20373
|
+
const id = nextPlanId2(dir, input.id);
|
|
20063
20374
|
const data = {
|
|
20064
20375
|
type: DEPRECATION_ARTIFACT_TYPE,
|
|
20065
20376
|
id,
|
|
@@ -20125,7 +20436,7 @@ function removeTarget(dir, planId, targetId, opts = {}) {
|
|
|
20125
20436
|
}
|
|
20126
20437
|
|
|
20127
20438
|
// src/core/deprecation-runbook.ts
|
|
20128
|
-
import
|
|
20439
|
+
import matter17 from "gray-matter";
|
|
20129
20440
|
var PRODUCTION_RUNBOOK_ARTIFACT_TYPE = "production-runbook";
|
|
20130
20441
|
var PRODUCTION_RUNBOOKS_DIR = "knowledge/delivery/runbooks";
|
|
20131
20442
|
var RUNBOOK_SECTIONS = [
|
|
@@ -20307,7 +20618,7 @@ function createProductionRunbook(dir, planId, targetId) {
|
|
|
20307
20618
|
if (!context.eligible) throw new ProductionRunbookError(context.blockers.join(" "));
|
|
20308
20619
|
const path16 = context.nextPath;
|
|
20309
20620
|
const id = path16.split("/").pop()?.match(/^(RB-\d+)-/)?.[1] ?? "";
|
|
20310
|
-
const content =
|
|
20621
|
+
const content = matter17.stringify(renderRunbook(context), {
|
|
20311
20622
|
id,
|
|
20312
20623
|
type: PRODUCTION_RUNBOOK_ARTIFACT_TYPE,
|
|
20313
20624
|
title: `Production runbook \u2014 ${context.target.title ?? context.target.id}`,
|
|
@@ -20334,7 +20645,7 @@ function getProductionRunbook(dir, id) {
|
|
|
20334
20645
|
for (const name of readDir(root)) {
|
|
20335
20646
|
if (!name.toLowerCase().startsWith(`${id.toLowerCase()}-`) || !name.endsWith(".md")) continue;
|
|
20336
20647
|
const path16 = `${PRODUCTION_RUNBOOKS_DIR}/${name}`;
|
|
20337
|
-
const parsed =
|
|
20648
|
+
const parsed = matter17(readFile(join(dir, path16)));
|
|
20338
20649
|
const data = parsed.data;
|
|
20339
20650
|
if (data.type !== PRODUCTION_RUNBOOK_ARTIFACT_TYPE) continue;
|
|
20340
20651
|
return {
|
|
@@ -20682,7 +20993,7 @@ import fs7 from "fs";
|
|
|
20682
20993
|
import path11 from "path";
|
|
20683
20994
|
|
|
20684
20995
|
// src/core/okf/mapping.ts
|
|
20685
|
-
import
|
|
20996
|
+
import matter18 from "gray-matter";
|
|
20686
20997
|
var OKF_TYPE_TABLE = {
|
|
20687
20998
|
"business-knowledge": "Business Knowledge",
|
|
20688
20999
|
"product-knowledge": "Product Knowledge",
|
|
@@ -20783,7 +21094,7 @@ function conceptId(a) {
|
|
|
20783
21094
|
}
|
|
20784
21095
|
function readBody(a) {
|
|
20785
21096
|
try {
|
|
20786
|
-
const body =
|
|
21097
|
+
const body = matter18(readFile(a.filePath)).content.trim();
|
|
20787
21098
|
return body || null;
|
|
20788
21099
|
} catch {
|
|
20789
21100
|
return null;
|
|
@@ -20808,7 +21119,7 @@ function buildConcept(a) {
|
|
|
20808
21119
|
}
|
|
20809
21120
|
|
|
20810
21121
|
// src/core/impact-report.ts
|
|
20811
|
-
import
|
|
21122
|
+
import matter19 from "gray-matter";
|
|
20812
21123
|
|
|
20813
21124
|
// src/core/reporting-evidence.ts
|
|
20814
21125
|
function graphHintFinding(hint) {
|
|
@@ -20945,7 +21256,7 @@ function buildImpactReport(dir, opts = {}, now = /* @__PURE__ */ new Date()) {
|
|
|
20945
21256
|
}
|
|
20946
21257
|
}
|
|
20947
21258
|
try {
|
|
20948
|
-
const body =
|
|
21259
|
+
const body = matter19(readFile(wi.filePath)).content;
|
|
20949
21260
|
if (hasSection(body, /acceptance|criterios de aceptaci/i)) withAcceptance++;
|
|
20950
21261
|
else gaps.missing_acceptance_criteria.push(gapItem(wi, "Add an `## Acceptance Criteria` section."));
|
|
20951
21262
|
if (hasSection(body, /definition of done|^#{1,6}\s*dod\b|definici[oó]n de (terminado|hecho)/i)) withDoD++;
|
|
@@ -22314,7 +22625,7 @@ ${c.body ?? ""}`;
|
|
|
22314
22625
|
// src/core/okf/validate.ts
|
|
22315
22626
|
import fs8 from "fs";
|
|
22316
22627
|
import path12 from "path";
|
|
22317
|
-
import
|
|
22628
|
+
import matter20 from "gray-matter";
|
|
22318
22629
|
function walk(root) {
|
|
22319
22630
|
const out = [];
|
|
22320
22631
|
const rec = (d) => {
|
|
@@ -22361,7 +22672,7 @@ function validateOkf(dir, opts = {}) {
|
|
|
22361
22672
|
const isIndex = path12.basename(file) === "index.md";
|
|
22362
22673
|
let data = {};
|
|
22363
22674
|
try {
|
|
22364
|
-
data =
|
|
22675
|
+
data = matter20(fs8.readFileSync(file, "utf-8")).data ?? {};
|
|
22365
22676
|
} catch {
|
|
22366
22677
|
findings.push({ level: "conformance", file: r, message: "Invalid YAML frontmatter." });
|
|
22367
22678
|
continue;
|
|
@@ -22383,7 +22694,7 @@ function validateOkf(dir, opts = {}) {
|
|
|
22383
22694
|
}
|
|
22384
22695
|
const body = (() => {
|
|
22385
22696
|
try {
|
|
22386
|
-
return
|
|
22697
|
+
return matter20(fs8.readFileSync(file, "utf-8")).content;
|
|
22387
22698
|
} catch {
|
|
22388
22699
|
return "";
|
|
22389
22700
|
}
|
|
@@ -22454,14 +22765,14 @@ function runOkfValidate(location, opts = {}, dir = cwd()) {
|
|
|
22454
22765
|
}
|
|
22455
22766
|
|
|
22456
22767
|
// src/services/integrations.ts
|
|
22457
|
-
import
|
|
22768
|
+
import matter22 from "gray-matter";
|
|
22458
22769
|
import { parse as parseYaml19, stringify as stringifyYaml10 } from "yaml";
|
|
22459
22770
|
|
|
22460
22771
|
// src/core/work-item-write.ts
|
|
22461
22772
|
import fs9 from "fs";
|
|
22462
22773
|
import path13 from "path";
|
|
22463
22774
|
import crypto2 from "crypto";
|
|
22464
|
-
import
|
|
22775
|
+
import matter21 from "gray-matter";
|
|
22465
22776
|
var WORK_ITEMS_DIR3 = "knowledge/delivery/work-items";
|
|
22466
22777
|
var WorkItemWriteError = class extends Error {
|
|
22467
22778
|
constructor(code, message) {
|
|
@@ -22565,7 +22876,7 @@ function ensureH1(body, title) {
|
|
|
22565
22876
|
${trimmed}`;
|
|
22566
22877
|
}
|
|
22567
22878
|
function serialize3(data, body) {
|
|
22568
|
-
return
|
|
22879
|
+
return matter21.stringify(`
|
|
22569
22880
|
${body.trim()}
|
|
22570
22881
|
`, data);
|
|
22571
22882
|
}
|
|
@@ -23642,7 +23953,7 @@ function findLinkedWorkItem(dir, integrationId, externalId) {
|
|
|
23642
23953
|
for (const art of discoverWorkItems(dir)) {
|
|
23643
23954
|
let data;
|
|
23644
23955
|
try {
|
|
23645
|
-
data =
|
|
23956
|
+
data = matter22(readFile(art.filePath)).data;
|
|
23646
23957
|
} catch {
|
|
23647
23958
|
continue;
|
|
23648
23959
|
}
|
|
@@ -24298,7 +24609,7 @@ function runAssetsUpdate(kind, opts = {}) {
|
|
|
24298
24609
|
// src/commands/ready.ts
|
|
24299
24610
|
import fs11 from "fs";
|
|
24300
24611
|
import path14 from "path";
|
|
24301
|
-
import
|
|
24612
|
+
import matter23 from "gray-matter";
|
|
24302
24613
|
function validateReadiness(content, frontmatter2) {
|
|
24303
24614
|
const warnings = [];
|
|
24304
24615
|
const body = content.replace(/^---[\s\S]*?---/, "").trim();
|
|
@@ -24352,11 +24663,11 @@ function isResolvedSection(text2) {
|
|
|
24352
24663
|
}
|
|
24353
24664
|
function transitionToReady(filePath) {
|
|
24354
24665
|
const raw = readFile(filePath);
|
|
24355
|
-
const { data, content } =
|
|
24666
|
+
const { data, content } = matter23(raw);
|
|
24356
24667
|
const today3 = (/* @__PURE__ */ new Date()).toISOString().slice(0, 10);
|
|
24357
24668
|
data.status = "ready";
|
|
24358
24669
|
data.ready_at = today3;
|
|
24359
|
-
const newContent =
|
|
24670
|
+
const newContent = matter23.stringify(content, data);
|
|
24360
24671
|
const posix2 = filePath.replace(/\\/g, "/");
|
|
24361
24672
|
let newPath = filePath;
|
|
24362
24673
|
if (posix2.includes("/work-items/draft/")) {
|
|
@@ -24396,7 +24707,7 @@ async function runReady(id, opts = {}) {
|
|
|
24396
24707
|
process.exit(1);
|
|
24397
24708
|
}
|
|
24398
24709
|
const raw = readFile(wi.filePath);
|
|
24399
|
-
const { data } =
|
|
24710
|
+
const { data } = matter23(raw);
|
|
24400
24711
|
const source2 = parseWorkItemSource(data);
|
|
24401
24712
|
const warnings = validateReadiness(raw, data);
|
|
24402
24713
|
log.info(`Work Item found:`);
|
|
@@ -24572,10 +24883,10 @@ async function runAdmin(opts = {}) {
|
|
|
24572
24883
|
// src/core/work-item-import.ts
|
|
24573
24884
|
import crypto3 from "crypto";
|
|
24574
24885
|
import fs12 from "fs";
|
|
24575
|
-
import
|
|
24886
|
+
import matter25 from "gray-matter";
|
|
24576
24887
|
|
|
24577
24888
|
// src/core/work-items.ts
|
|
24578
|
-
import
|
|
24889
|
+
import matter24 from "gray-matter";
|
|
24579
24890
|
function computeRefinementStatus(wi) {
|
|
24580
24891
|
const aspects = {
|
|
24581
24892
|
outcome: Boolean(wi.currentBehavior?.trim() || wi.targetBehavior?.trim()),
|
|
@@ -24711,7 +25022,7 @@ function parseOriginalSnapshot(fm2) {
|
|
|
24711
25022
|
function readBody2(filePath) {
|
|
24712
25023
|
try {
|
|
24713
25024
|
const raw = readFile(filePath);
|
|
24714
|
-
return
|
|
25025
|
+
return matter24(raw).content;
|
|
24715
25026
|
} catch {
|
|
24716
25027
|
return "";
|
|
24717
25028
|
}
|
|
@@ -24795,7 +25106,7 @@ function normalizeImpact(ia) {
|
|
|
24795
25106
|
...v.question ? { question: v.question } : {}
|
|
24796
25107
|
}));
|
|
24797
25108
|
}
|
|
24798
|
-
function
|
|
25109
|
+
function optStr4(v) {
|
|
24799
25110
|
if (typeof v === "string" && v.trim()) return v.trim();
|
|
24800
25111
|
return void 0;
|
|
24801
25112
|
}
|
|
@@ -24810,13 +25121,13 @@ function parseEvidence(fm2) {
|
|
|
24810
25121
|
const validations = Array.isArray(d.validations) ? d.validations.map((v) => ({
|
|
24811
25122
|
command: String(v.command ?? ""),
|
|
24812
25123
|
status: String(v.status ?? "unknown"),
|
|
24813
|
-
...
|
|
25124
|
+
...optStr4(v.reason) ? { reason: optStr4(v.reason) } : {}
|
|
24814
25125
|
})) : [];
|
|
24815
25126
|
const migrations = Array.isArray(d.migrations) ? d.migrations.map((m) => ({
|
|
24816
25127
|
id: String(m.id ?? ""),
|
|
24817
25128
|
environment: String(m.environment ?? ""),
|
|
24818
25129
|
status: String(m.status ?? "unknown"),
|
|
24819
|
-
...
|
|
25130
|
+
...optStr4(m.reason) ? { reason: optStr4(m.reason) } : {}
|
|
24820
25131
|
})) : [];
|
|
24821
25132
|
out.push({
|
|
24822
25133
|
module,
|
|
@@ -24834,8 +25145,8 @@ function parseReleaseGates(fm2) {
|
|
|
24834
25145
|
return fm2.release_gates.filter((g) => g && typeof g === "object").map((g) => ({
|
|
24835
25146
|
id: String(g.id ?? ""),
|
|
24836
25147
|
status: String(g.status ?? "pending"),
|
|
24837
|
-
...
|
|
24838
|
-
...
|
|
25148
|
+
...optStr4(g.reason) ? { reason: optStr4(g.reason) } : {},
|
|
25149
|
+
...optStr4(g.required_for) ? { requiredFor: optStr4(g.required_for) } : {}
|
|
24839
25150
|
}));
|
|
24840
25151
|
}
|
|
24841
25152
|
function parseExceptions(fm2) {
|
|
@@ -24843,9 +25154,9 @@ function parseExceptions(fm2) {
|
|
|
24843
25154
|
return fm2.completion_exceptions.filter((e) => e && typeof e === "object").map((e) => ({
|
|
24844
25155
|
id: String(e.id ?? ""),
|
|
24845
25156
|
status: String(e.status ?? "proposed"),
|
|
24846
|
-
...
|
|
24847
|
-
...
|
|
24848
|
-
...
|
|
25157
|
+
...optStr4(e.reason) ? { reason: optStr4(e.reason) } : {},
|
|
25158
|
+
...optStr4(e.category) ? { category: optStr4(e.category) } : {},
|
|
25159
|
+
...optStr4(e.impact) ? { impact: optStr4(e.impact) } : {}
|
|
24849
25160
|
}));
|
|
24850
25161
|
}
|
|
24851
25162
|
function parseDecisions(decisions, knowledgeById) {
|
|
@@ -25170,7 +25481,7 @@ function detectFormat(raw) {
|
|
|
25170
25481
|
if (!trimmed) throw new ImportError("EMPTY_INPUT", "Import content is empty.");
|
|
25171
25482
|
if (trimmed.startsWith("---")) {
|
|
25172
25483
|
try {
|
|
25173
|
-
const { data } =
|
|
25484
|
+
const { data } = matter25(trimmed);
|
|
25174
25485
|
if (data && typeof data === "object" && Object.keys(data).length > 0) {
|
|
25175
25486
|
const d = data;
|
|
25176
25487
|
if (d.type === "work-item" || d.id && typeof d.id === "string" && /^WI-\d+/.test(d.id)) {
|
|
@@ -25192,7 +25503,7 @@ function parseContent(raw) {
|
|
|
25192
25503
|
let bodyText = trimmed;
|
|
25193
25504
|
if (format === "kaddo-frontmatter" || format === "markdown-frontmatter") {
|
|
25194
25505
|
try {
|
|
25195
|
-
const parsed =
|
|
25506
|
+
const parsed = matter25(trimmed);
|
|
25196
25507
|
frontmatterFields = parsed.data ?? {};
|
|
25197
25508
|
bodyText = parsed.content.trim();
|
|
25198
25509
|
} catch {
|
|
@@ -25289,7 +25600,7 @@ function findDuplicateByHash(dir, hash) {
|
|
|
25289
25600
|
const raw = readFile(item.filePath);
|
|
25290
25601
|
if (!raw) continue;
|
|
25291
25602
|
try {
|
|
25292
|
-
const { data } =
|
|
25603
|
+
const { data } = matter25(raw);
|
|
25293
25604
|
const source2 = data?.source;
|
|
25294
25605
|
if (source2 && typeof source2 === "object" && !Array.isArray(source2)) {
|
|
25295
25606
|
const s = source2;
|
|
@@ -25530,7 +25841,7 @@ ${report.handoff}
|
|
|
25530
25841
|
}
|
|
25531
25842
|
|
|
25532
25843
|
// src/commands/verify.ts
|
|
25533
|
-
import
|
|
25844
|
+
import matter26 from "gray-matter";
|
|
25534
25845
|
|
|
25535
25846
|
// src/core/implementation-evidence.ts
|
|
25536
25847
|
var WorkItemNotInProgressError = class extends Error {
|
|
@@ -25807,7 +26118,7 @@ async function runVerify(workItemId, opts = {}) {
|
|
|
25807
26118
|
}
|
|
25808
26119
|
const changedPaths = await getModifiedFiles("head");
|
|
25809
26120
|
const raw = readFile(match.filePath);
|
|
25810
|
-
const parsed =
|
|
26121
|
+
const parsed = matter26(raw);
|
|
25811
26122
|
const fm2 = parsed.data;
|
|
25812
26123
|
const acs = extractACsFromBody(parsed.content);
|
|
25813
26124
|
const existingEvidence = fm2.implementation_evidence;
|
|
@@ -25925,13 +26236,13 @@ async function runVerify(workItemId, opts = {}) {
|
|
|
25925
26236
|
if (shouldPersist) {
|
|
25926
26237
|
const filePath = match.filePath;
|
|
25927
26238
|
const wiRaw = readFile(filePath);
|
|
25928
|
-
const wiParsed =
|
|
26239
|
+
const wiParsed = matter26(wiRaw);
|
|
25929
26240
|
const data = wiParsed.data;
|
|
25930
26241
|
data.implementation_evidence = verification.implementationEvidence;
|
|
25931
26242
|
data.implementation_status = verification.implementationStatus;
|
|
25932
26243
|
data.validation_status = verification.validationStatus;
|
|
25933
26244
|
data.verified_at = (/* @__PURE__ */ new Date()).toISOString().split("T")[0];
|
|
25934
|
-
const newRaw =
|
|
26245
|
+
const newRaw = matter26.stringify(wiParsed.content, data);
|
|
25935
26246
|
writeFile(filePath, newRaw);
|
|
25936
26247
|
log.success("Work Item frontmatter updated with verification evidence.");
|
|
25937
26248
|
}
|
|
@@ -25940,7 +26251,7 @@ async function runVerify(workItemId, opts = {}) {
|
|
|
25940
26251
|
|
|
25941
26252
|
// src/core/knowledge-consolidation.ts
|
|
25942
26253
|
import { createHash as createHash2 } from "crypto";
|
|
25943
|
-
import
|
|
26254
|
+
import matter27 from "gray-matter";
|
|
25944
26255
|
var KNOWLEDGE6 = "knowledge";
|
|
25945
26256
|
var CONSOLIDATION_CATEGORIES = [
|
|
25946
26257
|
"knowledge_redundancy",
|
|
@@ -25950,12 +26261,12 @@ var CONSOLIDATION_CATEGORIES = [
|
|
|
25950
26261
|
"potentially_outdated",
|
|
25951
26262
|
"knowledge_organization"
|
|
25952
26263
|
];
|
|
25953
|
-
function
|
|
26264
|
+
function toPosix8(p) {
|
|
25954
26265
|
return p.replace(/\\/g, "/");
|
|
25955
26266
|
}
|
|
25956
26267
|
function relFromDir(dir, filePath) {
|
|
25957
|
-
const d =
|
|
25958
|
-
const f =
|
|
26268
|
+
const d = toPosix8(dir).replace(/\/+$/, "");
|
|
26269
|
+
const f = toPosix8(filePath);
|
|
25959
26270
|
return f.startsWith(d + "/") ? f.slice(d.length + 1) : f;
|
|
25960
26271
|
}
|
|
25961
26272
|
function sha256(content) {
|
|
@@ -26073,7 +26384,7 @@ function stableOpportunityId(category, sources) {
|
|
|
26073
26384
|
function layerOf(a) {
|
|
26074
26385
|
const byType = layerForType(a.type);
|
|
26075
26386
|
if (byType) return byType;
|
|
26076
|
-
const p =
|
|
26387
|
+
const p = toPosix8(a.filePath);
|
|
26077
26388
|
if (p.includes(`/${KNOWLEDGE6}/business/`)) return "Business";
|
|
26078
26389
|
if (p.includes(`/${KNOWLEDGE6}/product/`)) return "Product";
|
|
26079
26390
|
if (p.includes(`/${KNOWLEDGE6}/tech/`)) return "Tech";
|
|
@@ -26097,7 +26408,7 @@ function buildConsolidationPlan(dir, opts = {}) {
|
|
|
26097
26408
|
const loaded = rawArtifacts.map((a) => {
|
|
26098
26409
|
let body = "";
|
|
26099
26410
|
try {
|
|
26100
|
-
body =
|
|
26411
|
+
body = matter27(readFile(a.filePath)).content;
|
|
26101
26412
|
} catch {
|
|
26102
26413
|
body = "";
|
|
26103
26414
|
}
|
|
@@ -26351,14 +26662,14 @@ function describeScope(scope) {
|
|
|
26351
26662
|
return `module:${scope.module}`;
|
|
26352
26663
|
}
|
|
26353
26664
|
function isWorkItem(la) {
|
|
26354
|
-
return
|
|
26665
|
+
return toPosix8(la.artifact.filePath).includes("/delivery/work-items/");
|
|
26355
26666
|
}
|
|
26356
26667
|
function isCompletedWorkItem(la) {
|
|
26357
|
-
const p =
|
|
26668
|
+
const p = toPosix8(la.artifact.filePath);
|
|
26358
26669
|
return p.includes("/delivery/work-items/completed/") || isWorkItem(la) && la.artifact.status === "completed";
|
|
26359
26670
|
}
|
|
26360
26671
|
function isScaffolding(la) {
|
|
26361
|
-
const p =
|
|
26672
|
+
const p = toPosix8(la.artifact.filePath);
|
|
26362
26673
|
return p.includes(`/${KNOWLEDGE6}/agents/`) || p.includes(`/${KNOWLEDGE6}/skills/`) || p.includes(`/${KNOWLEDGE6}/external/`) || la.artifact.type === "knowledge-capsule";
|
|
26363
26674
|
}
|
|
26364
26675
|
var NON_KNOWLEDGE_DOC_TYPES = /* @__PURE__ */ new Set([
|
|
@@ -26426,7 +26737,7 @@ function decisionFileExists(dir, decisionId) {
|
|
|
26426
26737
|
function hintInScope(hint, scoped) {
|
|
26427
26738
|
if (scoped.length === 0) return false;
|
|
26428
26739
|
return scoped.some(
|
|
26429
|
-
(la) => la.artifact.id === hint.artifact_id || hint.path &&
|
|
26740
|
+
(la) => la.artifact.id === hint.artifact_id || hint.path && toPosix8(la.artifact.filePath).endsWith(toPosix8(hint.path))
|
|
26430
26741
|
);
|
|
26431
26742
|
}
|
|
26432
26743
|
function relationshipOpportunityFromHint(hint) {
|
|
@@ -26501,72 +26812,603 @@ function runKnowledgeConsolidate(opts = {}) {
|
|
|
26501
26812
|
outro("Consolidation Plan ready for review.");
|
|
26502
26813
|
}
|
|
26503
26814
|
|
|
26504
|
-
// src/core/
|
|
26505
|
-
import
|
|
26815
|
+
// src/core/delivery-planning-write.ts
|
|
26816
|
+
import matter29 from "gray-matter";
|
|
26506
26817
|
|
|
26507
|
-
// src/core/
|
|
26508
|
-
import
|
|
26509
|
-
var
|
|
26510
|
-
var
|
|
26511
|
-
|
|
26512
|
-
|
|
26513
|
-
|
|
26514
|
-
|
|
26515
|
-
const p = identityPath(dir);
|
|
26516
|
-
if (!exists(p)) return null;
|
|
26517
|
-
try {
|
|
26518
|
-
return JSON.parse(readFile(p));
|
|
26519
|
-
} catch {
|
|
26520
|
-
return null;
|
|
26818
|
+
// src/core/initiative-write.ts
|
|
26819
|
+
import matter28 from "gray-matter";
|
|
26820
|
+
var WORK_ITEMS_DIR4 = "knowledge/delivery/work-items";
|
|
26821
|
+
var DRAFT_DIR2 = `${WORK_ITEMS_DIR4}/draft`;
|
|
26822
|
+
var InitiativeWriteError = class extends Error {
|
|
26823
|
+
constructor(message) {
|
|
26824
|
+
super(message);
|
|
26825
|
+
this.name = "InitiativeWriteError";
|
|
26521
26826
|
}
|
|
26827
|
+
};
|
|
26828
|
+
function slugify7(s) {
|
|
26829
|
+
return s.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, "").slice(0, 50);
|
|
26522
26830
|
}
|
|
26523
|
-
function
|
|
26524
|
-
|
|
26525
|
-
if (existing) return existing;
|
|
26526
|
-
const installationId = crypto4.randomUUID();
|
|
26527
|
-
const { publicKey, privateKey } = crypto4.generateKeyPairSync("ed25519");
|
|
26528
|
-
const pubSpki = publicKey.export({ type: "spki", format: "der" });
|
|
26529
|
-
const privPkcs8 = privateKey.export({ type: "pkcs8", format: "der" });
|
|
26530
|
-
const identity = {
|
|
26531
|
-
installationId,
|
|
26532
|
-
publicKey: pubSpki.toString("base64url"),
|
|
26533
|
-
privateKey: privPkcs8.toString("base64url"),
|
|
26534
|
-
keyAlgorithm: "Ed25519",
|
|
26535
|
-
registrationVersion: "1.0",
|
|
26536
|
-
registered: false
|
|
26537
|
-
};
|
|
26538
|
-
ensureDir(join(dir, TELEMETRY_DIR));
|
|
26539
|
-
writeFile(identityPath(dir), JSON.stringify(identity, null, 2));
|
|
26540
|
-
return identity;
|
|
26831
|
+
function today2() {
|
|
26832
|
+
return (/* @__PURE__ */ new Date()).toISOString().slice(0, 10);
|
|
26541
26833
|
}
|
|
26542
|
-
function
|
|
26543
|
-
|
|
26544
|
-
|
|
26545
|
-
|
|
26834
|
+
function candidateToData(c) {
|
|
26835
|
+
const out = { id: c.id, title: c.title };
|
|
26836
|
+
if (c.type) out.type = c.type;
|
|
26837
|
+
if (c.suggestedKnowledgeLevel) out.suggested_knowledge_level = c.suggestedKnowledgeLevel;
|
|
26838
|
+
if (c.expectedValue) out.expected_value = c.expectedValue;
|
|
26839
|
+
if (c.notes) out.notes = c.notes;
|
|
26840
|
+
if (c.sourceSignals.length) out.source_signals = c.sourceSignals;
|
|
26841
|
+
if (c.dependencies.length) out.dependencies = c.dependencies;
|
|
26842
|
+
if (c.materializedAs) out.materialized_as = c.materializedAs;
|
|
26843
|
+
return out;
|
|
26546
26844
|
}
|
|
26547
|
-
function
|
|
26548
|
-
const
|
|
26549
|
-
|
|
26550
|
-
|
|
26551
|
-
|
|
26552
|
-
|
|
26553
|
-
${bodySha256}`;
|
|
26554
|
-
const privKeyDer = Buffer.from(identity.privateKey, "base64url");
|
|
26555
|
-
const privKey = crypto4.createPrivateKey({ key: privKeyDer, format: "der", type: "pkcs8" });
|
|
26556
|
-
const sig2 = crypto4.sign(null, Buffer.from(canonical), privKey);
|
|
26557
|
-
return sig2.toString("base64url");
|
|
26845
|
+
function externalLinkToData(l) {
|
|
26846
|
+
const out = { integration: l.integration, external_id: l.externalId };
|
|
26847
|
+
if (l.externalType) out.external_type = l.externalType;
|
|
26848
|
+
if (l.url) out.url = l.url;
|
|
26849
|
+
if (l.externalStatus) out.external_status = l.externalStatus;
|
|
26850
|
+
return out;
|
|
26558
26851
|
}
|
|
26559
|
-
|
|
26560
|
-
// src/core/telemetry-events.ts
|
|
26561
|
-
import crypto5 from "crypto";
|
|
26562
|
-
function createEvent(name, installationId, source2, properties) {
|
|
26852
|
+
function normalizeCandidate(input, fallbackId) {
|
|
26563
26853
|
return {
|
|
26564
|
-
|
|
26565
|
-
|
|
26566
|
-
|
|
26567
|
-
|
|
26568
|
-
|
|
26569
|
-
|
|
26854
|
+
id: input.id?.trim() || fallbackId,
|
|
26855
|
+
title: input.title.trim(),
|
|
26856
|
+
type: input.type?.trim() || void 0,
|
|
26857
|
+
suggestedKnowledgeLevel: input.suggestedKnowledgeLevel?.trim() || void 0,
|
|
26858
|
+
expectedValue: input.expectedValue?.trim() || void 0,
|
|
26859
|
+
notes: input.notes?.trim() || void 0,
|
|
26860
|
+
sourceSignals: input.sourceSignals ?? [],
|
|
26861
|
+
dependencies: input.dependencies ?? [],
|
|
26862
|
+
materializedAs: input.materializedAs ?? null
|
|
26863
|
+
};
|
|
26864
|
+
}
|
|
26865
|
+
function defaultBody(title) {
|
|
26866
|
+
return [
|
|
26867
|
+
`# ${title}`,
|
|
26868
|
+
"",
|
|
26869
|
+
"## Goal",
|
|
26870
|
+
"",
|
|
26871
|
+
"_What outcome does this Initiative pursue?_",
|
|
26872
|
+
"",
|
|
26873
|
+
"## Expected Value",
|
|
26874
|
+
"",
|
|
26875
|
+
"_Why it matters._",
|
|
26876
|
+
"",
|
|
26877
|
+
"## Scope",
|
|
26878
|
+
"",
|
|
26879
|
+
"_What this Initiative covers._",
|
|
26880
|
+
"",
|
|
26881
|
+
"## Out of Scope",
|
|
26882
|
+
"",
|
|
26883
|
+
"_What it explicitly does not cover._",
|
|
26884
|
+
"",
|
|
26885
|
+
"## Success Criteria",
|
|
26886
|
+
"",
|
|
26887
|
+
'_Observable outcomes that define completion (not just "all Work Items done")._',
|
|
26888
|
+
"",
|
|
26889
|
+
"## Dependencies",
|
|
26890
|
+
"",
|
|
26891
|
+
"_Other Initiatives, modules, or external work this depends on._",
|
|
26892
|
+
"",
|
|
26893
|
+
"## Work Item Candidates",
|
|
26894
|
+
"",
|
|
26895
|
+
"_Candidates live in frontmatter `candidates`; summarize them here as they evolve._",
|
|
26896
|
+
"",
|
|
26897
|
+
"## Open Questions",
|
|
26898
|
+
"",
|
|
26899
|
+
"_Unresolved questions for this Initiative._",
|
|
26900
|
+
"",
|
|
26901
|
+
"## Learning",
|
|
26902
|
+
"",
|
|
26903
|
+
"_Captured on completion: what was delivered, what stayed out of scope, outcome reached._",
|
|
26904
|
+
""
|
|
26905
|
+
].join("\n");
|
|
26906
|
+
}
|
|
26907
|
+
function buildInitiativeContent(id, input) {
|
|
26908
|
+
const status = input.status ?? "planned";
|
|
26909
|
+
if (!isValidInitiativeStatus(status)) {
|
|
26910
|
+
throw new InitiativeWriteError(`Invalid initiative status: ${status}.`);
|
|
26911
|
+
}
|
|
26912
|
+
const candidates = (input.candidates ?? []).map(
|
|
26913
|
+
(c, i) => normalizeCandidate(c, `WI-CANDIDATE-${String(i + 1).padStart(3, "0")}`)
|
|
26914
|
+
);
|
|
26915
|
+
const data = {
|
|
26916
|
+
type: "initiative",
|
|
26917
|
+
id,
|
|
26918
|
+
title: input.title.trim(),
|
|
26919
|
+
status,
|
|
26920
|
+
knowledge_level: input.knowledgeLevel ?? "K2",
|
|
26921
|
+
domains: input.domains ?? [],
|
|
26922
|
+
related_capabilities: input.relatedCapabilities ?? [],
|
|
26923
|
+
created_at: today2(),
|
|
26924
|
+
external_links: (input.externalLinks ?? []).map(externalLinkToData),
|
|
26925
|
+
candidates: candidates.map(candidateToData)
|
|
26926
|
+
};
|
|
26927
|
+
if (input.horizon) data.horizon = input.horizon;
|
|
26928
|
+
if (input.priority) data.priority = input.priority;
|
|
26929
|
+
if (input.source) data.source = input.source;
|
|
26930
|
+
if (input.sourceId) data.source_id = input.sourceId;
|
|
26931
|
+
if (input.epic) data.epic = input.epic.trim();
|
|
26932
|
+
if (input.owners?.length) data.owners = input.owners.map((o) => o.trim()).filter(Boolean);
|
|
26933
|
+
if (input.contributors?.length) data.contributors = input.contributors.map((c) => c.trim()).filter(Boolean);
|
|
26934
|
+
return matter28.stringify("\n" + (input.body ?? defaultBody(input.title.trim())), data);
|
|
26935
|
+
}
|
|
26936
|
+
function createInitiative(dir, input) {
|
|
26937
|
+
if (!input.title?.trim()) throw new InitiativeWriteError("Initiative title is required.");
|
|
26938
|
+
const id = nextInitiativeId(dir);
|
|
26939
|
+
const fileName = `${id}-${slugify7(input.title)}.md`;
|
|
26940
|
+
const iniDir = join(dir, INITIATIVES_DIR);
|
|
26941
|
+
ensureDir(iniDir);
|
|
26942
|
+
const filePath = join(iniDir, fileName);
|
|
26943
|
+
const content = buildInitiativeContent(id, input);
|
|
26944
|
+
writeFile(filePath, content);
|
|
26945
|
+
const ini = parseInitiative(dir, filePath, content);
|
|
26946
|
+
if (!ini) throw new InitiativeWriteError("Failed to parse the Initiative just written.");
|
|
26947
|
+
return ini;
|
|
26948
|
+
}
|
|
26949
|
+
function transitionInitiative(dir, id, to) {
|
|
26950
|
+
const ini = getInitiative(dir, id);
|
|
26951
|
+
if (!ini) throw new InitiativeWriteError(`Initiative ${id} not found.`);
|
|
26952
|
+
if (!isValidInitiativeStatus(to)) throw new InitiativeWriteError(`Invalid status: ${to}.`);
|
|
26953
|
+
if (ini.status === to) return ini;
|
|
26954
|
+
if (!isValidInitiativeTransition(ini.status, to)) {
|
|
26955
|
+
throw new InitiativeWriteError(`Invalid transition ${ini.status} \u2192 ${to}.`);
|
|
26956
|
+
}
|
|
26957
|
+
const raw = readFile(ini.filePath);
|
|
26958
|
+
const { data, content } = matter28(raw, {});
|
|
26959
|
+
data.status = to;
|
|
26960
|
+
if (to === "completed") data.completed_at = today2();
|
|
26961
|
+
const newContent = matter28.stringify(content, data);
|
|
26962
|
+
writeFile(ini.filePath, newContent);
|
|
26963
|
+
const updated = parseInitiative(dir, ini.filePath, newContent);
|
|
26964
|
+
if (!updated) throw new InitiativeWriteError("Failed to parse the Initiative after transition.");
|
|
26965
|
+
return updated;
|
|
26966
|
+
}
|
|
26967
|
+
function updateInitiative(dir, id, patch) {
|
|
26968
|
+
const ini = getInitiative(dir, id);
|
|
26969
|
+
if (!ini) throw new InitiativeWriteError(`Initiative ${id} not found.`);
|
|
26970
|
+
const raw = readFile(ini.filePath);
|
|
26971
|
+
const { data, content } = matter28(raw, {});
|
|
26972
|
+
if (patch.title !== void 0) {
|
|
26973
|
+
if (!patch.title.trim()) throw new InitiativeWriteError("Initiative title cannot be empty.");
|
|
26974
|
+
data.title = patch.title.trim();
|
|
26975
|
+
}
|
|
26976
|
+
if (patch.horizon !== void 0) data.horizon = patch.horizon;
|
|
26977
|
+
if (patch.priority !== void 0) data.priority = patch.priority;
|
|
26978
|
+
if (patch.knowledgeLevel !== void 0) data.knowledge_level = patch.knowledgeLevel;
|
|
26979
|
+
if (patch.domains !== void 0) data.domains = patch.domains;
|
|
26980
|
+
if (patch.relatedCapabilities !== void 0) data.related_capabilities = patch.relatedCapabilities;
|
|
26981
|
+
if (patch.epic !== void 0) {
|
|
26982
|
+
if (patch.epic === null || patch.epic.trim() === "") delete data.epic;
|
|
26983
|
+
else data.epic = patch.epic.trim();
|
|
26984
|
+
}
|
|
26985
|
+
if (patch.owners !== void 0) data.owners = patch.owners.map((o) => o.trim()).filter(Boolean);
|
|
26986
|
+
if (patch.contributors !== void 0) data.contributors = patch.contributors.map((c) => c.trim()).filter(Boolean);
|
|
26987
|
+
const newContent = matter28.stringify(content, data);
|
|
26988
|
+
writeFile(ini.filePath, newContent);
|
|
26989
|
+
const updated = parseInitiative(dir, ini.filePath, newContent);
|
|
26990
|
+
if (!updated) throw new InitiativeWriteError("Failed to parse the Initiative after update.");
|
|
26991
|
+
return updated;
|
|
26992
|
+
}
|
|
26993
|
+
function nextWorkItemId3(dir) {
|
|
26994
|
+
const wiDir = join(dir, WORK_ITEMS_DIR4);
|
|
26995
|
+
let max = 0;
|
|
26996
|
+
const walk2 = (d) => {
|
|
26997
|
+
if (!exists(d)) return;
|
|
26998
|
+
for (const entry of readDir(d)) {
|
|
26999
|
+
const full = join(d, entry);
|
|
27000
|
+
if (isFile(full)) {
|
|
27001
|
+
const m = entry.match(/WI-(\d+)/);
|
|
27002
|
+
if (m) max = Math.max(max, parseInt(m[1], 10));
|
|
27003
|
+
} else if (!entry.startsWith(".")) {
|
|
27004
|
+
walk2(full);
|
|
27005
|
+
}
|
|
27006
|
+
}
|
|
27007
|
+
};
|
|
27008
|
+
walk2(wiDir);
|
|
27009
|
+
return `WI-${String(max + 1).padStart(3, "0")}`;
|
|
27010
|
+
}
|
|
27011
|
+
function buildWorkItemContent(wiId, iniId, candidate) {
|
|
27012
|
+
const data = {
|
|
27013
|
+
type: candidate.type ?? "feature",
|
|
27014
|
+
id: wiId,
|
|
27015
|
+
title: candidate.title,
|
|
27016
|
+
knowledge_level: candidate.suggestedKnowledgeLevel ?? "K2",
|
|
27017
|
+
status: "draft",
|
|
27018
|
+
phase: "now",
|
|
27019
|
+
initiative: iniId,
|
|
27020
|
+
domains: [],
|
|
27021
|
+
code: [],
|
|
27022
|
+
created_at: today2(),
|
|
27023
|
+
source: "initiative",
|
|
27024
|
+
source_id: candidate.id,
|
|
27025
|
+
source_initiative: iniId,
|
|
27026
|
+
affected_modules: []
|
|
27027
|
+
};
|
|
27028
|
+
if (candidate.sourceSignals.length) data.source_signals = candidate.sourceSignals;
|
|
27029
|
+
if (candidate.dependencies.length) data.dependencies = candidate.dependencies;
|
|
27030
|
+
const body = [
|
|
27031
|
+
`# ${candidate.title}`,
|
|
27032
|
+
"",
|
|
27033
|
+
`> Materialized from Initiative ${iniId}, candidate ${candidate.id}.`,
|
|
27034
|
+
"",
|
|
27035
|
+
"## Problem",
|
|
27036
|
+
"",
|
|
27037
|
+
candidate.expectedValue ? `_Expected value:_ ${candidate.expectedValue}` : "_Describe the problem._",
|
|
27038
|
+
"",
|
|
27039
|
+
"## Acceptance Criteria",
|
|
27040
|
+
"",
|
|
27041
|
+
"- [ ] _Define at least one testable criterion._",
|
|
27042
|
+
"",
|
|
27043
|
+
"## Out of scope",
|
|
27044
|
+
"",
|
|
27045
|
+
"_Not included in this Work Item._",
|
|
27046
|
+
"",
|
|
27047
|
+
"## Validation",
|
|
27048
|
+
"",
|
|
27049
|
+
"_How will this be validated?_",
|
|
27050
|
+
"",
|
|
27051
|
+
"## Learning",
|
|
27052
|
+
"",
|
|
27053
|
+
"_What did we learn? Update after completion._",
|
|
27054
|
+
""
|
|
27055
|
+
].join("\n");
|
|
27056
|
+
return matter28.stringify("\n" + body, data);
|
|
27057
|
+
}
|
|
27058
|
+
function materializeCandidate(dir, id, candidateId) {
|
|
27059
|
+
const ini = getInitiative(dir, id);
|
|
27060
|
+
if (!ini) throw new InitiativeWriteError(`Initiative ${id} not found.`);
|
|
27061
|
+
const candidate = ini.candidates.find((c) => c.id === candidateId);
|
|
27062
|
+
if (!candidate) throw new InitiativeWriteError(`Candidate ${candidateId} not found in ${id}.`);
|
|
27063
|
+
if (candidate.materializedAs) {
|
|
27064
|
+
throw new InitiativeWriteError(
|
|
27065
|
+
`Candidate ${candidateId} is already materialized as ${candidate.materializedAs}.`
|
|
27066
|
+
);
|
|
27067
|
+
}
|
|
27068
|
+
const wiId = nextWorkItemId3(dir);
|
|
27069
|
+
const fileName = `${wiId}-${slugify7(candidate.title)}.md`;
|
|
27070
|
+
ensureDir(join(dir, DRAFT_DIR2));
|
|
27071
|
+
writeFile(join(dir, DRAFT_DIR2, fileName), buildWorkItemContent(wiId, ini.id, candidate));
|
|
27072
|
+
const raw = readFile(ini.filePath);
|
|
27073
|
+
const { data, content } = matter28(raw, {});
|
|
27074
|
+
const cands = Array.isArray(data.candidates) ? data.candidates : [];
|
|
27075
|
+
for (const c of cands) {
|
|
27076
|
+
if (c && typeof c === "object" && String(c.id) === candidateId) c.materialized_as = wiId;
|
|
27077
|
+
}
|
|
27078
|
+
data.candidates = cands;
|
|
27079
|
+
const newContent = matter28.stringify(content, data);
|
|
27080
|
+
writeFile(ini.filePath, newContent);
|
|
27081
|
+
const updated = parseInitiative(dir, ini.filePath, newContent);
|
|
27082
|
+
if (!updated) throw new InitiativeWriteError("Failed to parse the Initiative after materialization.");
|
|
27083
|
+
return { workItemId: wiId, fileName, initiative: updated };
|
|
27084
|
+
}
|
|
27085
|
+
|
|
27086
|
+
// src/core/delivery-planning-write.ts
|
|
27087
|
+
var DeliveryPlanningWriteError = class extends Error {
|
|
27088
|
+
constructor(message) {
|
|
27089
|
+
super(message);
|
|
27090
|
+
this.name = "DeliveryPlanningWriteError";
|
|
27091
|
+
}
|
|
27092
|
+
};
|
|
27093
|
+
function slugify8(s) {
|
|
27094
|
+
return s.trim().toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "").slice(0, 60) || "item";
|
|
27095
|
+
}
|
|
27096
|
+
function createDeliveryPlan(dir, input) {
|
|
27097
|
+
if (!input.title?.trim()) throw new DeliveryPlanningWriteError("Plan title is required.");
|
|
27098
|
+
const status = input.status ?? "draft";
|
|
27099
|
+
if (!PLAN_STATES.includes(status)) throw new DeliveryPlanningWriteError(`Invalid plan status: ${status}.`);
|
|
27100
|
+
const id = nextPlanId(dir);
|
|
27101
|
+
const data = { type: "delivery-plan", id, title: input.title.trim(), status, milestones: [] };
|
|
27102
|
+
if (input.objective?.trim()) data.objective = input.objective.trim();
|
|
27103
|
+
const body = `
|
|
27104
|
+
# ${input.title.trim()}
|
|
27105
|
+
|
|
27106
|
+
_Describe the objective, scope, exclusions, milestones, dependencies, success criteria and risks._
|
|
27107
|
+
`;
|
|
27108
|
+
const filePath = join(dir, DELIVERY_PLANS_DIR, `${id}-${slugify8(input.title)}.md`);
|
|
27109
|
+
ensureDir(join(dir, DELIVERY_PLANS_DIR));
|
|
27110
|
+
const content = matter29.stringify(body, data);
|
|
27111
|
+
writeFile(filePath, content);
|
|
27112
|
+
const plan = parseDeliveryPlan(dir, filePath, content);
|
|
27113
|
+
if (!plan) throw new DeliveryPlanningWriteError("Failed to parse the Plan just written.");
|
|
27114
|
+
return plan;
|
|
27115
|
+
}
|
|
27116
|
+
function createEpic(dir, input) {
|
|
27117
|
+
if (!input.title?.trim()) throw new DeliveryPlanningWriteError("Epic title is required.");
|
|
27118
|
+
const status = input.status ?? "planned";
|
|
27119
|
+
if (!EPIC_STATES.includes(status)) throw new DeliveryPlanningWriteError(`Invalid epic status: ${status}.`);
|
|
27120
|
+
if (input.plan) {
|
|
27121
|
+
const plan = getPlan(dir, input.plan);
|
|
27122
|
+
if (!plan) throw new DeliveryPlanningWriteError(`Plan ${input.plan} does not exist.`);
|
|
27123
|
+
if (input.milestone && !plan.milestones.some((m) => m.id.toLowerCase() === input.milestone.toLowerCase())) {
|
|
27124
|
+
throw new DeliveryPlanningWriteError(`Milestone ${input.milestone} is not defined in ${input.plan}.`);
|
|
27125
|
+
}
|
|
27126
|
+
} else if (input.milestone) {
|
|
27127
|
+
throw new DeliveryPlanningWriteError("A milestone can only be set together with its plan.");
|
|
27128
|
+
}
|
|
27129
|
+
const id = nextEpicId(dir);
|
|
27130
|
+
const data = { type: "epic", id, title: input.title.trim(), status };
|
|
27131
|
+
if (input.outcome?.trim()) data.outcome = input.outcome.trim();
|
|
27132
|
+
if (input.plan) data.plan = input.plan;
|
|
27133
|
+
if (input.milestone) data.milestone = input.milestone;
|
|
27134
|
+
const body = `
|
|
27135
|
+
# ${input.title.trim()}
|
|
27136
|
+
|
|
27137
|
+
_Describe the expected outcome, success criteria, dependencies and delivery evidence._
|
|
27138
|
+
`;
|
|
27139
|
+
const filePath = join(dir, EPICS_DIR, `${id}-${slugify8(input.title)}.md`);
|
|
27140
|
+
ensureDir(join(dir, EPICS_DIR));
|
|
27141
|
+
const content = matter29.stringify(body, data);
|
|
27142
|
+
writeFile(filePath, content);
|
|
27143
|
+
const epic = parseEpic(dir, filePath, content);
|
|
27144
|
+
if (!epic) throw new DeliveryPlanningWriteError("Failed to parse the Epic just written.");
|
|
27145
|
+
return epic;
|
|
27146
|
+
}
|
|
27147
|
+
function associateInitiativeWithEpic(dir, initiativeId, epicId) {
|
|
27148
|
+
const ini = getInitiative(dir, initiativeId);
|
|
27149
|
+
if (!ini) throw new DeliveryPlanningWriteError(`Initiative ${initiativeId} not found.`);
|
|
27150
|
+
if (!getEpic(dir, epicId)) throw new DeliveryPlanningWriteError(`Epic ${epicId} does not exist.`);
|
|
27151
|
+
return updateInitiative(dir, ini.id, { epic: epicId });
|
|
27152
|
+
}
|
|
27153
|
+
|
|
27154
|
+
// src/commands/plan.ts
|
|
27155
|
+
function requireInit(dir) {
|
|
27156
|
+
if (!loadConfig(dir)) {
|
|
27157
|
+
log.error("Kaddo is not initialized. Run `kaddo init` first.");
|
|
27158
|
+
process.exit(1);
|
|
27159
|
+
}
|
|
27160
|
+
}
|
|
27161
|
+
function planFindings(dir, subjectPrefix) {
|
|
27162
|
+
const findings = validatePlanningGraph(dir).filter((f) => f.subject.toLowerCase().startsWith(subjectPrefix.toLowerCase()));
|
|
27163
|
+
for (const f of findings) log.warn(` [${f.level}] ${f.message}`);
|
|
27164
|
+
}
|
|
27165
|
+
function runPlanList() {
|
|
27166
|
+
const dir = cwd();
|
|
27167
|
+
requireInit(dir);
|
|
27168
|
+
intro("kaddo plan list");
|
|
27169
|
+
const plans = discoverDeliveryPlans(dir);
|
|
27170
|
+
if (plans.length === 0) {
|
|
27171
|
+
log.info("No delivery plans yet. Create one with `kaddo plan create`.");
|
|
27172
|
+
outro("Nothing to show.");
|
|
27173
|
+
return;
|
|
27174
|
+
}
|
|
27175
|
+
for (const p of plans) {
|
|
27176
|
+
const prog = computePlanProgress(dir, p);
|
|
27177
|
+
log.info(`${p.id} \u2014 ${p.title} [${p.status}] epics ${prog.epics.total} \xB7 delivery ${prog.delivery.completed}/${prog.delivery.total} completed \xB7 milestones ${p.milestones.length}`);
|
|
27178
|
+
}
|
|
27179
|
+
outro(`${plans.length} plan(s).`);
|
|
27180
|
+
}
|
|
27181
|
+
function runPlanShow(id) {
|
|
27182
|
+
const dir = cwd();
|
|
27183
|
+
requireInit(dir);
|
|
27184
|
+
intro(`kaddo plan show ${id}`);
|
|
27185
|
+
const plan = getPlan(dir, id);
|
|
27186
|
+
if (!plan) {
|
|
27187
|
+
log.error(`Plan ${id} not found.`);
|
|
27188
|
+
process.exit(1);
|
|
27189
|
+
}
|
|
27190
|
+
log.info(` ${plan.id} \u2014 ${plan.title}`);
|
|
27191
|
+
log.info(` Status: ${plan.status}`);
|
|
27192
|
+
if (plan.objective) log.info(` Objective: ${plan.objective}`);
|
|
27193
|
+
log.info(` Milestones: ${plan.milestones.length}`);
|
|
27194
|
+
for (const m of plan.milestones) log.info(` - ${m.id}: ${m.title}${m.exitCriteria.length ? ` (${m.exitCriteria.length} exit criteria)` : ""}`);
|
|
27195
|
+
const epics = epicsInPlan(dir, plan.id);
|
|
27196
|
+
log.info(` Epics: ${epics.length}`);
|
|
27197
|
+
for (const e of epics) log.info(` - ${e.id}: ${e.title} [${e.status}]${e.milestone ? ` \xB7 ${e.milestone}` : ""}`);
|
|
27198
|
+
if (plan.dependsOn.length) log.info(` Depends on: ${plan.dependsOn.join(", ")}`);
|
|
27199
|
+
planFindings(dir, "PLAN");
|
|
27200
|
+
outro(`Plan ${plan.id}.`);
|
|
27201
|
+
}
|
|
27202
|
+
function runPlanProgress(id) {
|
|
27203
|
+
const dir = cwd();
|
|
27204
|
+
requireInit(dir);
|
|
27205
|
+
intro(`kaddo plan progress ${id}`);
|
|
27206
|
+
const plan = getPlan(dir, id);
|
|
27207
|
+
if (!plan) {
|
|
27208
|
+
log.error(`Plan ${id} not found.`);
|
|
27209
|
+
process.exit(1);
|
|
27210
|
+
}
|
|
27211
|
+
const p = computePlanProgress(dir, plan);
|
|
27212
|
+
log.info(` Status: ${p.status}`);
|
|
27213
|
+
log.info("");
|
|
27214
|
+
log.info(` Planning coverage: ${p.planning.initiatives} initiative(s) \xB7 ${p.planning.materialized}/${p.planning.candidates} candidates materialized`);
|
|
27215
|
+
log.info(` Delivery progress: ${p.delivery.completed}/${p.delivery.total} Work Items completed \xB7 ${p.delivery.blocked} blocked`);
|
|
27216
|
+
for (const [state, n] of Object.entries(p.delivery.byState)) if (n > 0) log.info(` ${state}: ${n}`);
|
|
27217
|
+
log.info("");
|
|
27218
|
+
log.info(` Completion readiness: criteria ${p.readiness.successCriteria} \xB7 preconditions met: ${p.readiness.meetsCompletionPreconditions ? "yes" : "no"} \xB7 human approval required: yes`);
|
|
27219
|
+
if (p.readiness.blockingDependencies.length) log.warn(` Blocking dependencies: ${p.readiness.blockingDependencies.join(", ")}`);
|
|
27220
|
+
outro(`Progress for ${plan.id}.`);
|
|
27221
|
+
}
|
|
27222
|
+
async function runPlanCreate() {
|
|
27223
|
+
const dir = cwd();
|
|
27224
|
+
requireInit(dir);
|
|
27225
|
+
intro("kaddo plan create");
|
|
27226
|
+
const title = await text({ message: "Plan title", placeholder: "Technical Roadmap" });
|
|
27227
|
+
if (typeof title !== "string" || !title.trim()) {
|
|
27228
|
+
cancel("Cancelled.");
|
|
27229
|
+
return;
|
|
27230
|
+
}
|
|
27231
|
+
const ok = await confirm({ message: `Create delivery plan "${title.trim()}"?` });
|
|
27232
|
+
if (ok !== true) {
|
|
27233
|
+
cancel("Cancelled.");
|
|
27234
|
+
return;
|
|
27235
|
+
}
|
|
27236
|
+
try {
|
|
27237
|
+
const plan = createDeliveryPlan(dir, { title });
|
|
27238
|
+
log.success(`Created ${plan.id} \u2014 ${plan.title}.`);
|
|
27239
|
+
outro(`Edit ${plan.relPath} to add milestones, dependencies and success criteria.`);
|
|
27240
|
+
} catch (err) {
|
|
27241
|
+
log.error(err instanceof DeliveryPlanningWriteError ? err.message : String(err));
|
|
27242
|
+
process.exit(1);
|
|
27243
|
+
}
|
|
27244
|
+
}
|
|
27245
|
+
function runEpicList() {
|
|
27246
|
+
const dir = cwd();
|
|
27247
|
+
requireInit(dir);
|
|
27248
|
+
intro("kaddo epic list");
|
|
27249
|
+
const epics = discoverEpics(dir);
|
|
27250
|
+
if (epics.length === 0) {
|
|
27251
|
+
log.info("No epics yet. Create one with `kaddo epic create`.");
|
|
27252
|
+
outro("Nothing to show.");
|
|
27253
|
+
return;
|
|
27254
|
+
}
|
|
27255
|
+
for (const e of epics) {
|
|
27256
|
+
const prog = computeEpicProgress(dir, e);
|
|
27257
|
+
log.info(`${e.id} \u2014 ${e.title} [${e.status}] ${e.plan ? `${e.plan}${e.milestone ? `/${e.milestone}` : ""} \xB7 ` : ""}delivery ${prog.delivery.completed}/${prog.delivery.total} completed`);
|
|
27258
|
+
}
|
|
27259
|
+
outro(`${epics.length} epic(s).`);
|
|
27260
|
+
}
|
|
27261
|
+
function runEpicShow(id) {
|
|
27262
|
+
const dir = cwd();
|
|
27263
|
+
requireInit(dir);
|
|
27264
|
+
intro(`kaddo epic show ${id}`);
|
|
27265
|
+
const epic = getEpic(dir, id);
|
|
27266
|
+
if (!epic) {
|
|
27267
|
+
log.error(`Epic ${id} not found.`);
|
|
27268
|
+
process.exit(1);
|
|
27269
|
+
}
|
|
27270
|
+
log.info(` ${epic.id} \u2014 ${epic.title}`);
|
|
27271
|
+
log.info(` Status: ${epic.status}`);
|
|
27272
|
+
if (epic.outcome) log.info(` Outcome: ${epic.outcome}`);
|
|
27273
|
+
if (epic.plan) log.info(` Plan: ${epic.plan}${epic.milestone ? ` \xB7 milestone ${epic.milestone}` : ""}`);
|
|
27274
|
+
if (epic.relatedCapabilities.length) log.info(` Capabilities: ${epic.relatedCapabilities.join(", ")}`);
|
|
27275
|
+
if (epic.dependsOn.length) log.info(` Depends on: ${epic.dependsOn.join(", ")}`);
|
|
27276
|
+
const inis = initiativesInEpic(dir, epic.id);
|
|
27277
|
+
log.info(` Initiatives: ${inis.length}`);
|
|
27278
|
+
for (const i of inis) log.info(` - ${i.id}: ${i.title} [${i.status}]${i.owners.length ? ` \xB7 owners ${i.owners.join(", ")}` : ""}`);
|
|
27279
|
+
planFindings(dir, epic.id);
|
|
27280
|
+
outro(`Epic ${epic.id}.`);
|
|
27281
|
+
}
|
|
27282
|
+
function runEpicProgress(id) {
|
|
27283
|
+
const dir = cwd();
|
|
27284
|
+
requireInit(dir);
|
|
27285
|
+
intro(`kaddo epic progress ${id}`);
|
|
27286
|
+
const epic = getEpic(dir, id);
|
|
27287
|
+
if (!epic) {
|
|
27288
|
+
log.error(`Epic ${id} not found.`);
|
|
27289
|
+
process.exit(1);
|
|
27290
|
+
}
|
|
27291
|
+
const p = computeEpicProgress(dir, epic);
|
|
27292
|
+
log.info(` Status: ${p.status}`);
|
|
27293
|
+
log.info("");
|
|
27294
|
+
log.info(` Planning coverage: ${p.planning.initiatives} initiative(s) \xB7 ${p.planning.materialized}/${p.planning.candidates} candidates materialized`);
|
|
27295
|
+
log.info(` Delivery progress: ${p.delivery.completed}/${p.delivery.total} Work Items completed \xB7 ${p.delivery.blocked} blocked`);
|
|
27296
|
+
for (const [state, n] of Object.entries(p.delivery.byState)) if (n > 0) log.info(` ${state}: ${n}`);
|
|
27297
|
+
log.info("");
|
|
27298
|
+
log.info(` Completion readiness: criteria ${p.readiness.successCriteria} \xB7 preconditions met: ${p.readiness.meetsCompletionPreconditions ? "yes" : "no"} \xB7 human approval required: yes`);
|
|
27299
|
+
if (p.readiness.blockingDependencies.length) log.warn(` Blocking dependencies: ${p.readiness.blockingDependencies.join(", ")}`);
|
|
27300
|
+
outro(`Progress for ${epic.id}.`);
|
|
27301
|
+
}
|
|
27302
|
+
async function runEpicCreate() {
|
|
27303
|
+
const dir = cwd();
|
|
27304
|
+
requireInit(dir);
|
|
27305
|
+
intro("kaddo epic create");
|
|
27306
|
+
const title = await text({ message: "Epic title", placeholder: "Runtime Performance & Concurrency" });
|
|
27307
|
+
if (typeof title !== "string" || !title.trim()) {
|
|
27308
|
+
cancel("Cancelled.");
|
|
27309
|
+
return;
|
|
27310
|
+
}
|
|
27311
|
+
const plan = await text({ message: "Related plan id (optional, Enter to skip)", placeholder: "PLAN-001" });
|
|
27312
|
+
const planId = typeof plan === "string" && plan.trim() ? plan.trim() : void 0;
|
|
27313
|
+
const ok = await confirm({ message: `Create epic "${title.trim()}"${planId ? ` in ${planId}` : ""}?` });
|
|
27314
|
+
if (ok !== true) {
|
|
27315
|
+
cancel("Cancelled.");
|
|
27316
|
+
return;
|
|
27317
|
+
}
|
|
27318
|
+
try {
|
|
27319
|
+
const epic = createEpic(dir, { title, plan: planId });
|
|
27320
|
+
log.success(`Created ${epic.id} \u2014 ${epic.title}.`);
|
|
27321
|
+
outro(`Edit ${epic.relPath} to add the expected outcome, success criteria and dependencies.`);
|
|
27322
|
+
} catch (err) {
|
|
27323
|
+
log.error(err instanceof DeliveryPlanningWriteError ? err.message : String(err));
|
|
27324
|
+
process.exit(1);
|
|
27325
|
+
}
|
|
27326
|
+
}
|
|
27327
|
+
async function runEpicAssociate(epicId, initiativeId) {
|
|
27328
|
+
const dir = cwd();
|
|
27329
|
+
requireInit(dir);
|
|
27330
|
+
intro(`kaddo epic associate ${epicId} ${initiativeId}`);
|
|
27331
|
+
const ok = await confirm({ message: `Associate Initiative ${initiativeId} with Epic ${epicId}?` });
|
|
27332
|
+
if (ok !== true) {
|
|
27333
|
+
cancel("Cancelled.");
|
|
27334
|
+
return;
|
|
27335
|
+
}
|
|
27336
|
+
try {
|
|
27337
|
+
const ini = associateInitiativeWithEpic(dir, initiativeId, epicId);
|
|
27338
|
+
log.success(`${ini.id} is now part of ${epicId}.`);
|
|
27339
|
+
outro("Association recorded on the Initiative.");
|
|
27340
|
+
} catch (err) {
|
|
27341
|
+
log.error(err instanceof DeliveryPlanningWriteError ? err.message : String(err));
|
|
27342
|
+
process.exit(1);
|
|
27343
|
+
}
|
|
27344
|
+
}
|
|
27345
|
+
|
|
27346
|
+
// src/core/telemetry.ts
|
|
27347
|
+
import crypto6 from "crypto";
|
|
27348
|
+
|
|
27349
|
+
// src/core/telemetry-identity.ts
|
|
27350
|
+
import crypto4 from "crypto";
|
|
27351
|
+
var TELEMETRY_DIR = ".kaddo/telemetry";
|
|
27352
|
+
var IDENTITY_FILE = "identity.json";
|
|
27353
|
+
function identityPath(dir) {
|
|
27354
|
+
return join(dir, TELEMETRY_DIR, IDENTITY_FILE);
|
|
27355
|
+
}
|
|
27356
|
+
function loadIdentity(dir) {
|
|
27357
|
+
const p = identityPath(dir);
|
|
27358
|
+
if (!exists(p)) return null;
|
|
27359
|
+
try {
|
|
27360
|
+
return JSON.parse(readFile(p));
|
|
27361
|
+
} catch {
|
|
27362
|
+
return null;
|
|
27363
|
+
}
|
|
27364
|
+
}
|
|
27365
|
+
function ensureIdentity(dir) {
|
|
27366
|
+
const existing = loadIdentity(dir);
|
|
27367
|
+
if (existing) return existing;
|
|
27368
|
+
const installationId = crypto4.randomUUID();
|
|
27369
|
+
const { publicKey, privateKey } = crypto4.generateKeyPairSync("ed25519");
|
|
27370
|
+
const pubSpki = publicKey.export({ type: "spki", format: "der" });
|
|
27371
|
+
const privPkcs8 = privateKey.export({ type: "pkcs8", format: "der" });
|
|
27372
|
+
const identity = {
|
|
27373
|
+
installationId,
|
|
27374
|
+
publicKey: pubSpki.toString("base64url"),
|
|
27375
|
+
privateKey: privPkcs8.toString("base64url"),
|
|
27376
|
+
keyAlgorithm: "Ed25519",
|
|
27377
|
+
registrationVersion: "1.0",
|
|
27378
|
+
registered: false
|
|
27379
|
+
};
|
|
27380
|
+
ensureDir(join(dir, TELEMETRY_DIR));
|
|
27381
|
+
writeFile(identityPath(dir), JSON.stringify(identity, null, 2));
|
|
27382
|
+
return identity;
|
|
27383
|
+
}
|
|
27384
|
+
function markRegistered(dir, identity) {
|
|
27385
|
+
identity.registered = true;
|
|
27386
|
+
ensureDir(join(dir, TELEMETRY_DIR));
|
|
27387
|
+
writeFile(identityPath(dir), JSON.stringify(identity, null, 2));
|
|
27388
|
+
}
|
|
27389
|
+
function signPayload(identity, method, path16, timestamp, nonce, bodySha256) {
|
|
27390
|
+
const canonical = `${method}
|
|
27391
|
+
${path16}
|
|
27392
|
+
${identity.installationId}
|
|
27393
|
+
${timestamp}
|
|
27394
|
+
${nonce}
|
|
27395
|
+
${bodySha256}`;
|
|
27396
|
+
const privKeyDer = Buffer.from(identity.privateKey, "base64url");
|
|
27397
|
+
const privKey = crypto4.createPrivateKey({ key: privKeyDer, format: "der", type: "pkcs8" });
|
|
27398
|
+
const sig2 = crypto4.sign(null, Buffer.from(canonical), privKey);
|
|
27399
|
+
return sig2.toString("base64url");
|
|
27400
|
+
}
|
|
27401
|
+
|
|
27402
|
+
// src/core/telemetry-events.ts
|
|
27403
|
+
import crypto5 from "crypto";
|
|
27404
|
+
function createEvent(name, installationId, source2, properties) {
|
|
27405
|
+
return {
|
|
27406
|
+
schemaVersion: "1.0",
|
|
27407
|
+
id: crypto5.randomUUID(),
|
|
27408
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
27409
|
+
event: name,
|
|
27410
|
+
installationId,
|
|
27411
|
+
source: source2,
|
|
26570
27412
|
properties
|
|
26571
27413
|
};
|
|
26572
27414
|
}
|
|
@@ -26771,245 +27613,6 @@ function runTelemetryDisable() {
|
|
|
26771
27613
|
outro("Run `kaddo telemetry enable` to re-enable.");
|
|
26772
27614
|
}
|
|
26773
27615
|
|
|
26774
|
-
// src/core/initiative-write.ts
|
|
26775
|
-
import matter27 from "gray-matter";
|
|
26776
|
-
var WORK_ITEMS_DIR4 = "knowledge/delivery/work-items";
|
|
26777
|
-
var DRAFT_DIR2 = `${WORK_ITEMS_DIR4}/draft`;
|
|
26778
|
-
var InitiativeWriteError = class extends Error {
|
|
26779
|
-
constructor(message) {
|
|
26780
|
-
super(message);
|
|
26781
|
-
this.name = "InitiativeWriteError";
|
|
26782
|
-
}
|
|
26783
|
-
};
|
|
26784
|
-
function slugify7(s) {
|
|
26785
|
-
return s.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, "").slice(0, 50);
|
|
26786
|
-
}
|
|
26787
|
-
function today2() {
|
|
26788
|
-
return (/* @__PURE__ */ new Date()).toISOString().slice(0, 10);
|
|
26789
|
-
}
|
|
26790
|
-
function candidateToData(c) {
|
|
26791
|
-
const out = { id: c.id, title: c.title };
|
|
26792
|
-
if (c.type) out.type = c.type;
|
|
26793
|
-
if (c.suggestedKnowledgeLevel) out.suggested_knowledge_level = c.suggestedKnowledgeLevel;
|
|
26794
|
-
if (c.expectedValue) out.expected_value = c.expectedValue;
|
|
26795
|
-
if (c.notes) out.notes = c.notes;
|
|
26796
|
-
if (c.sourceSignals.length) out.source_signals = c.sourceSignals;
|
|
26797
|
-
if (c.dependencies.length) out.dependencies = c.dependencies;
|
|
26798
|
-
if (c.materializedAs) out.materialized_as = c.materializedAs;
|
|
26799
|
-
return out;
|
|
26800
|
-
}
|
|
26801
|
-
function externalLinkToData(l) {
|
|
26802
|
-
const out = { integration: l.integration, external_id: l.externalId };
|
|
26803
|
-
if (l.externalType) out.external_type = l.externalType;
|
|
26804
|
-
if (l.url) out.url = l.url;
|
|
26805
|
-
if (l.externalStatus) out.external_status = l.externalStatus;
|
|
26806
|
-
return out;
|
|
26807
|
-
}
|
|
26808
|
-
function normalizeCandidate(input, fallbackId) {
|
|
26809
|
-
return {
|
|
26810
|
-
id: input.id?.trim() || fallbackId,
|
|
26811
|
-
title: input.title.trim(),
|
|
26812
|
-
type: input.type?.trim() || void 0,
|
|
26813
|
-
suggestedKnowledgeLevel: input.suggestedKnowledgeLevel?.trim() || void 0,
|
|
26814
|
-
expectedValue: input.expectedValue?.trim() || void 0,
|
|
26815
|
-
notes: input.notes?.trim() || void 0,
|
|
26816
|
-
sourceSignals: input.sourceSignals ?? [],
|
|
26817
|
-
dependencies: input.dependencies ?? [],
|
|
26818
|
-
materializedAs: input.materializedAs ?? null
|
|
26819
|
-
};
|
|
26820
|
-
}
|
|
26821
|
-
function defaultBody(title) {
|
|
26822
|
-
return [
|
|
26823
|
-
`# ${title}`,
|
|
26824
|
-
"",
|
|
26825
|
-
"## Goal",
|
|
26826
|
-
"",
|
|
26827
|
-
"_What outcome does this Initiative pursue?_",
|
|
26828
|
-
"",
|
|
26829
|
-
"## Expected Value",
|
|
26830
|
-
"",
|
|
26831
|
-
"_Why it matters._",
|
|
26832
|
-
"",
|
|
26833
|
-
"## Scope",
|
|
26834
|
-
"",
|
|
26835
|
-
"_What this Initiative covers._",
|
|
26836
|
-
"",
|
|
26837
|
-
"## Out of Scope",
|
|
26838
|
-
"",
|
|
26839
|
-
"_What it explicitly does not cover._",
|
|
26840
|
-
"",
|
|
26841
|
-
"## Success Criteria",
|
|
26842
|
-
"",
|
|
26843
|
-
'_Observable outcomes that define completion (not just "all Work Items done")._',
|
|
26844
|
-
"",
|
|
26845
|
-
"## Dependencies",
|
|
26846
|
-
"",
|
|
26847
|
-
"_Other Initiatives, modules, or external work this depends on._",
|
|
26848
|
-
"",
|
|
26849
|
-
"## Work Item Candidates",
|
|
26850
|
-
"",
|
|
26851
|
-
"_Candidates live in frontmatter `candidates`; summarize them here as they evolve._",
|
|
26852
|
-
"",
|
|
26853
|
-
"## Open Questions",
|
|
26854
|
-
"",
|
|
26855
|
-
"_Unresolved questions for this Initiative._",
|
|
26856
|
-
"",
|
|
26857
|
-
"## Learning",
|
|
26858
|
-
"",
|
|
26859
|
-
"_Captured on completion: what was delivered, what stayed out of scope, outcome reached._",
|
|
26860
|
-
""
|
|
26861
|
-
].join("\n");
|
|
26862
|
-
}
|
|
26863
|
-
function buildInitiativeContent(id, input) {
|
|
26864
|
-
const status = input.status ?? "planned";
|
|
26865
|
-
if (!isValidInitiativeStatus(status)) {
|
|
26866
|
-
throw new InitiativeWriteError(`Invalid initiative status: ${status}.`);
|
|
26867
|
-
}
|
|
26868
|
-
const candidates = (input.candidates ?? []).map(
|
|
26869
|
-
(c, i) => normalizeCandidate(c, `WI-CANDIDATE-${String(i + 1).padStart(3, "0")}`)
|
|
26870
|
-
);
|
|
26871
|
-
const data = {
|
|
26872
|
-
type: "initiative",
|
|
26873
|
-
id,
|
|
26874
|
-
title: input.title.trim(),
|
|
26875
|
-
status,
|
|
26876
|
-
knowledge_level: input.knowledgeLevel ?? "K2",
|
|
26877
|
-
domains: input.domains ?? [],
|
|
26878
|
-
related_capabilities: input.relatedCapabilities ?? [],
|
|
26879
|
-
created_at: today2(),
|
|
26880
|
-
external_links: (input.externalLinks ?? []).map(externalLinkToData),
|
|
26881
|
-
candidates: candidates.map(candidateToData)
|
|
26882
|
-
};
|
|
26883
|
-
if (input.horizon) data.horizon = input.horizon;
|
|
26884
|
-
if (input.priority) data.priority = input.priority;
|
|
26885
|
-
if (input.source) data.source = input.source;
|
|
26886
|
-
if (input.sourceId) data.source_id = input.sourceId;
|
|
26887
|
-
return matter27.stringify("\n" + (input.body ?? defaultBody(input.title.trim())), data);
|
|
26888
|
-
}
|
|
26889
|
-
function createInitiative(dir, input) {
|
|
26890
|
-
if (!input.title?.trim()) throw new InitiativeWriteError("Initiative title is required.");
|
|
26891
|
-
const id = nextInitiativeId(dir);
|
|
26892
|
-
const fileName = `${id}-${slugify7(input.title)}.md`;
|
|
26893
|
-
const iniDir = join(dir, INITIATIVES_DIR);
|
|
26894
|
-
ensureDir(iniDir);
|
|
26895
|
-
const filePath = join(iniDir, fileName);
|
|
26896
|
-
const content = buildInitiativeContent(id, input);
|
|
26897
|
-
writeFile(filePath, content);
|
|
26898
|
-
const ini = parseInitiative(dir, filePath, content);
|
|
26899
|
-
if (!ini) throw new InitiativeWriteError("Failed to parse the Initiative just written.");
|
|
26900
|
-
return ini;
|
|
26901
|
-
}
|
|
26902
|
-
function transitionInitiative(dir, id, to) {
|
|
26903
|
-
const ini = getInitiative(dir, id);
|
|
26904
|
-
if (!ini) throw new InitiativeWriteError(`Initiative ${id} not found.`);
|
|
26905
|
-
if (!isValidInitiativeStatus(to)) throw new InitiativeWriteError(`Invalid status: ${to}.`);
|
|
26906
|
-
if (ini.status === to) return ini;
|
|
26907
|
-
if (!isValidInitiativeTransition(ini.status, to)) {
|
|
26908
|
-
throw new InitiativeWriteError(`Invalid transition ${ini.status} \u2192 ${to}.`);
|
|
26909
|
-
}
|
|
26910
|
-
const raw = readFile(ini.filePath);
|
|
26911
|
-
const { data, content } = matter27(raw, {});
|
|
26912
|
-
data.status = to;
|
|
26913
|
-
if (to === "completed") data.completed_at = today2();
|
|
26914
|
-
const newContent = matter27.stringify(content, data);
|
|
26915
|
-
writeFile(ini.filePath, newContent);
|
|
26916
|
-
const updated = parseInitiative(dir, ini.filePath, newContent);
|
|
26917
|
-
if (!updated) throw new InitiativeWriteError("Failed to parse the Initiative after transition.");
|
|
26918
|
-
return updated;
|
|
26919
|
-
}
|
|
26920
|
-
function nextWorkItemId3(dir) {
|
|
26921
|
-
const wiDir = join(dir, WORK_ITEMS_DIR4);
|
|
26922
|
-
let max = 0;
|
|
26923
|
-
const walk2 = (d) => {
|
|
26924
|
-
if (!exists(d)) return;
|
|
26925
|
-
for (const entry of readDir(d)) {
|
|
26926
|
-
const full = join(d, entry);
|
|
26927
|
-
if (isFile(full)) {
|
|
26928
|
-
const m = entry.match(/WI-(\d+)/);
|
|
26929
|
-
if (m) max = Math.max(max, parseInt(m[1], 10));
|
|
26930
|
-
} else if (!entry.startsWith(".")) {
|
|
26931
|
-
walk2(full);
|
|
26932
|
-
}
|
|
26933
|
-
}
|
|
26934
|
-
};
|
|
26935
|
-
walk2(wiDir);
|
|
26936
|
-
return `WI-${String(max + 1).padStart(3, "0")}`;
|
|
26937
|
-
}
|
|
26938
|
-
function buildWorkItemContent(wiId, iniId, candidate) {
|
|
26939
|
-
const data = {
|
|
26940
|
-
type: candidate.type ?? "feature",
|
|
26941
|
-
id: wiId,
|
|
26942
|
-
title: candidate.title,
|
|
26943
|
-
knowledge_level: candidate.suggestedKnowledgeLevel ?? "K2",
|
|
26944
|
-
status: "draft",
|
|
26945
|
-
phase: "now",
|
|
26946
|
-
initiative: iniId,
|
|
26947
|
-
domains: [],
|
|
26948
|
-
code: [],
|
|
26949
|
-
created_at: today2(),
|
|
26950
|
-
source: "initiative",
|
|
26951
|
-
source_id: candidate.id,
|
|
26952
|
-
source_initiative: iniId,
|
|
26953
|
-
affected_modules: []
|
|
26954
|
-
};
|
|
26955
|
-
if (candidate.sourceSignals.length) data.source_signals = candidate.sourceSignals;
|
|
26956
|
-
if (candidate.dependencies.length) data.dependencies = candidate.dependencies;
|
|
26957
|
-
const body = [
|
|
26958
|
-
`# ${candidate.title}`,
|
|
26959
|
-
"",
|
|
26960
|
-
`> Materialized from Initiative ${iniId}, candidate ${candidate.id}.`,
|
|
26961
|
-
"",
|
|
26962
|
-
"## Problem",
|
|
26963
|
-
"",
|
|
26964
|
-
candidate.expectedValue ? `_Expected value:_ ${candidate.expectedValue}` : "_Describe the problem._",
|
|
26965
|
-
"",
|
|
26966
|
-
"## Acceptance Criteria",
|
|
26967
|
-
"",
|
|
26968
|
-
"- [ ] _Define at least one testable criterion._",
|
|
26969
|
-
"",
|
|
26970
|
-
"## Out of scope",
|
|
26971
|
-
"",
|
|
26972
|
-
"_Not included in this Work Item._",
|
|
26973
|
-
"",
|
|
26974
|
-
"## Validation",
|
|
26975
|
-
"",
|
|
26976
|
-
"_How will this be validated?_",
|
|
26977
|
-
"",
|
|
26978
|
-
"## Learning",
|
|
26979
|
-
"",
|
|
26980
|
-
"_What did we learn? Update after completion._",
|
|
26981
|
-
""
|
|
26982
|
-
].join("\n");
|
|
26983
|
-
return matter27.stringify("\n" + body, data);
|
|
26984
|
-
}
|
|
26985
|
-
function materializeCandidate(dir, id, candidateId) {
|
|
26986
|
-
const ini = getInitiative(dir, id);
|
|
26987
|
-
if (!ini) throw new InitiativeWriteError(`Initiative ${id} not found.`);
|
|
26988
|
-
const candidate = ini.candidates.find((c) => c.id === candidateId);
|
|
26989
|
-
if (!candidate) throw new InitiativeWriteError(`Candidate ${candidateId} not found in ${id}.`);
|
|
26990
|
-
if (candidate.materializedAs) {
|
|
26991
|
-
throw new InitiativeWriteError(
|
|
26992
|
-
`Candidate ${candidateId} is already materialized as ${candidate.materializedAs}.`
|
|
26993
|
-
);
|
|
26994
|
-
}
|
|
26995
|
-
const wiId = nextWorkItemId3(dir);
|
|
26996
|
-
const fileName = `${wiId}-${slugify7(candidate.title)}.md`;
|
|
26997
|
-
ensureDir(join(dir, DRAFT_DIR2));
|
|
26998
|
-
writeFile(join(dir, DRAFT_DIR2, fileName), buildWorkItemContent(wiId, ini.id, candidate));
|
|
26999
|
-
const raw = readFile(ini.filePath);
|
|
27000
|
-
const { data, content } = matter27(raw, {});
|
|
27001
|
-
const cands = Array.isArray(data.candidates) ? data.candidates : [];
|
|
27002
|
-
for (const c of cands) {
|
|
27003
|
-
if (c && typeof c === "object" && String(c.id) === candidateId) c.materialized_as = wiId;
|
|
27004
|
-
}
|
|
27005
|
-
data.candidates = cands;
|
|
27006
|
-
const newContent = matter27.stringify(content, data);
|
|
27007
|
-
writeFile(ini.filePath, newContent);
|
|
27008
|
-
const updated = parseInitiative(dir, ini.filePath, newContent);
|
|
27009
|
-
if (!updated) throw new InitiativeWriteError("Failed to parse the Initiative after materialization.");
|
|
27010
|
-
return { workItemId: wiId, fileName, initiative: updated };
|
|
27011
|
-
}
|
|
27012
|
-
|
|
27013
27616
|
// src/core/initiative-analysis.ts
|
|
27014
27617
|
var SUCCESS_HEADING_RE = /^#{1,6}\s*(success criteria|criterios de[ét]xito|criterios de éxito)\s*$/i;
|
|
27015
27618
|
var HEADING_RE2 = /^#{1,6}\s+/;
|
|
@@ -27117,7 +27720,7 @@ function evaluateInitiativeCompletion(dir, ini) {
|
|
|
27117
27720
|
}
|
|
27118
27721
|
|
|
27119
27722
|
// src/commands/initiative.ts
|
|
27120
|
-
function
|
|
27723
|
+
function requireInit2(dir) {
|
|
27121
27724
|
if (!loadConfig(dir)) {
|
|
27122
27725
|
log.error("Kaddo is not initialized. Run `kaddo init` first.");
|
|
27123
27726
|
process.exit(1);
|
|
@@ -27125,7 +27728,7 @@ function requireInit(dir) {
|
|
|
27125
27728
|
}
|
|
27126
27729
|
function runInitiativeList() {
|
|
27127
27730
|
const dir = cwd();
|
|
27128
|
-
|
|
27731
|
+
requireInit2(dir);
|
|
27129
27732
|
intro("kaddo initiative list");
|
|
27130
27733
|
const all = discoverInitiatives(dir);
|
|
27131
27734
|
if (all.length === 0) {
|
|
@@ -27143,7 +27746,7 @@ function runInitiativeList() {
|
|
|
27143
27746
|
}
|
|
27144
27747
|
function runInitiativeShow(id) {
|
|
27145
27748
|
const dir = cwd();
|
|
27146
|
-
|
|
27749
|
+
requireInit2(dir);
|
|
27147
27750
|
intro(`kaddo initiative show ${id}`);
|
|
27148
27751
|
const ini = getInitiative(dir, id);
|
|
27149
27752
|
if (!ini) {
|
|
@@ -27165,7 +27768,7 @@ function runInitiativeShow(id) {
|
|
|
27165
27768
|
}
|
|
27166
27769
|
function runInitiativeProgress(id) {
|
|
27167
27770
|
const dir = cwd();
|
|
27168
|
-
|
|
27771
|
+
requireInit2(dir);
|
|
27169
27772
|
intro(`kaddo initiative progress ${id}`);
|
|
27170
27773
|
const ini = getInitiative(dir, id);
|
|
27171
27774
|
if (!ini) {
|
|
@@ -27185,7 +27788,7 @@ function runInitiativeProgress(id) {
|
|
|
27185
27788
|
}
|
|
27186
27789
|
function runInitiativeCandidates(id) {
|
|
27187
27790
|
const dir = cwd();
|
|
27188
|
-
|
|
27791
|
+
requireInit2(dir);
|
|
27189
27792
|
intro(`kaddo initiative candidates ${id}`);
|
|
27190
27793
|
const ini = getInitiative(dir, id);
|
|
27191
27794
|
if (!ini) {
|
|
@@ -27205,7 +27808,7 @@ function runInitiativeCandidates(id) {
|
|
|
27205
27808
|
}
|
|
27206
27809
|
async function runInitiativeCreate(opts) {
|
|
27207
27810
|
const dir = cwd();
|
|
27208
|
-
|
|
27811
|
+
requireInit2(dir);
|
|
27209
27812
|
intro("kaddo initiative create");
|
|
27210
27813
|
const title = opts.title?.trim() || (await text({
|
|
27211
27814
|
message: "Initiative title",
|
|
@@ -27223,7 +27826,7 @@ async function runInitiativeCreate(opts) {
|
|
|
27223
27826
|
}
|
|
27224
27827
|
async function runInitiativeUpdate(id, opts) {
|
|
27225
27828
|
const dir = cwd();
|
|
27226
|
-
|
|
27829
|
+
requireInit2(dir);
|
|
27227
27830
|
intro(`kaddo initiative update ${id}`);
|
|
27228
27831
|
const ini = getInitiative(dir, id);
|
|
27229
27832
|
if (!ini) {
|
|
@@ -27251,7 +27854,7 @@ async function runInitiativeUpdate(id, opts) {
|
|
|
27251
27854
|
}
|
|
27252
27855
|
function runInitiativeAnalyze(id) {
|
|
27253
27856
|
const dir = cwd();
|
|
27254
|
-
|
|
27857
|
+
requireInit2(dir);
|
|
27255
27858
|
intro(`kaddo initiative analyze ${id}`);
|
|
27256
27859
|
const ini = getInitiative(dir, id);
|
|
27257
27860
|
if (!ini) {
|
|
@@ -27283,7 +27886,7 @@ function runInitiativeAnalyze(id) {
|
|
|
27283
27886
|
}
|
|
27284
27887
|
async function runInitiativeComplete(id, opts = {}) {
|
|
27285
27888
|
const dir = cwd();
|
|
27286
|
-
|
|
27889
|
+
requireInit2(dir);
|
|
27287
27890
|
intro(`kaddo initiative complete ${id}`);
|
|
27288
27891
|
const ini = getInitiative(dir, id);
|
|
27289
27892
|
if (!ini) {
|
|
@@ -27319,7 +27922,7 @@ async function runInitiativeComplete(id, opts = {}) {
|
|
|
27319
27922
|
}
|
|
27320
27923
|
function runInitiativeMaterialize(id, candidateId) {
|
|
27321
27924
|
const dir = cwd();
|
|
27322
|
-
|
|
27925
|
+
requireInit2(dir);
|
|
27323
27926
|
intro(`kaddo initiative materialize ${id} ${candidateId}`);
|
|
27324
27927
|
try {
|
|
27325
27928
|
const result = materializeCandidate(dir, id, candidateId);
|
|
@@ -27376,6 +27979,23 @@ var knowledgeCmd = program.command("knowledge").description("Operate on the cano
|
|
|
27376
27979
|
knowledgeCmd.command("consolidate").description("Analyze canonical knowledge and write a reviewable Consolidation Plan to .kaddo/ (no changes to knowledge/)").option("--layer <layer>", "Limit the analysis to one layer: business, product, tech, delivery").option("--module <id>", "Limit the analysis to artifacts affecting one mapped module").option("--scope <scope>", "Analysis scope: all (default)").action((opts) => {
|
|
27377
27980
|
runKnowledgeConsolidate(opts);
|
|
27378
27981
|
});
|
|
27982
|
+
var planCmd = program.command("plan").description("Delivery Plans \u2014 milestones, epics and verifiable progress (WI-074)");
|
|
27983
|
+
planCmd.command("list").description("List delivery plans with progress").action(() => runPlanList());
|
|
27984
|
+
planCmd.command("show <id>").description("Show a delivery plan, its milestones and epics").action((id) => runPlanShow(id));
|
|
27985
|
+
planCmd.command("progress <id>").description("Planning coverage, delivery progress and completion readiness").action((id) => runPlanProgress(id));
|
|
27986
|
+
planCmd.command("create").description("Create a new delivery plan (interactive)").action(() => {
|
|
27987
|
+
void runPlanCreate();
|
|
27988
|
+
});
|
|
27989
|
+
var epicCmd = program.command("epic").description("Delivery Epics \u2014 significant outcomes spanning Initiatives and Work Items (WI-074)");
|
|
27990
|
+
epicCmd.command("list").description("List epics with progress").action(() => runEpicList());
|
|
27991
|
+
epicCmd.command("show <id>").description("Show an epic, its plan/milestone and initiatives").action((id) => runEpicShow(id));
|
|
27992
|
+
epicCmd.command("progress <id>").description("Planning coverage, delivery progress and completion readiness").action((id) => runEpicProgress(id));
|
|
27993
|
+
epicCmd.command("create").description("Create a new epic (interactive)").action(() => {
|
|
27994
|
+
void runEpicCreate();
|
|
27995
|
+
});
|
|
27996
|
+
epicCmd.command("associate <epicId> <initiativeId>").description("Associate an existing Initiative with an Epic").action((e, i) => {
|
|
27997
|
+
void runEpicAssociate(e, i);
|
|
27998
|
+
});
|
|
27379
27999
|
var topologyCmd = program.command("topology").description("Validate and apply a semantic system topology proposal (agent proposes, human confirms, Core applies)");
|
|
27380
28000
|
topologyCmd.command("validate <file>").description("Validate a topology proposal file deterministically (no write)").action((file) => {
|
|
27381
28001
|
runTopologyValidate(file);
|