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
package/dist/commands/migrate.js
CHANGED
|
@@ -18,6 +18,10 @@
|
|
|
18
18
|
import { existsSync, mkdirSync, readFileSync, renameSync, writeFileSync, } from "node:fs";
|
|
19
19
|
import * as path from "node:path";
|
|
20
20
|
import { load as parseYAML } from "js-yaml";
|
|
21
|
+
import { applySafeInventoryRederivations, planInventoryRederivation, } from "../operations/migration/inventory-rederive.js";
|
|
22
|
+
import { applyOriginBackfill, planOriginBackfill, } from "../operations/migration/origin-backfill.js";
|
|
23
|
+
import { applySourcePathRepairs, findSourceRepairs, } from "../operations/migration/source-paths.js";
|
|
24
|
+
import { applySupersededClosures, planSupersededClosures, } from "../operations/migration/superseded-closure.js";
|
|
21
25
|
import { extractSymbolsFromStagedFile } from "../traceability/symbol-extract.js";
|
|
22
26
|
import { resolveBranchAttachment } from "../utils/branch-resolver.js";
|
|
23
27
|
import { defaultKbManifest, readKbManifest, readKbManifestStatus, writeKbManifest, } from "../utils/kb-manifest.js";
|
|
@@ -57,6 +61,18 @@ const SCHEMA_MIGRATION_STEPS = [
|
|
|
57
61
|
to: 5,
|
|
58
62
|
description: "Move Kibi knowledge into the canonical .kb/ namespace and retire .kb/config.json.",
|
|
59
63
|
},
|
|
64
|
+
{
|
|
65
|
+
id: "entity-origin-v6",
|
|
66
|
+
from: 5,
|
|
67
|
+
to: 6,
|
|
68
|
+
description: "Record origin {kind: migration} on authored entities written before schema 6, close superseded requirements, and repair authored source fields (point moved knowledge files at .kb/, remove redundant and dead values).",
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
id: "polarity-values-v7",
|
|
72
|
+
from: 6,
|
|
73
|
+
to: 7,
|
|
74
|
+
description: "Encode legacy polarity-only property facts as eq boolean true with require/forbid polarity; strict fact shapes are blocking.",
|
|
75
|
+
},
|
|
60
76
|
];
|
|
61
77
|
function migrationStepsFor(fromVersion) {
|
|
62
78
|
const start = Math.max(0, fromVersion ?? 0);
|
|
@@ -117,6 +133,10 @@ function buildMigrationAuditRecord(args) {
|
|
|
117
133
|
semanticAdvisorBackfill: args.semanticAdvisorBackfill,
|
|
118
134
|
status: "applied",
|
|
119
135
|
symbolGranularityLegacyLinks: args.symbolGranularityLegacyLinks,
|
|
136
|
+
entityOriginBackfill: args.entityOriginBackfill,
|
|
137
|
+
supersededRequirementsClosed: args.supersededRequirementsClosed,
|
|
138
|
+
sourcePathsRewritten: args.sourcePathsRewritten,
|
|
139
|
+
sourcePathsRemoved: args.sourcePathsRemoved,
|
|
120
140
|
toVersion: LATEST_KB_SCHEMA_VERSION,
|
|
121
141
|
warning: args.warning,
|
|
122
142
|
steps: args.steps,
|
|
@@ -261,6 +281,119 @@ function migrateSymbolGranularity(options) {
|
|
|
261
281
|
}
|
|
262
282
|
return { count, manifestPath };
|
|
263
283
|
}
|
|
284
|
+
function describeRederivation(plan) {
|
|
285
|
+
const { keptModeled, roleChanges, newlyUnresolved, downgradedModeled } = plan.summary;
|
|
286
|
+
return `${plan.requirementId}: ${keptModeled} modeled claim(s) kept, ${roleChanges} role change(s), ${newlyUnresolved} claim(s) now unresolved, ${downgradedModeled} modeled claim(s) downgraded`;
|
|
287
|
+
}
|
|
288
|
+
function printManualRederivations(plans) {
|
|
289
|
+
for (const plan of plans) {
|
|
290
|
+
printWarning(`${plan.requirementId} (${plan.path}) no longer matches the current semantic advisor and needs a manual fix: ${plan.reasons.join("; ")}. Run 'kibi migrate --format json' for the exact repair steps.`);
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
/**
|
|
294
|
+
* Re-derive semantic inventories that drifted with the current advisor. Safe
|
|
295
|
+
* re-derivations keep every claim whose claim_key and text still match;
|
|
296
|
+
* anything else is reported for a manual fix.
|
|
297
|
+
*/
|
|
298
|
+
// implements REQ-cli-schema-migration, REQ-kibi-proposition-complete-ingestion
|
|
299
|
+
function rederiveDriftedInventories(cwd, dryRun) {
|
|
300
|
+
if (dryRun) {
|
|
301
|
+
const plans = planInventoryRederivation(cwd);
|
|
302
|
+
for (const plan of plans.filter((candidate) => candidate.safe)) {
|
|
303
|
+
console.log(`dry run: would re-derive the semantic inventory of ${describeRederivation(plan)}.`);
|
|
304
|
+
}
|
|
305
|
+
const manual = plans.filter((candidate) => !candidate.safe);
|
|
306
|
+
printManualRederivations(manual);
|
|
307
|
+
return {
|
|
308
|
+
rederived: plans
|
|
309
|
+
.filter((candidate) => candidate.safe)
|
|
310
|
+
.map((candidate) => candidate.requirementId),
|
|
311
|
+
manual: manual.length,
|
|
312
|
+
};
|
|
313
|
+
}
|
|
314
|
+
const plans = planInventoryRederivation(cwd);
|
|
315
|
+
const result = applySafeInventoryRederivations(cwd);
|
|
316
|
+
const rederived = result.rederived
|
|
317
|
+
.filter((outcome) => outcome.outcome === "rederived")
|
|
318
|
+
.map((outcome) => outcome.requirementId);
|
|
319
|
+
for (const plan of plans.filter((candidate) => rederived.includes(candidate.requirementId))) {
|
|
320
|
+
console.log(`Re-derived the semantic inventory of ${describeRederivation(plan)}.`);
|
|
321
|
+
}
|
|
322
|
+
printManualRederivations(result.manual);
|
|
323
|
+
return { rederived, manual: result.manual.length };
|
|
324
|
+
}
|
|
325
|
+
const REMOVED_SOURCES_NOTE = "the compiled source is always the entity's own file";
|
|
326
|
+
/**
|
|
327
|
+
* Close superseded requirements and repair authored source fields: point
|
|
328
|
+
* moved knowledge files at .kb/, and remove values that name the entity's
|
|
329
|
+
* own file or nothing Kibi can map. Superseded requirements and dangling
|
|
330
|
+
* sources block kibi check, so this runs at any schema version.
|
|
331
|
+
* Supersession cycles and source fields Kibi cannot edit safely are left for
|
|
332
|
+
* a person and reported as warnings.
|
|
333
|
+
*/
|
|
334
|
+
// implements REQ-cli-schema-migration, REQ-core-validation-rules, REQ-kibi-schema6-migration
|
|
335
|
+
function repairLifecycleFindings(cwd, dryRun) {
|
|
336
|
+
const supersession = planSupersededClosures(cwd);
|
|
337
|
+
let closed = supersession.closures.length;
|
|
338
|
+
let rewritten = 0;
|
|
339
|
+
let removed = 0;
|
|
340
|
+
let unrepaired = [];
|
|
341
|
+
if (dryRun) {
|
|
342
|
+
const repairs = findSourceRepairs(cwd);
|
|
343
|
+
for (const repair of repairs) {
|
|
344
|
+
if (repair.refused !== undefined) {
|
|
345
|
+
unrepaired.push({ file: repair.file, reason: repair.refused });
|
|
346
|
+
}
|
|
347
|
+
else if (repair.fix.kind === "rewrite") {
|
|
348
|
+
rewritten += 1;
|
|
349
|
+
}
|
|
350
|
+
else {
|
|
351
|
+
removed += 1;
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
if (closed > 0) {
|
|
355
|
+
console.log(`dry run: would close ${closed} superseded requirement(s): ${supersession.closures.map((closure) => closure.id).join(", ")}.`);
|
|
356
|
+
}
|
|
357
|
+
if (rewritten > 0) {
|
|
358
|
+
console.log(`dry run: would point ${rewritten} pre-canonical source path(s) at their .kb/ files.`);
|
|
359
|
+
}
|
|
360
|
+
if (removed > 0) {
|
|
361
|
+
console.log(`dry run: would remove ${removed} redundant or dead source field(s); ${REMOVED_SOURCES_NOTE}.`);
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
else {
|
|
365
|
+
const closures = applySupersededClosures(cwd);
|
|
366
|
+
closed = closures.closed.length;
|
|
367
|
+
if (closed > 0) {
|
|
368
|
+
console.log(`Closed ${closed} superseded requirement(s): ${closures.closed.map((closure) => closure.id).join(", ")}.`);
|
|
369
|
+
}
|
|
370
|
+
for (const skip of closures.skipped) {
|
|
371
|
+
printWarning(`Status not set for ${skip.path}: ${skip.reason}.`);
|
|
372
|
+
}
|
|
373
|
+
const repairs = applySourcePathRepairs(cwd);
|
|
374
|
+
rewritten = repairs.rewritten.length;
|
|
375
|
+
removed = repairs.removed.length;
|
|
376
|
+
unrepaired = [...repairs.skipped];
|
|
377
|
+
if (rewritten > 0) {
|
|
378
|
+
console.log(`Pointed ${rewritten} pre-canonical source path(s) at their .kb/ files.`);
|
|
379
|
+
}
|
|
380
|
+
if (removed > 0) {
|
|
381
|
+
console.log(`Removed ${removed} redundant or dead source field(s); ${REMOVED_SOURCES_NOTE}.`);
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
for (const cycle of supersession.cycles) {
|
|
385
|
+
printWarning(`Requirements ${cycle.members.join(", ")} supersede each other; decide which one is current, remove the supersedes link that points at it, and close the others.`);
|
|
386
|
+
}
|
|
387
|
+
for (const skip of unrepaired) {
|
|
388
|
+
printWarning(`Source field of ${skip.file} not repaired: ${skip.reason}; a person edits it by hand (kibi migrate --format json lists it as review_source_path_dangling).`);
|
|
389
|
+
}
|
|
390
|
+
return {
|
|
391
|
+
closed,
|
|
392
|
+
rewritten,
|
|
393
|
+
removed,
|
|
394
|
+
manual: supersession.cycles.length + unrepaired.length,
|
|
395
|
+
};
|
|
396
|
+
}
|
|
264
397
|
export function warnMigrationRequiredWithoutYes() {
|
|
265
398
|
printWarning("Migration required for this repository.");
|
|
266
399
|
console.log("No changes applied.");
|
|
@@ -326,6 +459,27 @@ export async function migrateCommand(options = {}) {
|
|
|
326
459
|
return { exitCode: 1 };
|
|
327
460
|
}
|
|
328
461
|
if (!needsStorageMigration && !needsSchemaUpgrade) {
|
|
462
|
+
const { planPolarityValueBackfill, applyPolarityValueBackfill } = await import("../operations/migration/polarity-values.js");
|
|
463
|
+
const polarityCount = options.dryRun
|
|
464
|
+
? planPolarityValueBackfill(cwd).length
|
|
465
|
+
: applyPolarityValueBackfill(cwd);
|
|
466
|
+
// An advisor change can make stored inventories drift at any version,
|
|
467
|
+
// and lifecycle findings block kibi check at any version.
|
|
468
|
+
const drift = rederiveDriftedInventories(cwd, options.dryRun === true);
|
|
469
|
+
const lifecycle = repairLifecycleFindings(cwd, options.dryRun === true);
|
|
470
|
+
const rewroteSources = polarityCount > 0 ||
|
|
471
|
+
drift.rederived.length > 0 ||
|
|
472
|
+
lifecycle.closed > 0 ||
|
|
473
|
+
lifecycle.rewritten > 0 ||
|
|
474
|
+
lifecycle.removed > 0;
|
|
475
|
+
if (rewroteSources || drift.manual > 0 || lifecycle.manual > 0) {
|
|
476
|
+
if (options.dryRun !== true && rewroteSources) {
|
|
477
|
+
console.log("Run 'kibi sync' to recompile the rewritten sources.");
|
|
478
|
+
}
|
|
479
|
+
if (options.yes === true)
|
|
480
|
+
updateGitIgnore(cwd);
|
|
481
|
+
return { exitCode: 0 };
|
|
482
|
+
}
|
|
329
483
|
console.log(`No migration needed: the KB is already at schemaVersion ${LATEST_KB_SCHEMA_VERSION} on the canonical .kb/ layout.`);
|
|
330
484
|
if (existsSync(auditPath)) {
|
|
331
485
|
console.log(`Existing migration audit metadata: ${toRelativePath(cwd, auditPath)}`);
|
|
@@ -339,7 +493,12 @@ export async function migrateCommand(options = {}) {
|
|
|
339
493
|
const migrationSteps = migrationStepsFor(configStatus.currentVersion);
|
|
340
494
|
const symbolGranularityStep = migrationSteps.some((step) => step.id === "symbol-granularity-v2");
|
|
341
495
|
const semanticBackfillStep = migrationSteps.some((step) => step.id === "semantic-backfill-v4");
|
|
496
|
+
const originBackfillStep = migrationSteps.some((step) => step.id === "entity-origin-v6");
|
|
497
|
+
const { planPolarityValueBackfill, applyPolarityValueBackfill } = await import("../operations/migration/polarity-values.js");
|
|
498
|
+
const polarityBackfill = planPolarityValueBackfill(cwd);
|
|
342
499
|
if (options.dryRun) {
|
|
500
|
+
if (polarityBackfill.length > 0)
|
|
501
|
+
console.log(`dry run: would encode ${polarityBackfill.length} legacy polarity-only fact(s) as typed booleans.`);
|
|
343
502
|
if (storagePlan.moves.length > 0) {
|
|
344
503
|
console.log(`dry run: would move ${storagePlan.moves.length} legacy knowledge file(s) into .kb/:`);
|
|
345
504
|
for (const move of storagePlan.moves) {
|
|
@@ -361,6 +520,14 @@ export async function migrateCommand(options = {}) {
|
|
|
361
520
|
console.log(`dry run: would mark ${preview.count} legacy coarse symbol link(s) as legacy-link.`);
|
|
362
521
|
}
|
|
363
522
|
}
|
|
523
|
+
if (originBackfillStep) {
|
|
524
|
+
const backfill = planOriginBackfill(cwd);
|
|
525
|
+
if (backfill.targets.length > 0) {
|
|
526
|
+
console.log(`dry run: would record origin {kind: migration} on ${backfill.targets.length} authored entit(ies) without one.`);
|
|
527
|
+
}
|
|
528
|
+
}
|
|
529
|
+
rederiveDriftedInventories(cwd, true);
|
|
530
|
+
repairLifecycleFindings(cwd, true);
|
|
364
531
|
console.log(`dry run: would write migration audit metadata to ${toRelativePath(cwd, auditPath)}.`);
|
|
365
532
|
console.log("Re-run with --yes to apply these changes.");
|
|
366
533
|
return { exitCode: 0 };
|
|
@@ -376,22 +543,35 @@ export async function migrateCommand(options = {}) {
|
|
|
376
543
|
console.log("Retired legacy .kb/config.json.");
|
|
377
544
|
}
|
|
378
545
|
}
|
|
379
|
-
const symbolGranularityMigration =
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
546
|
+
const symbolGranularityMigration = symbolGranularityStep
|
|
547
|
+
? migrateSymbolGranularity({
|
|
548
|
+
cwd,
|
|
549
|
+
dryRun: options.yes !== true,
|
|
550
|
+
})
|
|
551
|
+
: { count: 0 };
|
|
383
552
|
const semanticAdvisorBackfill = normalizeSemanticAdvisorBackfill(readKbManifest(cwd)?.semanticAdvisorBackfill) ??
|
|
384
553
|
normalizeSemanticAdvisorBackfill(storagePlan.semanticAdvisorBackfill) ??
|
|
385
554
|
(semanticBackfillStep || needsStorageMigration
|
|
386
555
|
? "pending"
|
|
387
556
|
: "not_applicable");
|
|
557
|
+
const migratedAt = new Date().toISOString();
|
|
558
|
+
const polarityValuesRewritten = applyPolarityValueBackfill(cwd);
|
|
559
|
+
if (polarityValuesRewritten > 0)
|
|
560
|
+
console.log(`Encoded ${polarityValuesRewritten} legacy polarity-only fact(s) as typed booleans.`);
|
|
561
|
+
// Source rewrites run before the manifest records the new schema, so an
|
|
562
|
+
// interrupted run is retried by the next 'kibi migrate --yes'; both are
|
|
563
|
+
// idempotent.
|
|
564
|
+
const originBackfill = originBackfillStep
|
|
565
|
+
? applyOriginBackfill(cwd, migratedAt)
|
|
566
|
+
: { written: [], skipped: [], previouslyStamped: 0 };
|
|
567
|
+
rederiveDriftedInventories(cwd, false);
|
|
568
|
+
const lifecycle = repairLifecycleFindings(cwd, false);
|
|
388
569
|
const existingManifest = readKbManifest(cwd) ?? defaultKbManifest();
|
|
389
570
|
writeKbManifest(cwd, {
|
|
390
571
|
...existingManifest,
|
|
391
572
|
schemaVersion: LATEST_KB_SCHEMA_VERSION,
|
|
392
573
|
semanticAdvisorBackfill,
|
|
393
574
|
});
|
|
394
|
-
const migratedAt = new Date().toISOString();
|
|
395
575
|
writeJsonAtomically(auditPath, buildMigrationAuditRecord({
|
|
396
576
|
branch,
|
|
397
577
|
manifestPath: KB_MANIFEST_RELATIVE,
|
|
@@ -399,6 +579,10 @@ export async function migrateCommand(options = {}) {
|
|
|
399
579
|
migratedAt,
|
|
400
580
|
semanticAdvisorBackfill,
|
|
401
581
|
symbolGranularityLegacyLinks: symbolGranularityMigration.count,
|
|
582
|
+
entityOriginBackfill: originBackfill.written.length + originBackfill.previouslyStamped,
|
|
583
|
+
supersededRequirementsClosed: lifecycle.closed,
|
|
584
|
+
sourcePathsRewritten: lifecycle.rewritten,
|
|
585
|
+
sourcePathsRemoved: lifecycle.removed,
|
|
402
586
|
warning: migrationWarning,
|
|
403
587
|
steps: migrationSteps.map((step) => step.id),
|
|
404
588
|
}));
|
|
@@ -409,20 +593,29 @@ export async function migrateCommand(options = {}) {
|
|
|
409
593
|
if (semanticAdvisorBackfill === "pending") {
|
|
410
594
|
console.log(`Marked semantic advisor backfill as pending in ${KB_MANIFEST_RELATIVE}.`);
|
|
411
595
|
}
|
|
596
|
+
if (originBackfill.written.length > 0) {
|
|
597
|
+
console.log(`Recorded origin {kind: migration} on ${originBackfill.written.length} authored entit(ies).`);
|
|
598
|
+
}
|
|
599
|
+
for (const skip of originBackfill.skipped) {
|
|
600
|
+
printWarning(`Origin not recorded for ${skip.path}: ${skip.reason}.`);
|
|
601
|
+
}
|
|
412
602
|
console.log(`Wrote migration audit metadata to ${toRelativePath(cwd, auditPath)}.`);
|
|
413
603
|
console.log("Migration complete. Future 'kibi migrate' runs will be a no-op.");
|
|
414
604
|
updateGitIgnore(cwd);
|
|
415
605
|
return { exitCode: 0 };
|
|
416
606
|
}
|
|
417
607
|
const KB_MANIFEST_RELATIVE = ".kb/manifest.json";
|
|
608
|
+
// implements REQ-agent-guided-migration-orchestration, REQ-cli-schema-migration
|
|
418
609
|
async function buildWorkspaceMigrationPlan(workspaceRoot = process.cwd()) {
|
|
419
|
-
const [{ createCliRuntime }, { executeOperation }, { statusSpec }, { checkSpec }, { coverageSpec }, { mergeMigrationPlans },] = await Promise.all([
|
|
610
|
+
const [{ createCliRuntime }, { executeOperation }, { statusSpec }, { checkSpec }, { coverageSpec }, { buildMigrationPlan, mergeMigrationPlans, migrationAction, withoutActionCodes, }, { ORIGIN_SCHEMA_VERSION, buildSchema6MigrationFragment, migrationSyncAction, }, { SOURCE_PLANNED_LIFECYCLE_CODES },] = await Promise.all([
|
|
420
611
|
import("../runtime/cli-runtime.js"),
|
|
421
612
|
import("../public/operations/runtime-types.js"),
|
|
422
613
|
import("../public/operations/specs/discovery.js"),
|
|
423
614
|
import("../public/operations/specs/check.js"),
|
|
424
615
|
import("../public/operations/specs/reporting.js"),
|
|
425
616
|
import("../public/operations/migration-plan.js"),
|
|
617
|
+
import("../operations/migration/schema6.js"),
|
|
618
|
+
import("../public/operations/schema6-check-actions.js"),
|
|
426
619
|
]);
|
|
427
620
|
const runtime = createCliRuntime({ workspaceRoot });
|
|
428
621
|
const statusResult = await executeOperation(runtime, statusSpec, {});
|
|
@@ -430,14 +623,57 @@ async function buildWorkspaceMigrationPlan(workspaceRoot = process.cwd()) {
|
|
|
430
623
|
const plans = [];
|
|
431
624
|
if (status?.migrationPlan !== undefined)
|
|
432
625
|
plans.push(status.migrationPlan);
|
|
626
|
+
// Source-derived schema 6 actions: re-derive drifted inventories, backfill
|
|
627
|
+
// origin and list exceptions that exempt nothing. They rewrite authored
|
|
628
|
+
// sources, so the schema upgrade (which performs them too) depends on them
|
|
629
|
+
// and one sync recompiles the result.
|
|
630
|
+
const currentSchemaVersion = status?.schemaStatus?.currentVersion ??
|
|
631
|
+
readKbManifest(workspaceRoot)?.schemaVersion ??
|
|
632
|
+
null;
|
|
633
|
+
const fragment = buildSchema6MigrationFragment({
|
|
634
|
+
workspaceRoot,
|
|
635
|
+
currentSchemaVersion,
|
|
636
|
+
});
|
|
637
|
+
const fragmentActions = [...fragment.actions];
|
|
638
|
+
const statusActions = status?.migrationPlan?.actions ?? [];
|
|
639
|
+
const schemaUpgrade = statusActions.find((action) => action.id === "schema-config-upgrade");
|
|
640
|
+
if (schemaUpgrade !== undefined &&
|
|
641
|
+
fragment.sourceRewriteActionIds.length > 0) {
|
|
642
|
+
fragmentActions.push(migrationAction({
|
|
643
|
+
...schemaUpgrade,
|
|
644
|
+
dependsOn: [
|
|
645
|
+
...schemaUpgrade.dependsOn,
|
|
646
|
+
...fragment.sourceRewriteActionIds,
|
|
647
|
+
],
|
|
648
|
+
}));
|
|
649
|
+
}
|
|
650
|
+
const unsafeDrift = fragment.actions.some((action) => action.code === "semantic_inventory_review");
|
|
651
|
+
if (!unsafeDrift &&
|
|
652
|
+
(fragment.sourceRewriteActionIds.length > 0 || schemaUpgrade !== undefined)) {
|
|
653
|
+
fragmentActions.push(migrationSyncAction([
|
|
654
|
+
...fragment.sourceRewriteActionIds,
|
|
655
|
+
...statusActions
|
|
656
|
+
.filter((action) => action.safety === "automatic")
|
|
657
|
+
.map((action) => action.id),
|
|
658
|
+
]));
|
|
659
|
+
}
|
|
660
|
+
// A check needs a compiled store: a never-synced store reports every
|
|
661
|
+
// authored relationship as missing. A schema 5 store compiles the same
|
|
662
|
+
// facts as schema 6, so its check findings are planned before the upgrade.
|
|
433
663
|
const storeHealthy = status?.branchStore?.state === "healthy";
|
|
434
|
-
const
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
664
|
+
const schemaCheckable = status?.schemaStatus?.needsMigration !== true ||
|
|
665
|
+
(currentSchemaVersion !== null &&
|
|
666
|
+
currentSchemaVersion >= ORIGIN_SCHEMA_VERSION - 1);
|
|
667
|
+
const storeSynced = status?.snapshotId !== "missing";
|
|
668
|
+
const checkable = storeHealthy &&
|
|
669
|
+
schemaCheckable &&
|
|
670
|
+
status?.branchAttachment?.kind === "exact";
|
|
671
|
+
if (checkable && storeSynced) {
|
|
438
672
|
const checkResult = await executeOperation(runtime, checkSpec, {});
|
|
439
673
|
if (checkResult.structuredContent?.migrationPlan !== undefined) {
|
|
440
|
-
|
|
674
|
+
// Lifecycle repairs and their sync are planned above from authored
|
|
675
|
+
// sources, which may be newer than the compiled store.
|
|
676
|
+
plans.push(withoutActionCodes(checkResult.structuredContent.migrationPlan, SOURCE_PLANNED_LIFECYCLE_CODES));
|
|
441
677
|
}
|
|
442
678
|
const coverageInputs = [
|
|
443
679
|
{ by: "req", limit: 10_000, offset: 0 },
|
|
@@ -450,8 +686,28 @@ async function buildWorkspaceMigrationPlan(workspaceRoot = process.cwd()) {
|
|
|
450
686
|
}
|
|
451
687
|
}
|
|
452
688
|
}
|
|
689
|
+
const skippedCheck = checkable && !storeSynced;
|
|
690
|
+
if (fragmentActions.length > 0 ||
|
|
691
|
+
fragment.diagnostics.length > 0 ||
|
|
692
|
+
skippedCheck) {
|
|
693
|
+
plans.push(buildMigrationPlan({
|
|
694
|
+
...(status?.migrationPlan !== undefined
|
|
695
|
+
? { expected: status.migrationPlan.expected }
|
|
696
|
+
: {}),
|
|
697
|
+
evaluatedDomains: ["schema", "semantic"],
|
|
698
|
+
incompleteDomains: skippedCheck ? ["quality"] : [],
|
|
699
|
+
actions: fragmentActions,
|
|
700
|
+
diagnostics: [
|
|
701
|
+
...fragment.diagnostics,
|
|
702
|
+
...(skippedCheck
|
|
703
|
+
? [
|
|
704
|
+
"kibi check did not run because this branch has never been synced; apply the plan (or run kibi sync) and rerun kibi migrate for quality actions.",
|
|
705
|
+
]
|
|
706
|
+
: []),
|
|
707
|
+
],
|
|
708
|
+
}));
|
|
709
|
+
}
|
|
453
710
|
if (plans.length === 0) {
|
|
454
|
-
const { buildMigrationPlan } = await import("../public/operations/migration-plan.js");
|
|
455
711
|
return buildMigrationPlan({
|
|
456
712
|
evaluatedDomains: ["package", "branch", "storage", "schema"],
|
|
457
713
|
incompleteDomains: ["status"],
|
|
@@ -483,12 +739,23 @@ async function migratePlanCommand(options) {
|
|
|
483
739
|
console.log("No approved automatic migration actions are ready.");
|
|
484
740
|
return { exitCode: 0 };
|
|
485
741
|
}
|
|
486
|
-
const [{ createCliRuntime }, { executeOperation }, { applyPlanSpec }] = await Promise.all([
|
|
742
|
+
const [{ createCliRuntime }, { executeOperation }, { applyPlanSpec }, { withConsoleOnStderr },] = await Promise.all([
|
|
487
743
|
import("../runtime/cli-runtime.js"),
|
|
488
744
|
import("../public/operations/runtime-types.js"),
|
|
489
745
|
import("../public/operations/specs/planning.js"),
|
|
746
|
+
import("../cli-json-command.js"),
|
|
490
747
|
]);
|
|
491
|
-
const
|
|
748
|
+
const approvedPlanHash = options.approvedPlanHash;
|
|
749
|
+
const execute = () => executeOperation(createCliRuntime({ workspaceRoot }), applyPlanSpec, {
|
|
750
|
+
plan,
|
|
751
|
+
approvedPlanHash,
|
|
752
|
+
approvedActionIds,
|
|
753
|
+
});
|
|
754
|
+
// The actions reuse commands that print progress; keep stdout to the
|
|
755
|
+
// JSON result.
|
|
756
|
+
const result = options.format === "json"
|
|
757
|
+
? await withConsoleOnStderr(execute)
|
|
758
|
+
: await execute();
|
|
492
759
|
if (options.format === "json") {
|
|
493
760
|
console.log(JSON.stringify(result, null, 2));
|
|
494
761
|
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export type ProofCompactOptions = Readonly<{
|
|
2
|
+
test?: string;
|
|
3
|
+
dryRun?: boolean;
|
|
4
|
+
json?: boolean;
|
|
5
|
+
}>;
|
|
6
|
+
export declare function proofCompactCommand(options: ProofCompactOptions): Promise<{
|
|
7
|
+
exitCode: number;
|
|
8
|
+
}>;
|
|
9
|
+
//# sourceMappingURL=proof-compact.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"proof-compact.d.ts","sourceRoot":"","sources":["../../src/commands/proof-compact.ts"],"names":[],"mappings":"AAsBA,MAAM,MAAM,mBAAmB,GAAG,QAAQ,CAAC;IACzC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB,CAAC,CAAC;AAGH,wBAAsB,mBAAmB,CACvC,OAAO,EAAE,mBAAmB,GAC3B,OAAO,CAAC;IAAE,QAAQ,EAAE,MAAM,CAAA;CAAE,CAAC,CA4C/B"}
|
|
@@ -0,0 +1,58 @@
|
|
|
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 { executeCompactReceipts } from "../operations/proof/compact-receipts.js";
|
|
19
|
+
import { createCliRuntime } from "../runtime/cli-runtime.js";
|
|
20
|
+
// implements REQ-kibi-fresh-verification-receipts-v2
|
|
21
|
+
export async function proofCompactCommand(options) {
|
|
22
|
+
const runtime = createCliRuntime();
|
|
23
|
+
const spec = {
|
|
24
|
+
name: "kibi_proof_compact",
|
|
25
|
+
effects: ["kb-mutate", "workspace-write"],
|
|
26
|
+
requiresProlog: true,
|
|
27
|
+
execute: async () => undefined,
|
|
28
|
+
};
|
|
29
|
+
const context = await runtime.open(spec, {});
|
|
30
|
+
let completed = false;
|
|
31
|
+
try {
|
|
32
|
+
const result = await executeCompactReceipts({
|
|
33
|
+
...(options.test === undefined ? {} : { testId: options.test }),
|
|
34
|
+
...(options.dryRun === true ? { dryRun: true } : {}),
|
|
35
|
+
}, context);
|
|
36
|
+
if (options.json === true) {
|
|
37
|
+
process.stdout.write(`${JSON.stringify(result.structuredContent, null, 2)}\n`);
|
|
38
|
+
}
|
|
39
|
+
else {
|
|
40
|
+
process.stdout.write(`${result.content[0]?.text ?? ""}\n`);
|
|
41
|
+
for (const row of result.structuredContent.tests) {
|
|
42
|
+
process.stdout.write(` ${row.testId}: ${row.before} -> ${row.after} receipt(s)\n`);
|
|
43
|
+
}
|
|
44
|
+
for (const row of result.structuredContent.skipped) {
|
|
45
|
+
process.stdout.write(` ${row.testId}: skipped (${row.reason})\n`);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
completed = true;
|
|
49
|
+
if (options.dryRun !== true)
|
|
50
|
+
await runtime.afterSuccess(spec, context);
|
|
51
|
+
return { exitCode: 0 };
|
|
52
|
+
}
|
|
53
|
+
finally {
|
|
54
|
+
await runtime.close(context, completed
|
|
55
|
+
? { status: "success", result: 0 }
|
|
56
|
+
: { status: "error", error: 1 });
|
|
57
|
+
}
|
|
58
|
+
}
|
package/dist/commands/prove.d.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { executeIngestProof } from "../operations/proof/ingest-proof.js";
|
|
2
|
+
import { type ProofRunAttribution } from "../proof/command-test-report.js";
|
|
2
3
|
import type { ProofIntegration } from "../proof/integrations.js";
|
|
3
4
|
import type { OperationRuntime } from "../public/operations/runtime-types.js";
|
|
4
5
|
import { readWorkspaceSnapshot } from "../public/operations/workspace-snapshot.js";
|
|
6
|
+
import { type ProofRunArtifact } from "../public/proof-protocol.js";
|
|
5
7
|
export type ProveCommandOptions = Readonly<{
|
|
6
8
|
testId?: string;
|
|
7
9
|
requirement?: string;
|
|
@@ -33,5 +35,41 @@ export declare function commandEnvironment(integration: ProofIntegration, comman
|
|
|
33
35
|
export declare function proveCommand(options: ProveCommandOptions, deps?: ProveCommandDependencies): Promise<{
|
|
34
36
|
exitCode: number;
|
|
35
37
|
}>;
|
|
38
|
+
/** The artifacts one integration run is evaluated through. */
|
|
39
|
+
export type EvaluatedRun = Readonly<{
|
|
40
|
+
/** Each artifact is ingested against exactly its own tests. */
|
|
41
|
+
artifacts: readonly Readonly<{
|
|
42
|
+
artifact: ProofRunArtifact;
|
|
43
|
+
testIds: readonly string[];
|
|
44
|
+
}>[];
|
|
45
|
+
/** The whole process run, kept when the evidence was partitioned. */
|
|
46
|
+
wholeRun?: ProofRunArtifact;
|
|
47
|
+
attribution?: ProofRunAttribution;
|
|
48
|
+
}>;
|
|
49
|
+
/** Read a command integration's optional per-test report and attribute it. */
|
|
50
|
+
export declare function readCommandAttribution(reportPath: string, selectedTestIds: readonly string[], exitCode: number): Promise<ProofRunAttribution>;
|
|
51
|
+
/** Where a partition's evaluated artifact is kept next to the run artifact. */
|
|
52
|
+
export declare function partitionArtifactPath(artifactPath: string, outcome: string): string;
|
|
53
|
+
/**
|
|
54
|
+
* Build the kibi.proof-run.v1 evidence of a `command` integration run.
|
|
55
|
+
*
|
|
56
|
+
* Without per-test attribution the run is one unit, exactly as before: a
|
|
57
|
+
* failing process fails every selected test. With a valid
|
|
58
|
+
* kibi.proof-test-report.v1 the run is split into one artifact per test
|
|
59
|
+
* outcome: tests whose own steps all passed are evaluated against a passing
|
|
60
|
+
* slice (exit code 0, the aggregate result of their own steps), and each
|
|
61
|
+
* failing outcome gets a failing slice that names the steps that failed. The
|
|
62
|
+
* whole-process artifact is kept alongside for audit.
|
|
63
|
+
*/
|
|
64
|
+
export declare function buildCommandRunArtifacts(input: {
|
|
65
|
+
integration: ProofIntegration;
|
|
66
|
+
commandArgv: readonly string[];
|
|
67
|
+
exitCode: number;
|
|
68
|
+
startedAt: string;
|
|
69
|
+
finishedAt: string;
|
|
70
|
+
snapshot: string;
|
|
71
|
+
tests: readonly SelectedTest[];
|
|
72
|
+
attribution: ProofRunAttribution;
|
|
73
|
+
}): EvaluatedRun;
|
|
36
74
|
export {};
|
|
37
75
|
//# sourceMappingURL=prove.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prove.d.ts","sourceRoot":"","sources":["../../src/commands/prove.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,kBAAkB,EAAE,MAAM,qCAAqC,CAAC;AAEzE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AASjE,OAAO,KAAK,EAEV,gBAAgB,EACjB,MAAM,uCAAuC,CAAC;AAE/C,OAAO,EAAE,qBAAqB,EAAE,MAAM,4CAA4C,CAAC;
|
|
1
|
+
{"version":3,"file":"prove.d.ts","sourceRoot":"","sources":["../../src/commands/prove.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,kBAAkB,EAAE,MAAM,qCAAqC,CAAC;AAEzE,OAAO,EAIL,KAAK,mBAAmB,EAGzB,MAAM,iCAAiC,CAAC;AACzC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AASjE,OAAO,KAAK,EAEV,gBAAgB,EACjB,MAAM,uCAAuC,CAAC;AAE/C,OAAO,EAAE,qBAAqB,EAAE,MAAM,4CAA4C,CAAC;AACnF,OAAO,EAIL,KAAK,gBAAgB,EAGtB,MAAM,6BAA6B,CAAC;AAIrC,MAAM,MAAM,mBAAmB,GAAG,QAAQ,CAAC;IACzC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB,CAAC,CAAC;AAGH,MAAM,MAAM,wBAAwB,GAAG,QAAQ,CAAC;IAC9C,OAAO,CAAC,EAAE,gBAAgB,CAAC;IAC3B,WAAW,CAAC,EAAE,OAAO,kBAAkB,CAAC;CACzC,CAAC,CAAC;AAEH,KAAK,YAAY,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAE5C;;;;;GAKG;AAEH,wBAAgB,sBAAsB,CACpC,QAAQ,EAAE,OAAO,CAAC,UAAU,CAAC,OAAO,qBAAqB,CAAC,CAAC,GAC1D,MAAM,CAiBR;AAED;;;;GAIG;AAEH,wBAAgB,wBAAwB,CACtC,KAAK,EAAE,MAAM,GAAG,SAAS,EACzB,QAAQ,EAAE,MAAM,GACf,GAAG,CAAC,MAAM,CAAC,CAUb;AAQD,wBAAgB,MAAM,CAAC,IAAI,EAAE,YAAY,GAAG,MAAM,CAEjD;AAkCD,wBAAgB,kBAAkB,CAChC,WAAW,EAAE,gBAAgB,EAC7B,WAAW,EAAE,SAAS,MAAM,EAAE,EAC9B,QAAQ,EAAE,MAAM,EAChB,aAAa,EAAE,MAAM,EACrB,OAAO,EAAE,SAAS,MAAM,EAAE,EAC1B,UAAU,EAAE,MAAM,GACjB,MAAM,CAAC,UAAU,CAWnB;AAsKD,wBAAsB,YAAY,CAChC,OAAO,EAAE,mBAAmB,EAC5B,IAAI,GAAE,wBAA6B,GAClC,OAAO,CAAC;IAAE,QAAQ,EAAE,MAAM,CAAA;CAAE,CAAC,CAuP/B;AAED,8DAA8D;AAE9D,MAAM,MAAM,YAAY,GAAG,QAAQ,CAAC;IAClC,+DAA+D;IAC/D,SAAS,EAAE,SAAS,QAAQ,CAAC;QAC3B,QAAQ,EAAE,gBAAgB,CAAC;QAC3B,OAAO,EAAE,SAAS,MAAM,EAAE,CAAC;KAC5B,CAAC,EAAE,CAAC;IACL,qEAAqE;IACrE,QAAQ,CAAC,EAAE,gBAAgB,CAAC;IAC5B,WAAW,CAAC,EAAE,mBAAmB,CAAC;CACnC,CAAC,CAAC;AAEH,8EAA8E;AAE9E,wBAAsB,sBAAsB,CAC1C,UAAU,EAAE,MAAM,EAClB,eAAe,EAAE,SAAS,MAAM,EAAE,EAClC,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,mBAAmB,CAAC,CAsB9B;AAED,+EAA+E;AAE/E,wBAAgB,qBAAqB,CACnC,YAAY,EAAE,MAAM,EACpB,OAAO,EAAE,MAAM,GACd,MAAM,CAKR;AAMD;;;;;;;;;;GAUG;AAEH,wBAAgB,wBAAwB,CAAC,KAAK,EAAE;IAC9C,WAAW,EAAE,gBAAgB,CAAC;IAC9B,WAAW,EAAE,SAAS,MAAM,EAAE,CAAC;IAC/B,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,SAAS,YAAY,EAAE,CAAC;IAC/B,WAAW,EAAE,mBAAmB,CAAC;CAClC,GAAG,YAAY,CAuFf"}
|