kibi-cli 2.1.0 → 2.3.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-operation-loader.d.ts.map +1 -1
- package/dist/cli-operation-loader.js +3 -0
- package/dist/cli-operation-metadata.d.ts +4 -0
- package/dist/cli-operation-metadata.d.ts.map +1 -1
- package/dist/cli-operation-metadata.js +5 -0
- package/dist/cli-protocol.d.ts.map +1 -1
- package/dist/cli-protocol.js +3 -2
- package/dist/cli-register-reporting.d.ts.map +1 -1
- package/dist/cli-register-reporting.js +4 -0
- package/dist/commands/aggregated-checks.d.ts +7 -0
- package/dist/commands/aggregated-checks.d.ts.map +1 -1
- package/dist/commands/aggregated-checks.js +25 -1
- package/dist/commands/check-diff.d.ts +5 -0
- package/dist/commands/check-diff.d.ts.map +1 -0
- package/dist/commands/check-diff.js +62 -0
- package/dist/commands/check-generated.d.ts.map +1 -1
- package/dist/commands/check-generated.js +41 -18
- package/dist/commands/check.d.ts.map +1 -1
- package/dist/commands/check.js +231 -86
- package/dist/commands/doctor.d.ts.map +1 -1
- package/dist/commands/doctor.js +168 -53
- package/dist/commands/github-init.d.ts +1 -1
- package/dist/commands/github-init.d.ts.map +1 -1
- package/dist/commands/github-init.js +10 -3
- package/dist/commands/init-helpers.d.ts +17 -2
- package/dist/commands/init-helpers.d.ts.map +1 -1
- package/dist/commands/init-helpers.js +123 -23
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +110 -15
- package/dist/commands/prove.d.ts.map +1 -1
- package/dist/commands/prove.js +10 -18
- package/dist/commands/sync/cache.d.ts +20 -1
- package/dist/commands/sync/cache.d.ts.map +1 -1
- package/dist/commands/sync/cache.js +51 -2
- package/dist/commands/sync/discovery.d.ts.map +1 -1
- package/dist/commands/sync/discovery.js +1 -1
- package/dist/commands/sync/manifest.d.ts.map +1 -1
- package/dist/commands/sync/manifest.js +3 -1
- package/dist/commands/sync/persistence.d.ts.map +1 -1
- package/dist/commands/sync/persistence.js +8 -0
- package/dist/commands/sync.d.ts.map +1 -1
- package/dist/commands/sync.js +11 -3
- package/dist/engine.d.ts +41 -1
- package/dist/engine.d.ts.map +1 -1
- package/dist/engine.js +377 -80
- package/dist/extractors/manifest.d.ts.map +1 -1
- package/dist/extractors/manifest.js +66 -28
- package/dist/extractors/markdown.d.ts +2 -0
- package/dist/extractors/markdown.d.ts.map +1 -1
- package/dist/extractors/markdown.js +14 -3
- package/dist/extractors/relationships.d.ts.map +1 -1
- package/dist/extractors/relationships.js +1 -0
- package/dist/extractors/symbols-coordinator.d.ts +7 -0
- package/dist/extractors/symbols-coordinator.d.ts.map +1 -1
- package/dist/extractors/symbols-coordinator.js +75 -39
- package/dist/intent-search.d.ts.map +1 -1
- package/dist/intent-search.js +68 -29
- package/dist/operations/bootstrap/generate.d.ts.map +1 -1
- package/dist/operations/bootstrap/generate.js +4 -3
- package/dist/operations/modeling/model-requirement.d.ts +1 -1
- package/dist/operations/modeling/model-requirement.d.ts.map +1 -1
- package/dist/operations/modeling/model-requirement.js +176 -10
- package/dist/operations/modeling/predicate-applyplan.d.ts.map +1 -1
- package/dist/operations/modeling/predicate-applyplan.js +14 -2
- package/dist/operations/modeling/predicate-inference-1.js +1 -1
- package/dist/operations/modeling/predicate-loader.d.ts.map +1 -1
- package/dist/operations/modeling/predicate-loader.js +24 -0
- package/dist/operations/modeling/predicate-types.d.ts +4 -0
- package/dist/operations/modeling/predicate-types.d.ts.map +1 -1
- package/dist/operations/modeling/predicate-vocabulary.d.ts +54 -0
- package/dist/operations/modeling/predicate-vocabulary.d.ts.map +1 -0
- package/dist/operations/modeling/predicate-vocabulary.js +169 -0
- package/dist/operations/modeling/requirement-types.d.ts +5 -0
- package/dist/operations/modeling/requirement-types.d.ts.map +1 -1
- package/dist/operations/modeling/vocabulary-alignment.d.ts +60 -0
- package/dist/operations/modeling/vocabulary-alignment.d.ts.map +1 -0
- package/dist/operations/modeling/vocabulary-alignment.js +178 -0
- package/dist/operations/mutation/contradictions.d.ts +3 -0
- package/dist/operations/mutation/contradictions.d.ts.map +1 -1
- package/dist/operations/mutation/contradictions.js +29 -0
- package/dist/operations/mutation/delete.d.ts.map +1 -1
- package/dist/operations/mutation/delete.js +33 -1
- package/dist/operations/mutation/predicate-vocabulary-guard.d.ts +8 -0
- package/dist/operations/mutation/predicate-vocabulary-guard.d.ts.map +1 -0
- package/dist/operations/mutation/predicate-vocabulary-guard.js +64 -0
- package/dist/operations/mutation/relationships.d.ts +1 -1
- package/dist/operations/mutation/relationships.d.ts.map +1 -1
- package/dist/operations/mutation/relationships.js +1 -0
- package/dist/operations/mutation/saga.d.ts +5 -0
- package/dist/operations/mutation/saga.d.ts.map +1 -1
- package/dist/operations/mutation/saga.js +10 -0
- package/dist/operations/mutation/serialization.d.ts.map +1 -1
- package/dist/operations/mutation/serialization.js +2 -0
- package/dist/operations/mutation/source-authoring.d.ts +6 -0
- package/dist/operations/mutation/source-authoring.d.ts.map +1 -1
- package/dist/operations/mutation/source-authoring.js +213 -52
- package/dist/operations/mutation/strict-fact.d.ts.map +1 -1
- package/dist/operations/mutation/strict-fact.js +5 -0
- package/dist/operations/mutation/types.d.ts +17 -0
- package/dist/operations/mutation/types.d.ts.map +1 -1
- package/dist/operations/mutation/upsert.d.ts +6 -0
- package/dist/operations/mutation/upsert.d.ts.map +1 -1
- package/dist/operations/mutation/upsert.js +77 -11
- package/dist/operations/mutation/validate-upsert.d.ts.map +1 -1
- package/dist/operations/mutation/validate-upsert.js +24 -1
- package/dist/operations/mutation/validation.d.ts.map +1 -1
- package/dist/operations/mutation/validation.js +16 -3
- package/dist/operations/planning/apply-plan.d.ts.map +1 -1
- package/dist/operations/planning/apply-plan.js +66 -26
- package/dist/operations/planning/compile-intent.d.ts.map +1 -1
- package/dist/operations/planning/compile-intent.js +3 -1
- package/dist/operations/proof/code-scope.d.ts +17 -0
- package/dist/operations/proof/code-scope.d.ts.map +1 -0
- package/dist/operations/proof/code-scope.js +60 -0
- package/dist/operations/proof/ingest-proof.d.ts +4 -2
- package/dist/operations/proof/ingest-proof.d.ts.map +1 -1
- package/dist/operations/proof/ingest-proof.js +208 -74
- package/dist/operations/proof/migrate-legacy-receipts.d.ts.map +1 -1
- package/dist/operations/proof/migrate-legacy-receipts.js +7 -5
- package/dist/operations/proof/prune-receipts.d.ts.map +1 -1
- package/dist/operations/proof/prune-receipts.js +7 -5
- package/dist/operations/semantic-advisor/analysis-receipt.d.ts.map +1 -1
- package/dist/operations/semantic-advisor/analysis-receipt.js +7 -1
- package/dist/operations/semantic-advisor/analyze-prose.d.ts.map +1 -1
- package/dist/operations/semantic-advisor/analyze-prose.js +26 -4
- package/dist/operations/semantic-advisor/clauses.d.ts +1 -0
- package/dist/operations/semantic-advisor/clauses.d.ts.map +1 -1
- package/dist/operations/semantic-advisor/clauses.js +7 -1
- package/dist/performance-trace.d.ts +17 -0
- package/dist/performance-trace.d.ts.map +1 -0
- package/dist/performance-trace.js +134 -0
- package/dist/plugins/approved-source-analyzers.d.ts +13 -0
- package/dist/plugins/approved-source-analyzers.d.ts.map +1 -0
- package/dist/plugins/approved-source-analyzers.generated.d.ts +71 -0
- package/dist/plugins/approved-source-analyzers.generated.d.ts.map +1 -0
- package/dist/plugins/approved-source-analyzers.generated.js +77 -0
- package/dist/plugins/approved-source-analyzers.js +3 -0
- package/dist/plugins/compose-semantic-classifier.d.ts +6 -1
- package/dist/plugins/compose-semantic-classifier.d.ts.map +1 -1
- package/dist/plugins/compose-semantic-classifier.js +8 -3
- package/dist/plugins/compose-vocabulary-alignment.d.ts +23 -0
- package/dist/plugins/compose-vocabulary-alignment.d.ts.map +1 -0
- package/dist/plugins/compose-vocabulary-alignment.js +141 -0
- package/dist/plugins/external-allowlist.d.ts +7 -0
- package/dist/plugins/external-allowlist.d.ts.map +1 -1
- package/dist/plugins/external-allowlist.js +13 -0
- package/dist/plugins/index.d.ts +2 -0
- package/dist/plugins/index.d.ts.map +1 -1
- package/dist/plugins/index.js +4 -0
- package/dist/plugins/maintenance-source-analysis.d.ts +14 -0
- package/dist/plugins/maintenance-source-analysis.d.ts.map +1 -0
- package/dist/plugins/maintenance-source-analysis.js +191 -0
- package/dist/plugins/registry.d.ts +3 -1
- package/dist/plugins/registry.d.ts.map +1 -1
- package/dist/plugins/registry.js +27 -1
- package/dist/plugins/source-analysis-service.d.ts +36 -1
- package/dist/plugins/source-analysis-service.d.ts.map +1 -1
- package/dist/plugins/source-analysis-service.js +184 -27
- package/dist/plugins/source-change-analysis.d.ts +15 -0
- package/dist/plugins/source-change-analysis.d.ts.map +1 -0
- package/dist/plugins/source-change-analysis.js +54 -0
- package/dist/plugins/source-classification.d.ts +41 -0
- package/dist/plugins/source-classification.d.ts.map +1 -0
- package/dist/plugins/source-classification.js +490 -0
- package/dist/prolog/codec.d.ts.map +1 -1
- package/dist/prolog/codec.js +2 -0
- package/dist/prolog/swipl-resolver.d.ts +88 -0
- package/dist/prolog/swipl-resolver.d.ts.map +1 -0
- package/dist/prolog/swipl-resolver.js +446 -0
- package/dist/prolog.d.ts +51 -1
- package/dist/prolog.d.ts.map +1 -1
- package/dist/prolog.js +145 -15
- package/dist/public/diagnostic-usage.d.ts.map +1 -1
- package/dist/public/diagnostic-usage.js +7 -25
- package/dist/public/impact/analyzer.d.ts.map +1 -1
- package/dist/public/impact/analyzer.js +56 -5
- package/dist/public/impact/diagnostics.d.ts.map +1 -1
- package/dist/public/impact/diagnostics.js +3 -1
- package/dist/public/impact/full-kb-quality.d.ts.map +1 -1
- package/dist/public/impact/full-kb-quality.js +4 -12
- package/dist/public/impact/manifest.d.ts.map +1 -1
- package/dist/public/impact/manifest.js +15 -1
- package/dist/public/impact/source-changes.d.ts.map +1 -1
- package/dist/public/impact/source-changes.js +35 -27
- package/dist/public/impact/types.d.ts +2 -0
- package/dist/public/impact/types.d.ts.map +1 -1
- package/dist/public/operations/catalog.d.ts +80 -7
- package/dist/public/operations/catalog.d.ts.map +1 -1
- package/dist/public/operations/catalog.js +2 -0
- package/dist/public/operations/check-executor.d.ts.map +1 -1
- package/dist/public/operations/check-executor.js +10 -2
- package/dist/public/operations/check-helpers.d.ts +6 -0
- package/dist/public/operations/check-helpers.d.ts.map +1 -1
- package/dist/public/operations/check-helpers.js +21 -1
- package/dist/public/operations/contracts.d.ts.map +1 -1
- package/dist/public/operations/contracts.js +325 -8
- package/dist/public/operations/discovery-entities.d.ts +42 -2
- package/dist/public/operations/discovery-entities.d.ts.map +1 -1
- package/dist/public/operations/discovery-entities.js +195 -22
- package/dist/public/operations/discovery-executors.d.ts +1 -0
- package/dist/public/operations/discovery-executors.d.ts.map +1 -1
- package/dist/public/operations/discovery-executors.js +75 -46
- package/dist/public/operations/impact-review-preparation.d.ts +14 -0
- package/dist/public/operations/impact-review-preparation.d.ts.map +1 -0
- package/dist/public/operations/impact-review-preparation.js +379 -0
- package/dist/public/operations/index.d.ts +2 -0
- package/dist/public/operations/index.d.ts.map +1 -1
- package/dist/public/operations/index.js +2 -0
- package/dist/public/operations/migration-plan.d.ts +2 -0
- package/dist/public/operations/migration-plan.d.ts.map +1 -1
- package/dist/public/operations/migration-plan.js +50 -0
- package/dist/public/operations/node-ports.d.ts.map +1 -1
- package/dist/public/operations/node-ports.js +1 -35
- package/dist/public/operations/predicate-schema-conformance.d.ts +41 -0
- package/dist/public/operations/predicate-schema-conformance.d.ts.map +1 -0
- package/dist/public/operations/predicate-schema-conformance.js +242 -0
- package/dist/public/operations/prolog-json.d.ts.map +1 -1
- package/dist/public/operations/prolog-json.js +9 -3
- package/dist/public/operations/proof-receipt-projection.d.ts +5 -0
- package/dist/public/operations/proof-receipt-projection.d.ts.map +1 -0
- package/dist/public/operations/proof-receipt-projection.js +36 -0
- package/dist/public/operations/result-envelope.d.ts +34 -1
- package/dist/public/operations/result-envelope.d.ts.map +1 -1
- package/dist/public/operations/result-envelope.js +78 -2
- package/dist/public/operations/runtime-types.d.ts +1 -1
- package/dist/public/operations/runtime-types.d.ts.map +1 -1
- package/dist/public/operations/specs/check-rules.generated.d.ts +1 -1
- package/dist/public/operations/specs/check-rules.generated.d.ts.map +1 -1
- package/dist/public/operations/specs/check-rules.generated.js +8 -1
- package/dist/public/operations/specs/check.d.ts +1 -1
- package/dist/public/operations/specs/discovery.d.ts +7 -1
- package/dist/public/operations/specs/discovery.d.ts.map +1 -1
- package/dist/public/operations/specs/discovery.js +7 -1
- package/dist/public/operations/specs/impact-review-preparation.d.ts +47 -0
- package/dist/public/operations/specs/impact-review-preparation.d.ts.map +1 -0
- package/dist/public/operations/specs/impact-review-preparation.js +43 -0
- package/dist/public/operations/specs/mutation-schemas.d.ts +27 -4
- package/dist/public/operations/specs/mutation-schemas.d.ts.map +1 -1
- package/dist/public/operations/specs/mutation-schemas.js +21 -3
- package/dist/public/operations/specs/reporting.d.ts +8 -0
- package/dist/public/operations/specs/reporting.d.ts.map +1 -1
- package/dist/public/operations/specs/reporting.js +46 -15
- package/dist/public/operations/specs/upsert.d.ts +28 -5
- package/dist/public/operations/specs/upsert.d.ts.map +1 -1
- package/dist/public/operations/specs/upsert.js +1 -1
- package/dist/public/operations/symbol-repair-plan.d.ts.map +1 -1
- package/dist/public/operations/symbol-repair-plan.js +8 -3
- package/dist/public/operations/types.d.ts +1 -1
- package/dist/public/operations/types.d.ts.map +1 -1
- package/dist/public/schemas/entity.d.ts.map +1 -1
- package/dist/public/schemas/entity.js +22 -0
- package/dist/public/schemas/relationship.d.ts.map +1 -1
- package/dist/public/schemas/relationship.js +1 -0
- package/dist/public/skills/kibi-usage/SKILL.md +7 -3
- package/dist/public/skills/kibi-usage/resources/fact-lanes.md +4 -0
- package/dist/public/skills/kibi-usage/resources/operation-access.md +1 -0
- package/dist/public/skills/kibi-usage/resources/relationship-directions.md +35 -17
- package/dist/public/skills/kibi-usage/resources/source-authoring.md +36 -0
- package/dist/public/skills/kibi-usage/resources/workflows.md +52 -1
- package/dist/public/telemetry-acceptance.d.ts.map +1 -1
- package/dist/public/telemetry-acceptance.js +21 -5
- package/dist/relationships/shards.d.ts +6 -0
- package/dist/relationships/shards.d.ts.map +1 -1
- package/dist/relationships/shards.js +26 -19
- package/dist/schemas/entity.schema.json +32 -0
- package/dist/traceability/analysis-gate.d.ts +39 -0
- package/dist/traceability/analysis-gate.d.ts.map +1 -0
- package/dist/traceability/analysis-gate.js +51 -0
- package/dist/traceability/git-change-snapshot.d.ts +27 -0
- package/dist/traceability/git-change-snapshot.d.ts.map +1 -0
- package/dist/traceability/git-change-snapshot.js +411 -0
- package/dist/traceability/git-staged.d.ts +5 -1
- package/dist/traceability/git-staged.d.ts.map +1 -1
- package/dist/traceability/git-staged.js +16 -11
- package/dist/traceability/impact-evaluator.d.ts +54 -0
- package/dist/traceability/impact-evaluator.d.ts.map +1 -0
- package/dist/traceability/impact-evaluator.js +270 -0
- package/dist/traceability/impact-git-tree.d.ts +12 -0
- package/dist/traceability/impact-git-tree.d.ts.map +1 -0
- package/dist/traceability/impact-git-tree.js +46 -0
- package/dist/traceability/impact-knowledge.d.ts +16 -0
- package/dist/traceability/impact-knowledge.d.ts.map +1 -0
- package/dist/traceability/impact-knowledge.js +165 -0
- package/dist/traceability/impact-policy.d.ts +15 -0
- package/dist/traceability/impact-policy.d.ts.map +1 -0
- package/dist/traceability/impact-policy.js +48 -0
- package/dist/traceability/impact-policy.v1.schema.json +48 -0
- package/dist/traceability/impact-pr-diff.d.ts +5 -0
- package/dist/traceability/impact-pr-diff.d.ts.map +1 -0
- package/dist/traceability/impact-pr-diff.js +83 -0
- package/dist/traceability/impact-record-validation.d.ts +9 -0
- package/dist/traceability/impact-record-validation.d.ts.map +1 -0
- package/dist/traceability/impact-record-validation.js +113 -0
- package/dist/traceability/impact-review.d.ts +148 -0
- package/dist/traceability/impact-review.d.ts.map +1 -0
- package/dist/traceability/impact-review.js +494 -0
- package/dist/traceability/impact-review.schema.json +365 -0
- package/dist/traceability/impact-side-evidence.d.ts +13 -0
- package/dist/traceability/impact-side-evidence.d.ts.map +1 -0
- package/dist/traceability/impact-side-evidence.js +240 -0
- package/dist/traceability/reviewed-coordinate-refresh.d.ts +10 -0
- package/dist/traceability/reviewed-coordinate-refresh.d.ts.map +1 -0
- package/dist/traceability/reviewed-coordinate-refresh.js +49 -0
- package/dist/traceability/snapshot-knowledge.d.ts +4 -0
- package/dist/traceability/snapshot-knowledge.d.ts.map +1 -0
- package/dist/traceability/snapshot-knowledge.js +98 -0
- package/dist/traceability/staged-diagnostics.d.ts +1 -1
- package/dist/traceability/staged-diagnostics.d.ts.map +1 -1
- package/dist/traceability/staged-entity-id-style.d.ts +12 -0
- package/dist/traceability/staged-entity-id-style.d.ts.map +1 -0
- package/dist/traceability/staged-entity-id-style.js +68 -0
- package/dist/traceability/staged-file-coverage.d.ts +23 -0
- package/dist/traceability/staged-file-coverage.d.ts.map +1 -1
- package/dist/traceability/staged-impact-contract.d.ts.map +1 -1
- package/dist/traceability/staged-impact-contract.js +2 -16
- package/dist/traceability/staged-symbols-manifest.d.ts +4 -0
- package/dist/traceability/staged-symbols-manifest.d.ts.map +1 -1
- package/dist/traceability/staged-symbols-manifest.js +17 -6
- package/dist/traceability/symbol-extract.d.ts +3 -5
- package/dist/traceability/symbol-extract.d.ts.map +1 -1
- package/dist/traceability/symbol-extract.js +49 -34
- package/dist/traceability/temp-kb.d.ts +1 -1
- package/dist/traceability/temp-kb.d.ts.map +1 -1
- package/dist/traceability/temp-kb.js +57 -13
- package/dist/traceability/trusted-pr-event.d.ts +13 -0
- package/dist/traceability/trusted-pr-event.d.ts.map +1 -0
- package/dist/traceability/trusted-pr-event.js +105 -0
- package/dist/traceability/validate.js +1 -1
- package/dist/types/entities.d.ts +2 -0
- package/dist/types/entities.d.ts.map +1 -1
- package/dist/types/relationships.d.ts +1 -1
- package/dist/types/relationships.d.ts.map +1 -1
- package/dist/utils/canonical-path.d.ts +3 -0
- package/dist/utils/canonical-path.d.ts.map +1 -0
- package/dist/utils/canonical-path.js +33 -0
- package/dist/utils/entity-id-style.d.ts +27 -0
- package/dist/utils/entity-id-style.d.ts.map +1 -0
- package/dist/utils/entity-id-style.js +81 -0
- package/dist/utils/git-repository-context.d.ts +50 -0
- package/dist/utils/git-repository-context.d.ts.map +1 -0
- package/dist/utils/git-repository-context.js +259 -0
- package/dist/utils/rule-registry.d.ts +5 -0
- package/dist/utils/rule-registry.d.ts.map +1 -1
- package/dist/utils/rule-registry.generated.d.ts +37 -0
- package/dist/utils/rule-registry.generated.d.ts.map +1 -1
- package/dist/utils/rule-registry.generated.js +44 -0
- package/dist/utils/strict-modeling.d.ts +7 -0
- package/dist/utils/strict-modeling.d.ts.map +1 -1
- package/dist/utils/strict-modeling.js +11 -0
- package/package.json +14 -5
- package/schema/entities.pl +60 -1
- package/schema/relationships.pl +17 -4
- package/schema/validation.pl +118 -20
- package/src/public/diagnostic-usage.ts +16 -24
- package/src/public/impact/analyzer.ts +88 -5
- package/src/public/impact/diagnostics.ts +7 -5
- package/src/public/impact/full-kb-quality.ts +4 -16
- package/src/public/impact/manifest.ts +14 -1
- package/src/public/impact/source-changes.ts +39 -34
- package/src/public/impact/types.ts +5 -0
- package/src/public/operations/catalog.ts +2 -0
- package/src/public/operations/check-executor.ts +12 -1
- package/src/public/operations/check-helpers.ts +27 -1
- package/src/public/operations/contracts.ts +404 -9
- package/src/public/operations/discovery-entities.ts +292 -23
- package/src/public/operations/discovery-executors.ts +91 -55
- package/src/public/operations/impact-review-preparation.ts +548 -0
- package/src/public/operations/index.ts +2 -0
- package/src/public/operations/migration-plan.ts +57 -0
- package/src/public/operations/node-ports.ts +1 -39
- package/src/public/operations/predicate-schema-conformance.ts +362 -0
- package/src/public/operations/prolog-json.ts +9 -3
- package/src/public/operations/proof-receipt-projection.ts +39 -0
- package/src/public/operations/result-envelope.ts +114 -2
- package/src/public/operations/runtime-types.ts +1 -1
- package/src/public/operations/specs/check-rules.generated.ts +8 -1
- package/src/public/operations/specs/discovery.ts +8 -1
- package/src/public/operations/specs/impact-review-preparation.ts +46 -0
- package/src/public/operations/specs/mutation-schemas.ts +23 -3
- package/src/public/operations/specs/reporting.ts +69 -22
- package/src/public/operations/specs/upsert.ts +1 -1
- package/src/public/operations/symbol-repair-plan.ts +13 -3
- package/src/public/operations/types.ts +1 -0
- package/src/public/schemas/entity.ts +22 -0
- package/src/public/schemas/relationship.ts +1 -0
- package/src/public/skills/kibi-usage/SKILL.md +7 -3
- package/src/public/skills/kibi-usage/resources/fact-lanes.md +4 -0
- package/src/public/skills/kibi-usage/resources/operation-access.md +1 -0
- package/src/public/skills/kibi-usage/resources/relationship-directions.md +35 -17
- package/src/public/skills/kibi-usage/resources/source-authoring.md +36 -0
- package/src/public/skills/kibi-usage/resources/workflows.md +52 -1
- package/src/public/telemetry-acceptance.ts +37 -6
- package/src/schemas/entity.schema.json +32 -0
- package/src/schemas/relationship.schema.json +1 -0
- package/src/traceability/impact-policy.v1.schema.json +48 -0
- package/src/traceability/impact-review.schema.json +365 -0
- package/templates/github/kibi-badge.yml +0 -4
- package/templates/github/kibi-report.yml +0 -4
|
@@ -0,0 +1,365 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "urn:kibi:impact-review:v1",
|
|
4
|
+
"title": "Kibi content-bound local impact review record",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"additionalProperties": false,
|
|
7
|
+
"required": [
|
|
8
|
+
"contractVersion",
|
|
9
|
+
"policy",
|
|
10
|
+
"evaluator",
|
|
11
|
+
"scope",
|
|
12
|
+
"reviewer",
|
|
13
|
+
"reviewedAt",
|
|
14
|
+
"files"
|
|
15
|
+
],
|
|
16
|
+
"properties": {
|
|
17
|
+
"contractVersion": { "const": "kibi.impact-review.v1" },
|
|
18
|
+
"policy": { "$ref": "#/$defs/policy" },
|
|
19
|
+
"evaluator": { "$ref": "#/$defs/evaluator" },
|
|
20
|
+
"scope": { "$ref": "#/$defs/scope" },
|
|
21
|
+
"reviewer": { "$ref": "#/$defs/reviewer" },
|
|
22
|
+
"reviewedAt": {
|
|
23
|
+
"type": "string",
|
|
24
|
+
"pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}(\\.[0-9]+)?(Z|[+-][0-9]{2}:[0-9]{2})$"
|
|
25
|
+
},
|
|
26
|
+
"files": { "type": "array", "items": { "$ref": "#/$defs/file" } }
|
|
27
|
+
},
|
|
28
|
+
"$defs": {
|
|
29
|
+
"sha256": { "type": "string", "pattern": "^sha256:[0-9a-f]{64}$" },
|
|
30
|
+
"policy": {
|
|
31
|
+
"type": "object",
|
|
32
|
+
"additionalProperties": false,
|
|
33
|
+
"required": ["id", "version", "fingerprint"],
|
|
34
|
+
"properties": {
|
|
35
|
+
"id": { "type": "string", "minLength": 1 },
|
|
36
|
+
"version": { "type": "string", "minLength": 1 },
|
|
37
|
+
"fingerprint": { "$ref": "#/$defs/sha256" }
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
"evaluator": {
|
|
41
|
+
"type": "object",
|
|
42
|
+
"additionalProperties": false,
|
|
43
|
+
"required": ["contractVersion", "fingerprint"],
|
|
44
|
+
"properties": {
|
|
45
|
+
"contractVersion": { "const": "kibi.impact-evaluator.v1" },
|
|
46
|
+
"fingerprint": { "$ref": "#/$defs/sha256" }
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
"scope": {
|
|
50
|
+
"type": "object",
|
|
51
|
+
"additionalProperties": false,
|
|
52
|
+
"required": [
|
|
53
|
+
"fingerprint",
|
|
54
|
+
"knowledgeFingerprint",
|
|
55
|
+
"providerSetFingerprint"
|
|
56
|
+
],
|
|
57
|
+
"properties": {
|
|
58
|
+
"fingerprint": { "$ref": "#/$defs/sha256" },
|
|
59
|
+
"knowledgeFingerprint": { "$ref": "#/$defs/sha256" },
|
|
60
|
+
"providerSetFingerprint": { "$ref": "#/$defs/sha256" }
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
"reviewer": {
|
|
64
|
+
"type": "object",
|
|
65
|
+
"additionalProperties": false,
|
|
66
|
+
"required": ["id", "source"],
|
|
67
|
+
"properties": {
|
|
68
|
+
"id": { "type": "string", "minLength": 1 },
|
|
69
|
+
"source": { "const": "self-claimed-local" }
|
|
70
|
+
}
|
|
71
|
+
},
|
|
72
|
+
"range": {
|
|
73
|
+
"type": "object",
|
|
74
|
+
"additionalProperties": false,
|
|
75
|
+
"required": ["start", "end"],
|
|
76
|
+
"properties": {
|
|
77
|
+
"start": { "type": "integer", "minimum": 0 },
|
|
78
|
+
"end": { "type": "integer", "minimum": 0 }
|
|
79
|
+
}
|
|
80
|
+
},
|
|
81
|
+
"uncoveredRange": {
|
|
82
|
+
"type": "object",
|
|
83
|
+
"additionalProperties": false,
|
|
84
|
+
"required": [
|
|
85
|
+
"startLine",
|
|
86
|
+
"startColumn",
|
|
87
|
+
"endLine",
|
|
88
|
+
"endColumn",
|
|
89
|
+
"reason"
|
|
90
|
+
],
|
|
91
|
+
"properties": {
|
|
92
|
+
"startLine": { "type": "integer", "minimum": 1 },
|
|
93
|
+
"startColumn": { "type": "integer", "minimum": 0 },
|
|
94
|
+
"endLine": { "type": "integer", "minimum": 1 },
|
|
95
|
+
"endColumn": { "type": "integer", "minimum": 0 },
|
|
96
|
+
"reason": { "type": "string", "minLength": 1 }
|
|
97
|
+
}
|
|
98
|
+
},
|
|
99
|
+
"analysis": {
|
|
100
|
+
"type": "object",
|
|
101
|
+
"additionalProperties": false,
|
|
102
|
+
"required": [
|
|
103
|
+
"contractVersion",
|
|
104
|
+
"status",
|
|
105
|
+
"language",
|
|
106
|
+
"sourceFile",
|
|
107
|
+
"providerId",
|
|
108
|
+
"providerStamp",
|
|
109
|
+
"providerFingerprint",
|
|
110
|
+
"inputFingerprint",
|
|
111
|
+
"resultFingerprint",
|
|
112
|
+
"diagnosticCodes",
|
|
113
|
+
"uncoveredRanges"
|
|
114
|
+
],
|
|
115
|
+
"properties": {
|
|
116
|
+
"contractVersion": { "const": "kibi.symbol-extractor.v2" },
|
|
117
|
+
"status": { "enum": ["ok", "partial", "unsupported", "failed"] },
|
|
118
|
+
"language": { "type": "string", "minLength": 1 },
|
|
119
|
+
"sourceFile": { "type": "string", "minLength": 1 },
|
|
120
|
+
"providerId": { "type": ["string", "null"] },
|
|
121
|
+
"providerStamp": {},
|
|
122
|
+
"providerFingerprint": {
|
|
123
|
+
"oneOf": [{ "$ref": "#/$defs/sha256" }, { "type": "null" }]
|
|
124
|
+
},
|
|
125
|
+
"inputFingerprint": { "$ref": "#/$defs/sha256" },
|
|
126
|
+
"resultFingerprint": { "$ref": "#/$defs/sha256" },
|
|
127
|
+
"diagnosticCodes": {
|
|
128
|
+
"type": "array",
|
|
129
|
+
"items": { "type": "string", "minLength": 1 }
|
|
130
|
+
},
|
|
131
|
+
"uncoveredRanges": {
|
|
132
|
+
"type": "array",
|
|
133
|
+
"items": { "$ref": "#/$defs/uncoveredRange" }
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
},
|
|
137
|
+
"side": {
|
|
138
|
+
"type": "object",
|
|
139
|
+
"additionalProperties": false,
|
|
140
|
+
"required": ["mode", "objectId", "byteFingerprint", "kind", "analysis"],
|
|
141
|
+
"properties": {
|
|
142
|
+
"mode": { "enum": ["100644", "100755", "120000", "160000"] },
|
|
143
|
+
"objectId": {
|
|
144
|
+
"oneOf": [
|
|
145
|
+
{ "type": "string", "pattern": "^[0-9a-f]{40,64}$" },
|
|
146
|
+
{ "type": "null" }
|
|
147
|
+
]
|
|
148
|
+
},
|
|
149
|
+
"byteFingerprint": { "$ref": "#/$defs/sha256" },
|
|
150
|
+
"kind": { "enum": ["regular", "symlink", "gitlink"] },
|
|
151
|
+
"contentProjection": { "const": "proof_receipts_stripped" },
|
|
152
|
+
"analysis": {
|
|
153
|
+
"oneOf": [{ "$ref": "#/$defs/analysis" }, { "type": "null" }]
|
|
154
|
+
}
|
|
155
|
+
},
|
|
156
|
+
"allOf": [
|
|
157
|
+
{
|
|
158
|
+
"if": {
|
|
159
|
+
"required": ["contentProjection"],
|
|
160
|
+
"properties": {
|
|
161
|
+
"contentProjection": { "const": "proof_receipts_stripped" }
|
|
162
|
+
}
|
|
163
|
+
},
|
|
164
|
+
"then": { "properties": { "objectId": { "type": "null" } } }
|
|
165
|
+
},
|
|
166
|
+
{
|
|
167
|
+
"if": { "not": { "required": ["contentProjection"] } },
|
|
168
|
+
"then": {
|
|
169
|
+
"properties": {
|
|
170
|
+
"objectId": {
|
|
171
|
+
"type": "string",
|
|
172
|
+
"pattern": "^[0-9a-f]{40,64}$"
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
]
|
|
178
|
+
},
|
|
179
|
+
"partialReview": {
|
|
180
|
+
"type": "object",
|
|
181
|
+
"additionalProperties": false,
|
|
182
|
+
"required": ["kind", "side", "limitationClass", "ranges", "rationale"],
|
|
183
|
+
"properties": {
|
|
184
|
+
"kind": { "const": "partial_review" },
|
|
185
|
+
"side": { "enum": ["before", "after"] },
|
|
186
|
+
"limitationClass": { "type": "string", "minLength": 1 },
|
|
187
|
+
"ranges": {
|
|
188
|
+
"type": "array",
|
|
189
|
+
"minItems": 1,
|
|
190
|
+
"items": { "$ref": "#/$defs/uncoveredRange" }
|
|
191
|
+
},
|
|
192
|
+
"rationale": { "type": "string", "minLength": 1 }
|
|
193
|
+
}
|
|
194
|
+
},
|
|
195
|
+
"unsupportedReview": {
|
|
196
|
+
"type": "object",
|
|
197
|
+
"additionalProperties": false,
|
|
198
|
+
"required": ["kind", "side", "wholeFile", "rationale"],
|
|
199
|
+
"properties": {
|
|
200
|
+
"kind": { "const": "unsupported_review" },
|
|
201
|
+
"side": { "enum": ["before", "after"] },
|
|
202
|
+
"wholeFile": { "const": true },
|
|
203
|
+
"rationale": { "type": "string", "minLength": 1 }
|
|
204
|
+
}
|
|
205
|
+
},
|
|
206
|
+
"updatedEntity": {
|
|
207
|
+
"type": "object",
|
|
208
|
+
"additionalProperties": false,
|
|
209
|
+
"required": [
|
|
210
|
+
"entityId",
|
|
211
|
+
"artifactPath",
|
|
212
|
+
"beforeFingerprint",
|
|
213
|
+
"afterFingerprint"
|
|
214
|
+
],
|
|
215
|
+
"properties": {
|
|
216
|
+
"entityId": { "type": "string", "minLength": 1 },
|
|
217
|
+
"artifactPath": { "type": "string", "minLength": 1 },
|
|
218
|
+
"beforeFingerprint": {
|
|
219
|
+
"oneOf": [{ "$ref": "#/$defs/sha256" }, { "type": "null" }]
|
|
220
|
+
},
|
|
221
|
+
"afterFingerprint": { "$ref": "#/$defs/sha256" }
|
|
222
|
+
}
|
|
223
|
+
},
|
|
224
|
+
"impactDecision": {
|
|
225
|
+
"type": "object",
|
|
226
|
+
"additionalProperties": false,
|
|
227
|
+
"required": ["kind", "requirementIds", "knowledge"],
|
|
228
|
+
"properties": {
|
|
229
|
+
"kind": { "const": "impact" },
|
|
230
|
+
"requirementIds": {
|
|
231
|
+
"type": "array",
|
|
232
|
+
"minItems": 1,
|
|
233
|
+
"uniqueItems": true,
|
|
234
|
+
"items": { "type": "string", "minLength": 1 }
|
|
235
|
+
},
|
|
236
|
+
"knowledge": {
|
|
237
|
+
"oneOf": [
|
|
238
|
+
{
|
|
239
|
+
"type": "object",
|
|
240
|
+
"additionalProperties": false,
|
|
241
|
+
"required": ["state", "rationale"],
|
|
242
|
+
"properties": {
|
|
243
|
+
"state": { "const": "still_current" },
|
|
244
|
+
"rationale": { "type": "string", "minLength": 1 }
|
|
245
|
+
}
|
|
246
|
+
},
|
|
247
|
+
{
|
|
248
|
+
"type": "object",
|
|
249
|
+
"additionalProperties": false,
|
|
250
|
+
"required": ["state", "entities"],
|
|
251
|
+
"properties": {
|
|
252
|
+
"state": { "const": "updated" },
|
|
253
|
+
"entities": {
|
|
254
|
+
"type": "array",
|
|
255
|
+
"minItems": 1,
|
|
256
|
+
"uniqueItems": true,
|
|
257
|
+
"items": { "$ref": "#/$defs/updatedEntity" }
|
|
258
|
+
},
|
|
259
|
+
"stillCurrent": {
|
|
260
|
+
"type": "array",
|
|
261
|
+
"uniqueItems": true,
|
|
262
|
+
"items": {
|
|
263
|
+
"type": "object",
|
|
264
|
+
"additionalProperties": false,
|
|
265
|
+
"required": ["requirementId", "rationale"],
|
|
266
|
+
"properties": {
|
|
267
|
+
"requirementId": {
|
|
268
|
+
"type": "string",
|
|
269
|
+
"minLength": 1,
|
|
270
|
+
"pattern": "\\S"
|
|
271
|
+
},
|
|
272
|
+
"rationale": {
|
|
273
|
+
"type": "string",
|
|
274
|
+
"minLength": 1,
|
|
275
|
+
"pattern": "\\S"
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
]
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
},
|
|
286
|
+
"decision": {
|
|
287
|
+
"oneOf": [
|
|
288
|
+
{ "$ref": "#/$defs/impactDecision" },
|
|
289
|
+
{
|
|
290
|
+
"type": "object",
|
|
291
|
+
"additionalProperties": false,
|
|
292
|
+
"required": ["kind", "reason", "rationale"],
|
|
293
|
+
"properties": {
|
|
294
|
+
"kind": { "const": "no_impact" },
|
|
295
|
+
"reason": { "type": "string", "minLength": 1 },
|
|
296
|
+
"rationale": { "type": "string", "minLength": 1 }
|
|
297
|
+
}
|
|
298
|
+
},
|
|
299
|
+
{
|
|
300
|
+
"type": "object",
|
|
301
|
+
"additionalProperties": false,
|
|
302
|
+
"required": ["kind", "policyReason", "rationale"],
|
|
303
|
+
"properties": {
|
|
304
|
+
"kind": { "const": "not_applicable" },
|
|
305
|
+
"policyReason": { "type": "string", "minLength": 1 },
|
|
306
|
+
"rationale": { "type": "string", "minLength": 1 }
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
]
|
|
310
|
+
},
|
|
311
|
+
"file": {
|
|
312
|
+
"type": "object",
|
|
313
|
+
"additionalProperties": false,
|
|
314
|
+
"required": [
|
|
315
|
+
"path",
|
|
316
|
+
"status",
|
|
317
|
+
"analysisDepth",
|
|
318
|
+
"disposition",
|
|
319
|
+
"oldHunkRanges",
|
|
320
|
+
"newHunkRanges",
|
|
321
|
+
"before",
|
|
322
|
+
"after",
|
|
323
|
+
"analysisReviews",
|
|
324
|
+
"decision"
|
|
325
|
+
],
|
|
326
|
+
"properties": {
|
|
327
|
+
"path": { "type": "string", "minLength": 1 },
|
|
328
|
+
"status": { "enum": ["A", "M", "R", "C", "T", "D"] },
|
|
329
|
+
"oldPath": { "type": "string", "minLength": 1 },
|
|
330
|
+
"copyFromPath": { "type": "string", "minLength": 1 },
|
|
331
|
+
"analysisDepth": { "enum": ["symbol", "metadata", "file", "none"] },
|
|
332
|
+
"disposition": { "enum": ["checked", "advisory", "skipped"] },
|
|
333
|
+
"skipReason": {
|
|
334
|
+
"enum": ["binary", "unsupported_encoding", "symlink", "submodule"]
|
|
335
|
+
},
|
|
336
|
+
"gitMode": { "type": "string" },
|
|
337
|
+
"previousMode": { "type": "string" },
|
|
338
|
+
"oldHunkRanges": {
|
|
339
|
+
"type": "array",
|
|
340
|
+
"items": { "$ref": "#/$defs/range" }
|
|
341
|
+
},
|
|
342
|
+
"newHunkRanges": {
|
|
343
|
+
"type": "array",
|
|
344
|
+
"items": { "$ref": "#/$defs/range" }
|
|
345
|
+
},
|
|
346
|
+
"before": { "oneOf": [{ "$ref": "#/$defs/side" }, { "type": "null" }] },
|
|
347
|
+
"after": { "oneOf": [{ "$ref": "#/$defs/side" }, { "type": "null" }] },
|
|
348
|
+
"analysisReviews": {
|
|
349
|
+
"type": "array",
|
|
350
|
+
"items": {
|
|
351
|
+
"oneOf": [
|
|
352
|
+
{ "$ref": "#/$defs/partialReview" },
|
|
353
|
+
{ "$ref": "#/$defs/unsupportedReview" }
|
|
354
|
+
]
|
|
355
|
+
}
|
|
356
|
+
},
|
|
357
|
+
"decision": { "$ref": "#/$defs/decision" }
|
|
358
|
+
},
|
|
359
|
+
"anyOf": [
|
|
360
|
+
{ "properties": { "before": { "$ref": "#/$defs/side" } } },
|
|
361
|
+
{ "properties": { "after": { "$ref": "#/$defs/side" } } }
|
|
362
|
+
]
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { HostSourceAnalysisResultV2 } from "../plugins/source-analysis-service.js";
|
|
2
|
+
import type { SourceChangeAnalysis } from "../plugins/source-change-analysis.js";
|
|
3
|
+
import type { GitChangeSnapshot } from "./git-change-snapshot.js";
|
|
4
|
+
import type { StagedPath } from "./git-staged.js";
|
|
5
|
+
import { type SideEvidence } from "./impact-review.js";
|
|
6
|
+
/** Per-path, per-side evidence: projected bytes, hunks and host analysis bindings. */
|
|
7
|
+
export declare function isKnowledgeMarkdown(path: string): boolean;
|
|
8
|
+
export declare function isReceiptOnlyChange(file: StagedPath): boolean;
|
|
9
|
+
export declare function projectedPathEvidence(file: StagedPath): StagedPath;
|
|
10
|
+
export declare function sideEvidence(snapshot: GitChangeSnapshot, tree: string, path: string, result: HostSourceAnalysisResultV2 | null, content: string | undefined): SideEvidence | null;
|
|
11
|
+
export declare function assertAnalysisInput(file: StagedPath, change: SourceChangeAnalysis | undefined): void;
|
|
12
|
+
export declare function exactPathProjection(file: StagedPath, before: SideEvidence | null, after: SideEvidence | null): unknown;
|
|
13
|
+
//# sourceMappingURL=impact-side-evidence.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"impact-side-evidence.d.ts","sourceRoot":"","sources":["../../src/traceability/impact-side-evidence.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,uCAAuC,CAAC;AACxF,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,sCAAsC,CAAC;AAEjF,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAElD,OAAO,EAEL,KAAK,YAAY,EAIlB,MAAM,oBAAoB,CAAC;AAE5B,sFAAsF;AAEtF,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAEzD;AAUD,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,UAAU,GAAG,OAAO,CA0B7D;AAwFD,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,UAAU,GAAG,UAAU,CAqBlE;AASD,wBAAgB,YAAY,CAC1B,QAAQ,EAAE,iBAAiB,EAC3B,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,0BAA0B,GAAG,IAAI,EACzC,OAAO,EAAE,MAAM,GAAG,SAAS,GAC1B,YAAY,GAAG,IAAI,CAuFrB;AAGD,wBAAgB,mBAAmB,CACjC,IAAI,EAAE,UAAU,EAChB,MAAM,EAAE,oBAAoB,GAAG,SAAS,GACvC,IAAI,CAQN;AAGD,wBAAgB,mBAAmB,CACjC,IAAI,EAAE,UAAU,EAChB,MAAM,EAAE,YAAY,GAAG,IAAI,EAC3B,KAAK,EAAE,YAAY,GAAG,IAAI,GACzB,OAAO,CAoBT"}
|
|
@@ -0,0 +1,240 @@
|
|
|
1
|
+
import { execFileSync } from "node:child_process";
|
|
2
|
+
import { mkdtempSync, rmSync, writeFileSync } from "node:fs";
|
|
3
|
+
import { tmpdir } from "node:os";
|
|
4
|
+
import { join } from "node:path";
|
|
5
|
+
import { snapshotFileContent } from "../public/operations/proof-receipt-projection.js";
|
|
6
|
+
import { blobBytes, treeEntry } from "./impact-git-tree.js";
|
|
7
|
+
import { assertSha256, fingerprint, fingerprintBytes, } from "./impact-review.js";
|
|
8
|
+
/** Per-path, per-side evidence: projected bytes, hunks and host analysis bindings. */
|
|
9
|
+
// implements REQ-impact-policy-stage-e-content-bound-review
|
|
10
|
+
export function isKnowledgeMarkdown(path) {
|
|
11
|
+
return path.startsWith(".kb/") && path.endsWith(".md");
|
|
12
|
+
}
|
|
13
|
+
function projectedKnowledgeMarkdown(path, content) {
|
|
14
|
+
if (!isKnowledgeMarkdown(path))
|
|
15
|
+
return content;
|
|
16
|
+
return snapshotFileContent(path, Buffer.from(content, "utf8")).toString("utf8");
|
|
17
|
+
}
|
|
18
|
+
// implements REQ-impact-policy-stage-e-content-bound-review
|
|
19
|
+
export function isReceiptOnlyChange(file) {
|
|
20
|
+
if (!isKnowledgeMarkdown(file.path) ||
|
|
21
|
+
file.status !== "M" ||
|
|
22
|
+
file.oldPath !== undefined ||
|
|
23
|
+
file.copyFromPath !== undefined ||
|
|
24
|
+
file.skipReason !== undefined ||
|
|
25
|
+
file.previousContent === undefined ||
|
|
26
|
+
file.content === undefined)
|
|
27
|
+
return false;
|
|
28
|
+
const previousMode = file.previousMode;
|
|
29
|
+
const currentMode = file.gitMode;
|
|
30
|
+
if ((previousMode !== "100644" && previousMode !== "100755") ||
|
|
31
|
+
currentMode !== previousMode)
|
|
32
|
+
return false;
|
|
33
|
+
const before = Buffer.from(file.previousContent, "utf8");
|
|
34
|
+
const after = Buffer.from(file.content, "utf8");
|
|
35
|
+
return (!before.equals(after) &&
|
|
36
|
+
snapshotFileContent(file.path, before).equals(snapshotFileContent(file.path, after)));
|
|
37
|
+
}
|
|
38
|
+
function normalizeHunks(ranges, content) {
|
|
39
|
+
const lineCount = Math.max(1, (content ?? "").split(/\r?\n/).length);
|
|
40
|
+
return ranges.map((range) => ({
|
|
41
|
+
start: range.start,
|
|
42
|
+
end: range.end === Number.MAX_SAFE_INTEGER ? lineCount : range.end,
|
|
43
|
+
}));
|
|
44
|
+
}
|
|
45
|
+
function projectedHunks(beforeContent, afterContent) {
|
|
46
|
+
const temporary = mkdtempSync(join(tmpdir(), "kibi-impact-projected-diff-"));
|
|
47
|
+
try {
|
|
48
|
+
const beforePath = join(temporary, "before.md");
|
|
49
|
+
const afterPath = join(temporary, "after.md");
|
|
50
|
+
writeFileSync(beforePath, beforeContent ?? "");
|
|
51
|
+
writeFileSync(afterPath, afterContent ?? "");
|
|
52
|
+
let diffText = "";
|
|
53
|
+
try {
|
|
54
|
+
diffText = execFileSync("git", [
|
|
55
|
+
"diff",
|
|
56
|
+
"--no-index",
|
|
57
|
+
"--no-ext-diff",
|
|
58
|
+
"--no-textconv",
|
|
59
|
+
"--no-color",
|
|
60
|
+
"--unified=0",
|
|
61
|
+
"--",
|
|
62
|
+
beforePath,
|
|
63
|
+
afterPath,
|
|
64
|
+
], {
|
|
65
|
+
encoding: "utf8",
|
|
66
|
+
maxBuffer: 64 * 1024 * 1024,
|
|
67
|
+
stdio: ["ignore", "pipe", "ignore"],
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
catch (error) {
|
|
71
|
+
if (typeof error !== "object" ||
|
|
72
|
+
error === null ||
|
|
73
|
+
!("status" in error) ||
|
|
74
|
+
error.status !== 1)
|
|
75
|
+
throw error;
|
|
76
|
+
diffText =
|
|
77
|
+
"stdout" in error && typeof error.stdout === "string"
|
|
78
|
+
? error.stdout
|
|
79
|
+
: "stdout" in error && Buffer.isBuffer(error.stdout)
|
|
80
|
+
? error.stdout.toString("utf8")
|
|
81
|
+
: "";
|
|
82
|
+
}
|
|
83
|
+
const oldHunkRanges = [];
|
|
84
|
+
const hunkRanges = [];
|
|
85
|
+
const regex = /^@@\s+-(\d+)(?:,(\d+))?\s+\+(\d+)(?:,(\d+))?\s+@@/gm;
|
|
86
|
+
for (const match of diffText.matchAll(regex)) {
|
|
87
|
+
const oldStart = Number.parseInt(match[1] ?? "0", 10);
|
|
88
|
+
const oldCount = Number.parseInt(match[2] ?? "1", 10);
|
|
89
|
+
const newStart = Number.parseInt(match[3] ?? "0", 10);
|
|
90
|
+
const newCount = Number.parseInt(match[4] ?? "1", 10);
|
|
91
|
+
if (oldCount > 0)
|
|
92
|
+
oldHunkRanges.push({
|
|
93
|
+
start: oldStart,
|
|
94
|
+
end: oldStart + oldCount - 1,
|
|
95
|
+
});
|
|
96
|
+
if (newCount > 0)
|
|
97
|
+
hunkRanges.push({ start: newStart, end: newStart + newCount - 1 });
|
|
98
|
+
}
|
|
99
|
+
return {
|
|
100
|
+
oldHunkRanges: normalizeHunks(oldHunkRanges, beforeContent),
|
|
101
|
+
hunkRanges: normalizeHunks(hunkRanges, afterContent),
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
finally {
|
|
105
|
+
rmSync(temporary, { recursive: true, force: true });
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
// implements REQ-impact-policy-stage-e-content-bound-review
|
|
109
|
+
export function projectedPathEvidence(file) {
|
|
110
|
+
const previousPath = file.oldPath ?? file.copyFromPath ?? file.path;
|
|
111
|
+
if (!isKnowledgeMarkdown(file.path) && !isKnowledgeMarkdown(previousPath))
|
|
112
|
+
return file;
|
|
113
|
+
const previousContent = file.previousContent === undefined
|
|
114
|
+
? undefined
|
|
115
|
+
: projectedKnowledgeMarkdown(previousPath, file.previousContent);
|
|
116
|
+
const content = file.content === undefined
|
|
117
|
+
? undefined
|
|
118
|
+
: projectedKnowledgeMarkdown(file.path, file.content);
|
|
119
|
+
const ranges = projectedHunks(previousContent, content);
|
|
120
|
+
const { diffText: _diffText, ...projected } = file;
|
|
121
|
+
return {
|
|
122
|
+
...projected,
|
|
123
|
+
...(previousContent !== undefined ? { previousContent } : {}),
|
|
124
|
+
...(content !== undefined ? { content } : {}),
|
|
125
|
+
oldHunkRanges: ranges.oldHunkRanges,
|
|
126
|
+
hunkRanges: ranges.hunkRanges,
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
function sideAnalysisFingerprint(result) {
|
|
130
|
+
return fingerprint(result);
|
|
131
|
+
}
|
|
132
|
+
// implements REQ-impact-policy-stage-e-content-bound-review
|
|
133
|
+
export function sideEvidence(snapshot, tree, path, result, content) {
|
|
134
|
+
const entry = treeEntry(snapshot, tree, path);
|
|
135
|
+
if (!entry)
|
|
136
|
+
return null;
|
|
137
|
+
if (!["100644", "100755", "120000", "160000"].includes(entry.mode))
|
|
138
|
+
throw new Error(`Unsupported Git mode ${entry.mode} for ${path}`);
|
|
139
|
+
if ((entry.mode === "160000") !== (entry.type === "commit") ||
|
|
140
|
+
(entry.mode !== "160000" && entry.type !== "blob"))
|
|
141
|
+
throw new Error(`Git mode/object type mismatch for ${path}`);
|
|
142
|
+
const bytes = blobBytes(snapshot, entry);
|
|
143
|
+
const kind = entry.mode === "160000" || entry.type === "commit"
|
|
144
|
+
? "gitlink"
|
|
145
|
+
: entry.mode === "120000"
|
|
146
|
+
? "symlink"
|
|
147
|
+
: "regular";
|
|
148
|
+
const projected = bytes !== undefined && isKnowledgeMarkdown(path);
|
|
149
|
+
const evidenceBytes = bytes && projected ? snapshotFileContent(path, bytes) : bytes;
|
|
150
|
+
const byteFingerprint = evidenceBytes
|
|
151
|
+
? fingerprintBytes(evidenceBytes)
|
|
152
|
+
: fingerprint({
|
|
153
|
+
mode: entry.mode,
|
|
154
|
+
type: entry.type,
|
|
155
|
+
objectId: entry.objectId,
|
|
156
|
+
});
|
|
157
|
+
let analysis = null;
|
|
158
|
+
if (result) {
|
|
159
|
+
if (result.sourceFile !== path)
|
|
160
|
+
throw new Error(`Analysis source path mismatch for ${path}`);
|
|
161
|
+
if (content === undefined ||
|
|
162
|
+
!/^[0-9a-f]{64}$/.test(result.inputFingerprint))
|
|
163
|
+
throw new Error(`Host analysis lacks a valid input fingerprint for captured path ${path}`);
|
|
164
|
+
if (result.providerFingerprint !== null)
|
|
165
|
+
assertSha256(`sha256:${result.providerFingerprint}`, `Provider fingerprint for ${path}`);
|
|
166
|
+
if ((result.status === "partial" && result.uncoveredRanges.length === 0) ||
|
|
167
|
+
(result.status === "ok" && result.uncoveredRanges.length > 0))
|
|
168
|
+
throw new Error(`Source analysis status/range mismatch for ${path}`);
|
|
169
|
+
analysis = {
|
|
170
|
+
contractVersion: result.contractVersion,
|
|
171
|
+
status: result.status,
|
|
172
|
+
language: result.language,
|
|
173
|
+
sourceFile: result.sourceFile,
|
|
174
|
+
providerId: result.providerId,
|
|
175
|
+
providerStamp: result.stamp,
|
|
176
|
+
providerFingerprint: result.providerFingerprint === null
|
|
177
|
+
? null
|
|
178
|
+
: `sha256:${result.providerFingerprint}`,
|
|
179
|
+
// The wrapper supplies host-validated analysis of these exact captured
|
|
180
|
+
// bytes. The byteFingerprint above independently binds the Git blob; do
|
|
181
|
+
// not recompute this host contract here because v2 may include the
|
|
182
|
+
// classifier, explicit language hint, and normalization version.
|
|
183
|
+
inputFingerprint: `sha256:${result.inputFingerprint}`,
|
|
184
|
+
resultFingerprint: sideAnalysisFingerprint(result),
|
|
185
|
+
diagnosticCodes: result.diagnostics.map((row) => row.code).sort(),
|
|
186
|
+
uncoveredRanges: result.uncoveredRanges.map((range) => ({
|
|
187
|
+
startLine: range.startLine,
|
|
188
|
+
startColumn: range.startColumn,
|
|
189
|
+
endLine: range.endLine,
|
|
190
|
+
endColumn: range.endColumn,
|
|
191
|
+
reason: range.reason,
|
|
192
|
+
})),
|
|
193
|
+
};
|
|
194
|
+
}
|
|
195
|
+
if (kind === "regular" && bytes === undefined)
|
|
196
|
+
throw new Error(`Regular tree entry has no blob: ${path}`);
|
|
197
|
+
return {
|
|
198
|
+
mode: entry.mode,
|
|
199
|
+
objectId: projected ? null : entry.objectId,
|
|
200
|
+
byteFingerprint,
|
|
201
|
+
kind,
|
|
202
|
+
...(projected
|
|
203
|
+
? { contentProjection: "proof_receipts_stripped" }
|
|
204
|
+
: {}),
|
|
205
|
+
analysis,
|
|
206
|
+
};
|
|
207
|
+
}
|
|
208
|
+
// implements REQ-impact-policy-stage-e-content-bound-review
|
|
209
|
+
export function assertAnalysisInput(file, change) {
|
|
210
|
+
if (file.analysisDepth === "metadata" || file.skipReason)
|
|
211
|
+
return;
|
|
212
|
+
if (file.previousContent !== undefined && !change?.before)
|
|
213
|
+
throw new Error(`Missing before-side source analysis for ${file.path}`);
|
|
214
|
+
if (file.content !== undefined && !change?.after)
|
|
215
|
+
throw new Error(`Missing after-side source analysis for ${file.path}`);
|
|
216
|
+
if (change && change.path !== file.path)
|
|
217
|
+
throw new Error(`Analysis path mismatch for ${file.path}`);
|
|
218
|
+
}
|
|
219
|
+
// implements REQ-impact-policy-stage-e-content-bound-review
|
|
220
|
+
export function exactPathProjection(file, before, after) {
|
|
221
|
+
return {
|
|
222
|
+
path: file.path,
|
|
223
|
+
status: file.status,
|
|
224
|
+
...(file.oldPath === undefined ? {} : { oldPath: file.oldPath }),
|
|
225
|
+
...(file.copyFromPath === undefined
|
|
226
|
+
? {}
|
|
227
|
+
: { copyFromPath: file.copyFromPath }),
|
|
228
|
+
analysisDepth: file.analysisDepth,
|
|
229
|
+
disposition: file.disposition,
|
|
230
|
+
...(file.skipReason === undefined ? {} : { skipReason: file.skipReason }),
|
|
231
|
+
...(file.gitMode === undefined ? {} : { gitMode: file.gitMode }),
|
|
232
|
+
...(file.previousMode === undefined
|
|
233
|
+
? {}
|
|
234
|
+
: { previousMode: file.previousMode }),
|
|
235
|
+
oldHunkRanges: file.oldHunkRanges ?? [],
|
|
236
|
+
newHunkRanges: file.hunkRanges,
|
|
237
|
+
before,
|
|
238
|
+
after,
|
|
239
|
+
};
|
|
240
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { HostSourceAnalysisResultV2, SourceAnalysisService } from "../plugins/source-analysis-service.js";
|
|
2
|
+
import type { GitChangeSnapshot } from "./git-change-snapshot.js";
|
|
3
|
+
import type { Fingerprint } from "./impact-review.js";
|
|
4
|
+
/** Authorize lexical coordinate migration only from a captured local staged review.
|
|
5
|
+
* Protected PR hosts must use their target-base evaluator, not this HEAD policy. */
|
|
6
|
+
export declare function createReviewedDecoratorCoordinateVerifier(snapshot: GitChangeSnapshot, service: SourceAnalysisService, bindings: {
|
|
7
|
+
providerSetFingerprint: Fingerprint;
|
|
8
|
+
evaluatorFingerprint: Fingerprint;
|
|
9
|
+
}): (path: string, analysis: HostSourceAnalysisResultV2) => Promise<void>;
|
|
10
|
+
//# sourceMappingURL=reviewed-coordinate-refresh.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reviewed-coordinate-refresh.d.ts","sourceRoot":"","sources":["../../src/traceability/reviewed-coordinate-refresh.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,0BAA0B,EAC1B,qBAAqB,EACtB,MAAM,uCAAuC,CAAC;AAE/C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAKlE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAEtD;oFACoF;AACpF,wBAAgB,yCAAyC,CACvD,QAAQ,EAAE,iBAAiB,EAC3B,OAAO,EAAE,qBAAqB,EAC9B,QAAQ,EAAE;IACR,sBAAsB,EAAE,WAAW,CAAC;IACpC,oBAAoB,EAAE,WAAW,CAAC;CACnC,GACA,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,0BAA0B,KAAK,OAAO,CAAC,IAAI,CAAC,CA4DvE"}
|