kibi-cli 2.31.1 → 2.35.1
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 +19 -7
- package/dist/cli-register-reporting.d.ts.map +1 -1
- package/dist/cli-register-reporting.js +2 -0
- 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/check.d.ts +1 -0
- package/dist/commands/check.d.ts.map +1 -1
- package/dist/commands/check.js +14 -5
- package/dist/commands/discovery-table.d.ts.map +1 -1
- package/dist/commands/discovery-table.js +51 -4
- package/dist/commands/doctor.js +19 -4
- 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 +109 -5
- package/dist/commands/prove.d.ts +48 -1
- package/dist/commands/prove.d.ts.map +1 -1
- package/dist/commands/prove.js +293 -8
- package/dist/commands/report.d.ts +1 -0
- package/dist/commands/report.d.ts.map +1 -1
- package/dist/commands/report.js +70 -5
- package/dist/commands/signoff.d.ts.map +1 -1
- package/dist/commands/signoff.js +20 -1
- 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 +106 -17
- package/dist/commands/sync/persistence.d.ts.map +1 -1
- package/dist/commands/sync/persistence.js +16 -5
- package/dist/commands/sync.d.ts.map +1 -1
- package/dist/commands/sync.js +19 -0
- package/dist/diagnostics.js +1 -1
- package/dist/engine.js +1 -1
- package/dist/extractors/markdown.d.ts +4 -2
- package/dist/extractors/markdown.d.ts.map +1 -1
- package/dist/extractors/markdown.js +17 -0
- 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/bootstrap/candidate-helpers.d.ts +3 -0
- package/dist/operations/bootstrap/candidate-helpers.d.ts.map +1 -1
- package/dist/operations/bootstrap/candidate-helpers.js +4 -0
- package/dist/operations/migration/evidence-floor.d.ts +41 -0
- package/dist/operations/migration/evidence-floor.d.ts.map +1 -0
- package/dist/operations/migration/evidence-floor.js +230 -0
- package/dist/operations/migration/proof-contract-claims.d.ts +72 -0
- package/dist/operations/migration/proof-contract-claims.d.ts.map +1 -0
- package/dist/operations/migration/proof-contract-claims.js +215 -0
- package/dist/operations/migration/schema6.d.ts +6 -0
- package/dist/operations/migration/schema6.d.ts.map +1 -1
- package/dist/operations/migration/schema6.js +92 -0
- 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/omitted-properties.d.ts +11 -0
- package/dist/operations/mutation/omitted-properties.d.ts.map +1 -0
- package/dist/operations/mutation/omitted-properties.js +76 -0
- package/dist/operations/mutation/serialization.d.ts.map +1 -1
- package/dist/operations/mutation/serialization.js +1 -0
- package/dist/operations/mutation/source-authoring.d.ts.map +1 -1
- package/dist/operations/mutation/source-authoring.js +39 -20
- package/dist/operations/mutation/strict-fact.d.ts.map +1 -1
- package/dist/operations/mutation/strict-fact.js +6 -2
- package/dist/operations/mutation/symbol-granularity.d.ts.map +1 -1
- package/dist/operations/mutation/symbol-granularity.js +5 -3
- package/dist/operations/mutation/upsert.d.ts.map +1 -1
- package/dist/operations/mutation/upsert.js +7 -1
- package/dist/operations/mutation/validation.d.ts +2 -0
- package/dist/operations/mutation/validation.d.ts.map +1 -1
- package/dist/operations/mutation/validation.js +4 -0
- package/dist/operations/proof/claim-bindings.d.ts +41 -0
- package/dist/operations/proof/claim-bindings.d.ts.map +1 -0
- package/dist/operations/proof/claim-bindings.js +364 -0
- package/dist/operations/proof/code-certificates.d.ts +155 -0
- package/dist/operations/proof/code-certificates.d.ts.map +1 -0
- package/dist/operations/proof/code-certificates.js +894 -0
- 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 +14 -1
- package/dist/operations/proof/code-scope.d.ts.map +1 -1
- package/dist/operations/proof/code-scope.js +44 -2
- package/dist/operations/proof/compact-receipts.d.ts.map +1 -1
- package/dist/operations/proof/compact-receipts.js +4 -3
- package/dist/operations/proof/explain.d.ts +32 -0
- package/dist/operations/proof/explain.d.ts.map +1 -1
- package/dist/operations/proof/explain.js +91 -0
- package/dist/operations/proof/ingest-proof.d.ts +9 -1
- package/dist/operations/proof/ingest-proof.d.ts.map +1 -1
- package/dist/operations/proof/ingest-proof.js +42 -2
- package/dist/operations/proof/receipt-compaction.d.ts +2 -0
- package/dist/operations/proof/receipt-compaction.d.ts.map +1 -1
- package/dist/operations/proof/receipt-compaction.js +6 -2
- 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/shared.d.ts.map +1 -1
- package/dist/operations/semantic-advisor/shared.js +4 -0
- 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 +234 -4
- package/dist/operations/semantic-advisor/types.d.ts +3 -2
- package/dist/operations/semantic-advisor/types.d.ts.map +1 -1
- package/dist/plugins/approved-source-analyzers.generated.d.ts +6 -6
- package/dist/plugins/approved-source-analyzers.generated.js +6 -6
- package/dist/prolog.d.ts.map +1 -1
- package/dist/prolog.js +13 -3
- package/dist/proof/command-test-report.d.ts +4 -3
- package/dist/proof/command-test-report.d.ts.map +1 -1
- package/dist/proof/command-test-report.js +4 -10
- package/dist/proof/evaluate.d.ts.map +1 -1
- package/dist/proof/evaluate.js +18 -2
- package/dist/proof/inspect.d.ts.map +1 -1
- package/dist/proof/inspect.js +58 -0
- package/dist/proof/producers/playwright-reporter.d.ts +3 -0
- package/dist/proof/producers/playwright-reporter.d.ts.map +1 -1
- package/dist/proof/producers/playwright-reporter.js +25 -2
- package/dist/proof/step-runner.d.ts +36 -0
- package/dist/proof/step-runner.d.ts.map +1 -0
- package/dist/proof/step-runner.js +234 -0
- package/dist/public/evidence-levels.d.ts +12 -0
- package/dist/public/evidence-levels.d.ts.map +1 -0
- package/dist/public/evidence-levels.js +19 -0
- package/dist/public/impact/coverage-depth-quality.d.ts +7 -0
- package/dist/public/impact/coverage-depth-quality.d.ts.map +1 -1
- package/dist/public/impact/coverage-depth-quality.js +59 -0
- package/dist/public/impact/full-kb-quality.d.ts.map +1 -1
- package/dist/public/impact/full-kb-quality.js +3 -1
- package/dist/public/operations/catalog.d.ts +315 -11
- package/dist/public/operations/catalog.d.ts.map +1 -1
- package/dist/public/operations/check-executor.d.ts +2 -0
- package/dist/public/operations/check-executor.d.ts.map +1 -1
- package/dist/public/operations/check-executor.js +6 -0
- package/dist/public/operations/evidence-floor.d.ts +48 -0
- package/dist/public/operations/evidence-floor.d.ts.map +1 -0
- package/dist/public/operations/evidence-floor.js +143 -0
- package/dist/public/operations/migration-plan.d.ts +19 -5
- package/dist/public/operations/migration-plan.d.ts.map +1 -1
- package/dist/public/operations/migration-plan.js +22 -5
- package/dist/public/operations/node-ports.d.ts.map +1 -1
- package/dist/public/operations/node-ports.js +4 -1
- package/dist/public/operations/proof-contract-claims.d.ts +26 -0
- package/dist/public/operations/proof-contract-claims.d.ts.map +1 -0
- package/dist/public/operations/proof-contract-claims.js +71 -0
- package/dist/public/operations/specs/check-rules.generated.d.ts +1 -1
- package/dist/public/operations/specs/check-rules.generated.d.ts.map +1 -1
- package/dist/public/operations/specs/check-rules.generated.js +3 -1
- package/dist/public/operations/specs/check.d.ts +1 -1
- package/dist/public/operations/specs/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 +289 -7
- package/dist/public/operations/specs/mutation-schemas.d.ts.map +1 -1
- package/dist/public/operations/specs/mutation-schemas.js +28 -4
- package/dist/public/operations/specs/proof.d.ts +9 -0
- package/dist/public/operations/specs/proof.d.ts.map +1 -1
- package/dist/public/operations/specs/reporting.d.ts.map +1 -1
- package/dist/public/operations/specs/reporting.js +19 -10
- package/dist/public/operations/specs/upsert.d.ts +289 -7
- package/dist/public/operations/specs/upsert.d.ts.map +1 -1
- package/dist/public/proof-certificates.d.ts +163 -0
- package/dist/public/proof-certificates.d.ts.map +1 -0
- package/dist/public/proof-certificates.js +419 -0
- package/dist/public/proof-protocol.d.ts +259 -3
- package/dist/public/proof-protocol.d.ts.map +1 -1
- package/dist/public/proof-protocol.js +524 -3
- package/dist/public/proof-receipt.d.ts +90 -6
- package/dist/public/proof-receipt.d.ts.map +1 -1
- package/dist/public/proof-receipt.js +88 -7
- 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 +39 -2
- package/dist/public/skills/kibi-bootstrap/SKILL.md +2 -2
- package/dist/public/skills/kibi-commit-review/SKILL.md +8 -8
- package/dist/public/skills/kibi-commit-review/resources/staged-gate.md +12 -7
- package/dist/public/skills/kibi-decisions/SKILL.md +13 -2
- package/dist/public/skills/kibi-decisions/resources/decision-records.md +9 -1
- package/dist/public/skills/kibi-freshness/SKILL.md +5 -1
- package/dist/public/skills/kibi-traceability/SKILL.md +12 -1
- package/dist/public/skills/kibi-usage/SKILL.md +8 -4
- package/dist/public/skills/kibi-usage/resources/proof.md +221 -20
- package/dist/public/skills/kibi-usage/resources/workflows.md +4 -4
- package/dist/report/html-report.css +83 -11
- package/dist/report/html-report.d.ts +8 -0
- package/dist/report/html-report.d.ts.map +1 -1
- package/dist/report/html-report.js +214 -22
- package/dist/report/report-view.d.ts +2 -2
- package/dist/report/report-view.d.ts.map +1 -1
- package/dist/report/report-view.js +8 -0
- package/dist/schemas/entity.schema.json +404 -5
- package/dist/search-answer.d.ts.map +1 -1
- package/dist/search-answer.js +1 -0
- package/dist/signoff/html.d.ts.map +1 -1
- package/dist/signoff/html.js +3 -0
- package/dist/signoff/markdown.d.ts.map +1 -1
- package/dist/signoff/markdown.js +3 -0
- package/dist/signoff/model.d.ts +20 -0
- package/dist/signoff/model.d.ts.map +1 -1
- package/dist/signoff/model.js +20 -1
- 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/impact-knowledge.d.ts.map +1 -1
- package/dist/traceability/impact-knowledge.js +1 -0
- 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/traceability/temp-kb.d.ts.map +1 -1
- package/dist/traceability/temp-kb.js +1 -0
- package/dist/types/entities.d.ts +5 -2
- package/dist/types/entities.d.ts.map +1 -1
- package/dist/utils/merge-driver-setup.d.ts +8 -1
- package/dist/utils/merge-driver-setup.d.ts.map +1 -1
- package/dist/utils/merge-driver-setup.js +23 -2
- package/dist/utils/rule-registry.generated.d.ts +10 -0
- package/dist/utils/rule-registry.generated.d.ts.map +1 -1
- package/dist/utils/rule-registry.generated.js +12 -0
- 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 +7 -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 +6 -2
- package/schema/entities.pl +6 -0
- package/schema/validation.pl +7 -2
- package/src/public/evidence-levels.ts +23 -0
- package/src/public/impact/coverage-depth-quality.ts +73 -0
- package/src/public/impact/full-kb-quality.ts +6 -1
- package/src/public/operations/check-executor.ts +13 -0
- package/src/public/operations/evidence-floor.ts +203 -0
- package/src/public/operations/migration-plan.ts +39 -6
- package/src/public/operations/node-ports.ts +3 -1
- package/src/public/operations/proof-contract-claims.ts +103 -0
- package/src/public/operations/specs/check-rules.generated.ts +3 -1
- package/src/public/operations/specs/modeling.ts +24 -5
- package/src/public/operations/specs/mutation-schemas.ts +30 -4
- package/src/public/operations/specs/reporting.ts +20 -10
- package/src/public/proof-certificates.ts +566 -0
- package/src/public/proof-protocol-types.d.ts +69 -1
- package/src/public/proof-protocol.ts +694 -3
- package/src/public/proof-receipt.ts +133 -7
- package/src/public/proof-sources.ts +1656 -0
- package/src/public/schemas/entity.ts +51 -3
- package/src/public/skills/kibi-bootstrap/SKILL.md +2 -2
- package/src/public/skills/kibi-commit-review/SKILL.md +8 -8
- package/src/public/skills/kibi-commit-review/resources/staged-gate.md +12 -7
- package/src/public/skills/kibi-decisions/SKILL.md +13 -2
- package/src/public/skills/kibi-decisions/resources/decision-records.md +9 -1
- package/src/public/skills/kibi-freshness/SKILL.md +5 -1
- package/src/public/skills/kibi-traceability/SKILL.md +12 -1
- package/src/public/skills/kibi-usage/SKILL.md +8 -4
- package/src/public/skills/kibi-usage/resources/proof.md +221 -20
- package/src/public/skills/kibi-usage/resources/workflows.md +4 -4
- package/src/schemas/entity.schema.json +404 -5
- package/dist/commands/proof-impact.d.ts +0 -7
- package/dist/commands/proof-impact.d.ts.map +0 -1
- package/dist/commands/proof-impact.js +0 -39
- package/dist/operations/proof/baseline-diff.d.ts +0 -41
- package/dist/operations/proof/baseline-diff.d.ts.map +0 -1
- package/dist/operations/proof/baseline-diff.js +0 -153
- package/dist/operations/proof/impact.d.ts +0 -51
- package/dist/operations/proof/impact.d.ts.map +0 -1
- package/dist/operations/proof/impact.js +0 -138
- 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,17 +18,21 @@
|
|
|
18
18
|
import path from "node:path";
|
|
19
19
|
import { extractFromMarkdown, } from "../../extractors/markdown.js";
|
|
20
20
|
import { FIRMNESS_FROM_ORIGIN_SCHEMA_VERSION } from "../../public/operations/decision-firmness.js";
|
|
21
|
+
import { EVIDENCE_FLOOR_SCHEMA_VERSION } from "../../public/operations/evidence-floor.js";
|
|
21
22
|
import { migrationAction, } from "../../public/operations/migration-plan.js";
|
|
23
|
+
import { CLAIM_BINDING_SCHEMA_VERSION } from "../../public/operations/proof-contract-claims.js";
|
|
22
24
|
import { CLOSE_SUPERSEDED_REQUIREMENTS_ACTION_ID, CLOSE_SUPERSEDED_REQUIREMENTS_CODE, MIGRATION_SYNC_ACTION_ID, MIGRATION_SYNC_CODE, SOURCE_PATH_REWRITE_ACTION_ID, SOURCE_PATH_REWRITE_CODE, closeSupersededRequirementsActionInput, exceptionUnapprovedActionInput, migrationSyncActionInput, sourcePathReviewActionInput, sourcePathRewriteActionInput, supersessionCycleReviewActionInput, } from "../../public/operations/schema6-check-actions.js";
|
|
23
25
|
import { readAllShards } from "../../relationships/shards.js";
|
|
24
26
|
import { KB_PATHS } from "../../utils/kb-paths.js";
|
|
25
27
|
import { CONTEXT_MISSING_TAG_CODE, SEMANTIC_TEXT_PIN_CODE, applyContextMissingTags, applySemanticTextPins, countByType, planContextMissingTags, planSemanticTextPins, } from "./entity-body-context.js";
|
|
26
28
|
import { ENTITY_TYPE_BACKFILL_ACTION_ID, ENTITY_TYPE_BACKFILL_CODE, applyEntityTypeBackfill, planEntityTypeBackfill, } from "./entity-type.js";
|
|
29
|
+
import { EVIDENCE_FLOOR_PIN_CODE, applyEvidenceFloorPins, planEvidenceFloorPins, } from "./evidence-floor.js";
|
|
27
30
|
import { FIRM_SUPERSEDE_ACKNOWLEDGE_CODE, applyFirmSupersedeAcknowledgement, planFirmSupersedeAcknowledgement, } from "./firm-supersede.js";
|
|
28
31
|
import { applyInventoryRederivation, applyInventoryRederivationDroppingGrounding, planInventoryRederivation, } from "./inventory-rederive.js";
|
|
29
32
|
import { listLaneMarkdownFiles } from "./kb-sources.js";
|
|
30
33
|
import { applyOriginBackfill, planOriginBackfill } from "./origin-backfill.js";
|
|
31
34
|
import { POLARITY_VALUE_BACKFILL_CODE, applyPolarityValueBackfill, planPolarityValueBackfill, } from "./polarity-values.js";
|
|
35
|
+
import { PROOF_CONTRACT_CLAIMS_PIN_CODE, PROOF_CONTRACT_CLAIMS_REVIEW_CODE, claimReviewInstruction, planProofContractClaimPins, } from "./proof-contract-claims.js";
|
|
32
36
|
import { DELIVERED_REQUIREMENT_TAG, applyDeliveredStatusMappings, applyRequirementStatusMapping, planRequirementStatusMappings, } from "./requirement-status.js";
|
|
33
37
|
import { applySourcePathRepairs, findSourceRepairs, plannedSourcePathRepairs, } from "./source-paths.js";
|
|
34
38
|
import { applySupersededClosures, planSupersededClosures, } from "./superseded-closure.js";
|
|
@@ -581,6 +585,86 @@ export function buildSchema6MigrationFragment(input) {
|
|
|
581
585
|
}));
|
|
582
586
|
}
|
|
583
587
|
}
|
|
588
|
+
// Schema 11: a firm requirement needs tested evidence. Record an asserted
|
|
589
|
+
// floor on current firm requirements without a passing proof path, so the
|
|
590
|
+
// upgraded knowledge base passes evidence-floor.
|
|
591
|
+
if (input.currentSchemaVersion === null ||
|
|
592
|
+
input.currentSchemaVersion < EVIDENCE_FLOOR_SCHEMA_VERSION) {
|
|
593
|
+
const floors = planEvidenceFloorPins(input.workspaceRoot, input.ladderFloors);
|
|
594
|
+
if (floors.targets.length > 0) {
|
|
595
|
+
const id = "evidence-floor-pin";
|
|
596
|
+
sourceRewriteActionIds.push(id);
|
|
597
|
+
actions.push(migrationAction({
|
|
598
|
+
id,
|
|
599
|
+
code: EVIDENCE_FLOOR_PIN_CODE,
|
|
600
|
+
category: "schema",
|
|
601
|
+
safety: "automatic",
|
|
602
|
+
autoApplicable: true,
|
|
603
|
+
invocation: {
|
|
604
|
+
kind: "cli",
|
|
605
|
+
command_argv: ["kibi", "migrate", "--yes"],
|
|
606
|
+
},
|
|
607
|
+
affectedEntityIds: floors.targets.map((row) => row.id),
|
|
608
|
+
affectedFiles: floors.targets.map((row) => row.path),
|
|
609
|
+
postconditions: [{ rule: "evidence-floor", findings: 0 }],
|
|
610
|
+
evidence: {
|
|
611
|
+
reason: "Schema 11 fails a current requirement whose evidence is below its floor, and a firm requirement without required_evidence needs tested evidence. These firm requirements are below tested (judged by the evidence ladder on the synced store when one could be read, else by their latest end-to-end receipt), so each records required_evidence: asserted in its front matter, where a reviewer can raise it once a proof exists.",
|
|
612
|
+
count: floors.targets.length,
|
|
613
|
+
skipped: floors.skipped,
|
|
614
|
+
preserves: "every other front matter key and the body bytes",
|
|
615
|
+
},
|
|
616
|
+
}));
|
|
617
|
+
}
|
|
618
|
+
}
|
|
619
|
+
// Schema 12: a certificate contract names the claims it proves. Pin proves
|
|
620
|
+
// where the test reaches one provable claim; list the rest for review.
|
|
621
|
+
if ((input.currentSchemaVersion === null ||
|
|
622
|
+
input.currentSchemaVersion < CLAIM_BINDING_SCHEMA_VERSION) &&
|
|
623
|
+
input.claimCandidates) {
|
|
624
|
+
const claims = planProofContractClaimPins(input.workspaceRoot, input.claimCandidates);
|
|
625
|
+
if (claims.targets.length > 0) {
|
|
626
|
+
const id = "proof-contract-claims-pin";
|
|
627
|
+
sourceRewriteActionIds.push(id);
|
|
628
|
+
actions.push(migrationAction({
|
|
629
|
+
id,
|
|
630
|
+
code: PROOF_CONTRACT_CLAIMS_PIN_CODE,
|
|
631
|
+
category: "schema",
|
|
632
|
+
safety: "automatic",
|
|
633
|
+
autoApplicable: true,
|
|
634
|
+
invocation: {
|
|
635
|
+
kind: "cli",
|
|
636
|
+
command_argv: ["kibi", "migrate", "--yes"],
|
|
637
|
+
},
|
|
638
|
+
affectedEntityIds: claims.targets.map((row) => row.id),
|
|
639
|
+
affectedFiles: claims.targets.map((row) => row.path),
|
|
640
|
+
evidence: {
|
|
641
|
+
reason: "Schema 12 requires every certificate-kind proof contract to name the claims it proves. Each of these tests reaches exactly one claim its proof kind can derive an obligation for, so the migration writes it to proof_contract.proves. The contract changes, so run kibi prove for these tests afterwards.",
|
|
642
|
+
count: claims.targets.length,
|
|
643
|
+
skipped: claims.skipped,
|
|
644
|
+
preserves: "every other front matter key and the body bytes",
|
|
645
|
+
},
|
|
646
|
+
}));
|
|
647
|
+
}
|
|
648
|
+
for (const row of claims.review)
|
|
649
|
+
actions.push(migrationAction({
|
|
650
|
+
id: `proof-contract-claims-review-${row.id}`,
|
|
651
|
+
code: PROOF_CONTRACT_CLAIMS_REVIEW_CODE,
|
|
652
|
+
category: "semantic",
|
|
653
|
+
safety: "review",
|
|
654
|
+
invocation: {
|
|
655
|
+
kind: "review",
|
|
656
|
+
instruction: claimReviewInstruction(row),
|
|
657
|
+
},
|
|
658
|
+
affectedEntityIds: [row.id],
|
|
659
|
+
affectedFiles: [row.path],
|
|
660
|
+
postconditions: [
|
|
661
|
+
{ rule: "proof-contract-claims", entityId: row.id, findings: 0 },
|
|
662
|
+
],
|
|
663
|
+
dispositionRequired: true,
|
|
664
|
+
allowedDispositions: ["fixed", "deferred"],
|
|
665
|
+
evidence: { kind: row.kind, candidates: row.candidates },
|
|
666
|
+
}));
|
|
667
|
+
}
|
|
584
668
|
const drift = planInventoryRederivation(input.workspaceRoot);
|
|
585
669
|
for (const plan of drift) {
|
|
586
670
|
const action = plan.safe ? rederiveAction(plan) : reviewAction(plan);
|
|
@@ -797,6 +881,13 @@ export async function applySchema6MigrationAction(action, context) {
|
|
|
797
881
|
applyFirmSupersedeAcknowledgement(context.workspaceRoot);
|
|
798
882
|
return;
|
|
799
883
|
}
|
|
884
|
+
case EVIDENCE_FLOOR_PIN_CODE: {
|
|
885
|
+
// The plan decided the pins with the evidence ladder; apply the same
|
|
886
|
+
// set even though source rewrites before it may have left the store
|
|
887
|
+
// behind the authored files.
|
|
888
|
+
applyEvidenceFloorPins(context.workspaceRoot, new Map((action.affectedEntityIds ?? []).map((id) => [id, "below"])));
|
|
889
|
+
return;
|
|
890
|
+
}
|
|
800
891
|
case SEMANTIC_INVENTORY_REDERIVE_CODE: {
|
|
801
892
|
const requirementId = action.affectedEntityIds[0];
|
|
802
893
|
if (requirementId === undefined)
|
|
@@ -890,6 +981,7 @@ export const SCHEMA6_AUTOMATIC_CODES = new Set([
|
|
|
890
981
|
CONTEXT_MISSING_TAG_CODE,
|
|
891
982
|
SUPERSEDES_REASON_ACKNOWLEDGE_CODE,
|
|
892
983
|
FIRM_SUPERSEDE_ACKNOWLEDGE_CODE,
|
|
984
|
+
EVIDENCE_FLOOR_PIN_CODE,
|
|
893
985
|
SEMANTIC_INVENTORY_REDERIVE_CODE,
|
|
894
986
|
REQ_STATUS_DELIVERED_MAP_CODE,
|
|
895
987
|
ENTITY_ORIGIN_BACKFILL_CODE,
|
|
@@ -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,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB,Q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ACrB,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) {
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { StoredEntityLookup } from "./stored-entity.js";
|
|
2
|
+
import type { StagedUpsertState, UpsertInput } from "./types.js";
|
|
3
|
+
/**
|
|
4
|
+
* An update keeps every property it leaves out. The authored file already
|
|
5
|
+
* does (the writer patches its front matter), so the compiled entity must
|
|
6
|
+
* too: otherwise a relationship-only upsert stores the requirement without,
|
|
7
|
+
* say, its `required_evidence`, and the store disagrees with the file until a
|
|
8
|
+
* rebuild.
|
|
9
|
+
*/
|
|
10
|
+
export declare function withStoredOmittedProperties(input: UpsertInput, lookup: StoredEntityLookup, staged?: StagedUpsertState): Promise<UpsertInput>;
|
|
11
|
+
//# sourceMappingURL=omitted-properties.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"omitted-properties.d.ts","sourceRoot":"","sources":["../../../src/operations/mutation/omitted-properties.ts"],"names":[],"mappings":"AAkBA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAC7D,OAAO,KAAK,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AA8BjE;;;;;;GAMG;AAEH,wBAAsB,2BAA2B,CAC/C,KAAK,EAAE,WAAW,EAClB,MAAM,EAAE,kBAAkB,EAC1B,MAAM,CAAC,EAAE,iBAAiB,GACzB,OAAO,CAAC,WAAW,CAAC,CAiBtB"}
|
|
@@ -0,0 +1,76 @@
|
|
|
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 { isUpsertEntityProperty } from "./validation.js";
|
|
19
|
+
/**
|
|
20
|
+
* Stored fields an update never inherits by omission: identity and write
|
|
21
|
+
* times, fields derived from other fields, and fields other upsert steps
|
|
22
|
+
* resolve with their own rules (origin, firmness, receipt history, the
|
|
23
|
+
* requirement proposition ledger).
|
|
24
|
+
*/
|
|
25
|
+
const NOT_INHERITED = new Set([
|
|
26
|
+
"id",
|
|
27
|
+
"type",
|
|
28
|
+
"created_at",
|
|
29
|
+
"updated_at",
|
|
30
|
+
"source",
|
|
31
|
+
"origin",
|
|
32
|
+
"firmness",
|
|
33
|
+
"approval_ref",
|
|
34
|
+
"proof_receipts",
|
|
35
|
+
"claim_key",
|
|
36
|
+
"text_ref",
|
|
37
|
+
"semantic_text",
|
|
38
|
+
"semantic_clauses",
|
|
39
|
+
"semantic_inventory",
|
|
40
|
+
"semantic_inventory_version",
|
|
41
|
+
"semantic_source_field",
|
|
42
|
+
"semantic_source_hash",
|
|
43
|
+
"logic_claims",
|
|
44
|
+
]);
|
|
45
|
+
/**
|
|
46
|
+
* An update keeps every property it leaves out. The authored file already
|
|
47
|
+
* does (the writer patches its front matter), so the compiled entity must
|
|
48
|
+
* too: otherwise a relationship-only upsert stores the requirement without,
|
|
49
|
+
* say, its `required_evidence`, and the store disagrees with the file until a
|
|
50
|
+
* rebuild.
|
|
51
|
+
*/
|
|
52
|
+
// implements REQ-kibi-operation-interface-parity
|
|
53
|
+
export async function withStoredOmittedProperties(input, lookup, staged) {
|
|
54
|
+
const stored = staged?.entities.get(input.id) ?? (await lookup.entity());
|
|
55
|
+
if (stored === undefined || stored === null)
|
|
56
|
+
return input;
|
|
57
|
+
if (stored.type !== undefined && stored.type !== input.type)
|
|
58
|
+
return input;
|
|
59
|
+
const properties = (input.properties ?? {});
|
|
60
|
+
const inherited = {};
|
|
61
|
+
for (const [key, value] of Object.entries(stored)) {
|
|
62
|
+
if (value === undefined || value === null)
|
|
63
|
+
continue;
|
|
64
|
+
if (NOT_INHERITED.has(key) || !isUpsertEntityProperty(key))
|
|
65
|
+
continue;
|
|
66
|
+
if (properties[key] !== undefined)
|
|
67
|
+
continue;
|
|
68
|
+
inherited[key] = value;
|
|
69
|
+
}
|
|
70
|
+
if (Object.keys(inherited).length === 0)
|
|
71
|
+
return input;
|
|
72
|
+
return {
|
|
73
|
+
...input,
|
|
74
|
+
properties: { ...inherited, ...properties },
|
|
75
|
+
};
|
|
76
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"serialization.d.ts","sourceRoot":"","sources":["../../../src/operations/mutation/serialization.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"serialization.d.ts","sourceRoot":"","sources":["../../../src/operations/mutation/serialization.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AA0DpD,wBAAgB,iBAAiB,CAC/B,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,GACxC,MAAM,CAMR;AAGD,wBAAgB,yBAAyB,CAAC,GAAG,EAAE,iBAAiB,GAAG,MAAM,CAOxE;AAGD,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAkBtD"}
|
|
@@ -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,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,CAC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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 }
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"strict-fact.d.ts","sourceRoot":"","sources":["../../../src/operations/mutation/strict-fact.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"strict-fact.d.ts","sourceRoot":"","sources":["../../../src/operations/mutation/strict-fact.ts"],"names":[],"mappings":"AAYA,wBAAgB,cAAc,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAgBrD;AAGD,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,GACxC,MAAM,EAAE,CA+EV;AAED,wBAAgB,qBAAqB,CACnC,aAAa,EAAE,OAAO,EACtB,aAAa,EAAE,OAAO,GACrB,IAAI,CAUN;AAGD,wBAAgB,yBAAyB,CACvC,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,GACxC,IAAI,CAmDN"}
|