kibi-cli 2.3.0 → 2.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli-json-command.d.ts +6 -0
- package/dist/cli-json-command.d.ts.map +1 -1
- package/dist/cli-json-command.js +39 -11
- package/dist/cli-operation-loader.d.ts.map +1 -1
- package/dist/cli-operation-loader.js +7 -0
- package/dist/cli-operation-metadata.d.ts +13 -5
- package/dist/cli-operation-metadata.d.ts.map +1 -1
- package/dist/cli-operation-metadata.js +15 -5
- package/dist/cli-protocol.d.ts +14 -0
- package/dist/cli-protocol.d.ts.map +1 -1
- package/dist/cli-protocol.js +31 -2
- package/dist/cli-register-maintenance.d.ts.map +1 -1
- package/dist/cli-register-maintenance.js +7 -0
- package/dist/cli-register-proof.d.ts.map +1 -1
- package/dist/cli-register-proof.js +13 -0
- package/dist/commands/check.d.ts.map +1 -1
- package/dist/commands/check.js +11 -2
- package/dist/commands/discovery-shared.d.ts.map +1 -1
- package/dist/commands/discovery-shared.js +8 -2
- package/dist/commands/engine.d.ts.map +1 -1
- package/dist/commands/engine.js +4 -2
- package/dist/commands/gc.d.ts.map +1 -1
- package/dist/commands/gc.js +7 -0
- package/dist/commands/init-helpers.d.ts.map +1 -1
- package/dist/commands/init-helpers.js +0 -1
- package/dist/commands/merge-driver.d.ts +31 -0
- package/dist/commands/merge-driver.d.ts.map +1 -0
- package/dist/commands/merge-driver.js +268 -0
- package/dist/commands/migrate.d.ts.map +1 -1
- package/dist/commands/migrate.js +281 -14
- package/dist/commands/proof-compact.d.ts +9 -0
- package/dist/commands/proof-compact.d.ts.map +1 -0
- package/dist/commands/proof-compact.js +58 -0
- package/dist/commands/prove.d.ts +38 -0
- package/dist/commands/prove.d.ts.map +1 -1
- package/dist/commands/prove.js +222 -47
- package/dist/commands/sync/persistence.d.ts.map +1 -1
- package/dist/commands/sync/persistence.js +61 -16
- package/dist/commands/sync.d.ts +8 -0
- package/dist/commands/sync.d.ts.map +1 -1
- package/dist/commands/sync.js +42 -16
- package/dist/diagnostics.js +1 -1
- package/dist/engine-limits.d.ts +74 -0
- package/dist/engine-limits.d.ts.map +1 -0
- package/dist/engine-limits.js +201 -0
- package/dist/engine.d.ts +10 -0
- package/dist/engine.d.ts.map +1 -1
- package/dist/engine.js +57 -9
- package/dist/extractors/manifest.d.ts +8 -0
- package/dist/extractors/manifest.d.ts.map +1 -1
- package/dist/extractors/manifest.js +34 -5
- package/dist/extractors/markdown.d.ts +8 -0
- package/dist/extractors/markdown.d.ts.map +1 -1
- package/dist/extractors/markdown.js +57 -0
- package/dist/extractors/relationships.d.ts.map +1 -1
- package/dist/extractors/relationships.js +2 -0
- package/dist/intent-search.d.ts +4 -1
- package/dist/intent-search.d.ts.map +1 -1
- package/dist/intent-search.js +186 -33
- package/dist/operations/bootstrap/candidate-helpers.d.ts.map +1 -1
- package/dist/operations/bootstrap/candidate-helpers.js +8 -1
- package/dist/operations/bootstrap/candidates.d.ts.map +1 -1
- package/dist/operations/bootstrap/candidates.js +55 -39
- package/dist/operations/bootstrap/discovery.js +1 -1
- package/dist/operations/bootstrap/generate.d.ts +2 -0
- package/dist/operations/bootstrap/generate.d.ts.map +1 -1
- package/dist/operations/bootstrap/generate.js +107 -37
- package/dist/operations/bootstrap/guidance-actions.d.ts.map +1 -1
- package/dist/operations/bootstrap/guidance-actions.js +3 -0
- package/dist/operations/bootstrap/guidance.d.ts.map +1 -1
- package/dist/operations/bootstrap/guidance.js +7 -1
- package/dist/operations/bootstrap/intent-claims.d.ts +17 -0
- package/dist/operations/bootstrap/intent-claims.d.ts.map +1 -0
- package/dist/operations/bootstrap/intent-claims.js +103 -0
- package/dist/operations/bootstrap/markdown-candidates.d.ts +2 -0
- package/dist/operations/bootstrap/markdown-candidates.d.ts.map +1 -1
- package/dist/operations/bootstrap/markdown-candidates.js +32 -10
- package/dist/operations/bootstrap/presentation.d.ts +2 -0
- package/dist/operations/bootstrap/presentation.d.ts.map +1 -1
- package/dist/operations/bootstrap/presentation.js +66 -3
- package/dist/operations/bootstrap/requirement-claims.d.ts +1 -0
- package/dist/operations/bootstrap/requirement-claims.d.ts.map +1 -1
- package/dist/operations/bootstrap/requirement-claims.js +13 -1
- package/dist/operations/bootstrap/types.d.ts +28 -0
- package/dist/operations/bootstrap/types.d.ts.map +1 -1
- package/dist/operations/bootstrap/types.js +16 -0
- package/dist/operations/bootstrap/validation.d.ts +4 -0
- package/dist/operations/bootstrap/validation.d.ts.map +1 -0
- package/dist/operations/bootstrap/validation.js +20 -0
- package/dist/operations/migration/inventory-rederive.d.ts +81 -0
- package/dist/operations/migration/inventory-rederive.d.ts.map +1 -0
- package/dist/operations/migration/inventory-rederive.js +484 -0
- package/dist/operations/migration/kb-sources.d.ts +53 -0
- package/dist/operations/migration/kb-sources.d.ts.map +1 -0
- package/dist/operations/migration/kb-sources.js +233 -0
- package/dist/operations/migration/origin-backfill.d.ts +39 -0
- package/dist/operations/migration/origin-backfill.d.ts.map +1 -0
- package/dist/operations/migration/origin-backfill.js +164 -0
- package/dist/operations/migration/polarity-values.d.ts +10 -0
- package/dist/operations/migration/polarity-values.d.ts.map +1 -0
- package/dist/operations/migration/polarity-values.js +60 -0
- package/dist/operations/migration/schema6.d.ts +59 -0
- package/dist/operations/migration/schema6.d.ts.map +1 -0
- package/dist/operations/migration/schema6.js +379 -0
- package/dist/operations/migration/source-paths.d.ts +131 -0
- package/dist/operations/migration/source-paths.d.ts.map +1 -0
- package/dist/operations/migration/source-paths.js +308 -0
- package/dist/operations/migration/superseded-closure.d.ts +54 -0
- package/dist/operations/migration/superseded-closure.d.ts.map +1 -0
- package/dist/operations/migration/superseded-closure.js +187 -0
- package/dist/operations/modeling/logic-modeling.d.ts.map +1 -1
- package/dist/operations/modeling/logic-modeling.js +3 -5
- package/dist/operations/modeling/model-requirement.d.ts.map +1 -1
- package/dist/operations/modeling/model-requirement.js +225 -67
- package/dist/operations/mutation/contradictions.d.ts +16 -0
- package/dist/operations/mutation/contradictions.d.ts.map +1 -1
- package/dist/operations/mutation/contradictions.js +32 -0
- package/dist/operations/mutation/delete.d.ts.map +1 -1
- package/dist/operations/mutation/delete.js +15 -7
- package/dist/operations/mutation/origin.d.ts +21 -0
- package/dist/operations/mutation/origin.d.ts.map +1 -0
- package/dist/operations/mutation/origin.js +78 -0
- package/dist/operations/mutation/plan-apply-journal.d.ts +182 -0
- package/dist/operations/mutation/plan-apply-journal.d.ts.map +1 -0
- package/dist/operations/mutation/plan-apply-journal.js +613 -0
- package/dist/operations/mutation/predicate-vocabulary-guard.d.ts +3 -1
- package/dist/operations/mutation/predicate-vocabulary-guard.d.ts.map +1 -1
- package/dist/operations/mutation/predicate-vocabulary-guard.js +13 -2
- package/dist/operations/mutation/relationships.d.ts +5 -5
- package/dist/operations/mutation/relationships.d.ts.map +1 -1
- package/dist/operations/mutation/relationships.js +31 -11
- package/dist/operations/mutation/serialization.d.ts.map +1 -1
- package/dist/operations/mutation/serialization.js +3 -1
- 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 +7 -1
- package/dist/operations/mutation/symbol-refresh.d.ts.map +1 -1
- package/dist/operations/mutation/symbol-refresh.js +4 -1
- package/dist/operations/mutation/types.d.ts +14 -0
- package/dist/operations/mutation/types.d.ts.map +1 -1
- package/dist/operations/mutation/upsert.d.ts +30 -3
- package/dist/operations/mutation/upsert.d.ts.map +1 -1
- package/dist/operations/mutation/upsert.js +105 -35
- package/dist/operations/mutation/validate-upsert.d.ts +6 -0
- package/dist/operations/mutation/validate-upsert.d.ts.map +1 -1
- package/dist/operations/mutation/validate-upsert.js +34 -30
- package/dist/operations/planning/apply-plan.d.ts.map +1 -1
- package/dist/operations/planning/apply-plan.js +751 -144
- package/dist/operations/planning/compile-intent.d.ts +34 -1
- package/dist/operations/planning/compile-intent.d.ts.map +1 -1
- package/dist/operations/planning/compile-intent.js +314 -98
- package/dist/operations/proof/code-scope.d.ts +28 -0
- package/dist/operations/proof/code-scope.d.ts.map +1 -1
- package/dist/operations/proof/code-scope.js +72 -0
- package/dist/operations/proof/compact-receipts.d.ts +49 -0
- package/dist/operations/proof/compact-receipts.d.ts.map +1 -0
- package/dist/operations/proof/compact-receipts.js +160 -0
- package/dist/operations/proof/ingest-proof.d.ts +2 -0
- package/dist/operations/proof/ingest-proof.d.ts.map +1 -1
- package/dist/operations/proof/ingest-proof.js +44 -23
- package/dist/operations/proof/prune-receipts.d.ts.map +1 -1
- package/dist/operations/proof/prune-receipts.js +5 -9
- package/dist/operations/proof/receipt-compaction.d.ts +48 -0
- package/dist/operations/proof/receipt-compaction.d.ts.map +1 -0
- package/dist/operations/proof/receipt-compaction.js +121 -0
- package/dist/operations/semantic-advisor/analysis-receipt.d.ts.map +1 -1
- package/dist/operations/semantic-advisor/analysis-receipt.js +12 -1
- package/dist/operations/semantic-advisor/analyze-prose.d.ts +2 -1
- package/dist/operations/semantic-advisor/analyze-prose.d.ts.map +1 -1
- package/dist/operations/semantic-advisor/analyze-prose.js +51 -5
- 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 +11 -1
- package/dist/operations/semantic-advisor/conditional-rules.d.ts +33 -0
- package/dist/operations/semantic-advisor/conditional-rules.d.ts.map +1 -0
- package/dist/operations/semantic-advisor/conditional-rules.js +262 -0
- package/dist/operations/semantic-advisor/ingestion-boundary.d.ts +3 -1
- package/dist/operations/semantic-advisor/ingestion-boundary.d.ts.map +1 -1
- package/dist/operations/semantic-advisor/ingestion-boundary.js +14 -6
- package/dist/operations/semantic-advisor/plugin-orchestration.js +1 -1
- package/dist/prolog/codec.d.ts.map +1 -1
- package/dist/prolog/codec.js +2 -1
- package/dist/prolog.d.ts +9 -0
- package/dist/prolog.d.ts.map +1 -1
- package/dist/prolog.js +56 -10
- package/dist/proof/command-test-report.d.ts +74 -0
- package/dist/proof/command-test-report.d.ts.map +1 -0
- package/dist/proof/command-test-report.js +206 -0
- package/dist/public/branch-resolver.d.ts +1 -0
- package/dist/public/branch-resolver.d.ts.map +1 -1
- package/dist/public/branch-resolver.js +1 -0
- package/dist/public/diagnostic-usage.d.ts +14 -0
- package/dist/public/diagnostic-usage.d.ts.map +1 -1
- package/dist/public/diagnostic-usage.js +55 -1
- package/dist/public/entity-origin.d.ts +69 -0
- package/dist/public/entity-origin.d.ts.map +1 -0
- package/dist/public/entity-origin.js +142 -0
- package/dist/public/impact/full-kb-quality.d.ts.map +1 -1
- package/dist/public/impact/full-kb-quality.js +1 -0
- package/dist/public/impact/requirement-quality.js +1 -1
- package/dist/public/operations/catalog.d.ts +203 -20
- package/dist/public/operations/catalog.d.ts.map +1 -1
- package/dist/public/operations/catalog.js +3 -0
- package/dist/public/operations/check-executor.d.ts.map +1 -1
- package/dist/public/operations/check-executor.js +8 -0
- package/dist/public/operations/contracts.d.ts +0 -5
- package/dist/public/operations/contracts.d.ts.map +1 -1
- package/dist/public/operations/contracts.js +63 -14
- package/dist/public/operations/discovery-entities.d.ts +15 -0
- package/dist/public/operations/discovery-entities.d.ts.map +1 -1
- package/dist/public/operations/discovery-entities.js +59 -0
- package/dist/public/operations/discovery-executors.d.ts +6 -1
- package/dist/public/operations/discovery-executors.d.ts.map +1 -1
- package/dist/public/operations/discovery-executors.js +65 -6
- package/dist/public/operations/index.d.ts +1 -0
- package/dist/public/operations/index.d.ts.map +1 -1
- package/dist/public/operations/index.js +1 -0
- package/dist/public/operations/migration-plan.d.ts +5 -0
- package/dist/public/operations/migration-plan.d.ts.map +1 -1
- package/dist/public/operations/migration-plan.js +26 -1
- package/dist/public/operations/node-ports.d.ts.map +1 -1
- package/dist/public/operations/node-ports.js +24 -3
- package/dist/public/operations/origin-review.d.ts +51 -0
- package/dist/public/operations/origin-review.d.ts.map +1 -0
- package/dist/public/operations/origin-review.js +307 -0
- package/dist/public/operations/predicate-schema-conformance.js +1 -1
- package/dist/public/operations/repair-plan.d.ts.map +1 -1
- package/dist/public/operations/repair-plan.js +4 -0
- package/dist/public/operations/result-envelope.d.ts.map +1 -1
- package/dist/public/operations/result-envelope.js +17 -5
- package/dist/public/operations/runtime-types.d.ts +9 -0
- package/dist/public/operations/runtime-types.d.ts.map +1 -1
- package/dist/public/operations/schema6-check-actions.d.ts +127 -0
- package/dist/public/operations/schema6-check-actions.d.ts.map +1 -0
- package/dist/public/operations/schema6-check-actions.js +575 -0
- package/dist/public/operations/source-path-dangling.d.ts +17 -0
- package/dist/public/operations/source-path-dangling.d.ts.map +1 -0
- package/dist/public/operations/source-path-dangling.js +66 -0
- package/dist/public/operations/specs/bootstrap.d.ts +73 -1
- package/dist/public/operations/specs/bootstrap.d.ts.map +1 -1
- package/dist/public/operations/specs/bootstrap.js +66 -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 +15 -1
- package/dist/public/operations/specs/check.d.ts +2 -2
- package/dist/public/operations/specs/check.js +1 -1
- package/dist/public/operations/specs/composite.d.ts +351 -0
- package/dist/public/operations/specs/composite.d.ts.map +1 -0
- package/dist/public/operations/specs/composite.js +96 -0
- package/dist/public/operations/specs/discovery.d.ts +8 -3
- package/dist/public/operations/specs/discovery.d.ts.map +1 -1
- package/dist/public/operations/specs/discovery.js +8 -3
- package/dist/public/operations/specs/modeling.d.ts +2 -2
- package/dist/public/operations/specs/modeling.js +2 -2
- package/dist/public/operations/specs/mutation-schemas.d.ts +73 -8
- package/dist/public/operations/specs/mutation-schemas.d.ts.map +1 -1
- package/dist/public/operations/specs/mutation-schemas.js +43 -7
- package/dist/public/operations/specs/mutation.d.ts +1 -1
- package/dist/public/operations/specs/mutation.js +1 -1
- package/dist/public/operations/specs/planning.d.ts +2 -2
- package/dist/public/operations/specs/planning.js +4 -4
- package/dist/public/operations/specs/reporting.d.ts.map +1 -1
- package/dist/public/operations/specs/reporting.js +13 -26
- package/dist/public/operations/specs/upsert.d.ts +79 -9
- package/dist/public/operations/specs/upsert.d.ts.map +1 -1
- package/dist/public/operations/specs/upsert.js +6 -1
- package/dist/public/operations/symbol-repair-plan.d.ts.map +1 -1
- package/dist/public/operations/symbol-repair-plan.js +3 -1
- package/dist/public/operations/types.d.ts +1 -1
- package/dist/public/operations/types.d.ts.map +1 -1
- package/dist/public/proof-receipt.d.ts +1 -0
- package/dist/public/proof-receipt.d.ts.map +1 -1
- package/dist/public/schemas/entity.d.ts.map +1 -1
- package/dist/public/schemas/entity.js +52 -0
- package/dist/public/schemas/relationship.d.ts.map +1 -1
- package/dist/public/schemas/relationship.js +2 -0
- package/dist/public/skills/kibi-bootstrap/SKILL.md +52 -11
- package/dist/public/skills/kibi-bootstrap/resources/bootstrap.md +12 -1
- package/dist/public/skills/kibi-usage/SKILL.md +82 -18
- package/dist/public/skills/kibi-usage/resources/fact-lanes.md +5 -5
- package/dist/public/skills/kibi-usage/resources/kb-improvement.md +1 -1
- package/dist/public/skills/kibi-usage/resources/logic-ir.md +2 -2
- package/dist/public/skills/kibi-usage/resources/operation-access.md +29 -1
- package/dist/public/skills/kibi-usage/resources/ui-requirements.md +4 -4
- package/dist/public/skills/kibi-usage/resources/workflows.md +42 -25
- package/dist/public/telemetry-acceptance.d.ts +64 -0
- package/dist/public/telemetry-acceptance.d.ts.map +1 -1
- package/dist/public/telemetry-acceptance.js +143 -7
- package/dist/public/telemetry-remediation.d.ts.map +1 -1
- package/dist/public/telemetry-remediation.js +26 -10
- package/dist/relationships/shards.d.ts +13 -0
- package/dist/relationships/shards.d.ts.map +1 -1
- package/dist/relationships/shards.js +54 -28
- package/dist/runtime/cli-runtime.d.ts.map +1 -1
- package/dist/runtime/cli-runtime.js +44 -3
- package/dist/runtime/detached-snapshot.d.ts +38 -0
- package/dist/runtime/detached-snapshot.d.ts.map +1 -0
- package/dist/runtime/detached-snapshot.js +92 -0
- package/dist/schemas/entity.schema.json +122 -0
- package/dist/search-answer.d.ts +157 -0
- package/dist/search-answer.d.ts.map +1 -0
- package/dist/search-answer.js +846 -0
- package/dist/traceability/impact-knowledge.d.ts.map +1 -1
- package/dist/traceability/impact-knowledge.js +7 -0
- package/dist/traceability/symbol-extract.js +3 -3
- package/dist/traceability/temp-kb.d.ts.map +1 -1
- package/dist/traceability/temp-kb.js +12 -0
- package/dist/types/entities.d.ts +13 -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/branch-resolver.d.ts +37 -1
- package/dist/utils/branch-resolver.d.ts.map +1 -1
- package/dist/utils/branch-resolver.js +130 -3
- package/dist/utils/repo-relative-path.d.ts +18 -0
- package/dist/utils/repo-relative-path.d.ts.map +1 -0
- package/dist/utils/repo-relative-path.js +58 -0
- package/dist/utils/rule-registry.generated.d.ts +75 -3
- package/dist/utils/rule-registry.generated.d.ts.map +1 -1
- package/dist/utils/rule-registry.generated.js +89 -3
- 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 +4 -3
- package/dist/utils/strict-modeling.d.ts +1 -1
- package/dist/utils/strict-modeling.d.ts.map +1 -1
- package/dist/utils/strict-modeling.js +23 -3
- package/package.json +3 -3
- package/schema/entities.pl +22 -0
- package/schema/relationships.pl +14 -0
- package/schema/validation.pl +45 -1
- package/src/public/branch-resolver.ts +1 -0
- package/src/public/diagnostic-usage.ts +59 -1
- package/src/public/entity-origin.ts +175 -0
- package/src/public/impact/full-kb-quality.ts +1 -0
- package/src/public/impact/requirement-quality.ts +1 -1
- package/src/public/operations/catalog.ts +3 -0
- package/src/public/operations/check-executor.ts +15 -0
- package/src/public/operations/contracts.ts +75 -15
- package/src/public/operations/discovery-entities.ts +74 -0
- package/src/public/operations/discovery-executors.ts +88 -10
- package/src/public/operations/index.ts +1 -0
- package/src/public/operations/migration-plan.ts +30 -1
- package/src/public/operations/node-ports.ts +24 -3
- package/src/public/operations/origin-review.ts +375 -0
- package/src/public/operations/predicate-schema-conformance.ts +1 -1
- package/src/public/operations/repair-plan.ts +4 -0
- package/src/public/operations/result-envelope.ts +18 -6
- package/src/public/operations/runtime-types.ts +9 -0
- package/src/public/operations/schema6-check-actions.ts +699 -0
- package/src/public/operations/source-path-dangling.ts +81 -0
- package/src/public/operations/specs/bootstrap.ts +78 -4
- package/src/public/operations/specs/check-rules.generated.ts +15 -1
- package/src/public/operations/specs/check.ts +1 -1
- package/src/public/operations/specs/composite.ts +141 -0
- package/src/public/operations/specs/discovery.ts +9 -3
- package/src/public/operations/specs/modeling.ts +2 -2
- package/src/public/operations/specs/mutation-schemas.ts +49 -7
- package/src/public/operations/specs/mutation.ts +1 -1
- package/src/public/operations/specs/planning.ts +4 -4
- package/src/public/operations/specs/reporting.ts +13 -38
- package/src/public/operations/specs/upsert.ts +7 -1
- package/src/public/operations/symbol-repair-plan.ts +3 -1
- package/src/public/operations/types.ts +2 -0
- package/src/public/proof-receipt.ts +1 -0
- package/src/public/schemas/entity.ts +57 -0
- package/src/public/schemas/relationship.ts +2 -0
- package/src/public/skills/kibi-bootstrap/SKILL.md +52 -11
- package/src/public/skills/kibi-bootstrap/resources/bootstrap.md +12 -1
- package/src/public/skills/kibi-usage/SKILL.md +82 -18
- package/src/public/skills/kibi-usage/resources/fact-lanes.md +5 -5
- package/src/public/skills/kibi-usage/resources/kb-improvement.md +1 -1
- package/src/public/skills/kibi-usage/resources/logic-ir.md +2 -2
- package/src/public/skills/kibi-usage/resources/operation-access.md +29 -1
- package/src/public/skills/kibi-usage/resources/ui-requirements.md +4 -4
- package/src/public/skills/kibi-usage/resources/workflows.md +42 -25
- package/src/public/telemetry-acceptance-types.d.ts +4 -1
- package/src/public/telemetry-acceptance.ts +210 -7
- package/src/public/telemetry-remediation.ts +39 -10
- package/src/schemas/entity.schema.json +122 -0
- package/src/schemas/relationship.schema.json +2 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"node-ports.d.ts","sourceRoot":"","sources":["../../../src/public/operations/node-ports.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,cAAc,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAE/E,KAAK,kBAAkB,GAAG,cAAc,GAAG;IACzC,QAAQ,CAAC,IAAI,EAAE,CACb,QAAQ,EAAE,SAAS,MAAM,EAAE,EAC3B,OAAO,EAAE;QAAE,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,cAAc,CAAC,EAAE,OAAO,CAAA;KAAE,KACjE,OAAO,CAAC,SAAS,MAAM,EAAE,CAAC,CAAC;CACjC,CAAC;AAEF,KAAK,WAAW,GAAG,OAAO,GAAG;IAC3B,QAAQ,CAAC,YAAY,EAAE,CACrB,aAAa,EAAE,MAAM,EACrB,KAAK,EAAE,SAAS,MAAM,EAAE,KACrB,OAAO,CAAC,SAAS,MAAM,EAAE,CAAC,CAAC;CACjC,CAAC;
|
|
1
|
+
{"version":3,"file":"node-ports.d.ts","sourceRoot":"","sources":["../../../src/public/operations/node-ports.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,cAAc,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAE/E,KAAK,kBAAkB,GAAG,cAAc,GAAG;IACzC,QAAQ,CAAC,IAAI,EAAE,CACb,QAAQ,EAAE,SAAS,MAAM,EAAE,EAC3B,OAAO,EAAE;QAAE,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,cAAc,CAAC,EAAE,OAAO,CAAA;KAAE,KACjE,OAAO,CAAC,SAAS,MAAM,EAAE,CAAC,CAAC;CACjC,CAAC;AAEF,KAAK,WAAW,GAAG,OAAO,GAAG;IAC3B,QAAQ,CAAC,YAAY,EAAE,CACrB,aAAa,EAAE,MAAM,EACrB,KAAK,EAAE,SAAS,MAAM,EAAE,KACrB,OAAO,CAAC,SAAS,MAAM,EAAE,CAAC,CAAC;CACjC,CAAC;AAkKF,eAAO,MAAM,cAAc,EAAE,kBAkC5B,CAAC;AAEF,eAAO,MAAM,OAAO,EAAE,WAiBrB,CAAC;AAEF,eAAO,MAAM,WAAW,EAAE,WAEzB,CAAC"}
|
|
@@ -66,19 +66,24 @@ async function workspaceSnapshot(workspaceRoot) {
|
|
|
66
66
|
"--exclude-standard",
|
|
67
67
|
"-z",
|
|
68
68
|
], { encoding: "buffer", maxBuffer: 64 * 1024 * 1024 });
|
|
69
|
+
// The snapshot names each file by its repo-relative path in Unicode NFC, so
|
|
70
|
+
// a checkout whose filesystem reports decomposed names (macOS) hashes the
|
|
71
|
+
// same commit to the same snapshot as a Linux CI runner. The raw name is
|
|
72
|
+
// kept only to read the file.
|
|
69
73
|
const paths = listed
|
|
70
74
|
.toString("utf8")
|
|
71
75
|
.split("\0")
|
|
72
76
|
.filter(Boolean)
|
|
73
77
|
.filter(includedSnapshotPath)
|
|
74
|
-
.
|
|
78
|
+
.map((raw) => ({ raw, key: raw.normalize("NFC") }))
|
|
79
|
+
.sort((left, right) => left.key < right.key ? -1 : left.key > right.key ? 1 : 0);
|
|
75
80
|
const digest = createHash("sha256");
|
|
76
81
|
digest.update("kibi.workspace-snapshot.v2\0");
|
|
77
|
-
for (const relativePath of paths) {
|
|
82
|
+
for (const { raw, key: relativePath } of paths) {
|
|
78
83
|
digest.update(relativePath);
|
|
79
84
|
digest.update("\0");
|
|
80
85
|
try {
|
|
81
|
-
const content = await fs.readFile(path.join(workspaceRoot,
|
|
86
|
+
const content = await fs.readFile(path.join(workspaceRoot, raw));
|
|
82
87
|
digest.update(snapshotFileContent(relativePath, content));
|
|
83
88
|
}
|
|
84
89
|
catch (error) {
|
|
@@ -141,6 +146,22 @@ export const nodeFilesystem = {
|
|
|
141
146
|
},
|
|
142
147
|
stat: (filePath) => fs.stat(filePath),
|
|
143
148
|
unlink: (filePath) => fs.unlink(filePath),
|
|
149
|
+
fsync: async (filePath) => {
|
|
150
|
+
// Windows cannot open a directory handle; directory entries are durable
|
|
151
|
+
// there once the rename returns.
|
|
152
|
+
if (process.platform === "win32") {
|
|
153
|
+
const stat = await fs.stat(filePath);
|
|
154
|
+
if (stat.isDirectory())
|
|
155
|
+
return;
|
|
156
|
+
}
|
|
157
|
+
const handle = await fs.open(filePath, "r");
|
|
158
|
+
try {
|
|
159
|
+
await handle.sync();
|
|
160
|
+
}
|
|
161
|
+
finally {
|
|
162
|
+
await handle.close();
|
|
163
|
+
}
|
|
164
|
+
},
|
|
144
165
|
glob: (patterns, options) => fg([...patterns], {
|
|
145
166
|
cwd: options.cwd,
|
|
146
167
|
onlyFiles: true,
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import type { Violation } from "../../utils/rule-registry.js";
|
|
2
|
+
import type { PrologPort } from "./runtime-types.js";
|
|
3
|
+
/**
|
|
4
|
+
* Advisory review of who approved what. Kibi cannot verify that a person
|
|
5
|
+
* approved anything; these rules make agent-recorded approvals and
|
|
6
|
+
* agent-authored requirements visible so a human can confirm them.
|
|
7
|
+
*/
|
|
8
|
+
/** An exception without approved_by exempts nothing. */
|
|
9
|
+
export declare const EXCEPTION_UNAPPROVED_RULE = "exception-unapproved";
|
|
10
|
+
/** An agent recorded an exception approval without human corroboration. */
|
|
11
|
+
export declare const EXCEPTION_APPROVAL_SELF_ATTESTED_RULE = "exception-approval-self-attested";
|
|
12
|
+
/** Agent-authored requirements no human has approved yet. */
|
|
13
|
+
export declare const AGENT_REQUIREMENT_UNAPPROVED_RULE = "agent-requirement-unapproved";
|
|
14
|
+
/** A human- or agent-authored requirement that records no reason. */
|
|
15
|
+
export declare const REQUIREMENT_RATIONALE_MISSING_RULE = "requirement-rationale-missing";
|
|
16
|
+
export declare const ORIGIN_REVIEW_RULES: readonly ["exception-unapproved", "exception-approval-self-attested", "agent-requirement-unapproved", "requirement-rationale-missing"];
|
|
17
|
+
/**
|
|
18
|
+
* agent-requirement-unapproved lists at most this many requirements (sorted
|
|
19
|
+
* by id) and then one summary finding, so a large agent-authored KB yields a
|
|
20
|
+
* bounded review queue instead of one warning per requirement.
|
|
21
|
+
*/
|
|
22
|
+
export declare const AGENT_REQUIREMENT_REVIEW_LIMIT = 25;
|
|
23
|
+
type Entity = Readonly<Record<string, unknown>>;
|
|
24
|
+
export type OriginReviewInput = Readonly<{
|
|
25
|
+
requirements: readonly Entity[];
|
|
26
|
+
/** `[exception, base]` pairs of `exempts` relationships. */
|
|
27
|
+
exempts: readonly (readonly [string, string])[];
|
|
28
|
+
/** Requirements some other requirement supersedes. */
|
|
29
|
+
superseded: ReadonlySet<string>;
|
|
30
|
+
/** Requirements linked to an ADR (either direction, any typed edge). */
|
|
31
|
+
adrLinked?: ReadonlySet<string>;
|
|
32
|
+
/** Whether the requirement's document has a Rationale or Why section. */
|
|
33
|
+
hasRationaleSection?: (entity: Entity) => boolean;
|
|
34
|
+
}>;
|
|
35
|
+
/**
|
|
36
|
+
* True when a Markdown document (frontmatter ignored) has a heading that
|
|
37
|
+
* starts with "Rationale" or "Why", at any level.
|
|
38
|
+
*/
|
|
39
|
+
export declare function markdownHasRationaleSection(content: string): boolean;
|
|
40
|
+
/**
|
|
41
|
+
* Read each requirement's own document (its compiled `source`) at most once
|
|
42
|
+
* and report whether it has a Rationale or Why section. Unreadable files
|
|
43
|
+
* count as having none.
|
|
44
|
+
*/
|
|
45
|
+
export declare function rationaleSectionReader(workspaceRoot: string): (entity: Entity) => boolean;
|
|
46
|
+
/** Evaluate the origin review rules over loaded requirements. */
|
|
47
|
+
export declare function evaluateOriginReview(input: OriginReviewInput, rules?: ReadonlySet<string>): Violation[];
|
|
48
|
+
/** Load requirements and relationships once and evaluate the selected rules. */
|
|
49
|
+
export declare function collectOriginReviewViolations(prolog: Pick<PrologPort, "query">, rules: ReadonlySet<string>, workspaceRoot?: string): Promise<Violation[]>;
|
|
50
|
+
export {};
|
|
51
|
+
//# sourceMappingURL=origin-review.d.ts.map
|
|
@@ -0,0 +1 @@
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7B;AAsBD,iEAAiE;AAEjE,wBAAgB,oBAAoB,CAClC,KAAK,EAAE,iBAAiB,EACxB,KAAK,GAAE,WAAW,CAAC,MAAM,CAAgC,GACxD,SAAS,EAAE,CAmGb;AA8ED,gFAAgF;AAEhF,wBAAsB,6BAA6B,CACjD,MAAM,EAAE,IAAI,CAAC,UAAU,EAAE,OAAO,CAAC,EACjC,KAAK,EAAE,WAAW,CAAC,MAAM,CAAC,EAC1B,aAAa,CAAC,EAAE,MAAM,GACrB,OAAO,CAAC,SAAS,EAAE,CAAC,CAgCtB"}
|
|
@@ -0,0 +1,307 @@
|
|
|
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 { readFileSync } from "node:fs";
|
|
19
|
+
import path from "node:path";
|
|
20
|
+
import { parseListOfLists, parsePrologValue } from "../../prolog/codec.js";
|
|
21
|
+
import { readEntityOrigin } from "../entity-origin.js";
|
|
22
|
+
import { loadEntitiesPaged } from "./discovery-entities.js";
|
|
23
|
+
/**
|
|
24
|
+
* Advisory review of who approved what. Kibi cannot verify that a person
|
|
25
|
+
* approved anything; these rules make agent-recorded approvals and
|
|
26
|
+
* agent-authored requirements visible so a human can confirm them.
|
|
27
|
+
*/
|
|
28
|
+
/** An exception without approved_by exempts nothing. */
|
|
29
|
+
// implements REQ-kibi-entity-origin
|
|
30
|
+
export const EXCEPTION_UNAPPROVED_RULE = "exception-unapproved";
|
|
31
|
+
/** An agent recorded an exception approval without human corroboration. */
|
|
32
|
+
// implements REQ-kibi-entity-origin
|
|
33
|
+
export const EXCEPTION_APPROVAL_SELF_ATTESTED_RULE = "exception-approval-self-attested";
|
|
34
|
+
/** Agent-authored requirements no human has approved yet. */
|
|
35
|
+
// implements REQ-kibi-entity-origin
|
|
36
|
+
export const AGENT_REQUIREMENT_UNAPPROVED_RULE = "agent-requirement-unapproved";
|
|
37
|
+
/** A human- or agent-authored requirement that records no reason. */
|
|
38
|
+
// implements REQ-core-validation-rules
|
|
39
|
+
export const REQUIREMENT_RATIONALE_MISSING_RULE = "requirement-rationale-missing";
|
|
40
|
+
// implements REQ-kibi-entity-origin
|
|
41
|
+
export const ORIGIN_REVIEW_RULES = [
|
|
42
|
+
EXCEPTION_UNAPPROVED_RULE,
|
|
43
|
+
EXCEPTION_APPROVAL_SELF_ATTESTED_RULE,
|
|
44
|
+
AGENT_REQUIREMENT_UNAPPROVED_RULE,
|
|
45
|
+
REQUIREMENT_RATIONALE_MISSING_RULE,
|
|
46
|
+
];
|
|
47
|
+
/**
|
|
48
|
+
* Origins whose author could have said why. Imported, inferred and legacy
|
|
49
|
+
* requirements were transcribed from somewhere else; their reason lives
|
|
50
|
+
* with the original, so requirement-rationale-missing does not ask for it.
|
|
51
|
+
*/
|
|
52
|
+
const RATIONALE_ORIGIN_KINDS = new Set(["human", "agent"]);
|
|
53
|
+
/**
|
|
54
|
+
* agent-requirement-unapproved lists at most this many requirements (sorted
|
|
55
|
+
* by id) and then one summary finding, so a large agent-authored KB yields a
|
|
56
|
+
* bounded review queue instead of one warning per requirement.
|
|
57
|
+
*/
|
|
58
|
+
// implements REQ-kibi-entity-origin
|
|
59
|
+
export const AGENT_REQUIREMENT_REVIEW_LIMIT = 25;
|
|
60
|
+
const CURRENT_REQUIREMENT_STATUSES = new Set([
|
|
61
|
+
"open",
|
|
62
|
+
"in_progress",
|
|
63
|
+
"closed",
|
|
64
|
+
"active",
|
|
65
|
+
"approved",
|
|
66
|
+
]);
|
|
67
|
+
const RATIONALE_HEADING = /^#{1,6}[ \t]+(?:rationale|why)\b/im;
|
|
68
|
+
/**
|
|
69
|
+
* True when a Markdown document (frontmatter ignored) has a heading that
|
|
70
|
+
* starts with "Rationale" or "Why", at any level.
|
|
71
|
+
*/
|
|
72
|
+
// implements REQ-kibi-entity-origin
|
|
73
|
+
export function markdownHasRationaleSection(content) {
|
|
74
|
+
const body = content.startsWith("---")
|
|
75
|
+
? content.replace(/^---\r?\n[\s\S]*?\r?\n---[ \t]*(?:\r?\n|$)/, "")
|
|
76
|
+
: content;
|
|
77
|
+
return RATIONALE_HEADING.test(body);
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Read each requirement's own document (its compiled `source`) at most once
|
|
81
|
+
* and report whether it has a Rationale or Why section. Unreadable files
|
|
82
|
+
* count as having none.
|
|
83
|
+
*/
|
|
84
|
+
// implements REQ-kibi-entity-origin
|
|
85
|
+
export function rationaleSectionReader(workspaceRoot) {
|
|
86
|
+
const cache = new Map();
|
|
87
|
+
return (entity) => {
|
|
88
|
+
const source = text(entity.source);
|
|
89
|
+
if (source === undefined || !source.endsWith(".md"))
|
|
90
|
+
return false;
|
|
91
|
+
const file = path.resolve(workspaceRoot, source);
|
|
92
|
+
const cached = cache.get(file);
|
|
93
|
+
if (cached !== undefined)
|
|
94
|
+
return cached;
|
|
95
|
+
let found = false;
|
|
96
|
+
try {
|
|
97
|
+
found = markdownHasRationaleSection(readFileSync(file, "utf8"));
|
|
98
|
+
}
|
|
99
|
+
catch {
|
|
100
|
+
found = false;
|
|
101
|
+
}
|
|
102
|
+
cache.set(file, found);
|
|
103
|
+
return found;
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
function text(value) {
|
|
107
|
+
return typeof value === "string" && value.trim() !== ""
|
|
108
|
+
? value.trim()
|
|
109
|
+
: undefined;
|
|
110
|
+
}
|
|
111
|
+
function sourceField(entity) {
|
|
112
|
+
const source = text(entity.source);
|
|
113
|
+
return source !== undefined ? { source } : {};
|
|
114
|
+
}
|
|
115
|
+
function isCurrent(entity, superseded) {
|
|
116
|
+
const status = text(entity.status);
|
|
117
|
+
return (status !== undefined &&
|
|
118
|
+
CURRENT_REQUIREMENT_STATUSES.has(status) &&
|
|
119
|
+
!superseded.has(String(entity.id)));
|
|
120
|
+
}
|
|
121
|
+
/** Evaluate the origin review rules over loaded requirements. */
|
|
122
|
+
// implements REQ-kibi-entity-origin
|
|
123
|
+
export function evaluateOriginReview(input, rules = new Set(ORIGIN_REVIEW_RULES)) {
|
|
124
|
+
const byId = new Map(input.requirements.map((entity) => [String(entity.id), entity]));
|
|
125
|
+
const current = [...byId.values()]
|
|
126
|
+
.filter((entity) => isCurrent(entity, input.superseded))
|
|
127
|
+
.sort((left, right) => String(left.id).localeCompare(String(right.id)));
|
|
128
|
+
const exempted = new Map();
|
|
129
|
+
for (const [exception, base] of input.exempts) {
|
|
130
|
+
exempted.set(exception, [...(exempted.get(exception) ?? []), base]);
|
|
131
|
+
}
|
|
132
|
+
const findings = [];
|
|
133
|
+
for (const entity of current) {
|
|
134
|
+
const id = String(entity.id);
|
|
135
|
+
const bases = [...new Set(exempted.get(id) ?? [])].sort();
|
|
136
|
+
if (bases.length === 0)
|
|
137
|
+
continue;
|
|
138
|
+
const approvedBy = text(entity.approved_by);
|
|
139
|
+
const approvalRef = text(entity.approval_ref);
|
|
140
|
+
const origin = readEntityOrigin(entity.origin);
|
|
141
|
+
if (approvedBy === undefined) {
|
|
142
|
+
if (!rules.has(EXCEPTION_UNAPPROVED_RULE))
|
|
143
|
+
continue;
|
|
144
|
+
findings.push({
|
|
145
|
+
rule: EXCEPTION_UNAPPROVED_RULE,
|
|
146
|
+
entityId: id,
|
|
147
|
+
description: `Exception ${id} exempts ${bases.join(", ")} but has no approved_by, so it exempts nothing: success scenarios it specifies are still checked against ${bases.join(", ")}`,
|
|
148
|
+
suggestion: `Have a human decide: set approved_by (and approval_ref to the decision record) on ${id} if the exception is approved, or remove the exempts link and set expects: rejection on the scenario if it is not`,
|
|
149
|
+
...sourceField(entity),
|
|
150
|
+
evidence: { exceptionId: id, exempts: bases },
|
|
151
|
+
});
|
|
152
|
+
continue;
|
|
153
|
+
}
|
|
154
|
+
if (!rules.has(EXCEPTION_APPROVAL_SELF_ATTESTED_RULE) ||
|
|
155
|
+
origin?.kind !== "agent") {
|
|
156
|
+
continue;
|
|
157
|
+
}
|
|
158
|
+
const missing = [
|
|
159
|
+
...(origin.approved_by === undefined ? ["origin.approved_by"] : []),
|
|
160
|
+
...(approvalRef === undefined ? ["approval_ref"] : []),
|
|
161
|
+
];
|
|
162
|
+
if (missing.length === 0)
|
|
163
|
+
continue;
|
|
164
|
+
findings.push({
|
|
165
|
+
rule: EXCEPTION_APPROVAL_SELF_ATTESTED_RULE,
|
|
166
|
+
entityId: id,
|
|
167
|
+
description: `Exception ${id} was recorded by an agent with approved_by '${approvedBy}', but nothing corroborates the approval (missing ${missing.join(" and ")})`,
|
|
168
|
+
suggestion: `Have ${approvedBy} (or another human) confirm the exception: set origin.approved_by to the confirming person and approval_ref to the decision record (ticket, ADR or review link) on ${id}; if nobody approved it, remove approved_by so the exception stops exempting ${bases.join(", ")}`,
|
|
169
|
+
...sourceField(entity),
|
|
170
|
+
evidence: {
|
|
171
|
+
exceptionId: id,
|
|
172
|
+
exempts: bases,
|
|
173
|
+
approvedBy,
|
|
174
|
+
origin,
|
|
175
|
+
missing,
|
|
176
|
+
},
|
|
177
|
+
});
|
|
178
|
+
}
|
|
179
|
+
if (rules.has(AGENT_REQUIREMENT_UNAPPROVED_RULE)) {
|
|
180
|
+
const unreviewed = current.filter((entity) => {
|
|
181
|
+
const origin = readEntityOrigin(entity.origin);
|
|
182
|
+
return origin?.kind === "agent" && origin.approved_by === undefined;
|
|
183
|
+
});
|
|
184
|
+
for (const entity of unreviewed.slice(0, AGENT_REQUIREMENT_REVIEW_LIMIT)) {
|
|
185
|
+
const origin = readEntityOrigin(entity.origin);
|
|
186
|
+
findings.push({
|
|
187
|
+
rule: AGENT_REQUIREMENT_UNAPPROVED_RULE,
|
|
188
|
+
entityId: String(entity.id),
|
|
189
|
+
description: `Requirement ${String(entity.id)} was authored by an agent${origin?.ref !== undefined ? ` (${origin.ref})` : ""} and no human has approved it`,
|
|
190
|
+
suggestion: "Review the requirement text; when it states the intended behavior, record the reviewer in origin.approved_by (keep kind: agent and the rest of origin)",
|
|
191
|
+
...sourceField(entity),
|
|
192
|
+
evidence: { origin },
|
|
193
|
+
});
|
|
194
|
+
}
|
|
195
|
+
const remaining = unreviewed.length - AGENT_REQUIREMENT_REVIEW_LIMIT;
|
|
196
|
+
if (remaining > 0) {
|
|
197
|
+
findings.push({
|
|
198
|
+
rule: AGENT_REQUIREMENT_UNAPPROVED_RULE,
|
|
199
|
+
entityId: "workspace",
|
|
200
|
+
description: `${remaining} more agent-authored requirement(s) have no human approval; the list above stops at ${AGENT_REQUIREMENT_REVIEW_LIMIT}`,
|
|
201
|
+
suggestion: "Approve the listed requirements first; the next kb_check lists the following ones",
|
|
202
|
+
evidence: {
|
|
203
|
+
total: unreviewed.length,
|
|
204
|
+
listed: AGENT_REQUIREMENT_REVIEW_LIMIT,
|
|
205
|
+
remainingIds: unreviewed
|
|
206
|
+
.slice(AGENT_REQUIREMENT_REVIEW_LIMIT)
|
|
207
|
+
.map((entity) => String(entity.id)),
|
|
208
|
+
},
|
|
209
|
+
});
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
if (rules.has(REQUIREMENT_RATIONALE_MISSING_RULE)) {
|
|
213
|
+
findings.push(...rationaleFindings(current, input));
|
|
214
|
+
}
|
|
215
|
+
return findings;
|
|
216
|
+
}
|
|
217
|
+
/**
|
|
218
|
+
* requirement-rationale-missing: a requirement a person or agent wrote
|
|
219
|
+
* (origin kind human or agent) with no `rationale`, no Rationale/Why
|
|
220
|
+
* section and no ADR link. Capped like agent-requirement-unapproved.
|
|
221
|
+
*/
|
|
222
|
+
function rationaleFindings(current, input) {
|
|
223
|
+
const adrLinked = input.adrLinked ?? new Set();
|
|
224
|
+
const missing = current.filter((entity) => {
|
|
225
|
+
const origin = readEntityOrigin(entity.origin);
|
|
226
|
+
if (origin === null || !RATIONALE_ORIGIN_KINDS.has(origin.kind)) {
|
|
227
|
+
return false;
|
|
228
|
+
}
|
|
229
|
+
if (text(entity.rationale) !== undefined)
|
|
230
|
+
return false;
|
|
231
|
+
if (adrLinked.has(String(entity.id)))
|
|
232
|
+
return false;
|
|
233
|
+
return input.hasRationaleSection?.(entity) !== true;
|
|
234
|
+
});
|
|
235
|
+
const findings = missing
|
|
236
|
+
.slice(0, AGENT_REQUIREMENT_REVIEW_LIMIT)
|
|
237
|
+
.map((entity) => ({
|
|
238
|
+
rule: REQUIREMENT_RATIONALE_MISSING_RULE,
|
|
239
|
+
entityId: String(entity.id),
|
|
240
|
+
description: `Requirement ${String(entity.id)} does not say why it exists: it has no rationale field, no Rationale or Why section and no linked ADR`,
|
|
241
|
+
suggestion: "Ask the person who stated the intent why it matters and record the answer in rationale (one or two sentences), or link the ADR that explains the decision",
|
|
242
|
+
...sourceField(entity),
|
|
243
|
+
evidence: { origin: readEntityOrigin(entity.origin) },
|
|
244
|
+
}));
|
|
245
|
+
const remaining = missing.length - AGENT_REQUIREMENT_REVIEW_LIMIT;
|
|
246
|
+
if (remaining > 0) {
|
|
247
|
+
findings.push({
|
|
248
|
+
rule: REQUIREMENT_RATIONALE_MISSING_RULE,
|
|
249
|
+
entityId: "workspace",
|
|
250
|
+
description: `${remaining} more requirement(s) do not say why they exist; the list above stops at ${AGENT_REQUIREMENT_REVIEW_LIMIT}`,
|
|
251
|
+
suggestion: "Record the rationale of the listed requirements first; the next kb_check lists the following ones",
|
|
252
|
+
evidence: {
|
|
253
|
+
total: missing.length,
|
|
254
|
+
listed: AGENT_REQUIREMENT_REVIEW_LIMIT,
|
|
255
|
+
remainingIds: missing
|
|
256
|
+
.slice(AGENT_REQUIREMENT_REVIEW_LIMIT)
|
|
257
|
+
.map((entity) => String(entity.id)),
|
|
258
|
+
},
|
|
259
|
+
});
|
|
260
|
+
}
|
|
261
|
+
return findings;
|
|
262
|
+
}
|
|
263
|
+
/**
|
|
264
|
+
* `[type, from, to]` rows the review reads, in one query: every `exempts` and
|
|
265
|
+
* `supersedes` edge, plus `[adr_link, Req, Adr]` for each requirement linked
|
|
266
|
+
* with an ADR by any typed edge in either direction.
|
|
267
|
+
*/
|
|
268
|
+
async function reviewRelationships(prolog) {
|
|
269
|
+
const result = await prolog.query("findall([Type,From,To], ((member(Type, [exempts, supersedes]), kb_relationship(Type, From, To)) ; (Type = adr_link, kb_entity(To, adr, _), kibi_relationships:relationship_type(Rel), (kb_relationship(Rel, To, From) ; kb_relationship(Rel, From, To)), kb_entity(From, req, _))), Rows)");
|
|
270
|
+
if (!result.success) {
|
|
271
|
+
throw new Error(`Unable to read exempts, supersedes and ADR relationships: ${result.error ?? "query failed"}`);
|
|
272
|
+
}
|
|
273
|
+
return parseListOfLists(result.bindings.Rows ?? "[]").map(([type, from, to]) => [
|
|
274
|
+
String(parsePrologValue(type ?? "")),
|
|
275
|
+
String(parsePrologValue(from ?? "")),
|
|
276
|
+
String(parsePrologValue(to ?? "")),
|
|
277
|
+
]);
|
|
278
|
+
}
|
|
279
|
+
/** Load requirements and relationships once and evaluate the selected rules. */
|
|
280
|
+
// implements REQ-kibi-entity-origin
|
|
281
|
+
export async function collectOriginReviewViolations(prolog, rules, workspaceRoot) {
|
|
282
|
+
if (!ORIGIN_REVIEW_RULES.some((rule) => rules.has(rule)))
|
|
283
|
+
return [];
|
|
284
|
+
// One Prolog port serves queries in order; read sequentially.
|
|
285
|
+
const requirements = await loadEntitiesPaged(prolog, "req");
|
|
286
|
+
const relationships = await reviewRelationships(prolog);
|
|
287
|
+
const rationale = rules.has(REQUIREMENT_RATIONALE_MISSING_RULE)
|
|
288
|
+
? {
|
|
289
|
+
adrLinked: new Set(relationships
|
|
290
|
+
.filter(([type]) => type === "adr_link")
|
|
291
|
+
.map(([, from]) => from)),
|
|
292
|
+
...(workspaceRoot !== undefined
|
|
293
|
+
? { hasRationaleSection: rationaleSectionReader(workspaceRoot) }
|
|
294
|
+
: {}),
|
|
295
|
+
}
|
|
296
|
+
: {};
|
|
297
|
+
return evaluateOriginReview({
|
|
298
|
+
requirements,
|
|
299
|
+
exempts: relationships
|
|
300
|
+
.filter(([type]) => type === "exempts")
|
|
301
|
+
.map(([, from, to]) => [from, to]),
|
|
302
|
+
superseded: new Set(relationships
|
|
303
|
+
.filter(([type]) => type === "supersedes")
|
|
304
|
+
.map(([, , to]) => to)),
|
|
305
|
+
...rationale,
|
|
306
|
+
}, rules);
|
|
307
|
+
}
|
|
@@ -232,7 +232,7 @@ function conformanceSuggestion(evidence) {
|
|
|
232
232
|
if (evidence.candidateNamespaces.length > 1) {
|
|
233
233
|
return "Set predicate_namespace to the schema this claim belongs to.";
|
|
234
234
|
}
|
|
235
|
-
return "Declare a predicate_schema for this signature (
|
|
235
|
+
return "Declare a predicate_schema for this signature (kb_model mode predicates helps pick an existing one) or move the claim to a schema that already exists.";
|
|
236
236
|
}
|
|
237
237
|
/** Load every fact once and evaluate predicate conformance. */
|
|
238
238
|
// implements REQ-kibi-predicate-schema-conformance
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"repair-plan.d.ts","sourceRoot":"","sources":["../../../src/public/operations/repair-plan.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,mBAAmB,EAAG,qBAA8B,CAAC;AAElE,KAAK,qBAAqB,GAAG;IAC3B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,aAAa,EAAE,SAAS,MAAM,EAAE,CAAC;IAC1C,Q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C;IACxB,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;CAC1B,CAAC;AAEF,KAAK,qBAAqB,GAAG;IAC3B,QAAQ,CAAC,OAAO,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IACpD,QAAQ,CAAC,IAAI,CAAC,EAAE,SAAS,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,EAAE,CAAC;CAC9D,CAAC;AAgLF,wBAAgB,eAAe,CAC7B,OAAO,EAAE,qBAAqB,EAC9B,KAAK,EAAE,eAAe,EACtB,YAAY,EAAE,MAAM,GACnB,UAAU,GAAG,SAAS,CA4FxB"}
|
|
@@ -171,6 +171,8 @@ const GAP_PHASE = {
|
|
|
171
171
|
logic_manifest_mismatch: "manifest_links",
|
|
172
172
|
blocking_contradiction: "contradiction_resolution",
|
|
173
173
|
missing_scenario: "scenario_endpoints",
|
|
174
|
+
infeasible_scenario: "scenario_endpoints",
|
|
175
|
+
unknown_scenario_feasibility: "scenario_endpoints",
|
|
174
176
|
missing_scenario_test: "scenario_tests",
|
|
175
177
|
proof_snapshot_unavailable: "snapshot_runtime",
|
|
176
178
|
missing_passing_e2e: "proof_evidence",
|
|
@@ -197,6 +199,8 @@ const GAP_STAGE = {
|
|
|
197
199
|
blocking_contradiction: "contradictions",
|
|
198
200
|
contradiction_check_incomplete: "contradictions",
|
|
199
201
|
missing_scenario: "scenarios",
|
|
202
|
+
infeasible_scenario: "scenarios",
|
|
203
|
+
unknown_scenario_feasibility: "scenarios",
|
|
200
204
|
missing_scenario_test: "scenario_tests",
|
|
201
205
|
missing_passing_e2e: "passing_e2e",
|
|
202
206
|
missing_proof_receipt: "passing_e2e",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"result-envelope.d.ts","sourceRoot":"","sources":["../../../src/public/operations/result-envelope.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,E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,OAAO,CAAC,GAAG,SAAS,GAC3C,IAAI,CAKN"}
|
|
@@ -105,10 +105,22 @@ export function resultVersion(spec) {
|
|
|
105
105
|
}
|
|
106
106
|
export function toKibiResult(spec, data, options = {}) {
|
|
107
107
|
const row = record(data) ? data : undefined;
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
108
|
+
let status = options.status;
|
|
109
|
+
if (!status) {
|
|
110
|
+
status = "success";
|
|
111
|
+
if (row?.status === "committed_with_repairs")
|
|
112
|
+
status = "committed_with_repairs";
|
|
113
|
+
if (row?.status === "rejected")
|
|
114
|
+
status = "error";
|
|
115
|
+
}
|
|
116
|
+
const terminalError = row?.status === "rejected"
|
|
117
|
+
? {
|
|
118
|
+
code: "BOOTSTRAP_PLAN_REJECTED",
|
|
119
|
+
message: "Bootstrap stopped at a deterministic failure. Inspect actionResults for committed actions and re-plan from the current state.",
|
|
120
|
+
retryable: false,
|
|
121
|
+
}
|
|
122
|
+
: undefined;
|
|
123
|
+
const resultError = options.error ?? terminalError;
|
|
112
124
|
const outcome = effectOutcome(status, options);
|
|
113
125
|
return {
|
|
114
126
|
kibiProtocol: KIBI_PROTOCOL_VERSION,
|
|
@@ -122,7 +134,7 @@ export function toKibiResult(spec, data, options = {}) {
|
|
|
122
134
|
],
|
|
123
135
|
diagnostics: options.diagnostics ?? diagnostics(row?.diagnostics),
|
|
124
136
|
nextActions: options.nextActions ?? nextActions(row?.nextActions),
|
|
125
|
-
...(
|
|
137
|
+
...(resultError ? { error: resultError } : {}),
|
|
126
138
|
};
|
|
127
139
|
}
|
|
128
140
|
export function operationData(value) {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { EngineLimitExceeded } from "../../engine-limits.js";
|
|
1
2
|
import type { CapabilityRegistry } from "../../plugins/registry.js";
|
|
2
3
|
import type { PrologErrorRecord } from "../../prolog/error-terms.js";
|
|
3
4
|
import type { BranchAttachment } from "../../utils/branch-resolver.js";
|
|
@@ -12,6 +13,8 @@ export type PrologQueryResult = {
|
|
|
12
13
|
readonly error?: string;
|
|
13
14
|
/** Structured error term when the failure crossed a kb.pl throw site. */
|
|
14
15
|
readonly errorRecord?: PrologErrorRecord;
|
|
16
|
+
/** Set when the engine stopped a bounded read at its limit. */
|
|
17
|
+
readonly limitExceeded?: EngineLimitExceeded;
|
|
15
18
|
};
|
|
16
19
|
export type PrologEntityQueryInput = Readonly<{
|
|
17
20
|
type?: string;
|
|
@@ -131,6 +134,12 @@ export interface FilesystemPort {
|
|
|
131
134
|
stat(path: string): Promise<FilesystemStat>;
|
|
132
135
|
/** Optional destructive primitive used only to roll back newly-created files. */
|
|
133
136
|
unlink?(path: string): Promise<void>;
|
|
137
|
+
/**
|
|
138
|
+
* Flush a file's (or directory's) contents to stable storage when the host
|
|
139
|
+
* supports it. Atomic plan application calls it on staged files before the
|
|
140
|
+
* rename that publishes them.
|
|
141
|
+
*/
|
|
142
|
+
fsync?(path: string): Promise<void>;
|
|
134
143
|
}
|
|
135
144
|
export interface GitPort {
|
|
136
145
|
/** Optional low-level Git probes; the journaled runtime may provide them. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime-types.d.ts","sourceRoot":"","sources":["../../../src/public/operations/runtime-types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AACpE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AACrE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AACvE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAElD,YAAY,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAElD,YAAY,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAEpE,4EAA4E;AAE5E,MAAM,MAAM,gBAAgB,GACxB,kBAAkB,GAClB,CAAC,MAAM,OAAO,CAAC,kBAAkB,CAAC,CAAC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