kibi-cli 2.0.0 → 2.1.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-proof.d.ts.map +1 -1
- package/dist/cli-register-proof.js +25 -1
- package/dist/cli-register-reporting.d.ts.map +1 -1
- package/dist/cli-register-reporting.js +6 -0
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +2 -0
- package/dist/commands/check-generated.d.ts +7 -0
- package/dist/commands/check-generated.d.ts.map +1 -0
- package/dist/commands/check-generated.js +192 -0
- package/dist/commands/check.d.ts.map +1 -1
- package/dist/commands/check.js +3 -2
- package/dist/commands/doctor.d.ts.map +1 -1
- package/dist/commands/doctor.js +122 -1
- package/dist/commands/engine.d.ts.map +1 -1
- package/dist/commands/engine.js +3 -1
- package/dist/commands/init-helpers.d.ts.map +1 -1
- package/dist/commands/init-helpers.js +13 -7
- package/dist/commands/proof-explain.d.ts +10 -0
- package/dist/commands/proof-explain.d.ts.map +1 -0
- package/dist/commands/proof-explain.js +45 -0
- package/dist/commands/proof-impact.d.ts +7 -0
- package/dist/commands/proof-impact.d.ts.map +1 -0
- package/dist/commands/proof-impact.js +39 -0
- package/dist/commands/proof-migrate-legacy.js +1 -1
- package/dist/commands/proof-prune.js +1 -1
- package/dist/commands/prove.js +4 -4
- package/dist/commands/report.d.ts.map +1 -1
- package/dist/commands/report.js +17 -2
- package/dist/commands/sync/manifest.d.ts +1 -0
- package/dist/commands/sync/manifest.d.ts.map +1 -1
- package/dist/commands/sync/manifest.js +18 -16
- package/dist/commands/sync/persistence.d.ts.map +1 -1
- package/dist/commands/sync/persistence.js +6 -0
- package/dist/engine.d.ts +3 -1
- package/dist/engine.d.ts.map +1 -1
- package/dist/engine.js +134 -61
- package/dist/env/bootstrap.d.ts +84 -0
- package/dist/env/bootstrap.d.ts.map +1 -0
- package/dist/env/bootstrap.js +310 -0
- package/dist/extractors/manifest.d.ts.map +1 -1
- package/dist/extractors/manifest.js +1 -1
- package/dist/extractors/markdown.d.ts +2 -0
- package/dist/extractors/markdown.d.ts.map +1 -1
- package/dist/extractors/markdown.js +19 -0
- package/dist/extractors/symbols-coordinator.d.ts +8 -0
- package/dist/extractors/symbols-coordinator.d.ts.map +1 -1
- package/dist/extractors/symbols-coordinator.js +40 -0
- package/dist/extractors/symbols-ts.d.ts +8 -19
- package/dist/extractors/symbols-ts.d.ts.map +1 -1
- package/dist/extractors/symbols-ts.js +33 -503
- package/dist/intent-search.d.ts.map +1 -1
- package/dist/intent-search.js +4 -5
- package/dist/operations/modeling/model-requirement.d.ts.map +1 -1
- package/dist/operations/modeling/model-requirement.js +4 -0
- package/dist/operations/modeling/suggest-predicates.d.ts +1 -1
- package/dist/operations/modeling/suggest-predicates.d.ts.map +1 -1
- package/dist/operations/modeling/suggest-predicates.js +30 -3
- package/dist/operations/mutation/symbol-granularity.d.ts.map +1 -1
- package/dist/operations/mutation/symbol-granularity.js +9 -87
- package/dist/operations/planning/compile-intent.d.ts +49 -0
- package/dist/operations/planning/compile-intent.d.ts.map +1 -1
- package/dist/operations/planning/compile-intent.js +63 -3
- package/dist/operations/proof/baseline-diff.d.ts +41 -0
- package/dist/operations/proof/baseline-diff.d.ts.map +1 -0
- package/dist/operations/proof/baseline-diff.js +153 -0
- package/dist/operations/proof/explain.d.ts +75 -0
- package/dist/operations/proof/explain.d.ts.map +1 -0
- package/dist/operations/proof/explain.js +294 -0
- package/dist/operations/proof/impact.d.ts +45 -0
- package/dist/operations/proof/impact.d.ts.map +1 -0
- package/dist/operations/proof/impact.js +118 -0
- package/dist/operations/proof/ingest-proof.d.ts.map +1 -1
- package/dist/operations/proof/ingest-proof.js +44 -3
- package/dist/operations/proof/migrate-legacy-receipts.d.ts.map +1 -1
- package/dist/operations/proof/migrate-legacy-receipts.js +21 -17
- package/dist/operations/proof/prune-receipts.js +1 -1
- package/dist/operations/proof/receipt-document.js +2 -2
- package/dist/operations/semantic-advisor/analysis-receipt.d.ts.map +1 -1
- package/dist/operations/semantic-advisor/analysis-receipt.js +3 -9
- package/dist/operations/semantic-advisor/analyze-prose.d.ts.map +1 -1
- package/dist/operations/semantic-advisor/analyze-prose.js +18 -67
- package/dist/operations/semantic-advisor/plugin-orchestration.d.ts +63 -0
- package/dist/operations/semantic-advisor/plugin-orchestration.d.ts.map +1 -0
- package/dist/operations/semantic-advisor/plugin-orchestration.js +489 -0
- package/dist/operations/semantic-advisor/predicate-rules-core.d.ts +15 -2
- package/dist/operations/semantic-advisor/predicate-rules-core.d.ts.map +1 -1
- package/dist/operations/semantic-advisor/predicate-rules-core.js +7 -140
- package/dist/operations/semantic-advisor/predicate-rules-launcher.d.ts +11 -12
- package/dist/operations/semantic-advisor/predicate-rules-launcher.d.ts.map +1 -1
- package/dist/operations/semantic-advisor/predicate-rules-launcher.js +6 -94
- package/dist/operations/semantic-advisor/predicate-rules-policy.d.ts +16 -0
- package/dist/operations/semantic-advisor/predicate-rules-policy.d.ts.map +1 -1
- package/dist/operations/semantic-advisor/predicate-rules-policy.js +7 -150
- package/dist/operations/semantic-advisor/predicate-rules-product-tail.d.ts +9 -0
- package/dist/operations/semantic-advisor/predicate-rules-product-tail.d.ts.map +1 -1
- package/dist/operations/semantic-advisor/predicate-rules-product-tail.js +7 -102
- package/dist/operations/semantic-advisor/predicate-rules-product.d.ts +13 -0
- package/dist/operations/semantic-advisor/predicate-rules-product.d.ts.map +1 -1
- package/dist/operations/semantic-advisor/predicate-rules-product.js +7 -133
- package/dist/operations/semantic-advisor/types.d.ts +1 -0
- package/dist/operations/semantic-advisor/types.d.ts.map +1 -1
- package/dist/plugins/compose-ontology-packs.d.ts +51 -0
- package/dist/plugins/compose-ontology-packs.d.ts.map +1 -0
- package/dist/plugins/compose-ontology-packs.js +257 -0
- package/dist/plugins/compose-semantic-classifier.d.ts +42 -0
- package/dist/plugins/compose-semantic-classifier.d.ts.map +1 -0
- package/dist/plugins/compose-semantic-classifier.js +211 -0
- package/dist/plugins/external-allowlist.d.ts +10 -0
- package/dist/plugins/external-allowlist.d.ts.map +1 -0
- package/dist/plugins/external-allowlist.js +16 -0
- package/dist/plugins/index.d.ts +9 -0
- package/dist/plugins/index.d.ts.map +1 -0
- package/dist/plugins/index.js +33 -0
- package/dist/plugins/load-plugin.d.ts +19 -0
- package/dist/plugins/load-plugin.d.ts.map +1 -0
- package/dist/plugins/load-plugin.js +59 -0
- package/dist/plugins/project-config.d.ts +28 -0
- package/dist/plugins/project-config.d.ts.map +1 -0
- package/dist/plugins/project-config.js +90 -0
- package/dist/plugins/registry.d.ts +93 -0
- package/dist/plugins/registry.d.ts.map +1 -0
- package/dist/plugins/registry.js +338 -0
- package/dist/plugins/resolve-package.d.ts +47 -0
- package/dist/plugins/resolve-package.d.ts.map +1 -0
- package/dist/plugins/resolve-package.js +262 -0
- package/dist/plugins/source-analysis-service.d.ts +44 -0
- package/dist/plugins/source-analysis-service.d.ts.map +1 -0
- package/dist/plugins/source-analysis-service.js +232 -0
- package/dist/prolog/janitor.d.ts.map +1 -1
- package/dist/prolog/janitor.js +1 -1
- package/dist/prolog/store-lock.d.ts +1 -1
- package/dist/prolog/store-lock.d.ts.map +1 -1
- package/dist/proof/inspect.js +1 -1
- package/dist/proof/producers/playwright-case-id.js +2 -2
- package/dist/proof/producers/playwright-reporter.js +4 -4
- package/dist/public/extractors/symbols-coordinator.d.ts +1 -1
- package/dist/public/extractors/symbols-coordinator.d.ts.map +1 -1
- package/dist/public/extractors/symbols-coordinator.js +1 -1
- package/dist/public/impact/analyzer.d.ts +1 -1
- package/dist/public/impact/analyzer.d.ts.map +1 -1
- package/dist/public/impact/analyzer.js +6 -4
- package/dist/public/operations/catalog.d.ts +4 -1
- package/dist/public/operations/catalog.d.ts.map +1 -1
- package/dist/public/operations/check-executor.js +1 -1
- package/dist/public/operations/check-helpers.d.ts +1 -1
- package/dist/public/operations/check-helpers.d.ts.map +1 -1
- package/dist/public/operations/check-helpers.js +1 -1
- package/dist/public/operations/contracts.d.ts.map +1 -1
- package/dist/public/operations/contracts.js +35 -12
- package/dist/public/operations/discovery-entities.d.ts +12 -0
- package/dist/public/operations/discovery-entities.d.ts.map +1 -1
- package/dist/public/operations/discovery-entities.js +34 -0
- package/dist/public/operations/discovery-executors.d.ts.map +1 -1
- package/dist/public/operations/discovery-executors.js +23 -18
- package/dist/public/operations/prolog-json.d.ts +1 -1
- package/dist/public/operations/prolog-json.d.ts.map +1 -1
- package/dist/public/operations/prolog-json.js +7 -7
- package/dist/public/operations/runtime-types.d.ts +16 -1
- package/dist/public/operations/runtime-types.d.ts.map +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 +2 -1
- package/dist/public/operations/specs/check.d.ts +1 -1
- package/dist/public/operations/specs/discovery.d.ts +3 -0
- package/dist/public/operations/specs/discovery.d.ts.map +1 -1
- package/dist/public/operations/specs/discovery.js +3 -0
- package/dist/public/operations/specs/proof.js +1 -1
- package/dist/public/operations/specs/reporting.d.ts +1 -0
- package/dist/public/operations/specs/reporting.d.ts.map +1 -1
- package/dist/public/operations/specs/reporting.js +2 -2
- package/dist/public/operations/specs/semantic.d.ts +1 -1
- package/dist/public/operations/specs/semantic.d.ts.map +1 -1
- package/dist/public/operations/specs/semantic.js +54 -4
- package/dist/public/operations/symbol-repair-plan.d.ts.map +1 -1
- package/dist/public/operations/symbol-repair-plan.js +3 -1
- package/dist/public/operations/types.d.ts +5 -0
- package/dist/public/operations/types.d.ts.map +1 -1
- package/dist/public/proof-protocol.js +4 -4
- package/dist/public/skills/kibi-usage/SKILL.md +4 -1
- package/dist/public/skills/kibi-usage/resources/proof.md +45 -0
- package/dist/public/symbol-granularity.d.ts +1 -1
- package/dist/public/symbol-granularity.d.ts.map +1 -1
- package/dist/public/symbol-granularity.generated.d.ts.map +1 -1
- package/dist/public/symbol-granularity.generated.js +38 -5
- package/dist/report/html-report.css +1239 -281
- package/dist/runtime/cli-runtime.d.ts.map +1 -1
- package/dist/runtime/cli-runtime.js +18 -0
- package/dist/traceability/symbol-extract.d.ts +24 -7
- package/dist/traceability/symbol-extract.d.ts.map +1 -1
- package/dist/traceability/symbol-extract.js +64 -208
- package/dist/utils/rule-registry.generated.d.ts +5 -0
- package/dist/utils/rule-registry.generated.d.ts.map +1 -1
- package/dist/utils/rule-registry.generated.js +6 -0
- package/package.json +14 -11
- package/src/public/extractors/symbols-coordinator.ts +1 -0
- package/src/public/impact/analyzer.ts +15 -12
- package/src/public/operations/check-executor.ts +1 -1
- package/src/public/operations/check-helpers.ts +2 -2
- package/src/public/operations/contracts.ts +40 -12
- package/src/public/operations/discovery-entities.ts +46 -0
- package/src/public/operations/discovery-executors.ts +39 -26
- package/src/public/operations/prolog-json.ts +13 -5
- package/src/public/operations/runtime-types.ts +21 -2
- package/src/public/operations/specs/check-rules.generated.ts +2 -1
- package/src/public/operations/specs/discovery.ts +3 -0
- package/src/public/operations/specs/proof.ts +1 -1
- package/src/public/operations/specs/reporting.ts +2 -2
- package/src/public/operations/specs/semantic.ts +79 -17
- package/src/public/operations/symbol-repair-plan.ts +3 -4
- package/src/public/operations/types.ts +5 -0
- package/src/public/proof-fingerprint.ts +1 -1
- package/src/public/proof-protocol-types.d.ts +1 -1
- package/src/public/proof-protocol.ts +4 -4
- package/src/public/skills/kibi-usage/SKILL.md +4 -1
- package/src/public/skills/kibi-usage/resources/proof.md +45 -0
- package/src/public/symbol-granularity.generated.ts +45 -12
- package/src/public/symbol-granularity.ts +3 -3
|
@@ -0,0 +1,262 @@
|
|
|
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 * as fs from "node:fs";
|
|
19
|
+
import { createRequire } from "node:module";
|
|
20
|
+
import { dirname, isAbsolute, join, relative, resolve } from "node:path";
|
|
21
|
+
import { pathToFileURL } from "node:url";
|
|
22
|
+
import { PluginValidationError } from "kibi-plugin-sdk";
|
|
23
|
+
import { readProjectPackageJson, } from "./project-config.js";
|
|
24
|
+
// implements REQ-capability-plugin-activation-disclosure-v1
|
|
25
|
+
export class PluginResolutionError extends Error {
|
|
26
|
+
code;
|
|
27
|
+
constructor(code, message) {
|
|
28
|
+
super(message);
|
|
29
|
+
this.name = "PluginResolutionError";
|
|
30
|
+
this.code = code;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
function readJson(path) {
|
|
34
|
+
return JSON.parse(fs.readFileSync(path, "utf8"));
|
|
35
|
+
}
|
|
36
|
+
function nextAncestorDirectory(current) {
|
|
37
|
+
const parent = dirname(current);
|
|
38
|
+
return parent === current ? undefined : parent;
|
|
39
|
+
}
|
|
40
|
+
function isWithinRoot(rootPath, candidatePath) {
|
|
41
|
+
const relativePath = relative(resolve(rootPath), resolve(candidatePath));
|
|
42
|
+
return (relativePath === "" ||
|
|
43
|
+
(!relativePath.startsWith("..") && !isAbsolute(relativePath)));
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Bare npm package names only. Paths, URLs, subpaths, and aliases are rejected.
|
|
47
|
+
*/
|
|
48
|
+
// implements REQ-capability-plugin-activation-disclosure-v1
|
|
49
|
+
export function isBarePackageName(packageName) {
|
|
50
|
+
const trimmed = packageName.trim();
|
|
51
|
+
if (!trimmed || trimmed !== packageName)
|
|
52
|
+
return false;
|
|
53
|
+
if (trimmed.startsWith(".") ||
|
|
54
|
+
trimmed.startsWith("/") ||
|
|
55
|
+
trimmed.includes(":") ||
|
|
56
|
+
trimmed.includes("\\") ||
|
|
57
|
+
trimmed.includes("..")) {
|
|
58
|
+
return false;
|
|
59
|
+
}
|
|
60
|
+
// Reject subpath imports (`pkg/sub`) and Windows drive paths.
|
|
61
|
+
if (trimmed.includes("/") && !trimmed.startsWith("@"))
|
|
62
|
+
return false;
|
|
63
|
+
if (trimmed.startsWith("@")) {
|
|
64
|
+
const parts = trimmed.split("/");
|
|
65
|
+
if (parts.length !== 2 || !parts[0] || !parts[1])
|
|
66
|
+
return false;
|
|
67
|
+
if (parts[1].includes("/"))
|
|
68
|
+
return false;
|
|
69
|
+
}
|
|
70
|
+
return true;
|
|
71
|
+
}
|
|
72
|
+
// implements REQ-capability-plugin-activation-disclosure-v1, REQ-capability-plugin-observable-behavior-v1
|
|
73
|
+
export function assertBarePackageName(packageName) {
|
|
74
|
+
if (!isBarePackageName(packageName)) {
|
|
75
|
+
throw new PluginResolutionError("INVALID_PACKAGE_REFERENCE", `Plugin package '${packageName}' must be a bare package name; paths, URLs, and subpaths are rejected`);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
// implements REQ-capability-plugin-activation-disclosure-v1, REQ-capability-plugin-observable-behavior-v1
|
|
79
|
+
export function hasDeclaredProjectDependency(workspaceRoot, packageName, manifest) {
|
|
80
|
+
const packageJson = manifest ?? readProjectPackageJson(workspaceRoot);
|
|
81
|
+
return [
|
|
82
|
+
packageJson.dependencies,
|
|
83
|
+
packageJson.devDependencies,
|
|
84
|
+
packageJson.optionalDependencies,
|
|
85
|
+
].some((dependencies) => Boolean(dependencies &&
|
|
86
|
+
typeof dependencies === "object" &&
|
|
87
|
+
dependencies[packageName]));
|
|
88
|
+
}
|
|
89
|
+
// implements REQ-capability-plugin-activation-disclosure-v1
|
|
90
|
+
export function hasConsumerNodeModulesLink(workspaceRoot, packageName, packageRoot) {
|
|
91
|
+
try {
|
|
92
|
+
const linkPath = join(workspaceRoot, "node_modules", ...packageName.split("/"));
|
|
93
|
+
const linkedRoot = fs.realpathSync(linkPath);
|
|
94
|
+
return (isWithinRoot(linkedRoot, packageRoot) ||
|
|
95
|
+
isWithinRoot(packageRoot, linkedRoot));
|
|
96
|
+
}
|
|
97
|
+
catch {
|
|
98
|
+
return false;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Same project-scope policy as packages/cursor/bin/launch-kibi-mcp.mjs:
|
|
103
|
+
* within workspace OR node_modules symlink OR Yarn PnP active resolver.
|
|
104
|
+
* Rejects NODE_PATH / global / ambient packages.
|
|
105
|
+
*/
|
|
106
|
+
// implements REQ-capability-plugin-activation-disclosure-v1, REQ-capability-plugin-observable-behavior-v1
|
|
107
|
+
export function isProjectScopedPackage(workspaceRoot, packageName, packageRoot) {
|
|
108
|
+
if (isWithinRoot(workspaceRoot, packageRoot))
|
|
109
|
+
return true;
|
|
110
|
+
return (hasConsumerNodeModulesLink(workspaceRoot, packageName, packageRoot) ||
|
|
111
|
+
Boolean(process.versions.pnp));
|
|
112
|
+
}
|
|
113
|
+
// implements REQ-capability-plugin-activation-disclosure-v1
|
|
114
|
+
export function packageJsonForResolvedFile(startPath, expectedPackageName) {
|
|
115
|
+
let current = resolve(startPath);
|
|
116
|
+
try {
|
|
117
|
+
if (!fs.statSync(current).isDirectory())
|
|
118
|
+
current = dirname(current);
|
|
119
|
+
}
|
|
120
|
+
catch {
|
|
121
|
+
current = dirname(current);
|
|
122
|
+
}
|
|
123
|
+
let cursor = current;
|
|
124
|
+
while (cursor !== undefined) {
|
|
125
|
+
const packageJsonPath = join(cursor, "package.json");
|
|
126
|
+
if (fs.existsSync(packageJsonPath)) {
|
|
127
|
+
try {
|
|
128
|
+
const packageJson = readJson(packageJsonPath);
|
|
129
|
+
if (packageJson.name === expectedPackageName) {
|
|
130
|
+
return { packageJsonPath, packageRoot: cursor, packageJson };
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
catch {
|
|
134
|
+
// Keep walking if a parent package manifest is malformed.
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
cursor = nextAncestorDirectory(cursor);
|
|
138
|
+
}
|
|
139
|
+
return null;
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* Confine a resolved entry to the realpath'd package root. Rejects
|
|
143
|
+
* `exports`/`main` traversal and symlink escapes.
|
|
144
|
+
*/
|
|
145
|
+
// implements REQ-capability-plugin-activation-disclosure-v1
|
|
146
|
+
export function assertResolvedEntryInsidePackageRoot(packageRoot, entryPath) {
|
|
147
|
+
let realRoot;
|
|
148
|
+
try {
|
|
149
|
+
realRoot = fs.realpathSync(packageRoot);
|
|
150
|
+
}
|
|
151
|
+
catch {
|
|
152
|
+
throw new PluginResolutionError("PACKAGE_NOT_FOUND", `Plugin package root '${packageRoot}' is not readable`);
|
|
153
|
+
}
|
|
154
|
+
let realEntry;
|
|
155
|
+
try {
|
|
156
|
+
const stats = fs.statSync(entryPath);
|
|
157
|
+
if (!stats.isFile()) {
|
|
158
|
+
throw new PluginResolutionError("PACKAGE_ENTRY_NOT_FILE", `Plugin package entry '${entryPath}' is not a regular file`);
|
|
159
|
+
}
|
|
160
|
+
realEntry = fs.realpathSync(entryPath);
|
|
161
|
+
}
|
|
162
|
+
catch (error) {
|
|
163
|
+
if (error instanceof PluginResolutionError)
|
|
164
|
+
throw error;
|
|
165
|
+
throw new PluginResolutionError("PACKAGE_ENTRY_NOT_FOUND", `Plugin package entry '${entryPath}' does not exist`);
|
|
166
|
+
}
|
|
167
|
+
if (!isWithinRoot(realRoot, realEntry)) {
|
|
168
|
+
throw new PluginResolutionError("PACKAGE_ENTRY_OUTSIDE_ROOT", `Resolved plugin entry '${realEntry}' is outside package root '${realRoot}'`);
|
|
169
|
+
}
|
|
170
|
+
return realEntry;
|
|
171
|
+
}
|
|
172
|
+
function candidateFromManifest(packageJson) {
|
|
173
|
+
const exportsField = packageJson.exports;
|
|
174
|
+
if (typeof exportsField === "string")
|
|
175
|
+
return exportsField;
|
|
176
|
+
if (exportsField &&
|
|
177
|
+
typeof exportsField === "object" &&
|
|
178
|
+
!Array.isArray(exportsField)) {
|
|
179
|
+
const rootExport = exportsField["."];
|
|
180
|
+
if (typeof rootExport === "string")
|
|
181
|
+
return rootExport;
|
|
182
|
+
if (rootExport &&
|
|
183
|
+
typeof rootExport === "object" &&
|
|
184
|
+
!Array.isArray(rootExport)) {
|
|
185
|
+
const conditional = rootExport;
|
|
186
|
+
if (typeof conditional.import === "string")
|
|
187
|
+
return conditional.import;
|
|
188
|
+
if (typeof conditional.default === "string")
|
|
189
|
+
return conditional.default;
|
|
190
|
+
if (typeof conditional.require === "string")
|
|
191
|
+
return conditional.require;
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
if (typeof packageJson.module === "string")
|
|
195
|
+
return packageJson.module;
|
|
196
|
+
if (typeof packageJson.main === "string")
|
|
197
|
+
return packageJson.main;
|
|
198
|
+
return undefined;
|
|
199
|
+
}
|
|
200
|
+
function resolvePackageEntryWithNode(packageRoot, packageJson, packageName, consumerRequire) {
|
|
201
|
+
let resolved;
|
|
202
|
+
try {
|
|
203
|
+
resolved = consumerRequire.resolve(packageName);
|
|
204
|
+
}
|
|
205
|
+
catch {
|
|
206
|
+
resolved = undefined;
|
|
207
|
+
}
|
|
208
|
+
if (resolved === undefined) {
|
|
209
|
+
const candidate = candidateFromManifest(packageJson);
|
|
210
|
+
if (candidate) {
|
|
211
|
+
resolved = resolve(packageRoot, candidate);
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
if (resolved === undefined) {
|
|
215
|
+
throw new PluginResolutionError("PACKAGE_ENTRY_NOT_FOUND", `Node could not resolve the root export of '${packageName}' from ${packageRoot}`);
|
|
216
|
+
}
|
|
217
|
+
const entryPath = assertResolvedEntryInsidePackageRoot(packageRoot, resolved);
|
|
218
|
+
return { entryPath, entryUrl: pathToFileURL(entryPath).href };
|
|
219
|
+
}
|
|
220
|
+
/**
|
|
221
|
+
* Resolve a declared project-local plugin package through the workspace
|
|
222
|
+
* package.json require graph. NODE_PATH / global / path / URL references fail.
|
|
223
|
+
*/
|
|
224
|
+
// implements REQ-capability-plugin-activation-disclosure-v1
|
|
225
|
+
export function resolveProjectLocalPackage(workspaceRoot, packageName) {
|
|
226
|
+
assertBarePackageName(packageName);
|
|
227
|
+
const root = resolve(workspaceRoot);
|
|
228
|
+
const manifest = readProjectPackageJson(root);
|
|
229
|
+
if (!hasDeclaredProjectDependency(root, packageName, manifest)) {
|
|
230
|
+
throw new PluginResolutionError("UNDECLARED_DEPENDENCY", `Plugin package '${packageName}' must be listed in dependencies, devDependencies, or optionalDependencies of ${join(root, "package.json")}`);
|
|
231
|
+
}
|
|
232
|
+
const consumerRequire = createRequire(join(root, "package.json"));
|
|
233
|
+
let packageInfo = null;
|
|
234
|
+
try {
|
|
235
|
+
packageInfo = packageJsonForResolvedFile(consumerRequire.resolve(`${packageName}/package.json`), packageName);
|
|
236
|
+
}
|
|
237
|
+
catch {
|
|
238
|
+
try {
|
|
239
|
+
packageInfo = packageJsonForResolvedFile(consumerRequire.resolve(packageName), packageName);
|
|
240
|
+
}
|
|
241
|
+
catch {
|
|
242
|
+
packageInfo = null;
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
if (!packageInfo) {
|
|
246
|
+
throw new PluginResolutionError("PACKAGE_NOT_FOUND", `No project-local package '${packageName}' was found for ${root}. Install it in that workspace and retry.`);
|
|
247
|
+
}
|
|
248
|
+
if (!isProjectScopedPackage(root, packageName, packageInfo.packageRoot)) {
|
|
249
|
+
throw new PluginResolutionError("PACKAGE_OUTSIDE_WORKSPACE", `Resolved '${packageName}' outside the consumer workspace: ${packageInfo.packageRoot}. Install it in ${root}; global, NODE_PATH, and ambient packages are not supported.`);
|
|
250
|
+
}
|
|
251
|
+
const { entryPath, entryUrl } = resolvePackageEntryWithNode(packageInfo.packageRoot, packageInfo.packageJson, packageName, consumerRequire);
|
|
252
|
+
return {
|
|
253
|
+
packageName,
|
|
254
|
+
packageRoot: packageInfo.packageRoot,
|
|
255
|
+
packageJsonPath: packageInfo.packageJsonPath,
|
|
256
|
+
packageJson: packageInfo.packageJson,
|
|
257
|
+
entryPath,
|
|
258
|
+
entryUrl,
|
|
259
|
+
};
|
|
260
|
+
}
|
|
261
|
+
/** Re-export for callers that catch SDK validation failures as resolution errors. */
|
|
262
|
+
export { PluginValidationError };
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { type PluginProviderStamp, type SourceAnalysisResult, type SymbolExtractorV1 } from "kibi-plugin-sdk";
|
|
2
|
+
import type { CapabilityModeResolution, CapabilityRegistry } from "./registry.js";
|
|
3
|
+
export type HostSourceAnalysisShadowComparison = Readonly<{
|
|
4
|
+
pluginId: string;
|
|
5
|
+
stamp: PluginProviderStamp;
|
|
6
|
+
symbolCount: number;
|
|
7
|
+
language: string;
|
|
8
|
+
ok: boolean;
|
|
9
|
+
error?: string;
|
|
10
|
+
}>;
|
|
11
|
+
export type HostSourceAnalysisResult = SourceAnalysisResult & Readonly<{
|
|
12
|
+
providerId: string | null;
|
|
13
|
+
stamp: PluginProviderStamp | null;
|
|
14
|
+
fallbackUsed: boolean;
|
|
15
|
+
diagnostics: readonly string[];
|
|
16
|
+
/** Shadow extractor comparisons; never affect canonical symbols. */
|
|
17
|
+
shadowComparisons: readonly HostSourceAnalysisShadowComparison[];
|
|
18
|
+
}>;
|
|
19
|
+
export type SourceAnalysisServiceOptions = Readonly<{
|
|
20
|
+
registry: CapabilityRegistry;
|
|
21
|
+
/** Injectable resolution for tests. */
|
|
22
|
+
resolveExtractors?: () => Promise<CapabilityModeResolution<SymbolExtractorV1>>;
|
|
23
|
+
}>;
|
|
24
|
+
export declare function createConservativeFallbackAnalysis(filePath: string, fallbackReason: string): HostSourceAnalysisResult;
|
|
25
|
+
/**
|
|
26
|
+
* Host-validated symbol analysis over registry providers with conservative
|
|
27
|
+
* text fallback. Mode semantics:
|
|
28
|
+
* - replace: first choice for claimed files; builtin fallback on failure
|
|
29
|
+
* - augment: builtin first for supported files; additional extractors for
|
|
30
|
+
* unsupported files in activation order
|
|
31
|
+
* - shadow: always run when configured/applicable; never canonical
|
|
32
|
+
*/
|
|
33
|
+
export declare class SourceAnalysisService {
|
|
34
|
+
private readonly registry;
|
|
35
|
+
private readonly resolveExtractors;
|
|
36
|
+
constructor(options: SourceAnalysisServiceOptions);
|
|
37
|
+
analyzeText(filePath: string, content: string): Promise<HostSourceAnalysisResult>;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Analyze using a pre-resolved extractor mode set (useful for tests).
|
|
41
|
+
*/
|
|
42
|
+
export declare function analyzeWithResolution(resolution: CapabilityModeResolution<SymbolExtractorV1>, filePath: string, content: string): Promise<HostSourceAnalysisResult>;
|
|
43
|
+
export declare function createSourceAnalysisService(options: SourceAnalysisServiceOptions): SourceAnalysisService;
|
|
44
|
+
//# sourceMappingURL=source-analysis-service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"source-analysis-service.d.ts","sourceRoot":"","sources":["../../src/plugins/source-analysis-service.ts"],"names":[],"mappings":"AAmBA,OAAO,EACL,KAAK,mBAAmB,EACxB,KAAK,oBAAoB,EACzB,KAAK,iBAAiB,EAGvB,MAAM,iBAAiB,CAAC;AAEzB,OAAO,KAAK,EACV,wBAAwB,EACxB,kBAAkB,EACnB,MAAM,eAAe,CAAC;AA4BvB,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,GAAG,oBAAoB,GACzD,QAAQ,CAAC;IACP,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,KAAK,EAAE,mBAAmB,GAAG,IAAI,CAAC;IAClC,YAAY,EAAE,OAAO,CAAC;IACtB,WAAW,EAAE,SAAS,MAAM,EAAE,CAAC;IAC/B,oEAAoE;IACpE,iBAAiB,EAAE,SAAS,kCAAkC,EAAE,CAAC;CAClE,CAAC,CAAC;AAGL,MAAM,MAAM,4BAA4B,GAAG,QAAQ,CAAC;IAClD,QAAQ,EAAE,kBAAkB,CAAC;IAC7B,uCAAuC;IACvC,iBAAiB,CAAC,EAAE,MAAM,OAAO,CAC/B,wBAAwB,CAAC,iBAAiB,CAAC,CAC5C,CAAC;CACH,CAAC,CAAC;AAgBH,wBAAgB,kCAAkC,CAChD,QAAQ,EAAE,MAAM,EAChB,cAAc,EAAE,MAAM,GACrB,wBAAwB,CAkB1B;AAuBD;;;;;;;GAOG;AAEH,qBAAa,qBAAqB;IAChC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAqB;IAC9C,OAAO,CAAC,QAAQ,CAAC,iBAAiB,CAEhC;gBAEU,OAAO,EAAE,4BAA4B;IAO3C,WAAW,CACf,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,MAAM,GACd,OAAO,CAAC,wBAAwB,CAAC;CAiIrC;AAED;;GAEG;AAEH,wBAAsB,qBAAqB,CACzC,UAAU,EAAE,wBAAwB,CAAC,iBAAiB,CAAC,EACvD,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,MAAM,GACd,OAAO,CAAC,wBAAwB,CAAC,CAQnC;AAGD,wBAAgB,2BAA2B,CACzC,OAAO,EAAE,4BAA4B,GACpC,qBAAqB,CAEvB"}
|
|
@@ -0,0 +1,232 @@
|
|
|
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 * as path from "node:path";
|
|
19
|
+
import { toSourceAnalysisProvider, validateSourceAnalysisResultForPath, } from "kibi-plugin-sdk";
|
|
20
|
+
const SOURCE_LANGUAGE_EXTENSIONS = {
|
|
21
|
+
".c": "c",
|
|
22
|
+
".cc": "cpp",
|
|
23
|
+
".cjs": "javascript",
|
|
24
|
+
".cpp": "cpp",
|
|
25
|
+
".cs": "csharp",
|
|
26
|
+
".cts": "typescript",
|
|
27
|
+
".go": "go",
|
|
28
|
+
".h": "c",
|
|
29
|
+
".hpp": "cpp",
|
|
30
|
+
".java": "java",
|
|
31
|
+
".js": "javascript",
|
|
32
|
+
".jsx": "javascript",
|
|
33
|
+
".kt": "kotlin",
|
|
34
|
+
".mjs": "javascript",
|
|
35
|
+
".mts": "typescript",
|
|
36
|
+
".php": "php",
|
|
37
|
+
".py": "python",
|
|
38
|
+
".rb": "ruby",
|
|
39
|
+
".rs": "rust",
|
|
40
|
+
".swift": "swift",
|
|
41
|
+
".ts": "typescript",
|
|
42
|
+
".tsx": "typescript",
|
|
43
|
+
};
|
|
44
|
+
function detectSourceLanguage(filePath) {
|
|
45
|
+
return (SOURCE_LANGUAGE_EXTENSIONS[path.extname(filePath).toLowerCase()] ??
|
|
46
|
+
"unknown");
|
|
47
|
+
}
|
|
48
|
+
function inferModuleTitle(filePath) {
|
|
49
|
+
const extension = path.extname(filePath);
|
|
50
|
+
const basename = path.basename(filePath, extension);
|
|
51
|
+
return basename.length > 0 ? basename : path.basename(filePath);
|
|
52
|
+
}
|
|
53
|
+
// implements REQ-capability-plugin-activation-disclosure-v1
|
|
54
|
+
export function createConservativeFallbackAnalysis(filePath, fallbackReason) {
|
|
55
|
+
const language = detectSourceLanguage(filePath);
|
|
56
|
+
return {
|
|
57
|
+
sourceFile: filePath,
|
|
58
|
+
language,
|
|
59
|
+
providerId: null,
|
|
60
|
+
stamp: null,
|
|
61
|
+
fallbackUsed: true,
|
|
62
|
+
diagnostics: [`conservative fallback: ${fallbackReason}`],
|
|
63
|
+
shadowComparisons: [],
|
|
64
|
+
module: {
|
|
65
|
+
title: inferModuleTitle(filePath),
|
|
66
|
+
language,
|
|
67
|
+
analysisMode: "fallback",
|
|
68
|
+
fallbackReason,
|
|
69
|
+
},
|
|
70
|
+
symbols: [],
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
function dedupeSymbols(symbols) {
|
|
74
|
+
const seen = new Set();
|
|
75
|
+
const output = [];
|
|
76
|
+
for (const symbol of symbols) {
|
|
77
|
+
const key = [
|
|
78
|
+
symbol.name,
|
|
79
|
+
symbol.kind,
|
|
80
|
+
symbol.startLine,
|
|
81
|
+
symbol.startColumn,
|
|
82
|
+
symbol.endLine,
|
|
83
|
+
symbol.endColumn,
|
|
84
|
+
].join("\0");
|
|
85
|
+
if (seen.has(key))
|
|
86
|
+
continue;
|
|
87
|
+
seen.add(key);
|
|
88
|
+
output.push(symbol);
|
|
89
|
+
}
|
|
90
|
+
return output;
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Host-validated symbol analysis over registry providers with conservative
|
|
94
|
+
* text fallback. Mode semantics:
|
|
95
|
+
* - replace: first choice for claimed files; builtin fallback on failure
|
|
96
|
+
* - augment: builtin first for supported files; additional extractors for
|
|
97
|
+
* unsupported files in activation order
|
|
98
|
+
* - shadow: always run when configured/applicable; never canonical
|
|
99
|
+
*/
|
|
100
|
+
// implements REQ-capability-plugin-activation-disclosure-v1
|
|
101
|
+
export class SourceAnalysisService {
|
|
102
|
+
registry;
|
|
103
|
+
resolveExtractors;
|
|
104
|
+
constructor(options) {
|
|
105
|
+
this.registry = options.registry;
|
|
106
|
+
this.resolveExtractors =
|
|
107
|
+
options.resolveExtractors ??
|
|
108
|
+
(() => this.registry.resolveSymbolExtractors());
|
|
109
|
+
}
|
|
110
|
+
async analyzeText(filePath, content) {
|
|
111
|
+
const resolution = await this.resolveExtractors();
|
|
112
|
+
const diagnostics = [];
|
|
113
|
+
const tryAnalyze = (extractor, stamp) => {
|
|
114
|
+
const provider = toSourceAnalysisProvider(extractor);
|
|
115
|
+
if (!provider.supportsFile(filePath))
|
|
116
|
+
return null;
|
|
117
|
+
try {
|
|
118
|
+
const raw = provider.analyzeText(filePath, content);
|
|
119
|
+
const validated = validateSourceAnalysisResultForPath(raw, filePath);
|
|
120
|
+
return {
|
|
121
|
+
...validated,
|
|
122
|
+
symbols: dedupeSymbols(validated.symbols),
|
|
123
|
+
providerId: extractor.id,
|
|
124
|
+
stamp,
|
|
125
|
+
fallbackUsed: false,
|
|
126
|
+
diagnostics,
|
|
127
|
+
shadowComparisons: [],
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
catch (error) {
|
|
131
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
132
|
+
diagnostics.push(`extractor '${extractor.id}' failed: ${message}`);
|
|
133
|
+
return null;
|
|
134
|
+
}
|
|
135
|
+
};
|
|
136
|
+
const runShadow = (canonical) => {
|
|
137
|
+
if (resolution.shadow.length === 0) {
|
|
138
|
+
return { ...canonical, diagnostics: [...diagnostics] };
|
|
139
|
+
}
|
|
140
|
+
const shadowComparisons = [];
|
|
141
|
+
for (const entry of resolution.shadow) {
|
|
142
|
+
const provider = toSourceAnalysisProvider(entry.capability);
|
|
143
|
+
if (!provider.supportsFile(filePath))
|
|
144
|
+
continue;
|
|
145
|
+
try {
|
|
146
|
+
const validated = validateSourceAnalysisResultForPath(provider.analyzeText(filePath, content), filePath);
|
|
147
|
+
shadowComparisons.push({
|
|
148
|
+
pluginId: entry.pluginId,
|
|
149
|
+
stamp: entry.stamp,
|
|
150
|
+
symbolCount: validated.symbols.length,
|
|
151
|
+
language: validated.language,
|
|
152
|
+
ok: true,
|
|
153
|
+
});
|
|
154
|
+
diagnostics.push(`shadow extractor '${entry.pluginId}' produced ${validated.symbols.length} non-canonical symbol(s)`);
|
|
155
|
+
}
|
|
156
|
+
catch (error) {
|
|
157
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
158
|
+
shadowComparisons.push({
|
|
159
|
+
pluginId: entry.pluginId,
|
|
160
|
+
stamp: entry.stamp,
|
|
161
|
+
symbolCount: 0,
|
|
162
|
+
language: detectSourceLanguage(filePath),
|
|
163
|
+
ok: false,
|
|
164
|
+
error: message,
|
|
165
|
+
});
|
|
166
|
+
diagnostics.push(`shadow extractor '${entry.pluginId}' failed: ${message}`);
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
return {
|
|
170
|
+
...canonical,
|
|
171
|
+
diagnostics: [...diagnostics],
|
|
172
|
+
shadowComparisons,
|
|
173
|
+
};
|
|
174
|
+
};
|
|
175
|
+
let canonical = null;
|
|
176
|
+
if (resolution.replace) {
|
|
177
|
+
const replaced = tryAnalyze(resolution.replace.capability, resolution.replace.stamp);
|
|
178
|
+
if (replaced) {
|
|
179
|
+
canonical = replaced;
|
|
180
|
+
}
|
|
181
|
+
else {
|
|
182
|
+
diagnostics.push(`replace extractor '${resolution.replace.pluginId}' did not claim or failed; trying builtin`);
|
|
183
|
+
const builtin = tryAnalyze(resolution.builtin.capability, {
|
|
184
|
+
...resolution.builtin.stamp,
|
|
185
|
+
fallbackUsed: true,
|
|
186
|
+
});
|
|
187
|
+
if (builtin) {
|
|
188
|
+
canonical = { ...builtin, fallbackUsed: true };
|
|
189
|
+
}
|
|
190
|
+
else {
|
|
191
|
+
canonical = createConservativeFallbackAnalysis(filePath, "provider_error");
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
else {
|
|
196
|
+
const builtin = tryAnalyze(resolution.builtin.capability, resolution.builtin.stamp);
|
|
197
|
+
if (builtin) {
|
|
198
|
+
canonical = builtin;
|
|
199
|
+
}
|
|
200
|
+
else {
|
|
201
|
+
for (const entry of resolution.augment) {
|
|
202
|
+
const analyzed = tryAnalyze(entry.capability, entry.stamp);
|
|
203
|
+
if (analyzed) {
|
|
204
|
+
canonical = analyzed;
|
|
205
|
+
break;
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
if (!canonical) {
|
|
209
|
+
canonical = createConservativeFallbackAnalysis(filePath, diagnostics.length > 0 ? "provider_error" : "unsupported_language");
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
return runShadow(canonical);
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
/**
|
|
217
|
+
* Analyze using a pre-resolved extractor mode set (useful for tests).
|
|
218
|
+
*/
|
|
219
|
+
// implements REQ-capability-plugin-activation-disclosure-v1
|
|
220
|
+
export async function analyzeWithResolution(resolution, filePath, content) {
|
|
221
|
+
const service = new SourceAnalysisService({
|
|
222
|
+
registry: {
|
|
223
|
+
resolveSymbolExtractors: async () => resolution,
|
|
224
|
+
},
|
|
225
|
+
resolveExtractors: async () => resolution,
|
|
226
|
+
});
|
|
227
|
+
return service.analyzeText(filePath, content);
|
|
228
|
+
}
|
|
229
|
+
// implements REQ-capability-plugin-activation-disclosure-v1
|
|
230
|
+
export function createSourceAnalysisService(options) {
|
|
231
|
+
return new SourceAnalysisService(options);
|
|
232
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"janitor.d.ts","sourceRoot":"","sources":["../../src/prolog/janitor.ts"],"names":[],"mappings":"AAoBA,OAAO,
|
|
1
|
+
{"version":3,"file":"janitor.d.ts","sourceRoot":"","sources":["../../src/prolog/janitor.ts"],"names":[],"mappings":"AAoBA,OAAO,EACL,KAAK,oBAAoB,EAK1B,MAAM,iBAAiB,CAAC;AAEzB;;;;;;;;GAQG;AAGH,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,IAAI,EAAE,YAAY,CAAC;IAC5B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,aAAa,CAAC,EAAE,MAAM,CAAC;IAChC,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,WAAW,EAAE,oBAAoB,CAAC;IAC3C,QAAQ,CAAC,eAAe,EAAE,OAAO,CAAC;IAClC,QAAQ,CAAC,MAAM,EAAE,OAAO,GAAG,gBAAgB,GAAG,MAAM,CAAC;CACtD;AAED,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC;IACxB,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,WAAW,EAAE,oBAAoB,CAAC;IAC3C,QAAQ,CAAC,MAAM,EAAE,OAAO,GAAG,MAAM,CAAC;CACnC;AAED,MAAM,MAAM,cAAc,GAAG,gBAAgB,GAAG,aAAa,CAAC;AAE9D,MAAM,WAAW,cAAc;IAC7B,6DAA6D;IAC7D,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,8DAA8D;IAC9D,QAAQ,CAAC,gBAAgB,EAAE,MAAM,CAAC;IAClC,kEAAkE;IAClE,QAAQ,CAAC,GAAG,CAAC,EAAE,OAAO,CAAC;IACvB,oEAAoE;IACpE,QAAQ,CAAC,KAAK,CAAC,EAAE,OAAO,CAAC;CAC1B;AAED,2EAA2E;AAE3E,wBAAgB,cAAc,CAC5B,SAAS,EAAE,MAAM,EACjB,KAAK,EAAE,OAAO,GACb,gBAAgB,GAAG,IAAI,CA+CzB;AAED,iEAAiE;AAEjE,wBAAgB,wBAAwB,CACtC,OAAO,EAAE,cAAc,GACtB,gBAAgB,EAAE,CAepB;AAED;;;GAGG;AAEH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,cAAc,GAAG,aAAa,EAAE,CA8C5E;AAED,gFAAgF;AAEhF,wBAAgB,UAAU,CAAC,OAAO,EAAE,cAAc,GAAG,cAAc,EAAE,CAKpE"}
|
package/dist/prolog/janitor.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 { existsSync,
|
|
18
|
+
import { existsSync, readFileSync, readdirSync, rmSync } from "node:fs";
|
|
19
19
|
import { join } from "node:path";
|
|
20
20
|
import { breakStoreLock, classifyStoreLockHolder, isProcessAlive, readStoreLockOwner, } from "./store-lock.js";
|
|
21
21
|
/** Scan one branch store's ownership journal and clean stale artifacts. */
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { PrologStoreLockOwner } from "./error-terms.js";
|
|
2
1
|
import type { QueryResult } from "../prolog.js";
|
|
2
|
+
import type { PrologStoreLockOwner } from "./error-terms.js";
|
|
3
3
|
/** Linux boot id; guards against PID reuse across reboots. Null elsewhere. */
|
|
4
4
|
export declare function currentBootId(): string | null;
|
|
5
5
|
export declare function isProcessAlive(pid: number): boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"store-lock.d.ts","sourceRoot":"","sources":["../../src/prolog/store-lock.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"store-lock.d.ts","sourceRoot":"","sources":["../../src/prolog/store-lock.ts"],"names":[],"mappings":"AAqBA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAEhD,OAAO,KAAK,EAAqB,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAgBhF,8EAA8E;AAC9E,wBAAgB,aAAa,IAAI,MAAM,GAAG,IAAI,CAa7C;AAED,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAUnD;AAED,MAAM,MAAM,oBAAoB,GAAG,MAAM,GAAG,OAAO,GAAG,MAAM,GAAG,SAAS,CAAC;AAEzE,wBAAgB,uBAAuB,CACrC,KAAK,EAAE,oBAAoB,GAAG,IAAI,GACjC,oBAAoB,CAYtB;AAED;;;;;GAKG;AAEH,wBAAgB,kBAAkB,CAChC,SAAS,EAAE,MAAM,GAChB;IAAE,KAAK,EAAE,oBAAoB,CAAC;IAAC,WAAW,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CA4B7D;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,YAAY,EAAE,MAAM,GAAG,IAAI,CAWzD;AAED,MAAM,WAAW,yBAAyB;IACxC,QAAQ,CAAC,MAAM,EAAE,OAAO,GAAG,SAAS,CAAC;IACrC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB;AAED;;;;GAIG;AACH,wBAAgB,uBAAuB,CACrC,KAAK,EAAE,oBAAoB,GAAG,IAAI,GACjC,yBAAyB,CAoB3B;AAED,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,KAAK,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,WAAW,CAAC,CAAC;CACxD;AAED;;;;;;GAMG;AAEH,wBAAsB,iCAAiC,CACrD,MAAM,EAAE,qBAAqB,EAC7B,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,WAAW,GAClB,OAAO,CAAC,WAAW,CAAC,CA4BtB"}
|
package/dist/proof/inspect.js
CHANGED
|
@@ -148,7 +148,7 @@ function directoryExists(root, relative) {
|
|
|
148
148
|
return false;
|
|
149
149
|
}
|
|
150
150
|
}
|
|
151
|
-
// implements REQ-kibi-
|
|
151
|
+
// implements REQ-kibi-verification-evidence-contract
|
|
152
152
|
export function inspectProofEnvironment(root) {
|
|
153
153
|
const languages = new Set();
|
|
154
154
|
const buildSystems = new Set();
|
|
@@ -5,7 +5,7 @@ import path from "node:path";
|
|
|
5
5
|
* The path is always repository-relative before hashing so the same case has
|
|
6
6
|
* the same identity in a checkout, packed consumer, and dogfood workspace.
|
|
7
7
|
*/
|
|
8
|
-
// implements REQ-kibi-
|
|
8
|
+
// implements REQ-kibi-verification-evidence-contract
|
|
9
9
|
export function playwrightCaseId(sourceFile, qualifiedTitle) {
|
|
10
10
|
const normalizedPath = sourceFile
|
|
11
11
|
.replaceAll("\\", "/")
|
|
@@ -14,7 +14,7 @@ export function playwrightCaseId(sourceFile, qualifiedTitle) {
|
|
|
14
14
|
const key = `${normalizedPath}\0${qualifiedTitle.trim()}`;
|
|
15
15
|
return `SYM-PW-${createHash("sha256").update(key).digest("hex").slice(0, 16).toUpperCase()}`;
|
|
16
16
|
}
|
|
17
|
-
// implements REQ-kibi-
|
|
17
|
+
// implements REQ-kibi-verification-evidence-contract
|
|
18
18
|
export function normalizePlaywrightSourceFile(sourceFile, workspaceRoot) {
|
|
19
19
|
const absolute = path.resolve(sourceFile);
|
|
20
20
|
if (!workspaceRoot)
|
|
@@ -2,7 +2,7 @@ import { mkdir, writeFile } from "node:fs/promises";
|
|
|
2
2
|
import path from "node:path";
|
|
3
3
|
import { PROOF_RUN_VERSION, } from "../../public/proof-protocol.js";
|
|
4
4
|
import { normalizePlaywrightSourceFile, playwrightCaseId, } from "./playwright-case-id.js";
|
|
5
|
-
// implements REQ-kibi-
|
|
5
|
+
// implements REQ-kibi-verification-evidence-contract
|
|
6
6
|
export { PROOF_RUN_VERSION };
|
|
7
7
|
function outputPath(options) {
|
|
8
8
|
const configured = options.outputPath ?? process.env.KIBI_PROOF_OUTPUT;
|
|
@@ -53,11 +53,11 @@ export class KibiPlaywrightProducer {
|
|
|
53
53
|
this.options = options;
|
|
54
54
|
this.startedAt = (options.now ?? (() => new Date()))().toISOString();
|
|
55
55
|
}
|
|
56
|
-
// implements REQ-kibi-
|
|
56
|
+
// implements REQ-kibi-verification-evidence-contract
|
|
57
57
|
onBegin() {
|
|
58
58
|
this.startedAt = (this.options.now ?? (() => new Date()))().toISOString();
|
|
59
59
|
}
|
|
60
|
-
// implements REQ-kibi-
|
|
60
|
+
// implements REQ-kibi-verification-evidence-contract
|
|
61
61
|
onTestEnd(test, result) {
|
|
62
62
|
const resultValue = result;
|
|
63
63
|
const titles = titlePath(test);
|
|
@@ -101,7 +101,7 @@ export class KibiPlaywrightProducer {
|
|
|
101
101
|
attempts: { status: "complete", entries: [attempt] },
|
|
102
102
|
});
|
|
103
103
|
}
|
|
104
|
-
// implements REQ-kibi-
|
|
104
|
+
// implements REQ-kibi-verification-evidence-contract
|
|
105
105
|
async onEnd(result) {
|
|
106
106
|
const now = this.options.now ?? (() => new Date());
|
|
107
107
|
const status = result?.status;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { analyzeSourceText, enrichSymbolCoordinates, type ManifestSymbolEntry, type AnalyzeSourceTextOptions, type SourceAnalysisProvider, type SourceAnalysisResult, type SourceModuleAnalysis, type SourceSymbolAnalysis, type SourceSymbolKind, } from "../../extractors/symbols-coordinator.js";
|
|
1
|
+
export { analyzeSourceText, analyzeSourceTextWithRegistry, enrichSymbolCoordinates, type ManifestSymbolEntry, type AnalyzeSourceTextOptions, type SourceAnalysisProvider, type SourceAnalysisResult, type SourceModuleAnalysis, type SourceSymbolAnalysis, type SourceSymbolKind, } from "../../extractors/symbols-coordinator.js";
|
|
2
2
|
//# sourceMappingURL=symbols-coordinator.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"symbols-coordinator.d.ts","sourceRoot":"","sources":["../../../src/public/extractors/symbols-coordinator.ts"],"names":[],"mappings":"AAkBA,OAAO,EACL,iBAAiB,EACjB,uBAAuB,EACvB,KAAK,mBAAmB,EACxB,KAAK,wBAAwB,EAC7B,KAAK,sBAAsB,EAC3B,KAAK,oBAAoB,EACzB,KAAK,oBAAoB,EACzB,KAAK,oBAAoB,EACzB,KAAK,gBAAgB,GACtB,MAAM,yCAAyC,CAAC"}
|
|
1
|
+
{"version":3,"file":"symbols-coordinator.d.ts","sourceRoot":"","sources":["../../../src/public/extractors/symbols-coordinator.ts"],"names":[],"mappings":"AAkBA,OAAO,EACL,iBAAiB,EACjB,6BAA6B,EAC7B,uBAAuB,EACvB,KAAK,mBAAmB,EACxB,KAAK,wBAAwB,EAC7B,KAAK,sBAAsB,EAC3B,KAAK,oBAAoB,EACzB,KAAK,oBAAoB,EACzB,KAAK,oBAAoB,EACzB,KAAK,gBAAgB,GACtB,MAAM,yCAAyC,CAAC"}
|
|
@@ -15,4 +15,4 @@
|
|
|
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
|
-
export { analyzeSourceText, enrichSymbolCoordinates, } from "../../extractors/symbols-coordinator.js";
|
|
18
|
+
export { analyzeSourceText, analyzeSourceTextWithRegistry, enrichSymbolCoordinates, } from "../../extractors/symbols-coordinator.js";
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { ChangedFileImpactOptions, ChangedFileImpactResult } from "./types.js";
|
|
2
|
-
export declare function analyzeChangedFileImpact(options: ChangedFileImpactOptions): ChangedFileImpactResult
|
|
2
|
+
export declare function analyzeChangedFileImpact(options: ChangedFileImpactOptions): Promise<ChangedFileImpactResult>;
|
|
3
3
|
//# sourceMappingURL=analyzer.d.ts.map
|