kibi-cli 2.39.0 → 2.40.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 (163) hide show
  1. package/dist/cli-register-foundation.js +2 -2
  2. package/dist/commands/check.d.ts.map +1 -1
  3. package/dist/commands/check.js +33 -9
  4. package/dist/commands/doctor.d.ts.map +1 -1
  5. package/dist/commands/doctor.js +15 -0
  6. package/dist/commands/init.d.ts.map +1 -1
  7. package/dist/commands/init.js +4 -0
  8. package/dist/commands/migrate-plan-record.d.ts +18 -0
  9. package/dist/commands/migrate-plan-record.d.ts.map +1 -0
  10. package/dist/commands/migrate-plan-record.js +112 -0
  11. package/dist/commands/migrate.d.ts +11 -2
  12. package/dist/commands/migrate.d.ts.map +1 -1
  13. package/dist/commands/migrate.js +53 -7
  14. package/dist/commands/prove.d.ts.map +1 -1
  15. package/dist/commands/prove.js +18 -3
  16. package/dist/commands/sync/manifest.d.ts.map +1 -1
  17. package/dist/commands/sync/manifest.js +17 -4
  18. package/dist/commands/sync.d.ts.map +1 -1
  19. package/dist/commands/sync.js +8 -0
  20. package/dist/commands/telemetry.d.ts.map +1 -1
  21. package/dist/commands/telemetry.js +12 -2
  22. package/dist/extractors/symbol-title-match.d.ts +31 -0
  23. package/dist/extractors/symbol-title-match.d.ts.map +1 -0
  24. package/dist/extractors/symbol-title-match.js +133 -0
  25. package/dist/extractors/symbols-coordinator.d.ts.map +1 -1
  26. package/dist/extractors/symbols-coordinator.js +81 -12
  27. package/dist/operations/bootstrap/discovery-evidence.js +2 -2
  28. package/dist/operations/bootstrap/guidance-actions.d.ts.map +1 -1
  29. package/dist/operations/bootstrap/guidance-actions.js +12 -1
  30. package/dist/operations/bootstrap/plugin-offers.d.ts +7 -1
  31. package/dist/operations/bootstrap/plugin-offers.d.ts.map +1 -1
  32. package/dist/operations/bootstrap/plugin-offers.js +73 -3
  33. package/dist/operations/modeling/logic-modeling.d.ts.map +1 -1
  34. package/dist/operations/modeling/logic-modeling.js +2 -1
  35. package/dist/operations/modeling/model-requirement.d.ts.map +1 -1
  36. package/dist/operations/modeling/model-requirement.js +2 -1
  37. package/dist/operations/mutation/symbol-refresh.d.ts +2 -0
  38. package/dist/operations/mutation/symbol-refresh.d.ts.map +1 -1
  39. package/dist/operations/mutation/symbol-refresh.js +6 -1
  40. package/dist/operations/mutation/upsert.d.ts.map +1 -1
  41. package/dist/operations/mutation/upsert.js +7 -0
  42. package/dist/operations/planning/compile-intent.d.ts.map +1 -1
  43. package/dist/operations/planning/compile-intent.js +2 -1
  44. package/dist/operations/proof/claim-bindings.d.ts +11 -0
  45. package/dist/operations/proof/claim-bindings.d.ts.map +1 -1
  46. package/dist/operations/proof/claim-bindings.js +144 -1
  47. package/dist/operations/proof/code-certificates.d.ts +10 -3
  48. package/dist/operations/proof/code-certificates.d.ts.map +1 -1
  49. package/dist/operations/proof/code-certificates.js +65 -13
  50. package/dist/operations/proof/code-languages.d.ts +104 -0
  51. package/dist/operations/proof/code-languages.d.ts.map +1 -0
  52. package/dist/operations/proof/code-languages.js +119 -0
  53. package/dist/operations/proof/code-models.d.ts +2 -0
  54. package/dist/operations/proof/code-models.d.ts.map +1 -1
  55. package/dist/operations/proof/code-models.js +11 -5
  56. package/dist/operations/proof/code-runner.d.ts +12 -9
  57. package/dist/operations/proof/code-runner.d.ts.map +1 -1
  58. package/dist/operations/proof/code-runner.js +81 -38
  59. package/dist/operations/proof/code-scope.d.ts +8 -0
  60. package/dist/operations/proof/code-scope.d.ts.map +1 -1
  61. package/dist/operations/proof/code-scope.js +30 -1
  62. package/dist/operations/proof/explain.d.ts +13 -0
  63. package/dist/operations/proof/explain.d.ts.map +1 -1
  64. package/dist/operations/proof/explain.js +66 -0
  65. package/dist/operations/proof/ingest-proof.d.ts +2 -0
  66. package/dist/operations/proof/ingest-proof.d.ts.map +1 -1
  67. package/dist/operations/proof/ingest-proof.js +1 -0
  68. package/dist/operations/proof/java-package-shadow.d.ts +14 -0
  69. package/dist/operations/proof/java-package-shadow.d.ts.map +1 -0
  70. package/dist/operations/proof/java-package-shadow.js +389 -0
  71. package/dist/operations/proof/prolog-evaluator.d.ts +14 -0
  72. package/dist/operations/proof/prolog-evaluator.d.ts.map +1 -0
  73. package/dist/operations/proof/prolog-evaluator.js +247 -0
  74. package/dist/operations/proof/prolog-source-reader.d.ts +20 -0
  75. package/dist/operations/proof/prolog-source-reader.d.ts.map +1 -0
  76. package/dist/operations/proof/prolog-source-reader.js +1123 -0
  77. package/dist/operations/proof/source-code-readers.d.ts +6 -0
  78. package/dist/operations/proof/source-code-readers.d.ts.map +1 -1
  79. package/dist/operations/proof/source-code-readers.js +879 -75
  80. package/dist/plugins/approved-source-analyzers.generated.d.ts +13 -35
  81. package/dist/plugins/approved-source-analyzers.generated.d.ts.map +1 -1
  82. package/dist/plugins/approved-source-analyzers.generated.js +13 -35
  83. package/dist/plugins/plugin-install-check.d.ts +21 -0
  84. package/dist/plugins/plugin-install-check.d.ts.map +1 -0
  85. package/dist/plugins/plugin-install-check.js +62 -0
  86. package/dist/plugins/proof-reference-extractors.d.ts +20 -0
  87. package/dist/plugins/proof-reference-extractors.d.ts.map +1 -0
  88. package/dist/plugins/proof-reference-extractors.js +104 -0
  89. package/dist/plugins/reference-language-suggestion.d.ts +51 -0
  90. package/dist/plugins/reference-language-suggestion.d.ts.map +1 -0
  91. package/dist/plugins/reference-language-suggestion.js +277 -0
  92. package/dist/plugins/registry.d.ts.map +1 -1
  93. package/dist/plugins/registry.js +3 -1
  94. package/dist/plugins/source-analysis-service.d.ts.map +1 -1
  95. package/dist/plugins/source-analysis-service.js +4 -0
  96. package/dist/plugins/source-change-analysis.d.ts +26 -1
  97. package/dist/plugins/source-change-analysis.d.ts.map +1 -1
  98. package/dist/plugins/source-change-analysis.js +77 -5
  99. package/dist/plugins/source-classification.d.ts.map +1 -1
  100. package/dist/plugins/source-classification.js +23 -3
  101. package/dist/public/operations/catalog.d.ts +32 -7
  102. package/dist/public/operations/catalog.d.ts.map +1 -1
  103. package/dist/public/operations/check-executor.d.ts.map +1 -1
  104. package/dist/public/operations/check-executor.js +3 -0
  105. package/dist/public/operations/evidence-floor.d.ts +8 -0
  106. package/dist/public/operations/evidence-floor.d.ts.map +1 -1
  107. package/dist/public/operations/evidence-floor.js +19 -1
  108. package/dist/public/operations/specs/check-rules.generated.d.ts +1 -1
  109. package/dist/public/operations/specs/check-rules.generated.d.ts.map +1 -1
  110. package/dist/public/operations/specs/check-rules.generated.js +2 -1
  111. package/dist/public/operations/specs/check.d.ts +1 -1
  112. package/dist/public/operations/specs/mutation-schemas.d.ts +31 -6
  113. package/dist/public/operations/specs/mutation-schemas.d.ts.map +1 -1
  114. package/dist/public/operations/specs/reporting.d.ts +8 -0
  115. package/dist/public/operations/specs/reporting.d.ts.map +1 -1
  116. package/dist/public/operations/specs/reporting.js +26 -3
  117. package/dist/public/operations/specs/semantic.d.ts.map +1 -1
  118. package/dist/public/operations/specs/semantic.js +2 -1
  119. package/dist/public/operations/specs/upsert.d.ts +31 -6
  120. package/dist/public/operations/specs/upsert.d.ts.map +1 -1
  121. package/dist/public/operations/symbol-coordinates-check.d.ts +11 -0
  122. package/dist/public/operations/symbol-coordinates-check.d.ts.map +1 -0
  123. package/dist/public/operations/symbol-coordinates-check.js +66 -0
  124. package/dist/public/proof-protocol.d.ts +31 -6
  125. package/dist/public/proof-protocol.d.ts.map +1 -1
  126. package/dist/public/proof-protocol.js +45 -15
  127. package/dist/public/proof-sources.d.ts +4 -2
  128. package/dist/public/proof-sources.d.ts.map +1 -1
  129. package/dist/public/proof-sources.js +43 -4
  130. package/dist/public/skills/kibi-usage/SKILL.md +6 -3
  131. package/dist/public/skills/kibi-usage/resources/prolog-proofs.md +207 -0
  132. package/dist/public/skills/kibi-usage/resources/proof.md +44 -3
  133. package/dist/schemas/entity.schema.json +34 -6
  134. package/dist/traceability/analysis-gate.d.ts +3 -1
  135. package/dist/traceability/analysis-gate.d.ts.map +1 -1
  136. package/dist/traceability/analysis-gate.js +9 -1
  137. package/dist/traceability/staged-file-coverage.d.ts.map +1 -1
  138. package/dist/traceability/staged-file-coverage.js +7 -2
  139. package/dist/traceability/symbol-extract.d.ts +17 -0
  140. package/dist/traceability/symbol-extract.d.ts.map +1 -1
  141. package/dist/traceability/symbol-extract.js +69 -15
  142. package/dist/traceability/validate.d.ts.map +1 -1
  143. package/dist/traceability/validate.js +5 -7
  144. package/dist/utils/first-sentence.d.ts +9 -0
  145. package/dist/utils/first-sentence.d.ts.map +1 -0
  146. package/dist/utils/first-sentence.js +52 -0
  147. package/dist/utils/rule-registry.generated.d.ts +6 -0
  148. package/dist/utils/rule-registry.generated.d.ts.map +1 -1
  149. package/dist/utils/rule-registry.generated.js +7 -0
  150. package/package.json +5 -5
  151. package/src/public/operations/check-executor.ts +8 -0
  152. package/src/public/operations/evidence-floor.ts +29 -1
  153. package/src/public/operations/specs/check-rules.generated.ts +2 -1
  154. package/src/public/operations/specs/reporting.ts +38 -3
  155. package/src/public/operations/specs/semantic.ts +2 -1
  156. package/src/public/operations/symbol-coordinates-check.ts +79 -0
  157. package/src/public/proof-protocol-types.d.ts +22 -5
  158. package/src/public/proof-protocol.ts +78 -19
  159. package/src/public/proof-sources.ts +51 -3
  160. package/src/public/skills/kibi-usage/SKILL.md +6 -3
  161. package/src/public/skills/kibi-usage/resources/prolog-proofs.md +207 -0
  162. package/src/public/skills/kibi-usage/resources/proof.md +44 -3
  163. package/src/schemas/entity.schema.json +34 -6
