@kaddo/cli 3.115.0 → 3.116.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.
Files changed (34) hide show
  1. package/dist/admin-dist/assets/{architectureDiagram-3BPJPVTR-YcMJYo0g.js → architectureDiagram-3BPJPVTR-DP6srEcc.js} +1 -1
  2. package/dist/admin-dist/assets/{chunk-727SXJPM-BVnKaPXl.js → chunk-727SXJPM-DnQC9siX.js} +1 -1
  3. package/dist/admin-dist/assets/{chunk-AQP2D5EJ-D_Hcj3zm.js → chunk-AQP2D5EJ-BpyJpCJ-.js} +1 -1
  4. package/dist/admin-dist/assets/{classDiagram-v2-Q7XG4LA2-C1j2IJF8.js → classDiagram-4FO5ZUOK-CGoPFtaR.js} +1 -1
  5. package/dist/admin-dist/assets/{classDiagram-4FO5ZUOK-C1j2IJF8.js → classDiagram-v2-Q7XG4LA2-CGoPFtaR.js} +1 -1
  6. package/dist/admin-dist/assets/{dagre-BM42HDAG-ADdKf6j1.js → dagre-BM42HDAG-CRZz5h6U.js} +1 -1
  7. package/dist/admin-dist/assets/{diagram-2AECGRRQ-Z_xeHBlY.js → diagram-2AECGRRQ-2IUax-pn.js} +1 -1
  8. package/dist/admin-dist/assets/{diagram-5GNKFQAL-Wgzw55l3.js → diagram-5GNKFQAL-Dbar3g31.js} +1 -1
  9. package/dist/admin-dist/assets/{diagram-LMA3HP47-Dj6c7SSM.js → diagram-LMA3HP47-CDpppwwZ.js} +1 -1
  10. package/dist/admin-dist/assets/{diagram-OG6HWLK6-hHqRSSZr.js → diagram-OG6HWLK6-CxJNrhOa.js} +1 -1
  11. package/dist/admin-dist/assets/{erDiagram-TEJ5UH35-BTGBIaZr.js → erDiagram-TEJ5UH35-CqGkUDrY.js} +1 -1
  12. package/dist/admin-dist/assets/{flowDiagram-I6XJVG4X-RZJDjzR6.js → flowDiagram-I6XJVG4X-Dj-jj3Xs.js} +1 -1
  13. package/dist/admin-dist/assets/{ganttDiagram-6RSMTGT7-DI5Lr-xB.js → ganttDiagram-6RSMTGT7-BsslcFFi.js} +1 -1
  14. package/dist/admin-dist/assets/{index-RwMAZcWr.js → index-DVXcBuvj.js} +5 -5
  15. package/dist/admin-dist/assets/{infoDiagram-5YYISTIA-T5KZWjTy.js → infoDiagram-5YYISTIA-Bm8y-W5K.js} +1 -1
  16. package/dist/admin-dist/assets/{ishikawaDiagram-YF4QCWOH-C6Gyb7TQ.js → ishikawaDiagram-YF4QCWOH-B1q-JfoS.js} +1 -1
  17. package/dist/admin-dist/assets/{kanban-definition-UN3LZRKU-Dg8kSuqH.js → kanban-definition-UN3LZRKU-iEF70R2u.js} +1 -1
  18. package/dist/admin-dist/assets/{linear-NG3wfuct.js → linear-Cp_M7piX.js} +1 -1
  19. package/dist/admin-dist/assets/{mindmap-definition-RKZ34NQL-B1dMo93T.js → mindmap-definition-RKZ34NQL-IS3zSxy4.js} +1 -1
  20. package/dist/admin-dist/assets/{pieDiagram-4H26LBE5-iIbw9aCq.js → pieDiagram-4H26LBE5-FRW3jbwa.js} +1 -1
  21. package/dist/admin-dist/assets/{quadrantDiagram-W4KKPZXB-CBsaVubF.js → quadrantDiagram-W4KKPZXB-BWvrA0U2.js} +1 -1
  22. package/dist/admin-dist/assets/{requirementDiagram-4Y6WPE33-CobNACNF.js → requirementDiagram-4Y6WPE33-BDo5C4-W.js} +1 -1
  23. package/dist/admin-dist/assets/{sequenceDiagram-3UESZ5HK-CpE56jux.js → sequenceDiagram-3UESZ5HK-BqkNcdXk.js} +1 -1
  24. package/dist/admin-dist/assets/{stateDiagram-AJRCARHV-pSzN5IAu.js → stateDiagram-AJRCARHV-BPRhmY_L.js} +1 -1
  25. package/dist/admin-dist/assets/{stateDiagram-v2-BHNVJYJU-LhQFrdKp.js → stateDiagram-v2-BHNVJYJU-DqC9KnuP.js} +1 -1
  26. package/dist/admin-dist/assets/{timeline-definition-PNZ67QCA-q4yUdZjI.js → timeline-definition-PNZ67QCA-BKU6Xg5t.js} +1 -1
  27. package/dist/admin-dist/assets/{vennDiagram-CIIHVFJN-D5DxPuNK.js → vennDiagram-CIIHVFJN-BRePJms1.js} +1 -1
  28. package/dist/admin-dist/assets/{wardleyDiagram-YWT4CUSO-451b1uEN.js → wardleyDiagram-YWT4CUSO-BZP5Do-p.js} +1 -1
  29. package/dist/admin-dist/assets/{xychartDiagram-2RQKCTM6-DnOwq6Mk.js → xychartDiagram-2RQKCTM6-Cf0SjuRr.js} +1 -1
  30. package/dist/admin-dist/index.html +1 -1
  31. package/dist/admin-server/index.js +88 -0
  32. package/dist/core.js +284 -85
  33. package/dist/index.js +431 -99
  34. package/package.json +1 -1
