kibi-cli 2.38.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-json-command.d.ts.map +1 -1
- package/dist/cli-json-command.js +4 -0
- package/dist/cli-register-foundation.js +2 -2
- package/dist/cli-register-reporting.d.ts.map +1 -1
- package/dist/cli-register-reporting.js +1 -0
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +3 -0
- package/dist/commands/check.d.ts.map +1 -1
- package/dist/commands/check.js +33 -9
- package/dist/commands/coverage.d.ts +1 -0
- package/dist/commands/coverage.d.ts.map +1 -1
- package/dist/commands/coverage.js +40 -0
- package/dist/commands/doctor.d.ts +5 -0
- package/dist/commands/doctor.d.ts.map +1 -1
- package/dist/commands/doctor.js +29 -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 +60 -8
- 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/persistence.d.ts.map +1 -1
- package/dist/commands/sync/persistence.js +6 -0
- 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/markdown.d.ts +6 -0
- package/dist/extractors/markdown.d.ts.map +1 -1
- package/dist/extractors/markdown.js +21 -0
- 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.d.ts.map +1 -1
- package/dist/operations/bootstrap/discovery-evidence.js +44 -2
- package/dist/operations/bootstrap/discovery.d.ts.map +1 -1
- package/dist/operations/bootstrap/discovery.js +1 -0
- 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 +76 -0
- package/dist/operations/proof/explain.d.ts.map +1 -1
- package/dist/operations/proof/explain.js +228 -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/operations/semantic-advisor/analyze-prose.d.ts +9 -1
- package/dist/operations/semantic-advisor/analyze-prose.d.ts.map +1 -1
- package/dist/operations/semantic-advisor/analyze-prose.js +21 -0
- package/dist/operations/semantic-advisor/case-preview.d.ts +24 -0
- package/dist/operations/semantic-advisor/case-preview.d.ts.map +1 -0
- package/dist/operations/semantic-advisor/case-preview.js +216 -0
- package/dist/operations/semantic-advisor/shared.d.ts.map +1 -1
- package/dist/operations/semantic-advisor/shared.js +3 -0
- package/dist/operations/semantic-advisor/types.d.ts +23 -0
- package/dist/operations/semantic-advisor/types.d.ts.map +1 -1
- package/dist/plugins/approved-source-analyzers.generated.d.ts +15 -34
- package/dist/plugins/approved-source-analyzers.generated.d.ts.map +1 -1
- package/dist/plugins/approved-source-analyzers.generated.js +15 -34
- 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 +2 -2
- package/dist/plugins/source-classification.d.ts.map +1 -1
- package/dist/plugins/source-classification.js +45 -1
- package/dist/public/operations/catalog.d.ts +62 -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/repair-plan.d.ts +46 -0
- package/dist/public/operations/repair-plan.d.ts.map +1 -1
- package/dist/public/operations/repair-plan.js +110 -1
- package/dist/public/operations/schema6-check-actions.js +1 -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 +3 -1
- package/dist/public/operations/specs/check.d.ts +1 -1
- package/dist/public/operations/specs/mutation-schemas.d.ts +61 -6
- package/dist/public/operations/specs/mutation-schemas.d.ts.map +1 -1
- package/dist/public/operations/specs/mutation-schemas.js +30 -0
- 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 +61 -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/schemas/entity.d.ts.map +1 -1
- package/dist/public/schemas/entity.js +59 -0
- package/dist/public/skills/kibi-commit-review/SKILL.md +6 -2
- package/dist/public/skills/kibi-decisions/SKILL.md +7 -2
- package/dist/public/skills/kibi-decisions/resources/signoff-views.md +3 -1
- package/dist/public/skills/kibi-usage/SKILL.md +14 -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 +126 -6
- package/dist/search-answer.d.ts +3 -2
- package/dist/search-answer.d.ts.map +1 -1
- package/dist/search-answer.js +56 -3
- 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/impact-knowledge.d.ts.map +1 -1
- package/dist/traceability/impact-knowledge.js +2 -0
- 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/temp-kb.d.ts.map +1 -1
- package/dist/traceability/temp-kb.js +11 -1
- package/dist/traceability/validate.d.ts.map +1 -1
- package/dist/traceability/validate.js +5 -7
- package/dist/types/entities.d.ts +12 -0
- package/dist/types/entities.d.ts.map +1 -1
- package/dist/usage-telemetry.d.ts +9 -0
- package/dist/usage-telemetry.d.ts.map +1 -1
- package/dist/usage-telemetry.js +50 -4
- 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 +11 -0
- package/dist/utils/rule-registry.generated.d.ts.map +1 -1
- package/dist/utils/rule-registry.generated.js +13 -0
- package/package.json +5 -5
- package/schema/entities.pl +12 -0
- package/src/public/operations/check-executor.ts +8 -0
- package/src/public/operations/evidence-floor.ts +29 -1
- package/src/public/operations/repair-plan.ts +152 -1
- package/src/public/operations/schema6-check-actions.ts +1 -1
- package/src/public/operations/specs/check-rules.generated.ts +3 -1
- package/src/public/operations/specs/mutation-schemas.ts +34 -0
- 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/schemas/entity.ts +65 -0
- package/src/public/skills/kibi-commit-review/SKILL.md +6 -2
- package/src/public/skills/kibi-decisions/SKILL.md +7 -2
- package/src/public/skills/kibi-decisions/resources/signoff-views.md +3 -1
- package/src/public/skills/kibi-usage/SKILL.md +14 -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 +126 -6
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { SYMBOL_EXTRACTOR_V2_CAPABILITY_ID } from "kibi-plugin-sdk";
|
|
2
|
+
import { APPROVED_SOURCE_ANALYZERS } from "./approved-source-analyzers.js";
|
|
3
|
+
import { verifyApprovedSourceAnalyzer } from "./maintenance-source-analysis.js";
|
|
4
|
+
import { readProjectKibiConfig } from "./project-config.js";
|
|
5
|
+
import { resolveProjectLocalPackage } from "./resolve-package.js";
|
|
6
|
+
/**
|
|
7
|
+
* Each plugin package.json#kibi.plugins declares must be installed in the
|
|
8
|
+
* workspace, and a release-qualified source analyzer must be the exact build
|
|
9
|
+
* this Kibi pins: otherwise every refresh drops symbol coordinates and every
|
|
10
|
+
* proof that needs the plugin is refused. Resolution reads package.json and
|
|
11
|
+
* hashes the pinned files; it never imports plugin code.
|
|
12
|
+
*/
|
|
13
|
+
// implements REQ-cli-doctor, REQ-capability-plugin-activation-disclosure-v1
|
|
14
|
+
export function pluginInstallProblems(workspaceRoot, packages) {
|
|
15
|
+
const problems = [];
|
|
16
|
+
for (const packageName of packages) {
|
|
17
|
+
let resolved;
|
|
18
|
+
try {
|
|
19
|
+
resolved = resolveProjectLocalPackage(workspaceRoot, packageName);
|
|
20
|
+
}
|
|
21
|
+
catch {
|
|
22
|
+
problems.push({
|
|
23
|
+
problem: `${packageName} is declared but not installed`,
|
|
24
|
+
fix: `Install the declared plugins (npm install in ${workspaceRoot}); until then kibi sync --refresh-symbol-coordinates drops the coordinates it places and proofs that need ${packageName} are refused.`,
|
|
25
|
+
});
|
|
26
|
+
continue;
|
|
27
|
+
}
|
|
28
|
+
const approval = APPROVED_SOURCE_ANALYZERS.find((item) => item.packageName === packageName);
|
|
29
|
+
if (approval === undefined)
|
|
30
|
+
continue;
|
|
31
|
+
try {
|
|
32
|
+
verifyApprovedSourceAnalyzer(resolved.packageRoot, approval);
|
|
33
|
+
}
|
|
34
|
+
catch (error) {
|
|
35
|
+
// Resolution already parsed the package.json; its version only names
|
|
36
|
+
// the build, since the hash check already failed.
|
|
37
|
+
const installed = typeof resolved.packageJson.version === "string"
|
|
38
|
+
? resolved.packageJson.version
|
|
39
|
+
: "unknown version";
|
|
40
|
+
const reason = error instanceof Error ? error.message : String(error);
|
|
41
|
+
problems.push({
|
|
42
|
+
problem: `installed ${packageName} ${installed} is not the release-qualified build this Kibi pins (${packageName} ${approval.version}: ${reason})`,
|
|
43
|
+
fix: `Remove node_modules/${packageName} and install the build qualified with this Kibi release (npm install --save-dev ${packageName}@${approval.version}); if the registry's ${approval.version} is another build, upgrade kibi-cli and ${packageName} together. Until then symbol refresh and proofs through ${packageName} fail.`,
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
return problems;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* The install problems of the plugins package.json#kibi.plugins activates
|
|
51
|
+
* for symbol extraction. An explicit coordinate refresh refuses on any of
|
|
52
|
+
* them rather than replacing every coordinate those plugins place.
|
|
53
|
+
*/
|
|
54
|
+
// implements REQ-symbol-coordinates-derived-locally
|
|
55
|
+
export function sourceAnalyzerInstallProblems(workspaceRoot) {
|
|
56
|
+
const packages = [
|
|
57
|
+
...new Set((readProjectKibiConfig(workspaceRoot).plugins ?? [])
|
|
58
|
+
.filter((entry) => entry.capabilities[SYMBOL_EXTRACTOR_V2_CAPABILITY_ID])
|
|
59
|
+
.map((entry) => entry.package)),
|
|
60
|
+
];
|
|
61
|
+
return pluginInstallProblems(workspaceRoot, packages);
|
|
62
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { type ReferenceExtractorV1 } from "kibi-plugin-sdk";
|
|
2
|
+
/** The plugin Kibi suggests for reading references of these languages. */
|
|
3
|
+
export declare const REFERENCE_PLUGIN_PACKAGE = "kibi-plugin-treesitter";
|
|
4
|
+
export type ProofReferenceExtractors = Readonly<{
|
|
5
|
+
extractors: readonly ReferenceExtractorV1[];
|
|
6
|
+
/** Why a configured provider was not used, for the refusal text. */
|
|
7
|
+
problems: readonly string[];
|
|
8
|
+
}>;
|
|
9
|
+
/**
|
|
10
|
+
* Load the reference extractors a proof may use: providers activated for
|
|
11
|
+
* kibi.reference-extractor.v1 whose installed bytes match a release-qualified
|
|
12
|
+
* closure. A proof is evidence, so an unqualified or modified provider is
|
|
13
|
+
* never imported; the read is refused instead and names the reason.
|
|
14
|
+
*/
|
|
15
|
+
export declare function loadProofReferenceExtractors(workspaceRoot: string): Promise<ProofReferenceExtractors>;
|
|
16
|
+
/** Replaceable loader, so tests can supply providers without installing a package. */
|
|
17
|
+
export declare const proofReferenceExtractorLoader: {
|
|
18
|
+
load: (workspaceRoot: string) => Promise<ProofReferenceExtractors>;
|
|
19
|
+
};
|
|
20
|
+
//# sourceMappingURL=proof-reference-extractors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"proof-reference-extractors.d.ts","sourceRoot":"","sources":["../../src/plugins/proof-reference-extractors.ts"],"names":[],"mappings":"AAoBA,OAAO,EAGL,KAAK,oBAAoB,EAC1B,MAAM,iBAAiB,CAAC;AAOzB,0EAA0E;AAC1E,eAAO,MAAM,wBAAwB,2BAA2B,CAAC;AAEjE,MAAM,MAAM,wBAAwB,GAAG,QAAQ,CAAC;IAC9C,UAAU,EAAE,SAAS,oBAAoB,EAAE,CAAC;IAC5C,oEAAoE;IACpE,QAAQ,EAAE,SAAS,MAAM,EAAE,CAAC;CAC7B,CAAC,CAAC;AAEH;;;;;GAKG;AAEH,wBAAsB,4BAA4B,CAChD,aAAa,EAAE,MAAM,GACpB,OAAO,CAAC,wBAAwB,CAAC,CA6CnC;AAYD,sFAAsF;AACtF,eAAO,MAAM,6BAA6B,EAAE;IAC1C,IAAI,EAAE,CAAC,aAAa,EAAE,MAAM,KAAK,OAAO,CAAC,wBAAwB,CAAC,CAAC;CA+BpE,CAAC"}
|
|
@@ -0,0 +1,104 @@
|
|
|
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 { statSync } from "node:fs";
|
|
19
|
+
import { join, relative } from "node:path";
|
|
20
|
+
import { REFERENCE_EXTRACTOR_CAPABILITY_ID, } from "kibi-plugin-sdk";
|
|
21
|
+
import { APPROVED_SOURCE_ANALYZERS } from "./approved-source-analyzers.js";
|
|
22
|
+
import { loadPluginPackage } from "./load-plugin.js";
|
|
23
|
+
import { verifyApprovedSourceAnalyzer } from "./maintenance-source-analysis.js";
|
|
24
|
+
import { readProjectKibiConfig } from "./project-config.js";
|
|
25
|
+
import { resolveProjectLocalPackage } from "./resolve-package.js";
|
|
26
|
+
/** The plugin Kibi suggests for reading references of these languages. */
|
|
27
|
+
export const REFERENCE_PLUGIN_PACKAGE = "kibi-plugin-treesitter";
|
|
28
|
+
/**
|
|
29
|
+
* Load the reference extractors a proof may use: providers activated for
|
|
30
|
+
* kibi.reference-extractor.v1 whose installed bytes match a release-qualified
|
|
31
|
+
* closure. A proof is evidence, so an unqualified or modified provider is
|
|
32
|
+
* never imported; the read is refused instead and names the reason.
|
|
33
|
+
*/
|
|
34
|
+
// implements REQ-kibi-tree-sitter-references
|
|
35
|
+
export async function loadProofReferenceExtractors(workspaceRoot) {
|
|
36
|
+
const problems = [];
|
|
37
|
+
let entries;
|
|
38
|
+
try {
|
|
39
|
+
entries = (readProjectKibiConfig(workspaceRoot).plugins ?? []).filter((entry) => entry.capabilities[REFERENCE_EXTRACTOR_CAPABILITY_ID]);
|
|
40
|
+
}
|
|
41
|
+
catch (error) {
|
|
42
|
+
return {
|
|
43
|
+
extractors: [],
|
|
44
|
+
problems: [error instanceof Error ? error.message : String(error)],
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
const extractors = [];
|
|
48
|
+
for (const entry of entries) {
|
|
49
|
+
try {
|
|
50
|
+
const approval = APPROVED_SOURCE_ANALYZERS.find((item) => item.packageName === entry.package);
|
|
51
|
+
if (!approval)
|
|
52
|
+
throw new Error(`${entry.package} is not a release-qualified reference reader`);
|
|
53
|
+
const resolved = resolveProjectLocalPackage(workspaceRoot, entry.package);
|
|
54
|
+
const entryRelative = relative(resolved.packageRoot, resolved.entryPath).replaceAll("\\", "/");
|
|
55
|
+
if (!approval.files[entryRelative])
|
|
56
|
+
throw new Error(`${entry.package}'s entrypoint is outside its qualified closure`);
|
|
57
|
+
verifyApprovedSourceAnalyzer(resolved.packageRoot, approval);
|
|
58
|
+
const loaded = await loadPluginPackage(workspaceRoot, entry.package);
|
|
59
|
+
const extractor = loaded.plugin.capabilities.referenceExtractor;
|
|
60
|
+
if (extractor === undefined)
|
|
61
|
+
throw new Error(`${entry.package} ${loaded.plugin.version} has no reference extractor`);
|
|
62
|
+
extractors.push(extractor);
|
|
63
|
+
}
|
|
64
|
+
catch (error) {
|
|
65
|
+
problems.push(error instanceof Error ? error.message : String(error));
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
return { extractors, problems };
|
|
69
|
+
}
|
|
70
|
+
const cache = new Map();
|
|
71
|
+
function mtimeOf(path) {
|
|
72
|
+
try {
|
|
73
|
+
return String(statSync(path).mtimeMs);
|
|
74
|
+
}
|
|
75
|
+
catch {
|
|
76
|
+
return "none";
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
/** Replaceable loader, so tests can supply providers without installing a package. */
|
|
80
|
+
export const proofReferenceExtractorLoader = {
|
|
81
|
+
load(workspaceRoot) {
|
|
82
|
+
// A changed package.json (a plugin activated) or an installed plugin
|
|
83
|
+
// whose manifest changed (installed, upgraded) loads afresh.
|
|
84
|
+
const key = [
|
|
85
|
+
workspaceRoot,
|
|
86
|
+
mtimeOf(join(workspaceRoot, "package.json")),
|
|
87
|
+
mtimeOf(join(workspaceRoot, "node_modules", REFERENCE_PLUGIN_PACKAGE, "package.json")),
|
|
88
|
+
].join("\0");
|
|
89
|
+
let loaded = cache.get(key);
|
|
90
|
+
if (loaded === undefined) {
|
|
91
|
+
loaded = loadProofReferenceExtractors(workspaceRoot);
|
|
92
|
+
cache.set(key, loaded);
|
|
93
|
+
// Only a load that found every provider is kept: a refusal is read
|
|
94
|
+
// again next time, so a fix is seen without restarting the host.
|
|
95
|
+
const pending = loaded;
|
|
96
|
+
void pending.then((result) => {
|
|
97
|
+
if (result.problems.length > 0 || result.extractors.length === 0)
|
|
98
|
+
if (cache.get(key) === pending)
|
|
99
|
+
cache.delete(key);
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
return loaded;
|
|
103
|
+
},
|
|
104
|
+
};
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { type ProjectKibiConfig } from "kibi-plugin-sdk";
|
|
2
|
+
export type ReferenceLanguageSuggestion = Readonly<{
|
|
3
|
+
package: string;
|
|
4
|
+
/** Capabilities to activate, each in augment mode; empty when all are active. */
|
|
5
|
+
capabilities: readonly string[];
|
|
6
|
+
languages: readonly Readonly<{
|
|
7
|
+
name: string;
|
|
8
|
+
files: number;
|
|
9
|
+
}>[];
|
|
10
|
+
evidence: readonly string[];
|
|
11
|
+
/** The project already lists the plugin, but not for proofs. */
|
|
12
|
+
activeForSymbolsOnly: boolean;
|
|
13
|
+
/** The plugin package is declared in package.json and resolves. */
|
|
14
|
+
pluginInstalled: boolean;
|
|
15
|
+
/** kibi-lang-* packs the tracked sources need that are not installed. */
|
|
16
|
+
packs: readonly string[];
|
|
17
|
+
/** Installed packs whose grammar bytes differ from the pinned SHA-256. */
|
|
18
|
+
modified: readonly string[];
|
|
19
|
+
}>;
|
|
20
|
+
/** Whether a package.json lists a package in any dependency field. */
|
|
21
|
+
export declare function manifestDeclares(manifest: unknown, packageName: string): boolean;
|
|
22
|
+
/** Whether a package resolves from the workspace root, and at which version. */
|
|
23
|
+
export type InstalledVersion = (packageName: string) => string | null;
|
|
24
|
+
/** The version of a package installed for the workspace, or null. */
|
|
25
|
+
export declare function workspaceInstalledVersion(workspaceRoot: string): InstalledVersion;
|
|
26
|
+
/** The pack versions the installed kibi-plugin-treesitter pins. */
|
|
27
|
+
export declare function pinnedPackVersions(workspaceRoot: string | undefined): ReadonlyMap<string, string>;
|
|
28
|
+
/**
|
|
29
|
+
* The installed kibi-lang-* packs, at the version the installed plugin pins,
|
|
30
|
+
* whose grammar file does not hash to the SHA-256 the plugin pins. Doctor
|
|
31
|
+
* names them so a changed grammar is not shown as healthy.
|
|
32
|
+
*/
|
|
33
|
+
export declare function modifiedPacks(workspaceRoot: string | undefined): ReadonlySet<string>;
|
|
34
|
+
/**
|
|
35
|
+
* Whether the project has sources kibi-plugin-treesitter must read for it:
|
|
36
|
+
* Go, Java, C# or Rust files whose references source proofs read only
|
|
37
|
+
* through the plugin while it is not activated for that, or files of a
|
|
38
|
+
* language whose kibi-lang-* pack is not installed (at the version the
|
|
39
|
+
* installed plugin pins) while the plugin is listed or being suggested.
|
|
40
|
+
* Reads file names and package manifests only; never imports a plugin.
|
|
41
|
+
*/
|
|
42
|
+
export declare function referenceLanguageSuggestion(files: readonly string[], config: ProjectKibiConfig, installedVersion?: InstalledVersion, pinned?: ReadonlyMap<string, string>, modified?: ReadonlySet<string>, pluginDeclared?: boolean): ReferenceLanguageSuggestion | null;
|
|
43
|
+
/** One line naming the languages and what to install or activate. */
|
|
44
|
+
export declare function describeReferenceLanguageSuggestion(suggestion: ReferenceLanguageSuggestion): string;
|
|
45
|
+
/**
|
|
46
|
+
* The suggestion for a workspace, from its tracked files, as one line for
|
|
47
|
+
* `kibi init` and `kibi doctor`, or null when nothing is missing. A project
|
|
48
|
+
* without a package.json is told to create a minimal one first.
|
|
49
|
+
*/
|
|
50
|
+
export declare function workspaceReferenceLanguageNote(workspaceRoot: string): string | null;
|
|
51
|
+
//# sourceMappingURL=reference-language-suggestion.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reference-language-suggestion.d.ts","sourceRoot":"","sources":["../../src/plugins/reference-language-suggestion.ts"],"names":[],"mappings":"AAuBA,OAAO,EACL,KAAK,iBAAiB,EAGvB,MAAM,iBAAiB,CAAC;AAWzB,MAAM,MAAM,2BAA2B,GAAG,QAAQ,CAAC;IACjD,OAAO,EAAE,MAAM,CAAC;IAChB,iFAAiF;IACjF,YAAY,EAAE,SAAS,MAAM,EAAE,CAAC;IAChC,SAAS,EAAE,SAAS,QAAQ,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC,EAAE,CAAC;IAChE,QAAQ,EAAE,SAAS,MAAM,EAAE,CAAC;IAC5B,gEAAgE;IAChE,oBAAoB,EAAE,OAAO,CAAC;IAC9B,mEAAmE;IACnE,eAAe,EAAE,OAAO,CAAC;IACzB,yEAAyE;IACzE,KAAK,EAAE,SAAS,MAAM,EAAE,CAAC;IACzB,0EAA0E;IAC1E,QAAQ,EAAE,SAAS,MAAM,EAAE,CAAC;CAC7B,CAAC,CAAC;AAEH,sEAAsE;AACtE,wBAAgB,gBAAgB,CAC9B,QAAQ,EAAE,OAAO,EACjB,WAAW,EAAE,MAAM,GAClB,OAAO,CAYT;AAED,gFAAgF;AAChF,MAAM,MAAM,gBAAgB,GAAG,CAAC,WAAW,EAAE,MAAM,KAAK,MAAM,GAAG,IAAI,CAAC;AAEtE,qEAAqE;AACrE,wBAAgB,yBAAyB,CACvC,aAAa,EAAE,MAAM,GACpB,gBAAgB,CAuBlB;AAED,mEAAmE;AACnE,wBAAgB,kBAAkB,CAChC,aAAa,EAAE,MAAM,GAAG,SAAS,GAChC,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,CAoB7B;AAED;;;;GAIG;AAEH,wBAAgB,aAAa,CAC3B,aAAa,EAAE,MAAM,GAAG,SAAS,GAChC,WAAW,CAAC,MAAM,CAAC,CAmDrB;AAED;;;;;;;GAOG;AAEH,wBAAgB,2BAA2B,CACzC,KAAK,EAAE,SAAS,MAAM,EAAE,EACxB,MAAM,EAAE,iBAAiB,EACzB,gBAAgB,GAAE,gBAA6B,EAC/C,MAAM,GAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAAa,EAC/C,QAAQ,GAAE,WAAW,CAAC,MAAM,CAAa,EACzC,cAAc,UAAO,GACpB,2BAA2B,GAAG,IAAI,CAoEpC;AAED,qEAAqE;AACrE,wBAAgB,mCAAmC,CACjD,UAAU,EAAE,2BAA2B,GACtC,MAAM,CAyCR;AAYD;;;;GAIG;AAEH,wBAAgB,8BAA8B,CAC5C,aAAa,EAAE,MAAM,GACpB,MAAM,GAAG,IAAI,CA0Cf"}
|
|
@@ -0,0 +1,277 @@
|
|
|
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 { execFileSync } from "node:child_process";
|
|
19
|
+
import { createHash } from "node:crypto";
|
|
20
|
+
import { existsSync, readFileSync } from "node:fs";
|
|
21
|
+
import { createRequire } from "node:module";
|
|
22
|
+
import { dirname, join } from "node:path";
|
|
23
|
+
import { REFERENCE_EXTRACTOR_CAPABILITY_ID, SYMBOL_EXTRACTOR_V2_CAPABILITY_ID, } from "kibi-plugin-sdk";
|
|
24
|
+
import { PLUGIN_LANGUAGE_PACKS, PLUGIN_REFERENCE_LANGUAGES, } from "../operations/proof/code-languages.js";
|
|
25
|
+
import { readProjectKibiConfig } from "./project-config.js";
|
|
26
|
+
import { REFERENCE_PLUGIN_PACKAGE } from "./proof-reference-extractors.js";
|
|
27
|
+
const NOT_PRODUCTION = /(?:^|\/)(?:node_modules|dist|build|target|bin|obj|vendor|coverage|tests?|__tests__|e2e|fixtures?)\/|^\.kb\/|(?:_test\.go|Tests?\.(?:java|cs)|\.(?:test|spec)\.[^/]+)$/i;
|
|
28
|
+
/** Whether a package.json lists a package in any dependency field. */
|
|
29
|
+
export function manifestDeclares(manifest, packageName) {
|
|
30
|
+
if (typeof manifest !== "object" || manifest === null)
|
|
31
|
+
return false;
|
|
32
|
+
return ["dependencies", "devDependencies", "optionalDependencies"].some((field) => {
|
|
33
|
+
const dependencies = manifest[field];
|
|
34
|
+
return (typeof dependencies === "object" &&
|
|
35
|
+
dependencies !== null &&
|
|
36
|
+
Object.hasOwn(dependencies, packageName));
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
/** The version of a package installed for the workspace, or null. */
|
|
40
|
+
export function workspaceInstalledVersion(workspaceRoot) {
|
|
41
|
+
const resolve = createRequire(join(workspaceRoot, "package.json")).resolve;
|
|
42
|
+
return (packageName) => {
|
|
43
|
+
// A package whose exports omit ./package.json (kibi-plugin-treesitter)
|
|
44
|
+
// is found through the node_modules lookup directories instead.
|
|
45
|
+
const manifests = [
|
|
46
|
+
() => resolve(`${packageName}/package.json`),
|
|
47
|
+
...(resolve.paths(packageName) ?? []).map((directory) => () => join(directory, packageName, "package.json")),
|
|
48
|
+
];
|
|
49
|
+
for (const manifestPath of manifests) {
|
|
50
|
+
try {
|
|
51
|
+
const manifest = JSON.parse(readFileSync(manifestPath(), "utf8"));
|
|
52
|
+
return typeof manifest.version === "string" ? manifest.version : null;
|
|
53
|
+
}
|
|
54
|
+
catch {
|
|
55
|
+
// Try the next lookup directory.
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
return null;
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
/** The pack versions the installed kibi-plugin-treesitter pins. */
|
|
62
|
+
export function pinnedPackVersions(workspaceRoot) {
|
|
63
|
+
if (workspaceRoot === undefined)
|
|
64
|
+
return new Map();
|
|
65
|
+
try {
|
|
66
|
+
const catalogPath = createRequire(join(workspaceRoot, "package.json")).resolve(`${REFERENCE_PLUGIN_PACKAGE}/catalog.json`);
|
|
67
|
+
const catalog = JSON.parse(readFileSync(catalogPath, "utf8"));
|
|
68
|
+
return new Map((catalog.languages ?? []).flatMap((language) => typeof language.pack === "string" &&
|
|
69
|
+
typeof language.packVersion === "string"
|
|
70
|
+
? [[language.pack, language.packVersion]]
|
|
71
|
+
: []));
|
|
72
|
+
}
|
|
73
|
+
catch {
|
|
74
|
+
return new Map();
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* The installed kibi-lang-* packs, at the version the installed plugin pins,
|
|
79
|
+
* whose grammar file does not hash to the SHA-256 the plugin pins. Doctor
|
|
80
|
+
* names them so a changed grammar is not shown as healthy.
|
|
81
|
+
*/
|
|
82
|
+
// implements REQ-kibi-tree-sitter-language-packs
|
|
83
|
+
export function modifiedPacks(workspaceRoot) {
|
|
84
|
+
if (workspaceRoot === undefined)
|
|
85
|
+
return new Set();
|
|
86
|
+
const resolve = createRequire(join(workspaceRoot, "package.json")).resolve;
|
|
87
|
+
let languages;
|
|
88
|
+
try {
|
|
89
|
+
languages =
|
|
90
|
+
JSON.parse(readFileSync(resolve(`${REFERENCE_PLUGIN_PACKAGE}/catalog.json`), "utf8")).languages ?? [];
|
|
91
|
+
}
|
|
92
|
+
catch {
|
|
93
|
+
return new Set();
|
|
94
|
+
}
|
|
95
|
+
const modified = new Set();
|
|
96
|
+
for (const language of languages) {
|
|
97
|
+
const { pack, packVersion, asset, assetSha256 } = language;
|
|
98
|
+
if (typeof pack !== "string" ||
|
|
99
|
+
typeof asset !== "string" ||
|
|
100
|
+
typeof assetSha256 !== "string")
|
|
101
|
+
continue;
|
|
102
|
+
let manifestPath;
|
|
103
|
+
try {
|
|
104
|
+
manifestPath = resolve(`${pack}/package.json`);
|
|
105
|
+
}
|
|
106
|
+
catch {
|
|
107
|
+
continue;
|
|
108
|
+
}
|
|
109
|
+
try {
|
|
110
|
+
const manifest = JSON.parse(readFileSync(manifestPath, "utf8"));
|
|
111
|
+
if (manifest.version !== packVersion)
|
|
112
|
+
continue;
|
|
113
|
+
const digest = createHash("sha256")
|
|
114
|
+
.update(readFileSync(join(dirname(manifestPath), asset)))
|
|
115
|
+
.digest("hex");
|
|
116
|
+
if (digest !== assetSha256)
|
|
117
|
+
modified.add(pack);
|
|
118
|
+
}
|
|
119
|
+
catch {
|
|
120
|
+
modified.add(pack);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
return modified;
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Whether the project has sources kibi-plugin-treesitter must read for it:
|
|
127
|
+
* Go, Java, C# or Rust files whose references source proofs read only
|
|
128
|
+
* through the plugin while it is not activated for that, or files of a
|
|
129
|
+
* language whose kibi-lang-* pack is not installed (at the version the
|
|
130
|
+
* installed plugin pins) while the plugin is listed or being suggested.
|
|
131
|
+
* Reads file names and package manifests only; never imports a plugin.
|
|
132
|
+
*/
|
|
133
|
+
// implements REQ-kibi-tree-sitter-references, REQ-kibi-tree-sitter-language-packs
|
|
134
|
+
export function referenceLanguageSuggestion(files, config, installedVersion = () => null, pinned = new Map(), modified = new Set(), pluginDeclared = true) {
|
|
135
|
+
const production = files.filter((file) => !NOT_PRODUCTION.test(file));
|
|
136
|
+
const references = PLUGIN_REFERENCE_LANGUAGES.map((language) => ({
|
|
137
|
+
name: language.name,
|
|
138
|
+
found: production.filter((file) => language.pattern.test(file)),
|
|
139
|
+
})).filter((language) => language.found.length > 0);
|
|
140
|
+
const entry = (config.plugins ?? []).find((plugin) => plugin.package === REFERENCE_PLUGIN_PACKAGE);
|
|
141
|
+
if ((config.declinedPlugins ?? []).includes(REFERENCE_PLUGIN_PACKAGE))
|
|
142
|
+
return null;
|
|
143
|
+
const activate = references.length > 0 &&
|
|
144
|
+
entry?.capabilities[REFERENCE_EXTRACTOR_CAPABILITY_ID] === undefined;
|
|
145
|
+
const packLanguages = PLUGIN_LANGUAGE_PACKS.map((language) => ({
|
|
146
|
+
...language,
|
|
147
|
+
found: production.filter((file) => language.pattern.test(file)),
|
|
148
|
+
})).filter((language) => language.found.length > 0);
|
|
149
|
+
// Without the plugin, any language it reads is a reason to suggest it for
|
|
150
|
+
// symbols. `.pl` alone is shared with Perl, so Prolog counts only with a
|
|
151
|
+
// `.plt` file or a `pack.pl`.
|
|
152
|
+
const confirmed = packLanguages.filter((language) => language.pack !== "kibi-lang-prolog" ||
|
|
153
|
+
language.found.some((file) => /(?:\.plt|(?:^|\/)pack\.pl)$/i.test(file)));
|
|
154
|
+
const symbolLanguages = confirmed;
|
|
155
|
+
const suggestSymbols = entry === undefined && symbolLanguages.length > 0;
|
|
156
|
+
if (entry === undefined && !activate && !suggestSymbols)
|
|
157
|
+
return null;
|
|
158
|
+
const missing = confirmed.filter((language) => {
|
|
159
|
+
const installed = installedVersion(language.pack);
|
|
160
|
+
const wanted = pinned.get(language.pack);
|
|
161
|
+
return (installed === null ||
|
|
162
|
+
(wanted !== undefined && installed !== wanted) ||
|
|
163
|
+
modified.has(language.pack));
|
|
164
|
+
});
|
|
165
|
+
if (!activate && !suggestSymbols && missing.length === 0)
|
|
166
|
+
return null;
|
|
167
|
+
const shown = activate
|
|
168
|
+
? references
|
|
169
|
+
: suggestSymbols
|
|
170
|
+
? symbolLanguages
|
|
171
|
+
: missing;
|
|
172
|
+
return {
|
|
173
|
+
package: REFERENCE_PLUGIN_PACKAGE,
|
|
174
|
+
capabilities: [
|
|
175
|
+
...(activate ? [REFERENCE_EXTRACTOR_CAPABILITY_ID] : []),
|
|
176
|
+
...(entry === undefined ? [SYMBOL_EXTRACTOR_V2_CAPABILITY_ID] : []),
|
|
177
|
+
],
|
|
178
|
+
languages: shown.map((language) => ({
|
|
179
|
+
name: language.name,
|
|
180
|
+
files: language.found.length,
|
|
181
|
+
})),
|
|
182
|
+
evidence: shown.flatMap((language) => language.found).slice(0, 5),
|
|
183
|
+
activeForSymbolsOnly: entry !== undefined,
|
|
184
|
+
pluginInstalled: pluginDeclared && installedVersion(REFERENCE_PLUGIN_PACKAGE) !== null,
|
|
185
|
+
packs: missing.map((language) => {
|
|
186
|
+
const version = pinned.get(language.pack);
|
|
187
|
+
return version === undefined
|
|
188
|
+
? language.pack
|
|
189
|
+
: `${language.pack}@${version}`;
|
|
190
|
+
}),
|
|
191
|
+
modified: missing
|
|
192
|
+
.filter((language) => modified.has(language.pack))
|
|
193
|
+
.map((language) => language.pack),
|
|
194
|
+
};
|
|
195
|
+
}
|
|
196
|
+
/** One line naming the languages and what to install or activate. */
|
|
197
|
+
export function describeReferenceLanguageSuggestion(suggestion) {
|
|
198
|
+
const found = suggestion.languages
|
|
199
|
+
.map((language) => `${language.files} ${language.name}`)
|
|
200
|
+
.join(", ");
|
|
201
|
+
const activation = suggestion.capabilities
|
|
202
|
+
.map((capability) => `"${capability}": { "mode": "augment" }`)
|
|
203
|
+
.join(", ");
|
|
204
|
+
const packs = suggestion.packs.length === 0
|
|
205
|
+
? ""
|
|
206
|
+
: ` and the grammar pack(s) ${suggestion.packs.join(", ")}`;
|
|
207
|
+
if (suggestion.capabilities.length === 0)
|
|
208
|
+
return `${found} source file(s); ${suggestion.package} reads them only with${packs.slice(4)} installed: npm install --save-dev ${suggestion.packs.join(" ")}`;
|
|
209
|
+
if (suggestion.activeForSymbolsOnly)
|
|
210
|
+
return `${found} source file(s); ${suggestion.package} is active for symbols but not for source proofs: add ${activation} to its package.json kibi.plugins entry${packs === "" ? "" : `, and install${packs.slice(4)}`}`;
|
|
211
|
+
const what = suggestion.capabilities.includes(REFERENCE_EXTRACTOR_CAPABILITY_ID)
|
|
212
|
+
? "source proofs and symbols"
|
|
213
|
+
: "symbols";
|
|
214
|
+
const entry = JSON.stringify({
|
|
215
|
+
package: suggestion.package,
|
|
216
|
+
capabilities: Object.fromEntries(suggestion.capabilities.map((capability) => [
|
|
217
|
+
capability,
|
|
218
|
+
{ mode: "augment" },
|
|
219
|
+
])),
|
|
220
|
+
});
|
|
221
|
+
const activate = `add this entry to package.json "kibi": { "plugins": [ ${entry} ] }`;
|
|
222
|
+
// An installed plugin only lacks its kibi.plugins entry.
|
|
223
|
+
const install = [
|
|
224
|
+
...(suggestion.pluginInstalled ? [] : [suggestion.package]),
|
|
225
|
+
...suggestion.packs,
|
|
226
|
+
];
|
|
227
|
+
const needs = suggestion.pluginInstalled
|
|
228
|
+
? `${suggestion.package}, which is installed but not activated${packs === "" ? "" : `,${packs}`}`
|
|
229
|
+
: `${suggestion.package}${packs}`;
|
|
230
|
+
return install.length === 0
|
|
231
|
+
? `${found} source file(s); ${what} for them need ${needs}: ${activate}`
|
|
232
|
+
: `${found} source file(s); ${what} for them need ${needs}: npm install --save-dev ${install.join(" ")}, then ${activate}`;
|
|
233
|
+
}
|
|
234
|
+
function readManifestOrNull(workspaceRoot) {
|
|
235
|
+
try {
|
|
236
|
+
return JSON.parse(readFileSync(join(workspaceRoot, "package.json"), "utf8"));
|
|
237
|
+
}
|
|
238
|
+
catch {
|
|
239
|
+
return null;
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
/**
|
|
243
|
+
* The suggestion for a workspace, from its tracked files, as one line for
|
|
244
|
+
* `kibi init` and `kibi doctor`, or null when nothing is missing. A project
|
|
245
|
+
* without a package.json is told to create a minimal one first.
|
|
246
|
+
*/
|
|
247
|
+
// implements REQ-kibi-tree-sitter-references, REQ-kibi-tree-sitter-language-packs
|
|
248
|
+
export function workspaceReferenceLanguageNote(workspaceRoot) {
|
|
249
|
+
let files;
|
|
250
|
+
let config;
|
|
251
|
+
try {
|
|
252
|
+
files = execFileSync("git", ["ls-files", "-z"], {
|
|
253
|
+
cwd: workspaceRoot,
|
|
254
|
+
encoding: "utf8",
|
|
255
|
+
stdio: ["ignore", "pipe", "ignore"],
|
|
256
|
+
maxBuffer: 64 * 1024 * 1024,
|
|
257
|
+
})
|
|
258
|
+
.split("\0")
|
|
259
|
+
.filter((file) => file.length > 0);
|
|
260
|
+
config = readProjectKibiConfig(workspaceRoot);
|
|
261
|
+
}
|
|
262
|
+
catch {
|
|
263
|
+
return null;
|
|
264
|
+
}
|
|
265
|
+
const suggestion = referenceLanguageSuggestion(files, config, workspaceInstalledVersion(workspaceRoot), pinnedPackVersions(workspaceRoot), modifiedPacks(workspaceRoot), manifestDeclares(readManifestOrNull(workspaceRoot), REFERENCE_PLUGIN_PACKAGE));
|
|
266
|
+
if (suggestion === null)
|
|
267
|
+
return null;
|
|
268
|
+
const noManifest = !existsSync(join(workspaceRoot, "package.json"));
|
|
269
|
+
const changed = suggestion.modified.length === 0
|
|
270
|
+
? ""
|
|
271
|
+
: ` The installed grammar of ${suggestion.modified.join(", ")} does not match the SHA-256 ${suggestion.package} pins; reinstall it.`;
|
|
272
|
+
return `${describeReferenceLanguageSuggestion(suggestion)}.${changed}${noManifest
|
|
273
|
+
? " This project has no package.json: run npm init -y first to create a minimal one (Kibi reads only its devDependencies and kibi.plugins), then run the install and add the kibi.plugins entry above, and add node_modules/ to .gitignore."
|
|
274
|
+
: ""} ${suggestion.capabilities.includes(REFERENCE_EXTRACTOR_CAPABILITY_ID)
|
|
275
|
+
? "Without it, references proofs on those files are refused."
|
|
276
|
+
: "Until then, symbols in those files are placed by text match and are approximate."}`;
|
|
277
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../src/plugins/registry.ts"],"names":[],"mappings":"AAkBA,OAAO,EAGL,KAAK,YAAY,EAGjB,KAAK,YAAY,EAEjB,KAAK,cAAc,EACnB,KAAK,UAAU,EACf,KAAK,iBAAiB,EACtB,KAAK,mBAAmB,EACxB,KAAK,iBAAiB,
|
|
1
|
+
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../src/plugins/registry.ts"],"names":[],"mappings":"AAkBA,OAAO,EAGL,KAAK,YAAY,EAGjB,KAAK,YAAY,EAEjB,KAAK,cAAc,EACnB,KAAK,UAAU,EACf,KAAK,iBAAiB,EACtB,KAAK,mBAAmB,EACxB,KAAK,iBAAiB,EAQtB,KAAK,aAAa,EAClB,KAAK,oBAAoB,EACzB,KAAK,iBAAiB,EACtB,KAAK,iBAAiB,EAEtB,KAAK,qBAAqB,EAG3B,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EAAE,KAAK,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAK7E,MAAM,MAAM,oBAAoB,GAAG,MAAM,YAAY,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC;AAG9E,MAAM,MAAM,yBAAyB,CAAC,CAAC,IAAI,QAAQ,CAAC;IAClD,QAAQ,EAAE,MAAM,CAAC;IACjB,aAAa,EAAE,MAAM,CAAC;IACtB,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,IAAI,EAAE,UAAU,GAAG,SAAS,CAAC;IAC7B,WAAW,EAAE,iBAAiB,CAAC;IAC/B,QAAQ,EAAE,OAAO,CAAC;IAClB,UAAU,EAAE,CAAC,CAAC;IACd,KAAK,EAAE,mBAAmB,CAAC;CAC5B,CAAC,CAAC;AAGH,MAAM,MAAM,wBAAwB,CAAC,CAAC,IAAI,QAAQ,CAAC;IACjD,OAAO,EAAE,yBAAyB,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AM,EAAE,QAAQ,EAAE,kBAAkB,GAAG,IAAI;IAI9D,KAAK,IAAI,IAAI;CAGd;AAGD,wBAAgB,wBAAwB,CACtC,OAAO,EAAE,yBAAyB,GACjC,kBAAkB,CAEpB;AAGD,wBAAgB,6BAA6B,IAAI,uBAAuB,CAEvE;AAGD,MAAM,MAAM,+BAA+B,GAAG,yBAAyB,GAAG;IACxE,QAAQ,CAAC,KAAK,CAAC,EAAE,uBAAuB,CAAC;CAC1C,CAAC;AAEF;;;GAGG;AAEH,wBAAgB,wBAAwB,CACtC,sBAAsB,EAAE,MAAM,GAAG,+BAA+B,EAChE,OAAO,CAAC,EAAE,IAAI,CAAC,yBAAyB,EAAE,eAAe,CAAC,GAAG;IAC3D,QAAQ,CAAC,KAAK,CAAC,EAAE,uBAAuB,CAAC;CAC1C,GACA,kBAAkB,CAoBpB"}
|
package/dist/plugins/registry.js
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
You should have received a copy of the GNU Affero General Public License
|
|
16
16
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
17
17
|
*/
|
|
18
|
-
import { CHECK_POLICY_CAPABILITY_ID, CHECK_POLICY_CONTRACT_VERSION, KIBI_PLUGIN_API_VERSION, ONTOLOGY_PACK_CAPABILITY_ID, SEARCH_HINTS_CAPABILITY_ID, SEMANTIC_CLASSIFIER_CAPABILITY_ID, SYMBOL_EXTRACTOR_CAPABILITY_ID, SYMBOL_EXTRACTOR_V2_CAPABILITY_ID, VOCABULARY_ALIGNMENT_CAPABILITY_ID, defineKibiPlugin, validateKibiPlugin, } from "kibi-plugin-sdk";
|
|
18
|
+
import { CHECK_POLICY_CAPABILITY_ID, CHECK_POLICY_CONTRACT_VERSION, KIBI_PLUGIN_API_VERSION, ONTOLOGY_PACK_CAPABILITY_ID, REFERENCE_EXTRACTOR_CAPABILITY_ID, SEARCH_HINTS_CAPABILITY_ID, SEMANTIC_CLASSIFIER_CAPABILITY_ID, SYMBOL_EXTRACTOR_CAPABILITY_ID, SYMBOL_EXTRACTOR_V2_CAPABILITY_ID, VOCABULARY_ALIGNMENT_CAPABILITY_ID, defineKibiPlugin, validateKibiPlugin, } from "kibi-plugin-sdk";
|
|
19
19
|
import { loadPluginPackage } from "./load-plugin.js";
|
|
20
20
|
import { readProjectKibiConfig } from "./project-config.js";
|
|
21
21
|
import { PluginResolutionError } from "./resolve-package.js";
|
|
@@ -27,6 +27,8 @@ const CAPABILITY_SLOT = {
|
|
|
27
27
|
[VOCABULARY_ALIGNMENT_CAPABILITY_ID]: "vocabularyAlignment",
|
|
28
28
|
[CHECK_POLICY_CAPABILITY_ID]: "checkPolicy",
|
|
29
29
|
[SEARCH_HINTS_CAPABILITY_ID]: "searchHints",
|
|
30
|
+
// Read only by source proofs, through the qualified loader.
|
|
31
|
+
[REFERENCE_EXTRACTOR_CAPABILITY_ID]: "referenceExtractor",
|
|
30
32
|
};
|
|
31
33
|
/**
|
|
32
34
|
* Search hints have no builtin answer: without a configured provider there
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"source-analysis-service.d.ts","sourceRoot":"","sources":["../../src/plugins/source-analysis-service.ts"],"names":[],"mappings":"AAoBA,OAAO,EACL,KAAK,mBAAmB,EAGxB,KAAK,oBAAoB,EACzB,KAAK,sBAAsB,EAC3B,KAAK,iBAAiB,EACtB,KAAK,iBAAiB,EAKvB,MAAM,iBAAiB,CAAC;AAEzB,OAAO,KAAK,EACV,wBAAwB,EACxB,kBAAkB,EACnB,MAAM,eAAe,CAAC;AAIvB,MAAM,MAAM,kCAAkC,GAAG,QAAQ,CAAC;IACxD,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,mBAAmB,CAAC;IAC3B,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,EAAE,EAAE,OAAO,CAAC;IACZ,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC,CAAC;AAGH,MAAM,MAAM,wBAAwB,GA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E,MAAM,GAAG,IAAI,CAAC;IACnC,iBAAiB,EAAE,SAAS,kCAAkC,EAAE,CAAC;CAClE,CAAC,CAAC"}
|
|
@@ -159,6 +159,10 @@ export class SourceAnalysisService {
|
|
|
159
159
|
async analyzeTextV2(filePath, content, explicitLanguageHint) {
|
|
160
160
|
const request = createV2Request(filePath, content, explicitLanguageHint);
|
|
161
161
|
const { classification } = request;
|
|
162
|
+
// Kibi's own knowledge-base files (its Prolog schema included) are not
|
|
163
|
+
// project source, so they never ask for a grammar pack.
|
|
164
|
+
if (/^(?:\.\/)?\.kb\//.test(filePath.replaceAll("\\", "/")))
|
|
165
|
+
return request.fallback("unsupported", "kibi_knowledge_base_file", "Kibi's own knowledge-base files are not analyzed as project source.");
|
|
162
166
|
if (content.length > SOURCE_ANALYSIS_V2_MAX_INPUT_CODE_UNITS ||
|
|
163
167
|
Buffer.byteLength(content, "utf8") > 8 * 1024 * 1024)
|
|
164
168
|
return request.fallback("failed", "input_limit", `Source input exceeds the ${SOURCE_ANALYSIS_V2_MAX_INPUT_CODE_UNITS} UTF-16 code unit or 8 MiB UTF-8 analysis limit`);
|
|
@@ -10,6 +10,31 @@ export interface SourceChangeAnalysis {
|
|
|
10
10
|
export declare function analyzeSourceChanges(inventory: readonly StagedPath[], service: SourceAnalysisService): Promise<Map<string, SourceChangeAnalysis>>;
|
|
11
11
|
/** Adapt a host result to the shared analysis gate. */
|
|
12
12
|
export declare function gateAnalysis(result: HostSourceAnalysisResultV2 | null): GateAnalysis<HostSourceAnalysisResultV2["uncoveredRanges"][number]> | null;
|
|
13
|
-
/**
|
|
13
|
+
/** Staged lines of a partially analyzed file that need a file-level review. */
|
|
14
|
+
export interface PartialAnalysisReview {
|
|
15
|
+
path: string;
|
|
16
|
+
/** Staged lines inside the gaps and outside every placed declaration. */
|
|
17
|
+
lines: {
|
|
18
|
+
startLine: number;
|
|
19
|
+
endLine: number;
|
|
20
|
+
}[];
|
|
21
|
+
ranges: {
|
|
22
|
+
startLine: number;
|
|
23
|
+
endLine: number;
|
|
24
|
+
reason: string;
|
|
25
|
+
}[];
|
|
26
|
+
detail: string;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* The after-side gaps a staged change touches outside every declaration the
|
|
30
|
+
* analyzer placed. A changed line inside a placed declaration is validated
|
|
31
|
+
* against that symbol instead.
|
|
32
|
+
*/
|
|
33
|
+
export declare function partialAnalysisReviews(inventory: readonly StagedPath[], analyses: ReadonlyMap<string, SourceChangeAnalysis>): PartialAnalysisReview[];
|
|
34
|
+
/**
|
|
35
|
+
* Enforce the shared analysis gate when no impact policy accepts reviews:
|
|
36
|
+
* failed analysis and non-local gaps block; a local gap is left to
|
|
37
|
+
* {@link partialAnalysisReviews}.
|
|
38
|
+
*/
|
|
14
39
|
export declare function assertSourceAnalysisGate(inventory: readonly StagedPath[], analyses: ReadonlyMap<string, SourceChangeAnalysis>): void;
|
|
15
40
|
//# sourceMappingURL=source-change-analysis.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"source-change-analysis.d.ts","sourceRoot":"","sources":["../../src/plugins/source-change-analysis.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,YAAY,EAElB,MAAM,kCAAkC,CAAC;AAC1C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;
|
|
1
|
+
{"version":3,"file":"source-change-analysis.d.ts","sourceRoot":"","sources":["../../src/plugins/source-change-analysis.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,YAAY,EAElB,MAAM,kCAAkC,CAAC;AAC1C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAEhE,OAAO,KAAK,EACV,0BAA0B,EAC1B,qBAAqB,EACtB,MAAM,8BAA8B,CAAC;AAGtC,MAAM,WAAW,oBAAoB;IACnC,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,0BAA0B,GAAG,IAAI,CAAC;IAC1C,KAAK,EAAE,0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