@kaddo/cli 3.113.0 → 3.115.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/README.md +199 -452
- package/dist/admin-dist/assets/{architectureDiagram-3BPJPVTR-eYr0CQIi.js → architectureDiagram-3BPJPVTR-YcMJYo0g.js} +1 -1
- package/dist/admin-dist/assets/{chunk-727SXJPM-DrnpGnui.js → chunk-727SXJPM-BVnKaPXl.js} +1 -1
- package/dist/admin-dist/assets/{chunk-AQP2D5EJ-CEGy8SpK.js → chunk-AQP2D5EJ-D_Hcj3zm.js} +1 -1
- package/dist/admin-dist/assets/{classDiagram-v2-Q7XG4LA2-DA001cdf.js → classDiagram-4FO5ZUOK-C1j2IJF8.js} +1 -1
- package/dist/admin-dist/assets/{classDiagram-4FO5ZUOK-DA001cdf.js → classDiagram-v2-Q7XG4LA2-C1j2IJF8.js} +1 -1
- package/dist/admin-dist/assets/{dagre-BM42HDAG-BRJ0nXQb.js → dagre-BM42HDAG-ADdKf6j1.js} +1 -1
- package/dist/admin-dist/assets/{diagram-2AECGRRQ-xd6Livp4.js → diagram-2AECGRRQ-Z_xeHBlY.js} +1 -1
- package/dist/admin-dist/assets/{diagram-5GNKFQAL-o9d2ix0l.js → diagram-5GNKFQAL-Wgzw55l3.js} +1 -1
- package/dist/admin-dist/assets/{diagram-LMA3HP47-DcnWjF35.js → diagram-LMA3HP47-Dj6c7SSM.js} +1 -1
- package/dist/admin-dist/assets/{diagram-OG6HWLK6-Cw5XQicu.js → diagram-OG6HWLK6-hHqRSSZr.js} +1 -1
- package/dist/admin-dist/assets/{erDiagram-TEJ5UH35-DRxLZQPp.js → erDiagram-TEJ5UH35-BTGBIaZr.js} +1 -1
- package/dist/admin-dist/assets/{flowDiagram-I6XJVG4X-Pb5MivY8.js → flowDiagram-I6XJVG4X-RZJDjzR6.js} +1 -1
- package/dist/admin-dist/assets/{ganttDiagram-6RSMTGT7-Cm7UHfMW.js → ganttDiagram-6RSMTGT7-DI5Lr-xB.js} +1 -1
- package/dist/admin-dist/assets/{index-M8TdCEku.js → index-RwMAZcWr.js} +4 -4
- package/dist/admin-dist/assets/{infoDiagram-5YYISTIA-Bwq-Ae1z.js → infoDiagram-5YYISTIA-T5KZWjTy.js} +1 -1
- package/dist/admin-dist/assets/{ishikawaDiagram-YF4QCWOH-CN8u3lkW.js → ishikawaDiagram-YF4QCWOH-C6Gyb7TQ.js} +1 -1
- package/dist/admin-dist/assets/{kanban-definition-UN3LZRKU-DFp13Kfy.js → kanban-definition-UN3LZRKU-Dg8kSuqH.js} +1 -1
- package/dist/admin-dist/assets/{linear-sB0c581b.js → linear-NG3wfuct.js} +1 -1
- package/dist/admin-dist/assets/{mindmap-definition-RKZ34NQL-Ds_AH-UF.js → mindmap-definition-RKZ34NQL-B1dMo93T.js} +1 -1
- package/dist/admin-dist/assets/{pieDiagram-4H26LBE5-CT6aVbJD.js → pieDiagram-4H26LBE5-iIbw9aCq.js} +1 -1
- package/dist/admin-dist/assets/{quadrantDiagram-W4KKPZXB-QacGkpjr.js → quadrantDiagram-W4KKPZXB-CBsaVubF.js} +1 -1
- package/dist/admin-dist/assets/{requirementDiagram-4Y6WPE33-UjzvMQAY.js → requirementDiagram-4Y6WPE33-CobNACNF.js} +1 -1
- package/dist/admin-dist/assets/{sequenceDiagram-3UESZ5HK-Drii4Z9H.js → sequenceDiagram-3UESZ5HK-CpE56jux.js} +1 -1
- package/dist/admin-dist/assets/{stateDiagram-AJRCARHV-Cu5M1jgm.js → stateDiagram-AJRCARHV-pSzN5IAu.js} +1 -1
- package/dist/admin-dist/assets/{stateDiagram-v2-BHNVJYJU-Dnkqr8wc.js → stateDiagram-v2-BHNVJYJU-LhQFrdKp.js} +1 -1
- package/dist/admin-dist/assets/{timeline-definition-PNZ67QCA-BmCLa1NQ.js → timeline-definition-PNZ67QCA-q4yUdZjI.js} +1 -1
- package/dist/admin-dist/assets/{vennDiagram-CIIHVFJN-BhHRtC9_.js → vennDiagram-CIIHVFJN-D5DxPuNK.js} +1 -1
- package/dist/admin-dist/assets/{wardleyDiagram-YWT4CUSO-BzHZzKlk.js → wardleyDiagram-YWT4CUSO-451b1uEN.js} +1 -1
- package/dist/admin-dist/assets/{xychartDiagram-2RQKCTM6-uU2Utuv0.js → xychartDiagram-2RQKCTM6-DnOwq6Mk.js} +1 -1
- package/dist/admin-dist/index.html +1 -1
- package/dist/admin-server/index.js +2 -0
- package/dist/core.js +254 -45
- package/dist/index.js +380 -129
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1390,8 +1390,8 @@ function loadConfig(dir) {
|
|
|
1390
1390
|
const parsed = configSchema.safeParse(raw ?? {});
|
|
1391
1391
|
if (!parsed.success) {
|
|
1392
1392
|
const issues = parsed.error.issues.map((i) => {
|
|
1393
|
-
const
|
|
1394
|
-
return
|
|
1393
|
+
const path12 = i.path.join(".");
|
|
1394
|
+
return path12 ? ` - ${path12}: ${i.message}` : ` - ${i.message}`;
|
|
1395
1395
|
}).join("\n");
|
|
1396
1396
|
throw new ConfigError(`Invalid .kaddo/config.yml:
|
|
1397
1397
|
${issues}`);
|
|
@@ -2499,8 +2499,13 @@ dependencies.
|
|
|
2499
2499
|
flags, content/copy, authentication/authorization, notifications, analytics, documentation,
|
|
2500
2500
|
operations/release \u2014 as affected, reviewed-not-affected, unknown, or not-applicable.
|
|
2501
2501
|
4. **Module review** \u2014 for multirepo, evaluate each mapped module with the same statuses.
|
|
2502
|
-
5. **
|
|
2503
|
-
|
|
2502
|
+
5. **Resource review** \u2014 ask: does this change need to observe, modify, validate or deliver against a
|
|
2503
|
+
known external resource of the project (a Project Resource under \`knowledge/tech/resources/\` \u2014
|
|
2504
|
+
database, cloud, API, queue, storage\u2026)? If so, declare it in the WI front matter \`resources:\` with
|
|
2505
|
+
a role (\`affected\`, \`implementation\`, \`validation\`, \`delivery\`). Resources are external systems,
|
|
2506
|
+
distinct from \`affected_modules\` (code). Not every WI needs resources (e.g. a CSS change does not).
|
|
2507
|
+
6. **Completeness review** \u2014 confirm: outcome covered, journey covered, modules assessed, resources
|
|
2508
|
+
assessed, unknowns visible, acceptance criteria end-to-end, scope and out-of-scope coherent.
|
|
2504
2509
|
|
|
2505
2510
|
## Rules
|
|
2506
2511
|
|
|
@@ -2511,6 +2516,8 @@ dependencies.
|
|
|
2511
2516
|
- Include at least one end-to-end acceptance criterion for user-facing changes.
|
|
2512
2517
|
- Do not reduce a product intent to the first technical implementation found.
|
|
2513
2518
|
- Evaluate surfaces and modules before proposing files.
|
|
2519
|
+
- Consider Project Resources when the scope justifies it; never invent resources not backed by
|
|
2520
|
+
project knowledge, and keep \`resources\` (external systems) separate from \`affected_modules\` (code).
|
|
2514
2521
|
- This skill refines scope and acceptance criteria but does not approve implementation readiness.
|
|
2515
2522
|
Readiness requires human confirmation through \`kaddo ready\` or the MCP \`mark_work_item_ready\` action.
|
|
2516
2523
|
|
|
@@ -7044,10 +7051,10 @@ function analyzeGuard(touchedFiles, artifacts, silentWithoutOwnership) {
|
|
|
7044
7051
|
import { parse as parseYaml5, stringify as stringifyYaml3 } from "yaml";
|
|
7045
7052
|
var IGNORE_FILE = ".kaddo/ignores.yml";
|
|
7046
7053
|
function loadIgnores(dir) {
|
|
7047
|
-
const
|
|
7048
|
-
if (!exists(
|
|
7054
|
+
const path12 = join(dir, IGNORE_FILE);
|
|
7055
|
+
if (!exists(path12)) return [];
|
|
7049
7056
|
try {
|
|
7050
|
-
const raw = readFile(
|
|
7057
|
+
const raw = readFile(path12);
|
|
7051
7058
|
const parsed = parseYaml5(raw);
|
|
7052
7059
|
return Array.isArray(parsed) ? parsed : [];
|
|
7053
7060
|
} catch {
|
|
@@ -7055,7 +7062,7 @@ function loadIgnores(dir) {
|
|
|
7055
7062
|
}
|
|
7056
7063
|
}
|
|
7057
7064
|
function saveIgnore(dir, entry) {
|
|
7058
|
-
const
|
|
7065
|
+
const path12 = join(dir, IGNORE_FILE);
|
|
7059
7066
|
const existing = loadIgnores(dir);
|
|
7060
7067
|
const idx = existing.findIndex((e) => e.artifact_id === entry.artifact_id);
|
|
7061
7068
|
if (idx >= 0) {
|
|
@@ -7063,17 +7070,17 @@ function saveIgnore(dir, entry) {
|
|
|
7063
7070
|
} else {
|
|
7064
7071
|
existing.push(entry);
|
|
7065
7072
|
}
|
|
7066
|
-
writeFile(
|
|
7073
|
+
writeFile(path12, stringifyYaml3(existing));
|
|
7067
7074
|
}
|
|
7068
7075
|
function isIgnored(ignores, artifactId) {
|
|
7069
7076
|
return ignores.find((e) => e.artifact_id === artifactId);
|
|
7070
7077
|
}
|
|
7071
7078
|
function removeIgnore(dir, artifactId) {
|
|
7072
|
-
const
|
|
7079
|
+
const path12 = join(dir, IGNORE_FILE);
|
|
7073
7080
|
const existing = loadIgnores(dir);
|
|
7074
7081
|
const filtered = existing.filter((e) => e.artifact_id !== artifactId);
|
|
7075
7082
|
if (filtered.length === existing.length) return false;
|
|
7076
|
-
writeFile(
|
|
7083
|
+
writeFile(path12, stringifyYaml3(filtered));
|
|
7077
7084
|
return true;
|
|
7078
7085
|
}
|
|
7079
7086
|
|
|
@@ -7095,11 +7102,11 @@ function moduleArtifactCoverage(dir, id) {
|
|
|
7095
7102
|
};
|
|
7096
7103
|
}
|
|
7097
7104
|
function loadMappedModules(dir) {
|
|
7098
|
-
const
|
|
7099
|
-
if (!exists(
|
|
7105
|
+
const path12 = join(dir, DESCRIPTOR_PATH);
|
|
7106
|
+
if (!exists(path12)) return [];
|
|
7100
7107
|
let parsed;
|
|
7101
7108
|
try {
|
|
7102
|
-
parsed = parseYaml6(readFile(
|
|
7109
|
+
parsed = parseYaml6(readFile(path12));
|
|
7103
7110
|
} catch {
|
|
7104
7111
|
return [];
|
|
7105
7112
|
}
|
|
@@ -7843,7 +7850,7 @@ function buildGuardHistory(dir) {
|
|
|
7843
7850
|
const d = hotspotDir(t.code_path);
|
|
7844
7851
|
hotspotMap.set(d, (hotspotMap.get(d) ?? 0) + 1);
|
|
7845
7852
|
}
|
|
7846
|
-
const hotspots = [...hotspotMap.entries()].map(([
|
|
7853
|
+
const hotspots = [...hotspotMap.entries()].map(([path12, warnings]) => ({ path: path12, warnings })).sort((a, b) => b.warnings - a.warnings);
|
|
7847
7854
|
return {
|
|
7848
7855
|
available: true,
|
|
7849
7856
|
total_runs: sorted.length,
|
|
@@ -8363,7 +8370,7 @@ function runIgnoreRemove(artifactId) {
|
|
|
8363
8370
|
}
|
|
8364
8371
|
|
|
8365
8372
|
// src/commands/explain.ts
|
|
8366
|
-
import
|
|
8373
|
+
import matter8 from "gray-matter";
|
|
8367
8374
|
import { parse as parseYaml13 } from "yaml";
|
|
8368
8375
|
|
|
8369
8376
|
// src/core/delivery-phase.ts
|
|
@@ -10481,10 +10488,10 @@ function slugify2(name) {
|
|
|
10481
10488
|
return name.trim().toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "");
|
|
10482
10489
|
}
|
|
10483
10490
|
function readModulesDescriptor(dir) {
|
|
10484
|
-
const
|
|
10485
|
-
if (!exists(
|
|
10491
|
+
const path12 = join(dir, DESCRIPTOR_PATH2);
|
|
10492
|
+
if (!exists(path12)) return { version: 1, modules: [] };
|
|
10486
10493
|
try {
|
|
10487
|
-
const parsed = parseYaml10(readFile(
|
|
10494
|
+
const parsed = parseYaml10(readFile(path12));
|
|
10488
10495
|
return { version: parsed.version ?? 1, modules: parsed.modules ?? [] };
|
|
10489
10496
|
} catch {
|
|
10490
10497
|
return { version: 1, modules: [] };
|
|
@@ -10864,7 +10871,7 @@ function sectionParagraph(md, title) {
|
|
|
10864
10871
|
}
|
|
10865
10872
|
return "";
|
|
10866
10873
|
}
|
|
10867
|
-
function parseCapsule(id,
|
|
10874
|
+
function parseCapsule(id, path12, md) {
|
|
10868
10875
|
const { data } = matter3(md);
|
|
10869
10876
|
const updatedAt = data.updated_at ? String(data.updated_at) : void 0;
|
|
10870
10877
|
let ageDays = null;
|
|
@@ -10874,7 +10881,7 @@ function parseCapsule(id, path11, md) {
|
|
|
10874
10881
|
}
|
|
10875
10882
|
return {
|
|
10876
10883
|
id,
|
|
10877
|
-
path:
|
|
10884
|
+
path: path12,
|
|
10878
10885
|
system: data.system ? String(data.system) : id,
|
|
10879
10886
|
owner: data.owner ? String(data.owner) : void 0,
|
|
10880
10887
|
updatedAt,
|
|
@@ -11097,8 +11104,117 @@ function computeInitiativeProgress(dir, ini) {
|
|
|
11097
11104
|
};
|
|
11098
11105
|
}
|
|
11099
11106
|
|
|
11107
|
+
// src/core/resources.ts
|
|
11108
|
+
import matter5 from "gray-matter";
|
|
11109
|
+
var RESOURCE_ARTIFACT_TYPE = "project-resource";
|
|
11110
|
+
function str(v) {
|
|
11111
|
+
return typeof v === "string" && v.trim() ? v.trim() : null;
|
|
11112
|
+
}
|
|
11113
|
+
function strArray(v) {
|
|
11114
|
+
if (Array.isArray(v)) return v.map((x) => String(x).trim()).filter(Boolean);
|
|
11115
|
+
if (typeof v === "string" && v.trim()) return [v.trim()];
|
|
11116
|
+
return [];
|
|
11117
|
+
}
|
|
11118
|
+
function parseInterfaces(v) {
|
|
11119
|
+
if (!Array.isArray(v)) return [];
|
|
11120
|
+
const out = [];
|
|
11121
|
+
for (const raw of v) {
|
|
11122
|
+
if (!raw || typeof raw !== "object") continue;
|
|
11123
|
+
const o = raw;
|
|
11124
|
+
const type = str(o.type);
|
|
11125
|
+
if (!type) continue;
|
|
11126
|
+
out.push({
|
|
11127
|
+
type,
|
|
11128
|
+
tool: str(o.tool),
|
|
11129
|
+
provider: str(o.provider),
|
|
11130
|
+
purpose: str(o.purpose),
|
|
11131
|
+
operations: strArray(o.operations),
|
|
11132
|
+
environments: strArray(o.environments),
|
|
11133
|
+
constraints: str(o.constraints)
|
|
11134
|
+
});
|
|
11135
|
+
}
|
|
11136
|
+
return out;
|
|
11137
|
+
}
|
|
11138
|
+
function parseBoundaries(v) {
|
|
11139
|
+
if (!v || typeof v !== "object" || Array.isArray(v)) return {};
|
|
11140
|
+
const out = {};
|
|
11141
|
+
for (const [env, val] of Object.entries(v)) {
|
|
11142
|
+
const list2 = strArray(val);
|
|
11143
|
+
if (list2.length > 0) out[env] = list2;
|
|
11144
|
+
}
|
|
11145
|
+
return out;
|
|
11146
|
+
}
|
|
11147
|
+
function parseAuth(v) {
|
|
11148
|
+
if (!v || typeof v !== "object" || Array.isArray(v)) return { mode: null, refs: [] };
|
|
11149
|
+
const o = v;
|
|
11150
|
+
const refs = strArray(o.refs).filter((r) => !r.includes("=") && /^[A-Za-z0-9_.-]+$/.test(r));
|
|
11151
|
+
return { mode: str(o.mode), refs };
|
|
11152
|
+
}
|
|
11153
|
+
function toDetail(filePath, relPath, raw) {
|
|
11154
|
+
const parsed = matter5(raw);
|
|
11155
|
+
const fm2 = parsed.data ?? {};
|
|
11156
|
+
const body = parsed.content.trim();
|
|
11157
|
+
const id = str(fm2.id) ?? "";
|
|
11158
|
+
return {
|
|
11159
|
+
id,
|
|
11160
|
+
title: str(fm2.title) ?? id,
|
|
11161
|
+
resourceType: str(fm2.resource_type),
|
|
11162
|
+
provider: str(fm2.provider),
|
|
11163
|
+
environments: strArray(fm2.environments),
|
|
11164
|
+
path: relPath,
|
|
11165
|
+
purpose: str(fm2.purpose),
|
|
11166
|
+
interfaces: parseInterfaces(fm2.access_interfaces),
|
|
11167
|
+
boundaries: parseBoundaries(fm2.access_boundaries),
|
|
11168
|
+
...(() => {
|
|
11169
|
+
const a = parseAuth(fm2.authentication);
|
|
11170
|
+
return { authRefs: a.refs, authMode: a.mode };
|
|
11171
|
+
})(),
|
|
11172
|
+
markdownBody: body
|
|
11173
|
+
};
|
|
11174
|
+
}
|
|
11175
|
+
function getResources(dir) {
|
|
11176
|
+
return discoverKnowledge(dir).filter((a) => a.type === RESOURCE_ARTIFACT_TYPE).map((a) => {
|
|
11177
|
+
const fm2 = a.rawFrontmatter;
|
|
11178
|
+
return {
|
|
11179
|
+
id: a.id || str(fm2.id) || a.title,
|
|
11180
|
+
title: a.title || str(fm2.title) || a.id,
|
|
11181
|
+
resourceType: str(fm2.resource_type),
|
|
11182
|
+
provider: str(fm2.provider),
|
|
11183
|
+
environments: strArray(fm2.environments),
|
|
11184
|
+
path: a.relPath
|
|
11185
|
+
};
|
|
11186
|
+
}).sort((x, y) => x.id.localeCompare(y.id));
|
|
11187
|
+
}
|
|
11188
|
+
function getResource(dir, id) {
|
|
11189
|
+
const match = discoverKnowledge(dir).find(
|
|
11190
|
+
(a) => a.type === RESOURCE_ARTIFACT_TYPE && (a.id === id || a.title === id)
|
|
11191
|
+
);
|
|
11192
|
+
if (!match) return null;
|
|
11193
|
+
const raw = readFile(match.filePath);
|
|
11194
|
+
return toDetail(match.filePath, match.relPath, raw);
|
|
11195
|
+
}
|
|
11196
|
+
function parseWorkItemResources(fm2) {
|
|
11197
|
+
const v = fm2.resources;
|
|
11198
|
+
if (!Array.isArray(v)) return [];
|
|
11199
|
+
const out = [];
|
|
11200
|
+
for (const raw of v) {
|
|
11201
|
+
if (!raw || typeof raw !== "object" || Array.isArray(raw)) continue;
|
|
11202
|
+
const o = raw;
|
|
11203
|
+
const id = str(o.id);
|
|
11204
|
+
if (!id) continue;
|
|
11205
|
+
out.push({ id, role: str(o.role) ?? "affected" });
|
|
11206
|
+
}
|
|
11207
|
+
return out;
|
|
11208
|
+
}
|
|
11209
|
+
|
|
11100
11210
|
// src/core/graph.ts
|
|
11101
11211
|
var KNOWLEDGE3 = "knowledge";
|
|
11212
|
+
var RESOURCE_ROLE_EDGE = {
|
|
11213
|
+
affected: "affects",
|
|
11214
|
+
implementation: "uses",
|
|
11215
|
+
validation: "validates_with",
|
|
11216
|
+
delivery: "delivers_through"
|
|
11217
|
+
};
|
|
11102
11218
|
var ACTIVE_STATUSES = ["draft", "ready", "in-progress", "blocked"];
|
|
11103
11219
|
var ALL_STATUSES = ["draft", "ready", "in-progress", "blocked", "completed"];
|
|
11104
11220
|
function scopeStatuses(scope) {
|
|
@@ -11135,9 +11251,9 @@ function buildGraph(dir, config, opts = {}, now = /* @__PURE__ */ new Date()) {
|
|
|
11135
11251
|
];
|
|
11136
11252
|
const presentLayers = [];
|
|
11137
11253
|
for (const layer2 of layerDocs) {
|
|
11138
|
-
const
|
|
11139
|
-
if (
|
|
11140
|
-
addNode({ id: layer2.id, type: layer2.type, label: layer2.label, path:
|
|
11254
|
+
const path12 = layer2.files.map((f) => `${KNOWLEDGE3}/${f}`).find((rel) => exists(join(dir, rel)));
|
|
11255
|
+
if (path12) {
|
|
11256
|
+
addNode({ id: layer2.id, type: layer2.type, label: layer2.label, path: path12 });
|
|
11141
11257
|
presentLayers.push(layer2.id);
|
|
11142
11258
|
}
|
|
11143
11259
|
}
|
|
@@ -11177,6 +11293,16 @@ function buildGraph(dir, config, opts = {}, now = /* @__PURE__ */ new Date()) {
|
|
|
11177
11293
|
if (cand.materializedAs) addEdge(candId, `wi:${cand.materializedAs}`, "materialized_as");
|
|
11178
11294
|
}
|
|
11179
11295
|
}
|
|
11296
|
+
const resourceTitleById = /* @__PURE__ */ new Map();
|
|
11297
|
+
for (const r of getResources(dir)) {
|
|
11298
|
+
resourceTitleById.set(r.id, r.title);
|
|
11299
|
+
addNode({
|
|
11300
|
+
id: `resource:${r.id}`,
|
|
11301
|
+
type: "project-resource",
|
|
11302
|
+
label: r.title ? `${r.id} ${r.title}`.trim() : r.id,
|
|
11303
|
+
path: r.path
|
|
11304
|
+
});
|
|
11305
|
+
}
|
|
11180
11306
|
for (const wi of selectedWIs) {
|
|
11181
11307
|
const id = wi.id || wi.title;
|
|
11182
11308
|
if (!id || !id.trim()) continue;
|
|
@@ -11201,6 +11327,12 @@ function buildGraph(dir, config, opts = {}, now = /* @__PURE__ */ new Date()) {
|
|
|
11201
11327
|
addNode({ id: capId, type: "capability", label: cap });
|
|
11202
11328
|
addEdge(wiNodeId, capId, "implements");
|
|
11203
11329
|
}
|
|
11330
|
+
for (const rel of parseWorkItemResources(wi.rawFrontmatter)) {
|
|
11331
|
+
const resId = `resource:${rel.id}`;
|
|
11332
|
+
const title = resourceTitleById.get(rel.id);
|
|
11333
|
+
addNode({ id: resId, type: "project-resource", label: title ? `${rel.id} ${title}`.trim() : rel.id });
|
|
11334
|
+
addEdge(wiNodeId, resId, RESOURCE_ROLE_EDGE[rel.role] ?? "uses");
|
|
11335
|
+
}
|
|
11204
11336
|
for (const dec of wi.decisions) {
|
|
11205
11337
|
if (!dec || !dec.trim()) continue;
|
|
11206
11338
|
const adrId = `adr:${dec}`;
|
|
@@ -11579,7 +11711,7 @@ function loadGraphHints(dir) {
|
|
|
11579
11711
|
}
|
|
11580
11712
|
|
|
11581
11713
|
// src/services/installed-skills.ts
|
|
11582
|
-
import
|
|
11714
|
+
import matter6 from "gray-matter";
|
|
11583
11715
|
var SKILLS_DIR = join("knowledge", "skills");
|
|
11584
11716
|
function discoverInstalledSkills(dir) {
|
|
11585
11717
|
const base = join(dir, SKILLS_DIR);
|
|
@@ -11589,7 +11721,7 @@ function discoverInstalledSkills(dir) {
|
|
|
11589
11721
|
const skillFile = join(base, entry, "skill.md");
|
|
11590
11722
|
if (!isFile(skillFile)) continue;
|
|
11591
11723
|
try {
|
|
11592
|
-
const { data } =
|
|
11724
|
+
const { data } = matter6(readFile(skillFile));
|
|
11593
11725
|
if (data.type && String(data.type) !== "skill") continue;
|
|
11594
11726
|
const id = String(data.id ?? entry);
|
|
11595
11727
|
out.push({
|
|
@@ -12700,10 +12832,10 @@ function resolveNextStep(dir, now = /* @__PURE__ */ new Date()) {
|
|
|
12700
12832
|
const q = (rel) => analyzeKnowledgeArtifact(dir, rel);
|
|
12701
12833
|
const resolveAgent = (agent) => {
|
|
12702
12834
|
const file = agent.endsWith(".md") ? agent : `${agent}.md`;
|
|
12703
|
-
const
|
|
12704
|
-
const installed = isFile(join(dir,
|
|
12835
|
+
const path12 = agentInstallPath(file);
|
|
12836
|
+
const installed = isFile(join(dir, path12));
|
|
12705
12837
|
const group = agentGroupOf(file);
|
|
12706
|
-
return { agentPath:
|
|
12838
|
+
return { agentPath: path12, agentInstalled: installed, installCommand: installed ? void 0 : `kaddo add agents --group ${group}` };
|
|
12707
12839
|
};
|
|
12708
12840
|
const moduleRepo = isModule(config);
|
|
12709
12841
|
const coreRepo = isCore(config);
|
|
@@ -13133,7 +13265,7 @@ function deriveDeliveryCompletedStatus(dir) {
|
|
|
13133
13265
|
}
|
|
13134
13266
|
|
|
13135
13267
|
// src/core/assets.ts
|
|
13136
|
-
import
|
|
13268
|
+
import matter7 from "gray-matter";
|
|
13137
13269
|
function canonicalAgents() {
|
|
13138
13270
|
return AGENT_PROMPTS.map((a) => ({
|
|
13139
13271
|
name: a.fileName.replace(/\.md$/, ""),
|
|
@@ -13146,7 +13278,7 @@ function canonicalSkills() {
|
|
|
13146
13278
|
}
|
|
13147
13279
|
function versionOf(content) {
|
|
13148
13280
|
try {
|
|
13149
|
-
const v =
|
|
13281
|
+
const v = matter7(content).data.version;
|
|
13150
13282
|
return v === void 0 || v === null ? null : String(v);
|
|
13151
13283
|
} catch {
|
|
13152
13284
|
return null;
|
|
@@ -14629,7 +14761,7 @@ function readKnowledge(dir) {
|
|
|
14629
14761
|
if (!exists(knowledgePath)) return null;
|
|
14630
14762
|
try {
|
|
14631
14763
|
const raw = readFile(knowledgePath);
|
|
14632
|
-
const { data, content } =
|
|
14764
|
+
const { data, content } = matter8(raw);
|
|
14633
14765
|
return { content, data };
|
|
14634
14766
|
} catch {
|
|
14635
14767
|
return null;
|
|
@@ -14640,7 +14772,7 @@ function readRoadmap(dir) {
|
|
|
14640
14772
|
if (!exists(roadmapPath)) return null;
|
|
14641
14773
|
try {
|
|
14642
14774
|
const raw = readFile(roadmapPath);
|
|
14643
|
-
const { content } =
|
|
14775
|
+
const { content } = matter8(raw);
|
|
14644
14776
|
return content.trim();
|
|
14645
14777
|
} catch {
|
|
14646
14778
|
return null;
|
|
@@ -14809,7 +14941,7 @@ function runExplain(opts) {
|
|
|
14809
14941
|
}
|
|
14810
14942
|
|
|
14811
14943
|
// src/core/context-pack.ts
|
|
14812
|
-
import
|
|
14944
|
+
import matter9 from "gray-matter";
|
|
14813
14945
|
var CONTEXT_PACK_VERSION = "1";
|
|
14814
14946
|
var ARCH_DIR6 = "knowledge";
|
|
14815
14947
|
function readScanJson(dir) {
|
|
@@ -14822,7 +14954,7 @@ function readScanJson(dir) {
|
|
|
14822
14954
|
}
|
|
14823
14955
|
}
|
|
14824
14956
|
function firstParagraph2(markdown) {
|
|
14825
|
-
const body =
|
|
14957
|
+
const body = matter9(markdown).content.trim();
|
|
14826
14958
|
const para = body.split("\n\n").map((p) => p.trim()).find((p) => p && !p.startsWith("#"));
|
|
14827
14959
|
return para ?? "";
|
|
14828
14960
|
}
|
|
@@ -14876,6 +15008,8 @@ function toContextWorkItem(a) {
|
|
|
14876
15008
|
wi.validationStatus = a.validationStatus || (isHistorical ? "not-assessed" : void 0);
|
|
14877
15009
|
wi.releaseStatus = a.releaseStatus || (isHistorical ? "not-assessed" : void 0);
|
|
14878
15010
|
if (a.affectedModules.length > 0) wi.affectedModules = a.affectedModules;
|
|
15011
|
+
const wiResources = parseWorkItemResources(a.rawFrontmatter);
|
|
15012
|
+
if (wiResources.length > 0) wi.resources = wiResources;
|
|
14879
15013
|
if (a.scopeConfidence) wi.scopeConfidence = a.scopeConfidence;
|
|
14880
15014
|
if (a.moduleCoverage) wi.moduleCoverage = a.moduleCoverage;
|
|
14881
15015
|
if (a.impactAnalysis) wi.impactAnalysis = a.impactAnalysis;
|
|
@@ -16442,19 +16576,24 @@ function runStatus() {
|
|
|
16442
16576
|
}
|
|
16443
16577
|
|
|
16444
16578
|
// src/commands/learn.ts
|
|
16445
|
-
import
|
|
16579
|
+
import fs3 from "fs";
|
|
16580
|
+
import path7 from "path";
|
|
16581
|
+
import matter10 from "gray-matter";
|
|
16446
16582
|
var ARCH_DIR9 = "knowledge";
|
|
16447
16583
|
var WORK_ITEMS_DIR2 = "knowledge/delivery/work-items";
|
|
16448
|
-
function
|
|
16449
|
-
const
|
|
16450
|
-
|
|
16451
|
-
|
|
16452
|
-
const
|
|
16453
|
-
|
|
16584
|
+
function completedPathFor(filePath) {
|
|
16585
|
+
const posix = filePath.replace(/\\/g, "/");
|
|
16586
|
+
const m = posix.match(/\/work-items\/(draft|ready|in-progress|blocked)\//);
|
|
16587
|
+
if (!m) return filePath;
|
|
16588
|
+
const completedDir = path7.dirname(filePath).replace(
|
|
16589
|
+
new RegExp(`[/\\\\]${m[1]}$`),
|
|
16590
|
+
path7.sep + "completed"
|
|
16591
|
+
);
|
|
16592
|
+
return path7.join(completedDir, path7.basename(filePath));
|
|
16454
16593
|
}
|
|
16455
16594
|
function updateWorkItemFile(filePath, learning) {
|
|
16456
16595
|
const raw = readFile(filePath);
|
|
16457
|
-
const { data, content } =
|
|
16596
|
+
const { data, content } = matter10(raw);
|
|
16458
16597
|
data.status = "completed";
|
|
16459
16598
|
data.completed_at = (/* @__PURE__ */ new Date()).toISOString().split("T")[0];
|
|
16460
16599
|
let updatedContent = content;
|
|
@@ -16479,8 +16618,16 @@ ${learning.trim()}
|
|
|
16479
16618
|
${learning.trim()}
|
|
16480
16619
|
`;
|
|
16481
16620
|
}
|
|
16482
|
-
const newRaw =
|
|
16483
|
-
|
|
16621
|
+
const newRaw = matter10.stringify(updatedContent, data);
|
|
16622
|
+
const newPath = completedPathFor(filePath);
|
|
16623
|
+
if (newPath !== filePath) {
|
|
16624
|
+
ensureDir(path7.dirname(newPath));
|
|
16625
|
+
writeFile(newPath, newRaw);
|
|
16626
|
+
fs3.unlinkSync(filePath);
|
|
16627
|
+
} else {
|
|
16628
|
+
writeFile(filePath, newRaw);
|
|
16629
|
+
}
|
|
16630
|
+
return newPath;
|
|
16484
16631
|
}
|
|
16485
16632
|
async function runLearn(artifactId, opts = {}) {
|
|
16486
16633
|
const dir = cwd();
|
|
@@ -16514,13 +16661,16 @@ async function runLearn(artifactId, opts = {}) {
|
|
|
16514
16661
|
});
|
|
16515
16662
|
targetId = chosen;
|
|
16516
16663
|
}
|
|
16517
|
-
const
|
|
16664
|
+
const targetArtifact = closable.find(
|
|
16665
|
+
(a) => (a.id || a.title) === targetId
|
|
16666
|
+
) ?? artifacts.find((a) => (a.id || a.title) === targetId);
|
|
16667
|
+
const filePath = targetArtifact?.filePath ?? null;
|
|
16518
16668
|
if (!filePath) {
|
|
16519
16669
|
log.error(`Work item "${targetId}" not found in ${WORK_ITEMS_DIR2}/`);
|
|
16520
16670
|
process.exit(1);
|
|
16521
16671
|
}
|
|
16522
16672
|
const wiRaw = readFile(filePath);
|
|
16523
|
-
const wiData =
|
|
16673
|
+
const wiData = matter10(wiRaw).data;
|
|
16524
16674
|
if (!opts.force) {
|
|
16525
16675
|
const completionBlockers = [];
|
|
16526
16676
|
const releaseGates = Array.isArray(wiData.release_gates) ? wiData.release_gates : [];
|
|
@@ -16563,9 +16713,9 @@ async function runLearn(artifactId, opts = {}) {
|
|
|
16563
16713
|
}
|
|
16564
16714
|
enrichedLearning += "\n\n> " + notes.join(" ");
|
|
16565
16715
|
}
|
|
16566
|
-
updateWorkItemFile(filePath, enrichedLearning);
|
|
16716
|
+
const finalPath = updateWorkItemFile(filePath, enrichedLearning);
|
|
16567
16717
|
log.success(`${targetId} marked as completed`);
|
|
16568
|
-
log.success(`Learning recorded in ${
|
|
16718
|
+
log.success(`Learning recorded in ${finalPath.replace(dir + path7.sep, "").replace(/\\/g, "/")}`);
|
|
16569
16719
|
if (hasExceptions) {
|
|
16570
16720
|
log.warn("Learning captured from a Work Item completed with validation exceptions.");
|
|
16571
16721
|
}
|
|
@@ -16776,7 +16926,7 @@ function runAdd(moduleName, opts = {}, dir = cwd()) {
|
|
|
16776
16926
|
}
|
|
16777
16927
|
|
|
16778
16928
|
// src/core/ownership-suggest.ts
|
|
16779
|
-
import
|
|
16929
|
+
import matter11 from "gray-matter";
|
|
16780
16930
|
var SCAN_PATH = ".kaddo/scan.json";
|
|
16781
16931
|
function normalizeGlob(input) {
|
|
16782
16932
|
let g = input.trim().replace(/\\/g, "/");
|
|
@@ -16898,11 +17048,11 @@ function suggestGlobs(artifact, signals) {
|
|
|
16898
17048
|
return [...new Set(out)];
|
|
16899
17049
|
}
|
|
16900
17050
|
function applyOwnership(raw, globs, mode = "replace") {
|
|
16901
|
-
const parsed =
|
|
17051
|
+
const parsed = matter11(raw);
|
|
16902
17052
|
const existing = toStringArray3(parsed.data.code);
|
|
16903
17053
|
const next = mode === "append" ? [.../* @__PURE__ */ new Set([...existing, ...globs])] : [...new Set(globs)];
|
|
16904
17054
|
const data = { ...parsed.data, code: next };
|
|
16905
|
-
return
|
|
17055
|
+
return matter11.stringify(parsed.content, data);
|
|
16906
17056
|
}
|
|
16907
17057
|
|
|
16908
17058
|
// src/commands/owners.ts
|
|
@@ -17713,8 +17863,8 @@ function runGraphExport(opts = {}) {
|
|
|
17713
17863
|
|
|
17714
17864
|
// src/core/system-topology.ts
|
|
17715
17865
|
import { parse as parseYaml17, stringify as stringifyYaml8 } from "yaml";
|
|
17716
|
-
import
|
|
17717
|
-
import
|
|
17866
|
+
import fs4 from "fs";
|
|
17867
|
+
import path8 from "path";
|
|
17718
17868
|
import crypto from "crypto";
|
|
17719
17869
|
var TOPOLOGY_FILE = "knowledge/tech/system-topology.yml";
|
|
17720
17870
|
var SYSTEM_ENTITY_KINDS = /* @__PURE__ */ new Set([
|
|
@@ -17880,14 +18030,14 @@ function serializeTopology(entities, relationships) {
|
|
|
17880
18030
|
return stringifyYaml8(doc);
|
|
17881
18031
|
}
|
|
17882
18032
|
function atomicWrite(filePath, content) {
|
|
17883
|
-
|
|
18033
|
+
fs4.mkdirSync(path8.dirname(filePath), { recursive: true });
|
|
17884
18034
|
const tmp = `${filePath}.${process.pid}.${Date.now()}.tmp`;
|
|
17885
|
-
|
|
18035
|
+
fs4.writeFileSync(tmp, content, "utf-8");
|
|
17886
18036
|
try {
|
|
17887
|
-
|
|
18037
|
+
fs4.renameSync(tmp, filePath);
|
|
17888
18038
|
} catch (err) {
|
|
17889
18039
|
try {
|
|
17890
|
-
|
|
18040
|
+
fs4.rmSync(tmp, { force: true });
|
|
17891
18041
|
} catch {
|
|
17892
18042
|
}
|
|
17893
18043
|
throw err;
|
|
@@ -17992,15 +18142,93 @@ async function runTopologyApply(file, opts = {}) {
|
|
|
17992
18142
|
}
|
|
17993
18143
|
}
|
|
17994
18144
|
|
|
18145
|
+
// src/commands/resources.ts
|
|
18146
|
+
function runResourcesList(dir = cwd(), opts = {}) {
|
|
18147
|
+
const resources = getResources(dir);
|
|
18148
|
+
if (opts.json) {
|
|
18149
|
+
console.log(JSON.stringify(resources, null, 2));
|
|
18150
|
+
return;
|
|
18151
|
+
}
|
|
18152
|
+
if (resources.length === 0) {
|
|
18153
|
+
console.log("");
|
|
18154
|
+
console.log("No Project Resources are defined for this project.");
|
|
18155
|
+
console.log("");
|
|
18156
|
+
console.log("Add one under:");
|
|
18157
|
+
console.log(" knowledge/tech/resources/");
|
|
18158
|
+
console.log("");
|
|
18159
|
+
return;
|
|
18160
|
+
}
|
|
18161
|
+
console.log("");
|
|
18162
|
+
console.log("Project Resources:");
|
|
18163
|
+
for (const r of resources) {
|
|
18164
|
+
const type = r.resourceType ?? "\u2014";
|
|
18165
|
+
const provider = r.provider ? ` (${r.provider})` : "";
|
|
18166
|
+
const envs = r.environments.length > 0 ? ` [${r.environments.join(", ")}]` : "";
|
|
18167
|
+
console.log(` ${r.id.padEnd(22)} ${type.padEnd(12)}${provider}${envs}`);
|
|
18168
|
+
}
|
|
18169
|
+
console.log("");
|
|
18170
|
+
}
|
|
18171
|
+
function runResourcesGet(id, dir = cwd(), opts = {}) {
|
|
18172
|
+
const resource = getResource(dir, id);
|
|
18173
|
+
if (!resource) {
|
|
18174
|
+
if (opts.json) {
|
|
18175
|
+
console.log(JSON.stringify({ error: `Resource "${id}" not found.` }, null, 2));
|
|
18176
|
+
} else {
|
|
18177
|
+
console.error(`Project Resource "${id}" not found under knowledge/tech/resources/.`);
|
|
18178
|
+
}
|
|
18179
|
+
process.exit(1);
|
|
18180
|
+
}
|
|
18181
|
+
if (opts.json) {
|
|
18182
|
+
console.log(JSON.stringify(resource, null, 2));
|
|
18183
|
+
return;
|
|
18184
|
+
}
|
|
18185
|
+
const r = resource;
|
|
18186
|
+
console.log("");
|
|
18187
|
+
console.log(`${r.id} \u2014 ${r.title}`);
|
|
18188
|
+
console.log("");
|
|
18189
|
+
console.log(` Type: ${r.resourceType ?? "\u2014"}`);
|
|
18190
|
+
console.log(` Provider: ${r.provider ?? "\u2014"}`);
|
|
18191
|
+
if (r.environments.length > 0) console.log(` Environments: ${r.environments.join(", ")}`);
|
|
18192
|
+
if (r.purpose) console.log(` Purpose: ${r.purpose}`);
|
|
18193
|
+
if (r.interfaces.length > 0) {
|
|
18194
|
+
console.log("");
|
|
18195
|
+
console.log(" Access interfaces:");
|
|
18196
|
+
for (const i of r.interfaces) {
|
|
18197
|
+
const tool = i.tool ?? i.provider ?? "";
|
|
18198
|
+
const label = tool ? `${i.type} (${tool})` : i.type;
|
|
18199
|
+
console.log(` - ${label}`);
|
|
18200
|
+
if (i.purpose) console.log(` purpose: ${i.purpose}`);
|
|
18201
|
+
if (i.operations.length > 0) console.log(` operations: ${i.operations.join(", ")}`);
|
|
18202
|
+
if (i.environments.length > 0) console.log(` environments: ${i.environments.join(", ")}`);
|
|
18203
|
+
if (i.constraints) console.log(` constraints: ${i.constraints}`);
|
|
18204
|
+
}
|
|
18205
|
+
}
|
|
18206
|
+
const boundaryEnvs = Object.keys(r.boundaries);
|
|
18207
|
+
if (boundaryEnvs.length > 0) {
|
|
18208
|
+
console.log("");
|
|
18209
|
+
console.log(" Access boundaries:");
|
|
18210
|
+
for (const env of boundaryEnvs) {
|
|
18211
|
+
console.log(` - ${env}: ${r.boundaries[env].join(", ")}`);
|
|
18212
|
+
}
|
|
18213
|
+
}
|
|
18214
|
+
if (r.authRefs.length > 0 || r.authMode) {
|
|
18215
|
+
console.log("");
|
|
18216
|
+
console.log(" Authentication (references only \u2014 never values):");
|
|
18217
|
+
if (r.authMode) console.log(` mode: ${r.authMode}`);
|
|
18218
|
+
if (r.authRefs.length > 0) console.log(` refs: ${r.authRefs.join(", ")}`);
|
|
18219
|
+
}
|
|
18220
|
+
console.log("");
|
|
18221
|
+
}
|
|
18222
|
+
|
|
17995
18223
|
// src/services/integrations.ts
|
|
17996
|
-
import
|
|
18224
|
+
import matter13 from "gray-matter";
|
|
17997
18225
|
import { parse as parseYaml18, stringify as stringifyYaml9 } from "yaml";
|
|
17998
18226
|
|
|
17999
18227
|
// src/core/work-item-write.ts
|
|
18000
|
-
import
|
|
18001
|
-
import
|
|
18228
|
+
import fs5 from "fs";
|
|
18229
|
+
import path9 from "path";
|
|
18002
18230
|
import crypto2 from "crypto";
|
|
18003
|
-
import
|
|
18231
|
+
import matter12 from "gray-matter";
|
|
18004
18232
|
var WORK_ITEMS_DIR3 = "knowledge/delivery/work-items";
|
|
18005
18233
|
var WorkItemWriteError = class extends Error {
|
|
18006
18234
|
constructor(code, message) {
|
|
@@ -18021,7 +18249,7 @@ function nextWorkItemId2(dir) {
|
|
|
18021
18249
|
let max = 0;
|
|
18022
18250
|
const walk = (d) => {
|
|
18023
18251
|
if (!exists(d)) return;
|
|
18024
|
-
for (const entry of
|
|
18252
|
+
for (const entry of fs5.readdirSync(d)) {
|
|
18025
18253
|
const full = join(d, entry);
|
|
18026
18254
|
if (isFile(full)) {
|
|
18027
18255
|
const m = entry.match(/WI-(\d+)/);
|
|
@@ -18035,14 +18263,14 @@ function nextWorkItemId2(dir) {
|
|
|
18035
18263
|
return `WI-${String(max + 1).padStart(3, "0")}`;
|
|
18036
18264
|
}
|
|
18037
18265
|
function atomicWrite2(filePath, content) {
|
|
18038
|
-
|
|
18266
|
+
fs5.mkdirSync(path9.dirname(filePath), { recursive: true });
|
|
18039
18267
|
const tmp = `${filePath}.${process.pid}.${Date.now()}.tmp`;
|
|
18040
|
-
|
|
18268
|
+
fs5.writeFileSync(tmp, content, "utf-8");
|
|
18041
18269
|
try {
|
|
18042
|
-
|
|
18270
|
+
fs5.renameSync(tmp, filePath);
|
|
18043
18271
|
} catch (err) {
|
|
18044
18272
|
try {
|
|
18045
|
-
|
|
18273
|
+
fs5.rmSync(tmp, { force: true });
|
|
18046
18274
|
} catch {
|
|
18047
18275
|
}
|
|
18048
18276
|
throw err;
|
|
@@ -18095,8 +18323,16 @@ ${body}`);
|
|
|
18095
18323
|
${out.join("\n\n")}
|
|
18096
18324
|
`.replace(/\n{3,}/g, "\n\n");
|
|
18097
18325
|
}
|
|
18326
|
+
function ensureH1(body, title) {
|
|
18327
|
+
const trimmed = body.trim();
|
|
18328
|
+
const firstMeaningful = trimmed.split(/\r?\n/).find((l) => l.trim());
|
|
18329
|
+
if (firstMeaningful && /^#\s+/.test(firstMeaningful.trim())) return trimmed;
|
|
18330
|
+
return `# ${title}
|
|
18331
|
+
|
|
18332
|
+
${trimmed}`;
|
|
18333
|
+
}
|
|
18098
18334
|
function serialize(data, body) {
|
|
18099
|
-
return
|
|
18335
|
+
return matter12.stringify(`
|
|
18100
18336
|
${body.trim()}
|
|
18101
18337
|
`, data);
|
|
18102
18338
|
}
|
|
@@ -18130,6 +18366,7 @@ function createWorkItem(dir, opts) {
|
|
|
18130
18366
|
const id = nextWorkItemId2(dir);
|
|
18131
18367
|
const title = intent.split(/\r?\n/)[0].trim().slice(0, 120);
|
|
18132
18368
|
const today3 = (/* @__PURE__ */ new Date()).toISOString().split("T")[0];
|
|
18369
|
+
const summary = opts.summary?.trim() || intent;
|
|
18133
18370
|
const source = opts.source ? { ...opts.source, inferred: false } : { type: "manual", inferred: false };
|
|
18134
18371
|
const data = {
|
|
18135
18372
|
type,
|
|
@@ -18141,15 +18378,16 @@ function createWorkItem(dir, opts) {
|
|
|
18141
18378
|
source,
|
|
18142
18379
|
generated_by: "kaddo-admin",
|
|
18143
18380
|
affected_modules: [],
|
|
18144
|
-
summary
|
|
18381
|
+
summary
|
|
18145
18382
|
};
|
|
18146
18383
|
if (opts.originalSnapshot) data.original_snapshot = opts.originalSnapshot;
|
|
18147
18384
|
const answers = opts.answers ?? {};
|
|
18148
18385
|
const hasAnswers = Object.values(answers).some((v) => v?.trim());
|
|
18149
|
-
const
|
|
18386
|
+
const providedBody = opts.body?.trim();
|
|
18387
|
+
const body = providedBody ? ensureH1(providedBody, title) : hasAnswers ? captureBody(title, type, answers) : freshBody({
|
|
18150
18388
|
title,
|
|
18151
18389
|
type,
|
|
18152
|
-
summary
|
|
18390
|
+
summary,
|
|
18153
18391
|
scopeUnknowns: [],
|
|
18154
18392
|
affectedModules: [],
|
|
18155
18393
|
moduleCoverage: [],
|
|
@@ -18851,8 +19089,8 @@ async function handleJiraResponse(res) {
|
|
|
18851
19089
|
}
|
|
18852
19090
|
return await res.json();
|
|
18853
19091
|
}
|
|
18854
|
-
async function jiraFetch(baseUrl,
|
|
18855
|
-
const url = new URL(
|
|
19092
|
+
async function jiraFetch(baseUrl, path12, auth, timeoutMs, params) {
|
|
19093
|
+
const url = new URL(path12, baseUrl + "/");
|
|
18856
19094
|
if (params) for (const [k, v] of Object.entries(params)) url.searchParams.set(k, v);
|
|
18857
19095
|
const controller = new AbortController();
|
|
18858
19096
|
const timer = setTimeout(() => controller.abort(), timeoutMs);
|
|
@@ -18870,8 +19108,8 @@ async function jiraFetch(baseUrl, path11, auth, timeoutMs, params) {
|
|
|
18870
19108
|
clearTimeout(timer);
|
|
18871
19109
|
}
|
|
18872
19110
|
}
|
|
18873
|
-
async function jiraPost(baseUrl,
|
|
18874
|
-
const url = new URL(
|
|
19111
|
+
async function jiraPost(baseUrl, path12, auth, timeoutMs, body) {
|
|
19112
|
+
const url = new URL(path12, baseUrl + "/");
|
|
18875
19113
|
const controller = new AbortController();
|
|
18876
19114
|
const timer = setTimeout(() => controller.abort(), timeoutMs);
|
|
18877
19115
|
try {
|
|
@@ -19171,7 +19409,7 @@ function findLinkedWorkItem(dir, integrationId, externalId) {
|
|
|
19171
19409
|
for (const art of discoverWorkItems(dir)) {
|
|
19172
19410
|
let data;
|
|
19173
19411
|
try {
|
|
19174
|
-
data =
|
|
19412
|
+
data = matter13(readFile(art.filePath)).data;
|
|
19175
19413
|
} catch {
|
|
19176
19414
|
continue;
|
|
19177
19415
|
}
|
|
@@ -19384,7 +19622,7 @@ async function runIntegrationsImport(dir, id, externalId, opts) {
|
|
|
19384
19622
|
}
|
|
19385
19623
|
|
|
19386
19624
|
// src/core/impact-report.ts
|
|
19387
|
-
import
|
|
19625
|
+
import matter14 from "gray-matter";
|
|
19388
19626
|
function isBroadGlob(glob) {
|
|
19389
19627
|
if (!glob.endsWith("/**")) return false;
|
|
19390
19628
|
const prefix = glob.slice(0, -3);
|
|
@@ -19453,7 +19691,7 @@ function buildImpactReport(dir, opts = {}, now = /* @__PURE__ */ new Date()) {
|
|
|
19453
19691
|
}
|
|
19454
19692
|
}
|
|
19455
19693
|
try {
|
|
19456
|
-
const body =
|
|
19694
|
+
const body = matter14(readFile(wi.filePath)).content;
|
|
19457
19695
|
if (hasSection(body, /acceptance|criterios de aceptaci/i)) withAcceptance++;
|
|
19458
19696
|
else gaps.missing_acceptance_criteria.push(gapItem(wi, "Add an `## Acceptance Criteria` section."));
|
|
19459
19697
|
if (hasSection(body, /definition of done|^#{1,6}\s*dod\b|definici[oó]n de (terminado|hecho)/i)) withDoD++;
|
|
@@ -20530,7 +20768,7 @@ function runAdr(opts = {}) {
|
|
|
20530
20768
|
}
|
|
20531
20769
|
|
|
20532
20770
|
// src/commands/tech.ts
|
|
20533
|
-
import
|
|
20771
|
+
import fs6 from "fs";
|
|
20534
20772
|
var DISCOVERY_FILES = ["architecture-notes.md", "decision-candidates.md"];
|
|
20535
20773
|
var DISCOVERY_DIR = "knowledge/tech/discovery";
|
|
20536
20774
|
function runTechOrganize(dir = cwd()) {
|
|
@@ -20547,7 +20785,7 @@ function runTechOrganize(dir = cwd()) {
|
|
|
20547
20785
|
continue;
|
|
20548
20786
|
}
|
|
20549
20787
|
ensureDir(join(dir, DISCOVERY_DIR));
|
|
20550
|
-
|
|
20788
|
+
fs6.renameSync(from, to);
|
|
20551
20789
|
moved.push(`knowledge/tech/${file} \u2192 ${DISCOVERY_DIR}/${file}`);
|
|
20552
20790
|
}
|
|
20553
20791
|
if (moved.length > 0) {
|
|
@@ -20629,9 +20867,9 @@ function runAssetsUpdate(kind, opts = {}) {
|
|
|
20629
20867
|
}
|
|
20630
20868
|
|
|
20631
20869
|
// src/commands/ready.ts
|
|
20632
|
-
import
|
|
20633
|
-
import
|
|
20634
|
-
import
|
|
20870
|
+
import fs7 from "fs";
|
|
20871
|
+
import path10 from "path";
|
|
20872
|
+
import matter15 from "gray-matter";
|
|
20635
20873
|
function validateReadiness(content, frontmatter) {
|
|
20636
20874
|
const warnings = [];
|
|
20637
20875
|
const body = content.replace(/^---[\s\S]*?---/, "").trim();
|
|
@@ -20685,18 +20923,18 @@ function isResolvedSection(text2) {
|
|
|
20685
20923
|
}
|
|
20686
20924
|
function transitionToReady(filePath) {
|
|
20687
20925
|
const raw = readFile(filePath);
|
|
20688
|
-
const { data, content } =
|
|
20926
|
+
const { data, content } = matter15(raw);
|
|
20689
20927
|
const today3 = (/* @__PURE__ */ new Date()).toISOString().slice(0, 10);
|
|
20690
20928
|
data.status = "ready";
|
|
20691
20929
|
data.ready_at = today3;
|
|
20692
|
-
const newContent =
|
|
20930
|
+
const newContent = matter15.stringify(content, data);
|
|
20693
20931
|
const posix = filePath.replace(/\\/g, "/");
|
|
20694
20932
|
let newPath = filePath;
|
|
20695
20933
|
if (posix.includes("/work-items/draft/")) {
|
|
20696
|
-
const readyDir =
|
|
20934
|
+
const readyDir = path10.dirname(filePath).replace(/[/\\]draft$/, path10.sep + "ready");
|
|
20697
20935
|
ensureDir(readyDir);
|
|
20698
|
-
const fileName =
|
|
20699
|
-
newPath =
|
|
20936
|
+
const fileName = path10.basename(filePath);
|
|
20937
|
+
newPath = path10.join(readyDir, fileName);
|
|
20700
20938
|
}
|
|
20701
20939
|
return { newPath, newContent };
|
|
20702
20940
|
}
|
|
@@ -20729,7 +20967,7 @@ async function runReady(id, opts = {}) {
|
|
|
20729
20967
|
process.exit(1);
|
|
20730
20968
|
}
|
|
20731
20969
|
const raw = readFile(wi.filePath);
|
|
20732
|
-
const { data } =
|
|
20970
|
+
const { data } = matter15(raw);
|
|
20733
20971
|
const source = parseWorkItemSource(data);
|
|
20734
20972
|
const warnings = validateReadiness(raw, data);
|
|
20735
20973
|
log.info(`Work Item found:`);
|
|
@@ -20764,11 +21002,11 @@ async function runReady(id, opts = {}) {
|
|
|
20764
21002
|
const { newPath, newContent } = transitionToReady(wi.filePath);
|
|
20765
21003
|
if (newPath !== wi.filePath) {
|
|
20766
21004
|
writeFile(newPath, newContent);
|
|
20767
|
-
|
|
21005
|
+
fs7.unlinkSync(wi.filePath);
|
|
20768
21006
|
log.success(`Updated status: ready`);
|
|
20769
21007
|
log.success(`Moved file:`);
|
|
20770
|
-
log.info(` ${
|
|
20771
|
-
log.info(` \u2192 ${
|
|
21008
|
+
log.info(` ${path10.relative(dir, wi.filePath)}`);
|
|
21009
|
+
log.info(` \u2192 ${path10.relative(dir, newPath)}`);
|
|
20772
21010
|
} else {
|
|
20773
21011
|
writeFile(wi.filePath, newContent);
|
|
20774
21012
|
log.success(`Updated status: ready`);
|
|
@@ -20779,7 +21017,7 @@ async function runReady(id, opts = {}) {
|
|
|
20779
21017
|
}
|
|
20780
21018
|
|
|
20781
21019
|
// src/commands/admin.ts
|
|
20782
|
-
import
|
|
21020
|
+
import path11 from "path";
|
|
20783
21021
|
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
20784
21022
|
import net from "net";
|
|
20785
21023
|
function isPortAvailable(port, host) {
|
|
@@ -20794,17 +21032,17 @@ function isPortAvailable(port, host) {
|
|
|
20794
21032
|
});
|
|
20795
21033
|
}
|
|
20796
21034
|
function resolveStaticDir() {
|
|
20797
|
-
const __dirname =
|
|
21035
|
+
const __dirname = path11.dirname(fileURLToPath2(import.meta.url));
|
|
20798
21036
|
const candidates = [
|
|
20799
21037
|
// Monorepo development: prefer the freshly built admin over the copy bundled into the CLI dist.
|
|
20800
21038
|
// The CLI build copies admin/dist into dist/admin-dist, but that copy can be stale when the admin
|
|
20801
21039
|
// was rebuilt after the CLI (build order is not guaranteed in `pnpm -r build`). Serving the admin
|
|
20802
21040
|
// package's own dist first ensures `kaddo admin` always shows the current frontend in dev. This
|
|
20803
21041
|
// path does not exist in a published npm install (admin is private), so it falls back below.
|
|
20804
|
-
|
|
20805
|
-
|
|
21042
|
+
path11.resolve(__dirname, "..", "..", "admin", "dist"),
|
|
21043
|
+
path11.resolve(__dirname, "..", "node_modules", "@kaddo", "admin", "dist"),
|
|
20806
21044
|
// Bundled inside CLI dist (npm install)
|
|
20807
|
-
|
|
21045
|
+
path11.resolve(__dirname, "admin-dist")
|
|
20808
21046
|
];
|
|
20809
21047
|
for (const c of candidates) {
|
|
20810
21048
|
if (exists(join(c, "index.html"))) return c;
|
|
@@ -20846,8 +21084,8 @@ async function runAdmin(opts = {}) {
|
|
|
20846
21084
|
}
|
|
20847
21085
|
let adminServer;
|
|
20848
21086
|
try {
|
|
20849
|
-
const __dirname =
|
|
20850
|
-
const bundled =
|
|
21087
|
+
const __dirname = path11.dirname(fileURLToPath2(import.meta.url));
|
|
21088
|
+
const bundled = path11.resolve(__dirname, "admin-server", "index.js");
|
|
20851
21089
|
if (exists(bundled)) {
|
|
20852
21090
|
const { pathToFileURL } = await import("url");
|
|
20853
21091
|
adminServer = await import(pathToFileURL(bundled).href);
|
|
@@ -20904,11 +21142,11 @@ async function runAdmin(opts = {}) {
|
|
|
20904
21142
|
|
|
20905
21143
|
// src/core/work-item-import.ts
|
|
20906
21144
|
import crypto3 from "crypto";
|
|
20907
|
-
import
|
|
20908
|
-
import
|
|
21145
|
+
import fs8 from "fs";
|
|
21146
|
+
import matter17 from "gray-matter";
|
|
20909
21147
|
|
|
20910
21148
|
// src/core/work-items.ts
|
|
20911
|
-
import
|
|
21149
|
+
import matter16 from "gray-matter";
|
|
20912
21150
|
function computeRefinementStatus(wi) {
|
|
20913
21151
|
const aspects = {
|
|
20914
21152
|
outcome: Boolean(wi.currentBehavior?.trim() || wi.targetBehavior?.trim()),
|
|
@@ -20976,6 +21214,8 @@ function getWorkItem(dir, workItemId) {
|
|
|
20976
21214
|
path: match.relPath,
|
|
20977
21215
|
// Faithful source of truth: the artifact body already read above, not reconstructed (WI-025).
|
|
20978
21216
|
markdownBody: body.trim(),
|
|
21217
|
+
// External systems this WI relates to (WI-030), separate from affectedModules (code).
|
|
21218
|
+
resources: parseWorkItemResources(fm2),
|
|
20979
21219
|
...parseSystemImpact(dir, fm2)
|
|
20980
21220
|
};
|
|
20981
21221
|
return { ...detail, refinement: computeRefinementStatus(detail) };
|
|
@@ -20984,8 +21224,8 @@ function parseGraphReason(v) {
|
|
|
20984
21224
|
if (!v || typeof v !== "object") return null;
|
|
20985
21225
|
const o = v;
|
|
20986
21226
|
const relationship = typeof o.relationship === "string" && o.relationship.trim() ? o.relationship.trim() : null;
|
|
20987
|
-
const
|
|
20988
|
-
return relationship ||
|
|
21227
|
+
const path12 = Array.isArray(o.path) ? o.path.map(String).filter(Boolean) : [];
|
|
21228
|
+
return relationship || path12.length ? { relationship, path: path12 } : null;
|
|
20989
21229
|
}
|
|
20990
21230
|
function parseExplain(o) {
|
|
20991
21231
|
const refs = Array.isArray(o.evidence) ? o.evidence : Array.isArray(o.evidence_refs) ? o.evidence_refs : [];
|
|
@@ -21040,7 +21280,7 @@ function parseOriginalSnapshot(fm2) {
|
|
|
21040
21280
|
function readBody(filePath) {
|
|
21041
21281
|
try {
|
|
21042
21282
|
const raw = readFile(filePath);
|
|
21043
|
-
return
|
|
21283
|
+
return matter16(raw).content;
|
|
21044
21284
|
} catch {
|
|
21045
21285
|
return "";
|
|
21046
21286
|
}
|
|
@@ -21499,7 +21739,7 @@ function detectFormat(raw) {
|
|
|
21499
21739
|
if (!trimmed) throw new ImportError("EMPTY_INPUT", "Import content is empty.");
|
|
21500
21740
|
if (trimmed.startsWith("---")) {
|
|
21501
21741
|
try {
|
|
21502
|
-
const { data } =
|
|
21742
|
+
const { data } = matter17(trimmed);
|
|
21503
21743
|
if (data && typeof data === "object" && Object.keys(data).length > 0) {
|
|
21504
21744
|
const d = data;
|
|
21505
21745
|
if (d.type === "work-item" || d.id && typeof d.id === "string" && /^WI-\d+/.test(d.id)) {
|
|
@@ -21521,7 +21761,7 @@ function parseContent(raw) {
|
|
|
21521
21761
|
let bodyText = trimmed;
|
|
21522
21762
|
if (format === "kaddo-frontmatter" || format === "markdown-frontmatter") {
|
|
21523
21763
|
try {
|
|
21524
|
-
const parsed =
|
|
21764
|
+
const parsed = matter17(trimmed);
|
|
21525
21765
|
frontmatterFields = parsed.data ?? {};
|
|
21526
21766
|
bodyText = parsed.content.trim();
|
|
21527
21767
|
} catch {
|
|
@@ -21578,15 +21818,21 @@ function extractSections(body) {
|
|
|
21578
21818
|
flush2();
|
|
21579
21819
|
return sections;
|
|
21580
21820
|
}
|
|
21821
|
+
function deriveShortSummary(parsed) {
|
|
21822
|
+
const paragraph = parsed.body.split(/\n{2,}/).map((p) => p.trim()).find((p) => p && !/^#{1,6}\s/.test(p) && !/^>/.test(p) && p !== parsed.title);
|
|
21823
|
+
const base = paragraph ? paragraph.replace(/\s+/g, " ") : parsed.title;
|
|
21824
|
+
return base.length > 280 ? `${base.slice(0, 277).trimEnd()}\u2026` : base;
|
|
21825
|
+
}
|
|
21581
21826
|
function normalizeImportFields(parsed, opts) {
|
|
21582
21827
|
const discardedFields = [];
|
|
21583
21828
|
for (const key of Object.keys(parsed.candidateFields)) {
|
|
21584
21829
|
if (LIFECYCLE_FIELDS.has(key)) discardedFields.push(key);
|
|
21585
21830
|
}
|
|
21586
21831
|
const type = opts.userType ? normalizeType(opts.userType) ?? "feature" : parsed.type ?? "feature";
|
|
21587
|
-
const
|
|
21588
|
-
|
|
21589
|
-
|
|
21832
|
+
const hasRealBody = !!parsed.body && parsed.body !== parsed.title;
|
|
21833
|
+
const intent = parsed.title;
|
|
21834
|
+
const body = hasRealBody ? parsed.body : void 0;
|
|
21835
|
+
const summary = hasRealBody ? deriveShortSummary(parsed) : parsed.title;
|
|
21590
21836
|
const source = {
|
|
21591
21837
|
type: opts.importSource === "chat" ? "chat" : "external",
|
|
21592
21838
|
imported_at: (/* @__PURE__ */ new Date()).toISOString().split("T")[0]
|
|
@@ -21594,14 +21840,14 @@ ${parsed.body}` : parsed.title;
|
|
|
21594
21840
|
source.source_format = opts.sourceFormat;
|
|
21595
21841
|
source.source_hash = opts.sourceHash;
|
|
21596
21842
|
const snapshot = { title: parsed.title };
|
|
21597
|
-
if (
|
|
21843
|
+
if (summary !== parsed.title) snapshot.description = summary;
|
|
21598
21844
|
if (typeof parsed.candidateFields.type === "string") snapshot.type = parsed.candidateFields.type;
|
|
21599
21845
|
if (typeof parsed.candidateFields.status === "string") snapshot.status = parsed.candidateFields.status;
|
|
21600
21846
|
if (Array.isArray(parsed.candidateFields.labels)) {
|
|
21601
21847
|
const labels = parsed.candidateFields.labels.filter((l) => typeof l === "string");
|
|
21602
21848
|
if (labels.length > 0) snapshot.labels = labels;
|
|
21603
21849
|
}
|
|
21604
|
-
return { type, intent, source, snapshot, discardedFields };
|
|
21850
|
+
return { type, intent, summary, body, source, snapshot, discardedFields };
|
|
21605
21851
|
}
|
|
21606
21852
|
function computeContentHash(raw) {
|
|
21607
21853
|
return crypto3.createHash("sha256").update(raw.trim(), "utf-8").digest("hex");
|
|
@@ -21612,7 +21858,7 @@ function findDuplicateByHash(dir, hash) {
|
|
|
21612
21858
|
const raw = readFile(item.filePath);
|
|
21613
21859
|
if (!raw) continue;
|
|
21614
21860
|
try {
|
|
21615
|
-
const { data } =
|
|
21861
|
+
const { data } = matter17(raw);
|
|
21616
21862
|
const source = data?.source;
|
|
21617
21863
|
if (source && typeof source === "object" && !Array.isArray(source)) {
|
|
21618
21864
|
const s = source;
|
|
@@ -21679,7 +21925,7 @@ function importWorkItem(dir, opts) {
|
|
|
21679
21925
|
};
|
|
21680
21926
|
}
|
|
21681
21927
|
if (opts.onConflict === "replace") {
|
|
21682
|
-
|
|
21928
|
+
fs8.rmSync(existing.filePath, { force: true });
|
|
21683
21929
|
replacedWorkItem = existing.workItemId;
|
|
21684
21930
|
}
|
|
21685
21931
|
}
|
|
@@ -21687,6 +21933,8 @@ function importWorkItem(dir, opts) {
|
|
|
21687
21933
|
const result = createWorkItem(dir, {
|
|
21688
21934
|
intent: normalized.intent,
|
|
21689
21935
|
type: normalized.type,
|
|
21936
|
+
summary: normalized.summary,
|
|
21937
|
+
body: normalized.body,
|
|
21690
21938
|
source: normalized.source,
|
|
21691
21939
|
originalSnapshot: normalized.snapshot
|
|
21692
21940
|
});
|
|
@@ -21826,7 +22074,7 @@ async function runWorkItemImport(dir, fileOrText, opts) {
|
|
|
21826
22074
|
}
|
|
21827
22075
|
|
|
21828
22076
|
// src/commands/verify.ts
|
|
21829
|
-
import
|
|
22077
|
+
import matter18 from "gray-matter";
|
|
21830
22078
|
|
|
21831
22079
|
// src/core/implementation-evidence.ts
|
|
21832
22080
|
var WorkItemNotInProgressError = class extends Error {
|
|
@@ -22103,7 +22351,7 @@ async function runVerify(workItemId, opts = {}) {
|
|
|
22103
22351
|
}
|
|
22104
22352
|
const changedPaths = await getModifiedFiles("head");
|
|
22105
22353
|
const raw = readFile(match.filePath);
|
|
22106
|
-
const parsed =
|
|
22354
|
+
const parsed = matter18(raw);
|
|
22107
22355
|
const fm2 = parsed.data;
|
|
22108
22356
|
const acs = extractACsFromBody(parsed.content);
|
|
22109
22357
|
const existingEvidence = fm2.implementation_evidence;
|
|
@@ -22220,13 +22468,13 @@ async function runVerify(workItemId, opts = {}) {
|
|
|
22220
22468
|
if (shouldPersist) {
|
|
22221
22469
|
const filePath = match.filePath;
|
|
22222
22470
|
const wiRaw = readFile(filePath);
|
|
22223
|
-
const wiParsed =
|
|
22471
|
+
const wiParsed = matter18(wiRaw);
|
|
22224
22472
|
const data = wiParsed.data;
|
|
22225
22473
|
data.implementation_evidence = verification.implementationEvidence;
|
|
22226
22474
|
data.implementation_status = verification.implementationStatus;
|
|
22227
22475
|
data.validation_status = verification.validationStatus;
|
|
22228
22476
|
data.verified_at = (/* @__PURE__ */ new Date()).toISOString().split("T")[0];
|
|
22229
|
-
const newRaw =
|
|
22477
|
+
const newRaw = matter18.stringify(wiParsed.content, data);
|
|
22230
22478
|
writeFile(filePath, newRaw);
|
|
22231
22479
|
log.success("Work Item frontmatter updated with verification evidence.");
|
|
22232
22480
|
}
|
|
@@ -22276,9 +22524,9 @@ function markRegistered(dir, identity) {
|
|
|
22276
22524
|
ensureDir(join(dir, TELEMETRY_DIR));
|
|
22277
22525
|
writeFile(identityPath(dir), JSON.stringify(identity, null, 2));
|
|
22278
22526
|
}
|
|
22279
|
-
function signPayload(identity, method,
|
|
22527
|
+
function signPayload(identity, method, path12, timestamp, nonce, bodySha256) {
|
|
22280
22528
|
const canonical = `${method}
|
|
22281
|
-
${
|
|
22529
|
+
${path12}
|
|
22282
22530
|
${identity.installationId}
|
|
22283
22531
|
${timestamp}
|
|
22284
22532
|
${nonce}
|
|
@@ -22504,7 +22752,7 @@ function runTelemetryDisable() {
|
|
|
22504
22752
|
}
|
|
22505
22753
|
|
|
22506
22754
|
// src/core/initiative-write.ts
|
|
22507
|
-
import
|
|
22755
|
+
import matter19 from "gray-matter";
|
|
22508
22756
|
var WORK_ITEMS_DIR4 = "knowledge/delivery/work-items";
|
|
22509
22757
|
var DRAFT_DIR2 = `${WORK_ITEMS_DIR4}/draft`;
|
|
22510
22758
|
var InitiativeWriteError = class extends Error {
|
|
@@ -22616,7 +22864,7 @@ function buildInitiativeContent(id, input) {
|
|
|
22616
22864
|
if (input.priority) data.priority = input.priority;
|
|
22617
22865
|
if (input.source) data.source = input.source;
|
|
22618
22866
|
if (input.sourceId) data.source_id = input.sourceId;
|
|
22619
|
-
return
|
|
22867
|
+
return matter19.stringify("\n" + (input.body ?? defaultBody(input.title.trim())), data);
|
|
22620
22868
|
}
|
|
22621
22869
|
function createInitiative(dir, input) {
|
|
22622
22870
|
if (!input.title?.trim()) throw new InitiativeWriteError("Initiative title is required.");
|
|
@@ -22640,10 +22888,10 @@ function transitionInitiative(dir, id, to) {
|
|
|
22640
22888
|
throw new InitiativeWriteError(`Invalid transition ${ini.status} \u2192 ${to}.`);
|
|
22641
22889
|
}
|
|
22642
22890
|
const raw = readFile(ini.filePath);
|
|
22643
|
-
const { data, content } =
|
|
22891
|
+
const { data, content } = matter19(raw, {});
|
|
22644
22892
|
data.status = to;
|
|
22645
22893
|
if (to === "completed") data.completed_at = today2();
|
|
22646
|
-
const newContent =
|
|
22894
|
+
const newContent = matter19.stringify(content, data);
|
|
22647
22895
|
writeFile(ini.filePath, newContent);
|
|
22648
22896
|
const updated = parseInitiative(dir, ini.filePath, newContent);
|
|
22649
22897
|
if (!updated) throw new InitiativeWriteError("Failed to parse the Initiative after transition.");
|
|
@@ -22712,7 +22960,7 @@ function buildWorkItemContent(wiId, iniId, candidate) {
|
|
|
22712
22960
|
"_What did we learn? Update after completion._",
|
|
22713
22961
|
""
|
|
22714
22962
|
].join("\n");
|
|
22715
|
-
return
|
|
22963
|
+
return matter19.stringify("\n" + body, data);
|
|
22716
22964
|
}
|
|
22717
22965
|
function materializeCandidate(dir, id, candidateId) {
|
|
22718
22966
|
const ini = getInitiative(dir, id);
|
|
@@ -22729,13 +22977,13 @@ function materializeCandidate(dir, id, candidateId) {
|
|
|
22729
22977
|
ensureDir(join(dir, DRAFT_DIR2));
|
|
22730
22978
|
writeFile(join(dir, DRAFT_DIR2, fileName), buildWorkItemContent(wiId, ini.id, candidate));
|
|
22731
22979
|
const raw = readFile(ini.filePath);
|
|
22732
|
-
const { data, content } =
|
|
22980
|
+
const { data, content } = matter19(raw, {});
|
|
22733
22981
|
const cands = Array.isArray(data.candidates) ? data.candidates : [];
|
|
22734
22982
|
for (const c of cands) {
|
|
22735
22983
|
if (c && typeof c === "object" && String(c.id) === candidateId) c.materialized_as = wiId;
|
|
22736
22984
|
}
|
|
22737
22985
|
data.candidates = cands;
|
|
22738
|
-
const newContent =
|
|
22986
|
+
const newContent = matter19.stringify(content, data);
|
|
22739
22987
|
writeFile(ini.filePath, newContent);
|
|
22740
22988
|
const updated = parseInitiative(dir, ini.filePath, newContent);
|
|
22741
22989
|
if (!updated) throw new InitiativeWriteError("Failed to parse the Initiative after materialization.");
|
|
@@ -23089,8 +23337,8 @@ var capsuleCmd = program.command("capsule").description("Export this project as
|
|
|
23089
23337
|
capsuleCmd.command("export").description("Write a Knowledge Capsule about this project to .kaddo/exports/").option("--scope <scope>", 'Export scope: "system" includes all mapped modules').option("--module <id>", "Export a capsule for a specific mapped module").action((opts) => {
|
|
23090
23338
|
runCapsuleExport(opts);
|
|
23091
23339
|
});
|
|
23092
|
-
capsuleCmd.command("add <path>").description("Register an external Knowledge Capsule as project context (.kaddo/external.yml)").action((
|
|
23093
|
-
runCapsuleAdd(
|
|
23340
|
+
capsuleCmd.command("add <path>").description("Register an external Knowledge Capsule as project context (.kaddo/external.yml)").action((path12) => {
|
|
23341
|
+
runCapsuleAdd(path12);
|
|
23094
23342
|
});
|
|
23095
23343
|
var graphCmd = program.command("graph").description("Export the lightweight, file-based knowledge graph of the project");
|
|
23096
23344
|
graphCmd.command("export").description("Write the knowledge graph to .kaddo/graph.json and .kaddo/graph.mmd").option("--scope <scope>", "Graph scope: active (default) or all").option("--format <format>", "Output format: json, mermaid (default: both)").action((opts) => {
|
|
@@ -23103,6 +23351,9 @@ topologyCmd.command("validate <file>").description("Validate a topology proposal
|
|
|
23103
23351
|
topologyCmd.command("apply <file>").description("Apply a validated topology proposal to the canonical artifact after human confirmation").option("-y, --yes", "Skip the confirmation prompt (for already-approved automation)").action((file, opts) => {
|
|
23104
23352
|
runTopologyApply(file, opts);
|
|
23105
23353
|
});
|
|
23354
|
+
var resourcesCmd = program.command("resources").description("List and inspect Project Resources \u2014 external systems the project uses (read-only, no secrets)");
|
|
23355
|
+
resourcesCmd.command("list").description("List Project Resources defined under knowledge/tech/resources/").option("--json", "Output JSON").action((opts) => runResourcesList(cwd(), opts));
|
|
23356
|
+
resourcesCmd.command("get <id>").description("Show one Project Resource: purpose, interfaces, boundaries and auth references").option("--json", "Output JSON").action((id, opts) => runResourcesGet(id, cwd(), opts));
|
|
23106
23357
|
var integrationsCmd = program.command("integrations").description("Connect Kaddo to external work systems (read-first; import requires human confirmation)");
|
|
23107
23358
|
integrationsCmd.command("list").description("List configured integrations and their capabilities").option("--json", "Output JSON").action((opts) => runIntegrationsList(cwd(), opts));
|
|
23108
23359
|
integrationsCmd.command("status").description("Verify each enabled integration and report its connection status").option("--json", "Output JSON").action(async (opts) => {
|