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.
- package/dist/cli-register-foundation.js +2 -2
- package/dist/commands/check.d.ts.map +1 -1
- package/dist/commands/check.js +33 -9
- package/dist/commands/doctor.d.ts.map +1 -1
- package/dist/commands/doctor.js +15 -0
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +4 -0
- package/dist/commands/migrate-plan-record.d.ts +18 -0
- package/dist/commands/migrate-plan-record.d.ts.map +1 -0
- package/dist/commands/migrate-plan-record.js +112 -0
- package/dist/commands/migrate.d.ts +11 -2
- package/dist/commands/migrate.d.ts.map +1 -1
- package/dist/commands/migrate.js +53 -7
- package/dist/commands/prove.d.ts.map +1 -1
- package/dist/commands/prove.js +18 -3
- package/dist/commands/sync/manifest.d.ts.map +1 -1
- package/dist/commands/sync/manifest.js +17 -4
- package/dist/commands/sync.d.ts.map +1 -1
- package/dist/commands/sync.js +8 -0
- package/dist/commands/telemetry.d.ts.map +1 -1
- package/dist/commands/telemetry.js +12 -2
- package/dist/extractors/symbol-title-match.d.ts +31 -0
- package/dist/extractors/symbol-title-match.d.ts.map +1 -0
- package/dist/extractors/symbol-title-match.js +133 -0
- package/dist/extractors/symbols-coordinator.d.ts.map +1 -1
- package/dist/extractors/symbols-coordinator.js +81 -12
- package/dist/operations/bootstrap/discovery-evidence.js +2 -2
- package/dist/operations/bootstrap/guidance-actions.d.ts.map +1 -1
- package/dist/operations/bootstrap/guidance-actions.js +12 -1
- package/dist/operations/bootstrap/plugin-offers.d.ts +7 -1
- package/dist/operations/bootstrap/plugin-offers.d.ts.map +1 -1
- package/dist/operations/bootstrap/plugin-offers.js +73 -3
- package/dist/operations/modeling/logic-modeling.d.ts.map +1 -1
- package/dist/operations/modeling/logic-modeling.js +2 -1
- package/dist/operations/modeling/model-requirement.d.ts.map +1 -1
- package/dist/operations/modeling/model-requirement.js +2 -1
- package/dist/operations/mutation/symbol-refresh.d.ts +2 -0
- package/dist/operations/mutation/symbol-refresh.d.ts.map +1 -1
- package/dist/operations/mutation/symbol-refresh.js +6 -1
- package/dist/operations/mutation/upsert.d.ts.map +1 -1
- package/dist/operations/mutation/upsert.js +7 -0
- package/dist/operations/planning/compile-intent.d.ts.map +1 -1
- package/dist/operations/planning/compile-intent.js +2 -1
- package/dist/operations/proof/claim-bindings.d.ts +11 -0
- package/dist/operations/proof/claim-bindings.d.ts.map +1 -1
- package/dist/operations/proof/claim-bindings.js +144 -1
- package/dist/operations/proof/code-certificates.d.ts +10 -3
- package/dist/operations/proof/code-certificates.d.ts.map +1 -1
- package/dist/operations/proof/code-certificates.js +65 -13
- package/dist/operations/proof/code-languages.d.ts +104 -0
- package/dist/operations/proof/code-languages.d.ts.map +1 -0
- package/dist/operations/proof/code-languages.js +119 -0
- package/dist/operations/proof/code-models.d.ts +2 -0
- package/dist/operations/proof/code-models.d.ts.map +1 -1
- package/dist/operations/proof/code-models.js +11 -5
- package/dist/operations/proof/code-runner.d.ts +12 -9
- package/dist/operations/proof/code-runner.d.ts.map +1 -1
- package/dist/operations/proof/code-runner.js +81 -38
- package/dist/operations/proof/code-scope.d.ts +8 -0
- package/dist/operations/proof/code-scope.d.ts.map +1 -1
- package/dist/operations/proof/code-scope.js +30 -1
- package/dist/operations/proof/explain.d.ts +13 -0
- package/dist/operations/proof/explain.d.ts.map +1 -1
- package/dist/operations/proof/explain.js +66 -0
- package/dist/operations/proof/ingest-proof.d.ts +2 -0
- package/dist/operations/proof/ingest-proof.d.ts.map +1 -1
- package/dist/operations/proof/ingest-proof.js +1 -0
- package/dist/operations/proof/java-package-shadow.d.ts +14 -0
- package/dist/operations/proof/java-package-shadow.d.ts.map +1 -0
- package/dist/operations/proof/java-package-shadow.js +389 -0
- package/dist/operations/proof/prolog-evaluator.d.ts +14 -0
- package/dist/operations/proof/prolog-evaluator.d.ts.map +1 -0
- package/dist/operations/proof/prolog-evaluator.js +247 -0
- package/dist/operations/proof/prolog-source-reader.d.ts +20 -0
- package/dist/operations/proof/prolog-source-reader.d.ts.map +1 -0
- package/dist/operations/proof/prolog-source-reader.js +1123 -0
- package/dist/operations/proof/source-code-readers.d.ts +6 -0
- package/dist/operations/proof/source-code-readers.d.ts.map +1 -1
- package/dist/operations/proof/source-code-readers.js +879 -75
- package/dist/plugins/approved-source-analyzers.generated.d.ts +13 -35
- package/dist/plugins/approved-source-analyzers.generated.d.ts.map +1 -1
- package/dist/plugins/approved-source-analyzers.generated.js +13 -35
- package/dist/plugins/plugin-install-check.d.ts +21 -0
- package/dist/plugins/plugin-install-check.d.ts.map +1 -0
- package/dist/plugins/plugin-install-check.js +62 -0
- package/dist/plugins/proof-reference-extractors.d.ts +20 -0
- package/dist/plugins/proof-reference-extractors.d.ts.map +1 -0
- package/dist/plugins/proof-reference-extractors.js +104 -0
- package/dist/plugins/reference-language-suggestion.d.ts +51 -0
- package/dist/plugins/reference-language-suggestion.d.ts.map +1 -0
- package/dist/plugins/reference-language-suggestion.js +277 -0
- package/dist/plugins/registry.d.ts.map +1 -1
- package/dist/plugins/registry.js +3 -1
- package/dist/plugins/source-analysis-service.d.ts.map +1 -1
- package/dist/plugins/source-analysis-service.js +4 -0
- package/dist/plugins/source-change-analysis.d.ts +26 -1
- package/dist/plugins/source-change-analysis.d.ts.map +1 -1
- package/dist/plugins/source-change-analysis.js +77 -5
- package/dist/plugins/source-classification.d.ts.map +1 -1
- package/dist/plugins/source-classification.js +23 -3
- package/dist/public/operations/catalog.d.ts +32 -7
- package/dist/public/operations/catalog.d.ts.map +1 -1
- package/dist/public/operations/check-executor.d.ts.map +1 -1
- package/dist/public/operations/check-executor.js +3 -0
- package/dist/public/operations/evidence-floor.d.ts +8 -0
- package/dist/public/operations/evidence-floor.d.ts.map +1 -1
- package/dist/public/operations/evidence-floor.js +19 -1
- package/dist/public/operations/specs/check-rules.generated.d.ts +1 -1
- package/dist/public/operations/specs/check-rules.generated.d.ts.map +1 -1
- package/dist/public/operations/specs/check-rules.generated.js +2 -1
- package/dist/public/operations/specs/check.d.ts +1 -1
- package/dist/public/operations/specs/mutation-schemas.d.ts +31 -6
- package/dist/public/operations/specs/mutation-schemas.d.ts.map +1 -1
- package/dist/public/operations/specs/reporting.d.ts +8 -0
- package/dist/public/operations/specs/reporting.d.ts.map +1 -1
- package/dist/public/operations/specs/reporting.js +26 -3
- package/dist/public/operations/specs/semantic.d.ts.map +1 -1
- package/dist/public/operations/specs/semantic.js +2 -1
- package/dist/public/operations/specs/upsert.d.ts +31 -6
- package/dist/public/operations/specs/upsert.d.ts.map +1 -1
- package/dist/public/operations/symbol-coordinates-check.d.ts +11 -0
- package/dist/public/operations/symbol-coordinates-check.d.ts.map +1 -0
- package/dist/public/operations/symbol-coordinates-check.js +66 -0
- package/dist/public/proof-protocol.d.ts +31 -6
- package/dist/public/proof-protocol.d.ts.map +1 -1
- package/dist/public/proof-protocol.js +45 -15
- package/dist/public/proof-sources.d.ts +4 -2
- package/dist/public/proof-sources.d.ts.map +1 -1
- package/dist/public/proof-sources.js +43 -4
- package/dist/public/skills/kibi-usage/SKILL.md +6 -3
- package/dist/public/skills/kibi-usage/resources/prolog-proofs.md +207 -0
- package/dist/public/skills/kibi-usage/resources/proof.md +44 -3
- package/dist/schemas/entity.schema.json +34 -6
- package/dist/traceability/analysis-gate.d.ts +3 -1
- package/dist/traceability/analysis-gate.d.ts.map +1 -1
- package/dist/traceability/analysis-gate.js +9 -1
- package/dist/traceability/staged-file-coverage.d.ts.map +1 -1
- package/dist/traceability/staged-file-coverage.js +7 -2
- package/dist/traceability/symbol-extract.d.ts +17 -0
- package/dist/traceability/symbol-extract.d.ts.map +1 -1
- package/dist/traceability/symbol-extract.js +69 -15
- package/dist/traceability/validate.d.ts.map +1 -1
- package/dist/traceability/validate.js +5 -7
- package/dist/utils/first-sentence.d.ts +9 -0
- package/dist/utils/first-sentence.d.ts.map +1 -0
- package/dist/utils/first-sentence.js +52 -0
- package/dist/utils/rule-registry.generated.d.ts +6 -0
- package/dist/utils/rule-registry.generated.d.ts.map +1 -1
- package/dist/utils/rule-registry.generated.js +7 -0
- package/package.json +5 -5
- package/src/public/operations/check-executor.ts +8 -0
- package/src/public/operations/evidence-floor.ts +29 -1
- package/src/public/operations/specs/check-rules.generated.ts +2 -1
- package/src/public/operations/specs/reporting.ts +38 -3
- package/src/public/operations/specs/semantic.ts +2 -1
- package/src/public/operations/symbol-coordinates-check.ts +79 -0
- package/src/public/proof-protocol-types.d.ts +22 -5
- package/src/public/proof-protocol.ts +78 -19
- package/src/public/proof-sources.ts +51 -3
- package/src/public/skills/kibi-usage/SKILL.md +6 -3
- package/src/public/skills/kibi-usage/resources/prolog-proofs.md +207 -0
- package/src/public/skills/kibi-usage/resources/proof.md +44 -3
- package/src/schemas/entity.schema.json +34 -6
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"symbol-refresh.d.ts","sourceRoot":"","sources":["../../../src/operations/mutation/symbol-refresh.ts"],"names":[],"mappings":"AAuBA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,0CAA0C,CAAC;AAiBjF,MAAM,MAAM,sBAAsB,GAC9B,SAAS,GACT,WAAW,GACX,SAAS,GACT,WAAW,CAAC;AAGhB,MAAM,MAAM,aAAa,GAAG;IAC1B,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC;IAC5B,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;IACxB,QAAQ,CAAC,OAAO,CAAC,EAAE,sBAAsB,CAAC;IAC1C,QAAQ,CAAC,WAAW,CAAC,EAAE,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"symbol-refresh.d.ts","sourceRoot":"","sources":["../../../src/operations/mutation/symbol-refresh.ts"],"names":[],"mappings":"AAuBA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,0CAA0C,CAAC;AAiBjF,MAAM,MAAM,sBAAsB,GAC9B,SAAS,GACT,WAAW,GACX,SAAS,GACT,WAAW,CAAC;AAGh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
@@ -183,8 +183,13 @@ async function refreshUnlocked(symbolId, context, options = {}) {
|
|
|
183
183
|
if (next === null || !isValidCoordinateSpan(next)) {
|
|
184
184
|
// No extractable coordinates: remove stale generated state so proof keeps
|
|
185
185
|
// failing closed instead of rebinding an old span to current source bytes.
|
|
186
|
+
const failure = typeof enriched?.coordinateRefreshFailure === "string"
|
|
187
|
+
? enriched.coordinateRefreshFailure
|
|
188
|
+
: sourceText === null
|
|
189
|
+
? `${sourceFile || "its source file"} cannot be read`
|
|
190
|
+
: `no declaration titled ${title} was found in ${sourceFile}`;
|
|
186
191
|
if (existingRecords[symbolId] === undefined) {
|
|
187
|
-
return { refreshed: false, found: true };
|
|
192
|
+
return { refreshed: false, found: true, unplaced: failure };
|
|
188
193
|
}
|
|
189
194
|
delete existingRecords[symbolId];
|
|
190
195
|
const publication = publishArtifact(artifactPath, writeTargetedArtifact(existingRecords, artifactFormat));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"upsert.d.ts","sourceRoot":"","sources":["../../../src/operations/mutation/upsert.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,0CAA0C,CAAC;AACjF,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAC;AAexE,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,8BAA8B,CAAC;AA8B3E,OAAO,EACL,KAAK,kBAAkB,EAExB,MAAM,oBAAoB,CAAC;AAQ5B,OAAO,KAAK,EACV,iBAAiB,EACjB,iBAAiB,EACjB,WAAW,EACX,aAAa,EACb,eAAe,EAChB,MAAM,YAAY,CAAC;AACpB,OAAO,EACL,KAAK,wBAAwB,EAI9B,MAAM,wBAAwB,CAAC;AAsEhC,wBAAgB,gCAAgC,CAC9C,aAAa,EAAE,MAAM,EACrB,SAAS,EAAE,MAAM,GAChB,IAAI,CAkBN;AA8CD;;;;;;;GAOG;AAEH,wBAAsB,+BAA+B,CACnD,MAAM,EAAE,QA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gBAAgB,EACzB,OAAO,GAAE,sBAA2B,GACnC,OAAO,CAAC,eAAe,CAAC,aAAa,CAAC,CAAC,CAqhBzC"}
|
|
@@ -526,6 +526,10 @@ export async function executeUpsert(input, context, options = {}) {
|
|
|
526
526
|
// the complete canonical entity the next sync would compile. Failures
|
|
527
527
|
// abort before the RDF transaction so source and shard rollbacks keep all
|
|
528
528
|
// surfaces consistent; stale coordinates are never reused as a fallback.
|
|
529
|
+
// A symbol Kibi cannot place in its source file is linked to no code:
|
|
530
|
+
// say so at write time, not only in a later sync's output.
|
|
531
|
+
// implements REQ-generated-coordinate-persistence
|
|
532
|
+
const coordinateWarnings = [];
|
|
529
533
|
if (input.type === "symbol" &&
|
|
530
534
|
context.fs !== undefined &&
|
|
531
535
|
context.sourceFirst !== false &&
|
|
@@ -542,6 +546,8 @@ export async function executeUpsert(input, context, options = {}) {
|
|
|
542
546
|
if (!refresh.found || refresh.outcome === "removed") {
|
|
543
547
|
throw new Error(`Coordinate refresh could not find ${input.id} in the authored symbol manifest`);
|
|
544
548
|
}
|
|
549
|
+
if (refresh.unplaced !== undefined)
|
|
550
|
+
coordinateWarnings.push(`${input.id} has no symbol coordinates: ${refresh.unplaced}. Until Kibi places it, its link is not checked against the code (impact review, coverage and proofs do not see it there). Use the name the extractor gives the declaration, install the plugins and grammar packs kibi doctor names, or add symbol_role and granularity_reason for a file-level link.`);
|
|
545
551
|
const canonical = reextractCanonicalSymbolEntity(input.id, sourceWrite.receipt.path, context.workspaceRoot);
|
|
546
552
|
if (canonical === null) {
|
|
547
553
|
throw new Error(`Canonical symbol manifest ${sourceWrite.receipt.path} no longer contains ${input.id} after coordinate refresh`);
|
|
@@ -684,6 +690,7 @@ export async function executeUpsert(input, context, options = {}) {
|
|
|
684
690
|
...idStyleWarnings,
|
|
685
691
|
...entityContextWarnings(input, commitEntity ?? validated.entity, context.workspaceRoot, { writtenPath: sourceWrite?.receipt.path }),
|
|
686
692
|
...shardWarnings,
|
|
693
|
+
...coordinateWarnings,
|
|
687
694
|
],
|
|
688
695
|
...advisorReceipt(semantic.receipt),
|
|
689
696
|
...storedClaimKey(commitEntity ?? validated.entity),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compile-intent.d.ts","sourceRoot":"","sources":["../../../src/operations/planning/compile-intent.ts"],"names":[],"mappings":"AAOA,OAAO,EACL,KAAK,kBAAkB,EACvB,KAAK,iBAAiB,EACtB,KAAK,cAAc,EAEpB,MAAM,wBAAwB,CAAC;AAMhC,OAAO,KAAK,EACV,gBAAgB,EAEjB,MAAM,0CAA0C,CAAC;
|
|
1
|
+
{"version":3,"file":"compile-intent.d.ts","sourceRoot":"","sources":["../../../src/operations/planning/compile-intent.ts"],"names":[],"mappings":"AAOA,OAAO,EACL,KAAK,kBAAkB,EACvB,KAAK,iBAAiB,EACtB,KAAK,cAAc,EAEpB,MAAM,wBAAwB,CAAC;AAMhC,OAAO,KAAK,EACV,gBAAgB,EAEjB,MAAM,0CAA0C,CAAC;AAMlD,OAAO,EACL,KAAK,oBAAoB,EAG1B,MAAM,wBAAwB,CAAC;AAGhC,OAAO,KAAK,EAEV,2BAA2B,EAE5B,MAAM,8BAA8B,CAAC;AACtC,OAAO,EACL,KAAK,uBAAuB,EAC5B,KAAK,sBAAsB,EAG3B,KAAK,eAAe,EAIrB,MAAM,sBAAsB,CAAC;AAG9B,eAAO,MAAM,oBAAoB,EAAG,sBAA+B,CAAC;AAGpE,MAAM,MAAM,iBAAiB,GAAG,QAAQ,CAAC;IACvC,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,QAAQ,GAAG,QAAQ,CAAC;IAC1B,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,eAAe,CAAC,EAAE,SAAS,cAAc,EAAE,CAAC;IAC5C,cAAc,CAAC,EAAE,kBAAkB,CAAC;IACpC,OAAO,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAC5B,eAAe,CAA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../../public/operations/discovery-entities.js";
|
|
7
7
|
import { executeStatus } from "../../public/operations/discovery-executors.js";
|
|
8
8
|
import { readAuthoredEntity } from "../../public/operations/entity-context.js";
|
|
9
|
+
import { firstSentence } from "../../utils/first-sentence.js";
|
|
9
10
|
import { buildWhatIfAnalysisGoal } from "../mutation/contradictions.js";
|
|
10
11
|
import { canonicalSourcePath } from "../mutation/source-authoring.js";
|
|
11
12
|
import { validateUpsertInput } from "../mutation/validation.js";
|
|
@@ -799,7 +800,7 @@ export async function executeCompileIntent(args, context) {
|
|
|
799
800
|
const existingEntity = existing[0] ?? {};
|
|
800
801
|
const title = text(args.title) ||
|
|
801
802
|
text(existingEntity.title) ||
|
|
802
|
-
intent
|
|
803
|
+
firstSentence(intent) ||
|
|
803
804
|
intent;
|
|
804
805
|
const requirementDocument = requirementDocumentPath(args.sourceLocations);
|
|
805
806
|
const source = requirementDocument ??
|
|
@@ -17,6 +17,17 @@ export declare function setEqualityWitness(importPath: string, members: readonly
|
|
|
17
17
|
export declare function requiredFieldsWitness(importPath: string, typeExpression: string, fields: readonly string[]): string;
|
|
18
18
|
/** Which fields a failed required-fields witness rejected, and how. */
|
|
19
19
|
export declare function requiredFieldsFailures(witness: string, fields: readonly string[], errorLines: readonly number[]): string[];
|
|
20
|
+
export declare function environmentGetterCallee(callee: string): boolean;
|
|
21
|
+
/**
|
|
22
|
+
* The project files a claim names in its subject key or claim text (for
|
|
23
|
+
* example `src/match.c`, `utils.sh`, `fzy/src/match.c`, `src/Match.c` or
|
|
24
|
+
* `src/match`): a token resolves, ignoring case, to the file at that path,
|
|
25
|
+
* else to every project file with that name or path suffix, else (for a
|
|
26
|
+
* slashed name without an extension) to the files with that stem. Tokens
|
|
27
|
+
* that name no file (dotted subject keys such as `kibi.cli`) resolve to
|
|
28
|
+
* nothing.
|
|
29
|
+
*/
|
|
30
|
+
export declare function namedClaimFiles(workspaceRoot: string, texts: readonly string[]): Map<string, string[]>;
|
|
20
31
|
/**
|
|
21
32
|
* The evidence level a receipt records. A certificate that re-checks but
|
|
22
33
|
* derives none of the claims it names from the code proves nothing about
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"claim-bindings.d.ts","sourceRoot":"","sources":["../../../src/operations/proof/claim-bindings.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"claim-bindings.d.ts","sourceRoot":"","sources":["../../../src/operations/proof/claim-bindings.ts"],"names":[],"mappings":"AA6BA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,0CAA0C,CAAC;AACjF,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AACpE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAClE,OAAO,EACL,KAAK,kBAAkB,EAIxB,MAAM,wBAAwB,CAAC;AAgDhC;;;GAGG;AAEH,wBAAgB,kBAAkB,CAChC,UAAU,EAAE,MAAM,EAClB,OAAO,EAAE,SAAS,MAAM,EAAE,EAC1B,WAAW,EAAE,MAAM,GAClB,MAAM,CAWR;AAgED;;;;;;GAMG;AAEH,wBAAgB,qBAAqB,CACnC,UAAU,EAAE,MAAM,EAClB,cAAc,EAAE,MAAM,EACtB,MAAM,EAAE,SAAS,MAAM,EAAE,GACxB,MAAM,CAgBR;AAED,uEAAuE;AACvE,wBAAgB,sBAAsB,CACpC,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,SAAS,MAAM,EAAE,EACzB,UAAU,EAAE,SAAS,MAAM,EAAE,GAC5B,MAAM,EAAE,CAaV;AAoKD,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAE/D;AAwBD;;;;;;;;GAQG;AAEH,wBAAgB,eAAe,CAC7B,aAAa,EAAE,MAAM,EACrB,KAAK,EAAE,SAAS,MAAM,EAAE,GACvB,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAqBvB;AAyFD;;;;;;GAMG;AAEH,wBAAgB,oBAAoB,CAClC,KAAK,EAAE,QAAQ,GAAG,QAAQ,EAC1B,QAAQ,EAAE,SAAS,YAAY,EAAE,GAAG,SAAS,GAC5C,QAAQ,GAAG,QAAQ,CAQrB;AAED;;;;;;GAMG;AAEH,wBAAsB,kBAAkB,CACtC,OAAO,EAAE,gBAAgB,EACzB,KAAK,EAAE,QAAQ,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,aAAa,CAAC;IACxB,OAAO,EAAE,kBAAkB,CAAC;IAC5B,gBAAgB,EAAE,SAAS,MAAM,EAAE,CAAC;CACrC,CAAC,GACD,OAAO,CAAC,YAAY,EAAE,GAAG,SAAS,CAAC,CA4FrC"}
|
|
@@ -18,7 +18,11 @@
|
|
|
18
18
|
import { randomBytes } from "node:crypto";
|
|
19
19
|
import { rmSync, writeFileSync } from "node:fs";
|
|
20
20
|
import path from "node:path";
|
|
21
|
+
import fg from "fast-glob";
|
|
22
|
+
import { normalizeEntityId, parseTriples } from "../../prolog/codec.js";
|
|
21
23
|
import { runOperationJsonQuery, toPrologAtom, } from "../../public/operations/prolog-json.js";
|
|
24
|
+
import { loadEntities } from "../../public/operations/discovery-entities.js";
|
|
25
|
+
import { matchWorkspaceFiles } from "../../public/proof-sources.js";
|
|
22
26
|
import { compileWitness, loadSymbol, smtAssertion, } from "./code-certificates.js";
|
|
23
27
|
import { stringConstraintProblem } from "./code-models.js";
|
|
24
28
|
function record(value) {
|
|
@@ -264,6 +268,143 @@ async function derivedProblem(context, contract, certificate, row, coveredBy) {
|
|
|
264
268
|
return `the query does not assert the negation of ${factId}'s constraint ${negation}`;
|
|
265
269
|
return null;
|
|
266
270
|
}
|
|
271
|
+
/**
|
|
272
|
+
* Callees that read one environment variable. A string_args read of one of
|
|
273
|
+
* them sees only that getter's first arguments, never the other ways the
|
|
274
|
+
* code reads the environment, so it cannot decide an eq, subset_of or
|
|
275
|
+
* excludes claim about what the code reads; the env extract reads them all.
|
|
276
|
+
*/
|
|
277
|
+
const ENVIRONMENT_GETTER = /(?:^|[.:/])(?:getenv|Getenv|LookupEnv|getenvb|GetEnvironmentVariable)$|(?:^|[.:/])env::var(?:_os)?$|^(?:os\.environ\.get|ENV\.fetch|process\.env)$/;
|
|
278
|
+
export function environmentGetterCallee(callee) {
|
|
279
|
+
return ENVIRONMENT_GETTER.test(callee.replace(/\s+/g, "").replace(/\/\d+$/, ""));
|
|
280
|
+
}
|
|
281
|
+
const CLOSED_OPERATORS = new Set(["eq", "subset_of", "excludes"]);
|
|
282
|
+
const FILE_NAME_TOKEN = /[A-Za-z0-9_][A-Za-z0-9_./-]*\.[A-Za-z0-9]{1,10}\b/g;
|
|
283
|
+
/** A quoted or backticked path, which may hold spaces (`automated install/x.sh`). */
|
|
284
|
+
const QUOTED_PATH = /[`'"]([^`'"\n]*[/.][^`'"\n]*)[`'"]/g;
|
|
285
|
+
/** A slashed path without an extension (`src/match` for src/match.c). */
|
|
286
|
+
const BARE_PATH = /[A-Za-z0-9_][A-Za-z0-9_.-]*(?:\/[A-Za-z0-9_.-]+)+/g;
|
|
287
|
+
function claimFileCandidates(token) {
|
|
288
|
+
const escaped = fg.escapePath(token.replace(/^\.?\/+/, ""));
|
|
289
|
+
const segments = escaped.split("/");
|
|
290
|
+
// The token as a path, as a name anywhere, then with leading segments
|
|
291
|
+
// dropped (a repository prefix such as fzy/src/match.c), then, for a
|
|
292
|
+
// slashed name without an extension, any extension.
|
|
293
|
+
const tries = [[escaped], [`**/${escaped}`]];
|
|
294
|
+
for (let drop = 1; drop < segments.length; drop += 1)
|
|
295
|
+
tries.push([`**/${segments.slice(drop).join("/")}`]);
|
|
296
|
+
if (segments.length > 1 && !/\.[^/.]+$/.test(escaped))
|
|
297
|
+
tries.push([`${escaped}.*`, `**/${escaped}.*`]);
|
|
298
|
+
return tries;
|
|
299
|
+
}
|
|
300
|
+
/**
|
|
301
|
+
* The project files a claim names in its subject key or claim text (for
|
|
302
|
+
* example `src/match.c`, `utils.sh`, `fzy/src/match.c`, `src/Match.c` or
|
|
303
|
+
* `src/match`): a token resolves, ignoring case, to the file at that path,
|
|
304
|
+
* else to every project file with that name or path suffix, else (for a
|
|
305
|
+
* slashed name without an extension) to the files with that stem. Tokens
|
|
306
|
+
* that name no file (dotted subject keys such as `kibi.cli`) resolve to
|
|
307
|
+
* nothing.
|
|
308
|
+
*/
|
|
309
|
+
// implements REQ-kibi-source-proof-kinds
|
|
310
|
+
export function namedClaimFiles(workspaceRoot, texts) {
|
|
311
|
+
const named = new Map();
|
|
312
|
+
for (const value of texts) {
|
|
313
|
+
const tokens = [
|
|
314
|
+
...[...value.matchAll(QUOTED_PATH)].map((match) => match[1] ?? ""),
|
|
315
|
+
...[...value.matchAll(FILE_NAME_TOKEN)].map((match) => match[0]),
|
|
316
|
+
...[...value.matchAll(BARE_PATH)].map((match) => match[0]),
|
|
317
|
+
];
|
|
318
|
+
for (const raw of tokens) {
|
|
319
|
+
const token = raw.trim();
|
|
320
|
+
if (token === "" || named.has(token))
|
|
321
|
+
continue;
|
|
322
|
+
for (const patterns of claimFileCandidates(token)) {
|
|
323
|
+
const files = matchWorkspaceFiles(workspaceRoot, patterns, [], false);
|
|
324
|
+
if (files.length > 0) {
|
|
325
|
+
named.set(token, files);
|
|
326
|
+
break;
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
return named;
|
|
332
|
+
}
|
|
333
|
+
/**
|
|
334
|
+
* What a references read must cover for the claims it proves. The read
|
|
335
|
+
* decides a claim only for the files it reads, so every symbol the test
|
|
336
|
+
* covers (covered_by) and every symbol that implements the claim's
|
|
337
|
+
* requirement must lie in one of those files: otherwise the claim, which is
|
|
338
|
+
* about that symbol's code, would be decided on other files. A string_args
|
|
339
|
+
* read of an environment getter cannot decide a closed claim (eq, subset_of,
|
|
340
|
+
* excludes) about what the code reads, since the other getters are unread.
|
|
341
|
+
*/
|
|
342
|
+
// implements REQ-kibi-source-proof-kinds
|
|
343
|
+
async function sourceScopeCheck(context, contract, coveredBy) {
|
|
344
|
+
const spec = contract.source;
|
|
345
|
+
if (contract.kind !== "source" || spec?.reader !== "references")
|
|
346
|
+
return null;
|
|
347
|
+
const list = (value) => typeof value === "string"
|
|
348
|
+
? [value]
|
|
349
|
+
: Array.isArray(value)
|
|
350
|
+
? value.filter((item) => typeof item === "string")
|
|
351
|
+
: [];
|
|
352
|
+
const read = new Set(matchWorkspaceFiles(context.workspaceRoot, list(spec.files), list(spec.ignore)));
|
|
353
|
+
const implementers = new Map();
|
|
354
|
+
if (context.prolog !== undefined) {
|
|
355
|
+
const result = await context.prolog.query("findall([From,To,'implements'], kb_relationship(implements, From, To), Rels)");
|
|
356
|
+
if (!result.success)
|
|
357
|
+
throw new Error(`implements relationship query failed: ${result.error ?? "Unknown error"}`);
|
|
358
|
+
for (const [from, to] of parseTriples(result.bindings.Rels ?? "[]")) {
|
|
359
|
+
const requirement = normalizeEntityId(to);
|
|
360
|
+
implementers.set(requirement, [
|
|
361
|
+
...(implementers.get(requirement) ?? []),
|
|
362
|
+
normalizeEntityId(from),
|
|
363
|
+
]);
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
const files = new Map();
|
|
367
|
+
const fileOf = async (symbolId) => {
|
|
368
|
+
if (!files.has(symbolId))
|
|
369
|
+
files.set(symbolId, (await loadSymbol(context, symbolId))?.sourceFile ?? "");
|
|
370
|
+
return files.get(symbolId) ?? "";
|
|
371
|
+
};
|
|
372
|
+
const callee = typeof spec.callee === "string" ? spec.callee : "";
|
|
373
|
+
const getter = spec.extract === "string_args" && environmentGetterCallee(callee);
|
|
374
|
+
return async (row) => {
|
|
375
|
+
const operator = text(record(row.obligation)?.operator);
|
|
376
|
+
if (getter && CLOSED_OPERATORS.has(operator))
|
|
377
|
+
return `a string_args read of ${callee} sees only that getter's arguments, not the other ways the code reads the environment, so it cannot decide a ${operator} claim; read the files with extract env`;
|
|
378
|
+
const linked = [
|
|
379
|
+
...[...coveredBy].map((id) => ({ id, how: "is covered by the test" })),
|
|
380
|
+
...(implementers.get(row.requirement_id ?? "") ?? []).map((id) => ({
|
|
381
|
+
id,
|
|
382
|
+
how: `implements ${row.requirement_id}`,
|
|
383
|
+
})),
|
|
384
|
+
];
|
|
385
|
+
if (row.fact_id && context.prolog !== undefined) {
|
|
386
|
+
const [fact] = await loadEntities(context.prolog, { id: row.fact_id, type: "fact" });
|
|
387
|
+
const named = namedClaimFiles(context.workspaceRoot, [
|
|
388
|
+
text(fact?.subject_key),
|
|
389
|
+
text(fact?.claim_text),
|
|
390
|
+
]);
|
|
391
|
+
const unread = [...named].filter(([, paths]) => !paths.some((file) => read.has(file)));
|
|
392
|
+
if (unread.length > 0) {
|
|
393
|
+
const [token, paths] = unread[0];
|
|
394
|
+
return `the claim is about ${token}${paths[0] !== token ? ` (${paths.slice(0, 3).join(", ")})` : ""}, which the read does not include. Kibi decides the claim only on the files it reads, so add that file to files; if Kibi cannot read it, the claim cannot be decided`;
|
|
395
|
+
}
|
|
396
|
+
}
|
|
397
|
+
const outside = [];
|
|
398
|
+
for (const { id, how } of linked) {
|
|
399
|
+
const file = await fileOf(id);
|
|
400
|
+
if (file !== "" && !read.has(file) && !outside.some((text) => text.startsWith(`${id} `)))
|
|
401
|
+
outside.push(`${id} (${file}) ${how}`);
|
|
402
|
+
}
|
|
403
|
+
if (outside.length === 0)
|
|
404
|
+
return null;
|
|
405
|
+
return `the read does not cover the code the claim is about: ${outside.slice(0, 3).join("; ")}${outside.length > 3 ? ` and ${outside.length - 3} more` : ""}. Kibi decides the claim only on the files it reads, so add those files to files; if Kibi cannot read them, the claim cannot be decided for them`;
|
|
406
|
+
};
|
|
407
|
+
}
|
|
267
408
|
/**
|
|
268
409
|
* The evidence level a receipt records. A certificate that re-checks but
|
|
269
410
|
* derives none of the claims it names from the code proves nothing about
|
|
@@ -306,6 +447,7 @@ export async function judgeClaimBindings(context, input) {
|
|
|
306
447
|
const harnessed = input.contract.kind === "rule" &&
|
|
307
448
|
Object.values(input.contract.predicate_source ?? {}).some((row) => (row.harness_for ?? []).length > 0);
|
|
308
449
|
const certificate = record(input.verdict.certificate) ?? {};
|
|
450
|
+
const scopeCheck = await sourceScopeCheck(context, input.contract, coveredBy);
|
|
309
451
|
const bindings = [];
|
|
310
452
|
for (const row of rows) {
|
|
311
453
|
const base = {
|
|
@@ -344,7 +486,8 @@ export async function judgeClaimBindings(context, input) {
|
|
|
344
486
|
});
|
|
345
487
|
continue;
|
|
346
488
|
}
|
|
347
|
-
const problem = await
|
|
489
|
+
const problem = (await scopeCheck?.(row)) ??
|
|
490
|
+
(await derivedProblem(context, input.contract, certificate, row, coveredBy));
|
|
348
491
|
const numeric = text(obligation.kind) === "numeric_constraint";
|
|
349
492
|
bindings.push(problem === null
|
|
350
493
|
? {
|
|
@@ -23,7 +23,9 @@ export declare function readWorkspaceFile(workspaceRoot: string, relative: strin
|
|
|
23
23
|
* `identifier`: the domain is read from the code, not hand-listed. A suite
|
|
24
24
|
* that tests compiled output imports the domain from the TypeScript
|
|
25
25
|
* project's `outDir`; given the workspace root, such an import counts when it
|
|
26
|
-
* maps back to the domain's source file under `rootDir`.
|
|
26
|
+
* maps back to the domain's source file under `rootDir`. A SWI-Prolog proof
|
|
27
|
+
* names the predicate and loads its file (use_module, ensure_loaded, consult
|
|
28
|
+
* or a load list), or is the plunit file beside it (`x.plt` for `x.pl`).
|
|
27
29
|
*/
|
|
28
30
|
export declare function importsDomain(source: string, sourcePath: string, targetPath: string, identifier: string, workspaceRoot?: string): boolean;
|
|
29
31
|
/**
|
|
@@ -47,6 +49,8 @@ export declare function evaluateDomain(workspaceRoot: string, sourceFile: string
|
|
|
47
49
|
runners?: readonly ("bun" | "tsx" | "node")[];
|
|
48
50
|
/** Read this field of each member instead of the member itself. */
|
|
49
51
|
field?: string;
|
|
52
|
+
/** A Prolog predicate's argument that names each member. */
|
|
53
|
+
arg?: number;
|
|
50
54
|
}>): {
|
|
51
55
|
ok: true;
|
|
52
56
|
count: number;
|
|
@@ -56,9 +60,12 @@ export declare function evaluateDomain(workspaceRoot: string, sourceFile: string
|
|
|
56
60
|
reason: string;
|
|
57
61
|
};
|
|
58
62
|
/**
|
|
59
|
-
* The number a value_source export holds, read the same way as a domain.
|
|
63
|
+
* The number a value_source export holds, read the same way as a domain. A
|
|
64
|
+
* Prolog constant is a predicate with a single solution holding a number.
|
|
60
65
|
*/
|
|
61
|
-
export declare function evaluateScalar(workspaceRoot: string, sourceFile: string, exportName: string
|
|
66
|
+
export declare function evaluateScalar(workspaceRoot: string, sourceFile: string, exportName: string, options?: Readonly<{
|
|
67
|
+
arg?: number;
|
|
68
|
+
}>): {
|
|
62
69
|
ok: true;
|
|
63
70
|
value: number;
|
|
64
71
|
} | {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"code-certificates.d.ts","sourceRoot":"","sources":["../../../src/operations/proof/code-certificates.ts"],"names":[],"mappings":"AA2BA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,0CAA0C,CAAC;AAKjF,OAAO,EAEL,KAAK,aAAa,EAClB,KAAK,SAAS,EAEf,MAAM,gCAAgC,CAAC;
|
|
1
|
+
{"version":3,"file":"code-certificates.d.ts","sourceRoot":"","sources":["../../../src/operations/proof/code-certificates.ts"],"names":[],"mappings":"AA2BA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,0CAA0C,CAAC;AAKjF,OAAO,EAEL,KAAK,aAAa,EAClB,KAAK,SAAS,EAEf,MAAM,gCAAgC,CAAC;AA2BxC;;;GAGG;AAEH,MAAM,MAAM,kBAAkB,GAAG,QAAQ,CAAC;IACxC,IAAI,EAAE,SAAS,CAAC;IAChB,cAAc,EAAE,QAAQ,GAAG,QAAQ,CAAC;IACpC,WAAW,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;IAChD,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,qBAAqB,CAAC,EAAE,MAAM,CAAC;CAChC,CAAC,CAAC;AAEH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B,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,OAAO,CAAC;CACtB,CAAC,GACD,OAAO,CAAC,kBAAkB,CAAC,CAoF7B"}
|
|
@@ -25,6 +25,8 @@ import { canonicalCertificateJson, certificateDigest, } from "../../public/proof
|
|
|
25
25
|
import { CODE_CERTIFICATE_VERSION, isCertificateProofKind, } from "../../public/proof-protocol.js";
|
|
26
26
|
import { describeSource, normalizeSourceSpec, readSource, } from "../../public/proof-sources.js";
|
|
27
27
|
import { runCodeEvaluator, spawnSyncThroughFiles, TS_RESOLVE_HOOKS, } from "./code-runner.js";
|
|
28
|
+
import { CODE_LANGUAGE_NAMES, codeLanguage, prologLoadSpecs, stripPrologExtension, unsupportedLanguageReason, } from "./code-languages.js";
|
|
29
|
+
import { PROLOG_EVALUATOR } from "./prolog-evaluator.js";
|
|
28
30
|
import { evaluateSourceCode } from "./source-code-readers.js";
|
|
29
31
|
import { machineCertificateProblem, patternCertificateProblem, ruleCertificateProblem, } from "./code-models.js";
|
|
30
32
|
function record(value) {
|
|
@@ -59,10 +61,14 @@ const IMPORT_SPECIFIER = /(?:\bfrom\s*|\bimport\s*\(\s*|\bimport\s+|\brequire\s*
|
|
|
59
61
|
* `identifier`: the domain is read from the code, not hand-listed. A suite
|
|
60
62
|
* that tests compiled output imports the domain from the TypeScript
|
|
61
63
|
* project's `outDir`; given the workspace root, such an import counts when it
|
|
62
|
-
* maps back to the domain's source file under `rootDir`.
|
|
64
|
+
* maps back to the domain's source file under `rootDir`. A SWI-Prolog proof
|
|
65
|
+
* names the predicate and loads its file (use_module, ensure_loaded, consult
|
|
66
|
+
* or a load list), or is the plunit file beside it (`x.plt` for `x.pl`).
|
|
63
67
|
*/
|
|
64
68
|
// implements REQ-kibi-code-proof-kinds
|
|
65
69
|
export function importsDomain(source, sourcePath, targetPath, identifier, workspaceRoot) {
|
|
70
|
+
if (codeLanguage(targetPath) === "prolog")
|
|
71
|
+
return prologLoadsModule(source, sourcePath, targetPath, identifier);
|
|
66
72
|
// A dotted export (BRAND.name) is imported under its head.
|
|
67
73
|
const imported = identifier.split(".")[0] ?? "";
|
|
68
74
|
if (imported === "" || !new RegExp(`\\b${escapeRegExp(imported)}\\b`).test(source))
|
|
@@ -85,6 +91,23 @@ export function importsDomain(source, sourcePath, targetPath, identifier, worksp
|
|
|
85
91
|
}
|
|
86
92
|
return false;
|
|
87
93
|
}
|
|
94
|
+
/**
|
|
95
|
+
* Whether a SWI-Prolog proof names the predicate `identifier` (Name/Arity,
|
|
96
|
+
* optionally module-qualified) and loads the file at `targetPath`: a relative
|
|
97
|
+
* path resolved from the proof's directory, `library(X)` for a pack's
|
|
98
|
+
* `prolog/X.pl`, or the plunit convention of a `.plt` file beside its `.pl`.
|
|
99
|
+
*/
|
|
100
|
+
function prologLoadsModule(source, sourcePath, targetPath, identifier) {
|
|
101
|
+
const name = identifier.replace(/^[^:]*:/, "").replace(/\/\/?\d+$/, "");
|
|
102
|
+
if (name === "" || !new RegExp(`(?<![\\w])${escapeRegExp(name)}(?![\\w])`).test(source))
|
|
103
|
+
return false;
|
|
104
|
+
const target = stripPrologExtension(targetPath);
|
|
105
|
+
if (stripPrologExtension(sourcePath) === target && /\.plt$/i.test(sourcePath))
|
|
106
|
+
return true;
|
|
107
|
+
return prologLoadSpecs(source).some((spec) => "library" in spec
|
|
108
|
+
? `${path.sep}${target}`.endsWith(`${path.sep}prolog${path.sep}${path.normalize(spec.library)}`)
|
|
109
|
+
: stripPrologExtension(path.join(path.dirname(sourcePath), spec.path)) === target);
|
|
110
|
+
}
|
|
88
111
|
const PYTHON_FROM_IMPORT = /^\s*from\s+(\.*)([\w.]*)\s+import\b/gm;
|
|
89
112
|
const PYTHON_IMPORT = /^\s*import\s+([\w.]+(?:\s*,\s*[\w.]+)*)/gm;
|
|
90
113
|
/**
|
|
@@ -288,7 +311,7 @@ else:
|
|
|
288
311
|
*/
|
|
289
312
|
// implements REQ-kibi-code-proof-kinds
|
|
290
313
|
export function evaluateDomain(workspaceRoot, sourceFile, exportName, options = {}) {
|
|
291
|
-
const evaluated = evaluateExport(workspaceRoot, sourceFile, exportName, options);
|
|
314
|
+
const evaluated = evaluateExport(workspaceRoot, sourceFile, exportName, "domain", options);
|
|
292
315
|
if (!evaluated.ok)
|
|
293
316
|
return evaluated;
|
|
294
317
|
if (evaluated.scalar !== undefined)
|
|
@@ -299,20 +322,44 @@ export function evaluateDomain(workspaceRoot, sourceFile, exportName, options =
|
|
|
299
322
|
return { ok: true, count: evaluated.count, members: evaluated.members };
|
|
300
323
|
}
|
|
301
324
|
/**
|
|
302
|
-
* The number a value_source export holds, read the same way as a domain.
|
|
325
|
+
* The number a value_source export holds, read the same way as a domain. A
|
|
326
|
+
* Prolog constant is a predicate with a single solution holding a number.
|
|
303
327
|
*/
|
|
304
328
|
// implements REQ-kibi-claim-bound-proofs
|
|
305
|
-
export function evaluateScalar(workspaceRoot, sourceFile, exportName) {
|
|
306
|
-
const evaluated = evaluateExport(workspaceRoot, sourceFile, exportName);
|
|
329
|
+
export function evaluateScalar(workspaceRoot, sourceFile, exportName, options = {}) {
|
|
330
|
+
const evaluated = evaluateExport(workspaceRoot, sourceFile, exportName, "scalar", options);
|
|
307
331
|
if (!evaluated.ok)
|
|
308
332
|
return evaluated;
|
|
309
333
|
if (evaluated.scalar === undefined || !Number.isFinite(evaluated.scalar))
|
|
310
334
|
return { ok: false, reason: `${exportName} in ${sourceFile} is not a finite number` };
|
|
311
335
|
return { ok: true, value: evaluated.scalar };
|
|
312
336
|
}
|
|
313
|
-
function evaluateExport(workspaceRoot, sourceFile, exportName, options = {}) {
|
|
337
|
+
function evaluateExport(workspaceRoot, sourceFile, exportName, want, options = {}) {
|
|
314
338
|
const absolute = path.resolve(workspaceRoot, sourceFile);
|
|
315
|
-
const
|
|
339
|
+
const language = codeLanguage(sourceFile);
|
|
340
|
+
if (language === null)
|
|
341
|
+
return {
|
|
342
|
+
ok: false,
|
|
343
|
+
reason: unsupportedLanguageReason("Kibi's domain loader", ["js", "python", "prolog"], [sourceFile]),
|
|
344
|
+
};
|
|
345
|
+
if (language === "prolog" && options.field !== undefined)
|
|
346
|
+
return {
|
|
347
|
+
ok: false,
|
|
348
|
+
reason: `a SWI-Prolog predicate has arguments, not fields: name the argument of ${exportName} with arg instead of field`,
|
|
349
|
+
};
|
|
350
|
+
if (language !== "prolog" && options.arg !== undefined)
|
|
351
|
+
return {
|
|
352
|
+
ok: false,
|
|
353
|
+
reason: `arg applies only to a SWI-Prolog predicate, not to ${CODE_LANGUAGE_NAMES[language]} in ${sourceFile}`,
|
|
354
|
+
};
|
|
355
|
+
const ref = {
|
|
356
|
+
file: absolute,
|
|
357
|
+
export: exportName,
|
|
358
|
+
...(options.arg === undefined ? {} : { arg: options.arg }),
|
|
359
|
+
};
|
|
360
|
+
const run = runCodeEvaluator(workspaceRoot, sourceFile, { js: DOMAIN_EVALUATOR, python: PYTHON_DOMAIN_EVALUATOR, prolog: PROLOG_EVALUATOR }, language === "prolog"
|
|
361
|
+
? [JSON.stringify({ mode: "export", want, ref })]
|
|
362
|
+
: [absolute, exportName, options.field ?? ""], (parsed) => {
|
|
316
363
|
const row = parsed;
|
|
317
364
|
return (row.error !== undefined ||
|
|
318
365
|
typeof row.scalar === "number" ||
|
|
@@ -321,7 +368,7 @@ function evaluateExport(workspaceRoot, sourceFile, exportName, options = {}) {
|
|
|
321
368
|
if (!run.ok)
|
|
322
369
|
return {
|
|
323
370
|
ok: false,
|
|
324
|
-
reason: `Kibi could not load ${exportName} from ${sourceFile}${run.failure ? `: ${run.failure}` : ""}${run.python ? " (a Python domain loads with KIBI_PYTHON, the active or project virtualenv (.venv or venv), then python3 on PATH)" : " (without bun or the workspace's tsx, node's type stripping loads the domain; a type imported without import type stops it)"}`,
|
|
371
|
+
reason: `Kibi could not load ${exportName} from ${sourceFile}${run.failure ? `: ${run.failure}` : ""}${run.language === "python" ? " (a Python domain loads with KIBI_PYTHON, the active or project virtualenv (.venv or venv), then python3 on PATH)" : run.language === "prolog" ? " (a SWI-Prolog domain loads with KIBI_SWIPL, the bundled SWI-Prolog, then swipl on PATH)" : " (without bun or the workspace's tsx, node's type stripping loads the domain; a type imported without import type stops it)"}`,
|
|
325
372
|
};
|
|
326
373
|
const parsed = run.value;
|
|
327
374
|
if (parsed.error !== undefined)
|
|
@@ -606,13 +653,13 @@ export async function valueSourceValues(context, contract) {
|
|
|
606
653
|
if (source.measure === "count") {
|
|
607
654
|
// A count claim reads the collection itself, not a number kept
|
|
608
655
|
// beside it for the proof.
|
|
609
|
-
const domain = evaluateDomain(context.workspaceRoot, symbol.sourceFile, exportName);
|
|
656
|
+
const domain = evaluateDomain(context.workspaceRoot, symbol.sourceFile, exportName, source.arg === undefined ? {} : { arg: source.arg });
|
|
610
657
|
if (!domain.ok)
|
|
611
658
|
return domain;
|
|
612
659
|
values.push({ symbol_id: source.symbol_id, value: domain.count });
|
|
613
660
|
continue;
|
|
614
661
|
}
|
|
615
|
-
const evaluated = evaluateScalar(context.workspaceRoot, symbol.sourceFile, exportName);
|
|
662
|
+
const evaluated = evaluateScalar(context.workspaceRoot, symbol.sourceFile, exportName, source.arg === undefined ? {} : { arg: source.arg });
|
|
616
663
|
if (!evaluated.ok)
|
|
617
664
|
return evaluated;
|
|
618
665
|
values.push({ symbol_id: source.symbol_id, value: evaluated.value });
|
|
@@ -729,9 +776,14 @@ async function workspaceProblem(context, contract, certificate) {
|
|
|
729
776
|
if (!importing)
|
|
730
777
|
return `the proof does not import ${exportName || domainId} from ${domain.sourceFile}, so its domain may be hand-listed${contract.domain_source?.export === undefined ? ` (Kibi reads the export named by the symbol's title; set domain_source.export when the export has another name)` : ""}`;
|
|
731
778
|
if (kind === "exhaustive") {
|
|
732
|
-
const evaluated = evaluateDomain(context.workspaceRoot, domain.sourceFile, exportName,
|
|
733
|
-
|
|
734
|
-
|
|
779
|
+
const evaluated = evaluateDomain(context.workspaceRoot, domain.sourceFile, exportName, {
|
|
780
|
+
...(contract.domain_source?.field === undefined
|
|
781
|
+
? {}
|
|
782
|
+
: { field: contract.domain_source.field }),
|
|
783
|
+
...(contract.domain_source?.arg === undefined
|
|
784
|
+
? {}
|
|
785
|
+
: { arg: contract.domain_source.arg }),
|
|
786
|
+
});
|
|
735
787
|
if (!evaluated.ok)
|
|
736
788
|
return evaluated.reason;
|
|
737
789
|
const members = record(certificate.domain)?.members;
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The languages Kibi reads code models in, decided by a file's extension in
|
|
3
|
+
* one place. Every proof kind that loads code (exhaustive domains, value
|
|
4
|
+
* constants, rule tables, state machines, patterns) asks this module which
|
|
5
|
+
* evaluator a file needs, so adding a language adds one entry here and its
|
|
6
|
+
* evaluator scripts, not another extension test at each call site.
|
|
7
|
+
*/
|
|
8
|
+
export type CodeLanguage = "js" | "python" | "prolog";
|
|
9
|
+
/** The language whose evaluator reads `file`, or null for any other file. */
|
|
10
|
+
export declare function codeLanguage(file: string): CodeLanguage | null;
|
|
11
|
+
export type PrologLoadSpec = {
|
|
12
|
+
library: string;
|
|
13
|
+
} | {
|
|
14
|
+
path: string;
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* The files a SWI-Prolog source loads, read from its text: use_module,
|
|
18
|
+
* ensure_loaded, consult, load_files, reexport and include with a quoted or
|
|
19
|
+
* plain path or `library(X)`, and `:- [a, b]` load lists. Nothing runs.
|
|
20
|
+
*/
|
|
21
|
+
export declare function prologLoadSpecs(source: string): PrologLoadSpec[];
|
|
22
|
+
export declare function stripPrologExtension(file: string): string;
|
|
23
|
+
/** How a reason names a language. */
|
|
24
|
+
/**
|
|
25
|
+
* Languages whose references a qualified plugin reads (kibi-plugin-treesitter
|
|
26
|
+
* through kibi.reference-extractor.v1). Kibi itself runs nothing for them.
|
|
27
|
+
*/
|
|
28
|
+
export declare const PLUGIN_REFERENCE_LANGUAGES: readonly [{
|
|
29
|
+
readonly name: "Go";
|
|
30
|
+
readonly pattern: RegExp;
|
|
31
|
+
}, {
|
|
32
|
+
readonly name: "Java";
|
|
33
|
+
readonly pattern: RegExp;
|
|
34
|
+
}, {
|
|
35
|
+
readonly name: "C#";
|
|
36
|
+
readonly pattern: RegExp;
|
|
37
|
+
}, {
|
|
38
|
+
readonly name: "Rust";
|
|
39
|
+
readonly pattern: RegExp;
|
|
40
|
+
}];
|
|
41
|
+
/**
|
|
42
|
+
* The data-only kibi-lang-* packs kibi-plugin-treesitter reads these
|
|
43
|
+
* languages with, by the file extensions its catalog maps to them. Every
|
|
44
|
+
* grammar ships in a pack; `.pl` counts as SWI-Prolog here.
|
|
45
|
+
*/
|
|
46
|
+
export declare const PLUGIN_LANGUAGE_PACKS: readonly [{
|
|
47
|
+
readonly pack: "kibi-lang-go";
|
|
48
|
+
readonly name: "Go";
|
|
49
|
+
readonly pattern: RegExp;
|
|
50
|
+
}, {
|
|
51
|
+
readonly pack: "kibi-lang-rust";
|
|
52
|
+
readonly name: "Rust";
|
|
53
|
+
readonly pattern: RegExp;
|
|
54
|
+
}, {
|
|
55
|
+
readonly pack: "kibi-lang-java";
|
|
56
|
+
readonly name: "Java";
|
|
57
|
+
readonly pattern: RegExp;
|
|
58
|
+
}, {
|
|
59
|
+
readonly pack: "kibi-lang-csharp";
|
|
60
|
+
readonly name: "C#";
|
|
61
|
+
readonly pattern: RegExp;
|
|
62
|
+
}, {
|
|
63
|
+
readonly pack: "kibi-lang-php";
|
|
64
|
+
readonly name: "PHP";
|
|
65
|
+
readonly pattern: RegExp;
|
|
66
|
+
}, {
|
|
67
|
+
readonly pack: "kibi-lang-c";
|
|
68
|
+
readonly name: "C";
|
|
69
|
+
readonly pattern: RegExp;
|
|
70
|
+
}, {
|
|
71
|
+
readonly pack: "kibi-lang-cpp";
|
|
72
|
+
readonly name: "C++";
|
|
73
|
+
readonly pattern: RegExp;
|
|
74
|
+
}, {
|
|
75
|
+
readonly pack: "kibi-lang-bash";
|
|
76
|
+
readonly name: "Bash";
|
|
77
|
+
readonly pattern: RegExp;
|
|
78
|
+
}, {
|
|
79
|
+
readonly pack: "kibi-lang-ruby";
|
|
80
|
+
readonly name: "Ruby";
|
|
81
|
+
readonly pattern: RegExp;
|
|
82
|
+
}, {
|
|
83
|
+
readonly pack: "kibi-lang-hcl";
|
|
84
|
+
readonly name: "Terraform/HCL";
|
|
85
|
+
readonly pattern: RegExp;
|
|
86
|
+
}, {
|
|
87
|
+
readonly pack: "kibi-lang-python";
|
|
88
|
+
readonly name: "Python";
|
|
89
|
+
readonly pattern: RegExp;
|
|
90
|
+
}, {
|
|
91
|
+
readonly pack: "kibi-lang-prolog";
|
|
92
|
+
readonly name: "SWI-Prolog";
|
|
93
|
+
readonly pattern: RegExp;
|
|
94
|
+
}];
|
|
95
|
+
export declare function pluginReferenceLanguage(file: string): string | null;
|
|
96
|
+
export declare const CODE_LANGUAGE_NAMES: Readonly<Record<CodeLanguage, string>>;
|
|
97
|
+
/** How a reason names the language of `file`. */
|
|
98
|
+
export declare function languageName(file: string): string;
|
|
99
|
+
/**
|
|
100
|
+
* The one refusal for a file whose language a reader cannot read: what reads
|
|
101
|
+
* which languages, and the files it was handed outside them.
|
|
102
|
+
*/
|
|
103
|
+
export declare function unsupportedLanguageReason(reader: string, supported: readonly CodeLanguage[], files: readonly string[]): string;
|
|
104
|
+
//# sourceMappingURL=code-languages.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"code-languages.d.ts","sourceRoot":"","sources":["../../../src/operations/proof/code-languages.ts"],"names":[],"mappings":"AAoBA;;;;;;GAMG;AAEH,MAAM,MAAM,YAAY,GAAG,IAAI,GAAG,QAAQ,GAAG,QAAQ,CAAC;AAQtD,6EAA6E;AAE7E,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,YAAY,GAAG,IAAI,CAK9D;AAMD,MAAM,MAAM,cAAc,GAAG;IAAE,OAAO,EAAE,MAAM,CAAA;CAAE,GAAG;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC;AAEpE;;;;GAIG;AAEH,wBAAgB,eAAe,CAAC,MAAM,EAAE,MAAM,GAAG,cAAc,EAAE,CAehE;AAED,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAEzD;AAED,qCAAqC;AACrC;;;GAGG;AAEH,eAAO,MAAM,0BAA0B;;;;;;;;;;;;EAK7B,CAAC;AAEX;;;;GAIG;AAEH,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAaxB,CAAC;AAEX,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAEnE;AAED,eAAO,MAAM,mBAAmB,EAAE,QAAQ,CAAC,MAAM,CAAC,YAAY,EAAE,MAAM,CAAC,CAItE,CAAC;AAEF,iDAAiD;AACjD,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAGjD;AAED;;;GAGG;AAEH,wBAAgB,yBAAyB,CACvC,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,SAAS,YAAY,EAAE,EAClC,KAAK,EAAE,SAAS,MAAM,EAAE,GACvB,MAAM,CAOR"}
|