kibi-cli 0.19.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli-operation-loader.d.ts.map +1 -1
- package/dist/cli-operation-loader.js +53 -20
- package/dist/cli-operation-metadata.d.ts +20 -8
- package/dist/cli-operation-metadata.d.ts.map +1 -1
- package/dist/cli-operation-metadata.js +23 -8
- package/dist/cli-protocol.d.ts.map +1 -1
- package/dist/cli-protocol.js +38 -8
- package/dist/cli-register-foundation.d.ts.map +1 -1
- package/dist/cli-register-foundation.js +14 -2
- package/dist/cli-register-maintenance.d.ts.map +1 -1
- package/dist/cli-register-maintenance.js +26 -4
- package/dist/cli-register-reporting.d.ts.map +1 -1
- package/dist/cli-register-reporting.js +10 -0
- package/dist/cli-register-verification.d.ts +3 -0
- package/dist/cli-register-verification.d.ts.map +1 -0
- package/dist/cli-register-verification.js +16 -0
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +2 -0
- package/dist/commands/aggregated-checks.d.ts +1 -2
- package/dist/commands/aggregated-checks.d.ts.map +1 -1
- package/dist/commands/aggregated-checks.js +14 -9
- package/dist/commands/branch.d.ts +36 -0
- package/dist/commands/branch.d.ts.map +1 -1
- package/dist/commands/branch.js +371 -40
- package/dist/commands/check.d.ts.map +1 -1
- package/dist/commands/check.js +20 -67
- package/dist/commands/discovery-shared.d.ts.map +1 -1
- package/dist/commands/discovery-shared.js +10 -19
- package/dist/commands/doctor.d.ts +4 -1
- package/dist/commands/doctor.d.ts.map +1 -1
- package/dist/commands/doctor.js +259 -24
- package/dist/commands/engine.d.ts.map +1 -1
- package/dist/commands/engine.js +10 -7
- package/dist/commands/gc.d.ts +5 -2
- package/dist/commands/gc.d.ts.map +1 -1
- package/dist/commands/gc.js +140 -71
- package/dist/commands/github-init.d.ts +56 -0
- package/dist/commands/github-init.d.ts.map +1 -0
- package/dist/commands/github-init.js +310 -0
- package/dist/commands/init-helpers.d.ts +1 -1
- package/dist/commands/init-helpers.d.ts.map +1 -1
- package/dist/commands/init-helpers.js +73 -25
- package/dist/commands/init.d.ts +2 -0
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +79 -24
- package/dist/commands/legacy-storage-migration.d.ts +54 -0
- package/dist/commands/legacy-storage-migration.d.ts.map +1 -0
- package/dist/commands/legacy-storage-migration.js +277 -0
- package/dist/commands/migrate.d.ts +7 -0
- package/dist/commands/migrate.d.ts.map +1 -1
- package/dist/commands/migrate.js +244 -91
- package/dist/commands/report.d.ts +24 -0
- package/dist/commands/report.d.ts.map +1 -0
- package/dist/commands/report.js +191 -0
- package/dist/commands/sync/cache.d.ts +16 -3
- package/dist/commands/sync/cache.d.ts.map +1 -1
- package/dist/commands/sync/cache.js +111 -4
- package/dist/commands/sync/discovery.d.ts +23 -2
- package/dist/commands/sync/discovery.d.ts.map +1 -1
- package/dist/commands/sync/discovery.js +196 -15
- package/dist/commands/sync/extraction.d.ts +8 -1
- package/dist/commands/sync/extraction.d.ts.map +1 -1
- package/dist/commands/sync/extraction.js +38 -4
- package/dist/commands/sync/manifest.d.ts +8 -5
- package/dist/commands/sync/manifest.d.ts.map +1 -1
- package/dist/commands/sync/manifest.js +142 -39
- package/dist/commands/sync/persistence.d.ts.map +1 -1
- package/dist/commands/sync/persistence.js +3 -0
- package/dist/commands/sync.d.ts +6 -0
- package/dist/commands/sync.d.ts.map +1 -1
- package/dist/commands/sync.js +304 -79
- package/dist/commands/verify.d.ts +10 -0
- package/dist/commands/verify.d.ts.map +1 -0
- package/dist/commands/verify.js +126 -0
- package/dist/diagnostics.d.ts +1 -1
- package/dist/diagnostics.d.ts.map +1 -1
- package/dist/engine.d.ts +96 -3
- package/dist/engine.d.ts.map +1 -1
- package/dist/engine.js +392 -23
- package/dist/env.d.ts.map +1 -1
- package/dist/env.js +5 -6
- package/dist/extractors/manifest.d.ts +8 -1
- package/dist/extractors/manifest.d.ts.map +1 -1
- package/dist/extractors/manifest.js +51 -9
- package/dist/extractors/markdown.d.ts +2 -1
- package/dist/extractors/markdown.d.ts.map +1 -1
- package/dist/extractors/markdown.js +21 -3
- package/dist/extractors/playwright-cases.d.ts +24 -0
- package/dist/extractors/playwright-cases.d.ts.map +1 -0
- package/dist/extractors/playwright-cases.js +126 -0
- package/dist/extractors/relationships.d.ts.map +1 -1
- package/dist/extractors/relationships.js +1 -0
- package/dist/extractors/symbol-coordinates.d.ts +81 -3
- package/dist/extractors/symbol-coordinates.d.ts.map +1 -1
- package/dist/extractors/symbol-coordinates.js +389 -51
- package/dist/extractors/symbols-coordinator.js +11 -1
- package/dist/intent-search.d.ts +60 -0
- package/dist/intent-search.d.ts.map +1 -0
- package/dist/intent-search.js +433 -0
- package/dist/operations/bootstrap/activation.d.ts.map +1 -0
- package/dist/operations/{autopilot → bootstrap}/activation.js +48 -31
- package/dist/operations/{autopilot → bootstrap}/candidate-helpers.d.ts.map +1 -1
- package/dist/operations/bootstrap/candidates.d.ts +4 -0
- package/dist/operations/{autopilot → bootstrap}/candidates.d.ts.map +1 -1
- package/dist/operations/{autopilot → bootstrap}/candidates.js +22 -8
- package/dist/operations/{autopilot → bootstrap}/discovery-evidence.d.ts +2 -2
- package/dist/operations/{autopilot → bootstrap}/discovery-evidence.d.ts.map +1 -1
- package/dist/operations/{autopilot → bootstrap}/discovery-evidence.js +46 -6
- package/dist/operations/{autopilot → bootstrap}/discovery.d.ts +1 -1
- package/dist/operations/bootstrap/discovery.d.ts.map +1 -0
- package/dist/operations/{autopilot → bootstrap}/discovery.js +21 -14
- package/dist/operations/bootstrap/generate.d.ts +8 -0
- package/dist/operations/bootstrap/generate.d.ts.map +1 -0
- package/dist/operations/bootstrap/generate.js +204 -0
- package/dist/operations/{autopilot → bootstrap}/guidance-actions.d.ts +2 -2
- package/dist/operations/{autopilot → bootstrap}/guidance-actions.d.ts.map +1 -1
- package/dist/operations/{autopilot → bootstrap}/guidance-actions.js +4 -4
- package/dist/operations/{autopilot → bootstrap}/guidance.d.ts +2 -2
- package/dist/operations/{autopilot → bootstrap}/guidance.d.ts.map +1 -1
- package/dist/operations/{autopilot → bootstrap}/guidance.js +2 -0
- package/dist/operations/{autopilot → bootstrap}/markdown-candidates.d.ts +2 -2
- package/dist/operations/{autopilot → bootstrap}/markdown-candidates.d.ts.map +1 -1
- package/dist/operations/{autopilot → bootstrap}/markdown-candidates.js +4 -3
- package/dist/operations/bootstrap/presentation.d.ts +15 -0
- package/dist/operations/bootstrap/presentation.d.ts.map +1 -0
- package/dist/operations/bootstrap/presentation.js +177 -0
- package/dist/operations/{autopilot → bootstrap}/requirement-claims.d.ts.map +1 -1
- package/dist/operations/{autopilot → bootstrap}/types.d.ts +63 -21
- package/dist/operations/bootstrap/types.d.ts.map +1 -0
- package/dist/operations/bootstrap/types.js +25 -0
- package/dist/operations/modeling/model-requirement.d.ts.map +1 -1
- package/dist/operations/modeling/model-requirement.js +4 -17
- package/dist/operations/modeling/predicate-applicability.d.ts +16 -0
- package/dist/operations/modeling/predicate-applicability.d.ts.map +1 -0
- package/dist/operations/modeling/predicate-applicability.js +276 -0
- package/dist/operations/modeling/predicate-applyplan.d.ts +13 -2
- package/dist/operations/modeling/predicate-applyplan.d.ts.map +1 -1
- package/dist/operations/modeling/predicate-applyplan.js +100 -3
- package/dist/operations/modeling/predicate-bindings.d.ts +6 -0
- package/dist/operations/modeling/predicate-bindings.d.ts.map +1 -0
- package/dist/operations/modeling/predicate-bindings.js +122 -0
- package/dist/operations/modeling/predicate-catalog-4.d.ts.map +1 -1
- package/dist/operations/modeling/predicate-catalog-4.js +155 -0
- package/dist/operations/modeling/predicate-inference-1.d.ts.map +1 -1
- package/dist/operations/modeling/predicate-inference-1.js +8 -0
- package/dist/operations/modeling/predicate-inference-launcher.d.ts +10 -0
- package/dist/operations/modeling/predicate-inference-launcher.d.ts.map +1 -0
- package/dist/operations/modeling/predicate-inference-launcher.js +13 -0
- package/dist/operations/modeling/predicate-inference.d.ts.map +1 -1
- package/dist/operations/modeling/predicate-inference.js +4 -0
- package/dist/operations/modeling/predicate-loader.d.ts.map +1 -1
- package/dist/operations/modeling/predicate-loader.js +7 -0
- package/dist/operations/modeling/predicate-ranker.d.ts +8 -1
- package/dist/operations/modeling/predicate-ranker.d.ts.map +1 -1
- package/dist/operations/modeling/predicate-ranker.js +156 -24
- package/dist/operations/modeling/predicate-score-3.d.ts.map +1 -1
- package/dist/operations/modeling/predicate-score-3.js +6 -0
- package/dist/operations/modeling/predicate-types.d.ts +34 -0
- package/dist/operations/modeling/predicate-types.d.ts.map +1 -1
- package/dist/operations/modeling/predicate-usage-hints-3.d.ts.map +1 -1
- package/dist/operations/modeling/predicate-usage-hints-3.js +40 -0
- package/dist/operations/modeling/predicate-utils.d.ts.map +1 -1
- package/dist/operations/modeling/predicate-utils.js +2 -0
- package/dist/operations/modeling/suggest-predicates.d.ts +1 -1
- package/dist/operations/modeling/suggest-predicates.d.ts.map +1 -1
- package/dist/operations/modeling/suggest-predicates.js +170 -32
- package/dist/operations/mutation/delete.d.ts.map +1 -1
- package/dist/operations/mutation/delete.js +415 -19
- package/dist/operations/mutation/entity-projection.d.ts +11 -0
- package/dist/operations/mutation/entity-projection.d.ts.map +1 -0
- package/dist/operations/mutation/entity-projection.js +14 -0
- package/dist/operations/mutation/relationships.d.ts +10 -0
- package/dist/operations/mutation/relationships.d.ts.map +1 -1
- package/dist/operations/mutation/relationships.js +71 -1
- package/dist/operations/mutation/serialization.d.ts.map +1 -1
- package/dist/operations/mutation/serialization.js +1 -0
- package/dist/operations/mutation/source-authoring.d.ts +61 -0
- package/dist/operations/mutation/source-authoring.d.ts.map +1 -0
- package/dist/operations/mutation/source-authoring.js +543 -0
- package/dist/operations/mutation/symbol-compiler-lock.d.ts +51 -0
- package/dist/operations/mutation/symbol-compiler-lock.d.ts.map +1 -0
- package/dist/operations/mutation/symbol-compiler-lock.js +274 -0
- package/dist/operations/mutation/symbol-granularity.d.ts.map +1 -1
- package/dist/operations/mutation/symbol-granularity.js +34 -3
- package/dist/operations/mutation/symbol-refresh.d.ts +18 -1
- package/dist/operations/mutation/symbol-refresh.d.ts.map +1 -1
- package/dist/operations/mutation/symbol-refresh.js +225 -63
- package/dist/operations/mutation/types.d.ts +57 -1
- package/dist/operations/mutation/types.d.ts.map +1 -1
- package/dist/operations/mutation/upsert.d.ts.map +1 -1
- package/dist/operations/mutation/upsert.js +363 -24
- package/dist/operations/mutation/validation.d.ts.map +1 -1
- package/dist/operations/mutation/validation.js +1 -0
- package/dist/operations/planning/apply-plan.d.ts +117 -0
- package/dist/operations/planning/apply-plan.d.ts.map +1 -0
- package/dist/operations/planning/apply-plan.js +1437 -0
- package/dist/operations/planning/compile-intent.d.ts +106 -0
- package/dist/operations/planning/compile-intent.d.ts.map +1 -0
- package/dist/operations/planning/compile-intent.js +562 -0
- package/dist/operations/semantic-advisor/analyze-prose.d.ts.map +1 -1
- package/dist/operations/semantic-advisor/analyze-prose.js +6 -2
- package/dist/operations/semantic-advisor/clauses.d.ts.map +1 -1
- package/dist/operations/semantic-advisor/clauses.js +15 -2
- package/dist/operations/semantic-advisor/ingestion-boundary.d.ts.map +1 -1
- package/dist/operations/semantic-advisor/ingestion-boundary.js +7 -3
- package/dist/operations/semantic-advisor/predicate-rules-launcher.d.ts +51 -0
- package/dist/operations/semantic-advisor/predicate-rules-launcher.d.ts.map +1 -0
- package/dist/operations/semantic-advisor/predicate-rules-launcher.js +96 -0
- package/dist/operations/semantic-advisor/types.d.ts +13 -5
- package/dist/operations/semantic-advisor/types.d.ts.map +1 -1
- package/dist/operations/verification/ingest-verification.d.ts +29 -0
- package/dist/operations/verification/ingest-verification.d.ts.map +1 -0
- package/dist/operations/verification/ingest-verification.js +192 -0
- package/dist/prolog/codec.d.ts.map +1 -1
- package/dist/prolog/codec.js +2 -1
- package/dist/prolog.d.ts.map +1 -1
- package/dist/prolog.js +27 -8
- 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/check-types.d.ts +2 -2
- package/dist/public/check-types.d.ts.map +1 -1
- package/dist/public/check-types.js +16 -16
- package/dist/public/diagnostic-usage.d.ts.map +1 -1
- package/dist/public/diagnostic-usage.js +69 -1
- package/dist/public/distribution-parity.d.ts +1 -1
- package/dist/public/distribution-parity.d.ts.map +1 -1
- package/dist/public/distribution-parity.js +1 -0
- package/dist/public/ignore-policy.d.ts.map +1 -1
- package/dist/public/ignore-policy.js +16 -4
- package/dist/public/impact/coverage-depth-quality.d.ts +6 -1
- package/dist/public/impact/coverage-depth-quality.d.ts.map +1 -1
- package/dist/public/impact/coverage-depth-quality.js +21 -3
- package/dist/public/impact/full-kb-quality.d.ts +4 -2
- package/dist/public/impact/full-kb-quality.d.ts.map +1 -1
- package/dist/public/impact/full-kb-quality.js +61 -1
- package/dist/public/impact/manifest.d.ts.map +1 -1
- package/dist/public/impact/manifest.js +2 -5
- package/dist/public/operational-artifacts.d.ts.map +1 -1
- package/dist/public/operational-artifacts.js +7 -1
- package/dist/public/operations/catalog.d.ts +682 -67
- package/dist/public/operations/catalog.d.ts.map +1 -1
- package/dist/public/operations/catalog.js +126 -4
- package/dist/public/operations/check-executor.d.ts +2 -2
- package/dist/public/operations/check-executor.d.ts.map +1 -1
- package/dist/public/operations/check-executor.js +72 -13
- package/dist/public/operations/check-format-shared.d.ts +3 -0
- package/dist/public/operations/check-format-shared.d.ts.map +1 -1
- package/dist/public/operations/check-format-shared.js +3 -0
- package/dist/public/operations/check-helpers.d.ts +27 -2
- package/dist/public/operations/check-helpers.d.ts.map +1 -1
- package/dist/public/operations/check-helpers.js +62 -26
- package/dist/public/operations/contracts.d.ts +11 -0
- package/dist/public/operations/contracts.d.ts.map +1 -0
- package/dist/public/operations/contracts.js +325 -0
- package/dist/public/operations/discovery-executors.d.ts +37 -1
- package/dist/public/operations/discovery-executors.d.ts.map +1 -1
- package/dist/public/operations/discovery-executors.js +206 -6
- package/dist/public/operations/index.d.ts +9 -4
- package/dist/public/operations/index.d.ts.map +1 -1
- package/dist/public/operations/index.js +8 -3
- package/dist/public/operations/migration-plan.d.ts +101 -0
- package/dist/public/operations/migration-plan.d.ts.map +1 -0
- package/dist/public/operations/migration-plan.js +537 -0
- package/dist/public/operations/node-ports.d.ts.map +1 -1
- package/dist/public/operations/node-ports.js +68 -8
- package/dist/public/operations/prolog-json.d.ts +14 -0
- package/dist/public/operations/prolog-json.d.ts.map +1 -1
- package/dist/public/operations/prolog-json.js +44 -5
- package/dist/public/operations/repair-plan.d.ts.map +1 -1
- package/dist/public/operations/repair-plan.js +1 -0
- package/dist/public/operations/result-envelope.d.ts +13 -0
- package/dist/public/operations/result-envelope.d.ts.map +1 -0
- package/dist/public/operations/result-envelope.js +104 -0
- package/dist/public/operations/runtime-types.d.ts +97 -7
- package/dist/public/operations/runtime-types.d.ts.map +1 -1
- package/dist/public/operations/source-relationship-parity.d.ts +13 -0
- package/dist/public/operations/source-relationship-parity.d.ts.map +1 -0
- package/dist/public/operations/source-relationship-parity.js +162 -0
- package/dist/public/operations/specs/{autopilot.d.ts → bootstrap.d.ts} +9 -9
- package/dist/public/operations/specs/bootstrap.d.ts.map +1 -0
- package/dist/public/operations/specs/{autopilot.js → bootstrap.js} +8 -7
- package/dist/public/operations/specs/check.d.ts +4 -4
- package/dist/public/operations/specs/check.d.ts.map +1 -1
- package/dist/public/operations/specs/check.js +4 -3
- package/dist/public/operations/specs/discovery.d.ts +87 -3
- package/dist/public/operations/specs/discovery.d.ts.map +1 -1
- package/dist/public/operations/specs/discovery.js +53 -3
- package/dist/public/operations/specs/modeling.d.ts +3 -3
- package/dist/public/operations/specs/modeling.js +3 -3
- package/dist/public/operations/specs/mutation-schemas.d.ts +190 -47
- package/dist/public/operations/specs/mutation-schemas.d.ts.map +1 -1
- package/dist/public/operations/specs/mutation-schemas.js +3 -1
- package/dist/public/operations/specs/mutation.d.ts +42 -2
- package/dist/public/operations/specs/mutation.d.ts.map +1 -1
- package/dist/public/operations/specs/mutation.js +26 -2
- package/dist/public/operations/specs/planning.d.ts +270 -0
- package/dist/public/operations/specs/planning.d.ts.map +1 -0
- package/dist/public/operations/specs/planning.js +191 -0
- package/dist/public/operations/specs/reporting.d.ts +4 -1
- package/dist/public/operations/specs/reporting.d.ts.map +1 -1
- package/dist/public/operations/specs/reporting.js +46 -1
- package/dist/public/operations/specs/upsert.d.ts +204 -47
- package/dist/public/operations/specs/upsert.d.ts.map +1 -1
- package/dist/public/operations/specs/upsert.js +9 -0
- package/dist/public/operations/specs/verification.d.ts +78 -0
- package/dist/public/operations/specs/verification.d.ts.map +1 -0
- package/dist/public/operations/specs/verification.js +62 -0
- package/dist/public/operations/symbol-repair-plan.d.ts +11 -0
- package/dist/public/operations/symbol-repair-plan.d.ts.map +1 -0
- package/dist/public/operations/symbol-repair-plan.js +123 -0
- package/dist/public/operations/types.d.ts +52 -1
- package/dist/public/operations/types.d.ts.map +1 -1
- package/dist/public/playwright-case-id.d.ts +8 -0
- package/dist/public/playwright-case-id.d.ts.map +1 -0
- package/dist/public/playwright-case-id.js +25 -0
- package/dist/public/schemas/entity.d.ts.map +1 -1
- package/dist/public/schemas/entity.js +4 -2
- package/dist/public/skills/kibi-bootstrap/SKILL.md +58 -0
- package/dist/public/skills/kibi-bootstrap/resources/bootstrap.md +11 -0
- package/dist/public/skills/kibi-bootstrap/resources/branch-lifecycle.md +7 -0
- package/dist/public/skills/kibi-bootstrap/resources/operation-access.md +5 -0
- package/dist/public/skills/kibi-bootstrap/resources/source-authoring.md +8 -0
- package/dist/public/skills/kibi-freshness/SKILL.md +39 -9
- package/dist/public/skills/kibi-freshness/resources/branch-lifecycle.md +7 -0
- package/dist/public/skills/kibi-freshness/resources/operation-access.md +6 -0
- package/dist/public/skills/kibi-freshness/resources/source-authoring.md +7 -0
- package/dist/public/skills/kibi-traceability/SKILL.md +47 -47
- package/dist/public/skills/kibi-traceability/resources/branch-lifecycle.md +7 -0
- package/dist/public/skills/kibi-traceability/resources/operation-access.md +5 -0
- package/dist/public/skills/kibi-traceability/resources/source-authoring.md +6 -0
- package/dist/public/skills/kibi-traceability/resources/traceability.md +8 -0
- package/dist/public/skills/kibi-usage/SKILL.md +115 -239
- package/dist/public/skills/kibi-usage/resources/branch-lifecycle.md +31 -0
- package/dist/public/skills/kibi-usage/resources/kb-improvement.md +38 -0
- package/dist/public/skills/kibi-usage/resources/operation-access.md +36 -38
- package/dist/public/skills/kibi-usage/resources/relationship-directions.md +3 -3
- package/dist/public/skills/kibi-usage/resources/source-authoring.md +31 -0
- package/dist/public/skills/kibi-usage/resources/workflows.md +56 -3
- package/dist/public/symbol-granularity.d.ts +1 -1
- package/dist/public/symbol-granularity.d.ts.map +1 -1
- package/dist/public/symbol-granularity.js +1 -0
- package/dist/public/telemetry-acceptance.d.ts +7 -0
- package/dist/public/telemetry-acceptance.d.ts.map +1 -1
- package/dist/public/telemetry-acceptance.js +8 -1
- package/dist/public/telemetry-remediation.js +1 -1
- package/dist/public/verification-receipt.d.ts +206 -39
- package/dist/public/verification-receipt.d.ts.map +1 -1
- package/dist/public/verification-receipt.js +171 -4
- package/dist/relationships/shards.d.ts +16 -0
- package/dist/relationships/shards.d.ts.map +1 -1
- package/dist/relationships/shards.js +87 -2
- package/dist/report/brand.d.ts +19 -0
- package/dist/report/brand.d.ts.map +1 -0
- package/dist/report/brand.js +112 -0
- package/dist/report/html-report.d.ts +19 -0
- package/dist/report/html-report.d.ts.map +1 -0
- package/dist/report/html-report.js +963 -0
- package/dist/report/relative-time.d.ts +4 -0
- package/dist/report/relative-time.d.ts.map +1 -0
- package/dist/report/relative-time.js +46 -0
- package/dist/report/report-view.d.ts +17 -0
- package/dist/report/report-view.d.ts.map +1 -0
- package/dist/report/report-view.js +33 -0
- package/dist/report/repository.d.ts +35 -0
- package/dist/report/repository.d.ts.map +1 -0
- package/dist/report/repository.js +151 -0
- package/dist/runtime/cli-runtime.d.ts.map +1 -1
- package/dist/runtime/cli-runtime.js +82 -22
- package/dist/schemas/entity.schema.json +1148 -273
- package/dist/traceability/evidence-model.d.ts +2 -2
- package/dist/traceability/evidence-model.d.ts.map +1 -1
- package/dist/traceability/evidence-model.js +2 -2
- package/dist/traceability/git-staged.d.ts.map +1 -1
- package/dist/traceability/git-staged.js +15 -40
- package/dist/traceability/markdown-validate.d.ts.map +1 -1
- package/dist/traceability/markdown-validate.js +12 -7
- package/dist/traceability/staged-impact-contract.d.ts +3 -3
- package/dist/traceability/staged-impact-contract.d.ts.map +1 -1
- package/dist/traceability/staged-impact-contract.js +10 -38
- package/dist/traceability/staged-symbols-manifest.d.ts.map +1 -1
- package/dist/traceability/staged-symbols-manifest.js +8 -3
- package/dist/traceability/temp-kb.d.ts.map +1 -1
- package/dist/traceability/temp-kb.js +3 -0
- package/dist/types/entities.d.ts +3 -0
- package/dist/types/entities.d.ts.map +1 -1
- package/dist/utils/branch-resolver.d.ts +24 -10
- package/dist/utils/branch-resolver.d.ts.map +1 -1
- package/dist/utils/branch-resolver.js +121 -38
- package/dist/utils/branch-store-locator.d.ts +23 -0
- package/dist/utils/branch-store-locator.d.ts.map +1 -0
- package/dist/utils/branch-store-locator.js +90 -0
- package/dist/utils/branch-store.d.ts +15 -0
- package/dist/utils/branch-store.d.ts.map +1 -0
- package/dist/utils/branch-store.js +130 -0
- package/dist/utils/config.d.ts +39 -37
- package/dist/utils/config.d.ts.map +1 -1
- package/dist/utils/config.js +107 -119
- package/dist/utils/kb-manifest.d.ts +35 -0
- package/dist/utils/kb-manifest.d.ts.map +1 -0
- package/dist/utils/kb-manifest.js +154 -0
- package/dist/utils/kb-paths.d.ts +54 -0
- package/dist/utils/kb-paths.d.ts.map +1 -0
- package/dist/utils/kb-paths.js +125 -0
- package/dist/utils/manifest-paths.d.ts +4 -4
- package/dist/utils/manifest-paths.d.ts.map +1 -1
- package/dist/utils/manifest-paths.js +8 -56
- package/dist/utils/rule-registry.d.ts +48 -20
- package/dist/utils/rule-registry.d.ts.map +1 -1
- package/dist/utils/rule-registry.js +82 -77
- package/dist/utils/schema-version.d.ts +5 -5
- package/dist/utils/schema-version.d.ts.map +1 -1
- package/dist/utils/schema-version.js +26 -6
- package/dist/utils/strict-modeling.d.ts +0 -4
- package/dist/utils/strict-modeling.d.ts.map +1 -1
- package/dist/utils/strict-modeling.js +7 -8
- package/dist/verification/playwright-reporter.d.ts +21 -0
- package/dist/verification/playwright-reporter.d.ts.map +1 -0
- package/dist/verification/playwright-reporter.js +114 -0
- package/package.json +46 -7
- package/schema/config.json +2 -2
- package/schema/manifest.json +26 -0
- package/src/public/branch-resolver.ts +1 -0
- package/src/public/check-types.ts +22 -19
- package/src/public/diagnostic-usage.ts +79 -1
- package/src/public/distribution-parity.ts +1 -0
- package/src/public/ignore-policy.ts +16 -10
- package/src/public/impact/coverage-depth-quality.ts +36 -0
- package/src/public/impact/full-kb-quality.ts +118 -5
- package/src/public/impact/manifest.ts +2 -4
- package/src/public/operational-artifacts.ts +9 -1
- package/src/public/operations/catalog.ts +146 -9
- package/src/public/operations/check-executor.ts +102 -15
- package/src/public/operations/check-format-shared.ts +6 -0
- package/src/public/operations/check-helpers.ts +74 -35
- package/src/public/operations/contracts.ts +366 -0
- package/src/public/operations/discovery-executors.ts +299 -12
- package/src/public/operations/index.ts +9 -4
- package/src/public/operations/migration-plan.ts +740 -0
- package/src/public/operations/node-ports.ts +84 -10
- package/src/public/operations/prolog-json.ts +60 -5
- package/src/public/operations/repair-plan.ts +1 -0
- package/src/public/operations/result-envelope.ts +136 -0
- package/src/public/operations/runtime-types.ts +91 -5
- package/src/public/operations/source-relationship-parity.ts +226 -0
- package/src/public/operations/specs/{autopilot.ts → bootstrap.ts} +17 -16
- package/src/public/operations/specs/check.ts +4 -3
- package/src/public/operations/specs/discovery.ts +57 -3
- package/src/public/operations/specs/modeling.ts +3 -3
- package/src/public/operations/specs/mutation-schemas.ts +6 -1
- package/src/public/operations/specs/mutation.ts +27 -2
- package/src/public/operations/specs/planning.ts +234 -0
- package/src/public/operations/specs/reporting.ts +55 -1
- package/src/public/operations/specs/upsert.ts +10 -0
- package/src/public/operations/specs/verification.ts +78 -0
- package/src/public/operations/symbol-repair-plan.ts +164 -0
- package/src/public/operations/types.ts +62 -1
- package/src/public/playwright-case-id.ts +35 -0
- package/src/public/schemas/entity.ts +7 -2
- package/src/public/skills/kibi-bootstrap/SKILL.md +58 -0
- package/src/public/skills/kibi-bootstrap/resources/bootstrap.md +11 -0
- package/src/public/skills/kibi-bootstrap/resources/branch-lifecycle.md +7 -0
- package/src/public/skills/kibi-bootstrap/resources/operation-access.md +5 -0
- package/src/public/skills/kibi-bootstrap/resources/source-authoring.md +8 -0
- package/src/public/skills/kibi-freshness/SKILL.md +39 -9
- package/src/public/skills/kibi-freshness/resources/branch-lifecycle.md +7 -0
- package/src/public/skills/kibi-freshness/resources/operation-access.md +6 -0
- package/src/public/skills/kibi-freshness/resources/source-authoring.md +7 -0
- package/src/public/skills/kibi-traceability/SKILL.md +47 -47
- package/src/public/skills/kibi-traceability/resources/branch-lifecycle.md +7 -0
- package/src/public/skills/kibi-traceability/resources/operation-access.md +5 -0
- package/src/public/skills/kibi-traceability/resources/source-authoring.md +6 -0
- package/src/public/skills/kibi-traceability/resources/traceability.md +8 -0
- package/src/public/skills/kibi-usage/SKILL.md +115 -239
- package/src/public/skills/kibi-usage/resources/branch-lifecycle.md +31 -0
- package/src/public/skills/kibi-usage/resources/kb-improvement.md +38 -0
- package/src/public/skills/kibi-usage/resources/operation-access.md +36 -38
- package/src/public/skills/kibi-usage/resources/relationship-directions.md +3 -3
- package/src/public/skills/kibi-usage/resources/source-authoring.md +31 -0
- package/src/public/skills/kibi-usage/resources/workflows.md +56 -3
- package/src/public/symbol-granularity.ts +1 -0
- package/src/public/telemetry-acceptance.ts +16 -1
- package/src/public/telemetry-remediation.ts +1 -1
- package/src/public/verification-receipt.ts +248 -6
- package/src/schemas/entity.schema.json +1148 -273
- package/templates/github/kibi-badge.yml +86 -0
- package/templates/github/kibi-report.yml +84 -0
- package/dist/operations/autopilot/activation.d.ts.map +0 -1
- package/dist/operations/autopilot/candidates.d.ts +0 -4
- package/dist/operations/autopilot/discovery.d.ts.map +0 -1
- package/dist/operations/autopilot/generate.d.ts +0 -8
- package/dist/operations/autopilot/generate.d.ts.map +0 -1
- package/dist/operations/autopilot/generate.js +0 -112
- package/dist/operations/autopilot/presentation.d.ts +0 -13
- package/dist/operations/autopilot/presentation.d.ts.map +0 -1
- package/dist/operations/autopilot/presentation.js +0 -91
- package/dist/operations/autopilot/types.d.ts.map +0 -1
- package/dist/operations/autopilot/types.js +0 -8
- package/dist/public/operations/specs/autopilot.d.ts.map +0 -1
- package/dist/public/skills/init-kibi/SKILL.md +0 -62
- package/src/public/skills/init-kibi/SKILL.md +0 -62
- /package/dist/operations/{autopilot → bootstrap}/activation.d.ts +0 -0
- /package/dist/operations/{autopilot → bootstrap}/candidate-helpers.d.ts +0 -0
- /package/dist/operations/{autopilot → bootstrap}/candidate-helpers.js +0 -0
- /package/dist/operations/{autopilot → bootstrap}/requirement-claims.d.ts +0 -0
- /package/dist/operations/{autopilot → bootstrap}/requirement-claims.js +0 -0
|
@@ -0,0 +1,740 @@
|
|
|
1
|
+
import { createHash } from "node:crypto";
|
|
2
|
+
import { existsSync, readFileSync } from "node:fs";
|
|
3
|
+
import * as path from "node:path";
|
|
4
|
+
import { legacyConfigExists } from "../../utils/config.js";
|
|
5
|
+
import { readKbManifestStatus } from "../../utils/kb-manifest.js";
|
|
6
|
+
import {
|
|
7
|
+
getSchemaVersionStatus,
|
|
8
|
+
normalizeSchemaVersion,
|
|
9
|
+
} from "../../utils/schema-version.js";
|
|
10
|
+
|
|
11
|
+
export const MIGRATION_PLAN_VERSION = "kibi.migration-plan.v2" as const;
|
|
12
|
+
|
|
13
|
+
export type MigrationActionState = "ready" | "blocked";
|
|
14
|
+
export type MigrationSafety = "automatic" | "review" | "operator" | "execution";
|
|
15
|
+
export type MigrationDisposition = "fixed" | "accepted" | "deferred";
|
|
16
|
+
|
|
17
|
+
export type MigrationInvocation =
|
|
18
|
+
| Readonly<{
|
|
19
|
+
kind: "operation";
|
|
20
|
+
name: string;
|
|
21
|
+
input: Readonly<Record<string, unknown>>;
|
|
22
|
+
}>
|
|
23
|
+
| Readonly<{
|
|
24
|
+
kind: "cli";
|
|
25
|
+
command_argv: readonly string[];
|
|
26
|
+
}>
|
|
27
|
+
| Readonly<{
|
|
28
|
+
kind: "review";
|
|
29
|
+
instruction: string;
|
|
30
|
+
}>;
|
|
31
|
+
|
|
32
|
+
export type MigrationAction = Readonly<{
|
|
33
|
+
id: string;
|
|
34
|
+
code: string;
|
|
35
|
+
category:
|
|
36
|
+
| "package"
|
|
37
|
+
| "branch"
|
|
38
|
+
| "storage"
|
|
39
|
+
| "schema"
|
|
40
|
+
| "freshness"
|
|
41
|
+
| "relationship"
|
|
42
|
+
| "symbol"
|
|
43
|
+
| "semantic"
|
|
44
|
+
| "verification"
|
|
45
|
+
| "quality";
|
|
46
|
+
state: MigrationActionState;
|
|
47
|
+
safety: MigrationSafety;
|
|
48
|
+
invocation: MigrationInvocation;
|
|
49
|
+
affectedEntityIds: readonly string[];
|
|
50
|
+
affectedFiles: readonly string[];
|
|
51
|
+
dependsOn: readonly string[];
|
|
52
|
+
preconditions: readonly Readonly<Record<string, unknown>>[];
|
|
53
|
+
postconditions: readonly Readonly<Record<string, unknown>>[];
|
|
54
|
+
evidence: Readonly<Record<string, unknown>>;
|
|
55
|
+
autoApplicable: boolean;
|
|
56
|
+
dispositionRequired: boolean;
|
|
57
|
+
allowedDispositions: readonly MigrationDisposition[];
|
|
58
|
+
}>;
|
|
59
|
+
|
|
60
|
+
export type MigrationPlan = Readonly<{
|
|
61
|
+
version: typeof MIGRATION_PLAN_VERSION;
|
|
62
|
+
planHash: string;
|
|
63
|
+
status: "no_actions" | "ready" | "partial" | "blocked";
|
|
64
|
+
expected: Readonly<{
|
|
65
|
+
branch: string | null;
|
|
66
|
+
kbBranch: string | null;
|
|
67
|
+
kbSnapshotId: string | null;
|
|
68
|
+
workspaceSnapshot: string | null;
|
|
69
|
+
configHash: string | null;
|
|
70
|
+
}>;
|
|
71
|
+
scope: Readonly<{
|
|
72
|
+
evaluatedDomains: readonly string[];
|
|
73
|
+
incompleteDomains: readonly string[];
|
|
74
|
+
complete: boolean;
|
|
75
|
+
}>;
|
|
76
|
+
summary: Readonly<{
|
|
77
|
+
actionCount: number;
|
|
78
|
+
readyActionCount: number;
|
|
79
|
+
blockedActionCount: number;
|
|
80
|
+
automaticActionCount: number;
|
|
81
|
+
reviewActionCount: number;
|
|
82
|
+
operatorActionCount: number;
|
|
83
|
+
executionActionCount: number;
|
|
84
|
+
}>;
|
|
85
|
+
actions: readonly MigrationAction[];
|
|
86
|
+
diagnostics: readonly string[];
|
|
87
|
+
}>;
|
|
88
|
+
|
|
89
|
+
type PlanInput = Readonly<{
|
|
90
|
+
expected?: Partial<MigrationPlan["expected"]>;
|
|
91
|
+
evaluatedDomains?: readonly string[];
|
|
92
|
+
incompleteDomains?: readonly string[];
|
|
93
|
+
actions?: readonly MigrationAction[];
|
|
94
|
+
diagnostics?: readonly string[];
|
|
95
|
+
}>;
|
|
96
|
+
|
|
97
|
+
function isRecord(value: unknown): value is Record<string, unknown> {
|
|
98
|
+
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
function stableValue(value: unknown, root = true): unknown {
|
|
102
|
+
if (Array.isArray(value))
|
|
103
|
+
return value.map((entry) => stableValue(entry, false));
|
|
104
|
+
if (!isRecord(value)) return value;
|
|
105
|
+
return Object.fromEntries(
|
|
106
|
+
Object.entries(value)
|
|
107
|
+
.filter(([key]) =>
|
|
108
|
+
root
|
|
109
|
+
? key !== "planHash" && key !== "status" && key !== "summary"
|
|
110
|
+
: key !== "planHash",
|
|
111
|
+
)
|
|
112
|
+
.sort(([left], [right]) => left.localeCompare(right))
|
|
113
|
+
.map(([key, item]) => [key, stableValue(item, false)]),
|
|
114
|
+
);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
// implements REQ-agent-guided-migration-orchestration
|
|
118
|
+
export function migrationPlanHash(value: unknown): string {
|
|
119
|
+
return createHash("sha256")
|
|
120
|
+
.update(JSON.stringify(stableValue(value)))
|
|
121
|
+
.digest("hex");
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
function uniqueSorted(values: readonly string[] | undefined): string[] {
|
|
125
|
+
return [...new Set(values ?? [])].sort();
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
function actionSort(left: MigrationAction, right: MigrationAction): number {
|
|
129
|
+
return (
|
|
130
|
+
left.state.localeCompare(right.state) ||
|
|
131
|
+
left.safety.localeCompare(right.safety) ||
|
|
132
|
+
left.category.localeCompare(right.category) ||
|
|
133
|
+
left.id.localeCompare(right.id)
|
|
134
|
+
);
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
/** Return actions in a deterministic dependency-first order for agents and the applier. */
|
|
138
|
+
function dependencyOrder(
|
|
139
|
+
actions: readonly MigrationAction[],
|
|
140
|
+
): MigrationAction[] {
|
|
141
|
+
const byId = new Map(actions.map((action) => [action.id, action]));
|
|
142
|
+
const remaining = new Map(
|
|
143
|
+
actions.map((action) => [
|
|
144
|
+
action.id,
|
|
145
|
+
new Set(action.dependsOn.filter((dependency) => byId.has(dependency))),
|
|
146
|
+
]),
|
|
147
|
+
);
|
|
148
|
+
const ordered: MigrationAction[] = [];
|
|
149
|
+
const ready = actions
|
|
150
|
+
.filter((action) => (remaining.get(action.id)?.size ?? 0) === 0)
|
|
151
|
+
.sort(actionSort)
|
|
152
|
+
.map((action) => action.id);
|
|
153
|
+
const queued = new Set(ready);
|
|
154
|
+
while (ready.length > 0) {
|
|
155
|
+
const id = ready.shift();
|
|
156
|
+
if (id === undefined) break;
|
|
157
|
+
queued.delete(id);
|
|
158
|
+
const action = byId.get(id);
|
|
159
|
+
if (action === undefined) continue;
|
|
160
|
+
ordered.push(action);
|
|
161
|
+
for (const [candidateId, dependencies] of remaining) {
|
|
162
|
+
if (
|
|
163
|
+
!dependencies.delete(id) ||
|
|
164
|
+
dependencies.size !== 0 ||
|
|
165
|
+
queued.has(candidateId)
|
|
166
|
+
) {
|
|
167
|
+
continue;
|
|
168
|
+
}
|
|
169
|
+
ready.push(candidateId);
|
|
170
|
+
queued.add(candidateId);
|
|
171
|
+
ready.sort((left, right) => {
|
|
172
|
+
const leftAction = byId.get(left);
|
|
173
|
+
const rightAction = byId.get(right);
|
|
174
|
+
if (leftAction === undefined || rightAction === undefined) {
|
|
175
|
+
return left.localeCompare(right);
|
|
176
|
+
}
|
|
177
|
+
return actionSort(leftAction, rightAction);
|
|
178
|
+
});
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
// Preserve cyclic/missing-dependency actions in canonical order; validation will block them.
|
|
182
|
+
if (ordered.length !== actions.length) {
|
|
183
|
+
const emitted = new Set(ordered.map((action) => action.id));
|
|
184
|
+
ordered.push(
|
|
185
|
+
...actions.filter((action) => !emitted.has(action.id)).sort(actionSort),
|
|
186
|
+
);
|
|
187
|
+
}
|
|
188
|
+
return ordered;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
function summarize(actions: readonly MigrationAction[]) {
|
|
192
|
+
return {
|
|
193
|
+
actionCount: actions.length,
|
|
194
|
+
readyActionCount: actions.filter((action) => action.state === "ready")
|
|
195
|
+
.length,
|
|
196
|
+
blockedActionCount: actions.filter((action) => action.state === "blocked")
|
|
197
|
+
.length,
|
|
198
|
+
automaticActionCount: actions.filter(
|
|
199
|
+
(action) => action.safety === "automatic",
|
|
200
|
+
).length,
|
|
201
|
+
reviewActionCount: actions.filter((action) => action.safety === "review")
|
|
202
|
+
.length,
|
|
203
|
+
operatorActionCount: actions.filter(
|
|
204
|
+
(action) => action.safety === "operator",
|
|
205
|
+
).length,
|
|
206
|
+
executionActionCount: actions.filter(
|
|
207
|
+
(action) => action.safety === "execution",
|
|
208
|
+
).length,
|
|
209
|
+
};
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
// implements REQ-agent-guided-migration-orchestration
|
|
213
|
+
export function buildMigrationPlan(input: PlanInput = {}): MigrationPlan {
|
|
214
|
+
const actions = dependencyOrder([...(input.actions ?? [])].sort(actionSort));
|
|
215
|
+
const evaluatedDomains = uniqueSorted(input.evaluatedDomains);
|
|
216
|
+
const incompleteDomains = uniqueSorted(input.incompleteDomains);
|
|
217
|
+
const expected = {
|
|
218
|
+
branch: input.expected?.branch ?? null,
|
|
219
|
+
kbBranch: input.expected?.kbBranch ?? null,
|
|
220
|
+
kbSnapshotId: input.expected?.kbSnapshotId ?? null,
|
|
221
|
+
workspaceSnapshot: input.expected?.workspaceSnapshot ?? null,
|
|
222
|
+
configHash: input.expected?.configHash ?? null,
|
|
223
|
+
} as const;
|
|
224
|
+
const body = {
|
|
225
|
+
version: MIGRATION_PLAN_VERSION,
|
|
226
|
+
expected,
|
|
227
|
+
scope: {
|
|
228
|
+
evaluatedDomains,
|
|
229
|
+
incompleteDomains,
|
|
230
|
+
complete: incompleteDomains.length === 0,
|
|
231
|
+
},
|
|
232
|
+
actions,
|
|
233
|
+
diagnostics: [...(input.diagnostics ?? [])].sort(),
|
|
234
|
+
};
|
|
235
|
+
const planHash = migrationPlanHash(body);
|
|
236
|
+
const summary = summarize(actions);
|
|
237
|
+
const status =
|
|
238
|
+
actions.length === 0 && incompleteDomains.length === 0
|
|
239
|
+
? "no_actions"
|
|
240
|
+
: actions.length > 0 && summary.readyActionCount === 0
|
|
241
|
+
? "blocked"
|
|
242
|
+
: incompleteDomains.length > 0 || summary.blockedActionCount > 0
|
|
243
|
+
? "partial"
|
|
244
|
+
: "ready";
|
|
245
|
+
return {
|
|
246
|
+
...body,
|
|
247
|
+
planHash,
|
|
248
|
+
status,
|
|
249
|
+
summary,
|
|
250
|
+
};
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
export function mergeMigrationPlans(
|
|
254
|
+
plans: readonly MigrationPlan[],
|
|
255
|
+
): MigrationPlan {
|
|
256
|
+
if (plans.length === 0) return buildMigrationPlan();
|
|
257
|
+
const first = plans[0];
|
|
258
|
+
if (first === undefined) return buildMigrationPlan();
|
|
259
|
+
const actions = new Map<string, MigrationAction>();
|
|
260
|
+
const diagnostics = new Set<string>();
|
|
261
|
+
const evaluated = new Set<string>();
|
|
262
|
+
const incomplete = new Set<string>();
|
|
263
|
+
for (const plan of plans) {
|
|
264
|
+
for (const action of plan.actions) {
|
|
265
|
+
const existing = actions.get(action.id);
|
|
266
|
+
if (existing === undefined || action.state === "ready") {
|
|
267
|
+
actions.set(action.id, action);
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
for (const value of plan.diagnostics) diagnostics.add(value);
|
|
271
|
+
for (const value of plan.scope.evaluatedDomains) evaluated.add(value);
|
|
272
|
+
for (const value of plan.scope.incompleteDomains) incomplete.add(value);
|
|
273
|
+
}
|
|
274
|
+
return buildMigrationPlan({
|
|
275
|
+
expected: first.expected,
|
|
276
|
+
evaluatedDomains: [...evaluated],
|
|
277
|
+
incompleteDomains: [...incomplete],
|
|
278
|
+
actions: [...actions.values()],
|
|
279
|
+
diagnostics: [...diagnostics],
|
|
280
|
+
});
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
function actionDefaults(input: Partial<MigrationAction>): MigrationAction {
|
|
284
|
+
return {
|
|
285
|
+
id: input.id ?? "migration-action-unknown",
|
|
286
|
+
code: input.code ?? "migration_action",
|
|
287
|
+
category: input.category ?? "quality",
|
|
288
|
+
state: input.state ?? "ready",
|
|
289
|
+
safety: input.safety ?? "review",
|
|
290
|
+
invocation: input.invocation ?? {
|
|
291
|
+
kind: "review",
|
|
292
|
+
instruction: "Review this migration action and choose a disposition.",
|
|
293
|
+
},
|
|
294
|
+
affectedEntityIds: uniqueSorted(input.affectedEntityIds),
|
|
295
|
+
affectedFiles: uniqueSorted(input.affectedFiles),
|
|
296
|
+
dependsOn: uniqueSorted(input.dependsOn),
|
|
297
|
+
preconditions: input.preconditions ?? [],
|
|
298
|
+
postconditions: input.postconditions ?? [],
|
|
299
|
+
evidence: input.evidence ?? {},
|
|
300
|
+
autoApplicable: input.autoApplicable ?? false,
|
|
301
|
+
dispositionRequired: input.dispositionRequired ?? false,
|
|
302
|
+
allowedDispositions: input.allowedDispositions ?? [
|
|
303
|
+
"fixed",
|
|
304
|
+
"accepted",
|
|
305
|
+
"deferred",
|
|
306
|
+
],
|
|
307
|
+
};
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
export function migrationAction(
|
|
311
|
+
input: Partial<MigrationAction> & Pick<MigrationAction, "id" | "code">,
|
|
312
|
+
): MigrationAction {
|
|
313
|
+
return actionDefaults(input);
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
export function buildActionsFromCheck(input: {
|
|
317
|
+
violations?: readonly Readonly<Record<string, unknown>>[];
|
|
318
|
+
qualityDiagnostics?: readonly Readonly<Record<string, unknown>>[];
|
|
319
|
+
}): MigrationAction[] {
|
|
320
|
+
const actions: MigrationAction[] = [];
|
|
321
|
+
for (const [index, violation] of (input.violations ?? []).entries()) {
|
|
322
|
+
const rule = typeof violation.rule === "string" ? violation.rule : "check";
|
|
323
|
+
const entityId =
|
|
324
|
+
typeof violation.entityId === "string" ? violation.entityId : "";
|
|
325
|
+
const suggestion =
|
|
326
|
+
typeof violation.suggestion === "string"
|
|
327
|
+
? violation.suggestion
|
|
328
|
+
: typeof violation.description === "string"
|
|
329
|
+
? violation.description
|
|
330
|
+
: "Review the blocking validation violation.";
|
|
331
|
+
actions.push(
|
|
332
|
+
migrationAction({
|
|
333
|
+
id: `check-${rule}-${entityId || "workspace"}-${index + 1}`,
|
|
334
|
+
code: `check_${rule}`,
|
|
335
|
+
category: "quality",
|
|
336
|
+
safety: "review",
|
|
337
|
+
invocation: { kind: "review", instruction: suggestion },
|
|
338
|
+
affectedEntityIds: entityId ? [entityId] : [],
|
|
339
|
+
evidence: { violation },
|
|
340
|
+
dispositionRequired: false,
|
|
341
|
+
}),
|
|
342
|
+
);
|
|
343
|
+
}
|
|
344
|
+
for (const [index, diagnostic] of (
|
|
345
|
+
input.qualityDiagnostics ?? []
|
|
346
|
+
).entries()) {
|
|
347
|
+
const id = typeof diagnostic.id === "string" ? diagnostic.id : "quality";
|
|
348
|
+
const entityId =
|
|
349
|
+
typeof diagnostic.entityId === "string" ? diagnostic.entityId : "";
|
|
350
|
+
const suggestion =
|
|
351
|
+
typeof diagnostic.suggestion === "string"
|
|
352
|
+
? diagnostic.suggestion
|
|
353
|
+
: "Review this quality diagnostic.";
|
|
354
|
+
const blocking = diagnostic.blocking === true;
|
|
355
|
+
actions.push(
|
|
356
|
+
migrationAction({
|
|
357
|
+
id: `diagnostic-${id}-${entityId || "workspace"}-${index + 1}`,
|
|
358
|
+
code: `quality_${id}`,
|
|
359
|
+
category: "quality",
|
|
360
|
+
safety: blocking ? "review" : "review",
|
|
361
|
+
invocation: { kind: "review", instruction: suggestion },
|
|
362
|
+
affectedEntityIds: entityId ? [entityId] : [],
|
|
363
|
+
affectedFiles: Array.isArray(diagnostic.files)
|
|
364
|
+
? diagnostic.files.filter(
|
|
365
|
+
(value): value is string => typeof value === "string",
|
|
366
|
+
)
|
|
367
|
+
: [],
|
|
368
|
+
evidence: { diagnostic },
|
|
369
|
+
dispositionRequired: true,
|
|
370
|
+
}),
|
|
371
|
+
);
|
|
372
|
+
}
|
|
373
|
+
return actions;
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
export function buildActionsFromCoverage(input: {
|
|
377
|
+
repairPlan?: Readonly<Record<string, unknown>>;
|
|
378
|
+
symbolRepairPlan?: Readonly<Record<string, unknown>>;
|
|
379
|
+
}): MigrationAction[] {
|
|
380
|
+
const actions: MigrationAction[] = [];
|
|
381
|
+
const batches = Array.isArray(input.repairPlan?.batches)
|
|
382
|
+
? input.repairPlan.batches.filter(isRecord)
|
|
383
|
+
: [];
|
|
384
|
+
for (const batch of batches) {
|
|
385
|
+
const id = typeof batch.id === "string" ? batch.id : "repair-batch";
|
|
386
|
+
const phase = typeof batch.phase === "string" ? batch.phase : "review";
|
|
387
|
+
const req =
|
|
388
|
+
typeof batch.requirementId === "string" ? batch.requirementId : "";
|
|
389
|
+
const ready = batch.state === "ready";
|
|
390
|
+
const automatic = phase === "source_coordinates";
|
|
391
|
+
actions.push(
|
|
392
|
+
migrationAction({
|
|
393
|
+
id: `coverage-${id}`,
|
|
394
|
+
code: `coverage_${phase}`,
|
|
395
|
+
category:
|
|
396
|
+
phase === "verification_evidence" ? "verification" : "semantic",
|
|
397
|
+
state: ready ? "ready" : "blocked",
|
|
398
|
+
safety: automatic
|
|
399
|
+
? "automatic"
|
|
400
|
+
: phase === "verification_evidence"
|
|
401
|
+
? "execution"
|
|
402
|
+
: "review",
|
|
403
|
+
invocation: automatic
|
|
404
|
+
? {
|
|
405
|
+
kind: "cli",
|
|
406
|
+
command_argv: ["kibi", "sync", "--refresh-symbol-coordinates"],
|
|
407
|
+
}
|
|
408
|
+
: {
|
|
409
|
+
kind: "review",
|
|
410
|
+
instruction:
|
|
411
|
+
typeof batch.objective === "string"
|
|
412
|
+
? batch.objective
|
|
413
|
+
: "Apply the dependency-ordered coverage repair batch.",
|
|
414
|
+
},
|
|
415
|
+
affectedEntityIds: req ? [req] : [],
|
|
416
|
+
dependsOn: Array.isArray(batch.dependsOn)
|
|
417
|
+
? batch.dependsOn
|
|
418
|
+
.filter((value): value is string => typeof value === "string")
|
|
419
|
+
.map((value) => `coverage-${value}`)
|
|
420
|
+
: [],
|
|
421
|
+
evidence: { batch },
|
|
422
|
+
autoApplicable: automatic && ready,
|
|
423
|
+
dispositionRequired: !automatic,
|
|
424
|
+
}),
|
|
425
|
+
);
|
|
426
|
+
}
|
|
427
|
+
const repairs = Array.isArray(input.symbolRepairPlan?.repairs)
|
|
428
|
+
? input.symbolRepairPlan.repairs.filter(isRecord)
|
|
429
|
+
: [];
|
|
430
|
+
for (const repair of repairs) {
|
|
431
|
+
const symbolId =
|
|
432
|
+
typeof repair.symbolId === "string" ? repair.symbolId : "symbol";
|
|
433
|
+
const action = typeof repair.action === "string" ? repair.action : "review";
|
|
434
|
+
const automatic = action === "refresh_coordinates";
|
|
435
|
+
actions.push(
|
|
436
|
+
migrationAction({
|
|
437
|
+
id: `symbol-${action}-${symbolId}`,
|
|
438
|
+
code: `symbol_${action}`,
|
|
439
|
+
category: "symbol",
|
|
440
|
+
safety: automatic ? "automatic" : "review",
|
|
441
|
+
invocation: automatic
|
|
442
|
+
? {
|
|
443
|
+
kind: "cli",
|
|
444
|
+
command_argv: ["kibi", "sync", "--refresh-symbol-coordinates"],
|
|
445
|
+
}
|
|
446
|
+
: {
|
|
447
|
+
kind: "review",
|
|
448
|
+
instruction: `Review ${action} for ${symbolId} using current extraction and Git evidence.`,
|
|
449
|
+
},
|
|
450
|
+
affectedEntityIds: [symbolId],
|
|
451
|
+
evidence: { repair },
|
|
452
|
+
autoApplicable: automatic,
|
|
453
|
+
dispositionRequired: !automatic,
|
|
454
|
+
}),
|
|
455
|
+
);
|
|
456
|
+
}
|
|
457
|
+
return actions;
|
|
458
|
+
}
|
|
459
|
+
|
|
460
|
+
export type MigrationConfigStatus = Readonly<{
|
|
461
|
+
status: "missing" | "invalid" | "older" | "current" | "newer";
|
|
462
|
+
currentVersion: number | null;
|
|
463
|
+
latestVersion: number;
|
|
464
|
+
needsMigration: boolean;
|
|
465
|
+
warning: string | null;
|
|
466
|
+
configHash: string | null;
|
|
467
|
+
}>;
|
|
468
|
+
|
|
469
|
+
export function readMigrationConfigStatus(
|
|
470
|
+
workspaceRoot: string,
|
|
471
|
+
): MigrationConfigStatus {
|
|
472
|
+
const status = readKbManifestStatus(workspaceRoot);
|
|
473
|
+
if (status.state === "ok") {
|
|
474
|
+
return {
|
|
475
|
+
status: getSchemaVersionStatus({
|
|
476
|
+
schemaVersion: status.manifest.schemaVersion,
|
|
477
|
+
}).status,
|
|
478
|
+
currentVersion: status.manifest.schemaVersion,
|
|
479
|
+
latestVersion: getSchemaVersionStatus({
|
|
480
|
+
schemaVersion: status.manifest.schemaVersion,
|
|
481
|
+
}).latestVersion,
|
|
482
|
+
needsMigration: getSchemaVersionStatus({
|
|
483
|
+
schemaVersion: status.manifest.schemaVersion,
|
|
484
|
+
}).needsMigration,
|
|
485
|
+
warning: null,
|
|
486
|
+
configHash: status.manifestHash,
|
|
487
|
+
};
|
|
488
|
+
}
|
|
489
|
+
const legacySchemaVersion = readLegacySchemaVersion(workspaceRoot);
|
|
490
|
+
const schemaStatus = getSchemaVersionStatus(
|
|
491
|
+
legacySchemaVersion === null
|
|
492
|
+
? undefined
|
|
493
|
+
: { schemaVersion: legacySchemaVersion },
|
|
494
|
+
);
|
|
495
|
+
return {
|
|
496
|
+
...schemaStatus,
|
|
497
|
+
currentVersion: normalizeSchemaVersion(legacySchemaVersion),
|
|
498
|
+
configHash: null,
|
|
499
|
+
warning: status.warning,
|
|
500
|
+
};
|
|
501
|
+
}
|
|
502
|
+
|
|
503
|
+
/**
|
|
504
|
+
* Best-effort recognition of a legacy `.kb/config.json` schemaVersion for
|
|
505
|
+
* repositories that have not yet run the storage migration. Malformed
|
|
506
|
+
* documents return null so status reports demand repair rather than
|
|
507
|
+
* silently treating the KB as uninitialized.
|
|
508
|
+
*/
|
|
509
|
+
function readLegacySchemaVersion(
|
|
510
|
+
workspaceRoot: string,
|
|
511
|
+
): number | string | null {
|
|
512
|
+
const legacyPath = path.join(workspaceRoot, ".kb", "config.json");
|
|
513
|
+
if (!existsSync(legacyPath)) return null;
|
|
514
|
+
try {
|
|
515
|
+
const parsed = JSON.parse(readFileSync(legacyPath, "utf8")) as {
|
|
516
|
+
schemaVersion?: number | string;
|
|
517
|
+
};
|
|
518
|
+
return parsed.schemaVersion ?? null;
|
|
519
|
+
} catch {
|
|
520
|
+
return "";
|
|
521
|
+
}
|
|
522
|
+
}
|
|
523
|
+
|
|
524
|
+
// implements REQ-agent-guided-migration-orchestration
|
|
525
|
+
export function buildActionsFromStatus(input: {
|
|
526
|
+
workspaceRoot: string;
|
|
527
|
+
branchAttachment?: Readonly<Record<string, unknown>>;
|
|
528
|
+
branchStore?: Readonly<Record<string, unknown>>;
|
|
529
|
+
staleReasons?: readonly Readonly<Record<string, unknown>>[];
|
|
530
|
+
verificationSnapshotAvailable?: boolean;
|
|
531
|
+
verificationSnapshotDirty?: boolean;
|
|
532
|
+
kbSnapshotId?: string | null;
|
|
533
|
+
workspaceSnapshot?: string | null;
|
|
534
|
+
configStatus?: MigrationConfigStatus;
|
|
535
|
+
}): MigrationPlan {
|
|
536
|
+
const actions: MigrationAction[] = [];
|
|
537
|
+
const attachment = input.branchAttachment;
|
|
538
|
+
const store = input.branchStore;
|
|
539
|
+
const configStatus =
|
|
540
|
+
input.configStatus ?? readMigrationConfigStatus(input.workspaceRoot);
|
|
541
|
+
const branch =
|
|
542
|
+
typeof attachment?.gitBranch === "string" ? attachment.gitBranch : null;
|
|
543
|
+
const kbBranch =
|
|
544
|
+
typeof attachment?.kbBranch === "string" ? attachment.kbBranch : null;
|
|
545
|
+
|
|
546
|
+
if (attachment?.migrationRequired === true) {
|
|
547
|
+
const legacy =
|
|
548
|
+
attachment.kind === "legacy_compat" &&
|
|
549
|
+
typeof branch === "string" &&
|
|
550
|
+
typeof kbBranch === "string";
|
|
551
|
+
actions.push(
|
|
552
|
+
migrationAction({
|
|
553
|
+
id: "branch-legacy-attachment",
|
|
554
|
+
code: legacy ? "legacy_branch_storage" : "ambiguous_branch_attachment",
|
|
555
|
+
category: "branch",
|
|
556
|
+
state: legacy ? "ready" : "blocked",
|
|
557
|
+
safety: legacy ? "automatic" : "operator",
|
|
558
|
+
invocation: legacy
|
|
559
|
+
? {
|
|
560
|
+
kind: "cli",
|
|
561
|
+
command_argv: [
|
|
562
|
+
"kibi",
|
|
563
|
+
"branch",
|
|
564
|
+
"migrate",
|
|
565
|
+
"--from",
|
|
566
|
+
kbBranch as string,
|
|
567
|
+
"--to",
|
|
568
|
+
branch as string,
|
|
569
|
+
"--apply",
|
|
570
|
+
],
|
|
571
|
+
}
|
|
572
|
+
: {
|
|
573
|
+
kind: "review",
|
|
574
|
+
instruction:
|
|
575
|
+
"Resolve branch and KB provenance explicitly; Kibi will not guess or rename Git branches.",
|
|
576
|
+
},
|
|
577
|
+
affectedFiles: [
|
|
578
|
+
typeof attachment.storePath === "string"
|
|
579
|
+
? attachment.storePath
|
|
580
|
+
: ".kb/branches",
|
|
581
|
+
],
|
|
582
|
+
evidence: { attachment },
|
|
583
|
+
autoApplicable: legacy,
|
|
584
|
+
dispositionRequired: !legacy,
|
|
585
|
+
}),
|
|
586
|
+
);
|
|
587
|
+
}
|
|
588
|
+
|
|
589
|
+
const storeState = typeof store?.state === "string" ? store.state : null;
|
|
590
|
+
const legacyStorageMigrationRequired = legacyConfigExists(
|
|
591
|
+
input.workspaceRoot,
|
|
592
|
+
);
|
|
593
|
+
if (storeState === "missing") {
|
|
594
|
+
actions.push(
|
|
595
|
+
migrationAction({
|
|
596
|
+
id: "branch-store-ensure",
|
|
597
|
+
code: "missing_exact_branch_store",
|
|
598
|
+
category: "storage",
|
|
599
|
+
safety: "automatic",
|
|
600
|
+
invocation: { kind: "cli", command_argv: ["kibi", "branch", "ensure"] },
|
|
601
|
+
affectedFiles: [
|
|
602
|
+
typeof store?.path === "string" ? store.path : ".kb/branches",
|
|
603
|
+
],
|
|
604
|
+
evidence: { store },
|
|
605
|
+
autoApplicable: true,
|
|
606
|
+
}),
|
|
607
|
+
);
|
|
608
|
+
} else if (storeState === "incomplete" || storeState === "unreadable") {
|
|
609
|
+
actions.push(
|
|
610
|
+
migrationAction({
|
|
611
|
+
id: "branch-store-recover",
|
|
612
|
+
code: "damaged_exact_branch_store",
|
|
613
|
+
category: "storage",
|
|
614
|
+
safety: "automatic",
|
|
615
|
+
invocation: {
|
|
616
|
+
kind: "cli",
|
|
617
|
+
command_argv: ["kibi", "branch", "recover", "--apply"],
|
|
618
|
+
},
|
|
619
|
+
affectedFiles: [
|
|
620
|
+
typeof store?.path === "string" ? store.path : ".kb/branches",
|
|
621
|
+
],
|
|
622
|
+
evidence: { store, backupRequired: true },
|
|
623
|
+
autoApplicable: true,
|
|
624
|
+
}),
|
|
625
|
+
);
|
|
626
|
+
}
|
|
627
|
+
|
|
628
|
+
if (configStatus.needsMigration || legacyStorageMigrationRequired) {
|
|
629
|
+
actions.push(
|
|
630
|
+
migrationAction({
|
|
631
|
+
id: "schema-config-upgrade",
|
|
632
|
+
code:
|
|
633
|
+
configStatus.status === "invalid"
|
|
634
|
+
? "invalid_schema_version"
|
|
635
|
+
: legacyStorageMigrationRequired
|
|
636
|
+
? "legacy_storage_migration"
|
|
637
|
+
: "schema_version_upgrade",
|
|
638
|
+
category: "schema",
|
|
639
|
+
state: configStatus.status === "newer" ? "blocked" : "ready",
|
|
640
|
+
safety: configStatus.status === "newer" ? "operator" : "automatic",
|
|
641
|
+
invocation: { kind: "cli", command_argv: ["kibi", "migrate", "--yes"] },
|
|
642
|
+
affectedFiles: [
|
|
643
|
+
".kb/manifest.json",
|
|
644
|
+
".kb/migrations",
|
|
645
|
+
".kb/config.json",
|
|
646
|
+
],
|
|
647
|
+
evidence: { configStatus },
|
|
648
|
+
dependsOn: storeState === "missing" ? ["branch-store-ensure"] : [],
|
|
649
|
+
autoApplicable: configStatus.status !== "newer",
|
|
650
|
+
}),
|
|
651
|
+
);
|
|
652
|
+
}
|
|
653
|
+
|
|
654
|
+
for (const reason of input.staleReasons ?? []) {
|
|
655
|
+
const code = typeof reason.code === "string" ? reason.code : "stale_source";
|
|
656
|
+
const file = typeof reason.path === "string" ? reason.path : "";
|
|
657
|
+
actions.push(
|
|
658
|
+
migrationAction({
|
|
659
|
+
id: `freshness-${code}-${file}`,
|
|
660
|
+
code,
|
|
661
|
+
category: "freshness",
|
|
662
|
+
safety: "review",
|
|
663
|
+
invocation: {
|
|
664
|
+
kind: "review",
|
|
665
|
+
instruction:
|
|
666
|
+
typeof reason.remediation === "string"
|
|
667
|
+
? reason.remediation
|
|
668
|
+
: "Refresh or reconcile the stale source, then run kibi sync and read back status.",
|
|
669
|
+
},
|
|
670
|
+
affectedFiles: file ? [file] : [],
|
|
671
|
+
evidence: { reason },
|
|
672
|
+
dispositionRequired: true,
|
|
673
|
+
}),
|
|
674
|
+
);
|
|
675
|
+
}
|
|
676
|
+
if (input.verificationSnapshotAvailable === false) {
|
|
677
|
+
actions.push(
|
|
678
|
+
migrationAction({
|
|
679
|
+
id: "verification-snapshot-unavailable",
|
|
680
|
+
code: "verification_snapshot_unavailable",
|
|
681
|
+
category: "verification",
|
|
682
|
+
safety: "operator",
|
|
683
|
+
invocation: {
|
|
684
|
+
kind: "review",
|
|
685
|
+
instruction:
|
|
686
|
+
"Use a runtime that can compute a workspace verification snapshot before claiming proof.",
|
|
687
|
+
},
|
|
688
|
+
evidence: { verificationSnapshotAvailable: false },
|
|
689
|
+
dispositionRequired: true,
|
|
690
|
+
}),
|
|
691
|
+
);
|
|
692
|
+
} else if (input.verificationSnapshotDirty === true) {
|
|
693
|
+
actions.push(
|
|
694
|
+
migrationAction({
|
|
695
|
+
id: "verification-snapshot-dirty",
|
|
696
|
+
code: "verification_snapshot_dirty",
|
|
697
|
+
category: "verification",
|
|
698
|
+
safety: "review",
|
|
699
|
+
invocation: {
|
|
700
|
+
kind: "review",
|
|
701
|
+
instruction:
|
|
702
|
+
"Resolve or intentionally record the listed dirty workspace paths before reusing or creating proof receipts.",
|
|
703
|
+
},
|
|
704
|
+
evidence: { verificationSnapshotDirty: true },
|
|
705
|
+
dispositionRequired: true,
|
|
706
|
+
}),
|
|
707
|
+
);
|
|
708
|
+
}
|
|
709
|
+
|
|
710
|
+
const incompleteDomains = actions.some(
|
|
711
|
+
(action) =>
|
|
712
|
+
action.code === "damaged_exact_branch_store" ||
|
|
713
|
+
action.code === "ambiguous_branch_attachment" ||
|
|
714
|
+
action.code === "missing_exact_branch_store" ||
|
|
715
|
+
action.code === "schema_version_upgrade" ||
|
|
716
|
+
action.code === "invalid_schema_version" ||
|
|
717
|
+
action.code === "legacy_storage_migration",
|
|
718
|
+
)
|
|
719
|
+
? ["kb"]
|
|
720
|
+
: [];
|
|
721
|
+
return buildMigrationPlan({
|
|
722
|
+
expected: {
|
|
723
|
+
branch,
|
|
724
|
+
kbBranch,
|
|
725
|
+
kbSnapshotId: input.kbSnapshotId ?? null,
|
|
726
|
+
workspaceSnapshot: input.workspaceSnapshot ?? null,
|
|
727
|
+
configHash: configStatus.configHash,
|
|
728
|
+
},
|
|
729
|
+
evaluatedDomains: [
|
|
730
|
+
"package",
|
|
731
|
+
"branch",
|
|
732
|
+
"storage",
|
|
733
|
+
"schema",
|
|
734
|
+
"freshness",
|
|
735
|
+
"verification",
|
|
736
|
+
],
|
|
737
|
+
incompleteDomains,
|
|
738
|
+
actions,
|
|
739
|
+
});
|
|
740
|
+
}
|