package/dist/core.js CHANGED
@@ -130,8 +130,8 @@ function loadConfig(dir) {
130
130
  const parsed = configSchema.safeParse(raw ?? {});
131
131
  if (!parsed.success) {
132
132
  const issues = parsed.error.issues.map((i) => {
133
- const path4 = i.path.join(".");
134
- return path4 ? ` - ${path4}: ${i.message}` : ` - ${i.message}`;
133
+ const path5 = i.path.join(".");
134
+ return path5 ? ` - ${path5}: ${i.message}` : ` - ${i.message}`;
135
135
  }).join("\n");
136
136
  throw new ConfigError(`Invalid .kaddo/config.yml:
137
137
  ${issues}`);
@@ -366,11 +366,11 @@ function moduleArtifactCoverage(dir, id) {
366
366
  };
367
367
  }
368
368
  function loadMappedModules(dir) {
369
- const path4 = join(dir, DESCRIPTOR_PATH);
370
- if (!exists(path4)) return [];
369
+ const path5 = join(dir, DESCRIPTOR_PATH);
370
+ if (!exists(path5)) return [];
371
371
  let parsed;
372
372
  try {
373
- parsed = parseYaml3(readFile(path4));
373
+ parsed = parseYaml3(readFile(path5));
374
374
  } catch {
375
375
  return [];
376
376
  }
@@ -1601,7 +1601,7 @@ function sectionParagraph(md, title) {
1601
1601
  }
1602
1602
  return "";
1603
1603
  }
1604
- function parseCapsule(id, path4, md) {
1604
+ function parseCapsule(id, path5, md) {
1605
1605
  const { data } = matter2(md);
1606
1606
  const updatedAt = data.updated_at ? String(data.updated_at) : void 0;
1607
1607
  let ageDays = null;
@@ -1611,7 +1611,7 @@ function parseCapsule(id, path4, md) {
1611
1611
  }
1612
1612
  return {
1613
1613
  id,
1614
- path: path4,
1614
+ path: path5,
1615
1615
  system: data.system ? String(data.system) : id,
1616
1616
  owner: data.owner ? String(data.owner) : void 0,
1617
1617
  updatedAt,
@@ -1903,6 +1903,18 @@ function parseAuth(v) {
1903
1903
  const refs = strArray(o.refs).filter((r) => !r.includes("=") && /^[A-Za-z0-9_.-]+$/.test(r));
1904
1904
  return { mode: str(o.mode), refs };
1905
1905
  }
1906
+ function parseScope(v) {
1907
+ if (!v || typeof v !== "object" || Array.isArray(v)) return null;
1908
+ const o = v;
1909
+ const type = str(o.type);
1910
+ if (!type) return null;
1911
+ return { type, module: str(o.module) };
1912
+ }
1913
+ function purposeFromBody(body) {
1914
+ const m = body.match(/^#{1,2}\s+Purpose\s*\n+([\s\S]*?)(?=\n#{1,2}\s|\s*$)/m);
1915
+ const text2 = m ? m[1].trim() : "";
1916
+ return text2 || null;
1917
+ }
1906
1918
  function toDetail(filePath, relPath, raw) {
1907
1919
  const parsed = matter4(raw);
1908
1920
  const fm = parsed.data ?? {};
@@ -1914,8 +1926,10 @@ function toDetail(filePath, relPath, raw) {
1914
1926
  resourceType: str(fm.resource_type),
1915
1927
  provider: str(fm.provider),
1916
1928
  environments: strArray(fm.environments),
1929
+ scope: parseScope(fm.scope),
1930
+ modules: strArray(fm.modules),
1917
1931
  path: relPath,
1918
- purpose: str(fm.purpose),
1932
+ purpose: str(fm.purpose) ?? purposeFromBody(body),
1919
1933
  interfaces: parseInterfaces(fm.access_interfaces),
1920
1934
  boundaries: parseBoundaries(fm.access_boundaries),
1921
1935
  ...(() => {
@@ -1934,6 +1948,8 @@ function getResources(dir) {
1934
1948
  resourceType: str(fm.resource_type),
1935
1949
  provider: str(fm.provider),
1936
1950
  environments: strArray(fm.environments),
1951
+ scope: parseScope(fm.scope),
1952
+ modules: strArray(fm.modules),
1937
1953
  path: a.relPath
1938
1954
  };
1939
1955
  }).sort((x, y) => x.id.localeCompare(y.id));
@@ -2004,9 +2020,9 @@ function buildGraph(dir, config, opts = {}, now = /* @__PURE__ */ new Date()) {
2004
2020
  ];
2005
2021
  const presentLayers = [];
2006
2022
  for (const layer of layerDocs) {
2007
- const path4 = layer.files.map((f) => `${KNOWLEDGE2}/${f}`).find((rel) => exists(join(dir, rel)));
2008
- if (path4) {
2009
- addNode({ id: layer.id, type: layer.type, label: layer.label, path: path4 });
2023
+ const path5 = layer.files.map((f) => `${KNOWLEDGE2}/${f}`).find((rel) => exists(join(dir, rel)));
2024
+ if (path5) {
2025
+ addNode({ id: layer.id, type: layer.type, label: layer.label, path: path5 });
2010
2026
  presentLayers.push(layer.id);
2011
2027
  }
2012
2028
  }
@@ -2049,12 +2065,20 @@ function buildGraph(dir, config, opts = {}, now = /* @__PURE__ */ new Date()) {
2049
2065
  const resourceTitleById = /* @__PURE__ */ new Map();
2050
2066
  for (const r of getResources(dir)) {
2051
2067
  resourceTitleById.set(r.id, r.title);
2068
+ const resId = `resource:${r.id}`;
2052
2069
  addNode({
2053
- id: `resource:${r.id}`,
2070
+ id: resId,
2054
2071
  type: "project-resource",
2055
2072
  label: r.title ? `${r.id} ${r.title}`.trim() : r.id,
2056
2073
  path: r.path
2057
2074
  });
2075
+ const depModules = new Set(r.modules);
2076
+ if (r.scope?.type === "module" && r.scope.module) depModules.add(r.scope.module);
2077
+ for (const mod of depModules) {
2078
+ const modId = `module:${mod}`;
2079
+ addNode({ id: modId, type: "module", label: mod });
2080
+ addEdge(modId, resId, "depends_on");
2081
+ }
2058
2082
  }
2059
2083
  for (const wi of selectedWIs) {
2060
2084
  const id = wi.id || wi.title;
@@ -3448,10 +3472,10 @@ function resolveNextStep(dir, now = /* @__PURE__ */ new Date()) {
3448
3472
  const q = (rel) => analyzeKnowledgeArtifact(dir, rel);
3449
3473
  const resolveAgent = (agent) => {
3450
3474
  const file = agent.endsWith(".md") ? agent : `${agent}.md`;
3451
- const path4 = agentInstallPath(file);
3452
- const installed = isFile(join(dir, path4));
3475
+ const path5 = agentInstallPath(file);
3476
+ const installed = isFile(join(dir, path5));
3453
3477
  const group = agentGroupOf(file);
3454
- return { agentPath: path4, agentInstalled: installed, installCommand: installed ? void 0 : `kaddo add agents --group ${group}` };
3478
+ return { agentPath: path5, agentInstalled: installed, installCommand: installed ? void 0 : `kaddo add agents --group ${group}` };
3455
3479
  };
3456
3480
  const moduleRepo = isModule(config);
3457
3481
  const coreRepo = isCore(config);
@@ -5206,6 +5230,16 @@ supporting notes as \`knowledge/tech/discovery/architecture-notes.md\` and decis
5206
5230
  under \`knowledge/tech/decisions/\`. Kaddo still reads the legacy root locations for backward
5207
5231
  compatibility, but new output should use \`discovery/\`.
5208
5232
 
5233
+ ## Project Resource candidates
5234
+
5235
+ When the knowledge describes an external system the project depends on (a database, cloud account,
5236
+ API, queue, storage, service\u2026), you may propose it as a **candidate** Project Resource \u2014 never create
5237
+ it silently. Discovery \u2260 creation: present candidates for human review and materialize only through
5238
+ \`kaddo_create_resource\` / \`kaddo resources create\` with explicit confirmation. Ground every
5239
+ candidate in the knowledge (no guessing from ambiguous names). Model the stable system, not its access
5240
+ interface (CLI/MCP/SQL/API are interfaces); keep \`resources\` separate from \`affected_modules\`; and
5241
+ never include secret values \u2014 only reference names.
5242
+
5209
5243
  ## Quality Checklist
5210
5244
 
5211
5245
  - Every component is backed by evidence from the context pack.
@@ -8198,6 +8232,164 @@ function buildProjectExplanation(dir) {
8198
8232
  };
8199
8233
  }
8200
8234
 
8235
+ // src/core/resource-write.ts
8236
+ import fs2 from "fs";
8237
+ import path2 from "path";
8238
+ import matter8 from "gray-matter";
8239
+ var RESOURCES_DIR = "knowledge/tech/resources";
8240
+ var ResourceWriteError = class extends Error {
8241
+ constructor(code, message) {
8242
+ super(message);
8243
+ this.code = code;
8244
+ this.name = "ResourceWriteError";
8245
+ }
8246
+ code;
8247
+ };
8248
+ function slug3(s) {
8249
+ return s.toLowerCase().trim().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "").slice(0, 60);
8250
+ }
8251
+ function atomicWrite(filePath, content) {
8252
+ const tmp = `${filePath}.tmp-${process.pid}-${Date.now()}`;
8253
+ fs2.writeFileSync(tmp, content, "utf-8");
8254
+ fs2.renameSync(tmp, filePath);
8255
+ }
8256
+ function sanitizeRefs(refs) {
8257
+ if (!Array.isArray(refs)) return [];
8258
+ return refs.map((r) => String(r).trim()).filter((r) => r && !r.includes("=") && /^[A-Za-z0-9_.-]+$/.test(r));
8259
+ }
8260
+ function allResourceArtifacts(dir) {
8261
+ return discoverKnowledge(dir).filter((a) => a.type === RESOURCE_ARTIFACT_TYPE);
8262
+ }
8263
+ function nextResourceId(dir, title, explicit) {
8264
+ const existing = new Set(allResourceArtifacts(dir).map((a) => (a.id || "").toUpperCase()));
8265
+ if (explicit && explicit.trim()) return explicit.trim();
8266
+ const base = `RES-${slug3(title) || "resource"}`;
8267
+ if (!existing.has(base.toUpperCase())) return base;
8268
+ for (let i = 2; i < 1e3; i++) {
8269
+ const candidate = `${base}-${i}`;
8270
+ if (!existing.has(candidate.toUpperCase())) return candidate;
8271
+ }
8272
+ throw new ResourceWriteError("ID_EXHAUSTED", `Could not derive a unique id for "${title}".`);
8273
+ }
8274
+ function validateResource(dir, input) {
8275
+ const findings = [];
8276
+ if (input.resourceType && !RESOURCE_TYPES.includes(input.resourceType)) {
8277
+ findings.push({ level: "warning", message: `Unknown resource_type "${input.resourceType}" (not in the known set).` });
8278
+ }
8279
+ for (const i of input.accessInterfaces ?? []) {
8280
+ if (i.type && !INTERFACE_TYPES.includes(i.type)) {
8281
+ findings.push({ level: "warning", message: `Unknown access interface type "${i.type}".` });
8282
+ }
8283
+ }
8284
+ const mapped = loadMappedModules(dir).map((m) => m.id);
8285
+ if (mapped.length > 0) {
8286
+ const refs = /* @__PURE__ */ new Set();
8287
+ if (input.scope?.type === "module" && input.scope.module) refs.add(input.scope.module);
8288
+ for (const m of input.modules ?? []) refs.add(m);
8289
+ for (const m of refs) {
8290
+ if (!mapped.includes(m)) findings.push({ level: "warning", message: `Module "${m}" is not in .kaddo/modules.yml.` });
8291
+ }
8292
+ }
8293
+ if (input.scope && input.scope.type === "module" && !input.scope.module) {
8294
+ findings.push({ level: "error", message: 'scope.type "module" requires a module id.' });
8295
+ }
8296
+ return findings;
8297
+ }
8298
+ function buildFrontmatter(id, input, base = {}) {
8299
+ const data = { ...base };
8300
+ data.type = RESOURCE_ARTIFACT_TYPE;
8301
+ data.id = id;
8302
+ if (input.title != null) data.title = input.title;
8303
+ if (input.resourceType != null) data.resource_type = input.resourceType;
8304
+ if (input.provider != null) data.provider = input.provider;
8305
+ if (input.environments != null) data.environments = input.environments;
8306
+ if (input.scope != null) data.scope = input.scope.module ? { type: input.scope.type, module: input.scope.module } : { type: input.scope.type };
8307
+ if (input.modules != null) data.modules = input.modules;
8308
+ if (input.accessInterfaces != null) data.access_interfaces = input.accessInterfaces;
8309
+ if (input.accessBoundaries != null) data.access_boundaries = input.accessBoundaries;
8310
+ if (input.authentication != null) {
8311
+ const mode = input.authentication.mode;
8312
+ const refs = sanitizeRefs(input.authentication.refs);
8313
+ data.authentication = { ...mode ? { mode } : {}, ...refs.length ? { refs } : {} };
8314
+ }
8315
+ return data;
8316
+ }
8317
+ function serialize(data, body) {
8318
+ return matter8.stringify(`
8319
+ ${body.trim()}
8320
+ `, data);
8321
+ }
8322
+ function createResource(dir, input) {
8323
+ const title = (input.title ?? "").trim();
8324
+ if (!title) throw new ResourceWriteError("INVALID_INPUT", "A resource title is required.");
8325
+ const resourceType = (input.resourceType ?? "").trim();
8326
+ if (!resourceType) throw new ResourceWriteError("INVALID_INPUT", "A resource_type is required.");
8327
+ const findings = validateResource(dir, input);
8328
+ if (findings.some((f) => f.level === "error")) {
8329
+ throw new ResourceWriteError("VALIDATION_FAILED", findings.filter((f) => f.level === "error").map((f) => f.message).join("; "));
8330
+ }
8331
+ const existing = allResourceArtifacts(dir);
8332
+ if (input.id && existing.some((a) => (a.id || "").toUpperCase() === input.id.toUpperCase())) {
8333
+ throw new ResourceWriteError("DUPLICATE", `A resource with id "${input.id}" already exists.`);
8334
+ }
8335
+ if (existing.some((a) => (a.title || "").toLowerCase() === title.toLowerCase())) {
8336
+ throw new ResourceWriteError("DUPLICATE", `A resource titled "${title}" already exists.`);
8337
+ }
8338
+ const id = nextResourceId(dir, title, input.id);
8339
+ const data = buildFrontmatter(id, input);
8340
+ const body = `# Purpose
8341
+
8342
+ ${(input.purpose ?? "").trim() || "TODO: describe what this resource is for."}`;
8343
+ const relPath = `${RESOURCES_DIR}/${slug3(title) || slug3(id)}.md`;
8344
+ const filePath = join(dir, relPath);
8345
+ if (exists(filePath)) throw new ResourceWriteError("DUPLICATE", `Resource file already exists: ${relPath}`);
8346
+ ensureDir(path2.dirname(filePath));
8347
+ atomicWrite(filePath, serialize(data, body));
8348
+ return { id, path: relPath, findings };
8349
+ }
8350
+ function updateResource(dir, id, input) {
8351
+ const match = allResourceArtifacts(dir).find((a) => a.id === id || a.title === id);
8352
+ if (!match) throw new ResourceWriteError("NOT_FOUND", `Project Resource "${id}" not found.`);
8353
+ const findings = validateResource(dir, input);
8354
+ if (findings.some((f) => f.level === "error")) {
8355
+ throw new ResourceWriteError("VALIDATION_FAILED", findings.filter((f) => f.level === "error").map((f) => f.message).join("; "));
8356
+ }
8357
+ const raw = readFile(match.filePath);
8358
+ const parsed = matter8(raw);
8359
+ const base = parsed.data ?? {};
8360
+ const data = buildFrontmatter(match.id || id, input, base);
8361
+ let body = parsed.content.trim();
8362
+ if (input.purpose != null) {
8363
+ const purpose = `# Purpose
8364
+
8365
+ ${input.purpose.trim()}`;
8366
+ body = /^#\s+Purpose/m.test(body) ? body.replace(/#\s+Purpose[\s\S]*?(?=\n#\s|\n*$)/, purpose + "\n") : `${purpose}
8367
+
8368
+ ${body}`.trim();
8369
+ }
8370
+ atomicWrite(match.filePath, serialize(data, body));
8371
+ return { id: match.id || id, path: match.relPath, findings };
8372
+ }
8373
+ function getResourceReferences(dir, id) {
8374
+ const refs = [];
8375
+ for (const wi of discoverWorkItems(dir)) {
8376
+ for (const rel of parseWorkItemResources(wi.rawFrontmatter)) {
8377
+ if (rel.id === id) refs.push({ kind: "work-item", id: wi.id || wi.title, role: rel.role, path: wi.relPath });
8378
+ }
8379
+ }
8380
+ return refs;
8381
+ }
8382
+ function deleteResource(dir, id, opts = {}) {
8383
+ const match = allResourceArtifacts(dir).find((a) => a.id === id || a.title === id);
8384
+ if (!match) throw new ResourceWriteError("NOT_FOUND", `Project Resource "${id}" not found.`);
8385
+ const references = getResourceReferences(dir, match.id || id);
8386
+ if (!opts.confirm) {
8387
+ return { deleted: false, preview: { id: match.id || id, references } };
8388
+ }
8389
+ fs2.rmSync(match.filePath, { force: true });
8390
+ return { deleted: true, path: match.relPath };
8391
+ }
8392
+
8201
8393
  // src/core/scope-coverage.ts
8202
8394
  var VALID_CONFIDENCE_LEVELS = /* @__PURE__ */ new Set(["high", "medium", "low"]);
8203
8395
  var VALID_COVERAGE_STATUSES2 = /* @__PURE__ */ new Set(["affected", "reviewed-not-affected", "unknown", "not-applicable"]);
@@ -8434,12 +8626,12 @@ function analyzeCrossRepoEvidence(input) {
8434
8626
  }
8435
8627
 
8436
8628
  // src/core/work-items.ts
8437
- import matter8 from "gray-matter";
8629
+ import matter9 from "gray-matter";
8438
8630
 
8439
8631
  // src/core/system-topology.ts
8440
8632
  import { parse as parseYaml8, stringify as stringifyYaml4 } from "yaml";
8441
- import fs2 from "fs";
8442
- import path2 from "path";
8633
+ import fs3 from "fs";
8634
+ import path3 from "path";
8443
8635
  import crypto from "crypto";
8444
8636
  var TOPOLOGY_FILE = "knowledge/tech/system-topology.yml";
8445
8637
  var SYSTEM_ENTITY_KINDS = /* @__PURE__ */ new Set([
@@ -8607,15 +8799,15 @@ function serializeTopology(entities, relationships) {
8607
8799
  };
8608
8800
  return stringifyYaml4(doc);
8609
8801
  }
8610
- function atomicWrite(filePath, content) {
8611
- fs2.mkdirSync(path2.dirname(filePath), { recursive: true });
8802
+ function atomicWrite2(filePath, content) {
8803
+ fs3.mkdirSync(path3.dirname(filePath), { recursive: true });
8612
8804
  const tmp = `${filePath}.${process.pid}.${Date.now()}.tmp`;
8613
- fs2.writeFileSync(tmp, content, "utf-8");
8805
+ fs3.writeFileSync(tmp, content, "utf-8");
8614
8806
  try {
8615
- fs2.renameSync(tmp, filePath);
8807
+ fs3.renameSync(tmp, filePath);
8616
8808
  } catch (err) {
8617
8809
  try {
8618
- fs2.rmSync(tmp, { force: true });
8810
+ fs3.rmSync(tmp, { force: true });
8619
8811
  } catch {
8620
8812
  }
8621
8813
  throw err;
@@ -8649,7 +8841,7 @@ function applyTopologyProposal(dir, proposalYaml, expectedRevision) {
8649
8841
  const raw = serializeTopology([...entityMap.values()], [...relMap.values()]);
8650
8842
  const finalCheck = validateTopologyProposal(dir, raw);
8651
8843
  if (!finalCheck.canApply) throw new TopologyWriteError("TOPOLOGY_INVALID", "The merged topology is invalid; no changes were written.");
8652
- atomicWrite(join(dir, TOPOLOGY_FILE), raw);
8844
+ atomicWrite2(join(dir, TOPOLOGY_FILE), raw);
8653
8845
  return { revision: topologyRevision(dir), entitiesNew, entitiesUpdated, relationshipsNew };
8654
8846
  }
8655
8847
  function buildTopologyEnrichmentHandoff(dir, projectName) {
@@ -8814,8 +9006,8 @@ function parseGraphReason(v) {
8814
9006
  if (!v || typeof v !== "object") return null;
8815
9007
  const o = v;
8816
9008
  const relationship = typeof o.relationship === "string" && o.relationship.trim() ? o.relationship.trim() : null;
8817
- const path4 = Array.isArray(o.path) ? o.path.map(String).filter(Boolean) : [];
8818
- return relationship || path4.length ? { relationship, path: path4 } : null;
9009
+ const path5 = Array.isArray(o.path) ? o.path.map(String).filter(Boolean) : [];
9010
+ return relationship || path5.length ? { relationship, path: path5 } : null;
8819
9011
  }
8820
9012
  function parseExplain(o) {
8821
9013
  const refs = Array.isArray(o.evidence) ? o.evidence : Array.isArray(o.evidence_refs) ? o.evidence_refs : [];
@@ -8870,7 +9062,7 @@ function parseOriginalSnapshot(fm) {
8870
9062
  function readBody(filePath) {
8871
9063
  try {
8872
9064
  const raw = readFile(filePath);
8873
- return matter8(raw).content;
9065
+ return matter9(raw).content;
8874
9066
  } catch {
8875
9067
  return "";
8876
9068
  }
@@ -9034,10 +9226,10 @@ function parseRelatedKnowledge(fm, knowledgeById) {
9034
9226
  }
9035
9227
 
9036
9228
  // src/core/work-item-write.ts
9037
- import fs3 from "fs";
9038
- import path3 from "path";
9229
+ import fs4 from "fs";
9230
+ import path4 from "path";
9039
9231
  import crypto2 from "crypto";
9040
- import matter9 from "gray-matter";
9232
+ import matter10 from "gray-matter";
9041
9233
 
9042
9234
  // src/core/knowledge-levels.ts
9043
9235
  var WORK_ITEM_TYPES2 = ["feature", "bugfix", "hotfix", "spike", "chore"];
@@ -9249,7 +9441,7 @@ function nextWorkItemId(dir) {
9249
9441
  let max = 0;
9250
9442
  const walk = (d) => {
9251
9443
  if (!exists(d)) return;
9252
- for (const entry of fs3.readdirSync(d)) {
9444
+ for (const entry of fs4.readdirSync(d)) {
9253
9445
  const full = join(d, entry);
9254
9446
  if (isFile(full)) {
9255
9447
  const m = entry.match(/WI-(\d+)/);
@@ -9262,15 +9454,15 @@ function nextWorkItemId(dir) {
9262
9454
  walk(wiDir);
9263
9455
  return `WI-${String(max + 1).padStart(3, "0")}`;
9264
9456
  }
9265
- function atomicWrite2(filePath, content) {
9266
- fs3.mkdirSync(path3.dirname(filePath), { recursive: true });
9457
+ function atomicWrite3(filePath, content) {
9458
+ fs4.mkdirSync(path4.dirname(filePath), { recursive: true });
9267
9459
  const tmp = `${filePath}.${process.pid}.${Date.now()}.tmp`;
9268
- fs3.writeFileSync(tmp, content, "utf-8");
9460
+ fs4.writeFileSync(tmp, content, "utf-8");
9269
9461
  try {
9270
- fs3.renameSync(tmp, filePath);
9462
+ fs4.renameSync(tmp, filePath);
9271
9463
  } catch (err) {
9272
9464
  try {
9273
- fs3.rmSync(tmp, { force: true });
9465
+ fs4.rmSync(tmp, { force: true });
9274
9466
  } catch {
9275
9467
  }
9276
9468
  throw err;
@@ -9443,8 +9635,8 @@ function applyFrontmatter(data, input) {
9443
9635
  else delete next.related_knowledge;
9444
9636
  return next;
9445
9637
  }
9446
- function serialize(data, body) {
9447
- return matter9.stringify(`
9638
+ function serialize2(data, body) {
9639
+ return matter10.stringify(`
9448
9640
  ${body.trim()}
9449
9641
  `, data);
9450
9642
  }
@@ -9503,7 +9695,7 @@ function toInput(data, content) {
9503
9695
  function getWorkItemForEdit(dir, id) {
9504
9696
  const { filePath, relPath } = findArtifact(dir, id);
9505
9697
  const raw = readFile(filePath);
9506
- const { data, content } = matter9(raw);
9698
+ const { data, content } = matter10(raw);
9507
9699
  const status = lifecycleStateOf({ status: String(data.status ?? ""), filePath });
9508
9700
  const input = toInput(data, content);
9509
9701
  const editable = EDITABLE_STATES.includes(status);
@@ -9581,8 +9773,8 @@ function createWorkItem(dir, opts) {
9581
9773
  const relPath = `${WORK_ITEMS_DIR}/draft/${id}-${slugify2(title)}.md`;
9582
9774
  const filePath = join(dir, relPath);
9583
9775
  if (exists(filePath)) throw new WorkItemWriteError("INVALID_INPUT", `Work Item file already exists: ${relPath}`);
9584
- const raw = serialize(data, body);
9585
- atomicWrite2(filePath, raw);
9776
+ const raw = serialize2(data, body);
9777
+ atomicWrite3(filePath, raw);
9586
9778
  return { id, path: relPath, revision: revisionOf(raw) };
9587
9779
  }
9588
9780
  function validateInput(input) {
@@ -9596,21 +9788,21 @@ function updateWorkItem(dir, id, input, expectedRevision) {
9596
9788
  if (revisionOf(raw) !== expectedRevision) {
9597
9789
  throw new WorkItemWriteError("WORK_ITEM_CONFLICT", "This Work Item changed outside Kaddo Admin. Reload the latest version before saving.");
9598
9790
  }
9599
- const { data, content } = matter9(raw);
9791
+ const { data, content } = matter10(raw);
9600
9792
  const status = lifecycleStateOf({ status: String(data.status ?? ""), filePath });
9601
9793
  if (!EDITABLE_STATES.includes(status)) {
9602
9794
  throw new WorkItemWriteError("WORK_ITEM_NOT_EDITABLE", `A ${status} Work Item cannot be edited. Reopen it as Draft first.`);
9603
9795
  }
9604
9796
  const nextData = applyFrontmatter(data, input);
9605
9797
  const nextBody = mergeBody(content, input);
9606
- const nextRaw = serialize(nextData, nextBody);
9607
- atomicWrite2(filePath, nextRaw);
9798
+ const nextRaw = serialize2(nextData, nextBody);
9799
+ atomicWrite3(filePath, nextRaw);
9608
9800
  return { revision: revisionOf(nextRaw), path: relPath };
9609
9801
  }
9610
9802
  function validateWorkItem(dir, id) {
9611
9803
  const { filePath } = findArtifact(dir, id);
9612
9804
  const raw = readFile(filePath);
9613
- const { data, content } = matter9(raw);
9805
+ const { data, content } = matter10(raw);
9614
9806
  const input = toInput(data, content);
9615
9807
  const findings = [];
9616
9808
  const modules = validModuleIds(dir);
@@ -9663,7 +9855,7 @@ function transitionWorkItem(dir, id, to, expectedRevision) {
9663
9855
  if (revisionOf(raw) !== expectedRevision) {
9664
9856
  throw new WorkItemWriteError("WORK_ITEM_CONFLICT", "This Work Item changed outside Kaddo Admin. Reload the latest version before continuing.");
9665
9857
  }
9666
- const { data, content } = matter9(raw);
9858
+ const { data, content } = matter10(raw);
9667
9859
  const from = lifecycleStateOf({ status: String(data.status ?? ""), filePath });
9668
9860
  if (!(ALLOWED[from] ?? []).includes(to)) {
9669
9861
  throw new WorkItemWriteError("INVALID_TRANSITION", `Cannot transition a ${from} Work Item to ${to}.`);
@@ -9673,14 +9865,14 @@ function transitionWorkItem(dir, id, to, expectedRevision) {
9673
9865
  if (!canMarkReady) throw new WorkItemWriteError("INVALID_TRANSITION", "This Work Item has blocking issues and cannot be marked Ready.");
9674
9866
  }
9675
9867
  const nextData = { ...data, status: to };
9676
- const nextRaw = serialize(nextData, content);
9677
- const filename = path3.basename(filePath);
9868
+ const nextRaw = serialize2(nextData, content);
9869
+ const filename = path4.basename(filePath);
9678
9870
  const targetRel = `${WORK_ITEMS_DIR}/${to}/${filename}`;
9679
9871
  const targetPath = join(dir, targetRel);
9680
- atomicWrite2(targetPath, nextRaw);
9681
- if (path3.resolve(targetPath) !== path3.resolve(filePath)) {
9872
+ atomicWrite3(targetPath, nextRaw);
9873
+ if (path4.resolve(targetPath) !== path4.resolve(filePath)) {
9682
9874
  try {
9683
- fs3.rmSync(filePath, { force: true });
9875
+ fs4.rmSync(filePath, { force: true });
9684
9876
  } catch {
9685
9877
  }
9686
9878
  }
@@ -9929,16 +10121,16 @@ function findSystemPaths(dir, source, target, opts = {}) {
9929
10121
  out.get(r.source).push(r.target);
9930
10122
  }
9931
10123
  const paths = [];
9932
- const walk = (node, path4) => {
10124
+ const walk = (node, path5) => {
9933
10125
  if (paths.length >= 20) return;
9934
- if (node === target && path4.length > 1) {
9935
- paths.push([...path4]);
10126
+ if (node === target && path5.length > 1) {
10127
+ paths.push([...path5]);
9936
10128
  return;
9937
10129
  }
9938
- if (path4.length > maxDepth) return;
10130
+ if (path5.length > maxDepth) return;
9939
10131
  for (const nxt of out.get(node) ?? []) {
9940
- if (path4.includes(nxt)) continue;
9941
- walk(nxt, [...path4, nxt]);
10132
+ if (path5.includes(nxt)) continue;
10133
+ walk(nxt, [...path5, nxt]);
9942
10134
  }
9943
10135
  };
9944
10136
  walk(source, [source]);
@@ -9963,14 +10155,14 @@ function getImpactCandidates(dir, seedIds, opts = {}) {
9963
10155
  existing.reason.push(reason);
9964
10156
  continue;
9965
10157
  }
9966
- const path4 = findSystemPaths(dir, seed, n.id, { maxDepth: opts.maxDepth ?? DEFAULT_MAX_DEPTH })[0];
10158
+ const path5 = findSystemPaths(dir, seed, n.id, { maxDepth: opts.maxDepth ?? DEFAULT_MAX_DEPTH })[0];
9967
10159
  candidates.set(n.id, {
9968
10160
  nodeId: n.id,
9969
10161
  label: n.label,
9970
10162
  kind: n.type,
9971
10163
  ...n.moduleId ? { moduleId: n.moduleId } : {},
9972
10164
  reason: [reason],
9973
- ...path4 ? { graphPath: path4.map((id) => byId.get(id)?.label ?? id) } : {},
10165
+ ...path5 ? { graphPath: path5.map((id) => byId.get(id)?.label ?? id) } : {},
9974
10166
  ...n.implementationRefs?.length ? { implementationRefs: n.implementationRefs } : {},
9975
10167
  ...n.knowledgeRefs?.length ? { knowledgeRefs: n.knowledgeRefs } : {},
9976
10168
  status: "candidate",
@@ -10541,8 +10733,8 @@ function deriveImplementationStatus(repos) {
10541
10733
 
10542
10734
  // src/core/work-item-import.ts
10543
10735
  import crypto3 from "crypto";
10544
- import fs4 from "fs";
10545
- import matter10 from "gray-matter";
10736
+ import fs5 from "fs";
10737
+ import matter11 from "gray-matter";
10546
10738
  var MAX_INPUT_BYTES = 102400;
10547
10739
  var LIFECYCLE_FIELDS = /* @__PURE__ */ new Set([
10548
10740
  "id",
@@ -10564,7 +10756,7 @@ function detectFormat(raw) {
10564
10756
  if (!trimmed) throw new ImportError("EMPTY_INPUT", "Import content is empty.");
10565
10757
  if (trimmed.startsWith("---")) {
10566
10758
  try {
10567
- const { data } = matter10(trimmed);
10759
+ const { data } = matter11(trimmed);
10568
10760
  if (data && typeof data === "object" && Object.keys(data).length > 0) {
10569
10761
  const d = data;
10570
10762
  if (d.type === "work-item" || d.id && typeof d.id === "string" && /^WI-\d+/.test(d.id)) {
@@ -10586,7 +10778,7 @@ function parseContent(raw) {
10586
10778
  let bodyText = trimmed;
10587
10779
  if (format === "kaddo-frontmatter" || format === "markdown-frontmatter") {
10588
10780
  try {
10589
- const parsed = matter10(trimmed);
10781
+ const parsed = matter11(trimmed);
10590
10782
  frontmatterFields = parsed.data ?? {};
10591
10783
  bodyText = parsed.content.trim();
10592
10784
  } catch {
@@ -10683,7 +10875,7 @@ function findDuplicateByHash(dir, hash) {
10683
10875
  const raw = readFile(item.filePath);
10684
10876
  if (!raw) continue;
10685
10877
  try {
10686
- const { data } = matter10(raw);
10878
+ const { data } = matter11(raw);
10687
10879
  const source = data?.source;
10688
10880
  if (source && typeof source === "object" && !Array.isArray(source)) {
10689
10881
  const s = source;
@@ -10750,7 +10942,7 @@ function importWorkItem(dir, opts) {
10750
10942
  };
10751
10943
  }
10752
10944
  if (opts.onConflict === "replace") {
10753
- fs4.rmSync(existing.filePath, { force: true });
10945
+ fs5.rmSync(existing.filePath, { force: true });
10754
10946
  replacedWorkItem = existing.workItemId;
10755
10947
  }
10756
10948
  }
@@ -10792,7 +10984,7 @@ var ImportError = class extends Error {
10792
10984
  };
10793
10985
 
10794
10986
  // src/services/integrations.ts
10795
- import matter11 from "gray-matter";
10987
+ import matter12 from "gray-matter";
10796
10988
  import { parse as parseYaml9, stringify as stringifyYaml5 } from "yaml";
10797
10989
 
10798
10990
  // ../integrations/src/errors.ts
@@ -11561,8 +11753,8 @@ async function handleJiraResponse(res) {
11561
11753
  }
11562
11754
  return await res.json();
11563
11755
  }
11564
- async function jiraFetch(baseUrl, path4, auth, timeoutMs, params) {
11565
- const url = new URL(path4, baseUrl + "/");
11756
+ async function jiraFetch(baseUrl, path5, auth, timeoutMs, params) {
11757
+ const url = new URL(path5, baseUrl + "/");
11566
11758
  if (params) for (const [k, v] of Object.entries(params)) url.searchParams.set(k, v);
11567
11759
  const controller = new AbortController();
11568
11760
  const timer = setTimeout(() => controller.abort(), timeoutMs);
@@ -11580,8 +11772,8 @@ async function jiraFetch(baseUrl, path4, auth, timeoutMs, params) {
11580
11772
  clearTimeout(timer);
11581
11773
  }
11582
11774
  }
11583
- async function jiraPost(baseUrl, path4, auth, timeoutMs, body) {
11584
- const url = new URL(path4, baseUrl + "/");
11775
+ async function jiraPost(baseUrl, path5, auth, timeoutMs, body) {
11776
+ const url = new URL(path5, baseUrl + "/");
11585
11777
  const controller = new AbortController();
11586
11778
  const timer = setTimeout(() => controller.abort(), timeoutMs);
11587
11779
  try {
@@ -12134,7 +12326,7 @@ function findLinkedWorkItem(dir, integrationId, externalId) {
12134
12326
  for (const art of discoverWorkItems(dir)) {
12135
12327
  let data;
12136
12328
  try {
12137
- data = matter11(readFile(art.filePath)).data;
12329
+ data = matter12(readFile(art.filePath)).data;
12138
12330
  } catch {
12139
12331
  continue;
12140
12332
  }
@@ -12150,7 +12342,7 @@ function buildImportIndex(dir) {
12150
12342
  for (const art of discoverWorkItems(dir)) {
12151
12343
  let data;
12152
12344
  try {
12153
- data = matter11(readFile(art.filePath)).data;
12345
+ data = matter12(readFile(art.filePath)).data;
12154
12346
  } catch {
12155
12347
  continue;
12156
12348
  }
@@ -12326,7 +12518,7 @@ function getStatus(dir) {
12326
12518
  }
12327
12519
 
12328
12520
  // src/core/initiative-write.ts
12329
- import matter12 from "gray-matter";
12521
+ import matter13 from "gray-matter";
12330
12522
  var WORK_ITEMS_DIR2 = "knowledge/delivery/work-items";
12331
12523
  var DRAFT_DIR = `${WORK_ITEMS_DIR2}/draft`;
12332
12524
  var ROADMAP_PATH2 = "knowledge/delivery/roadmap.md";
@@ -12439,7 +12631,7 @@ function buildInitiativeContent(id, input) {
12439
12631
  if (input.priority) data.priority = input.priority;
12440
12632
  if (input.source) data.source = input.source;
12441
12633
  if (input.sourceId) data.source_id = input.sourceId;
12442
- return matter12.stringify("\n" + (input.body ?? defaultBody(input.title.trim())), data);
12634
+ return matter13.stringify("\n" + (input.body ?? defaultBody(input.title.trim())), data);
12443
12635
  }
12444
12636
  function createInitiative(dir, input) {
12445
12637
  if (!input.title?.trim()) throw new InitiativeWriteError("Initiative title is required.");
@@ -12463,10 +12655,10 @@ function transitionInitiative(dir, id, to) {
12463
12655
  throw new InitiativeWriteError(`Invalid transition ${ini.status} \u2192 ${to}.`);
12464
12656
  }
12465
12657
  const raw = readFile(ini.filePath);
12466
- const { data, content } = matter12(raw, {});
12658
+ const { data, content } = matter13(raw, {});
12467
12659
  data.status = to;
12468
12660
  if (to === "completed") data.completed_at = today();
12469
- const newContent = matter12.stringify(content, data);
12661
+ const newContent = matter13.stringify(content, data);
12470
12662
  writeFile(ini.filePath, newContent);
12471
12663
  const updated = parseInitiative(dir, ini.filePath, newContent);
12472
12664
  if (!updated) throw new InitiativeWriteError("Failed to parse the Initiative after transition.");
@@ -12476,7 +12668,7 @@ function addCandidate(dir, id, candidate) {
12476
12668
  const ini = getInitiative(dir, id);
12477
12669
  if (!ini) throw new InitiativeWriteError(`Initiative ${id} not found.`);
12478
12670
  const raw = readFile(ini.filePath);
12479
- const { data, content } = matter12(raw, {});
12671
+ const { data, content } = matter13(raw, {});
12480
12672
  const existing = Array.isArray(data.candidates) ? data.candidates : [];
12481
12673
  const fallbackId = `WI-CANDIDATE-${String(existing.length + 1).padStart(3, "0")}`;
12482
12674
  const normalized = normalizeCandidate(candidate, fallbackId);
@@ -12484,7 +12676,7 @@ function addCandidate(dir, id, candidate) {
12484
12676
  throw new InitiativeWriteError(`Candidate ${normalized.id} already exists in ${id}.`);
12485
12677
  }
12486
12678
  data.candidates = [...existing, candidateToData(normalized)];
12487
- const newContent = matter12.stringify(content, data);
12679
+ const newContent = matter13.stringify(content, data);
12488
12680
  writeFile(ini.filePath, newContent);
12489
12681
  const updated = parseInitiative(dir, ini.filePath, newContent);
12490
12682
  if (!updated) throw new InitiativeWriteError("Failed to parse the Initiative after adding a candidate.");
@@ -12494,7 +12686,7 @@ function updateInitiative(dir, id, patch) {
12494
12686
  const ini = getInitiative(dir, id);
12495
12687
  if (!ini) throw new InitiativeWriteError(`Initiative ${id} not found.`);
12496
12688
  const raw = readFile(ini.filePath);
12497
- const { data, content } = matter12(raw, {});
12689
+ const { data, content } = matter13(raw, {});
12498
12690
  if (patch.title !== void 0) {
12499
12691
  if (!patch.title.trim()) throw new InitiativeWriteError("Initiative title cannot be empty.");
12500
12692
  data.title = patch.title.trim();
@@ -12504,7 +12696,7 @@ function updateInitiative(dir, id, patch) {
12504
12696
  if (patch.knowledgeLevel !== void 0) data.knowledge_level = patch.knowledgeLevel;
12505
12697
  if (patch.domains !== void 0) data.domains = patch.domains;
12506
12698
  if (patch.relatedCapabilities !== void 0) data.related_capabilities = patch.relatedCapabilities;
12507
- const newContent = matter12.stringify(content, data);
12699
+ const newContent = matter13.stringify(content, data);
12508
12700
  writeFile(ini.filePath, newContent);
12509
12701
  const updated = parseInitiative(dir, ini.filePath, newContent);
12510
12702
  if (!updated) throw new InitiativeWriteError("Failed to parse the Initiative after update.");
@@ -12522,10 +12714,10 @@ function addExternalLink(dir, id, link) {
12522
12714
  throw new InitiativeWriteError(`External link ${link.integration}:${link.externalId} already exists on ${id}.`);
12523
12715
  }
12524
12716
  const raw = readFile(ini.filePath);
12525
- const { data, content } = matter12(raw, {});
12717
+ const { data, content } = matter13(raw, {});
12526
12718
  const existing = Array.isArray(data.external_links) ? data.external_links : [];
12527
12719
  data.external_links = [...existing, externalLinkToData(link)];
12528
- const newContent = matter12.stringify(content, data);
12720
+ const newContent = matter13.stringify(content, data);
12529
12721
  writeFile(ini.filePath, newContent);
12530
12722
  const updated = parseInitiative(dir, ini.filePath, newContent);
12531
12723
  if (!updated) throw new InitiativeWriteError("Failed to parse the Initiative after adding an external link.");
@@ -12594,7 +12786,7 @@ function buildWorkItemContent(wiId, iniId, candidate) {
12594
12786
  "_What did we learn? Update after completion._",
12595
12787
  ""
12596
12788
  ].join("\n");
12597
- return matter12.stringify("\n" + body, data);
12789
+ return matter13.stringify("\n" + body, data);
12598
12790
  }
12599
12791
  function materializeCandidate(dir, id, candidateId) {
12600
12792
  const ini = getInitiative(dir, id);
@@ -12611,13 +12803,13 @@ function materializeCandidate(dir, id, candidateId) {
12611
12803
  ensureDir(join(dir, DRAFT_DIR));
12612
12804
  writeFile(join(dir, DRAFT_DIR, fileName), buildWorkItemContent(wiId, ini.id, candidate));
12613
12805
  const raw = readFile(ini.filePath);
12614
- const { data, content } = matter12(raw, {});
12806
+ const { data, content } = matter13(raw, {});
12615
12807
  const cands = Array.isArray(data.candidates) ? data.candidates : [];
12616
12808
  for (const c of cands) {
12617
12809
  if (c && typeof c === "object" && String(c.id) === candidateId) c.materialized_as = wiId;
12618
12810
  }
12619
12811
  data.candidates = cands;
12620
- const newContent = matter12.stringify(content, data);
12812
+ const newContent = matter13.stringify(content, data);
12621
12813
  writeFile(ini.filePath, newContent);
12622
12814
  const updated = parseInitiative(dir, ini.filePath, newContent);
12623
12815
  if (!updated) throw new InitiativeWriteError("Failed to parse the Initiative after materialization.");
@@ -12778,6 +12970,7 @@ export {
12778
12970
  RESOURCE_ARTIFACT_TYPE,
12779
12971
  RESOURCE_ROLES,
12780
12972
  RESOURCE_TYPES,
12973
+ ResourceWriteError,
12781
12974
  TOPOLOGY_FILE,
12782
12975
  TopologyWriteError,
12783
12976
  WorkItemNotFoundError,
@@ -12805,10 +12998,12 @@ export {
12805
12998
  consentNotice,
12806
12999
  createInitiative,
12807
13000
  createIntegration,
13001
+ createResource,
12808
13002
  createWorkItem,
12809
13003
  cwd,
12810
13004
  deferConsent,
12811
13005
  deleteIntegration,
13006
+ deleteResource,
12812
13007
  detectFormat,
12813
13008
  disableIntegration,
12814
13009
  discoverExternalWorkItems,
@@ -12834,6 +13029,7 @@ export {
12834
13029
  getIntegrationFilters,
12835
13030
  getIntegrationSecretStatus,
12836
13031
  getResource,
13032
+ getResourceReferences,
12837
13033
  getResources,
12838
13034
  getSystemMapProjection,
12839
13035
  getSystemNeighbors,
@@ -12868,6 +13064,7 @@ export {
12868
13064
  nextInitiativeId,
12869
13065
  parseContent,
12870
13066
  parseInitiative,
13067
+ parseScope,
12871
13068
  parseSuccessCriteria,
12872
13069
  parseWorkItemResources,
12873
13070
  persistConsent,
@@ -12883,8 +13080,10 @@ export {
12883
13080
  updateInitiative,
12884
13081
  updateIntegration,
12885
13082
  updateIntegrationFilters,
13083
+ updateResource,
12886
13084
  updateWorkItem,
12887
13085
  validateConfigAgainstSchema,
13086
+ validateResource,
12888
13087
  validateSystemTopology,
12889
13088
  validateTopologyProposal,
12890
13089
  validateWorkItem,