kibi-cli 0.16.1 → 0.18.1

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 (229) hide show
  1. package/dist/cli-json-command.d.ts.map +1 -1
  2. package/dist/cli-json-command.js +87 -11
  3. package/dist/cli-register-maintenance.d.ts.map +1 -1
  4. package/dist/cli-register-maintenance.js +8 -0
  5. package/dist/cli-register-reporting.d.ts.map +1 -1
  6. package/dist/cli-register-reporting.js +5 -0
  7. package/dist/cli.d.ts.map +1 -1
  8. package/dist/cli.js +2 -1
  9. package/dist/commands/aggregated-checks.d.ts.map +1 -1
  10. package/dist/commands/aggregated-checks.js +1 -0
  11. package/dist/commands/check.d.ts.map +1 -1
  12. package/dist/commands/check.js +1 -1
  13. package/dist/commands/coverage.d.ts +5 -0
  14. package/dist/commands/coverage.d.ts.map +1 -1
  15. package/dist/commands/coverage.js +5 -0
  16. package/dist/commands/discovery-table.d.ts.map +1 -1
  17. package/dist/commands/discovery-table.js +96 -5
  18. package/dist/commands/sync/cache.d.ts +2 -0
  19. package/dist/commands/sync/cache.d.ts.map +1 -1
  20. package/dist/commands/sync/cache.js +8 -0
  21. package/dist/commands/sync/manifest.d.ts +12 -1
  22. package/dist/commands/sync/manifest.d.ts.map +1 -1
  23. package/dist/commands/sync/manifest.js +22 -5
  24. package/dist/commands/sync/persistence.d.ts.map +1 -1
  25. package/dist/commands/sync/persistence.js +76 -2
  26. package/dist/commands/sync.d.ts.map +1 -1
  27. package/dist/commands/sync.js +72 -15
  28. package/dist/commands/usage-metrics.d.ts +66 -2
  29. package/dist/commands/usage-metrics.d.ts.map +1 -1
  30. package/dist/commands/usage-metrics.js +34 -24
  31. package/dist/commands/usage-remediation.d.ts +9 -0
  32. package/dist/commands/usage-remediation.d.ts.map +1 -0
  33. package/dist/commands/usage-remediation.js +52 -0
  34. package/dist/extractors/markdown.d.ts +17 -1
  35. package/dist/extractors/markdown.d.ts.map +1 -1
  36. package/dist/extractors/markdown.js +81 -2
  37. package/dist/logic/ir.d.ts +112 -0
  38. package/dist/logic/ir.d.ts.map +1 -0
  39. package/dist/logic/ir.js +729 -0
  40. package/dist/operations/modeling/logic-modeling.d.ts +22 -0
  41. package/dist/operations/modeling/logic-modeling.d.ts.map +1 -0
  42. package/dist/operations/modeling/logic-modeling.js +120 -0
  43. package/dist/operations/modeling/model-requirement.d.ts.map +1 -1
  44. package/dist/operations/modeling/model-requirement.js +83 -2
  45. package/dist/operations/modeling/predicate-applyplan.d.ts +1 -1
  46. package/dist/operations/modeling/predicate-applyplan.d.ts.map +1 -1
  47. package/dist/operations/modeling/predicate-applyplan.js +29 -4
  48. package/dist/operations/modeling/predicate-inference.d.ts.map +1 -1
  49. package/dist/operations/modeling/predicate-inference.js +3 -0
  50. package/dist/operations/modeling/predicate-loader.d.ts.map +1 -1
  51. package/dist/operations/modeling/predicate-loader.js +7 -1
  52. package/dist/operations/modeling/predicate-ranker.d.ts.map +1 -1
  53. package/dist/operations/modeling/predicate-ranker.js +40 -2
  54. package/dist/operations/modeling/predicate-types.d.ts +12 -1
  55. package/dist/operations/modeling/predicate-types.d.ts.map +1 -1
  56. package/dist/operations/modeling/requirement-types.d.ts +12 -0
  57. package/dist/operations/modeling/requirement-types.d.ts.map +1 -1
  58. package/dist/operations/modeling/suggest-predicates.d.ts.map +1 -1
  59. package/dist/operations/modeling/suggest-predicates.js +35 -11
  60. package/dist/operations/mutation/audit.js +1 -1
  61. package/dist/operations/mutation/contradictions.d.ts +1 -1
  62. package/dist/operations/mutation/contradictions.d.ts.map +1 -1
  63. package/dist/operations/mutation/contradictions.js +23 -18
  64. package/dist/operations/mutation/relationships.d.ts.map +1 -1
  65. package/dist/operations/mutation/relationships.js +8 -0
  66. package/dist/operations/mutation/serialization.d.ts.map +1 -1
  67. package/dist/operations/mutation/serialization.js +6 -0
  68. package/dist/operations/mutation/strict-fact.d.ts.map +1 -1
  69. package/dist/operations/mutation/strict-fact.js +68 -3
  70. package/dist/operations/mutation/upsert.d.ts +3 -1
  71. package/dist/operations/mutation/upsert.d.ts.map +1 -1
  72. package/dist/operations/mutation/upsert.js +51 -12
  73. package/dist/operations/mutation/validate-upsert.d.ts.map +1 -1
  74. package/dist/operations/mutation/validate-upsert.js +18 -2
  75. package/dist/operations/mutation/validation.d.ts.map +1 -1
  76. package/dist/operations/mutation/validation.js +8 -0
  77. package/dist/operations/semantic-advisor/analysis-receipt.d.ts +2 -2
  78. package/dist/operations/semantic-advisor/analysis-receipt.d.ts.map +1 -1
  79. package/dist/operations/semantic-advisor/analysis-receipt.js +30 -16
  80. package/dist/operations/semantic-advisor/analyze-prose.d.ts +1 -1
  81. package/dist/operations/semantic-advisor/analyze-prose.d.ts.map +1 -1
  82. package/dist/operations/semantic-advisor/analyze-prose.js +464 -27
  83. package/dist/operations/semantic-advisor/clauses.d.ts +1 -0
  84. package/dist/operations/semantic-advisor/clauses.d.ts.map +1 -1
  85. package/dist/operations/semantic-advisor/clauses.js +7 -7
  86. package/dist/operations/semantic-advisor/ingestion-boundary.d.ts +18 -0
  87. package/dist/operations/semantic-advisor/ingestion-boundary.d.ts.map +1 -0
  88. package/dist/operations/semantic-advisor/ingestion-boundary.js +167 -0
  89. package/dist/operations/semantic-advisor/observation-plan.d.ts.map +1 -1
  90. package/dist/operations/semantic-advisor/observation-plan.js +15 -3
  91. package/dist/operations/semantic-advisor/shared.d.ts +9 -0
  92. package/dist/operations/semantic-advisor/shared.d.ts.map +1 -1
  93. package/dist/operations/semantic-advisor/shared.js +38 -4
  94. package/dist/operations/semantic-advisor/types.d.ts +66 -1
  95. package/dist/operations/semantic-advisor/types.d.ts.map +1 -1
  96. package/dist/prolog/codec.d.ts.map +1 -1
  97. package/dist/prolog/codec.js +19 -2
  98. package/dist/prolog.d.ts +6 -0
  99. package/dist/prolog.d.ts.map +1 -1
  100. package/dist/prolog.js +247 -63
  101. package/dist/public/diagnostic-usage.d.ts +17 -0
  102. package/dist/public/diagnostic-usage.d.ts.map +1 -0
  103. package/dist/public/diagnostic-usage.js +152 -0
  104. package/dist/public/distribution-parity.d.ts +90 -0
  105. package/dist/public/distribution-parity.d.ts.map +1 -0
  106. package/dist/public/distribution-parity.js +367 -0
  107. package/dist/public/impact/full-kb-quality.d.ts +2 -0
  108. package/dist/public/impact/full-kb-quality.d.ts.map +1 -1
  109. package/dist/public/impact/full-kb-quality.js +53 -1
  110. package/dist/public/impact-diagnostics.d.ts +2 -0
  111. package/dist/public/impact-diagnostics.d.ts.map +1 -1
  112. package/dist/public/impact-diagnostics.js +1 -0
  113. package/dist/public/operations/catalog.d.ts +235 -11
  114. package/dist/public/operations/catalog.d.ts.map +1 -1
  115. package/dist/public/operations/check-executor.d.ts.map +1 -1
  116. package/dist/public/operations/check-executor.js +4 -0
  117. package/dist/public/operations/discovery-executors.d.ts +6 -0
  118. package/dist/public/operations/discovery-executors.d.ts.map +1 -1
  119. package/dist/public/operations/discovery-executors.js +18 -2
  120. package/dist/public/operations/index.d.ts +5 -0
  121. package/dist/public/operations/index.d.ts.map +1 -1
  122. package/dist/public/operations/index.js +5 -0
  123. package/dist/public/operations/legacy-migration-plan.d.ts +113 -0
  124. package/dist/public/operations/legacy-migration-plan.d.ts.map +1 -0
  125. package/dist/public/operations/legacy-migration-plan.js +409 -0
  126. package/dist/public/operations/node-ports.d.ts.map +1 -1
  127. package/dist/public/operations/node-ports.js +90 -0
  128. package/dist/public/operations/repair-plan.d.ts +184 -0
  129. package/dist/public/operations/repair-plan.d.ts.map +1 -0
  130. package/dist/public/operations/repair-plan.js +397 -0
  131. package/dist/public/operations/runtime-types.d.ts +7 -0
  132. package/dist/public/operations/runtime-types.d.ts.map +1 -1
  133. package/dist/public/operations/specs/check.d.ts +3 -3
  134. package/dist/public/operations/specs/check.d.ts.map +1 -1
  135. package/dist/public/operations/specs/check.js +5 -2
  136. package/dist/public/operations/specs/discovery.d.ts +1 -1
  137. package/dist/public/operations/specs/discovery.js +1 -1
  138. package/dist/public/operations/specs/modeling.d.ts +35 -1
  139. package/dist/public/operations/specs/modeling.d.ts.map +1 -1
  140. package/dist/public/operations/specs/modeling.js +32 -1
  141. package/dist/public/operations/specs/mutation-schemas.d.ts +133 -3
  142. package/dist/public/operations/specs/mutation-schemas.d.ts.map +1 -1
  143. package/dist/public/operations/specs/mutation-schemas.js +67 -1
  144. package/dist/public/operations/specs/reporting.d.ts +42 -1
  145. package/dist/public/operations/specs/reporting.d.ts.map +1 -1
  146. package/dist/public/operations/specs/reporting.js +70 -6
  147. package/dist/public/operations/specs/semantic.d.ts +30 -2
  148. package/dist/public/operations/specs/semantic.d.ts.map +1 -1
  149. package/dist/public/operations/specs/semantic.js +35 -3
  150. package/dist/public/operations/specs/upsert.d.ts +133 -3
  151. package/dist/public/operations/specs/upsert.d.ts.map +1 -1
  152. package/dist/public/operations/workspace-snapshot.d.ts +10 -0
  153. package/dist/public/operations/workspace-snapshot.d.ts.map +1 -0
  154. package/dist/public/operations/workspace-snapshot.js +20 -0
  155. package/dist/public/schemas/entity.d.ts.map +1 -1
  156. package/dist/public/schemas/entity.js +332 -0
  157. package/dist/public/schemas/relationship.d.ts.map +1 -1
  158. package/dist/public/schemas/relationship.js +1 -0
  159. package/dist/public/skills/kibi-traceability/SKILL.md +7 -1
  160. package/dist/public/skills/kibi-usage/SKILL.md +44 -12
  161. package/dist/public/skills/kibi-usage/resources/fact-lanes.md +12 -2
  162. package/dist/public/skills/kibi-usage/resources/logic-ir.md +43 -0
  163. package/dist/public/skills/kibi-usage/resources/operation-access.md +19 -19
  164. package/dist/public/skills/kibi-usage/resources/ui-requirements.md +96 -0
  165. package/dist/public/skills/kibi-usage/resources/workflows.md +40 -8
  166. package/dist/public/symbol-granularity.d.ts +9 -0
  167. package/dist/public/symbol-granularity.d.ts.map +1 -1
  168. package/dist/public/symbol-granularity.js +16 -0
  169. package/dist/public/telemetry-acceptance.d.ts +89 -0
  170. package/dist/public/telemetry-acceptance.d.ts.map +1 -0
  171. package/dist/public/telemetry-acceptance.js +597 -0
  172. package/dist/public/telemetry-remediation.d.ts +33 -0
  173. package/dist/public/telemetry-remediation.d.ts.map +1 -0
  174. package/dist/public/telemetry-remediation.js +257 -0
  175. package/dist/public/verification-receipt.d.ts +75 -0
  176. package/dist/public/verification-receipt.d.ts.map +1 -0
  177. package/dist/public/verification-receipt.js +129 -0
  178. package/dist/schemas/entity.schema.json +401 -4
  179. package/dist/traceability/staged-diagnostics.d.ts +1 -1
  180. package/dist/traceability/staged-diagnostics.d.ts.map +1 -1
  181. package/dist/traceability/staged-diagnostics.js +17 -10
  182. package/dist/traceability/staged-impact-contract.js +1 -1
  183. package/dist/traceability/staged-symbols-manifest.d.ts.map +1 -1
  184. package/dist/traceability/staged-symbols-manifest.js +28 -10
  185. package/dist/traceability/temp-kb.d.ts.map +1 -1
  186. package/dist/traceability/temp-kb.js +49 -3
  187. package/dist/types/entities.d.ts +1 -0
  188. package/dist/types/entities.d.ts.map +1 -1
  189. package/dist/types/relationships.d.ts +1 -1
  190. package/dist/types/relationships.d.ts.map +1 -1
  191. package/dist/utils/rule-registry.d.ts +2 -0
  192. package/dist/utils/rule-registry.d.ts.map +1 -1
  193. package/dist/utils/rule-registry.js +18 -0
  194. package/dist/utils/schema-version.d.ts +1 -1
  195. package/dist/utils/schema-version.js +1 -1
  196. package/package.json +34 -2
  197. package/src/public/diagnostic-usage.ts +206 -0
  198. package/src/public/distribution-parity.ts +580 -0
  199. package/src/public/impact/full-kb-quality.ts +74 -1
  200. package/src/public/impact-diagnostics.ts +16 -0
  201. package/src/public/operations/check-executor.ts +4 -0
  202. package/src/public/operations/discovery-executors.ts +24 -2
  203. package/src/public/operations/index.ts +5 -0
  204. package/src/public/operations/legacy-migration-plan.ts +688 -0
  205. package/src/public/operations/node-ports.ts +109 -0
  206. package/src/public/operations/repair-plan.ts +562 -0
  207. package/src/public/operations/runtime-types.ts +8 -0
  208. package/src/public/operations/specs/check.ts +5 -2
  209. package/src/public/operations/specs/discovery.ts +1 -1
  210. package/src/public/operations/specs/modeling.ts +39 -1
  211. package/src/public/operations/specs/mutation-schemas.ts +77 -1
  212. package/src/public/operations/specs/reporting.ts +91 -6
  213. package/src/public/operations/specs/semantic.ts +42 -3
  214. package/src/public/operations/workspace-snapshot.ts +28 -0
  215. package/src/public/schemas/entity.ts +340 -1
  216. package/src/public/schemas/relationship.ts +1 -0
  217. package/src/public/skills/kibi-traceability/SKILL.md +7 -1
  218. package/src/public/skills/kibi-usage/SKILL.md +44 -12
  219. package/src/public/skills/kibi-usage/resources/fact-lanes.md +12 -2
  220. package/src/public/skills/kibi-usage/resources/logic-ir.md +43 -0
  221. package/src/public/skills/kibi-usage/resources/operation-access.md +19 -19
  222. package/src/public/skills/kibi-usage/resources/ui-requirements.md +96 -0
  223. package/src/public/skills/kibi-usage/resources/workflows.md +40 -8
  224. package/src/public/symbol-granularity.ts +25 -0
  225. package/src/public/telemetry-acceptance.ts +859 -0
  226. package/src/public/telemetry-remediation.ts +462 -0
  227. package/src/public/verification-receipt.ts +170 -0
  228. package/src/schemas/entity.schema.json +401 -4
  229. package/src/schemas/relationship.schema.json +1 -0
