@kaddo/cli 3.133.0 → 3.134.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-DR1_1O3v.js → architectureDiagram-3BPJPVTR-CYNwLGE7.js} +1 -1
  2. package/dist/admin-dist/assets/{chunk-727SXJPM-COmzRt04.js → chunk-727SXJPM-Cet603Hl.js} +1 -1
  3. package/dist/admin-dist/assets/{chunk-AQP2D5EJ-CXMsTGWW.js → chunk-AQP2D5EJ-8XEHPg3a.js} +1 -1
  4. package/dist/admin-dist/assets/{classDiagram-v2-Q7XG4LA2-D2dQFgos.js → classDiagram-4FO5ZUOK-Bhwb9850.js} +1 -1
  5. package/dist/admin-dist/assets/{classDiagram-4FO5ZUOK-D2dQFgos.js → classDiagram-v2-Q7XG4LA2-Bhwb9850.js} +1 -1
  6. package/dist/admin-dist/assets/{dagre-BM42HDAG-BMRsOxw1.js → dagre-BM42HDAG-DqQXdP8F.js} +1 -1
  7. package/dist/admin-dist/assets/{diagram-2AECGRRQ-CRXNCxDY.js → diagram-2AECGRRQ-B1bysbNR.js} +1 -1
  8. package/dist/admin-dist/assets/{diagram-5GNKFQAL-C9bO8FnC.js → diagram-5GNKFQAL-DRifvijh.js} +1 -1
  9. package/dist/admin-dist/assets/{diagram-LMA3HP47-ye8rGB9h.js → diagram-LMA3HP47-DajL2Tv-.js} +1 -1
  10. package/dist/admin-dist/assets/{diagram-OG6HWLK6-BL0joNkk.js → diagram-OG6HWLK6-WCJo9oL4.js} +1 -1
  11. package/dist/admin-dist/assets/{erDiagram-TEJ5UH35-lqVTGIq-.js → erDiagram-TEJ5UH35-DwgqKm6b.js} +1 -1
  12. package/dist/admin-dist/assets/{flowDiagram-I6XJVG4X-DA2CLejf.js → flowDiagram-I6XJVG4X-M0kG8sQQ.js} +1 -1
  13. package/dist/admin-dist/assets/{ganttDiagram-6RSMTGT7-Dkr4jLLp.js → ganttDiagram-6RSMTGT7-DtyZt9Ti.js} +1 -1
  14. package/dist/admin-dist/assets/{index-CZPZGMX7.js → index-CZVvIq5M.js} +10 -10
  15. package/dist/admin-dist/assets/{infoDiagram-5YYISTIA-PZDUmGz-.js → infoDiagram-5YYISTIA-Vwdw_1gf.js} +1 -1
  16. package/dist/admin-dist/assets/{ishikawaDiagram-YF4QCWOH-BByxhIgY.js → ishikawaDiagram-YF4QCWOH-CIi6B5fy.js} +1 -1
  17. package/dist/admin-dist/assets/{kanban-definition-UN3LZRKU-BSTqfNBc.js → kanban-definition-UN3LZRKU-5HNFMSQ7.js} +1 -1
  18. package/dist/admin-dist/assets/{linear-DJE08IfY.js → linear-D3H69r3G.js} +1 -1
  19. package/dist/admin-dist/assets/{mindmap-definition-RKZ34NQL-CmiCyDY8.js → mindmap-definition-RKZ34NQL-BI0w0H_c.js} +1 -1
  20. package/dist/admin-dist/assets/{pieDiagram-4H26LBE5-BlMxq332.js → pieDiagram-4H26LBE5-5oMGjRSP.js} +1 -1
  21. package/dist/admin-dist/assets/{quadrantDiagram-W4KKPZXB-Cy0zZxaY.js → quadrantDiagram-W4KKPZXB-Cf4_7xD4.js} +1 -1
  22. package/dist/admin-dist/assets/{requirementDiagram-4Y6WPE33-CAfQqVXA.js → requirementDiagram-4Y6WPE33-tKyHvrMo.js} +1 -1
  23. package/dist/admin-dist/assets/{sequenceDiagram-3UESZ5HK-CZYFDyTc.js → sequenceDiagram-3UESZ5HK-XJChOzcT.js} +1 -1
  24. package/dist/admin-dist/assets/{stateDiagram-AJRCARHV-BTWDzbes.js → stateDiagram-AJRCARHV-CG6QHhPz.js} +1 -1
  25. package/dist/admin-dist/assets/{stateDiagram-v2-BHNVJYJU-BcExDjN4.js → stateDiagram-v2-BHNVJYJU-COU53r4o.js} +1 -1
  26. package/dist/admin-dist/assets/{timeline-definition-PNZ67QCA-Db_z8PtC.js → timeline-definition-PNZ67QCA-CszwARJN.js} +1 -1
  27. package/dist/admin-dist/assets/{vennDiagram-CIIHVFJN-Dkj99o7j.js → vennDiagram-CIIHVFJN-kMR7sGYN.js} +1 -1
  28. package/dist/admin-dist/assets/{wardleyDiagram-YWT4CUSO-DG8V20tb.js → wardleyDiagram-YWT4CUSO-Cu44stm7.js} +1 -1
  29. package/dist/admin-dist/assets/{xychartDiagram-2RQKCTM6-B6EVudFe.js → xychartDiagram-2RQKCTM6-DeU0-PgC.js} +1 -1
  30. package/dist/admin-dist/index.html +1 -1
  31. package/dist/admin-server/index.js +112 -5
  32. package/dist/core.js +272 -82
  33. package/dist/index.js +501 -137
  34. package/package.json +1 -1
