@kaddo/cli 3.124.1 → 3.124.2

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 (2) hide show
  1. package/dist/index.js +28 -16
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -21910,7 +21910,7 @@ function buildImpactReport(dir, opts = {}, now = /* @__PURE__ */ new Date()) {
21910
21910
  let withAcceptance = 0;
21911
21911
  let withDoD = 0;
21912
21912
  let withValidation = 0;
21913
- let connectedRoadmap = 0;
21913
+ const connectedRoadmapCandidates = /* @__PURE__ */ new Set();
21914
21914
  const globCounts = /* @__PURE__ */ new Map();
21915
21915
  const globOwners = /* @__PURE__ */ new Map();
21916
21916
  const gaps = {
@@ -21934,13 +21934,17 @@ function buildImpactReport(dir, opts = {}, now = /* @__PURE__ */ new Date()) {
21934
21934
  for (const wi of wis) {
21935
21935
  const id = wi.id || wi.title;
21936
21936
  if (wi.codeGlobs.length > 0) withOwnership++;
21937
- else gaps.missing_code_ownership.push(gapItem(wi, "Add `code:` globs to connect this Work Item to source paths (`kaddo owners suggest`)."));
21938
- const hasSource = Boolean(wi.sourceId) || wi.source === "roadmap";
21937
+ else if (wi.type === "bugfix" || wi.type === "hotfix") {
21938
+ gaps.missing_code_ownership.push(gapItem(wi, "Add `code:` globs to connect this corrective Work Item to source paths (`kaddo owners suggest`)."));
21939
+ }
21940
+ const roadmapOrigin = wi.source === "roadmap";
21941
+ const hasSource = Boolean(wi.source) || Boolean(wi.sourceId);
21939
21942
  if (hasSource) withSource++;
21940
- else gaps.missing_source.push(gapItem(wi, "Add `source` or `source_id` if this Work Item came from the roadmap."));
21941
- if (hasSource || wi.initiative) connectedRoadmap++;
21943
+ if (roadmapOrigin && !wi.sourceId) {
21944
+ gaps.missing_source.push(gapItem(wi, "Add `source_id` for this roadmap-originated Work Item."));
21945
+ }
21946
+ if (roadmapOrigin && wi.sourceId) connectedRoadmapCandidates.add(wi.sourceId);
21942
21947
  if (wi.initiative) withInitiative++;
21943
- else gaps.missing_initiative.push(gapItem(wi, "Add `initiative` to connect this Work Item to a delivery initiative."));
21944
21948
  if (wi.knowledgeLevel) withLevel++;
21945
21949
  else gaps.missing_knowledge_level.push(gapItem(wi, "Add `knowledge_level` (K0\u2013K4) to the front matter."));
21946
21950
  for (const g2 of wi.codeGlobs) {
@@ -21962,10 +21966,11 @@ function buildImpactReport(dir, opts = {}, now = /* @__PURE__ */ new Date()) {
21962
21966
  }
21963
21967
  }
21964
21968
  const ownedCodePaths = [...globCounts.values()].reduce((a, b) => a + b, 0);
21969
+ const connectedRoadmap = connectedRoadmapCandidates.size;
21965
21970
  const broadGlobs = [...globCounts.keys()].filter((g2) => isBroadGlob(g2)).length;
21966
21971
  for (const [glob, owners] of globOwners) {
21967
21972
  if (owners.length > 1) {
21968
- gaps.ownership_overlaps.push({ code_path: glob, work_items: [...new Set(owners)], suggested_action: "Review whether the overlap is expected or should be narrowed." });
21973
+ gaps.ownership_overlaps.push({ code_path: glob, work_items: [...new Set(owners)], suggested_action: "Shared historical modification path; it is not a conflict unless incompatible ownership is documented." });
21969
21974
  }
21970
21975
  }
21971
21976
  const ownershipOverlaps = gaps.ownership_overlaps.length;
@@ -22037,9 +22042,10 @@ function buildImpactReport(dir, opts = {}, now = /* @__PURE__ */ new Date()) {
22037
22042
  const deliveryTrace = levelFromRatio(
22038
22043
  coverageRatio(withOwnership) * 0.5 + (g.available && g.edges > 0 ? 1 : 0) * 0.25 + (exp.roadmap.present ? 1 : 0) * 0.25
22039
22044
  );
22045
+ const guardHistory = buildGuardHistory(dir);
22040
22046
  const impact_signals = {
22041
22047
  ambiguity_reduction: levelFromRatio(ambiguityRatio),
22042
- drift_prevention: withOwnership > 0 ? "Active" : "Limited",
22048
+ drift_prevention: guardHistory.available && guardHistory.resolved > 0 ? "Observed" : "Unknown",
22043
22049
  onboarding_support: onboarding,
22044
22050
  delivery_traceability: deliveryTrace,
22045
22051
  ai_context_readiness: aiReady,
@@ -22048,17 +22054,19 @@ function buildImpactReport(dir, opts = {}, now = /* @__PURE__ */ new Date()) {
22048
22054
  let score = null;
22049
22055
  let score_breakdown = null;
22050
22056
  if (total > 0) {
22051
- const healthPts = [layerStatus("Business"), layerStatus("Product"), layerStatus("Tech"), layerStatus("Delivery")].filter((s) => s !== "Missing").length / 4 * 20;
22057
+ const layerMaturity = { Consolidated: 1, Structured: 0.8, Traceable: 0.75, Weak: 0.4, Missing: 0 };
22058
+ const healthPts = [layerStatus("Business"), layerStatus("Product"), layerStatus("Tech"), layerStatus("Delivery")].reduce((sum, status) => sum + (layerMaturity[status] ?? 0), 0) / 4 * 20;
22052
22059
  const applicableCoverage = knowledge_coverage.filter((c) => c.label !== "Work Items using optional initiatives");
22053
22060
  const covAvg = applicableCoverage.reduce((a, c) => a + coverageRatio(c.have), 0) / applicableCoverage.length;
22054
22061
  const coveragePts = covAvg * 20;
22055
22062
  const ownPts = coverageRatio(withOwnership) * 15;
22056
- const traceBlend = (exp.roadmap.candidates > 0 ? exp.roadmap.materialized / exp.roadmap.candidates : 1) * 0.5 + coverageRatio(withOwnership) * 0.5;
22063
+ const roadmapTraceRatio = exp.roadmap.candidates > 0 ? Math.min(connectedRoadmap, exp.roadmap.candidates) / exp.roadmap.candidates : null;
22064
+ const traceSignals = [coverageRatio(withOwnership), ...roadmapTraceRatio === null ? [] : [roadmapTraceRatio]];
22065
+ const traceBlend = traceSignals.reduce((sum, value) => sum + value, 0) / traceSignals.length;
22057
22066
  const tracePts = traceBlend * 20;
22058
22067
  const qualityMap = { good: 1, partial: 0.6, sparse: 0.3, empty: 0, unknown: 0 };
22059
22068
  const graphPts = (g.available ? qualityMap[g.quality] ?? 0 : 0) * 15;
22060
22069
  const ctxPts = { Low: 0.25, Medium: 0.5, High: 0.8, "Very High": 1 }[ctxLevel] * 10;
22061
- score = Math.round(healthPts + coveragePts + ownPts + tracePts + graphPts + ctxPts);
22062
22070
  score_breakdown = {
22063
22071
  knowledge_health: { points: Math.round(healthPts), max: 20 },
22064
22072
  knowledge_coverage: { points: Math.round(coveragePts), max: 20 },
@@ -22067,6 +22075,7 @@ function buildImpactReport(dir, opts = {}, now = /* @__PURE__ */ new Date()) {
22067
22075
  graph_quality: { points: Math.round(graphPts), max: 15 },
22068
22076
  context_readiness: { points: Math.round(ctxPts), max: 10 }
22069
22077
  };
22078
+ score = Object.values(score_breakdown).reduce((sum, component) => sum + component.points, 0);
22070
22079
  }
22071
22080
  const idsOf = (items) => items.map((i) => i.id);
22072
22081
  const groupedAction = (items, verb) => {
@@ -22105,7 +22114,7 @@ function buildImpactReport(dir, opts = {}, now = /* @__PURE__ */ new Date()) {
22105
22114
  { id: "work-items.lifecycle", label: "Work Item lifecycle", classification: total > 0 ? "observed" : "unknown", reason: total > 0 ? `${total} Work Item artifact(s) were discovered.` : "No Work Item artifacts were discovered." },
22106
22115
  { id: "delivery.verification", label: "Verified delivery outcomes", classification: verifiedWorkItems > 0 ? "observed" : "unknown", reason: verifiedWorkItems > 0 ? `${verifiedWorkItems} Work Item(s) have persisted validation_status: passed.` : "Acceptance Criteria and Definition of Done sections show declared intent, not completed verification evidence." },
22107
22116
  ...deliveryCapabilityEvidence(dir, projectContext),
22108
- { id: "guard-history", label: "Guard consistency history", classification: buildGuardHistory(dir).available ? "observed" : "unknown", reason: buildGuardHistory(dir).available ? "Recorded Guard runs provide current consistency evidence." : "No recorded Guard history is available." }
22117
+ { id: "guard-history", label: "Guard consistency history", classification: guardHistory.available ? "observed" : "unknown", reason: guardHistory.available ? "Recorded Guard runs provide current consistency evidence." : "No recorded Guard history is available." }
22109
22118
  ],
22110
22119
  scope: g.scope,
22111
22120
  default_scope: "all",
@@ -22143,7 +22152,7 @@ function buildImpactReport(dir, opts = {}, now = /* @__PURE__ */ new Date()) {
22143
22152
  },
22144
22153
  graph_quality: g.available ? { available: true, scope: g.scope, quality: g.quality, nodes: g.nodes, edges: g.edges, hints: g.hints, reason: g.scopeReason, last_exported: g.generatedAt } : { available: false, suggestion: "Run `kaddo graph export --scope all`." },
22145
22154
  guard_activity: (() => {
22146
- const gh = buildGuardHistory(dir);
22155
+ const gh = guardHistory;
22147
22156
  return gh.available ? { available: true, runs_recorded: gh.total_runs, detected: gh.detected, open: gh.open, resolved: gh.resolved, resolution_rate: gh.resolution_rate } : { available: false, note: "Guard history is not persisted. Run `kaddo guard --record` to record runs for trend analysis." };
22148
22157
  })(),
22149
22158
  impact_signals,
@@ -22254,7 +22263,7 @@ function renderImpactMarkdown(r) {
22254
22263
  L.push("## Impact Signals", "");
22255
22264
  const s = r.impact_signals;
22256
22265
  L.push(`- Ambiguity reduction: ${s.ambiguity_reduction}`);
22257
- L.push(`- Drift prevention: ${s.drift_prevention}`);
22266
+ L.push(`- Drift prevention evidence: ${s.drift_prevention}`);
22258
22267
  L.push(`- Onboarding support: ${s.onboarding_support}`);
22259
22268
  L.push(`- Delivery traceability: ${s.delivery_traceability}`);
22260
22269
  L.push(`- AI context readiness: ${s.ai_context_readiness}`);
@@ -22289,7 +22298,7 @@ function renderImpactMarkdown(r) {
22289
22298
  L.push("");
22290
22299
  }
22291
22300
  if (gp.ownership_overlaps.length > 0) {
22292
- L.push("### Ownership overlaps", "");
22301
+ L.push("### Shared code-path history (review only)", "");
22293
22302
  for (const o of gp.ownership_overlaps) {
22294
22303
  L.push(`- \`${o.code_path}\``);
22295
22304
  L.push(` - Owned by: ${o.work_items.join(", ")}`);
@@ -22297,7 +22306,7 @@ function renderImpactMarkdown(r) {
22297
22306
  }
22298
22307
  L.push("");
22299
22308
  }
22300
- const anyGaps = gp.missing_source.length + gp.missing_initiative.length + gp.missing_code_ownership.length + gp.missing_knowledge_level.length + gp.missing_acceptance_criteria.length + gp.missing_definition_of_done.length + gp.missing_validation.length + gp.broad_ownership_globs.length + gp.ownership_overlaps.length;
22309
+ const anyGaps = gp.missing_source.length + gp.missing_initiative.length + gp.missing_code_ownership.length + gp.missing_knowledge_level.length + gp.missing_acceptance_criteria.length + gp.missing_definition_of_done.length + gp.missing_validation.length + gp.broad_ownership_globs.length;
22301
22310
  if (anyGaps === 0) {
22302
22311
  L.push("No actionable knowledge gaps detected. \u{1F389}", "");
22303
22312
  }
@@ -22727,6 +22736,9 @@ function renderDriftMarkdown(r) {
22727
22736
  L.push("## Guard History", "");
22728
22737
  L.push("No guard history recorded yet.");
22729
22738
  L.push("");
22739
+ L.push("## Historical Drift Trend", "");
22740
+ L.push("Not available \u2014 no recorded Guard runs.");
22741
+ L.push("");
22730
22742
  L.push("Run `kaddo guard --record` to start recording drift evidence.");
22731
22743
  L.push("");
22732
22744
  L.push("## Suggested Actions", "");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kaddo/cli",
3
- "version": "3.124.1",
3
+ "version": "3.124.2",
4
4
  "description": "Knowledge Driven Development toolkit",
5
5
  "license": "MIT",
6
6
  "repository": {