@@ -0,0 +1,119 @@
1
+ /*
2
+ Kibi — repo-local, per-branch, queryable long-term memory for software projects
3
+ Copyright (C) 2026 Piotr Franczyk
4
+
5
+ This program is free software: you can redistribute it and/or modify
6
+ it under the terms of the GNU Affero General Public License as published by
7
+ the Free Software Foundation, either version 3 of the License, or
8
+ (at your option) any later version.
9
+
10
+ This program is distributed in the hope that it will be useful,
11
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
+ GNU Affero General Public License for more details.
14
+
15
+ You should have received a copy of the GNU Affero General Public License
16
+ along with this program. If not, see <https://www.gnu.org/licenses/>.
17
+ */
18
+ import path from "node:path";
19
+ const JS_FILE = /\.(?:[cm]?[jt]sx?)$/i;
20
+ const PYTHON_FILE = /\.py$/i;
21
+ // Symbol discovery resolves an ambiguous `.pl` file by its content; one that
22
+ // is Perl fails to load in SWI-Prolog, so the read refuses rather than guess.
23
+ const PROLOG_FILE = /\.(?:pl|plt)$/i;
24
+ /** The language whose evaluator reads `file`, or null for any other file. */
25
+ // implements REQ-kibi-multilingual-code-proofs
26
+ export function codeLanguage(file) {
27
+ if (JS_FILE.test(file))
28
+ return "js";
29
+ if (PYTHON_FILE.test(file))
30
+ return "python";
31
+ if (PROLOG_FILE.test(file))
32
+ return "prolog";
33
+ return null;
34
+ }
35
+ const PROLOG_LOAD = /\b(?:use_module|ensure_loaded|consult|load_files|reexport|include)\s*\(\s*(?:library\(\s*([^)\s]+)\s*\)|'([^']+)'|"([^"]+)"|([a-z][\w/]*))/g;
36
+ const PROLOG_LOAD_LIST = /:-\s*\[([^\]]+)\]/g;
37
+ /**
38
+ * The files a SWI-Prolog source loads, read from its text: use_module,
39
+ * ensure_loaded, consult, load_files, reexport and include with a quoted or
40
+ * plain path or `library(X)`, and `:- [a, b]` load lists. Nothing runs.
41
+ */
42
+ // implements REQ-kibi-multilingual-code-proofs
43
+ export function prologLoadSpecs(source) {
44
+ const specs = [];
45
+ for (const match of source.matchAll(PROLOG_LOAD)) {
46
+ if (match[1] !== undefined)
47
+ specs.push({ library: match[1] });
48
+ else {
49
+ const spec = match[2] ?? match[3] ?? match[4] ?? "";
50
+ if (spec !== "")
51
+ specs.push({ path: spec });
52
+ }
53
+ }
54
+ for (const match of source.matchAll(PROLOG_LOAD_LIST))
55
+ for (const item of (match[1] ?? "").split(",")) {
56
+ const spec = item.trim().replace(/^['"]|['"]$/g, "");
57
+ if (spec !== "")
58
+ specs.push({ path: spec });
59
+ }
60
+ return specs;
61
+ }
62
+ export function stripPrologExtension(file) {
63
+ return path.normalize(file).replace(/\.(?:pl|plt|pro)$/i, "");
64
+ }
65
+ /** How a reason names a language. */
66
+ /**
67
+ * Languages whose references a qualified plugin reads (kibi-plugin-treesitter
68
+ * through kibi.reference-extractor.v1). Kibi itself runs nothing for them.
69
+ */
70
+ // implements REQ-kibi-tree-sitter-references
71
+ export const PLUGIN_REFERENCE_LANGUAGES = [
72
+ { name: "Go", pattern: /\.go$/i },
73
+ { name: "Java", pattern: /\.java$/i },
74
+ { name: "C#", pattern: /\.cs$/i },
75
+ { name: "Rust", pattern: /\.rs$/i },
76
+ ];
77
+ /**
78
+ * The data-only kibi-lang-* packs kibi-plugin-treesitter reads these
79
+ * languages with, by the file extensions its catalog maps to them. Every
80
+ * grammar ships in a pack; `.pl` counts as SWI-Prolog here.
81
+ */
82
+ // implements REQ-kibi-tree-sitter-language-packs
83
+ export const PLUGIN_LANGUAGE_PACKS = [
84
+ { pack: "kibi-lang-go", name: "Go", pattern: /\.go$/i },
85
+ { pack: "kibi-lang-rust", name: "Rust", pattern: /\.rs$/i },
86
+ { pack: "kibi-lang-java", name: "Java", pattern: /\.java$/i },
87
+ { pack: "kibi-lang-csharp", name: "C#", pattern: /\.cs$/i },
88
+ { pack: "kibi-lang-php", name: "PHP", pattern: /\.php$/i },
89
+ { pack: "kibi-lang-c", name: "C", pattern: /\.c$/i },
90
+ { pack: "kibi-lang-cpp", name: "C++", pattern: /\.(?:cc|cpp|cxx|hh|hpp|hxx)$/i },
91
+ { pack: "kibi-lang-bash", name: "Bash", pattern: /\.(?:bash|sh)$/i },
92
+ { pack: "kibi-lang-ruby", name: "Ruby", pattern: /\.rb$/i },
93
+ { pack: "kibi-lang-hcl", name: "Terraform/HCL", pattern: /\.(?:tf|hcl)$/i },
94
+ { pack: "kibi-lang-python", name: "Python", pattern: /\.pyi?$/i },
95
+ { pack: "kibi-lang-prolog", name: "SWI-Prolog", pattern: /\.(?:pl|plt)$/i },
96
+ ];
97
+ export function pluginReferenceLanguage(file) {
98
+ return PLUGIN_REFERENCE_LANGUAGES.find((language) => language.pattern.test(file))?.name ?? null;
99
+ }
100
+ export const CODE_LANGUAGE_NAMES = {
101
+ js: "TypeScript or JavaScript",
102
+ python: "Python",
103
+ prolog: "SWI-Prolog",
104
+ };
105
+ /** How a reason names the language of `file`. */
106
+ export function languageName(file) {
107
+ const language = codeLanguage(file);
108
+ return language === null ? "an unsupported language" : CODE_LANGUAGE_NAMES[language];
109
+ }
110
+ /**
111
+ * The one refusal for a file whose language a reader cannot read: what reads
112
+ * which languages, and the files it was handed outside them.
113
+ */
114
+ // implements REQ-kibi-multilingual-code-proofs
115
+ export function unsupportedLanguageReason(reader, supported, files) {
116
+ const names = supported.map((language) => language === "js" ? "TypeScript, JavaScript" : CODE_LANGUAGE_NAMES[language]);
117
+ const listed = names.length > 1 ? `${names.slice(0, -1).join(", ")} and ${names.at(-1)}` : (names[0] ?? "no");
118
+ return `${reader} reads ${listed} files, not ${files.slice(0, 3).join(", ")}${files.length > 3 ? ` and ${files.length - 3} more` : ""}`;
119
+ }
@@ -3,9 +3,11 @@ import type { ProofContract } from "../../public/proof-protocol.js";
3
3
  import { type LanguageSpec } from "./regular-language.js";
4
4
  /** The most predicate calls one rule certificate may need. */
5
5
  export declare const MAX_TABLE_ROWS = 100000;
6
+ /** A code export Kibi reads; `arg` projects a Prolog predicate's solutions. */
6
7
  export type Resolved = {
7
8
  file: string;
8
9
  export: string;
10
+ arg?: number;
9
11
  };
10
12
  export type TableRow = Readonly<{
11
13
  args: readonly string[];
@@ -1 +1 @@
1
- {"version":3,"file":"code-models.d.ts","sourceRoot":"","sources":["../../../src/operations/proof/code-models.ts"],"names":[],"mappings":"AA2BA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,0CAA0C,CAAC;AACjF,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AACpE,OAAO,EACL,KAAK,YAAY,EAKlB,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AQ,EAAE,aAAa,EACvB,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GACnC,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAiBxB;AAED,+EAA+E;AAE/E,wBAAsB,yBAAyB,CAC7C,OAAO,EAAE,gBAAgB,EACzB,QAAQ,EAAE,aAAa,EACvB,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GACnC,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAoBxB;AAED,+EAA+E;AAC/E,wBAAgB,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,YAAY,CAExD;AAED;;;;;;;;GAQG;AAEH,wBAAgB,uBAAuB,CACrC,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACpC,UAAU,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,EAC7C,MAAM,EAAE,MAAM,GACb,MAAM,GAAG,IAAI,CAgDf"}
@@ -27,6 +27,8 @@ import { languageAccepts, languagesDisjoint, languagesEqual, UnsupportedPattern,
27
27
  import { loadSymbol } from "./code-certificates.js";
28
28
  import { describeSource, readSource } from "../../public/proof-sources.js";
29
29
  import { runCodeEvaluator, TS_RESOLVE_HOOKS } from "./code-runner.js";
30
+ import { CODE_LANGUAGE_NAMES, codeLanguage, languageName, } from "./code-languages.js";
31
+ import { PROLOG_EVALUATOR } from "./prolog-evaluator.js";
30
32
  import { evaluateSourceCode } from "./source-code-readers.js";
31
33
  /** The most predicate calls one rule certificate may need. */
32
34
  export const MAX_TABLE_ROWS = 100_000;
@@ -317,9 +319,13 @@ async function resolveReference(context, reference, label) {
317
319
  const symbol = await loadSymbol(context, reference.symbol_id);
318
320
  if (!symbol || symbol.sourceFile === "")
319
321
  return `the ${label} symbol ${reference.symbol_id} has no source file`;
322
+ const file = path.resolve(context.workspaceRoot, symbol.sourceFile);
323
+ if (reference.arg !== undefined && codeLanguage(file) !== "prolog")
324
+ return `${label}.arg applies only to a SWI-Prolog predicate, not to ${languageName(file)} in ${symbol.sourceFile}`;
320
325
  return {
321
- file: path.resolve(context.workspaceRoot, symbol.sourceFile),
326
+ file,
322
327
  export: reference.export ?? symbol.title,
328
+ ...(reference.arg === undefined ? {} : { arg: reference.arg }),
323
329
  };
324
330
  }
325
331
  /**
@@ -328,16 +334,16 @@ async function resolveReference(context, reference, label) {
328
334
  */
329
335
  // implements REQ-kibi-non-numeric-proof-kinds
330
336
  export function evaluateCodeModel(workspaceRoot, files, plan) {
331
- const python = files.map((file) => /\.py$/i.test(file.file));
332
- if (python.some((value) => value !== python[0]))
337
+ const languages = [...new Set(files.map((file) => codeLanguage(file.file)))];
338
+ if (languages.length > 1)
333
339
  return {
334
340
  ok: false,
335
- reason: "the contract's sources mix Python and JavaScript files; one certificate reads one language",
341
+ reason: `the contract's sources mix ${languages.map((language) => (language === null ? "unsupported" : CODE_LANGUAGE_NAMES[language])).join(" and ")} files; one certificate reads one language`,
336
342
  };
337
343
  const first = files[0];
338
344
  if (first === undefined)
339
345
  return { ok: false, reason: "the contract names no source" };
340
- const run = runCodeEvaluator(workspaceRoot, path.relative(workspaceRoot, first.file), { js: jsModelEvaluator(), python: PYTHON_MODEL_EVALUATOR }, [JSON.stringify(plan)], (parsed) => parsed !== null && typeof parsed === "object" && "ok" in parsed);
346
+ const run = runCodeEvaluator(workspaceRoot, path.relative(workspaceRoot, first.file), { js: jsModelEvaluator(), python: PYTHON_MODEL_EVALUATOR, prolog: PROLOG_EVALUATOR }, [JSON.stringify(plan)], (parsed) => parsed !== null && typeof parsed === "object" && "ok" in parsed);
341
347
  if (!run.ok)
342
348
  return {
343
349
  ok: false,
@@ -1,7 +1,9 @@
1
+ import { type CodeLanguage } from "./code-languages.js";
1
2
  /**
2
3
  * How Kibi runs a small evaluator script against the workspace's own code:
3
4
  * the TypeScript and JavaScript runners (bun, the workspace's tsx, node with
4
- * type stripping) and the Python interpreters a project uses. The proof kinds
5
+ * type stripping), the Python interpreters a project uses and the SWI-Prolog
6
+ * Kibi's engine runs on. The proof kinds
5
7
  * that read a model from the code (exhaustive domains, rule tables, state
6
8
  * machines, patterns, data schemas, route tables) all load code this way.
7
9
  */
@@ -25,6 +27,7 @@ export declare function spawnSyncThroughFiles(command: string, args: readonly st
25
27
  cwd?: string;
26
28
  input?: string;
27
29
  timeout: number;
30
+ env?: NodeJS.ProcessEnv;
28
31
  }>): {
29
32
  error: Error | undefined;
30
33
  status: number | null;
@@ -36,21 +39,21 @@ export declare function spawnSyncThroughFiles(command: string, args: readonly st
36
39
  * prints last. A TypeScript or JavaScript file runs with bun when it is on
37
40
  * PATH, else the workspace's tsx, else node's type stripping (which retries
38
41
  * extensionless relative imports as TypeScript files); a Python file (`.py`)
39
- * runs with the first interpreter pythonDomainInterpreters finds. A runner
40
- * whose output `accept` rejects (or that fails to start) yields to the next.
42
+ * runs with the first interpreter pythonDomainInterpreters finds; a
43
+ * SWI-Prolog file (`.pl`, `.plt`) runs with the SWI-Prolog Kibi resolves for
44
+ * its engine. A runner whose output `accept` rejects (or that fails to
45
+ * start) yields to the next. A file in a language the caller has no script
46
+ * for refuses.
41
47
  */
42
- export declare function runCodeEvaluator(workspaceRoot: string, sourceFile: string, scripts: Readonly<{
43
- js: string;
44
- python: string;
45
- }>, args: readonly string[], accept?: (parsed: unknown) => boolean, options?: Readonly<{
48
+ export declare function runCodeEvaluator(workspaceRoot: string, sourceFile: string, scripts: Readonly<Partial<Record<CodeLanguage, string>>>, args: readonly string[], accept?: (parsed: unknown) => boolean, options?: Readonly<{
46
49
  runners?: readonly ("bun" | "tsx" | "node")[];
47
50
  }>): {
48
51
  ok: true;
49
52
  value: unknown;
50
- python: boolean;
53
+ language: CodeLanguage;
51
54
  } | {
52
55
  ok: false;
53
56
  failure: string;
54
- python: boolean;
57
+ language: CodeLanguage | null;
55
58
  };
56
59
  //# sourceMappingURL=code-runner.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"code-runner.d.ts","source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EAAE,MAAM,CAAC,CAAC,CAAC,EACxD,IAAI,EAAE,SAAS,MAAM,EAAE,EACvB,MAAM,GAAE,CAAC,MAAM,EAAE,OAAO,KAAK,OAAoB,EACjD,OAAO,GAAE,QAAQ,CAAC;IAChB,OAAO,CAAC,EAAE,SAAS,CAAC,KAAK,GAAG,KAAK,GAAG,MAAM,CAAC,EAAE,CAAC;CAC/C,CAAM,GAEL;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,KAAK,EAAE,OAAO,CAAC;IAAC,QAAQ,EAAE,YAAY,CAAA;CAAE,GACpD;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,YAAY,GAAG,IAAI,CAAA;CAAE,CAoFhE"}
@@ -19,10 +19,13 @@ import { spawnSync } from "node:child_process";
19
19
  import { closeSync, existsSync, mkdtempSync, openSync, readFileSync, rmSync, writeFileSync, } from "node:fs";
20
20
  import os from "node:os";
21
21
  import path from "node:path";
22
+ import { resolveSwipl, swiplChildEnv } from "../../prolog/swipl-resolver.js";
23
+ import { codeLanguage, unsupportedLanguageReason, } from "./code-languages.js";
22
24
  /**
23
25
  * How Kibi runs a small evaluator script against the workspace's own code:
24
26
  * the TypeScript and JavaScript runners (bun, the workspace's tsx, node with
25
- * type stripping) and the Python interpreters a project uses. The proof kinds
27
+ * type stripping), the Python interpreters a project uses and the SWI-Prolog
28
+ * Kibi's engine runs on. The proof kinds
26
29
  * that read a model from the code (exhaustive domains, rule tables, state
27
30
  * machines, patterns, data schemas, route tables) all load code this way.
28
31
  */
@@ -111,6 +114,7 @@ export function spawnSyncThroughFiles(command, args, options) {
111
114
  try {
112
115
  run = spawnSync(command, [...args], {
113
116
  cwd: options.cwd,
117
+ ...(options.env === undefined ? {} : { env: options.env }),
114
118
  stdio: fds,
115
119
  timeout: options.timeout,
116
120
  });
@@ -131,70 +135,109 @@ export function spawnSyncThroughFiles(command, args, options) {
131
135
  }
132
136
  }
133
137
  /** The line of a runner's stderr that names the failure. */
134
- function failureLine(stderr, python) {
138
+ function failureLine(stderr, language) {
135
139
  const lines = stderr
136
140
  .trim()
137
141
  .split("\n")
138
142
  .map((line) => line.trim())
139
143
  .filter((line) => line !== "");
140
144
  // A Python traceback names the exception on its last line.
141
- return (python ? lines.at(-1) : lines[0]) ?? "";
145
+ return (language === "python" ? lines.at(-1) : lines[0]) ?? "";
142
146
  }
143
147
  /**
144
148
  * Run an evaluator script against the workspace code and return the JSON it
145
149
  * prints last. A TypeScript or JavaScript file runs with bun when it is on
146
150
  * PATH, else the workspace's tsx, else node's type stripping (which retries
147
151
  * extensionless relative imports as TypeScript files); a Python file (`.py`)
148
- * runs with the first interpreter pythonDomainInterpreters finds. A runner
149
- * whose output `accept` rejects (or that fails to start) yields to the next.
152
+ * runs with the first interpreter pythonDomainInterpreters finds; a
153
+ * SWI-Prolog file (`.pl`, `.plt`) runs with the SWI-Prolog Kibi resolves for
154
+ * its engine. A runner whose output `accept` rejects (or that fails to
155
+ * start) yields to the next. A file in a language the caller has no script
156
+ * for refuses.
150
157
  */
151
- // implements REQ-kibi-non-numeric-proof-kinds
158
+ // implements REQ-kibi-non-numeric-proof-kinds, REQ-kibi-multilingual-code-proofs
152
159
  export function runCodeEvaluator(workspaceRoot, sourceFile, scripts, args, accept = () => true, options = {}) {
153
- const python = /\.py$/i.test(sourceFile);
154
- const tsx = python ? null : workspaceBin(workspaceRoot, "tsx");
155
- const runners = python
156
- ? pythonDomainInterpreters(workspaceRoot, sourceFile).map((interpreter) => [
157
- interpreter,
158
- ["-c", scripts.python],
159
- ])
160
- : (options.runners ?? ["bun", "tsx", "node"]).flatMap((runner) => {
160
+ const language = codeLanguage(sourceFile);
161
+ const script = language === null ? undefined : scripts[language];
162
+ if (language === null || script === undefined)
163
+ return {
164
+ ok: false,
165
+ failure: unsupportedLanguageReason("this reader", Object.keys(scripts).filter((key) => scripts[key] !== undefined), [sourceFile]),
166
+ language,
167
+ };
168
+ const fail = (failure) => ({ ok: false, failure, language });
169
+ let scriptDir = null;
170
+ let runners;
171
+ if (language === "prolog") {
172
+ let swipl;
173
+ try {
174
+ swipl = resolveSwipl();
175
+ }
176
+ catch (error) {
177
+ return fail(error instanceof Error ? error.message.split("\n")[0] ?? "" : String(error));
178
+ }
179
+ // swipl runs a script from a file, not from an argument.
180
+ scriptDir = mkdtempSync(path.join(os.tmpdir(), "kibi-prolog-"));
181
+ const scriptFile = path.join(scriptDir, "evaluator.pl");
182
+ writeFileSync(scriptFile, script);
183
+ runners = [
184
+ {
185
+ command: swipl.bin,
186
+ argv: [scriptFile, "--"],
187
+ env: { ...process.env, ...swiplChildEnv(swipl) },
188
+ },
189
+ ];
190
+ }
191
+ else if (language === "python")
192
+ runners = pythonDomainInterpreters(workspaceRoot, sourceFile).map((interpreter) => ({ command: interpreter, argv: ["-c", script] }));
193
+ else {
194
+ const tsx = workspaceBin(workspaceRoot, "tsx");
195
+ runners = (options.runners ?? ["bun", "tsx", "node"]).flatMap((runner) => {
161
196
  if (runner === "bun")
162
- return [["bun", ["-e", scripts.js]]];
197
+ return [{ command: "bun", argv: ["-e", script] }];
163
198
  if (runner === "tsx")
164
199
  return tsx === null
165
200
  ? []
166
- : [[tsx, ["--eval", scripts.js, "--"]]];
201
+ : [{ command: tsx, argv: ["--eval", script, "--"] }];
167
202
  return [
168
- [
169
- process.execPath,
170
- [
203
+ {
204
+ command: process.execPath,
205
+ argv: [
171
206
  "--experimental-strip-types",
172
207
  "--no-warnings",
173
208
  "--input-type=module",
174
209
  "-e",
175
- scripts.js,
210
+ script,
176
211
  ],
177
- ],
212
+ },
178
213
  ];
179
214
  });
215
+ }
180
216
  let failure = "";
181
- for (const [command, argv] of runners) {
182
- const run = spawnSyncThroughFiles(command, [...argv, ...args], {
183
- cwd: workspaceRoot,
184
- timeout: 60_000,
185
- });
186
- if (run.error)
187
- continue;
188
- const line = run.stdout.trim().split("\n").pop() ?? "";
189
- try {
190
- const parsed = JSON.parse(line);
191
- if (accept(parsed))
192
- return { ok: true, value: parsed, python };
193
- }
194
- catch {
195
- // Fall through to the next runner.
217
+ try {
218
+ for (const { command, argv, env } of runners) {
219
+ const run = spawnSyncThroughFiles(command, [...argv, ...args], {
220
+ cwd: workspaceRoot,
221
+ timeout: 60_000,
222
+ ...(env === undefined ? {} : { env }),
223
+ });
224
+ if (run.error)
225
+ continue;
226
+ const line = run.stdout.trim().split("\n").pop() ?? "";
227
+ try {
228
+ const parsed = JSON.parse(line);
229
+ if (accept(parsed))
230
+ return { ok: true, value: parsed, language };
231
+ }
232
+ catch {
233
+ // Fall through to the next runner.
234
+ }
235
+ failure = failureLine(run.stderr, language);
196
236
  }
197
- failure = failureLine(run.stderr, python);
198
237
  }
199
- return { ok: false, failure, python };
238
+ finally {
239
+ if (scriptDir !== null)
240
+ rmSync(scriptDir, { recursive: true, force: true });
241
+ }
242
+ return fail(failure);
200
243
  }
@@ -23,6 +23,14 @@ export declare function loadCoveredBySymbolsByTest(prolog: Pick<PrologPort, "que
23
23
  * make every receipt of that test silently fall back to snapshot matching.
24
24
  */
25
25
  export declare function receiptBindingContract(raw: unknown): ProofContract | null;
26
+ /**
27
+ * The code symbols a certificate contract loads at ingest: its domain, value
28
+ * constants, rule predicates and domains, initial states and pattern. They
29
+ * enter the binding with the test's own scope, so editing the file a domain
30
+ * is read from stales the receipt even when that symbol is not linked
31
+ * covered_by the test. A symbol already in scope binds as before.
32
+ */
33
+ export declare function contractCodeSymbolIds(contract: ProofContract): string[];
26
34
  /** Every project source a contract reads: its source, source counts and source domains. */
27
35
  export declare function contractSources(contract: ProofContract): SourceSpec[];
28
36
  export type ReceiptBindingInput = Readonly<{
@@ -1 +1 @@
1
- {"version":3,"file":"code-scope.d.ts","sourceRoot":"","sources":["../../../src/operations/proof/code-scope.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,0CAA0C,CAAC;AAE3E,OAAO,EAAE,KAAK,UAAU,EAAsB,MAAM,+BAA+B,C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QG;AAEH,wBAAsB,2BAA2B,CAC/C,KAAK,EAAE,mBAAmB,GACzB,OAAO,CAAC,SAAS,MAAM,EAAE,GAAG,SAAS,CAAC,CA0CxC"}
@@ -99,6 +99,32 @@ export function receiptBindingContract(raw) {
99
99
  ...optionalProofContractFields(contract),
100
100
  };
101
101
  }
102
+ /**
103
+ * The code symbols a certificate contract loads at ingest: its domain, value
104
+ * constants, rule predicates and domains, initial states and pattern. They
105
+ * enter the binding with the test's own scope, so editing the file a domain
106
+ * is read from stales the receipt even when that symbol is not linked
107
+ * covered_by the test. A symbol already in scope binds as before.
108
+ */
109
+ // implements REQ-kibi-multilingual-code-proofs
110
+ export function contractCodeSymbolIds(contract) {
111
+ const ids = new Set();
112
+ const add = (entry) => {
113
+ const row = record(entry);
114
+ if (row !== null && typeof row.symbol_id === "string" && row.symbol_id !== "")
115
+ ids.add(row.symbol_id);
116
+ };
117
+ add(contract.domain_source);
118
+ add(contract.initial_source);
119
+ add(contract.pattern_source);
120
+ for (const entry of contract.value_source ?? [])
121
+ add(entry);
122
+ for (const entry of Object.values(contract.domains ?? {}))
123
+ add(entry);
124
+ for (const entry of Object.values(contract.predicate_source ?? {}))
125
+ add(entry);
126
+ return [...ids].sort();
127
+ }
102
128
  /** Every project source a contract reads: its source, source counts and source domains. */
103
129
  // implements REQ-kibi-source-proof-kinds
104
130
  export function contractSources(contract) {
@@ -154,7 +180,10 @@ export async function currentReceiptBindingHashes(input) {
154
180
  const authored = await input.readFile(absolute);
155
181
  const withoutReceipts = removeFrontmatterBlock(authored, "proof_receipts") ?? authored;
156
182
  const withoutLinks = removeFrontmatterBlock(withoutReceipts, "links") ?? withoutReceipts;
157
- const codeScope = resolveBoundSymbolScope(join(input.workspaceRoot, ".kb", "symbols.yaml"), receiptCodeScopeSymbolIds(contract, input.test.proof_bindings, input.coveredBySymbols));
183
+ const codeScope = resolveBoundSymbolScope(join(input.workspaceRoot, ".kb", "symbols.yaml"), [
184
+ ...receiptCodeScopeSymbolIds(contract, input.test.proof_bindings, input.coveredBySymbols),
185
+ ...contractCodeSymbolIds(contract),
186
+ ]);
158
187
  // A contract that reads project sources stales when what it reads
159
188
  // changes: each file's contents and the set of files a glob matches.
160
189
  const scope = [
@@ -43,6 +43,8 @@ export type ClaimExplainEntry = Readonly<{
43
43
  applicable: boolean;
44
44
  level: string | null;
45
45
  blocker?: string;
46
+ /** Why a claim with a derived binding is still not proved. */
47
+ notProved?: string;
46
48
  bindings: readonly Readonly<{
47
49
  test: string;
48
50
  kind: string;
@@ -51,6 +53,11 @@ export type ClaimExplainEntry = Readonly<{
51
53
  reason?: string;
52
54
  }>[];
53
55
  }>;
56
+ export type ClaimRefutation = Readonly<{
57
+ test: string;
58
+ claimKey: string;
59
+ reason: string;
60
+ }>;
54
61
  export type RequirementProofExplainView = {
55
62
  readonly kind: "requirement";
56
63
  readonly id: string;
@@ -63,6 +70,10 @@ export type RequirementProofExplainView = {
63
70
  test: string;
64
71
  reason: string;
65
72
  }[];
73
+ /** Claims a proof refuted: the test and what it read that breaks the claim. */
74
+ readonly refutations?: readonly ClaimRefutation[];
75
+ /** Proof-bearing symbols without source coordinates. */
76
+ readonly missingCoordinateSymbols?: readonly string[];
66
77
  /** How many applicable claims reach each level, and which are not proved. */
67
78
  readonly claimSummary?: ClaimSummary;
68
79
  readonly unprovedClaims?: readonly string[];
@@ -151,6 +162,8 @@ export type SymbolProofExplainView = {
151
162
  };
152
163
  export type ProofExplainView = RequirementProofExplainView | SymbolProofExplainView;
153
164
  export declare function projectRequirementExplain(proof: Record<string, unknown>): RequirementProofExplainView;
165
+ /** One plain clause per gap, naming what it is about where Kibi knows. */
166
+ export declare function gapReason(gap: string, view: Pick<RequirementProofExplainView, "missingCoordinateSymbols">): string;
154
167
  export declare function projectSymbolExplain(payload: Record<string, unknown>): SymbolProofExplainView;
155
168
  export declare function renderProofExplain(view: ProofExplainView): string;
156
169
  export declare function classifyExplainTarget(id: string | undefined, options: {
@@ -1 +1 @@
1
- {"version":3,"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