package/dist/core.js CHANGED
@@ -141,8 +141,8 @@ function loadConfig(dir) {
141
141
  const parsed = configSchema.safeParse(raw ?? {});
142
142
  if (!parsed.success) {
143
143
  const issues = parsed.error.issues.map((i) => {
144
- const path8 = i.path.join(".");
145
- return path8 ? ` - ${path8}: ${i.message}` : ` - ${i.message}`;
144
+ const path10 = i.path.join(".");
145
+ return path10 ? ` - ${path10}: ${i.message}` : ` - ${i.message}`;
146
146
  }).join("\n");
147
147
  throw new ConfigError(`Invalid .kaddo/config.yml:
148
148
  ${issues}`);
@@ -409,11 +409,11 @@ function moduleArtifactCoverage(dir, id) {
409
409
  };
410
410
  }
411
411
  function loadMappedModules(dir) {
412
- const path8 = join(dir, DESCRIPTOR_PATH);
413
- if (!exists(path8)) return [];
412
+ const path10 = join(dir, DESCRIPTOR_PATH);
413
+ if (!exists(path10)) return [];
414
414
  let parsed;
415
415
  try {
416
- parsed = parseYaml3(readFile(path8));
416
+ parsed = parseYaml3(readFile(path10));
417
417
  } catch {
418
418
  return [];
419
419
  }
@@ -1644,7 +1644,7 @@ function sectionParagraph(md, title) {
1644
1644
  }
1645
1645
  return "";
1646
1646
  }
1647
- function parseCapsule(id, path8, md) {
1647
+ function parseCapsule(id, path10, md) {
1648
1648
  const { data } = matter2(md);
1649
1649
  const updatedAt = data.updated_at ? String(data.updated_at) : void 0;
1650
1650
  let ageDays = null;
@@ -1654,7 +1654,7 @@ function parseCapsule(id, path8, md) {
1654
1654
  }
1655
1655
  return {
1656
1656
  id,
1657
- path: path8,
1657
+ path: path10,
1658
1658
  system: data.system ? String(data.system) : id,
1659
1659
  owner: data.owner ? String(data.owner) : void 0,
1660
1660
  updatedAt,
@@ -2726,9 +2726,9 @@ function buildGraph(dir, config, opts = {}, now = /* @__PURE__ */ new Date()) {
2726
2726
  ];
2727
2727
  const presentLayers = [];
2728
2728
  for (const layer of layerDocs) {
2729
- const path8 = layer.files.map((f) => `${KNOWLEDGE2}/${f}`).find((rel) => exists(join(dir, rel)));
2730
- if (path8) {
2731
- addNode({ id: layer.id, type: layer.type, label: layer.label, path: path8 });
2729
+ const path10 = layer.files.map((f) => `${KNOWLEDGE2}/${f}`).find((rel) => exists(join(dir, rel)));
2730
+ if (path10) {
2731
+ addNode({ id: layer.id, type: layer.type, label: layer.label, path: path10 });
2732
2732
  presentLayers.push(layer.id);
2733
2733
  }
2734
2734
  }
@@ -4156,13 +4156,13 @@ function meaningful(text2) {
4156
4156
  });
4157
4157
  }
4158
4158
  function readPocSummary(dir) {
4159
- const path8 = join(dir, POC_ARTIFACT_PATH);
4160
- if (!exists(path8)) {
4159
+ const path10 = join(dir, POC_ARTIFACT_PATH);
4160
+ if (!exists(path10)) {
4161
4161
  return { exists: false, hypothesisDefined: false, successCriteriaCount: 0, constraintsDefined: false, nonGoalsDefined: false, conclusion: "pending" };
4162
4162
  }
4163
4163
  let markdown = "";
4164
4164
  try {
4165
- markdown = readFile(path8);
4165
+ markdown = readFile(path10);
4166
4166
  } catch {
4167
4167
  return { exists: false, hypothesisDefined: false, successCriteriaCount: 0, constraintsDefined: false, nonGoalsDefined: false, conclusion: "pending" };
4168
4168
  }
@@ -4197,11 +4197,11 @@ function redactSecrets(value) {
4197
4197
  return line.replace(/([:=]\s*)\S+.*/, "$1[redacted]");
4198
4198
  }).join("\n");
4199
4199
  }
4200
- function source(dir, path8, kind) {
4201
- const absolute = join(dir, path8);
4200
+ function source(dir, path10, kind) {
4201
+ const absolute = join(dir, path10);
4202
4202
  if (!exists(absolute)) return null;
4203
4203
  const raw = readFile(absolute);
4204
- return { path: posix(path8), kind, digest: sha(raw), content: redactSecrets(raw) };
4204
+ return { path: posix(path10), kind, digest: sha(raw), content: redactSecrets(raw) };
4205
4205
  }
4206
4206
  function reportFiles(dir) {
4207
4207
  const delivery = join(dir, "knowledge", "delivery");
@@ -4241,9 +4241,9 @@ function buildPocReportContext(dir) {
4241
4241
  };
4242
4242
  }
4243
4243
  const sources = [];
4244
- const add = (path8, kind) => {
4245
- if (sources.some((item2) => item2.path === posix(path8))) return;
4246
- const item = source(dir, path8, kind);
4244
+ const add = (path10, kind) => {
4245
+ if (sources.some((item2) => item2.path === posix(path10))) return;
4246
+ const item = source(dir, path10, kind);
4247
4247
  if (item) sources.push(item);
4248
4248
  };
4249
4249
  add(POC_ARTIFACT_PATH, "poc");
@@ -4271,7 +4271,7 @@ function buildPocReportContext(dir) {
4271
4271
  const sourceFingerprint = sha(sources.map((item) => `${item.path}\0${item.digest}`).join("\n"));
4272
4272
  const status = !latestReport ? "missing" : latestReport.sourceFingerprint === sourceFingerprint ? "current" : "stale";
4273
4273
  const currentManifest = Object.fromEntries(sources.map((item) => [item.path, item.digest]));
4274
- const changesSinceLatest = status === "stale" ? [.../* @__PURE__ */ new Set([...Object.keys(currentManifest), ...Object.keys(latestReport?.sourceManifest ?? {})])].filter((path8) => currentManifest[path8] !== latestReport?.sourceManifest[path8]).sort() : [];
4274
+ const changesSinceLatest = status === "stale" ? [.../* @__PURE__ */ new Set([...Object.keys(currentManifest), ...Object.keys(latestReport?.sourceManifest ?? {})])].filter((path10) => currentManifest[path10] !== latestReport?.sourceManifest[path10]).sort() : [];
4275
4275
  const sourceList = sources.map((item) => `- ${item.path} (${item.kind})`).join("\n") || "- No sources selected.";
4276
4276
  return {
4277
4277
  eligible: true,
@@ -4447,10 +4447,10 @@ function resolveNextStep(dir, now = /* @__PURE__ */ new Date()) {
4447
4447
  const q = (rel) => analyzeKnowledgeArtifact(dir, rel);
4448
4448
  const resolveAgent = (agent) => {
4449
4449
  const file = agent.endsWith(".md") ? agent : `${agent}.md`;
4450
- const path8 = agentInstallPath(file);
4451
- const installed = isFile(join(dir, path8));
4450
+ const path10 = agentInstallPath(file);
4451
+ const installed = isFile(join(dir, path10));
4452
4452
  const group = agentGroupOf(file);
4453
- return { agentPath: path8, agentInstalled: installed, installCommand: installed ? void 0 : `kaddo add agents --group ${group}` };
4453
+ return { agentPath: path10, agentInstalled: installed, installCommand: installed ? void 0 : `kaddo add agents --group ${group}` };
4454
4454
  };
4455
4455
  const moduleRepo = isModule(config);
4456
4456
  const coreRepo = isCore(config);
@@ -9627,7 +9627,7 @@ function buildGuardHistory(dir) {
9627
9627
  const d = hotspotDir(t.code_path);
9628
9628
  hotspotMap.set(d, (hotspotMap.get(d) ?? 0) + 1);
9629
9629
  }
9630
- const hotspots = [...hotspotMap.entries()].map(([path8, warnings]) => ({ path: path8, warnings })).sort((a, b) => b.warnings - a.warnings);
9630
+ const hotspots = [...hotspotMap.entries()].map(([path10, warnings]) => ({ path: path10, warnings })).sort((a, b) => b.warnings - a.warnings);
9631
9631
  return {
9632
9632
  available: true,
9633
9633
  total_runs: sorted.length,
@@ -12615,7 +12615,9 @@ function toListItem(a) {
12615
12615
  releaseStatus: a.releaseStatus || null,
12616
12616
  affectedModules: a.affectedModules,
12617
12617
  scopeConfidenceLevel: a.scopeConfidence?.level ?? null,
12618
- initiative: a.initiative || null
12618
+ initiative: a.initiative || null,
12619
+ owners: Array.isArray(a.rawFrontmatter.owners) ? a.rawFrontmatter.owners.map(String).filter(Boolean) : [],
12620
+ contributors: Array.isArray(a.rawFrontmatter.contributors) ? a.rawFrontmatter.contributors.map(String).filter(Boolean) : []
12619
12621
  };
12620
12622
  }
12621
12623
  function getWorkItem(dir, workItemId) {
@@ -12664,8 +12666,8 @@ function parseGraphReason(v) {
12664
12666
  if (!v || typeof v !== "object") return null;
12665
12667
  const o = v;
12666
12668
  const relationship = typeof o.relationship === "string" && o.relationship.trim() ? o.relationship.trim() : null;
12667
- const path8 = Array.isArray(o.path) ? o.path.map(String).filter(Boolean) : [];
12668
- return relationship || path8.length ? { relationship, path: path8 } : null;
12669
+ const path10 = Array.isArray(o.path) ? o.path.map(String).filter(Boolean) : [];
12670
+ return relationship || path10.length ? { relationship, path: path10 } : null;
12669
12671
  }
12670
12672
  function parseExplain(o) {
12671
12673
  const refs = Array.isArray(o.evidence) ? o.evidence : Array.isArray(o.evidence_refs) ? o.evidence_refs : [];
@@ -13264,6 +13266,8 @@ function applyFrontmatter(data, input) {
13264
13266
  next.type = input.type;
13265
13267
  next.work_type = input.type;
13266
13268
  if (input.summary != null) next.summary = input.summary;
13269
+ next.owners = [...new Set((input.owners ?? []).map((v) => v.trim()).filter(Boolean))];
13270
+ next.contributors = [...new Set((input.contributors ?? []).map((v) => v.trim()).filter(Boolean))];
13267
13271
  next.affected_modules = [...input.affectedModules];
13268
13272
  if (input.scopeConfidence && VALID_CONFIDENCE.has(input.scopeConfidence.level)) {
13269
13273
  next.scope_confidence = { level: input.scopeConfidence.level, reasons: input.scopeConfidence.reasons.filter((r) => r.trim()) };
@@ -13347,7 +13351,9 @@ function toInput(data, content) {
13347
13351
  impactAnalysis: ia ? Object.entries(ia).map(([surface, v]) => ({ surface, status: String(v.status ?? ""), ...v.reason ? { reason: String(v.reason) } : {}, ...v.question ? { question: String(v.question) } : {} })) : [],
13348
13352
  acceptanceCriteria: criteria,
13349
13353
  decisions: Array.isArray(data.decisions) ? data.decisions.map(String) : [],
13350
- relatedKnowledge: Array.isArray(data.related_knowledge) ? data.related_knowledge.map(String) : []
13354
+ relatedKnowledge: Array.isArray(data.related_knowledge) ? data.related_knowledge.map(String) : [],
13355
+ owners: Array.isArray(data.owners) ? data.owners.map(String) : [],
13356
+ contributors: Array.isArray(data.contributors) ? data.contributors.map(String) : []
13351
13357
  };
13352
13358
  }
13353
13359
  function getWorkItemForEdit(dir, id) {
@@ -13457,6 +13463,24 @@ function updateWorkItem(dir, id, input, expectedRevision) {
13457
13463
  atomicWrite3(filePath, nextRaw);
13458
13464
  return { revision: revisionOf2(nextRaw), path: relPath };
13459
13465
  }
13466
+ function updateWorkItemAssignments(dir, id, assignments, expectedRevision) {
13467
+ const { filePath, relPath } = findArtifact(dir, id);
13468
+ const raw = readFile(filePath);
13469
+ if (revisionOf2(raw) !== expectedRevision) {
13470
+ throw new WorkItemWriteError("WORK_ITEM_CONFLICT", "This Work Item changed outside Kaddo Admin. Reload the latest version before saving assignments.");
13471
+ }
13472
+ const { data, content } = matter17(raw);
13473
+ const status = lifecycleStateOf({ status: String(data.status ?? ""), filePath });
13474
+ if (!["draft", "ready", "in-progress"].includes(status)) {
13475
+ throw new WorkItemWriteError("WORK_ITEM_NOT_EDITABLE", `Assignments cannot be changed for a ${status} Work Item.`);
13476
+ }
13477
+ const next = { ...data };
13478
+ next.owners = [...new Set((assignments.owners ?? []).map((value) => value.trim()).filter(Boolean))];
13479
+ next.contributors = [...new Set((assignments.contributors ?? []).map((value) => value.trim()).filter(Boolean))];
13480
+ const nextRaw = serialize2(next, content);
13481
+ atomicWrite3(filePath, nextRaw);
13482
+ return { revision: revisionOf2(nextRaw), path: relPath, status };
13483
+ }
13460
13484
  function validateWorkItem(dir, id) {
13461
13485
  const { filePath } = findArtifact(dir, id);
13462
13486
  const raw = readFile(filePath);
@@ -13506,7 +13530,7 @@ function validateWorkItem(dir, id) {
13506
13530
  const canMarkReady = !findings.some((f) => f.level === "blocking");
13507
13531
  return { findings, canMarkReady };
13508
13532
  }
13509
- var ALLOWED = { draft: ["ready"], ready: ["draft"] };
13533
+ var ALLOWED = { draft: ["ready"], ready: ["draft", "in-progress"] };
13510
13534
  function transitionWorkItem(dir, id, to, expectedRevision) {
13511
13535
  const { filePath } = findArtifact(dir, id);
13512
13536
  const raw = readFile(filePath);
@@ -13779,16 +13803,16 @@ function findSystemPaths(dir, source2, target, opts = {}) {
13779
13803
  out.get(r.source).push(r.target);
13780
13804
  }
13781
13805
  const paths = [];
13782
- const walk2 = (node, path8) => {
13806
+ const walk2 = (node, path10) => {
13783
13807
  if (paths.length >= 20) return;
13784
- if (node === target && path8.length > 1) {
13785
- paths.push([...path8]);
13808
+ if (node === target && path10.length > 1) {
13809
+ paths.push([...path10]);
13786
13810
  return;
13787
13811
  }
13788
- if (path8.length > maxDepth) return;
13812
+ if (path10.length > maxDepth) return;
13789
13813
  for (const nxt of out.get(node) ?? []) {
13790
- if (path8.includes(nxt)) continue;
13791
- walk2(nxt, [...path8, nxt]);
13814
+ if (path10.includes(nxt)) continue;
13815
+ walk2(nxt, [...path10, nxt]);
13792
13816
  }
13793
13817
  };
13794
13818
  walk2(source2, [source2]);
@@ -13813,14 +13837,14 @@ function getImpactCandidates(dir, seedIds, opts = {}) {
13813
13837
  existing.reason.push(reason);
13814
13838
  continue;
13815
13839
  }
13816
- const path8 = findSystemPaths(dir, seed, n.id, { maxDepth: opts.maxDepth ?? DEFAULT_MAX_DEPTH })[0];
13840
+ const path10 = findSystemPaths(dir, seed, n.id, { maxDepth: opts.maxDepth ?? DEFAULT_MAX_DEPTH })[0];
13817
13841
  candidates.set(n.id, {
13818
13842
  nodeId: n.id,
13819
13843
  label: n.label,
13820
13844
  kind: n.type,
13821
13845
  ...n.moduleId ? { moduleId: n.moduleId } : {},
13822
13846
  reason: [reason],
13823
- ...path8 ? { graphPath: path8.map((id) => byId.get(id)?.label ?? id) } : {},
13847
+ ...path10 ? { graphPath: path10.map((id) => byId.get(id)?.label ?? id) } : {},
13824
13848
  ...n.implementationRefs?.length ? { implementationRefs: n.implementationRefs } : {},
13825
13849
  ...n.knowledgeRefs?.length ? { knowledgeRefs: n.knowledgeRefs } : {},
13826
13850
  status: "candidate",
@@ -14513,7 +14537,12 @@ function collectImplementationEvidence(dir, workItemId, input) {
14513
14537
  } : {}
14514
14538
  };
14515
14539
  }
14516
- return { repositories };
14540
+ return {
14541
+ repositories,
14542
+ ...input.acVerifications.length > 0 ? {
14543
+ ac_verifications: input.acVerifications.map((verification) => ({ ...verification }))
14544
+ } : {}
14545
+ };
14517
14546
  }
14518
14547
  function verifyWorkItem(dir, workItemId, input) {
14519
14548
  const evidence = collectImplementationEvidence(dir, workItemId, input);
@@ -14573,6 +14602,9 @@ function evaluateCompletion(verification) {
14573
14602
  warnings.push(`Completion exception "${ex.id}" is still proposed (not yet accepted).`);
14574
14603
  }
14575
14604
  }
14605
+ if (verification.acSummary.total === 0) {
14606
+ blockers.push("No acceptance criteria were detected; completion evidence is insufficient.");
14607
+ }
14576
14608
  if (verification.acSummary.failed > 0) {
14577
14609
  const failedACs = verification.acVerifications.filter((ac) => ac.status === "failed");
14578
14610
  for (const ac of failedACs) {
@@ -14584,10 +14616,16 @@ function evaluateCompletion(verification) {
14584
14616
  blockers.push(f.message);
14585
14617
  }
14586
14618
  if (verification.acSummary.manualReview > 0) {
14587
- warnings.push(`${verification.acSummary.manualReview} AC(s) require manual review.`);
14619
+ blockers.push(`${verification.acSummary.manualReview} AC(s) require manual review.`);
14588
14620
  }
14589
14621
  if (verification.acSummary.notVerified > 0) {
14590
- warnings.push(`${verification.acSummary.notVerified} AC(s) not yet verified.`);
14622
+ blockers.push(`${verification.acSummary.notVerified} AC(s) not yet verified.`);
14623
+ }
14624
+ if (verification.implementationStatus !== "completed") {
14625
+ blockers.push(`Implementation status is "${verification.implementationStatus}", not "completed".`);
14626
+ }
14627
+ if (!["passed", "accepted-with-exceptions"].includes(verification.validationStatus)) {
14628
+ blockers.push(`Validation status is "${verification.validationStatus}", not passed.`);
14591
14629
  }
14592
14630
  const warningFindings = verification.findings.filter((f) => f.severity === "warning");
14593
14631
  for (const f of warningFindings) {
@@ -14604,8 +14642,8 @@ function evaluateCompletion(verification) {
14604
14642
  }
14605
14643
  let readiness;
14606
14644
  if (blockers.length > 0) {
14607
- const hasOnlyACFailures = blockers.every((b) => b.startsWith("AC failed:"));
14608
- if (hasOnlyACFailures) {
14645
+ const needsEvidence = blockers.every((b) => b.startsWith("AC failed:") || b.includes("acceptance criteria") || b.includes("AC(s)") || b.startsWith("Implementation status") || b.startsWith("Validation status"));
14646
+ if (needsEvidence) {
14609
14647
  readiness = "NEEDS_WORK";
14610
14648
  reasons.push("Acceptance criteria have failures that must be addressed.");
14611
14649
  } else {
@@ -14686,6 +14724,152 @@ function deriveImplementationStatus(repos) {
14686
14724
  return "in-progress";
14687
14725
  }
14688
14726
 
14727
+ // src/services/git.ts
14728
+ import { execa } from "execa";
14729
+ import path5 from "path";
14730
+ async function getGitRoot(dir) {
14731
+ try {
14732
+ const result = await execa("git", ["rev-parse", "--show-toplevel"], { cwd: dir });
14733
+ return result.stdout.trim() || null;
14734
+ } catch {
14735
+ return null;
14736
+ }
14737
+ }
14738
+ async function observeGit(dir, maxCommits = 100, repositoryId) {
14739
+ const limit = Math.max(1, Math.min(maxCommits, 250));
14740
+ const inspectedAt = (/* @__PURE__ */ new Date()).toISOString();
14741
+ try {
14742
+ const root = await getGitRoot(dir);
14743
+ if (!root) return { availability: "unavailable", repository: null, commits: [], branches: [], inspectedAt, limit };
14744
+ const [log2, refs] = await Promise.all([
14745
+ execa("git", ["log", `--max-count=${limit}`, "--format=%H%x1f%an%x1f%aI%x1f%s", "--name-only"], { cwd: root, timeout: 5e3 }),
14746
+ execa("git", ["for-each-ref", "--format=%(refname:short)", "refs/heads"], { cwd: root, timeout: 5e3 })
14747
+ ]);
14748
+ const commits = [];
14749
+ let current = null;
14750
+ for (const line of log2.stdout.split(/\r?\n/)) {
14751
+ const parts = line.split("");
14752
+ if (parts.length === 4) {
14753
+ if (current) commits.push(current);
14754
+ current = { sha: parts[0], author: parts[1], date: parts[2], subject: parts[3], files: [] };
14755
+ } else if (current && line.trim()) current.files.push(line.trim());
14756
+ }
14757
+ if (current) commits.push(current);
14758
+ return {
14759
+ // The display identity is supplied by the caller when a project observes
14760
+ // several repositories. A basename alone is ambiguous in a multirepo
14761
+ // workspace (for example, two independent `api` folders).
14762
+ availability: "available",
14763
+ repository: repositoryId ?? path5.basename(root),
14764
+ commits,
14765
+ branches: refs.stdout.split(/\r?\n/).map((name) => name.trim()).filter(Boolean).slice(0, 100).map((name) => ({ name })),
14766
+ inspectedAt,
14767
+ limit
14768
+ };
14769
+ } catch {
14770
+ return { availability: "partial", repository: null, commits: [], branches: [], inspectedAt, limit };
14771
+ }
14772
+ }
14773
+
14774
+ // src/core/collaboration.ts
14775
+ import path6 from "path";
14776
+ function matchesWorkItemReference(value, id) {
14777
+ return new RegExp(`(^|[^A-Za-z0-9_-])${id.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")}(?=$|[^A-Za-z0-9_-])`, "i").test(value);
14778
+ }
14779
+ async function observationsForProject(dir) {
14780
+ const corePath = path6.resolve(dir);
14781
+ const mapped = loadMappedModules(dir).filter((module) => Boolean(module.repoPath)).map((module) => ({ path: path6.resolve(corePath, module.repoPath), repositoryId: `module:${module.id}` }));
14782
+ const candidates = [{ path: corePath, repositoryId: "core" }, ...mapped];
14783
+ const resolved = await Promise.all(candidates.map(async (candidate) => ({ ...candidate, root: await getGitRoot(candidate.path) })));
14784
+ const repositories = /* @__PURE__ */ new Map();
14785
+ for (const item of resolved) if (item.root && !repositories.has(item.root)) repositories.set(item.root, { root: item.root, repositoryId: item.repositoryId });
14786
+ const observations = await Promise.all([...repositories.values()].map((repo) => observeGit(repo.root, 100, repo.repositoryId)));
14787
+ return observations;
14788
+ }
14789
+ async function collaborationForWorkItems(dir, ids) {
14790
+ const observations = await observationsForProject(dir);
14791
+ return ids.map((id) => {
14792
+ const wi = getWorkItem(dir, id);
14793
+ const linkedCommits = [];
14794
+ const relatedBranches = [];
14795
+ for (const observation of observations) {
14796
+ const repository = observation.repository ?? "local";
14797
+ for (const commit of observation.commits) {
14798
+ if (!matchesWorkItemReference(commit.subject, wi.id)) continue;
14799
+ linkedCommits.push({ repository, sha: commit.sha, author: commit.author, date: commit.date, subject: commit.subject, paths: commit.files.slice(0, 50), attribution: "explicit-reference", evidence: `Exact reference ${wi.id} in commit subject.` });
14800
+ }
14801
+ for (const branch of observation.branches) {
14802
+ if (!matchesWorkItemReference(branch.name, wi.id)) continue;
14803
+ relatedBranches.push({ repository, name: branch.name, attribution: "branch-associated", evidence: `Exact reference ${wi.id} in local branch name.` });
14804
+ }
14805
+ }
14806
+ const inspectedCommits = observations.reduce((total, observation) => total + observation.commits.length, 0);
14807
+ const available = observations.filter((observation) => observation.availability === "available").length;
14808
+ const availability = available === observations.length ? "available" : available > 0 ? "partial" : observations.some((observation) => observation.availability === "partial") ? "partial" : "unavailable";
14809
+ return {
14810
+ workItemId: wi.id,
14811
+ responsibility: { owners: wi.owners, contributors: wi.contributors },
14812
+ git: {
14813
+ availability,
14814
+ repositories: observations.flatMap((observation) => observation.repository ? [observation.repository] : []),
14815
+ observedAuthors: [...new Set(linkedCommits.map((commit) => commit.author))],
14816
+ linkedCommits,
14817
+ relatedBranches,
14818
+ unattributedActivityCount: Math.max(0, inspectedCommits - linkedCommits.length),
14819
+ inspectedAt: observations.map((observation) => observation.inspectedAt).sort().at(-1) ?? null,
14820
+ coverage: { maxCommits: observations[0]?.limit ?? 100, inspectedCommits, note: "Only the core repository and explicitly mapped module repositories were inspected with read-only Git metadata. File overlap never creates attribution." }
14821
+ }
14822
+ };
14823
+ });
14824
+ }
14825
+ async function getWorkItemsCollaboration(dir, ids) {
14826
+ return collaborationForWorkItems(dir, [...new Set(ids)]);
14827
+ }
14828
+ async function getWorkItemCollaboration(dir, id) {
14829
+ return (await collaborationForWorkItems(dir, [id]))[0];
14830
+ }
14831
+ function aggregate(id, responsibility, items) {
14832
+ const commits = /* @__PURE__ */ new Map();
14833
+ for (const item of items) for (const commit of item.git.linkedCommits) {
14834
+ const key = `${commit.repository}:${commit.sha}`;
14835
+ const existing = commits.get(key);
14836
+ if (existing) existing.workItemIds = [.../* @__PURE__ */ new Set([...existing.workItemIds, item.workItemId])];
14837
+ else commits.set(key, { ...commit, workItemIds: [item.workItemId] });
14838
+ }
14839
+ const first2 = items[0];
14840
+ return {
14841
+ id,
14842
+ responsibility,
14843
+ workItems: items.map((item) => ({ id: item.workItemId, owners: item.responsibility.owners, contributors: item.responsibility.contributors, linkedCommitCount: item.git.linkedCommits.length })),
14844
+ observedAuthors: [...new Set([...commits.values()].map((commit) => commit.author))],
14845
+ linkedCommits: [...commits.values()],
14846
+ unassignedWorkItemIds: items.filter((item) => item.responsibility.owners.length === 0).map((item) => item.workItemId),
14847
+ git: first2?.git ?? { availability: "unavailable", repositories: [], observedAuthors: [], linkedCommits: [], relatedBranches: [], unattributedActivityCount: 0, inspectedAt: null, coverage: { maxCommits: 100, inspectedCommits: 0, note: "No associated Work Items." } }
14848
+ };
14849
+ }
14850
+ async function getInitiativeCollaboration(dir, id) {
14851
+ const initiative = getInitiative(dir, id);
14852
+ if (!initiative) throw new WorkItemNotFoundError(`Initiative ${id} was not found.`);
14853
+ const items = await collaborationForWorkItems(dir, associatedWorkItems(dir, id).map((item) => item.id));
14854
+ return aggregate(id, { owners: initiative.owners, contributors: initiative.contributors }, items);
14855
+ }
14856
+ async function getEpicCollaboration(dir, id) {
14857
+ const epic = getEpic(dir, id);
14858
+ if (!epic) throw new WorkItemNotFoundError(`Epic ${id} was not found.`);
14859
+ const items = await collaborationForWorkItems(dir, workItemsInEpic(dir, id).map((item) => item.id));
14860
+ const initiatives = initiativesInEpic(dir, id);
14861
+ return aggregate(id, { owners: [...new Set(initiatives.flatMap((item) => item.owners))], contributors: [...new Set(initiatives.flatMap((item) => item.contributors))] }, items);
14862
+ }
14863
+ async function getPlanCollaboration(dir, id) {
14864
+ const plan = getPlan(dir, id);
14865
+ if (!plan) throw new WorkItemNotFoundError(`Plan ${id} was not found.`);
14866
+ const epicIds = epicsInPlan(dir, id).map((epic) => epic.id);
14867
+ const workItemIds = [...new Set(epicIds.flatMap((epicId) => workItemsInEpic(dir, epicId).map((item) => item.id)))];
14868
+ const items = await collaborationForWorkItems(dir, workItemIds);
14869
+ const initiatives = epicIds.flatMap((epicId) => initiativesInEpic(dir, epicId));
14870
+ return aggregate(id, { owners: [...new Set(initiatives.flatMap((item) => item.owners))], contributors: [...new Set(initiatives.flatMap((item) => item.contributors))] }, items);
14871
+ }
14872
+
14689
14873
  // src/core/work-item-import.ts
14690
14874
  import crypto3 from "crypto";
14691
14875
  import fs5 from "fs";
@@ -15708,8 +15892,8 @@ async function handleJiraResponse(res) {
15708
15892
  }
15709
15893
  return await res.json();
15710
15894
  }
15711
- async function jiraFetch(baseUrl, path8, auth, timeoutMs, params) {
15712
- const url = new URL(path8, baseUrl + "/");
15895
+ async function jiraFetch(baseUrl, path10, auth, timeoutMs, params) {
15896
+ const url = new URL(path10, baseUrl + "/");
15713
15897
  if (params) for (const [k, v] of Object.entries(params)) url.searchParams.set(k, v);
15714
15898
  const controller = new AbortController();
15715
15899
  const timer = setTimeout(() => controller.abort(), timeoutMs);
@@ -15727,8 +15911,8 @@ async function jiraFetch(baseUrl, path8, auth, timeoutMs, params) {
15727
15911
  clearTimeout(timer);
15728
15912
  }
15729
15913
  }
15730
- async function jiraPost(baseUrl, path8, auth, timeoutMs, body) {
15731
- const url = new URL(path8, baseUrl + "/");
15914
+ async function jiraPost(baseUrl, path10, auth, timeoutMs, body) {
15915
+ const url = new URL(path10, baseUrl + "/");
15732
15916
  const controller = new AbortController();
15733
15917
  const timer = setTimeout(() => controller.abort(), timeoutMs);
15734
15918
  try {
@@ -16580,7 +16764,7 @@ function evaluateInitiativeCompletion(dir, ini) {
16580
16764
 
16581
16765
  // src/core/deprecation-write.ts
16582
16766
  import fs6 from "fs";
16583
- import path5 from "path";
16767
+ import path7 from "path";
16584
16768
  import matter20 from "gray-matter";
16585
16769
  var DeprecationWriteError = class extends Error {
16586
16770
  constructor(code, message) {
@@ -16696,7 +16880,7 @@ ${(input.purpose ?? "").trim() || "TODO: describe what this plan retires and why
16696
16880
  const relPath = `${DEPRECATION_PLANS_DIR}/${id}-${slug4(title) || "plan"}.md`;
16697
16881
  const filePath = join(dir, relPath);
16698
16882
  if (exists(filePath)) throw new DeprecationWriteError("DUPLICATE", `Plan file already exists: ${relPath}`);
16699
- ensureDir(path5.dirname(filePath));
16883
+ ensureDir(path7.dirname(filePath));
16700
16884
  atomicWrite4(filePath, serialize3(data, body));
16701
16885
  return { id, path: relPath, findings: [] };
16702
16886
  }
@@ -16715,7 +16899,7 @@ function addTarget(dir, planId, input) {
16715
16899
  }
16716
16900
  data.targets = [...targets, raw];
16717
16901
  atomicWrite4(filePath, serialize3(data, body));
16718
- return { planId, targetId, path: `${DEPRECATION_PLANS_DIR}/${path5.basename(filePath)}`, findings };
16902
+ return { planId, targetId, path: `${DEPRECATION_PLANS_DIR}/${path7.basename(filePath)}`, findings };
16719
16903
  }
16720
16904
  function updateTarget(dir, planId, targetId, patch) {
16721
16905
  const { filePath, data, body } = loadPlanRaw(dir, planId);
@@ -16731,7 +16915,7 @@ function updateTarget(dir, planId, targetId, patch) {
16731
16915
  next[idx] = merged;
16732
16916
  data.targets = next;
16733
16917
  atomicWrite4(filePath, serialize3(data, body));
16734
- return { planId, targetId: String(targets[idx].id), path: `${DEPRECATION_PLANS_DIR}/${path5.basename(filePath)}`, findings };
16918
+ return { planId, targetId: String(targets[idx].id), path: `${DEPRECATION_PLANS_DIR}/${path7.basename(filePath)}`, findings };
16735
16919
  }
16736
16920
  function removeTarget(dir, planId, targetId, opts = {}) {
16737
16921
  const { filePath, data, body } = loadPlanRaw(dir, planId);
@@ -16744,7 +16928,7 @@ function removeTarget(dir, planId, targetId, opts = {}) {
16744
16928
  }
16745
16929
  data.targets = targets.filter((t) => String(t.id ?? "").toUpperCase() !== targetId.toUpperCase());
16746
16930
  atomicWrite4(filePath, serialize3(data, body));
16747
- return { removed: true, path: `${DEPRECATION_PLANS_DIR}/${path5.basename(filePath)}` };
16931
+ return { removed: true, path: `${DEPRECATION_PLANS_DIR}/${path7.basename(filePath)}` };
16748
16932
  }
16749
16933
 
16750
16934
  // src/core/deprecation-runbook.ts
@@ -16827,7 +17011,7 @@ function buildProductionRunbookContext(dir, planId, targetId) {
16827
17011
  blockers.push(`Dependency ${dependency.id} is not retired (current: ${dependency.lifecycle}).`);
16828
17012
  }
16829
17013
  }
16830
- const path8 = runbookPath(dir, target);
17014
+ const path10 = runbookPath(dir, target);
16831
17015
  return {
16832
17016
  eligible: blockers.length === 0,
16833
17017
  plan: { id: plan.id, title: plan.title, purpose: plan.purpose },
@@ -16835,7 +17019,7 @@ function buildProductionRunbookContext(dir, planId, targetId) {
16835
17019
  resource: target.resource ? getResource(dir, target.resource) : null,
16836
17020
  dependencies,
16837
17021
  blockers,
16838
- nextPath: path8,
17022
+ nextPath: path10,
16839
17023
  nextStep: blockers.length > 0 ? "Resolve the listed safeguards; no production proposal can be persisted yet." : "Review the generated proposal, obtain human approval, execute manually, then record evidence and validate the observation window."
16840
17024
  };
16841
17025
  }
@@ -16928,8 +17112,8 @@ function renderRunbook(context) {
16928
17112
  function createProductionRunbook(dir, planId, targetId) {
16929
17113
  const context = buildProductionRunbookContext(dir, planId, targetId);
16930
17114
  if (!context.eligible) throw new ProductionRunbookError(context.blockers.join(" "));
16931
- const path8 = context.nextPath;
16932
- const id = path8.split("/").pop()?.match(/^(RB-\d+)-/)?.[1] ?? "";
17115
+ const path10 = context.nextPath;
17116
+ const id = path10.split("/").pop()?.match(/^(RB-\d+)-/)?.[1] ?? "";
16933
17117
  const content = matter21.stringify(renderRunbook(context), {
16934
17118
  id,
16935
17119
  type: PRODUCTION_RUNBOOK_ARTIFACT_TYPE,
@@ -16939,13 +17123,13 @@ function createProductionRunbook(dir, planId, targetId) {
16939
17123
  resource: context.target.resource,
16940
17124
  approval: { required: true, status: "pending", approved_by: null, approved_at: null }
16941
17125
  });
16942
- const absolute = join(dir, path8);
16943
- if (exists(absolute)) throw new ProductionRunbookError(`Runbook already exists: ${path8}`);
17126
+ const absolute = join(dir, path10);
17127
+ if (exists(absolute)) throw new ProductionRunbookError(`Runbook already exists: ${path10}`);
16944
17128
  writeFile(absolute, content);
16945
17129
  return {
16946
17130
  id,
16947
17131
  title: `Production runbook \u2014 ${context.target.title ?? context.target.id}`,
16948
- path: path8,
17132
+ path: path10,
16949
17133
  planId: context.plan.id,
16950
17134
  targetId: context.target.id,
16951
17135
  approval: { required: true, status: "pending", approvedBy: null, approvedAt: null },
@@ -16956,14 +17140,14 @@ function getProductionRunbook(dir, id) {
16956
17140
  const root = join(dir, PRODUCTION_RUNBOOKS_DIR);
16957
17141
  for (const name of readDir(root)) {
16958
17142
  if (!name.toLowerCase().startsWith(`${id.toLowerCase()}-`) || !name.endsWith(".md")) continue;
16959
- const path8 = `${PRODUCTION_RUNBOOKS_DIR}/${name}`;
16960
- const parsed = matter21(readFile(join(dir, path8)));
17143
+ const path10 = `${PRODUCTION_RUNBOOKS_DIR}/${name}`;
17144
+ const parsed = matter21(readFile(join(dir, path10)));
16961
17145
  const data = parsed.data;
16962
17146
  if (data.type !== PRODUCTION_RUNBOOK_ARTIFACT_TYPE) continue;
16963
17147
  return {
16964
17148
  id: stringValue(data.id) ?? id,
16965
17149
  title: stringValue(data.title) ?? id,
16966
- path: path8,
17150
+ path: path10,
16967
17151
  planId: stringValue(data.deprecation_plan) ?? "",
16968
17152
  targetId: stringValue(data.deprecation_target) ?? "",
16969
17153
  approval: parseApproval(data.approval),
@@ -16988,7 +17172,7 @@ function validateProductionRunbook(runbook) {
16988
17172
 
16989
17173
  // src/core/okf/export.ts
16990
17174
  import fs7 from "fs";
16991
- import path6 from "path";
17175
+ import path8 from "path";
16992
17176
 
16993
17177
  // src/core/okf/mapping.ts
16994
17178
  import matter22 from "gray-matter";
@@ -17231,16 +17415,16 @@ function frontmatter(data) {
17231
17415
  return lines.join("\n");
17232
17416
  }
17233
17417
  function relLink(fromPath, toPath) {
17234
- const rel = path6.posix.relative(path6.posix.dirname(fromPath), toPath);
17418
+ const rel = path8.posix.relative(path8.posix.dirname(fromPath), toPath);
17235
17419
  return rel.startsWith(".") ? rel : `./${rel}`;
17236
17420
  }
17237
17421
  function rewriteBodyLinks(body, sourcePath, srcToBundle, selfBundlePath) {
17238
- const srcDir = path6.posix.dirname(sourcePath);
17422
+ const srcDir = path8.posix.dirname(sourcePath);
17239
17423
  return body.replace(/\]\(([^)]+)\)/g, (whole, href) => {
17240
17424
  const raw = href.trim();
17241
17425
  const bare = raw.split("#")[0].split(" ")[0];
17242
17426
  if (!bare || /^(https?:|mailto:|#)/.test(bare)) return whole;
17243
- const candidate = bare.startsWith("/") ? bare.replace(/^\/+/, "") : path6.posix.normalize(path6.posix.join(srcDir, bare));
17427
+ const candidate = bare.startsWith("/") ? bare.replace(/^\/+/, "") : path8.posix.normalize(path8.posix.join(srcDir, bare));
17244
17428
  const target = srcToBundle.get(candidate);
17245
17429
  if (!target) return whole;
17246
17430
  const anchor = raw.includes("#") ? "#" + raw.split("#").slice(1).join("#") : "";
@@ -17317,22 +17501,22 @@ function sensitiveLabels(content) {
17317
17501
  return [...new Set(SENSITIVE_PATTERNS.filter((p) => p.re.test(content)).map((p) => p.label))];
17318
17502
  }
17319
17503
  function assertSafeDestination(dir, outputDir) {
17320
- const root = path6.resolve(dir);
17321
- const out = path6.resolve(outputDir);
17504
+ const root = path8.resolve(dir);
17505
+ const out = path8.resolve(outputDir);
17322
17506
  const within = (child, parent) => {
17323
- const rel = path6.relative(parent, child);
17324
- return rel === "" || !rel.startsWith("..") && !path6.isAbsolute(rel);
17507
+ const rel = path8.relative(parent, child);
17508
+ return rel === "" || !rel.startsWith("..") && !path8.isAbsolute(rel);
17325
17509
  };
17326
17510
  if (out === root) throw new OkfExportError("UNSAFE_DESTINATION", "Refusing to export onto the project root.");
17327
17511
  if (within(root, out)) throw new OkfExportError("UNSAFE_DESTINATION", "Refusing to export onto a parent of the project.");
17328
17512
  for (const protectedDir of ["knowledge", "packages", "apps", "src", "node_modules", ".git"]) {
17329
- const p = path6.join(root, protectedDir);
17513
+ const p = path8.join(root, protectedDir);
17330
17514
  if (out === p || within(out, p)) throw new OkfExportError("UNSAFE_DESTINATION", `Refusing to export into a protected directory: ${protectedDir}/`);
17331
17515
  }
17332
17516
  if (fs7.existsSync(out)) {
17333
17517
  try {
17334
17518
  const entries = fs7.readdirSync(out);
17335
- const looksOkf = entries.includes("index.md") && /okf_version/.test(fs7.readFileSync(path6.join(out, "index.md"), "utf-8"));
17519
+ const looksOkf = entries.includes("index.md") && /okf_version/.test(fs7.readFileSync(path8.join(out, "index.md"), "utf-8"));
17336
17520
  if (entries.length > 0 && !looksOkf) {
17337
17521
  throw new OkfExportError("UNSAFE_DESTINATION", `Destination is not empty and is not an OKF bundle: ${outputDir}. Use an empty or dedicated directory.`);
17338
17522
  }
@@ -17357,7 +17541,7 @@ function detectCollisions(concepts) {
17357
17541
  }
17358
17542
  function exportOkf(dir, opts = {}) {
17359
17543
  const outRel = opts.output ?? OKF_DEFAULT_OUTPUT;
17360
- const outputDir = path6.isAbsolute(outRel) ? outRel : path6.join(dir, outRel);
17544
+ const outputDir = path8.isAbsolute(outRel) ? outRel : path8.join(dir, outRel);
17361
17545
  assertSafeDestination(dir, outputDir);
17362
17546
  const extraWarnings = [];
17363
17547
  const artifacts = discoverKnowledge(dir);
@@ -17413,7 +17597,7 @@ ${c.body ?? ""}`;
17413
17597
  const dirs = /* @__PURE__ */ new Map();
17414
17598
  const childDirs = /* @__PURE__ */ new Map();
17415
17599
  for (const c of concepts) {
17416
- const d = path6.posix.dirname(c.path);
17600
+ const d = path8.posix.dirname(c.path);
17417
17601
  (dirs.get(d) ?? dirs.set(d, []).get(d)).push(c);
17418
17602
  const segs = d === "." ? [] : d.split("/");
17419
17603
  for (let i = 0; i < segs.length; i++) {
@@ -17439,8 +17623,8 @@ ${c.body ?? ""}`;
17439
17623
  try {
17440
17624
  fs7.rmSync(staging, { recursive: true, force: true });
17441
17625
  for (const [rel, content] of files) {
17442
- const full = path6.join(staging, rel);
17443
- fs7.mkdirSync(path6.dirname(full), { recursive: true });
17626
+ const full = path8.join(staging, rel);
17627
+ fs7.mkdirSync(path8.dirname(full), { recursive: true });
17444
17628
  fs7.writeFileSync(full, content, "utf-8");
17445
17629
  }
17446
17630
  const backup = `${outputDir}.old-${process.pid}-${Date.now()}`;
@@ -17469,13 +17653,13 @@ ${c.body ?? ""}`;
17469
17653
 
17470
17654
  // src/core/okf/validate.ts
17471
17655
  import fs8 from "fs";
17472
- import path7 from "path";
17656
+ import path9 from "path";
17473
17657
  import matter23 from "gray-matter";
17474
17658
  function walk(root) {
17475
17659
  const out = [];
17476
17660
  const rec = (d) => {
17477
17661
  for (const entry of fs8.readdirSync(d)) {
17478
- const full = path7.join(d, entry);
17662
+ const full = path9.join(d, entry);
17479
17663
  const st = fs8.statSync(full);
17480
17664
  if (st.isDirectory()) rec(full);
17481
17665
  else if (entry.endsWith(".md")) out.push(full);
@@ -17497,24 +17681,24 @@ function internalLinks(body) {
17497
17681
  }
17498
17682
  function validateOkf(dir, opts = {}) {
17499
17683
  const loc = opts.location ?? OKF_DEFAULT_OUTPUT;
17500
- const bundleDir = path7.isAbsolute(loc) ? loc : path7.join(dir, loc);
17684
+ const bundleDir = path9.isAbsolute(loc) ? loc : path9.join(dir, loc);
17501
17685
  const findings = [];
17502
17686
  if (!fs8.existsSync(bundleDir)) {
17503
17687
  findings.push({ level: "conformance", message: `OKF bundle directory not found: ${loc}. Run \`kaddo okf export\` first.` });
17504
17688
  return { dir: bundleDir, conformant: false, conceptCount: 0, findings, counts: { conformance: 1, warning: 0, info: 0 } };
17505
17689
  }
17506
17690
  const files = walk(bundleDir);
17507
- const rel = (f) => path7.relative(bundleDir, f).split(path7.sep).join("/");
17691
+ const rel = (f) => path9.relative(bundleDir, f).split(path9.sep).join("/");
17508
17692
  const present = new Set(files.map(rel));
17509
17693
  const idToFile = /* @__PURE__ */ new Map();
17510
17694
  let conceptCount = 0;
17511
- const rootIndex = path7.join(bundleDir, "index.md");
17695
+ const rootIndex = path9.join(bundleDir, "index.md");
17512
17696
  if (!fs8.existsSync(rootIndex)) {
17513
17697
  findings.push({ level: "warning", message: "No root index.md \u2014 the bundle has no top-level navigation entry." });
17514
17698
  }
17515
17699
  for (const file of files) {
17516
17700
  const r = rel(file);
17517
- const isIndex = path7.basename(file) === "index.md";
17701
+ const isIndex = path9.basename(file) === "index.md";
17518
17702
  let data = {};
17519
17703
  try {
17520
17704
  data = matter23(fs8.readFileSync(file, "utf-8")).data ?? {};
@@ -17545,7 +17729,7 @@ function validateOkf(dir, opts = {}) {
17545
17729
  }
17546
17730
  })();
17547
17731
  for (const href of internalLinks(body)) {
17548
- const resolved = path7.posix.normalize(path7.posix.join(path7.posix.dirname(r), href));
17732
+ const resolved = path9.posix.normalize(path9.posix.join(path9.posix.dirname(r), href));
17549
17733
  if (!present.has(resolved)) findings.push({ level: "info", file: r, message: `Internal link not resolvable yet: ${href}` });
17550
17734
  }
17551
17735
  }
@@ -17682,14 +17866,17 @@ export {
17682
17866
  getDeprecationPlan,
17683
17867
  getDeprecationPlans,
17684
17868
  getEpic,
17869
+ getEpicCollaboration,
17685
17870
  getExternalWorkItem,
17686
17871
  getImpactCandidates,
17687
17872
  getInitiative,
17873
+ getInitiativeCollaboration,
17688
17874
  getInitiativeContext,
17689
17875
  getIntegration,
17690
17876
  getIntegrationFilters,
17691
17877
  getIntegrationSecretStatus,
17692
17878
  getPlan,
17879
+ getPlanCollaboration,
17693
17880
  getProductionRunbook,
17694
17881
  getResource,
17695
17882
  getResourceReferences,
@@ -17700,8 +17887,10 @@ export {
17700
17887
  getStatus as getTelemetryStatus,
17701
17888
  getWorkItem,
17702
17889
  getWorkItemCaptureDefinition,
17890
+ getWorkItemCollaboration,
17703
17891
  getWorkItemForEdit,
17704
17892
  getWorkItems,
17893
+ getWorkItemsCollaboration,
17705
17894
  getWorkItemsSummary,
17706
17895
  importExternalWorkItem,
17707
17896
  importWorkItem,
@@ -17789,6 +17978,7 @@ export {
17789
17978
  updateResource,
17790
17979
  updateTarget,
17791
17980
  updateWorkItem,
17981
+ updateWorkItemAssignments,
17792
17982
  validateConfigAgainstSchema,
17793
17983
  validateEpicDependencyChange,
17794
17984
  validateOkf,