@@ -1 +1 @@
1
- {"version":3,"file":"cli-json-command.d.ts","sourceRoot":"","sources":["../src/cli-json-command.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAIzC,OAAO,EACL,KAAK,aAAa,EAGnB,MAAM,8BAA8B,CAAC;AAItC,MAAM,MAAM,cAAc,GAAG;IAC3B,QAAQ,CAAC,aAAa,EAAE,aAAa,CAAC;IACtC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,WAAW,CAAC,EAAE,SAAS;QAC9B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;QACtB,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,CAAC;KACpC,EAAE,CAAC;CACL,CAAC;AAyBF,wBAAsB,iBAAiB,CACrC,UAAU,EAAE,cAAc,GACzB,OAAO,CAAC,IAAI,CAAC,CAiDf;AAaD,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CA0B/D"}
1
+ {"version":3,"file":"cli-json-command.d.ts","sourceRoot":"","sources":["../src/cli-json-command.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAMzC,OAAO,EACL,KAAK,aAAa,EAGnB,MAAM,8BAA8B,CAAC;AAItC,MAAM,MAAM,cAAc,GAAG;IAC3B,QAAQ,CAAC,aAAa,EAAE,aAAa,CAAC;IACtC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,WAAW,CAAC,EAAE,SAAS;QAC9B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;QACtB,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,CAAC;KACpC,EAAE,CAAC;CACL,CAAC;AA0CF,wBAAsB,iBAAiB,CACrC,UAAU,EAAE,cAAc,GACzB,OAAO,CAAC,IAAI,CAAC,CAyGf;AAaD,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CA0B/D"}
@@ -1,6 +1,8 @@
1
1
  import { InputError } from "./cli-errors.js";
2
2
  import { loadInput } from "./cli-input.js";
3
3
  import { executeOperation as executeProtocolOperation } from "./cli-protocol.js";
4
+ import { prepareOperationInput } from "./cli-validate.js";
5
+ import { appendCliDiagnosticUsage } from "./public/diagnostic-usage.js";
4
6
  import { getSpec, listSpecs, } from "./public/operations/index.js";
5
7
  import { createCliRuntime } from "./runtime/cli-runtime.js";
6
8
  function writeInputError(error) {
@@ -21,11 +23,42 @@ function findInputConflicts(invocation) {
21
23
  .map(({ name }) => name);
22
24
  return [...positionalConflicts, ...optionConflicts];
23
25
  }
26
+ function diagnosticModeEnabled(command) {
27
+ return (process.env.KIBI_CLI_DIAGNOSTIC_MODE === "1" ||
28
+ process.argv.includes("--diagnostic-mode") ||
29
+ command.optsWithGlobals().diagnosticMode === true);
30
+ }
31
+ function structuredResult(stdout) {
32
+ if (stdout === undefined)
33
+ return undefined;
34
+ try {
35
+ return JSON.parse(stdout);
36
+ }
37
+ catch {
38
+ return undefined;
39
+ }
40
+ }
24
41
  // implements REQ-kibi-operation-interface-parity
25
42
  export async function runJsonInvocation(invocation) {
43
+ const startedAt = new Date();
44
+ const diagnostic = diagnosticModeEnabled(invocation.command);
45
+ const workspaceRoot = process.cwd();
46
+ const spec = getSpec(invocation.operationName);
26
47
  const conflicts = findInputConflicts(invocation);
27
48
  if (conflicts.length > 0) {
28
- writeInputError(new InputError("CONFLICTING_INPUT", `--input cannot be combined with: ${conflicts.join(", ")}`));
49
+ const error = new InputError("CONFLICTING_INPUT", `--input cannot be combined with: ${conflicts.join(", ")}`);
50
+ if (diagnostic) {
51
+ appendCliDiagnosticUsage({
52
+ workspaceRoot,
53
+ tool: invocation.operationName,
54
+ businessArgs: {},
55
+ telemetry: null,
56
+ startedAt,
57
+ status: "error",
58
+ error: error.detail,
59
+ });
60
+ }
61
+ writeInputError(error);
29
62
  return;
30
63
  }
31
64
  let input;
@@ -37,23 +70,66 @@ export async function runJsonInvocation(invocation) {
37
70
  }
38
71
  catch (error) {
39
72
  if (error instanceof InputError) {
73
+ if (diagnostic) {
74
+ appendCliDiagnosticUsage({
75
+ workspaceRoot,
76
+ tool: invocation.operationName,
77
+ businessArgs: {},
78
+ telemetry: null,
79
+ startedAt,
80
+ status: "error",
81
+ error: error.detail,
82
+ });
83
+ }
40
84
  writeInputError(error);
41
85
  return;
42
86
  }
43
87
  throw error;
44
88
  }
45
- const workspaceRoot = process.cwd();
46
- const spec = getSpec(invocation.operationName);
89
+ const prepared = prepareOperationInput(input, spec.businessInputSchema);
90
+ const businessArgs = prepared.valid ? prepared.businessInput : {};
91
+ const telemetry = prepared.valid ? (prepared.telemetry ?? null) : null;
47
92
  const runtime = createCliRuntime({ workspaceRoot });
48
- const context = await runtime.open(spec, { workspaceRoot });
49
- const result = await executeProtocolOperation(invocation.operationName, input, context);
50
- if (result.exitCode === 0 && spec.effects.includes("kb-write")) {
51
- await runtime.afterSuccess(spec, context);
93
+ let result;
94
+ try {
95
+ const context = await runtime.open(spec, { workspaceRoot });
96
+ result = await executeProtocolOperation(invocation.operationName, input, context);
97
+ if (result.exitCode === 0 && spec.effects.includes("kb-write")) {
98
+ await runtime.afterSuccess(spec, context);
99
+ }
100
+ await runtime.close(context, {
101
+ status: "success",
102
+ result,
103
+ });
104
+ }
105
+ catch (error) {
106
+ if (diagnostic) {
107
+ appendCliDiagnosticUsage({
108
+ workspaceRoot,
109
+ tool: invocation.operationName,
110
+ businessArgs,
111
+ telemetry,
112
+ startedAt,
113
+ status: "error",
114
+ error: error instanceof Error ? error.message : String(error),
115
+ });
116
+ }
117
+ throw error;
118
+ }
119
+ if (diagnostic) {
120
+ appendCliDiagnosticUsage({
121
+ workspaceRoot,
122
+ tool: invocation.operationName,
123
+ businessArgs,
124
+ telemetry,
125
+ startedAt,
126
+ status: result.exitCode === 0 ? "success" : "error",
127
+ result: structuredResult(result.stdout),
128
+ ...(result.exitCode === 0 || result.stderr === undefined
129
+ ? {}
130
+ : { error: result.stderr.trim() }),
131
+ });
52
132
  }
53
- await runtime.close(context, {
54
- status: "success",
55
- result,
56
- });
57
133
  if (result.stdout !== undefined) {
58
134
  process.stdout.write(result.stdout);
59
135
  }
@@ -1 +1 @@
1
- {"version":3,"file":"cli-register-maintenance.d.ts","sourceRoot":"","sources":["../src/cli-register-maintenance.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAQzC,wBAAgB,2BAA2B,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAoClE"}
1
+ {"version":3,"file":"cli-register-maintenance.d.ts","sourceRoot":"","sources":["../src/cli-register-maintenance.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AASzC,wBAAgB,2BAA2B,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAsDlE"}
@@ -3,6 +3,7 @@ import { branchEnsureCommand } from "./commands/branch.js";
3
3
  import { doctorCommand } from "./commands/doctor.js";
4
4
  import { gcCommand } from "./commands/gc.js";
5
5
  import { usageMetricsCommand } from "./commands/usage-metrics.js";
6
+ import { usageRemediationCommand } from "./commands/usage-remediation.js";
6
7
  // implements REQ-kibi-operation-interface-parity
7
8
  export function registerMaintenanceCommands(program) {
8
9
  program
@@ -22,7 +23,14 @@ export function registerMaintenanceCommands(program) {
22
23
  .description("Report usage and quality metrics from .kb/usage.log")
23
24
  .option("--format <format>", "Output format: json|table", "table")
24
25
  .option("--limit <n>", "Limit top zero-result source files", "10")
26
+ .option("--require-acceptance", "Exit non-zero unless the telemetry acceptance report passes")
25
27
  .action(withExitCode(async (options) => usageMetricsCommand(options)));
28
+ program
29
+ .command("usage-remediation")
30
+ .description("Enumerate exact diagnostic events and report-level evidence gaps requiring repair")
31
+ .option("--format <format>", "Output format: json|table", "table")
32
+ .option("--limit <n>", "Limit rendered table rows", "50")
33
+ .action(withExitCode(async (options) => usageRemediationCommand(options)));
26
34
  program
27
35
  .command("branch")
28
36
  .description("Manage branch KBs")
@@ -1 +1 @@
1
- {"version":3,"file":"cli-register-reporting.d.ts","sourceRoot":"","sources":["../src/cli-register-reporting.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAUzC,wBAAgB,yBAAyB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAuHhE"}
1
+ {"version":3,"file":"cli-register-reporting.d.ts","sourceRoot":"","sources":["../src/cli-register-reporting.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAUzC,wBAAgB,yBAAyB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAgJhE"}
@@ -41,6 +41,11 @@ export function registerReportingCommands(program) {
41
41
  .option("--no-include-transitive", "Disable transitive symbol coverage")
42
42
  .option("--limit <n>", "Limit results", "100")
43
43
  .option("--offset <n>", "Skip results", "0")
44
+ .option("--include-migration-preview", "Include one read-only legacy semantic migration preview batch", false)
45
+ .option("--migration-limit <n>", "Maximum migration preview batches (1-10)", "1")
46
+ .option("--migration-offset <n>", "Skip ready semantic-inventory migration batches", "0")
47
+ .option("--migration-predicate-limit <n>", "Maximum ranked predicate schemas per proposition", "5")
48
+ .option("--migration-predicate-min-score <score>", "Minimum predicate schema rank score", "0.35")
44
49
  .option("--format <format>", "Output format: json|table", "table")
45
50
  .action(async (options, command) => {
46
51
  if (options.input !== undefined) {
package/dist/cli.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"AAsBA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAOpC,YAAY,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAmBtD,wBAAgB,YAAY,IAAI,OAAO,CAYtC;AAGD,wBAAsB,IAAI,IAAI,OAAO,CAAC,KAAK,CAAC,CAgB3C"}
1
+ {"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"AAsBA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAOpC,YAAY,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAmBtD,wBAAgB,YAAY,IAAI,OAAO,CAgBtC;AAGD,wBAAsB,IAAI,IAAI,OAAO,CAAC,KAAK,CAAC,CAgB3C"}
package/dist/cli.js CHANGED
@@ -40,7 +40,8 @@ export function buildProgram() {
40
40
  const program = new Command()
41
41
  .name("kibi")
42
42
  .description("Prolog-based project knowledge base")
43
- .version(packageVersion(packageJson));
43
+ .version(packageVersion(packageJson))
44
+ .option("--diagnostic-mode", "Append diagnostic usage evidence for public JSON operations");
44
45
  registerFoundationCommands(program);
45
46
  registerReportingCommands(program);
46
47
  registerMaintenanceCommands(program);
@@ -1 +1 @@
1
- {"version":3,"file":"aggregated-checks.d.ts","sourceRoot":"","sources":["../../src/commands/aggregated-checks.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,aAAa,EAAmB,MAAM,cAAc,CAAC;AAEnE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAU5C;;;;;;;GAOG;AACH,wBAAsB,mBAAmB,CACvC,MAAM,EAAE,IAAI,CAAC,aAAa,EAAE,OAAO,CAAC,EACpC,cAAc,EAAE,GAAG,CAAC,MAAM,CAAC,GAAG,IAAI,EAClC,UAAU,UAAQ,GACjB,OAAO,CAAC,SAAS,EAAE,CAAC,CAuDtB"}
1
+ {"version":3,"file":"aggregated-checks.d.ts","sourceRoot":"","sources":["../../src/commands/aggregated-checks.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,aAAa,EAAmB,MAAM,cAAc,CAAC;AAEnE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAW5C;;;;;;;GAOG;AACH,wBAAsB,mBAAmB,CACvC,MAAM,EAAE,IAAI,CAAC,aAAa,EAAE,OAAO,CAAC,EACpC,cAAc,EAAE,GAAG,CAAC,MAAM,CAAC,GAAG,IAAI,EAClC,UAAU,UAAQ,GACjB,OAAO,CAAC,SAAS,EAAE,CAAC,CAwDtB"}
@@ -50,6 +50,7 @@ export async function runAggregatedChecks(prolog, rulesAllowlist, requireAdr = f
50
50
  description: v.description,
51
51
  ...(v.suggestion ? { suggestion: v.suggestion } : {}),
52
52
  ...(v.source ? { source: v.source } : {}),
53
+ ...(v.evidence ? { evidence: v.evidence } : {}),
53
54
  });
54
55
  }
55
56
  }
@@ -1 +1 @@
1
- {"version":3,"file":"check.d.ts","sourceRoot":"","sources":["../../src/commands/check.ts"],"names":[],"mappings":"AAmFA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AAE3D,YAAY,EAAE,SAAS,EAAE,CAAC;AAG1B,MAAM,WAAW,YAAY;IAC3B,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAC3B,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;CAC1B;AA2bD,wBAAsB,YAAY,CAChC,OAAO,EAAE,YAAY,GACpB,OAAO,CAAC;IAAE,QAAQ,EAAE,MAAM,CAAA;CAAE,CAAC,CAmW/B"}
1
+ {"version":3,"file":"check.d.ts","sourceRoot":"","sources":["../../src/commands/check.ts"],"names":[],"mappings":"AAkFA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AAE3D,YAAY,EAAE,SAAS,EAAE,CAAC;AAG1B,MAAM,WAAW,YAAY;IAC3B,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAC3B,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;CAC1B;AA2bD,wBAAsB,YAAY,CAChC,OAAO,EAAE,YAAY,GACpB,OAAO,CAAC;IAAE,QAAQ,EAAE,MAAM,CAAA;CAAE,CAAC,CAqW/B"}
@@ -453,7 +453,7 @@ export async function checkCommand(options) {
453
453
  symbolsByFile,
454
454
  symbolsManifestPath,
455
455
  });
456
- const stagedKibiDiagnostics = collectStagedKibiDiagnostics(stagedKibiEvidence);
456
+ const stagedKibiDiagnostics = collectStagedKibiDiagnostics(stagedKibiEvidence, symbolsManifestPath);
457
457
  const activeStagedSymbolEntityIds = new Set(stagedKibiEvidence.mode.kind === "kb_changes"
458
458
  ? stagedKibiEvidence.mode.kbArtifacts
459
459
  .filter((artifact) => artifact.kind === "symbols_manifest")
@@ -5,6 +5,11 @@ interface CoverageOptions {
5
5
  includeTransitive?: boolean;
6
6
  limit?: string;
7
7
  offset?: string;
8
+ includeMigrationPreview?: boolean;
9
+ migrationLimit?: string;
10
+ migrationOffset?: string;
11
+ migrationPredicateLimit?: string;
12
+ migrationPredicateMinScore?: string;
8
13
  format?: "json" | "table";
9
14
  }
10
15
  export declare function coverageCommand(options: CoverageOptions): Promise<void>;
@@ -1 +1 @@
1
- {"version":3,"file":"coverage.d.ts","sourceRoot":"","sources":["../../src/commands/coverage.ts"],"names":[],"mappings":"AAMA,UAAU,eAAe;IACvB,EAAE,CAAC,EAAE,KAAK,GAAG,QAAQ,GAAG,MAAM,CAAC;IAC/B,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;CAC3B;AAGD,wBAAsB,eAAe,CAAC,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,IAAI,CAAC,CAmB7E"}
1
+ {"version":3,"file":"coverage.d.ts","sourceRoot":"","sources":["../../src/commands/coverage.ts"],"names":[],"mappings":"AAMA,UAAU,eAAe;IACvB,EAAE,CAAC,EAAE,KAAK,GAAG,QAAQ,GAAG,MAAM,CAAC;IAC/B,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,uBAAuB,CAAC,EAAE,OAAO,CAAC;IAClC,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,uBAAuB,CAAC,EAAE,MAAM,CAAC;IACjC,0BAA0B,CAAC,EAAE,MAAM,CAAC;IACpC,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;CAC3B;AAGD,wBAAsB,eAAe,CAAC,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,IAAI,CAAC,CA6B7E"}
@@ -14,6 +14,11 @@ export async function coverageCommand(options) {
14
14
  includeTransitive: options.includeTransitive ?? true,
15
15
  limit: Number.parseInt(options.limit || "100", 10),
16
16
  offset: Number.parseInt(options.offset || "0", 10),
17
+ includeMigrationPreview: options.includeMigrationPreview ?? false,
18
+ migrationLimit: Number.parseInt(options.migrationLimit || "1", 10),
19
+ migrationOffset: Number.parseInt(options.migrationOffset || "0", 10),
20
+ migrationPredicateLimit: Number.parseInt(options.migrationPredicateLimit || "5", 10),
21
+ migrationPredicateMinScore: Number.parseFloat(options.migrationPredicateMinScore || "0.35"),
17
22
  });
18
23
  printDiscoveryResult(options.format, result.structuredContent, result.content[0]?.text ?? "Coverage summary unavailable.");
19
24
  }
@@ -1 +1 @@
1
- {"version":3,"file":"discovery-table.d.ts","sourceRoot":"","sources":["../../src/commands/discovery-table.ts"],"names":[],"mappings":"AAIA,wBAAgB,oBAAoB,CAAC,UAAU,EAAE,OAAO,GAAG,MAAM,GAAG,IAAI,CAmCvE;AA4ED,wBAAgB,mBAAmB,CACjC,OAAO,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,GACzC,MAAM,CA+DR"}
1
+ {"version":3,"file":"discovery-table.d.ts","sourceRoot":"","sources":["../../src/commands/discovery-table.ts"],"names":[],"mappings":"AAIA,wBAAgB,oBAAoB,CAAC,UAAU,EAAE,OAAO,GAAG,MAAM,GAAG,IAAI,CAmCvE;AA4ED,wBAAgB,mBAAmB,CACjC,OAAO,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,GACzC,MAAM,CA4ER"}
@@ -101,12 +101,14 @@ export function renderCoverageTable(payload) {
101
101
  "Priority",
102
102
  "Coverage",
103
103
  "Depth",
104
+ "Proof",
104
105
  "Scen",
105
106
  "Tests",
106
107
  "Symbols",
107
- "Gaps",
108
+ "Structural gaps",
109
+ "Proof gaps",
108
110
  ],
109
- colWidths: [20, 12, 12, 18, 32, 8, 8, 10, 28],
111
+ colWidths: [20, 12, 12, 18, 36, 12, 8, 8, 10, 24, 36],
110
112
  wordWrap: true,
111
113
  })
112
114
  : new Table({
@@ -123,23 +125,112 @@ export function renderCoverageTable(payload) {
123
125
  stringifyCell(item.priority),
124
126
  stringifyCell(item.coverageStatus),
125
127
  stringifyCell(item.coverageDepth),
128
+ stringifyCell(item.proofStatus),
126
129
  stringifyCell(item.scenarioCount),
127
130
  stringifyCell(item.testCount),
128
131
  stringifyCell(item.transitiveSymbolCount),
129
132
  joinCells(item.gaps),
133
+ joinCells(item.proofGaps),
130
134
  ]);
131
135
  }
132
136
  else {
133
137
  table.push([
134
138
  stringifyCell(item.id),
135
- stringifyCell(item.type),
139
+ stringifyCell(item.traceabilityRole ?? item.type),
136
140
  stringifyCell(item.coverageStatus),
137
- `req=${stringifyCell(item.directRequirementCount)} test=${stringifyCell(item.testCount)} count=${stringifyCell(item.count)}`,
141
+ `req=${stringifyCell(item.directRequirementCount)} covered=${stringifyCell(item.testCount)} executable=${stringifyCell(item.executableTestCount)} count=${stringifyCell(item.count)}`,
138
142
  joinCells(item.gaps),
139
143
  ]);
140
144
  }
141
145
  }
142
- return [summaryTable.toString(), table.toString()].join("\n\n");
146
+ const sections = [summaryTable.toString(), table.toString()];
147
+ const repairPlan = fieldsFrom(payload.repairPlan);
148
+ if (typeof repairPlan.version === "string") {
149
+ sections.push(renderRepairPlanTable(repairPlan));
150
+ }
151
+ const legacyMigrationPlan = fieldsFrom(payload.legacyMigrationPlan);
152
+ if (typeof legacyMigrationPlan.version === "string") {
153
+ sections.push(renderLegacyMigrationPlanTable(legacyMigrationPlan));
154
+ }
155
+ return sections.join("\n\n");
156
+ }
157
+ function renderLegacyMigrationPlanTable(plan) {
158
+ const scope = fieldsFrom(plan.scope);
159
+ const summary = fieldsFrom(plan.summary);
160
+ const batches = Array.isArray(plan.batches) ? plan.batches : [];
161
+ const summaryTable = new Table({
162
+ head: ["Legacy migration preview", "Value"],
163
+ colWidths: [28, 72],
164
+ wordWrap: true,
165
+ });
166
+ summaryTable.push(["Plan ID", stringifyCell(plan.planId)], ["Status", stringifyCell(plan.status)], ["Repair scope complete", stringifyCell(scope.repairPlanComplete)], ["Candidate requirements", stringifyCell(scope.candidateRequirements)], ["Selected requirements", stringifyCell(scope.selectedRequirements)], ["Next offset", stringifyCell(scope.nextOffset)], ["Propositions", stringifyCell(summary.propositionCount)], ["Unresolved", stringifyCell(summary.unresolvedPropositionCount)]);
167
+ const batchTable = new Table({
168
+ head: [
169
+ "Requirement",
170
+ "State",
171
+ "Source binding",
172
+ "Claims",
173
+ "Predicate candidates",
174
+ "Diagnostics",
175
+ ],
176
+ colWidths: [24, 18, 18, 10, 20, 46],
177
+ wordWrap: true,
178
+ });
179
+ for (const rawBatch of batches) {
180
+ const batch = fieldsFrom(rawBatch);
181
+ const sourceBinding = fieldsFrom(batch.sourceBinding);
182
+ const propositions = Array.isArray(batch.propositions)
183
+ ? batch.propositions
184
+ : [];
185
+ const candidateCount = propositions.reduce((count, proposition) => {
186
+ const candidates = fieldsFrom(proposition).predicateCandidates;
187
+ return count + (Array.isArray(candidates) ? candidates.length : 0);
188
+ }, 0);
189
+ batchTable.push([
190
+ stringifyCell(batch.requirementId),
191
+ stringifyCell(batch.state),
192
+ stringifyCell(sourceBinding.status),
193
+ propositions.length,
194
+ candidateCount,
195
+ joinCells(batch.diagnostics),
196
+ ]);
197
+ }
198
+ return [summaryTable.toString(), batchTable.toString()].join("\n\n");
199
+ }
200
+ function renderRepairPlanTable(repairPlan) {
201
+ const scope = fieldsFrom(repairPlan.scope);
202
+ const summary = fieldsFrom(repairPlan.summary);
203
+ const batches = Array.isArray(repairPlan.batches) ? repairPlan.batches : [];
204
+ const displayedBatches = batches.slice(0, 25);
205
+ const summaryTable = new Table({
206
+ head: ["Repair plan", "Value"],
207
+ colWidths: [24, 72],
208
+ wordWrap: true,
209
+ });
210
+ summaryTable.push(["Plan ID", stringifyCell(repairPlan.planId)], ["Status", stringifyCell(repairPlan.status)], ["Complete scope", stringifyCell(scope.complete)], ["Requirements", stringifyCell(summary.requirementCount)], ["Repairs", stringifyCell(summary.repairCount)], ["Batches", stringifyCell(summary.batchCount)]);
211
+ const batchTable = new Table({
212
+ head: ["Order", "Requirement", "Phase", "State", "Depends on", "Gaps"],
213
+ colWidths: [8, 24, 24, 10, 28, 32],
214
+ wordWrap: true,
215
+ });
216
+ for (const rawBatch of displayedBatches) {
217
+ const batch = fieldsFrom(rawBatch);
218
+ const repairs = Array.isArray(batch.repairs) ? batch.repairs : [];
219
+ batchTable.push([
220
+ stringifyCell(batch.order),
221
+ stringifyCell(batch.requirementId),
222
+ stringifyCell(batch.phase),
223
+ stringifyCell(batch.state),
224
+ joinCells(batch.dependsOn),
225
+ repairs
226
+ .map((repair) => stringifyCell(fieldsFrom(repair).gap))
227
+ .join(", ") || "-",
228
+ ]);
229
+ }
230
+ const suffix = displayedBatches.length < batches.length
231
+ ? `\nShowing ${displayedBatches.length} of ${batches.length} repair batches; use --format json for the complete plan.`
232
+ : "";
233
+ return [summaryTable.toString(), batchTable.toString()].join("\n\n") + suffix;
143
234
  }
144
235
  function renderGraphTable(payload) {
145
236
  const nodes = Array.isArray(payload.nodes) ? payload.nodes : [];
@@ -11,6 +11,8 @@ export type SyncCache = {
11
11
  version: number;
12
12
  hashes: Record<string, string>;
13
13
  seenAt: Record<string, string>;
14
+ semanticHashes: Record<string, string>;
15
+ semanticContracts: Record<string, boolean>;
14
16
  };
15
17
  export declare const SYNC_CACHE_VERSION = 1;
16
18
  export declare const SYNC_CACHE_TTL_MS: number;
@@ -1 +1 @@
1
- {"version":3,"file":"cache.d.ts","sourceRoot":"","sources":["../../../src/commands/sync/cache.ts"],"names":[],"mappings":"AAkBA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAG7E,UAAU,aAAa;IACrB,UAAU,EAAE,OAAO,UAAU,CAAC;IAC9B,UAAU,EAAE,OAAO,UAAU,CAAC;IAC9B,SAAS,EAAE,OAAO,SAAS,CAAC;IAC5B,YAAY,EAAE,OAAO,YAAY,CAAC;IAClC,aAAa,EAAE,OAAO,aAAa,CAAC;CACrC;AAaD,MAAM,MAAM,SAAS,GAAG;IACtB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC/B,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAChC,CAAC;AAEF,eAAO,MAAM,kBAAkB,IAAI,CAAC;AACpC,eAAO,MAAM,iBAAiB,QAA2B,CAAC;AAE1D,wBAAgB,UAAU,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAEnD;AAED,wBAAgB,QAAQ,CAEtB,QAAQ,EAAE,MAAM,EAChB,IAAI,CAAC,EAAE,OAAO,CAAC,aAAa,CAAC,GAC5B,MAAM,CAIR;AAED,wBAAgB,aAAa,CAE3B,SAAS,EAAE,MAAM,EACjB,IAAI,CAAC,EAAE,OAAO,CAAC,aAAa,CAAC,GAC5B,SAAS,CAkCX;AAED,wBAAgB,cAAc,CAE5B,SAAS,EAAE,MAAM,EACjB,KAAK,EAAE,SAAS,EAChB,IAAI,CAAC,EAAE,OAAO,CAAC,aAAa,CAAC,GAC5B,IAAI,CAaN;AAED,wBAAgB,aAAa,CAE3B,QAAQ,EAAE,MAAM,EAChB,WAAW,EAAE,MAAM,EACnB,IAAI,CAAC,EAAE,OAAO,CAAC,aAAa,CAAC,GAC5B,IAAI,CASN"}
1
+ {"version":3,"file":"cache.d.ts","sourceRoot":"","sources":["../../../src/commands/sync/cache.ts"],"names":[],"mappings":"AAkBA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAG7E,UAAU,aAAa;IACrB,UAAU,EAAE,OAAO,UAAU,CAAC;IAC9B,UAAU,EAAE,OAAO,UAAU,CAAC;IAC9B,SAAS,EAAE,OAAO,SAAS,CAAC;IAC5B,YAAY,EAAE,OAAO,YAAY,CAAC;IAClC,aAAa,EAAE,OAAO,aAAa,CAAC;CACrC;AAaD,MAAM,MAAM,SAAS,GAAG;IACtB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC/B,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC/B,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACvC,iBAAiB,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAC5C,CAAC;AAEF,eAAO,MAAM,kBAAkB,IAAI,CAAC;AACpC,eAAO,MAAM,iBAAiB,QAA2B,CAAC;AAE1D,wBAAgB,UAAU,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAEnD;AAED,wBAAgB,QAAQ,CAEtB,QAAQ,EAAE,MAAM,EAChB,IAAI,CAAC,EAAE,OAAO,CAAC,aAAa,CAAC,GAC5B,MAAM,CAIR;AAED,wBAAgB,aAAa,CAE3B,SAAS,EAAE,MAAM,EACjB,IAAI,CAAC,EAAE,OAAO,CAAC,aAAa,CAAC,GAC5B,SAAS,CA0CX;AAED,wBAAgB,cAAc,CAE5B,SAAS,EAAE,MAAM,EACjB,KAAK,EAAE,SAAS,EAChB,IAAI,CAAC,EAAE,OAAO,CAAC,aAAa,CAAC,GAC5B,IAAI,CAaN;AAED,wBAAgB,aAAa,CAE3B,QAAQ,EAAE,MAAM,EAChB,WAAW,EAAE,MAAM,EACnB,IAAI,CAAC,EAAE,OAAO,CAAC,aAAa,CAAC,GAC5B,IAAI,CASN"}
@@ -49,6 +49,8 @@ cachePath, deps) {
49
49
  version: SYNC_CACHE_VERSION,
50
50
  hashes: {},
51
51
  seenAt: {},
52
+ semanticHashes: {},
53
+ semanticContracts: {},
52
54
  };
53
55
  }
54
56
  try {
@@ -58,12 +60,16 @@ cachePath, deps) {
58
60
  version: SYNC_CACHE_VERSION,
59
61
  hashes: {},
60
62
  seenAt: {},
63
+ semanticHashes: {},
64
+ semanticContracts: {},
61
65
  };
62
66
  }
63
67
  return {
64
68
  version: SYNC_CACHE_VERSION,
65
69
  hashes: parsed.hashes ?? {},
66
70
  seenAt: parsed.seenAt ?? {},
71
+ semanticHashes: parsed.semanticHashes ?? {},
72
+ semanticContracts: parsed.semanticContracts ?? {},
67
73
  };
68
74
  }
69
75
  catch {
@@ -71,6 +77,8 @@ cachePath, deps) {
71
77
  version: SYNC_CACHE_VERSION,
72
78
  hashes: {},
73
79
  seenAt: {},
80
+ semanticHashes: {},
81
+ semanticContracts: {},
74
82
  };
75
83
  }
76
84
  }
@@ -2,6 +2,7 @@ import { existsSync, readFileSync, writeFileSync } from "node:fs";
2
2
  import { dump as dumpYAML, load as parseYAML } from "js-yaml";
3
3
  import { writeCoordinateArtifact } from "../../extractors/symbol-coordinates.js";
4
4
  import { type ManifestSymbolEntry, enrichSymbolCoordinates } from "../../extractors/symbols-coordinator.js";
5
+ import { COARSE_GRANULARITY_REASONS } from "../../public/symbol-granularity.js";
5
6
  import { resolveSymbolsManifestPaths } from "../../utils/manifest-paths.js";
6
7
  interface ManifestDeps {
7
8
  dumpYAML: typeof dumpYAML;
@@ -14,10 +15,20 @@ interface ManifestDeps {
14
15
  resolveSymbolsManifestPaths: typeof resolveSymbolsManifestPaths;
15
16
  }
16
17
  export declare const SYMBOLS_MANIFEST_COMMENT_BLOCK = "# symbols.yaml\n# AUTHORED fields (edit freely):\n# id, title, sourceFile, links, status, tags, owner, priority\n# Generated coordinates are stored separately in symbol-coordinates.yaml.\n# Run `kibi sync --refresh-symbol-coordinates` to refresh them.\n";
18
+ /**
19
+ * Coarse symbol anchors for which per-symbol coordinates are not expected.
20
+ *
21
+ * Test-suite, module-level-behavior, and config-artifact symbols represent a
22
+ * whole file or configuration unit, and `extractor-miss` explicitly documents
23
+ * that the extractor cannot locate a declaration. These entries legitimately
24
+ * carry no generated coordinates, so coordinate refresh counts them as
25
+ * unchanged instead of flagging them as failures.
26
+ */
27
+ export { COARSE_GRANULARITY_REASONS };
28
+ export declare function isCoarseGranularityAnchor(entry: ManifestSymbolEntry): boolean;
17
29
  export declare function refreshManifestCoordinates(manifestPath: string, workspaceRoot: string, deps?: Partial<ManifestDeps> & {
18
30
  refreshSymbolCoordinates?: boolean;
19
31
  }): Promise<void>;
20
32
  export declare function hasAllGeneratedCoordinates(entry: ManifestSymbolEntry): boolean;
21
33
  export declare function isEligibleForCoordinateRefresh(sourceFile: string | undefined, workspaceRoot: string, deps?: Partial<ManifestDeps>): boolean;
22
- export {};
23
34
  //# sourceMappingURL=manifest.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"manifest.d.ts","sourceRoot":"","sources":["../../../src/commands/sync/manifest.ts"],"names":[],"mappings":"AAkBA,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAElE,OAAO,EAAE,IAAI,IAAI,QAAQ,EAAE,IAAI,IAAI,SAAS,EAAE,MAAM,SAAS,CAAC;AAC9D,OAAO,EAEL,uBAAuB,EACxB,MAAM,wCAAwC,CAAC;AAChD,OAAO,EACL,KAAK,mBAAmB,EACxB,uBAAuB,EACxB,MAAM,yCAAyC,CAAC;AACjD,OAAO,EAAE,2BAA2B,EAAE,MAAM,+BAA+B,CAAC;AAE5E,UAAU,YAAY;IACpB,QAAQ,EAAE,OAAO,QAAQ,CAAC;IAC1B,uBAAuB,EAAE,OAAO,uBAAuB,CAAC;IACxD,UAAU,EAAE,OAAO,UAAU,CAAC;IAC9B,SAAS,EAAE,OAAO,SAAS,CAAC;IAC5B,YAAY,EAAE,OAAO,YAAY,CAAC;IAClC,aAAa,EAAE,OAAO,aAAa,CAAC;IACpC,uBAAuB,EAAE,OAAO,uBAAuB,CAAC;IACxD,2BAA2B,EAAE,OAAO,2BAA2B,CAAC;CACjE;AAgBD,eAAO,MAAM,8BAA8B,oQAK1C,CAAC;AAwBF,wBAAsB,0BAA0B,CAE9C,YAAY,EAAE,MAAM,EACpB,aAAa,EAAE,MAAM,EACrB,IAAI,CAAC,EAAE,OAAO,CAAC,YAAY,CAAC,GAAG;IAAE,wBAAwB,CAAC,EAAE,OAAO,CAAA;CAAE,GACpE,OAAO,CAAC,IAAI,CAAC,CAmIf;AAED,wBAAgB,0BAA0B,CAExC,KAAK,EAAE,mBAAmB,GACzB,OAAO,CAOT;AAED,wBAAgB,8BAA8B,CAE5C,UAAU,EAAE,MAAM,GAAG,SAAS,EAC9B,aAAa,EAAE,MAAM,EACrB,IAAI,CAAC,EAAE,OAAO,CAAC,YAAY,CAAC,GAC3B,OAAO,CAUT"}
1
+ {"version":3,"file":"manifest.d.ts","sourceRoot":"","sources":["../../../src/commands/sync/manifest.ts"],"names":[],"mappings":"AAkBA,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAElE,OAAO,EAAE,IAAI,IAAI,QAAQ,EAAE,IAAI,IAAI,SAAS,EAAE,MAAM,SAAS,CAAC;AAC9D,OAAO,EAEL,uBAAuB,EACxB,MAAM,wCAAwC,CAAC;AAChD,OAAO,EACL,KAAK,mBAAmB,EACxB,uBAAuB,EACxB,MAAM,yCAAyC,CAAC;AACjD,OAAO,EACL,0BAA0B,EAE3B,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAAE,2BAA2B,EAAE,MAAM,+BAA+B,CAAC;AAE5E,UAAU,YAAY;IACpB,QAAQ,EAAE,OAAO,QAAQ,CAAC;IAC1B,uBAAuB,EAAE,OAAO,uBAAuB,CAAC;IACxD,UAAU,EAAE,OAAO,UAAU,CAAC;IAC9B,SAAS,EAAE,OAAO,SAAS,CAAC;IAC5B,YAAY,EAAE,OAAO,YAAY,CAAC;IAClC,aAAa,EAAE,OAAO,aAAa,CAAC;IACpC,uBAAuB,EAAE,OAAO,uBAAuB,CAAC;IACxD,2BAA2B,EAAE,OAAO,2BAA2B,CAAC;CACjE;AAgBD,eAAO,MAAM,8BAA8B,oQAK1C,CAAC;AAwBF;;;;;;;;GAQG;AACH,OAAO,EAAE,0BAA0B,EAAE,CAAC;AAEtC,wBAAgB,yBAAyB,CAAC,KAAK,EAAE,mBAAmB,GAAG,OAAO,CAG7E;AAED,wBAAsB,0BAA0B,CAE9C,YAAY,EAAE,MAAM,EACpB,aAAa,EAAE,MAAM,EACrB,IAAI,CAAC,EAAE,OAAO,CAAC,YAAY,CAAC,GAAG;IAAE,wBAAwB,CAAC,EAAE,OAAO,CAAA;CAAE,GACpE,OAAO,CAAC,IAAI,CAAC,CAuIf;AAED,wBAAgB,0BAA0B,CAExC,KAAK,EAAE,mBAAmB,GACzB,OAAO,CAOT;AAED,wBAAgB,8BAA8B,CAE5C,UAAU,EAAE,MAAM,GAAG,SAAS,EAC9B,aAAa,EAAE,MAAM,EACrB,IAAI,CAAC,EAAE,OAAO,CAAC,YAAY,CAAC,GAC3B,OAAO,CAUT"}
@@ -20,6 +20,7 @@ import * as path from "node:path";
20
20
  import { dump as dumpYAML, load as parseYAML } from "js-yaml";
21
21
  import { writeCoordinateArtifact, } from "../../extractors/symbol-coordinates.js";
22
22
  import { enrichSymbolCoordinates, } from "../../extractors/symbols-coordinator.js";
23
+ import { COARSE_GRANULARITY_REASONS, isCoarseGranularityReason, } from "../../public/symbol-granularity.js";
23
24
  import { resolveSymbolsManifestPaths } from "../../utils/manifest-paths.js";
24
25
  function resolveDeps(overrides) {
25
26
  return {
@@ -60,6 +61,20 @@ const GENERATED_MANIFEST_FIELDS = new Set([
60
61
  ...GENERATED_COORD_FIELDS,
61
62
  "coordinatesGeneratedAt",
62
63
  ]);
64
+ /**
65
+ * Coarse symbol anchors for which per-symbol coordinates are not expected.
66
+ *
67
+ * Test-suite, module-level-behavior, and config-artifact symbols represent a
68
+ * whole file or configuration unit, and `extractor-miss` explicitly documents
69
+ * that the extractor cannot locate a declaration. These entries legitimately
70
+ * carry no generated coordinates, so coordinate refresh counts them as
71
+ * unchanged instead of flagging them as failures.
72
+ */
73
+ export { COARSE_GRANULARITY_REASONS };
74
+ export function isCoarseGranularityAnchor(entry) {
75
+ const reason = entry.granularity_reason;
76
+ return isCoarseGranularityReason(reason);
77
+ }
63
78
  export async function refreshManifestCoordinates(
64
79
  // implements REQ-003
65
80
  manifestPath, workspaceRoot, deps) {
@@ -127,11 +142,13 @@ manifestPath, workspaceRoot, deps) {
127
142
  refreshed++;
128
143
  continue;
129
144
  }
130
- const eligible = isEligibleForCoordinateRefresh(typeof current.sourceFile === "string"
131
- ? current.sourceFile
132
- : typeof previous.sourceFile === "string"
133
- ? previous.sourceFile
134
- : undefined, workspaceRoot, resolved);
145
+ const coarseAnchor = isCoarseGranularityAnchor(current);
146
+ const eligible = !coarseAnchor &&
147
+ isEligibleForCoordinateRefresh(typeof current.sourceFile === "string"
148
+ ? current.sourceFile
149
+ : typeof previous.sourceFile === "string"
150
+ ? previous.sourceFile
151
+ : undefined, workspaceRoot, resolved);
135
152
  if (eligible && !hasAllGeneratedCoordinates(current)) {
136
153
  failed++;
137
154
  }
@@ -1 +1 @@
1
- {"version":3,"file":"persistence.d.ts","sourceRoot":"","sources":["../../../src/commands/sync/persistence.ts"],"names":[],"mappings":"AAmBA,OAAO,KAAK,EAEV,qBAAqB,EACrB,gBAAgB,EACjB,MAAM,8BAA8B,CAAC;AACtC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AA+FrD,MAAM,WAAW,iBAAiB;IAChC,WAAW,EAAE,MAAM,CAAC;IACpB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,UAAU,EAAE,OAAO,CAAC;CACrB;AAmCD,wBAAsB,eAAe,CAEnC,MAAM,EAAE,aAAa,EACrB,OAAO,EAAE,gBAAgB,EAAE,EAC3B,SAAS,EAAE,GAAG,CAAC,MAAM,CAAC,GACrB,OAAO,CAAC;IAAE,WAAW,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,OAAO,CAAA;CAAE,CAAC,CAyFvD;AA6BD,wBAAsB,oBAAoB,CACxC,MAAM,EAAE,aAAa,EACrB,OAAO,EAAE,gBAAgB,EAAE,EAC3B,kBAAkB,EAAE,qBAAqB,EAAE,GAC1C,OAAO,CAAC;IAAE,iBAAiB,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,OAAO,CAAA;CAAE,CAAC,CA+K7D"}
1
+ {"version":3,"file":"persistence.d.ts","sourceRoot":"","sources":["../../../src/commands/sync/persistence.ts"],"names":[],"mappings":"AAmBA,OAAO,KAAK,EAEV,qBAAqB,EACrB,gBAAgB,EACjB,MAAM,8BAA8B,CAAC;AACtC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAgHrD,MAAM,WAAW,iBAAiB;IAChC,WAAW,EAAE,MAAM,CAAC;IACpB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,UAAU,EAAE,OAAO,CAAC;CACrB;AAmCD,wBAAsB,eAAe,CAEnC,MAAM,EAAE,aAAa,EACrB,OAAO,EAAE,gBAAgB,EAAE,EAC3B,SAAS,EAAE,GAAG,CAAC,MAAM,CAAC,GACrB,OAAO,CAAC;IAAE,WAAW,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,OAAO,CAAA;CAAE,CAAC,CAwKvD;AA6BD,wBAAsB,oBAAoB,CACxC,MAAM,EAAE,aAAa,EACrB,OAAO,EAAE,gBAAgB,EAAE,EAC3B,kBAAkB,EAAE,qBAAqB,EAAE,GAC1C,OAAO,CAAC;IAAE,iBAAiB,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,OAAO,CAAA;CAAE,CAAC,CA+K7D"}