kibi-cli 2.32.0 → 2.36.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.d.ts.map +1 -1
- package/dist/cli.js +5 -1
- package/dist/commands/check-generated.d.ts +5 -1
- package/dist/commands/check-generated.d.ts.map +1 -1
- package/dist/commands/check-generated.js +24 -35
- package/dist/commands/init-helpers.d.ts.map +1 -1
- package/dist/commands/init-helpers.js +8 -5
- package/dist/commands/migrate.d.ts.map +1 -1
- package/dist/commands/migrate.js +23 -5
- package/dist/commands/sync/manifest.d.ts +10 -1
- package/dist/commands/sync/manifest.d.ts.map +1 -1
- package/dist/commands/sync/manifest.js +87 -14
- package/dist/commands/sync.d.ts.map +1 -1
- package/dist/commands/sync.js +19 -0
- package/dist/extractors/markdown.d.ts +1 -1
- package/dist/extractors/markdown.d.ts.map +1 -1
- package/dist/extractors/symbol-coordinates.js +2 -2
- package/dist/extractors/symbols-coordinator.d.ts +2 -4
- package/dist/extractors/symbols-coordinator.d.ts.map +1 -1
- package/dist/extractors/symbols-coordinator.js +1 -2
- package/dist/operations/migration/proof-contract-claims.d.ts +23 -10
- package/dist/operations/migration/proof-contract-claims.d.ts.map +1 -1
- package/dist/operations/migration/proof-contract-claims.js +35 -2
- package/dist/operations/migration/schema6.d.ts.map +1 -1
- package/dist/operations/migration/schema6.js +2 -4
- package/dist/operations/migration/symbol-coordinates-refresh.d.ts +3 -2
- package/dist/operations/migration/symbol-coordinates-refresh.d.ts.map +1 -1
- package/dist/operations/migration/symbol-coordinates-refresh.js +4 -3
- package/dist/operations/migration/untrack-symbol-coordinates.d.ts +23 -0
- package/dist/operations/migration/untrack-symbol-coordinates.d.ts.map +1 -0
- package/dist/operations/migration/untrack-symbol-coordinates.js +67 -0
- package/dist/operations/modeling/requirement-modeler.d.ts.map +1 -1
- package/dist/operations/modeling/requirement-modeler.js +48 -1
- package/dist/operations/modeling/requirement-types.d.ts +2 -1
- package/dist/operations/modeling/requirement-types.d.ts.map +1 -1
- package/dist/operations/modeling/requirement-utils.d.ts +1 -1
- package/dist/operations/modeling/requirement-utils.d.ts.map +1 -1
- package/dist/operations/modeling/requirement-utils.js +8 -1
- package/dist/operations/mutation/source-authoring.d.ts.map +1 -1
- package/dist/operations/mutation/source-authoring.js +39 -20
- package/dist/operations/proof/claim-bindings.d.ts +18 -0
- package/dist/operations/proof/claim-bindings.d.ts.map +1 -1
- package/dist/operations/proof/claim-bindings.js +157 -4
- package/dist/operations/proof/code-certificates.d.ts +34 -14
- package/dist/operations/proof/code-certificates.d.ts.map +1 -1
- package/dist/operations/proof/code-certificates.js +266 -157
- package/dist/operations/proof/code-models.d.ts +96 -0
- package/dist/operations/proof/code-models.d.ts.map +1 -0
- package/dist/operations/proof/code-models.js +601 -0
- package/dist/operations/proof/code-runner.d.ts +40 -0
- package/dist/operations/proof/code-runner.d.ts.map +1 -0
- package/dist/operations/proof/code-runner.js +164 -0
- package/dist/operations/proof/code-scope.d.ts +3 -0
- package/dist/operations/proof/code-scope.d.ts.map +1 -1
- package/dist/operations/proof/code-scope.js +26 -2
- package/dist/operations/proof/ingest-proof.d.ts.map +1 -1
- package/dist/operations/proof/ingest-proof.js +2 -1
- package/dist/operations/proof/regular-language.d.ts +89 -0
- package/dist/operations/proof/regular-language.d.ts.map +1 -0
- package/dist/operations/proof/regular-language.js +943 -0
- package/dist/operations/proof/source-code-readers.d.ts +12 -0
- package/dist/operations/proof/source-code-readers.d.ts.map +1 -0
- package/dist/operations/proof/source-code-readers.js +699 -0
- package/dist/operations/semantic-advisor/analyze-prose.d.ts.map +1 -1
- package/dist/operations/semantic-advisor/analyze-prose.js +2 -1
- package/dist/operations/semantic-advisor/strict-count-rules.d.ts.map +1 -1
- package/dist/operations/semantic-advisor/strict-count-rules.js +8 -2
- package/dist/operations/semantic-advisor/strict-rules.d.ts +8 -0
- package/dist/operations/semantic-advisor/strict-rules.d.ts.map +1 -1
- package/dist/operations/semantic-advisor/strict-rules.js +231 -1
- package/dist/operations/semantic-advisor/types.d.ts +1 -1
- package/dist/operations/semantic-advisor/types.d.ts.map +1 -1
- package/dist/prolog.d.ts.map +1 -1
- package/dist/prolog.js +13 -3
- package/dist/public/operations/catalog.d.ts +156 -13
- package/dist/public/operations/catalog.d.ts.map +1 -1
- package/dist/public/operations/evidence-floor.js +1 -1
- package/dist/public/operations/proof-contract-claims.js +1 -1
- package/dist/public/operations/specs/composite.d.ts +16 -3
- package/dist/public/operations/specs/composite.d.ts.map +1 -1
- package/dist/public/operations/specs/modeling.d.ts +16 -3
- package/dist/public/operations/specs/modeling.d.ts.map +1 -1
- package/dist/public/operations/specs/modeling.js +22 -3
- package/dist/public/operations/specs/mutation-schemas.d.ts +140 -10
- package/dist/public/operations/specs/mutation-schemas.d.ts.map +1 -1
- package/dist/public/operations/specs/mutation-schemas.js +14 -3
- package/dist/public/operations/specs/upsert.d.ts +140 -10
- package/dist/public/operations/specs/upsert.d.ts.map +1 -1
- package/dist/public/proof-certificates.d.ts +75 -1
- package/dist/public/proof-certificates.d.ts.map +1 -1
- package/dist/public/proof-certificates.js +212 -0
- package/dist/public/proof-protocol.d.ts +143 -10
- package/dist/public/proof-protocol.d.ts.map +1 -1
- package/dist/public/proof-protocol.js +301 -16
- package/dist/public/proof-receipt.d.ts +4 -3
- package/dist/public/proof-receipt.d.ts.map +1 -1
- package/dist/public/proof-receipt.js +6 -1
- package/dist/public/proof-sources.d.ts +102 -0
- package/dist/public/proof-sources.d.ts.map +1 -0
- package/dist/public/proof-sources.js +1292 -0
- package/dist/public/schemas/entity.d.ts.map +1 -1
- package/dist/public/schemas/entity.js +21 -1
- package/dist/public/skills/kibi-commit-review/SKILL.md +8 -8
- package/dist/public/skills/kibi-commit-review/resources/staged-gate.md +6 -6
- package/dist/public/skills/kibi-decisions/SKILL.md +5 -2
- package/dist/public/skills/kibi-decisions/resources/decision-records.md +4 -1
- package/dist/public/skills/kibi-freshness/SKILL.md +2 -2
- package/dist/public/skills/kibi-traceability/SKILL.md +3 -2
- package/dist/public/skills/kibi-usage/SKILL.md +5 -3
- package/dist/public/skills/kibi-usage/resources/proof.md +105 -9
- package/dist/report/html-report.css +45 -10
- package/dist/report/html-report.d.ts.map +1 -1
- package/dist/report/html-report.js +74 -17
- package/dist/report/report-view.d.ts +1 -1
- package/dist/report/report-view.d.ts.map +1 -1
- package/dist/report/report-view.js +1 -0
- package/dist/schemas/entity.schema.json +199 -8
- package/dist/traceability/evidence-model.d.ts +13 -12
- package/dist/traceability/evidence-model.d.ts.map +1 -1
- package/dist/traceability/evidence-model.js +1 -1
- package/dist/traceability/staged-diagnostics.d.ts.map +1 -1
- package/dist/traceability/staged-diagnostics.js +24 -20
- package/dist/traceability/staged-impact-contract.d.ts +4 -4
- package/dist/traceability/staged-impact-contract.js +9 -9
- package/dist/traceability/staged-symbols-manifest.d.ts +11 -3
- package/dist/traceability/staged-symbols-manifest.d.ts.map +1 -1
- package/dist/traceability/staged-symbols-manifest.js +47 -140
- package/dist/types/entities.d.ts +1 -1
- package/dist/types/entities.d.ts.map +1 -1
- package/dist/utils/rule-registry.generated.d.ts +1 -1
- package/dist/utils/rule-registry.generated.js +1 -1
- package/dist/utils/schema-version.d.ts +1 -1
- package/dist/utils/schema-version.d.ts.map +1 -1
- package/dist/utils/schema-version.js +3 -1
- package/dist/utils/strict-modeling.d.ts +3 -2
- package/dist/utils/strict-modeling.d.ts.map +1 -1
- package/dist/utils/strict-modeling.js +37 -4
- package/dist/workspace-cwd.d.ts +15 -0
- package/dist/workspace-cwd.d.ts.map +1 -0
- package/dist/workspace-cwd.js +86 -0
- package/package.json +2 -2
- package/schema/validation.pl +3 -1
- package/src/public/operations/evidence-floor.ts +1 -1
- package/src/public/operations/proof-contract-claims.ts +1 -1
- package/src/public/operations/specs/modeling.ts +24 -5
- package/src/public/operations/specs/mutation-schemas.ts +14 -3
- package/src/public/proof-certificates.ts +296 -1
- package/src/public/proof-protocol-types.d.ts +54 -2
- package/src/public/proof-protocol.ts +396 -20
- package/src/public/proof-receipt.ts +8 -2
- package/src/public/proof-sources.ts +1656 -0
- package/src/public/schemas/entity.ts +32 -2
- package/src/public/skills/kibi-commit-review/SKILL.md +8 -8
- package/src/public/skills/kibi-commit-review/resources/staged-gate.md +6 -6
- package/src/public/skills/kibi-decisions/SKILL.md +5 -2
- package/src/public/skills/kibi-decisions/resources/decision-records.md +4 -1
- package/src/public/skills/kibi-freshness/SKILL.md +2 -2
- package/src/public/skills/kibi-traceability/SKILL.md +3 -2
- package/src/public/skills/kibi-usage/SKILL.md +5 -3
- package/src/public/skills/kibi-usage/resources/proof.md +105 -9
- package/src/schemas/entity.schema.json +199 -8
- package/dist/traceability/reviewed-coordinate-refresh.d.ts +0 -10
- package/dist/traceability/reviewed-coordinate-refresh.d.ts.map +0 -1
- package/dist/traceability/reviewed-coordinate-refresh.js +0 -49
|
@@ -18,9 +18,9 @@
|
|
|
18
18
|
import * as fs from "node:fs";
|
|
19
19
|
import * as path from "node:path";
|
|
20
20
|
import { createMaintenanceSourceAnalysisService } from "../plugins/maintenance-source-analysis.js";
|
|
21
|
-
import { resolveWorkspaceSourceAbsolute } from "../utils/repo-relative-path.js";
|
|
22
21
|
import { createSourceAnalysisService, } from "../plugins/source-analysis-service.js";
|
|
23
22
|
import { extensionLanguage, isTsJsSourcePath, } from "../plugins/source-classification.js";
|
|
23
|
+
import { resolveWorkspaceSourceAbsolute } from "../utils/repo-relative-path.js";
|
|
24
24
|
import { createTsMorphSourceAnalysisProvider, enrichSymbolCoordinatesWithTsMorph, } from "./symbols-ts.js";
|
|
25
25
|
const DEFAULT_SOURCE_ANALYSIS_PROVIDERS = [
|
|
26
26
|
createTsMorphSourceAnalysisProvider(),
|
|
@@ -147,7 +147,6 @@ export async function enrichSymbolCoordinates(entries, workspaceRoot, deps) {
|
|
|
147
147
|
(analysis.status === "partial" && !coordinateOnlyPartial))
|
|
148
148
|
throw new Error(`Cannot refresh incomplete source analysis for ${logicalPath}: ${analysis.diagnostics.map((d) => d.message).join("; ")}`);
|
|
149
149
|
if (coordinateOnlyPartial && firstAnalysis) {
|
|
150
|
-
await deps?.verifyPythonDecoratorCoordinates?.(logicalPath, analysis);
|
|
151
150
|
console.warn(`[kibi] Coordinate-only refresh for ${logicalPath}; source analysis remains partial: ${analysis.diagnostics.map((diagnostic) => diagnostic.message).join("; ")}`);
|
|
152
151
|
}
|
|
153
152
|
if (analysis.status === "unsupported") {
|
|
@@ -3,36 +3,49 @@ import type { BodyContextTarget } from "./entity-body-context.js";
|
|
|
3
3
|
export declare const PROOF_CONTRACT_CLAIMS_PIN_CODE = "proof_contract_claims_pin";
|
|
4
4
|
/** Schema 12: certificate contracts a person must bind to their claims. */
|
|
5
5
|
export declare const PROOF_CONTRACT_CLAIMS_REVIEW_CODE = "proof_contract_claims_review";
|
|
6
|
-
/**
|
|
6
|
+
/**
|
|
7
|
+
* A modeled claim a certificate contract's test reaches, with the binding a
|
|
8
|
+
* certificate of its kind would get: derived when the claim's fact derives
|
|
9
|
+
* an obligation for the kind, attested when the fact has no derivation,
|
|
10
|
+
* incompatible (with the reason) when the kind cannot express it.
|
|
11
|
+
*/
|
|
7
12
|
export type ClaimCandidate = Readonly<{
|
|
8
13
|
claim_key: string;
|
|
9
14
|
requirement_id: string;
|
|
10
15
|
fact_id: string;
|
|
16
|
+
binding: "derived" | "attested" | "incompatible";
|
|
17
|
+
reason?: string;
|
|
11
18
|
}>;
|
|
12
19
|
/**
|
|
13
|
-
* A certificate-kind contract without proves, with
|
|
14
|
-
* requirements its test reaches
|
|
20
|
+
* A certificate-kind contract without proves, with every modeled claim of
|
|
21
|
+
* the requirements its test reaches through its scenarios.
|
|
15
22
|
*/
|
|
16
23
|
export type ClaimCandidateRow = Readonly<{
|
|
17
24
|
test_id: string;
|
|
18
25
|
kind: string;
|
|
19
26
|
candidates: readonly ClaimCandidate[];
|
|
20
27
|
}>;
|
|
28
|
+
export type ProofContractClaimsReview = Readonly<{
|
|
29
|
+
id: string;
|
|
30
|
+
path: string;
|
|
31
|
+
kind: string;
|
|
32
|
+
candidates: readonly ClaimCandidate[];
|
|
33
|
+
}>;
|
|
21
34
|
export type ProofContractClaimsPlan = Readonly<{
|
|
22
35
|
targets: readonly BodyContextTarget[];
|
|
23
|
-
/** Contracts left without proves:
|
|
24
|
-
review: readonly
|
|
25
|
-
id: string;
|
|
26
|
-
path: string;
|
|
27
|
-
kind: string;
|
|
28
|
-
candidates: readonly string[];
|
|
29
|
-
}>[];
|
|
36
|
+
/** Contracts left without proves: no derived claim, or several. */
|
|
37
|
+
review: readonly ProofContractClaimsReview[];
|
|
30
38
|
skipped: readonly Readonly<{
|
|
31
39
|
id: string;
|
|
32
40
|
path: string;
|
|
33
41
|
reason: string;
|
|
34
42
|
}>[];
|
|
35
43
|
}>;
|
|
44
|
+
/**
|
|
45
|
+
* What a person reviewing a contract without proves has to do, naming every
|
|
46
|
+
* claim its test reaches and how a certificate of its kind would bind it.
|
|
47
|
+
*/
|
|
48
|
+
export declare function claimReviewInstruction(row: ProofContractClaimsReview): string;
|
|
36
49
|
/**
|
|
37
50
|
* Add proves to a test's proof_contract block, leaving every other byte of
|
|
38
51
|
* the document unchanged: the list goes after the block's last line, at the
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"proof-contract-claims.d.ts","sourceRoot":"","sources":["../../../src/operations/migration/proof-contract-claims.ts"],"names":[],"mappings":"AAsBA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAQlE,+EAA+E;AAE/E,eAAO,MAAM,8BAA8B,8BAA8B,CAAC;AAE1E,2EAA2E;AAE3E,eAAO,MAAM,iCAAiC,iCAAiC,CAAC;AAEhF
|
|
1
|
+
{"version":3,"file":"proof-contract-claims.d.ts","sourceRoot":"","sources":["../../../src/operations/migration/proof-contract-claims.ts"],"names":[],"mappings":"AAsBA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAQlE,+EAA+E;AAE/E,eAAO,MA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,GAAG,IAAI,CAwCf;AAED;;;;;GAKG;AAEH,wBAAgB,0BAA0B,CACxC,aAAa,EAAE,MAAM,EACrB,IAAI,EAAE,SAAS,iBAAiB,EAAE,GAAG,IAAI,GACxC,uBAAuB,CA+CzB;AAGD,wBAAgB,2BAA2B,CACzC,aAAa,EAAE,MAAM,EACrB,IAAI,EAAE,SAAS,iBAAiB,EAAE,GAAG,IAAI,GACxC,uBAAuB,CAKzB;AAED;;;;;GAKG;AAEH,wBAAsB,gCAAgC,CACpD,aAAa,EAAE,MAAM,GACpB,OAAO,CAAC,SAAS,iBAAiB,EAAE,GAAG,IAAI,CAAC,CA6C9C"}
|
|
@@ -26,6 +26,35 @@ export const PROOF_CONTRACT_CLAIMS_PIN_CODE = "proof_contract_claims_pin";
|
|
|
26
26
|
/** Schema 12: certificate contracts a person must bind to their claims. */
|
|
27
27
|
// implements REQ-kibi-claim-bound-proofs, REQ-cli-schema-migration
|
|
28
28
|
export const PROOF_CONTRACT_CLAIMS_REVIEW_CODE = "proof_contract_claims_review";
|
|
29
|
+
function describeCandidate(candidate) {
|
|
30
|
+
const where = `${candidate.claim_key} (${candidate.requirement_id}, ${candidate.fact_id})`;
|
|
31
|
+
if (candidate.binding === "derived")
|
|
32
|
+
return `${where}: provable`;
|
|
33
|
+
if (candidate.binding === "attested")
|
|
34
|
+
return `${where}: attested only, the fact has no derivation`;
|
|
35
|
+
return `${where}: ${candidate.reason ?? "its kind cannot express the fact"}`;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* What a person reviewing a contract without proves has to do, naming every
|
|
39
|
+
* claim its test reaches and how a certificate of its kind would bind it.
|
|
40
|
+
*/
|
|
41
|
+
// implements REQ-kibi-claim-bound-proofs, REQ-cli-schema-migration
|
|
42
|
+
export function claimReviewInstruction(row) {
|
|
43
|
+
const factKind = row.kind === "exhaustive" || row.kind === "typecheck"
|
|
44
|
+
? "set"
|
|
45
|
+
: row.kind === "regex"
|
|
46
|
+
? "string"
|
|
47
|
+
: row.kind === "rule" || row.kind === "state_machine"
|
|
48
|
+
? "rule, predicate or set"
|
|
49
|
+
: "numeric";
|
|
50
|
+
if (row.candidates.length === 0)
|
|
51
|
+
return `${row.id} (${row.path}) has a ${row.kind} proof contract, but its test reaches no modeled claim through a scenario. Link the test to the scenario of the requirement it proves, then add proof_contract.proves with the claim keys its certificate establishes and run kibi prove --test ${row.id}.`;
|
|
52
|
+
const derived = row.candidates.filter((c) => c.binding === "derived");
|
|
53
|
+
const advice = derived.length > 1
|
|
54
|
+
? "Add proof_contract.proves with the claim keys its certificate establishes"
|
|
55
|
+
: `None is provable by a ${row.kind} certificate as modeled: add proof_contract.proves with the claim it establishes (it then counts as attested, not proved), or model that claim's grounding fact as a ${factKind} fact first`;
|
|
56
|
+
return `${row.id} (${row.path}) has a ${row.kind} proof contract without proves. Claims its test reaches: ${row.candidates.map(describeCandidate).join("; ")}. ${advice}, then run kibi prove --test ${row.id}.`;
|
|
57
|
+
}
|
|
29
58
|
function isRecord(value) {
|
|
30
59
|
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
31
60
|
}
|
|
@@ -105,13 +134,17 @@ export function planProofContractClaimPins(workspaceRoot, rows) {
|
|
|
105
134
|
const row = entity === null ? undefined : byTest.get(entity.id);
|
|
106
135
|
if (entity === null || row === undefined)
|
|
107
136
|
continue;
|
|
108
|
-
const keys = [
|
|
137
|
+
const keys = [
|
|
138
|
+
...new Set(row.candidates
|
|
139
|
+
.filter((c) => c.binding === "derived")
|
|
140
|
+
.map((c) => c.claim_key)),
|
|
141
|
+
].sort();
|
|
109
142
|
if (keys.length !== 1) {
|
|
110
143
|
review.push({
|
|
111
144
|
id: entity.id,
|
|
112
145
|
path: file.relativePath,
|
|
113
146
|
kind: row.kind,
|
|
114
|
-
candidates:
|
|
147
|
+
candidates: row.candidates,
|
|
115
148
|
});
|
|
116
149
|
continue;
|
|
117
150
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema6.d.ts","sourceRoot":"","sources":["../../../src/operations/migration/schema6.ts"],"names":[],"mappings":"AAyBA,OAAO,EACL,KAAK,eAAe,EAErB,MAAM,2CAA2C,CAAC;AAEnD,OAAO,EAEL,kCAAkC,EAClC,wBAAwB,EACxB,mBAAmB,EAEnB,wBAAwB,EAOzB,MAAM,kDAAkD,CAAC;AAkB1D,OAAO,EAEL,KAAK,mBAAmB,EAGzB,MAAM,qBAAqB,CAAC;AAmB7B,OAAO,EACL,KAAK,iBAAiB,
|
|
1
|
+
{"version":3,"file":"schema6.d.ts","sourceRoot":"","sources":["../../../src/operations/migration/schema6.ts"],"names":[],"mappings":"AAyBA,OAAO,EACL,KAAK,eAAe,EAErB,MAAM,2CAA2C,CAAC;AAEnD,OAAO,EAEL,kCAAkC,EAClC,wBAAwB,EACxB,mBAAmB,EAEnB,wBAAwB,EAOzB,MAAM,kDAAkD,CAAC;AAkB1D,OAAO,EAEL,KAAK,mBAAmB,EAGzB,MAAM,qBAAqB,CAAC;AAmB7B,OAAO,EACL,KAAK,iBAAiB,EAKvB,MAAM,4BAA4B,CAAC;AAqCpC,gEAAgE;AAEhE,eAAO,MAAM,qBAAqB,IAAI,CAAC;AAEvC,+EAA+E;AAE/E,eAAO,MAAM,2BAA2B,IAAI,CAAC;AAE7C,4DAA4D;AAE5D,eAAO,MAAM,gCAAgC,IAAI,CAAC;AAElD,yEAAyE;AAEzE,eAAO,MAAM,gCAAgC,gCAAgC,CAAC;AAC9E,gEAAgE;AAEhE,eAAO,MAAM,8BAA8B,8BAA8B,CAAC;AAC1E;;;GAGG;AAEH,eAAO,MAAM,+CAA+C,+CACd,CAAC;AAC/C,iFAAiF;AAEjF,eAAO,MAAM,8BAA8B,8BAA8B,CAAC;AAC1E,+EAA+E;AAE/E,eAAO,MAAM,6BAA6B,6BAA6B,CAAC;AAExE,eAAO,MAAM,kCAAkC,6BAA6B,CAAC;AAC7E,yEAAyE;AAEzE,eAAO,MAAM,2BAA2B,2BAA2B,CAAC;AAEpE,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AAS,MAAM,EAAE,GAC3B,eAAe,CAEjB;AAgDD,KAAK,YAAY,GAAG,QAAQ,CAAC;IAC3B,aAAa,EAAE,MAAM,CAAC;IACtB,KAAK,EAAE,MAAM,IAAI,CAAC;CACnB,CAAC,CAAC;AAEH,4DAA4D;AAE5D,wBAAsB,2BAA2B,CAC/C,MAAM,EAAE,eAAe,EACvB,OAAO,EAAE,YAAY,GACpB,OAAO,CAAC,IAAI,CAAC,CA8Jf;AAED;;;GAGG;AAEH,eAAO,MAAM,+BAA+B,EAAE,WAAW,CAAC,MAAM,CAK9D,CAAC;AAGH,eAAO,MAAM,uBAAuB,EAAE,WAAW,CAAC,MAAM,CAetD,CAAC"}
|
|
@@ -32,7 +32,7 @@ import { applyInventoryRederivation, applyInventoryRederivationDroppingGrounding
|
|
|
32
32
|
import { listLaneMarkdownFiles } from "./kb-sources.js";
|
|
33
33
|
import { applyOriginBackfill, planOriginBackfill } from "./origin-backfill.js";
|
|
34
34
|
import { POLARITY_VALUE_BACKFILL_CODE, applyPolarityValueBackfill, planPolarityValueBackfill, } from "./polarity-values.js";
|
|
35
|
-
import { PROOF_CONTRACT_CLAIMS_PIN_CODE, PROOF_CONTRACT_CLAIMS_REVIEW_CODE, planProofContractClaimPins, } from "./proof-contract-claims.js";
|
|
35
|
+
import { PROOF_CONTRACT_CLAIMS_PIN_CODE, PROOF_CONTRACT_CLAIMS_REVIEW_CODE, claimReviewInstruction, planProofContractClaimPins, } from "./proof-contract-claims.js";
|
|
36
36
|
import { DELIVERED_REQUIREMENT_TAG, applyDeliveredStatusMappings, applyRequirementStatusMapping, planRequirementStatusMappings, } from "./requirement-status.js";
|
|
37
37
|
import { applySourcePathRepairs, findSourceRepairs, plannedSourcePathRepairs, } from "./source-paths.js";
|
|
38
38
|
import { applySupersededClosures, planSupersededClosures, } from "./superseded-closure.js";
|
|
@@ -653,9 +653,7 @@ export function buildSchema6MigrationFragment(input) {
|
|
|
653
653
|
safety: "review",
|
|
654
654
|
invocation: {
|
|
655
655
|
kind: "review",
|
|
656
|
-
instruction: row
|
|
657
|
-
? `${row.id} (${row.path}) has a ${row.kind} proof contract but reaches no claim ${/^[aeiou]/.test(row.kind) ? "an" : "a"} ${row.kind} certificate can derive an obligation for. Add proof_contract.proves with the claim key its certificate establishes (it then counts as attested, not proved), or model that claim's grounding fact as a ${row.kind === "exhaustive" || row.kind === "typecheck" ? "set" : "numeric"} fact first. Then run kibi prove --test ${row.id}.`
|
|
658
|
-
: `${row.id} (${row.path}) has a ${row.kind} proof contract and could prove any of ${row.candidates.join(", ")}. Add proof_contract.proves with the claim keys its certificate establishes, then run kibi prove --test ${row.id}.`,
|
|
656
|
+
instruction: claimReviewInstruction(row),
|
|
659
657
|
},
|
|
660
658
|
affectedEntityIds: [row.id],
|
|
661
659
|
affectedFiles: [row.path],
|
|
@@ -22,8 +22,9 @@ export type MigrationCoordinateRefresh = {
|
|
|
22
22
|
* `kibi sync --refresh-symbol-coordinates` does, after a migration rewrote or
|
|
23
23
|
* moved the symbols manifest. The coordinate artifact binds each record by an
|
|
24
24
|
* identity hash that includes `granularity_reason`, so a legacy-link mark
|
|
25
|
-
* leaves the
|
|
26
|
-
*
|
|
25
|
+
* leaves the local coordinates stale, and the refresh also writes the
|
|
26
|
+
* symbols manifest in the canonical layout the pre-commit
|
|
27
|
+
* generated-manifest gate expects for the first commit after a migration.
|
|
27
28
|
*
|
|
28
29
|
* Skipped when `before` shows the run left both files untouched, or when the
|
|
29
30
|
* manifest has no symbols. A refresh failure is returned, not thrown: the
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"symbol-coordinates-refresh.d.ts","sourceRoot":"","sources":["../../../src/operations/migration/symbol-coordinates-refresh.ts"],"names":[],"mappings":"AA0BA;;;GAGG;AAEH,MAAM,MAAM,sBAAsB,GAAG,QAAQ,CAAC;IAC5C,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;CAC5B,CAAC,CAAC;AAMH,yEAAyE;AAEzE,wBAAgB,0BAA0B,CACxC,aAAa,EAAE,MAAM,GACpB,sBAAsB,CAMxB;AAYD,sDAAsD;AAEtD,MAAM,MAAM,0BAA0B,GAClC;IAAE,OAAO,EAAE,SAAS,CAAA;CAAE,GACtB;IAAE,OAAO,EAAE,WAAW,CAAA;CAAE,GACxB;IAAE,OAAO,EAAE,QAAQ,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC;AAE1C
|
|
1
|
+
{"version":3,"file":"symbol-coordinates-refresh.d.ts","sourceRoot":"","sources":["../../../src/operations/migration/symbol-coordinates-refresh.ts"],"names":[],"mappings":"AA0BA;;;GAGG;AAEH,MAAM,MAAM,sBAAsB,GAAG,QAAQ,CAAC;IAC5C,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;CAC5B,CAAC,CAAC;AAMH,yEAAyE;AAEzE,wBAAgB,0BAA0B,CACxC,aAAa,EAAE,MAAM,GACpB,sBAAsB,CAMxB;AAYD,sDAAsD;AAEtD,MAAM,MAAM,0BAA0B,GAClC;IAAE,OAAO,EAAE,SAAS,CAAA;CAAE,GACtB;IAAE,OAAO,EAAE,WAAW,CAAA;CAAE,GACxB;IAAE,OAAO,EAAE,QAAQ,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC;AAE1C;;;;;;;;;;;;;GAaG;AAEH,wBAAsB,gCAAgC,CACpD,aAAa,EAAE,MAAM,EACrB,MAAM,CAAC,EAAE,sBAAsB,GAC9B,OAAO,CAAC,0BAA0B,CAAC,CA0CrC;AAED,sEAAsE;AAEtE,wBAAgB,+BAA+B,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAEtE"}
|
|
@@ -49,8 +49,9 @@ function hasSymbols(content) {
|
|
|
49
49
|
* `kibi sync --refresh-symbol-coordinates` does, after a migration rewrote or
|
|
50
50
|
* moved the symbols manifest. The coordinate artifact binds each record by an
|
|
51
51
|
* identity hash that includes `granularity_reason`, so a legacy-link mark
|
|
52
|
-
* leaves the
|
|
53
|
-
*
|
|
52
|
+
* leaves the local coordinates stale, and the refresh also writes the
|
|
53
|
+
* symbols manifest in the canonical layout the pre-commit
|
|
54
|
+
* generated-manifest gate expects for the first commit after a migration.
|
|
54
55
|
*
|
|
55
56
|
* Skipped when `before` shows the run left both files untouched, or when the
|
|
56
57
|
* manifest has no symbols. A refresh failure is returned, not thrown: the
|
|
@@ -95,5 +96,5 @@ export async function refreshCoordinatesAfterMigration(workspaceRoot, before) {
|
|
|
95
96
|
/** The line a migration prints when its coordinate refresh failed. */
|
|
96
97
|
// implements REQ-cli-migration-first-commit
|
|
97
98
|
export function coordinateRefreshFailureMessage(reason) {
|
|
98
|
-
return `Could not refresh symbol coordinates after the migration (${reason}). Run 'kibi sync --refresh-symbol-coordinates' and stage .kb/symbols.yaml
|
|
99
|
+
return `Could not refresh symbol coordinates after the migration (${reason}). Run 'kibi sync --refresh-symbol-coordinates' and stage .kb/symbols.yaml before the first commit, or the pre-commit hook reports generated manifest drift.`;
|
|
99
100
|
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/** Schema version from which symbol coordinates are derived and never tracked. */
|
|
2
|
+
export declare const DERIVED_COORDINATES_SCHEMA_VERSION = 13;
|
|
3
|
+
/** What the schema 13 untracking step did to the Git index. */
|
|
4
|
+
export type CoordinateUntrackOutcome = {
|
|
5
|
+
outcome: "untracked";
|
|
6
|
+
} | {
|
|
7
|
+
outcome: "not_tracked";
|
|
8
|
+
} | {
|
|
9
|
+
outcome: "not_a_repository";
|
|
10
|
+
} | {
|
|
11
|
+
outcome: "failed";
|
|
12
|
+
reason: string;
|
|
13
|
+
};
|
|
14
|
+
/** True when the derived coordinate artifact is in the Git index. */
|
|
15
|
+
export declare function isCoordinateArtifactTracked(cwd: string): boolean | null;
|
|
16
|
+
/**
|
|
17
|
+
* Remove `.kb/symbol-coordinates.yaml` from the Git index and keep the local
|
|
18
|
+
* file. Symbol coordinates are derived from source by every sync and are
|
|
19
|
+
* gitignored from schema 13; tracking them made every two branches that
|
|
20
|
+
* touch the same source file conflict.
|
|
21
|
+
*/
|
|
22
|
+
export declare function untrackCoordinateArtifact(cwd: string): CoordinateUntrackOutcome;
|
|
23
|
+
//# sourceMappingURL=untrack-symbol-coordinates.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"untrack-symbol-coordinates.d.ts","sourceRoot":"","sources":["../../../src/operations/migration/untrack-symbol-coordinates.ts"],"names":[],"mappings":"AAqBA,kFAAkF;AAClF,eAAO,MAAM,kCAAkC,KAAK,CAAC;AAErD,+DAA+D;AAE/D,MAAM,MAAM,wBAAwB,GAChC;IAAE,OAAO,EAAE,WAAW,CAAA;CAAE,GACxB;IAAE,OAAO,EAAE,aAAa,CAAA;CAAE,GAC1B;IAAE,OAAO,EAAE,kBAAkB,CAAA;CAAE,GAC/B;IAAE,OAAO,EAAE,QAAQ,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC;AAM1C,qEAAqE;AAErE,wBAAgB,2BAA2B,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,GAAG,IAAI,CAUvE;AAED;;;;;GAKG;AAEH,wBAAgB,yBAAyB,CACvC,GAAG,EAAE,MAAM,GACV,wBAAwB,CAkB1B"}
|
|
@@ -0,0 +1,67 @@
|
|
|
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 { spawnSync } from "node:child_process";
|
|
19
|
+
import { KB_PATHS } from "../../utils/kb-paths.js";
|
|
20
|
+
/** Schema version from which symbol coordinates are derived and never tracked. */
|
|
21
|
+
export const DERIVED_COORDINATES_SCHEMA_VERSION = 13;
|
|
22
|
+
function git(cwd, args) {
|
|
23
|
+
return spawnSync("git", args, { cwd, encoding: "utf8" });
|
|
24
|
+
}
|
|
25
|
+
/** True when the derived coordinate artifact is in the Git index. */
|
|
26
|
+
// implements REQ-symbol-coordinates-derived-locally
|
|
27
|
+
export function isCoordinateArtifactTracked(cwd) {
|
|
28
|
+
const result = git(cwd, [
|
|
29
|
+
"ls-files",
|
|
30
|
+
"--error-unmatch",
|
|
31
|
+
"--",
|
|
32
|
+
KB_PATHS.symbolCoordinates,
|
|
33
|
+
]);
|
|
34
|
+
if (result.error)
|
|
35
|
+
return null;
|
|
36
|
+
if (result.status === 0)
|
|
37
|
+
return true;
|
|
38
|
+
return /did not match any file/.test(result.stderr) ? false : null;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Remove `.kb/symbol-coordinates.yaml` from the Git index and keep the local
|
|
42
|
+
* file. Symbol coordinates are derived from source by every sync and are
|
|
43
|
+
* gitignored from schema 13; tracking them made every two branches that
|
|
44
|
+
* touch the same source file conflict.
|
|
45
|
+
*/
|
|
46
|
+
// implements REQ-symbol-coordinates-derived-locally
|
|
47
|
+
export function untrackCoordinateArtifact(cwd) {
|
|
48
|
+
const tracked = isCoordinateArtifactTracked(cwd);
|
|
49
|
+
if (tracked === null)
|
|
50
|
+
return { outcome: "not_a_repository" };
|
|
51
|
+
if (!tracked)
|
|
52
|
+
return { outcome: "not_tracked" };
|
|
53
|
+
const result = git(cwd, [
|
|
54
|
+
"rm",
|
|
55
|
+
"--cached",
|
|
56
|
+
"--quiet",
|
|
57
|
+
"--",
|
|
58
|
+
KB_PATHS.symbolCoordinates,
|
|
59
|
+
]);
|
|
60
|
+
if (result.error || result.status !== 0) {
|
|
61
|
+
return {
|
|
62
|
+
outcome: "failed",
|
|
63
|
+
reason: (result.error?.message ?? result.stderr).trim(),
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
return { outcome: "untracked" };
|
|
67
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"requirement-modeler.d.ts","sourceRoot":"","sources":["../../../src/operations/modeling/requirement-modeler.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"requirement-modeler.d.ts","sourceRoot":"","sources":["../../../src/operations/modeling/requirement-modeler.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EACV,yBAAyB,EACzB,oBAAoB,EACrB,MAAM,wBAAwB,CAAC;AA4BhC,wBAAgB,iCAAiC,CAC/C,SAAS,EAAE,MAAM,EACjB,OAAO,CAAC,EAAE,MAAM,GACf,MAAM,CAUR;AAGD,wBAAgB,uBAAuB,CACrC,IAAI,EAAE,oBAAoB,GACzB,yBAAyB,GAAG;IAC7B,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,EAAE,CAAC;CACvB,CA0EA"}
|
|
@@ -1,5 +1,11 @@
|
|
|
1
|
+
import { detectStrictSuggestion } from "../semantic-advisor/strict-rules.js";
|
|
1
2
|
import { buildFallbackClaim, extractHeuristicClaim, } from "./requirement-heuristics.js";
|
|
2
3
|
import { clampConfidence, normalizeClaimValue, normalizeOptionalString, normalizeSourceFiles, normalizeText, stripListPrefix, } from "./requirement-utils.js";
|
|
4
|
+
const SET_OPERATORS = new Set([
|
|
5
|
+
"includes",
|
|
6
|
+
"subset_of",
|
|
7
|
+
"excludes",
|
|
8
|
+
]);
|
|
3
9
|
const NORMATIVE_SECTION_PATTERN = /\b(requirements?|polic(?:y|ies)|rules?)\b/i;
|
|
4
10
|
function hasExplicitClaimFields(args) {
|
|
5
11
|
return (args.subjectKey !== undefined ||
|
|
@@ -40,12 +46,18 @@ export function extractRequirementClaim(args) {
|
|
|
40
46
|
args.value === undefined) {
|
|
41
47
|
throw new Error("Requirement modeling failed: subjectKey, propertyKey, operator, and value must all be provided when any extracted claim field is supplied");
|
|
42
48
|
}
|
|
49
|
+
const value = normalizeClaimValue(args.value);
|
|
50
|
+
const setOperator = SET_OPERATORS.has(args.operator);
|
|
51
|
+
if (setOperator && !Array.isArray(value))
|
|
52
|
+
throw new Error(`Requirement modeling failed: operator ${args.operator} takes a set value (a list of strings)`);
|
|
53
|
+
if (Array.isArray(value) && !setOperator && args.operator !== "eq")
|
|
54
|
+
throw new Error(`Requirement modeling failed: a set value takes operator eq, includes, subset_of or excludes, not ${args.operator}`);
|
|
43
55
|
const claim = {
|
|
44
56
|
source,
|
|
45
57
|
subjectKey,
|
|
46
58
|
propertyKey,
|
|
47
59
|
operator: args.operator,
|
|
48
|
-
value
|
|
60
|
+
value,
|
|
49
61
|
confidence,
|
|
50
62
|
...(provenance ? { provenance } : {}),
|
|
51
63
|
};
|
|
@@ -58,6 +70,13 @@ export function extractRequirementClaim(args) {
|
|
|
58
70
|
extractionWarnings: [],
|
|
59
71
|
};
|
|
60
72
|
}
|
|
73
|
+
// implements REQ-kibi-source-proof-kinds
|
|
74
|
+
// Set and pattern claims (every route uses a middleware, a state can never
|
|
75
|
+
// reach another, a format) take the advisor's strict shapes, so the fact is
|
|
76
|
+
// one a source, state_machine or regex proof can derive.
|
|
77
|
+
const strict = strictSetClaim(statement, source, confidence, provenance);
|
|
78
|
+
if (strict)
|
|
79
|
+
return { statement, source, sourceFiles, ...strict };
|
|
61
80
|
const heuristic = extractHeuristicClaim(statement, source, confidence, provenance);
|
|
62
81
|
if (heuristic)
|
|
63
82
|
return { statement, source, sourceFiles, ...heuristic };
|
|
@@ -68,3 +87,31 @@ export function extractRequirementClaim(args) {
|
|
|
68
87
|
...buildFallbackClaim(statement, source, confidence, provenance),
|
|
69
88
|
};
|
|
70
89
|
}
|
|
90
|
+
/** A set or pattern claim from the advisor's strict shapes, or null. */
|
|
91
|
+
function strictSetClaim(statement, source, confidence, provenance) {
|
|
92
|
+
const normalized = stripListPrefix(statement);
|
|
93
|
+
const suggestion = detectStrictSuggestion({ semantic_text: normalized }, normalized);
|
|
94
|
+
if (suggestion?.kind !== "strict_property")
|
|
95
|
+
return null;
|
|
96
|
+
const strict = suggestion.claim;
|
|
97
|
+
const value = strict.value_type === "set" && strict.value_set !== undefined
|
|
98
|
+
? [...strict.value_set]
|
|
99
|
+
: strict.operator === "matches" && strict.value_string !== undefined
|
|
100
|
+
? strict.value_string
|
|
101
|
+
: undefined;
|
|
102
|
+
if (value === undefined)
|
|
103
|
+
return null;
|
|
104
|
+
return {
|
|
105
|
+
claim: {
|
|
106
|
+
source,
|
|
107
|
+
subjectKey: strict.subject_key,
|
|
108
|
+
propertyKey: strict.property_key,
|
|
109
|
+
operator: strict.operator,
|
|
110
|
+
value,
|
|
111
|
+
confidence,
|
|
112
|
+
...(provenance ? { provenance } : {}),
|
|
113
|
+
},
|
|
114
|
+
extractionMode: "heuristic",
|
|
115
|
+
extractionWarnings: [],
|
|
116
|
+
};
|
|
117
|
+
}
|
|
@@ -9,7 +9,8 @@ export type ModelRequirementArgs = Readonly<Record<string, unknown>> & {
|
|
|
9
9
|
readonly subjectKey?: string;
|
|
10
10
|
readonly propertyKey?: string;
|
|
11
11
|
readonly operator?: SemanticClaim["operator"];
|
|
12
|
-
|
|
12
|
+
/** A list of strings is a set value (operators eq, includes, subset_of, excludes). */
|
|
13
|
+
readonly value?: string | number | boolean | readonly string[];
|
|
13
14
|
readonly provenance?: string;
|
|
14
15
|
/** Existing requirement claim manifest. Returned req updates merge this list. */
|
|
15
16
|
readonly existingLogicClaims?: readonly string[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"requirement-types.d.ts","sourceRoot":"","sources":["../../../src/operations/modeling/requirement-types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,KAAK,EACV,aAAa,EACb,cAAc,EACf,MAAM,6BAA6B,CAAC;AACrC,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,2BAA2B,CAAC;AAG5E,MAAM,MAAM,oBAAoB,GAAG,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,GAAG;IACrE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;IAChC,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,QAAQ,CAAC,EAAE,aAAa,CAAC,UAAU,CAAC,CAAC;IAC9C,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"requirement-types.d.ts","sourceRoot":"","sources":["../../../src/operations/modeling/requirement-types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,KAAK,EACV,aAAa,EACb,cAAc,EACf,MAAM,6BAA6B,CAAC;AACrC,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,2BAA2B,CAAC;AAG5E,MAAM,MAAM,oBAAoB,GAAG,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,GAAG;IACrE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB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E,MAAM,EAAE,CAAC;QACtB,KAAK,EAAE,aAAa,CAAC;QACrB,QAAQ,EAAE,cAAc,CAAC;QACzB,SAAS,EAAE,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;QAC1C,QAAQ,EAAE,OAAO,CAAC;QAClB,UAAU,EAAE,MAAM,CAAC;QACnB,cAAc,EAAE,UAAU,GAAG,WAAW,GAAG,UAAU,CAAC;QACtD,kBAAkB,EAAE,MAAM,EAAE,CAAC;QAC7B,QAAQ,EAAE,KAAK,CAAC;YACd,IAAI,EAAE,MAAM,CAAC;YACb,OAAO,EAAE,MAAM,CAAC;YAChB,UAAU,EAAE,MAAM,CAAC;SACpB,CAAC,CAAC;QACH,gBAAgB,EAAE,MAAM,GAAG,IAAI,CAAC;QAChC,uEAAuE;QACvE,mBAAmB,CAAC,EAAE,0BAA0B,GAAG;YACjD,QAAQ,CAAC,UAAU,EAAE,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;SACrD,CAAC;QACF,KAAK,CAAC,EAAE;YACN,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;YAC7B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;YAC1B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;YAC3B,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;YAChC,QAAQ,CAAC,UAAU,EAAE,WAAW,CAAC;SAClC,CAAC;KACH,CAAC;IACF,SAAS,EAAE,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;IAC1C,QAAQ,EAAE,cAAc,CAAC;IACzB,gBAAgB,EAAE,MAAM,GAAG,IAAI,CAAC;CACjC"}
|
|
@@ -2,7 +2,7 @@ export declare function normalizeText(text: string): string;
|
|
|
2
2
|
export declare function normalizeOptionalString(value: string | undefined): string | undefined;
|
|
3
3
|
export declare function normalizeSourceFiles(sourceFiles: string[] | undefined): string[];
|
|
4
4
|
export declare function clampConfidence(confidence: number | undefined): number;
|
|
5
|
-
export declare function normalizeClaimValue(value: unknown): string | number | boolean;
|
|
5
|
+
export declare function normalizeClaimValue(value: unknown): string | number | boolean | readonly string[];
|
|
6
6
|
export declare function stripListPrefix(value: string): string;
|
|
7
7
|
export declare function trimSentenceTail(value: string): string;
|
|
8
8
|
export declare function cleanSubject(value: string): string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"requirement-utils.d.ts","sourceRoot":"","sources":["../../../src/operations/modeling/requirement-utils.ts"],"names":[],"mappings":"AACA,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAQlD;AAGD,wBAAgB,uBAAuB,CACrC,KAAK,EAAE,MAAM,GAAG,SAAS,GACxB,MAAM,GAAG,SAAS,CAGpB;AAGD,wBAAgB,oBAAoB,CAClC,WAAW,EAAE,MAAM,EAAE,GAAG,SAAS,GAChC,MAAM,EAAE,CAUV;AAGD,wBAAgB,eAAe,CAAC,UAAU,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,CAMtE;AAGD,wBAAgB,mBAAmB,
|
|
1
|
+
{"version":3,"file":"requirement-utils.d.ts","sourceRoot":"","sources":["../../../src/operations/modeling/requirement-utils.ts"],"names":[],"mappings":"AACA,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAQlD;AAGD,wBAAgB,uBAAuB,CACrC,KAAK,EAAE,MAAM,GAAG,SAAS,GACxB,MAAM,GAAG,SAAS,CAGpB;AAGD,wBAAgB,oBAAoB,CAClC,WAAW,EAAE,MAAM,EAAE,GAAG,SAAS,GAChC,MAAM,EAAE,CAUV;AAGD,wBAAgB,eAAe,CAAC,UAAU,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,CAMtE;AAGD,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,OAAO,GACb,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,SAAS,MAAM,EAAE,CA2B/C;AAGD,wBAAgB,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAKrD;AAGD,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAEtD;AAGD,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAGlD;AAGD,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAEpD"}
|
|
@@ -33,6 +33,13 @@ export function clampConfidence(confidence) {
|
|
|
33
33
|
}
|
|
34
34
|
// implements REQ-002
|
|
35
35
|
export function normalizeClaimValue(value) {
|
|
36
|
+
// implements REQ-kibi-source-proof-kinds
|
|
37
|
+
if (Array.isArray(value)) {
|
|
38
|
+
const members = value.map((member) => typeof member === "string" ? member.trim() : "");
|
|
39
|
+
if (members.length === 0 || members.some((member) => member === ""))
|
|
40
|
+
throw new Error("Requirement modeling failed: a set value must be a non-empty list of non-empty strings");
|
|
41
|
+
return [...new Set(members)].sort();
|
|
42
|
+
}
|
|
36
43
|
if (typeof value === "string" ||
|
|
37
44
|
typeof value === "number" ||
|
|
38
45
|
typeof value === "boolean") {
|
|
@@ -41,7 +48,7 @@ export function normalizeClaimValue(value) {
|
|
|
41
48
|
}
|
|
42
49
|
return value;
|
|
43
50
|
}
|
|
44
|
-
throw new Error("Requirement modeling failed: value must be a string, number, or
|
|
51
|
+
throw new Error("Requirement modeling failed: value must be a string, number, boolean, or a list of strings");
|
|
45
52
|
}
|
|
46
53
|
// implements REQ-002
|
|
47
54
|
export function stripListPrefix(value) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"source-authoring.d.ts","sourceRoot":"","sources":["../../../src/operations/mutation/source-authoring.ts"],"names":[],"mappings":"AAkBA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,0CAA0C,CAAC;AAOjF,OAAO,KAAK,EAAqB,WAAW,EAAE,MAAM,YAAY,CAAC;AAEjE,MAAM,MAAM,kBAAkB,GAAG,QAAQ,CA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AI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,OAAO,CAAA;CAAE,
|
|
1
|
+
{"version":3,"file":"source-authoring.d.ts","sourceRoot":"","sources":["../../../src/operations/mutation/source-authoring.ts"],"names":[],"mappings":"AAkBA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,0CAA0C,CAAC;AAOjF,OAAO,KAAK,EAAqB,WAAW,EAAE,MAAM,YAAY,CAAC;AAEjE,MAAM,MAAM,kBAAkB,GAAG,QAAQ,CAAC;IACxC,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,OAAO,GAAG,QAAQ,CAAC;IACzB,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,OAAO,EAAE,OAAO,CAAC;CAClB,CAAC,CAAC;AAmBH,wBAAgB,yBAAyB,CACvC,aAAa,EAAE,MAAM,EACrB,YAAY,EAAE,MAAM,EACpB,SAAS,EAAE,MAAM,GAChB,IAAI,CAiBN;AAED,KAAK,SAAS,GAAG,QAAQ,CAAC;IAAE,KAAK,EAAE,IAAI,CAAC;IAAC,KAAK,EAAE,IAAI,CAAA;CAAE,CAAC,CAAC;AAExD,8EAA8E;AAE9E,wBAAgB,aAAa,CAAC,YAAY,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,CAOpE;AAED;;;;GAIG;AAEH,wBAAgB,gBAAgB,CAC9B,YAAY,EAAE,MAAM,EACpB,KAAK,EAAE,SAAS,GAAG,IAAI,GACtB,IAAI,CAON;AAeD;;;;GAIG;AAEH,wBAAgB,0BAA0B,CACxC,aAAa,EAAE,MAAM,EACrB,YAAY,EAAE,MAAM,GACnB,IAAI,CAMN;AAED;;;;;;GAMG;AAEH,wBAAgB,6BAA6B,CAC3C,aAAa,EAAE,MAAM,EACrB,YAAY,EAAE,MAAM,EACpB,SAAS,EAAE,MAAM,GAChB,OAAO,CA8BT;AAgBD,wBAAgB,0BAA0B,CACxC,aAAa,E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ACf,CAAC,CAoBD;AAED,wBAAsB,oBAAoB,CACxC,KAAK,EAAE,WAAW,EAClB,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,EACzC,QAAQ,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,EAC5C,OAAO,CAAC,EAAE,gBAAgB,EAC1B,sBAAsB,CAAC,EAAE,MAAM,GAC9B,OAAO,CAAC;IACT,OAAO,EAAE,kBAAkB,CAAC;IAC5B,QAAQ,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CAC/B,GAAG,IAAI,CAAC,CAoIR;AAED,uEAAuE;AACvE,wBAAgB,mBAAmB,CACjC,OAAO,EAAE,gBAAgB,EACzB,KAAK,EAAE,WAAW,EAClB,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,EACzC,QAAQ,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,GAC3C,MAAM,CAOR"}
|
|
@@ -806,28 +806,47 @@ export function renderYamlRelationshipDeletion(sourcePathValue, existingContent,
|
|
|
806
806
|
if (!symbol || typeof symbol !== "object" || !("get" in symbol)) {
|
|
807
807
|
return { body: existingContent, removed: false };
|
|
808
808
|
}
|
|
809
|
-
const
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
!("items" in relationships)) {
|
|
813
|
-
return { body: existingContent, removed: false };
|
|
814
|
-
}
|
|
815
|
-
const relationshipItems = relationships.items;
|
|
809
|
+
const symbolNode = symbol;
|
|
810
|
+
const sameTarget = (value) => typeof value === "string" &&
|
|
811
|
+
value.replace(/^kb:entity\//, "") === selector.to;
|
|
816
812
|
let removed = false;
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
const
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
813
|
+
const relationships = symbolNode.get("relationships", true);
|
|
814
|
+
if (relationships &&
|
|
815
|
+
typeof relationships === "object" &&
|
|
816
|
+
"items" in relationships) {
|
|
817
|
+
const relationshipItems = relationships.items;
|
|
818
|
+
for (let index = relationshipItems.length - 1; index >= 0; index -= 1) {
|
|
819
|
+
const item = relationshipItems[index];
|
|
820
|
+
if (!item || typeof item !== "object" || !("get" in item))
|
|
821
|
+
continue;
|
|
822
|
+
const node = item;
|
|
823
|
+
if (node.get("type") === selector.type &&
|
|
824
|
+
sameTarget(node.get("target") ?? node.get("to"))) {
|
|
825
|
+
relationships.delete(index);
|
|
826
|
+
removed = true;
|
|
827
|
+
}
|
|
828
|
+
}
|
|
829
|
+
}
|
|
830
|
+
// A legacy `links:` list declares implements edges too; leaving the entry
|
|
831
|
+
// would bring the deleted edge back on the next sync.
|
|
832
|
+
const links = symbolNode.get("links", true);
|
|
833
|
+
if (selector.type === "implements" &&
|
|
834
|
+
links &&
|
|
835
|
+
typeof links === "object" &&
|
|
836
|
+
"items" in links) {
|
|
837
|
+
const linkItems = links.items;
|
|
838
|
+
for (let index = linkItems.length - 1; index >= 0; index -= 1) {
|
|
839
|
+
const item = linkItems[index];
|
|
840
|
+
const value = item && typeof item === "object" && "value" in item
|
|
841
|
+
? item.value
|
|
842
|
+
: item;
|
|
843
|
+
if (sameTarget(value)) {
|
|
844
|
+
links.delete(index);
|
|
845
|
+
removed = true;
|
|
846
|
+
}
|
|
830
847
|
}
|
|
848
|
+
if (linkItems.length === 0)
|
|
849
|
+
symbolNode.delete("links");
|
|
831
850
|
}
|
|
832
851
|
return removed
|
|
833
852
|
? { body: doc.toString(AUTHORED_YAML_OPTIONS), removed: true }
|
|
@@ -7,6 +7,24 @@ import { type CertificateVerdict } from "./code-certificates.js";
|
|
|
7
7
|
* compiles only when the domain type has exactly the fact's members.
|
|
8
8
|
*/
|
|
9
9
|
export declare function setEqualityWitness(importPath: string, members: readonly string[], membersType: string): string;
|
|
10
|
+
/**
|
|
11
|
+
* The type-level witness Kibi writes for a required_fields claim binding: it
|
|
12
|
+
* compiles only when every field is a required key of the type whose value
|
|
13
|
+
* can be neither undefined nor null. Each field has its own two lines (`key<i>`
|
|
14
|
+
* that the field exists, `required<i>` that it is required and non-null), so
|
|
15
|
+
* a failed compile says which fields break the claim.
|
|
16
|
+
*/
|
|
17
|
+
export declare function requiredFieldsWitness(importPath: string, typeExpression: string, fields: readonly string[]): string;
|
|
18
|
+
/** Which fields a failed required-fields witness rejected, and how. */
|
|
19
|
+
export declare function requiredFieldsFailures(witness: string, fields: readonly string[], errorLines: readonly number[]): string[];
|
|
20
|
+
/**
|
|
21
|
+
* The evidence level a receipt records. A certificate that re-checks but
|
|
22
|
+
* derives none of the claims it names from the code proves nothing about
|
|
23
|
+
* the code, so the receipt supports tested, the level coverage reports. An
|
|
24
|
+
* intent-scope derivation rests on the knowledge base's own facts alone
|
|
25
|
+
* (the test read no value from the code), so it does not count either.
|
|
26
|
+
*/
|
|
27
|
+
export declare function receiptEvidenceLevel(level: "proved" | "tested", bindings: readonly ClaimBinding[] | undefined): "proved" | "tested";
|
|
10
28
|
/**
|
|
11
29
|
* How a certificate binds to each claim its contract names in proves. Kibi
|
|
12
30
|
* derives what the certificate must establish from each claim's grounding
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"claim-bindings.d.ts","sourceRoot":"","sources":["../../../src/operations/proof/claim-bindings.ts"],"names":[],"mappings":"AAyBA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,0CAA0C,CAAC;AACjF,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AACpE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAClE,OAAO,EACL,KAAK,kBAAkB,EAIxB,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"claim-bindings.d.ts","sourceRoot":"","sources":["../../../src/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