kibi-cli 2.1.0 → 2.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli-operation-loader.d.ts.map +1 -1
- package/dist/cli-operation-loader.js +3 -0
- package/dist/cli-operation-metadata.d.ts +4 -0
- package/dist/cli-operation-metadata.d.ts.map +1 -1
- package/dist/cli-operation-metadata.js +5 -0
- package/dist/cli-protocol.d.ts.map +1 -1
- package/dist/cli-protocol.js +3 -2
- package/dist/cli-register-reporting.d.ts.map +1 -1
- package/dist/cli-register-reporting.js +4 -0
- package/dist/commands/aggregated-checks.d.ts +7 -0
- package/dist/commands/aggregated-checks.d.ts.map +1 -1
- package/dist/commands/aggregated-checks.js +25 -1
- package/dist/commands/check-diff.d.ts +5 -0
- package/dist/commands/check-diff.d.ts.map +1 -0
- package/dist/commands/check-diff.js +62 -0
- package/dist/commands/check-generated.d.ts.map +1 -1
- package/dist/commands/check-generated.js +41 -18
- package/dist/commands/check.d.ts.map +1 -1
- package/dist/commands/check.js +231 -86
- package/dist/commands/doctor.d.ts.map +1 -1
- package/dist/commands/doctor.js +168 -53
- package/dist/commands/github-init.d.ts +1 -1
- package/dist/commands/github-init.d.ts.map +1 -1
- package/dist/commands/github-init.js +10 -3
- package/dist/commands/init-helpers.d.ts +17 -2
- package/dist/commands/init-helpers.d.ts.map +1 -1
- package/dist/commands/init-helpers.js +123 -23
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +110 -15
- package/dist/commands/prove.d.ts.map +1 -1
- package/dist/commands/prove.js +10 -18
- package/dist/commands/sync/cache.d.ts +20 -1
- package/dist/commands/sync/cache.d.ts.map +1 -1
- package/dist/commands/sync/cache.js +51 -2
- package/dist/commands/sync/discovery.d.ts.map +1 -1
- package/dist/commands/sync/discovery.js +1 -1
- package/dist/commands/sync/manifest.d.ts.map +1 -1
- package/dist/commands/sync/manifest.js +3 -1
- package/dist/commands/sync/persistence.d.ts.map +1 -1
- package/dist/commands/sync/persistence.js +8 -0
- package/dist/commands/sync.d.ts.map +1 -1
- package/dist/commands/sync.js +11 -3
- package/dist/engine.d.ts +41 -1
- package/dist/engine.d.ts.map +1 -1
- package/dist/engine.js +377 -80
- package/dist/extractors/manifest.d.ts.map +1 -1
- package/dist/extractors/manifest.js +66 -28
- package/dist/extractors/markdown.d.ts +2 -0
- package/dist/extractors/markdown.d.ts.map +1 -1
- package/dist/extractors/markdown.js +14 -3
- package/dist/extractors/relationships.d.ts.map +1 -1
- package/dist/extractors/relationships.js +1 -0
- package/dist/extractors/symbols-coordinator.d.ts +7 -0
- package/dist/extractors/symbols-coordinator.d.ts.map +1 -1
- package/dist/extractors/symbols-coordinator.js +75 -39
- package/dist/intent-search.d.ts.map +1 -1
- package/dist/intent-search.js +68 -29
- package/dist/operations/bootstrap/generate.d.ts.map +1 -1
- package/dist/operations/bootstrap/generate.js +4 -3
- package/dist/operations/modeling/model-requirement.d.ts +1 -1
- package/dist/operations/modeling/model-requirement.d.ts.map +1 -1
- package/dist/operations/modeling/model-requirement.js +176 -10
- package/dist/operations/modeling/predicate-applyplan.d.ts.map +1 -1
- package/dist/operations/modeling/predicate-applyplan.js +14 -2
- package/dist/operations/modeling/predicate-inference-1.js +1 -1
- package/dist/operations/modeling/predicate-loader.d.ts.map +1 -1
- package/dist/operations/modeling/predicate-loader.js +24 -0
- package/dist/operations/modeling/predicate-types.d.ts +4 -0
- package/dist/operations/modeling/predicate-types.d.ts.map +1 -1
- package/dist/operations/modeling/predicate-vocabulary.d.ts +54 -0
- package/dist/operations/modeling/predicate-vocabulary.d.ts.map +1 -0
- package/dist/operations/modeling/predicate-vocabulary.js +169 -0
- package/dist/operations/modeling/requirement-types.d.ts +5 -0
- package/dist/operations/modeling/requirement-types.d.ts.map +1 -1
- package/dist/operations/modeling/vocabulary-alignment.d.ts +60 -0
- package/dist/operations/modeling/vocabulary-alignment.d.ts.map +1 -0
- package/dist/operations/modeling/vocabulary-alignment.js +178 -0
- package/dist/operations/mutation/contradictions.d.ts +3 -0
- package/dist/operations/mutation/contradictions.d.ts.map +1 -1
- package/dist/operations/mutation/contradictions.js +29 -0
- package/dist/operations/mutation/delete.d.ts.map +1 -1
- package/dist/operations/mutation/delete.js +33 -1
- package/dist/operations/mutation/predicate-vocabulary-guard.d.ts +8 -0
- package/dist/operations/mutation/predicate-vocabulary-guard.d.ts.map +1 -0
- package/dist/operations/mutation/predicate-vocabulary-guard.js +64 -0
- package/dist/operations/mutation/relationships.d.ts +1 -1
- package/dist/operations/mutation/relationships.d.ts.map +1 -1
- package/dist/operations/mutation/relationships.js +1 -0
- package/dist/operations/mutation/saga.d.ts +5 -0
- package/dist/operations/mutation/saga.d.ts.map +1 -1
- package/dist/operations/mutation/saga.js +10 -0
- package/dist/operations/mutation/serialization.d.ts.map +1 -1
- package/dist/operations/mutation/serialization.js +2 -0
- package/dist/operations/mutation/source-authoring.d.ts +6 -0
- package/dist/operations/mutation/source-authoring.d.ts.map +1 -1
- package/dist/operations/mutation/source-authoring.js +213 -52
- package/dist/operations/mutation/strict-fact.d.ts.map +1 -1
- package/dist/operations/mutation/strict-fact.js +5 -0
- package/dist/operations/mutation/types.d.ts +17 -0
- package/dist/operations/mutation/types.d.ts.map +1 -1
- package/dist/operations/mutation/upsert.d.ts +6 -0
- package/dist/operations/mutation/upsert.d.ts.map +1 -1
- package/dist/operations/mutation/upsert.js +77 -11
- package/dist/operations/mutation/validate-upsert.d.ts.map +1 -1
- package/dist/operations/mutation/validate-upsert.js +24 -1
- package/dist/operations/mutation/validation.d.ts.map +1 -1
- package/dist/operations/mutation/validation.js +16 -3
- package/dist/operations/planning/apply-plan.d.ts.map +1 -1
- package/dist/operations/planning/apply-plan.js +66 -26
- package/dist/operations/planning/compile-intent.d.ts.map +1 -1
- package/dist/operations/planning/compile-intent.js +3 -1
- package/dist/operations/proof/code-scope.d.ts +17 -0
- package/dist/operations/proof/code-scope.d.ts.map +1 -0
- package/dist/operations/proof/code-scope.js +60 -0
- package/dist/operations/proof/ingest-proof.d.ts +4 -2
- package/dist/operations/proof/ingest-proof.d.ts.map +1 -1
- package/dist/operations/proof/ingest-proof.js +208 -74
- package/dist/operations/proof/migrate-legacy-receipts.d.ts.map +1 -1
- package/dist/operations/proof/migrate-legacy-receipts.js +7 -5
- package/dist/operations/proof/prune-receipts.d.ts.map +1 -1
- package/dist/operations/proof/prune-receipts.js +7 -5
- package/dist/operations/semantic-advisor/analysis-receipt.d.ts.map +1 -1
- package/dist/operations/semantic-advisor/analysis-receipt.js +7 -1
- package/dist/operations/semantic-advisor/analyze-prose.d.ts.map +1 -1
- package/dist/operations/semantic-advisor/analyze-prose.js +26 -4
- package/dist/operations/semantic-advisor/clauses.d.ts +1 -0
- package/dist/operations/semantic-advisor/clauses.d.ts.map +1 -1
- package/dist/operations/semantic-advisor/clauses.js +7 -1
- package/dist/performance-trace.d.ts +17 -0
- package/dist/performance-trace.d.ts.map +1 -0
- package/dist/performance-trace.js +134 -0
- package/dist/plugins/approved-source-analyzers.d.ts +13 -0
- package/dist/plugins/approved-source-analyzers.d.ts.map +1 -0
- package/dist/plugins/approved-source-analyzers.generated.d.ts +71 -0
- package/dist/plugins/approved-source-analyzers.generated.d.ts.map +1 -0
- package/dist/plugins/approved-source-analyzers.generated.js +77 -0
- package/dist/plugins/approved-source-analyzers.js +3 -0
- package/dist/plugins/compose-semantic-classifier.d.ts +6 -1
- package/dist/plugins/compose-semantic-classifier.d.ts.map +1 -1
- package/dist/plugins/compose-semantic-classifier.js +8 -3
- package/dist/plugins/compose-vocabulary-alignment.d.ts +23 -0
- package/dist/plugins/compose-vocabulary-alignment.d.ts.map +1 -0
- package/dist/plugins/compose-vocabulary-alignment.js +141 -0
- package/dist/plugins/external-allowlist.d.ts +7 -0
- package/dist/plugins/external-allowlist.d.ts.map +1 -1
- package/dist/plugins/external-allowlist.js +13 -0
- package/dist/plugins/index.d.ts +2 -0
- package/dist/plugins/index.d.ts.map +1 -1
- package/dist/plugins/index.js +4 -0
- package/dist/plugins/maintenance-source-analysis.d.ts +14 -0
- package/dist/plugins/maintenance-source-analysis.d.ts.map +1 -0
- package/dist/plugins/maintenance-source-analysis.js +191 -0
- package/dist/plugins/registry.d.ts +3 -1
- package/dist/plugins/registry.d.ts.map +1 -1
- package/dist/plugins/registry.js +27 -1
- package/dist/plugins/source-analysis-service.d.ts +36 -1
- package/dist/plugins/source-analysis-service.d.ts.map +1 -1
- package/dist/plugins/source-analysis-service.js +184 -27
- package/dist/plugins/source-change-analysis.d.ts +15 -0
- package/dist/plugins/source-change-analysis.d.ts.map +1 -0
- package/dist/plugins/source-change-analysis.js +54 -0
- package/dist/plugins/source-classification.d.ts +41 -0
- package/dist/plugins/source-classification.d.ts.map +1 -0
- package/dist/plugins/source-classification.js +490 -0
- package/dist/prolog/codec.d.ts.map +1 -1
- package/dist/prolog/codec.js +2 -0
- package/dist/prolog/swipl-resolver.d.ts +88 -0
- package/dist/prolog/swipl-resolver.d.ts.map +1 -0
- package/dist/prolog/swipl-resolver.js +446 -0
- package/dist/prolog.d.ts +51 -1
- package/dist/prolog.d.ts.map +1 -1
- package/dist/prolog.js +145 -15
- package/dist/public/diagnostic-usage.d.ts.map +1 -1
- package/dist/public/diagnostic-usage.js +7 -25
- package/dist/public/impact/analyzer.d.ts.map +1 -1
- package/dist/public/impact/analyzer.js +56 -5
- package/dist/public/impact/diagnostics.d.ts.map +1 -1
- package/dist/public/impact/diagnostics.js +3 -1
- package/dist/public/impact/full-kb-quality.d.ts.map +1 -1
- package/dist/public/impact/full-kb-quality.js +4 -12
- package/dist/public/impact/manifest.d.ts.map +1 -1
- package/dist/public/impact/manifest.js +15 -1
- package/dist/public/impact/source-changes.d.ts.map +1 -1
- package/dist/public/impact/source-changes.js +35 -27
- package/dist/public/impact/types.d.ts +2 -0
- package/dist/public/impact/types.d.ts.map +1 -1
- package/dist/public/operations/catalog.d.ts +80 -7
- package/dist/public/operations/catalog.d.ts.map +1 -1
- package/dist/public/operations/catalog.js +2 -0
- package/dist/public/operations/check-executor.d.ts.map +1 -1
- package/dist/public/operations/check-executor.js +10 -2
- package/dist/public/operations/check-helpers.d.ts +6 -0
- package/dist/public/operations/check-helpers.d.ts.map +1 -1
- package/dist/public/operations/check-helpers.js +21 -1
- package/dist/public/operations/contracts.d.ts.map +1 -1
- package/dist/public/operations/contracts.js +325 -8
- package/dist/public/operations/discovery-entities.d.ts +42 -2
- package/dist/public/operations/discovery-entities.d.ts.map +1 -1
- package/dist/public/operations/discovery-entities.js +195 -22
- package/dist/public/operations/discovery-executors.d.ts +1 -0
- package/dist/public/operations/discovery-executors.d.ts.map +1 -1
- package/dist/public/operations/discovery-executors.js +75 -46
- package/dist/public/operations/impact-review-preparation.d.ts +14 -0
- package/dist/public/operations/impact-review-preparation.d.ts.map +1 -0
- package/dist/public/operations/impact-review-preparation.js +379 -0
- package/dist/public/operations/index.d.ts +2 -0
- package/dist/public/operations/index.d.ts.map +1 -1
- package/dist/public/operations/index.js +2 -0
- package/dist/public/operations/migration-plan.d.ts +2 -0
- package/dist/public/operations/migration-plan.d.ts.map +1 -1
- package/dist/public/operations/migration-plan.js +50 -0
- package/dist/public/operations/node-ports.d.ts.map +1 -1
- package/dist/public/operations/node-ports.js +1 -35
- package/dist/public/operations/predicate-schema-conformance.d.ts +41 -0
- package/dist/public/operations/predicate-schema-conformance.d.ts.map +1 -0
- package/dist/public/operations/predicate-schema-conformance.js +242 -0
- package/dist/public/operations/prolog-json.d.ts.map +1 -1
- package/dist/public/operations/prolog-json.js +9 -3
- package/dist/public/operations/proof-receipt-projection.d.ts +5 -0
- package/dist/public/operations/proof-receipt-projection.d.ts.map +1 -0
- package/dist/public/operations/proof-receipt-projection.js +36 -0
- package/dist/public/operations/result-envelope.d.ts +34 -1
- package/dist/public/operations/result-envelope.d.ts.map +1 -1
- package/dist/public/operations/result-envelope.js +78 -2
- package/dist/public/operations/runtime-types.d.ts +1 -1
- package/dist/public/operations/runtime-types.d.ts.map +1 -1
- package/dist/public/operations/specs/check-rules.generated.d.ts +1 -1
- package/dist/public/operations/specs/check-rules.generated.d.ts.map +1 -1
- package/dist/public/operations/specs/check-rules.generated.js +8 -1
- package/dist/public/operations/specs/check.d.ts +1 -1
- package/dist/public/operations/specs/discovery.d.ts +7 -1
- package/dist/public/operations/specs/discovery.d.ts.map +1 -1
- package/dist/public/operations/specs/discovery.js +7 -1
- package/dist/public/operations/specs/impact-review-preparation.d.ts +47 -0
- package/dist/public/operations/specs/impact-review-preparation.d.ts.map +1 -0
- package/dist/public/operations/specs/impact-review-preparation.js +43 -0
- package/dist/public/operations/specs/mutation-schemas.d.ts +27 -4
- package/dist/public/operations/specs/mutation-schemas.d.ts.map +1 -1
- package/dist/public/operations/specs/mutation-schemas.js +21 -3
- package/dist/public/operations/specs/reporting.d.ts +8 -0
- package/dist/public/operations/specs/reporting.d.ts.map +1 -1
- package/dist/public/operations/specs/reporting.js +46 -15
- package/dist/public/operations/specs/upsert.d.ts +28 -5
- package/dist/public/operations/specs/upsert.d.ts.map +1 -1
- package/dist/public/operations/specs/upsert.js +1 -1
- package/dist/public/operations/symbol-repair-plan.d.ts.map +1 -1
- package/dist/public/operations/symbol-repair-plan.js +8 -3
- package/dist/public/operations/types.d.ts +1 -1
- package/dist/public/operations/types.d.ts.map +1 -1
- package/dist/public/schemas/entity.d.ts.map +1 -1
- package/dist/public/schemas/entity.js +22 -0
- package/dist/public/schemas/relationship.d.ts.map +1 -1
- package/dist/public/schemas/relationship.js +1 -0
- package/dist/public/skills/kibi-usage/SKILL.md +7 -3
- package/dist/public/skills/kibi-usage/resources/fact-lanes.md +4 -0
- package/dist/public/skills/kibi-usage/resources/operation-access.md +1 -0
- package/dist/public/skills/kibi-usage/resources/relationship-directions.md +35 -17
- package/dist/public/skills/kibi-usage/resources/source-authoring.md +36 -0
- package/dist/public/skills/kibi-usage/resources/workflows.md +52 -1
- package/dist/public/telemetry-acceptance.d.ts.map +1 -1
- package/dist/public/telemetry-acceptance.js +21 -5
- package/dist/relationships/shards.d.ts +6 -0
- package/dist/relationships/shards.d.ts.map +1 -1
- package/dist/relationships/shards.js +26 -19
- package/dist/schemas/entity.schema.json +32 -0
- package/dist/traceability/analysis-gate.d.ts +39 -0
- package/dist/traceability/analysis-gate.d.ts.map +1 -0
- package/dist/traceability/analysis-gate.js +51 -0
- package/dist/traceability/git-change-snapshot.d.ts +27 -0
- package/dist/traceability/git-change-snapshot.d.ts.map +1 -0
- package/dist/traceability/git-change-snapshot.js +411 -0
- package/dist/traceability/git-staged.d.ts +5 -1
- package/dist/traceability/git-staged.d.ts.map +1 -1
- package/dist/traceability/git-staged.js +16 -11
- package/dist/traceability/impact-evaluator.d.ts +54 -0
- package/dist/traceability/impact-evaluator.d.ts.map +1 -0
- package/dist/traceability/impact-evaluator.js +270 -0
- package/dist/traceability/impact-git-tree.d.ts +12 -0
- package/dist/traceability/impact-git-tree.d.ts.map +1 -0
- package/dist/traceability/impact-git-tree.js +46 -0
- package/dist/traceability/impact-knowledge.d.ts +16 -0
- package/dist/traceability/impact-knowledge.d.ts.map +1 -0
- package/dist/traceability/impact-knowledge.js +165 -0
- package/dist/traceability/impact-policy.d.ts +15 -0
- package/dist/traceability/impact-policy.d.ts.map +1 -0
- package/dist/traceability/impact-policy.js +48 -0
- package/dist/traceability/impact-policy.v1.schema.json +48 -0
- package/dist/traceability/impact-pr-diff.d.ts +5 -0
- package/dist/traceability/impact-pr-diff.d.ts.map +1 -0
- package/dist/traceability/impact-pr-diff.js +83 -0
- package/dist/traceability/impact-record-validation.d.ts +9 -0
- package/dist/traceability/impact-record-validation.d.ts.map +1 -0
- package/dist/traceability/impact-record-validation.js +113 -0
- package/dist/traceability/impact-review.d.ts +148 -0
- package/dist/traceability/impact-review.d.ts.map +1 -0
- package/dist/traceability/impact-review.js +494 -0
- package/dist/traceability/impact-review.schema.json +365 -0
- package/dist/traceability/impact-side-evidence.d.ts +13 -0
- package/dist/traceability/impact-side-evidence.d.ts.map +1 -0
- package/dist/traceability/impact-side-evidence.js +240 -0
- package/dist/traceability/reviewed-coordinate-refresh.d.ts +10 -0
- package/dist/traceability/reviewed-coordinate-refresh.d.ts.map +1 -0
- package/dist/traceability/reviewed-coordinate-refresh.js +49 -0
- package/dist/traceability/snapshot-knowledge.d.ts +4 -0
- package/dist/traceability/snapshot-knowledge.d.ts.map +1 -0
- package/dist/traceability/snapshot-knowledge.js +98 -0
- package/dist/traceability/staged-diagnostics.d.ts +1 -1
- package/dist/traceability/staged-diagnostics.d.ts.map +1 -1
- package/dist/traceability/staged-entity-id-style.d.ts +12 -0
- package/dist/traceability/staged-entity-id-style.d.ts.map +1 -0
- package/dist/traceability/staged-entity-id-style.js +68 -0
- package/dist/traceability/staged-file-coverage.d.ts +23 -0
- package/dist/traceability/staged-file-coverage.d.ts.map +1 -1
- package/dist/traceability/staged-impact-contract.d.ts.map +1 -1
- package/dist/traceability/staged-impact-contract.js +2 -16
- package/dist/traceability/staged-symbols-manifest.d.ts +4 -0
- package/dist/traceability/staged-symbols-manifest.d.ts.map +1 -1
- package/dist/traceability/staged-symbols-manifest.js +17 -6
- package/dist/traceability/symbol-extract.d.ts +3 -5
- package/dist/traceability/symbol-extract.d.ts.map +1 -1
- package/dist/traceability/symbol-extract.js +49 -34
- package/dist/traceability/temp-kb.d.ts +1 -1
- package/dist/traceability/temp-kb.d.ts.map +1 -1
- package/dist/traceability/temp-kb.js +57 -13
- package/dist/traceability/trusted-pr-event.d.ts +13 -0
- package/dist/traceability/trusted-pr-event.d.ts.map +1 -0
- package/dist/traceability/trusted-pr-event.js +105 -0
- package/dist/traceability/validate.js +1 -1
- package/dist/types/entities.d.ts +2 -0
- package/dist/types/entities.d.ts.map +1 -1
- package/dist/types/relationships.d.ts +1 -1
- package/dist/types/relationships.d.ts.map +1 -1
- package/dist/utils/canonical-path.d.ts +3 -0
- package/dist/utils/canonical-path.d.ts.map +1 -0
- package/dist/utils/canonical-path.js +33 -0
- package/dist/utils/entity-id-style.d.ts +27 -0
- package/dist/utils/entity-id-style.d.ts.map +1 -0
- package/dist/utils/entity-id-style.js +81 -0
- package/dist/utils/git-repository-context.d.ts +50 -0
- package/dist/utils/git-repository-context.d.ts.map +1 -0
- package/dist/utils/git-repository-context.js +259 -0
- package/dist/utils/rule-registry.d.ts +5 -0
- package/dist/utils/rule-registry.d.ts.map +1 -1
- package/dist/utils/rule-registry.generated.d.ts +37 -0
- package/dist/utils/rule-registry.generated.d.ts.map +1 -1
- package/dist/utils/rule-registry.generated.js +44 -0
- package/dist/utils/strict-modeling.d.ts +7 -0
- package/dist/utils/strict-modeling.d.ts.map +1 -1
- package/dist/utils/strict-modeling.js +11 -0
- package/package.json +14 -5
- package/schema/entities.pl +60 -1
- package/schema/relationships.pl +17 -4
- package/schema/validation.pl +118 -20
- package/src/public/diagnostic-usage.ts +16 -24
- package/src/public/impact/analyzer.ts +88 -5
- package/src/public/impact/diagnostics.ts +7 -5
- package/src/public/impact/full-kb-quality.ts +4 -16
- package/src/public/impact/manifest.ts +14 -1
- package/src/public/impact/source-changes.ts +39 -34
- package/src/public/impact/types.ts +5 -0
- package/src/public/operations/catalog.ts +2 -0
- package/src/public/operations/check-executor.ts +12 -1
- package/src/public/operations/check-helpers.ts +27 -1
- package/src/public/operations/contracts.ts +404 -9
- package/src/public/operations/discovery-entities.ts +292 -23
- package/src/public/operations/discovery-executors.ts +91 -55
- package/src/public/operations/impact-review-preparation.ts +548 -0
- package/src/public/operations/index.ts +2 -0
- package/src/public/operations/migration-plan.ts +57 -0
- package/src/public/operations/node-ports.ts +1 -39
- package/src/public/operations/predicate-schema-conformance.ts +362 -0
- package/src/public/operations/prolog-json.ts +9 -3
- package/src/public/operations/proof-receipt-projection.ts +39 -0
- package/src/public/operations/result-envelope.ts +114 -2
- package/src/public/operations/runtime-types.ts +1 -1
- package/src/public/operations/specs/check-rules.generated.ts +8 -1
- package/src/public/operations/specs/discovery.ts +8 -1
- package/src/public/operations/specs/impact-review-preparation.ts +46 -0
- package/src/public/operations/specs/mutation-schemas.ts +23 -3
- package/src/public/operations/specs/reporting.ts +69 -22
- package/src/public/operations/specs/upsert.ts +1 -1
- package/src/public/operations/symbol-repair-plan.ts +13 -3
- package/src/public/operations/types.ts +1 -0
- package/src/public/schemas/entity.ts +22 -0
- package/src/public/schemas/relationship.ts +1 -0
- package/src/public/skills/kibi-usage/SKILL.md +7 -3
- package/src/public/skills/kibi-usage/resources/fact-lanes.md +4 -0
- package/src/public/skills/kibi-usage/resources/operation-access.md +1 -0
- package/src/public/skills/kibi-usage/resources/relationship-directions.md +35 -17
- package/src/public/skills/kibi-usage/resources/source-authoring.md +36 -0
- package/src/public/skills/kibi-usage/resources/workflows.md +52 -1
- package/src/public/telemetry-acceptance.ts +37 -6
- package/src/schemas/entity.schema.json +32 -0
- package/src/schemas/relationship.schema.json +1 -0
- package/src/traceability/impact-policy.v1.schema.json +48 -0
- package/src/traceability/impact-review.schema.json +365 -0
- package/templates/github/kibi-badge.yml +0 -4
- package/templates/github/kibi-report.yml +0 -4
package/dist/commands/doctor.js
CHANGED
|
@@ -22,8 +22,11 @@ import * as path from "node:path";
|
|
|
22
22
|
import { fileURLToPath } from "node:url";
|
|
23
23
|
import { bootstrapKibiEnvironment, secretSourceFromBootstrap, } from "../env/bootstrap.js";
|
|
24
24
|
import { describeConfiguredCapabilityPlugins, readProjectKibiConfig, } from "../plugins/project-config.js";
|
|
25
|
+
import { SwiplResolutionError, inspectSwiplBundle, probeRequiredLibraries, resolveSwipl, } from "../prolog/swipl-resolver.js";
|
|
25
26
|
import { buildMigrationPlan, migrationAction, } from "../public/operations/migration-plan.js";
|
|
27
|
+
import { resolveGitRepository, } from "../utils/git-repository-context.js";
|
|
26
28
|
import { readKbManifestStatus } from "../utils/kb-manifest.js";
|
|
29
|
+
import { hasManagedHooks, outdatedManagedHooks } from "./init-helpers.js";
|
|
27
30
|
import { planLegacyStorageMigration } from "./legacy-storage-migration.js";
|
|
28
31
|
/**
|
|
29
32
|
* First-party plugin diagnostics known without importing the package.
|
|
@@ -38,6 +41,10 @@ const JEV_DEFAULT_MODEL = "jev-latest";
|
|
|
38
41
|
const JEV_MAX_TIMEOUT_MS = 120_000;
|
|
39
42
|
// implements REQ-003
|
|
40
43
|
export async function doctorCommand(options = {}) {
|
|
44
|
+
// The repository context is per-diagnostic-run state: clearing here keeps
|
|
45
|
+
// repeated in-process invocations honest when core.hooksPath changes
|
|
46
|
+
// between runs, without introducing another ambient cache.
|
|
47
|
+
cachedRepositoryContext = undefined;
|
|
41
48
|
const checks = [
|
|
42
49
|
{
|
|
43
50
|
name: "SWI-Prolog",
|
|
@@ -71,6 +78,10 @@ export async function doctorCommand(options = {}) {
|
|
|
71
78
|
name: "post-rewrite hook",
|
|
72
79
|
check: checkPostRewriteHook,
|
|
73
80
|
},
|
|
81
|
+
{
|
|
82
|
+
name: "Kibi-managed hook sections",
|
|
83
|
+
check: checkManagedHookSections,
|
|
84
|
+
},
|
|
74
85
|
{
|
|
75
86
|
name: "Capability plugins",
|
|
76
87
|
check: checkCapabilityPlugins,
|
|
@@ -309,45 +320,78 @@ function resolveInstalledPackageInfo(name) {
|
|
|
309
320
|
dependencies: undefined,
|
|
310
321
|
};
|
|
311
322
|
}
|
|
323
|
+
const SWIPL_SOURCE_LABELS = {
|
|
324
|
+
env: "KIBI_SWIPL",
|
|
325
|
+
bundled: "the bundled build",
|
|
326
|
+
path: "PATH",
|
|
327
|
+
};
|
|
328
|
+
// implements REQ-prolog-doctor-runtime-report
|
|
312
329
|
function checkSWIProlog() {
|
|
330
|
+
let resolved;
|
|
313
331
|
try {
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
332
|
+
resolved = resolveSwipl();
|
|
333
|
+
}
|
|
334
|
+
catch (error) {
|
|
335
|
+
if (!(error instanceof SwiplResolutionError))
|
|
336
|
+
throw error;
|
|
337
|
+
const [headline = error.message, ...guidance] = error.message.split("\n");
|
|
338
|
+
return {
|
|
339
|
+
passed: false,
|
|
340
|
+
message: headline,
|
|
341
|
+
...(guidance.length === 0 ? {} : { remediation: guidance.join("\n ") }),
|
|
342
|
+
details: {
|
|
343
|
+
code: error.code,
|
|
344
|
+
platform: error.platform,
|
|
345
|
+
...(error.packageName === undefined
|
|
346
|
+
? {}
|
|
347
|
+
: { bundledPackage: error.packageName }),
|
|
348
|
+
},
|
|
349
|
+
};
|
|
350
|
+
}
|
|
351
|
+
const details = {
|
|
352
|
+
source: resolved.source,
|
|
353
|
+
path: resolved.bin,
|
|
354
|
+
version: resolved.version,
|
|
355
|
+
...(resolved.home === undefined ? {} : { home: resolved.home }),
|
|
356
|
+
};
|
|
357
|
+
const summary = `Version ${resolved.version} from ${SWIPL_SOURCE_LABELS[resolved.source]} at ${resolved.bin}`;
|
|
358
|
+
const probe = probeRequiredLibraries(resolved);
|
|
359
|
+
if (probe.kind !== "ok") {
|
|
360
|
+
const remediation = resolved.source === "bundled"
|
|
361
|
+
? "Reinstall the bundled SWI-Prolog package, or set KIBI_SWIPL=system to use swipl from PATH."
|
|
362
|
+
: "Install a full SWI-Prolog 9.0+ distribution that provides these libraries (for example swi-prolog rather than swi-prolog-nox or a minimal build), or point KIBI_SWIPL at one.";
|
|
363
|
+
if (probe.kind === "missing") {
|
|
333
364
|
return {
|
|
334
365
|
passed: false,
|
|
335
|
-
message:
|
|
336
|
-
remediation
|
|
366
|
+
message: `${summary}; cannot load required libraries: ${probe.libraries.join(", ")}`,
|
|
367
|
+
remediation,
|
|
368
|
+
details: { ...details, missingLibraries: probe.libraries },
|
|
337
369
|
};
|
|
338
370
|
}
|
|
339
|
-
return {
|
|
340
|
-
passed: true,
|
|
341
|
-
message: `Version ${versionMatch[0]} installed`,
|
|
342
|
-
};
|
|
343
|
-
}
|
|
344
|
-
catch (error) {
|
|
345
371
|
return {
|
|
346
372
|
passed: false,
|
|
347
|
-
message:
|
|
348
|
-
remediation
|
|
373
|
+
message: `${summary}; the required-library load check could not run (${probe.detail})`,
|
|
374
|
+
remediation,
|
|
375
|
+
details,
|
|
349
376
|
};
|
|
350
377
|
}
|
|
378
|
+
let bundleNote = "";
|
|
379
|
+
if (resolved.source === "path") {
|
|
380
|
+
try {
|
|
381
|
+
const bundle = inspectSwiplBundle();
|
|
382
|
+
if (bundle.state === "missing") {
|
|
383
|
+
bundleNote = `; bundled ${bundle.packageName} is not installed (npm install --save-dev ${bundle.packageName})`;
|
|
384
|
+
}
|
|
385
|
+
}
|
|
386
|
+
catch {
|
|
387
|
+
// The bundle note is advisory; never let it fail the check.
|
|
388
|
+
}
|
|
389
|
+
}
|
|
390
|
+
return {
|
|
391
|
+
passed: true,
|
|
392
|
+
message: `${summary}; required libraries load${bundleNote}`,
|
|
393
|
+
details,
|
|
394
|
+
};
|
|
351
395
|
}
|
|
352
396
|
/**
|
|
353
397
|
* Read-only view of package.json plugin activation.
|
|
@@ -525,15 +569,86 @@ function checkGitRepository() {
|
|
|
525
569
|
};
|
|
526
570
|
}
|
|
527
571
|
}
|
|
572
|
+
// Hook health must be diagnosed against the hooks directory Git actually
|
|
573
|
+
// executes (resolved via git rev-parse --git-path hooks, honoring
|
|
574
|
+
// core.hooksPath and linked worktrees), not against <cwd>/.git/hooks.
|
|
575
|
+
// implements REQ-git-hook-effective-install
|
|
576
|
+
let cachedRepositoryContext;
|
|
577
|
+
function doctorRepositoryContext() {
|
|
578
|
+
const cwd = process.cwd();
|
|
579
|
+
if (cachedRepositoryContext?.cwd !== cwd) {
|
|
580
|
+
const resolution = resolveGitRepository(cwd);
|
|
581
|
+
cachedRepositoryContext = {
|
|
582
|
+
cwd,
|
|
583
|
+
context: resolution.status === "ok" ? resolution.context : null,
|
|
584
|
+
};
|
|
585
|
+
}
|
|
586
|
+
return cachedRepositoryContext.context;
|
|
587
|
+
}
|
|
588
|
+
function effectiveHooksDir() {
|
|
589
|
+
const context = doctorRepositoryContext();
|
|
590
|
+
return (context?.effectiveHooksDir ?? path.join(process.cwd(), ".git", "hooks"));
|
|
591
|
+
}
|
|
592
|
+
function shellQuote(value) {
|
|
593
|
+
return `'${value.replace(/'/g, `'\\''`)}'`;
|
|
594
|
+
}
|
|
595
|
+
function remediationHookPaths(...hooks) {
|
|
596
|
+
const dir = effectiveHooksDir();
|
|
597
|
+
return `Run: chmod +x ${hooks.map((hook) => shellQuote(path.join(dir, hook))).join(" ")}`;
|
|
598
|
+
}
|
|
599
|
+
function hooksPathSuffix() {
|
|
600
|
+
const context = doctorRepositoryContext();
|
|
601
|
+
if (!context?.hooksPathConfig)
|
|
602
|
+
return "";
|
|
603
|
+
const origin = context.hooksPathOrigin
|
|
604
|
+
? ` from ${context.hooksPathOrigin}`
|
|
605
|
+
: "";
|
|
606
|
+
return ` (core.hooksPath=${context.hooksPathConfig}${origin})`;
|
|
607
|
+
}
|
|
608
|
+
/**
|
|
609
|
+
* Kibi-managed hook sections must match what this CLI installs. A section
|
|
610
|
+
* written by an older CLI keeps running while silently lacking newer gates
|
|
611
|
+
* (the pre-commit `check-generated` step, for example), and the other hook
|
|
612
|
+
* checks only confirm that kibi is invoked at all.
|
|
613
|
+
*/
|
|
614
|
+
// implements REQ-cli-doctor
|
|
615
|
+
function checkManagedHookSections() {
|
|
616
|
+
const hooksDir = effectiveHooksDir();
|
|
617
|
+
let outdated;
|
|
618
|
+
try {
|
|
619
|
+
if (!hasManagedHooks(hooksDir)) {
|
|
620
|
+
return { passed: true, message: "Not installed (optional)" };
|
|
621
|
+
}
|
|
622
|
+
outdated = outdatedManagedHooks(hooksDir);
|
|
623
|
+
}
|
|
624
|
+
catch {
|
|
625
|
+
return {
|
|
626
|
+
passed: false,
|
|
627
|
+
message: "Unable to read hook content",
|
|
628
|
+
remediation: "Run: kibi init",
|
|
629
|
+
};
|
|
630
|
+
}
|
|
631
|
+
if (outdated.length > 0) {
|
|
632
|
+
return {
|
|
633
|
+
passed: false,
|
|
634
|
+
message: `Outdated for this Kibi CLI: ${outdated.join(", ")} (installed by a different version; newer gates may be missing)${hooksPathSuffix()}`,
|
|
635
|
+
remediation: "Run: kibi init to refresh the kibi-managed hook sections",
|
|
636
|
+
};
|
|
637
|
+
}
|
|
638
|
+
return { passed: true, message: "Current for this Kibi CLI" };
|
|
639
|
+
}
|
|
528
640
|
function checkGitHooks() {
|
|
529
|
-
const postCheckoutPath = path.join(
|
|
530
|
-
const postMergePath = path.join(
|
|
641
|
+
const postCheckoutPath = path.join(effectiveHooksDir(), "post-checkout");
|
|
642
|
+
const postMergePath = path.join(effectiveHooksDir(), "post-merge");
|
|
643
|
+
const preCommitPath = path.join(effectiveHooksDir(), "pre-commit");
|
|
531
644
|
const postCheckoutExists = existsSync(postCheckoutPath);
|
|
532
645
|
const postMergeExists = existsSync(postMergePath);
|
|
533
|
-
|
|
646
|
+
// An existing pre-commit is hard enforcement; the companions being absent
|
|
647
|
+
// must not downgrade the summary to "optional".
|
|
648
|
+
if (!postCheckoutExists && !postMergeExists && !existsSync(preCommitPath)) {
|
|
534
649
|
return {
|
|
535
650
|
passed: true,
|
|
536
|
-
message:
|
|
651
|
+
message: `Not installed (optional)${hooksPathSuffix()}`,
|
|
537
652
|
};
|
|
538
653
|
}
|
|
539
654
|
if (postCheckoutExists && postMergeExists) {
|
|
@@ -545,13 +660,13 @@ function checkGitHooks() {
|
|
|
545
660
|
if (checkoutExecutable && mergeExecutable) {
|
|
546
661
|
return {
|
|
547
662
|
passed: true,
|
|
548
|
-
message:
|
|
663
|
+
message: `Installed and executable${hooksPathSuffix()}`,
|
|
549
664
|
};
|
|
550
665
|
}
|
|
551
666
|
return {
|
|
552
667
|
passed: false,
|
|
553
|
-
message:
|
|
554
|
-
remediation: "
|
|
668
|
+
message: `Installed but not executable${hooksPathSuffix()}`,
|
|
669
|
+
remediation: remediationHookPaths("post-checkout", "post-merge"),
|
|
555
670
|
};
|
|
556
671
|
}
|
|
557
672
|
catch (error) {
|
|
@@ -563,20 +678,20 @@ function checkGitHooks() {
|
|
|
563
678
|
}
|
|
564
679
|
return {
|
|
565
680
|
passed: false,
|
|
566
|
-
message:
|
|
681
|
+
message: `Partially installed${hooksPathSuffix()}`,
|
|
567
682
|
remediation: "Run: kibi init",
|
|
568
683
|
};
|
|
569
684
|
}
|
|
570
685
|
function checkPreCommitHook() {
|
|
571
|
-
const postCheckoutPath = path.join(
|
|
572
|
-
const postMergePath = path.join(
|
|
573
|
-
const preCommitPath = path.join(
|
|
686
|
+
const postCheckoutPath = path.join(effectiveHooksDir(), "post-checkout");
|
|
687
|
+
const postMergePath = path.join(effectiveHooksDir(), "post-merge");
|
|
688
|
+
const preCommitPath = path.join(effectiveHooksDir(), "pre-commit");
|
|
574
689
|
const postCheckoutExists = existsSync(postCheckoutPath);
|
|
575
690
|
const postMergeExists = existsSync(postMergePath);
|
|
576
|
-
if (!postCheckoutExists && !postMergeExists) {
|
|
691
|
+
if (!postCheckoutExists && !postMergeExists && !existsSync(preCommitPath)) {
|
|
577
692
|
return {
|
|
578
693
|
passed: true,
|
|
579
|
-
message:
|
|
694
|
+
message: `Not installed (optional)${hooksPathSuffix()}`,
|
|
580
695
|
};
|
|
581
696
|
}
|
|
582
697
|
const preCommitExists = existsSync(preCommitPath);
|
|
@@ -620,7 +735,7 @@ function checkPreCommitHook() {
|
|
|
620
735
|
}
|
|
621
736
|
return {
|
|
622
737
|
passed: true,
|
|
623
|
-
message:
|
|
738
|
+
message: `Installed and executable (resolves kibi CLI; uses 'kibi check --staged')${hooksPathSuffix()}`,
|
|
624
739
|
};
|
|
625
740
|
}
|
|
626
741
|
// Warn but pass if using legacy kibi check without --staged
|
|
@@ -632,8 +747,8 @@ function checkPreCommitHook() {
|
|
|
632
747
|
}
|
|
633
748
|
return {
|
|
634
749
|
passed: false,
|
|
635
|
-
message:
|
|
636
|
-
remediation: "
|
|
750
|
+
message: `Installed but not executable${hooksPathSuffix()}`,
|
|
751
|
+
remediation: remediationHookPaths("pre-commit"),
|
|
637
752
|
};
|
|
638
753
|
}
|
|
639
754
|
catch (error) {
|
|
@@ -645,15 +760,15 @@ function checkPreCommitHook() {
|
|
|
645
760
|
}
|
|
646
761
|
}
|
|
647
762
|
function checkPostRewriteHook() {
|
|
648
|
-
const postCheckoutPath = path.join(
|
|
649
|
-
const postMergePath = path.join(
|
|
650
|
-
const postRewritePath = path.join(
|
|
763
|
+
const postCheckoutPath = path.join(effectiveHooksDir(), "post-checkout");
|
|
764
|
+
const postMergePath = path.join(effectiveHooksDir(), "post-merge");
|
|
765
|
+
const postRewritePath = path.join(effectiveHooksDir(), "post-rewrite");
|
|
651
766
|
const postCheckoutExists = existsSync(postCheckoutPath);
|
|
652
767
|
const postMergeExists = existsSync(postMergePath);
|
|
653
|
-
if (!postCheckoutExists && !postMergeExists) {
|
|
768
|
+
if (!postCheckoutExists && !postMergeExists && !existsSync(postRewritePath)) {
|
|
654
769
|
return {
|
|
655
770
|
passed: true,
|
|
656
|
-
message:
|
|
771
|
+
message: `Not installed (optional)${hooksPathSuffix()}`,
|
|
657
772
|
};
|
|
658
773
|
}
|
|
659
774
|
const postRewriteExists = existsSync(postRewritePath);
|
|
@@ -689,13 +804,13 @@ function checkPostRewriteHook() {
|
|
|
689
804
|
}
|
|
690
805
|
return {
|
|
691
806
|
passed: true,
|
|
692
|
-
message:
|
|
807
|
+
message: `Installed and executable${hooksPathSuffix()}`,
|
|
693
808
|
};
|
|
694
809
|
}
|
|
695
810
|
return {
|
|
696
811
|
passed: false,
|
|
697
|
-
message:
|
|
698
|
-
remediation: "
|
|
812
|
+
message: `Installed but not executable${hooksPathSuffix()}`,
|
|
813
|
+
remediation: remediationHookPaths("post-rewrite"),
|
|
699
814
|
};
|
|
700
815
|
}
|
|
701
816
|
catch (error) {
|
|
@@ -2,7 +2,7 @@ export declare const GITHUB_REPORT_WORKFLOW_RELPATH = ".github/workflows/kibi-re
|
|
|
2
2
|
export declare const GITHUB_BADGE_WORKFLOW_RELPATH = ".github/workflows/kibi-badge.yml";
|
|
3
3
|
export declare const GITHUB_PAGES_NAMESPACE = "kibi-report";
|
|
4
4
|
export declare const KIBI_BADGE_ALT = "Kibi requirement health";
|
|
5
|
-
export declare const KIBI_METRIC_DOCS_URL = "https://github.
|
|
5
|
+
export declare const KIBI_METRIC_DOCS_URL = "https://looted.github.io/kibi/guide/github-integration.html#what-the-badge-means";
|
|
6
6
|
export declare const PLACEHOLDER_OWNER = "OWNER";
|
|
7
7
|
export declare const PLACEHOLDER_REPO = "REPOSITORY";
|
|
8
8
|
export type GitHubRepo = Readonly<{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"github-init.d.ts","sourceRoot":"","sources":["../../src/commands/github-init.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"github-init.d.ts","sourceRoot":"","sources":["../../src/commands/github-init.ts"],"names":[],"mappings":"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"}
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
17
17
|
*/
|
|
18
18
|
import { execFileSync } from "node:child_process";
|
|
19
|
-
import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
19
|
+
import { existsSync, mkdirSync, readFileSync, readdirSync, writeFileSync, } from "node:fs";
|
|
20
20
|
import * as path from "node:path";
|
|
21
21
|
import { fileURLToPath } from "node:url";
|
|
22
22
|
const __filename = fileURLToPath(import.meta.url);
|
|
@@ -25,7 +25,7 @@ export const GITHUB_REPORT_WORKFLOW_RELPATH = ".github/workflows/kibi-report.yml
|
|
|
25
25
|
export const GITHUB_BADGE_WORKFLOW_RELPATH = ".github/workflows/kibi-badge.yml";
|
|
26
26
|
export const GITHUB_PAGES_NAMESPACE = "kibi-report";
|
|
27
27
|
export const KIBI_BADGE_ALT = "Kibi requirement health";
|
|
28
|
-
export const KIBI_METRIC_DOCS_URL = "https://github.
|
|
28
|
+
export const KIBI_METRIC_DOCS_URL = "https://looted.github.io/kibi/guide/github-integration.html#what-the-badge-means";
|
|
29
29
|
export const PLACEHOLDER_OWNER = "OWNER";
|
|
30
30
|
export const PLACEHOLDER_REPO = "REPOSITORY";
|
|
31
31
|
const README_CANDIDATES = ["README.md", "readme.md", "Readme.md"];
|
|
@@ -101,9 +101,16 @@ export function hasKibiBadge(content) {
|
|
|
101
101
|
return /\[!\[Kibi requirement health\]/i.test(content);
|
|
102
102
|
}
|
|
103
103
|
export function detectReadmePath(cwd) {
|
|
104
|
+
let entries;
|
|
105
|
+
try {
|
|
106
|
+
entries = new Set(readdirSync(cwd));
|
|
107
|
+
}
|
|
108
|
+
catch {
|
|
109
|
+
return undefined;
|
|
110
|
+
}
|
|
104
111
|
for (const name of README_CANDIDATES) {
|
|
105
112
|
const candidate = path.join(cwd, name);
|
|
106
|
-
if (existsSync(candidate)) {
|
|
113
|
+
if (entries.has(name) && existsSync(candidate)) {
|
|
107
114
|
return candidate;
|
|
108
115
|
}
|
|
109
116
|
}
|
|
@@ -4,6 +4,21 @@ export declare function createManifestFile(kbDir: string): void;
|
|
|
4
4
|
export declare function updateGitIgnore(cwd: string): void;
|
|
5
5
|
export declare function ensureSymbolsManifestFile(cwd: string): void;
|
|
6
6
|
export declare function copySchemaFiles(kbDir: string, schemaSourceDir: string): Promise<void>;
|
|
7
|
-
export
|
|
8
|
-
export declare function
|
|
7
|
+
export type InstallHookResult = "installed" | "updated" | "skipped-foreign" | "skipped-symlink" | "skipped-unsupported";
|
|
8
|
+
export declare function installHook(hookPath: string, content: string): InstallHookResult;
|
|
9
|
+
export interface GitHookInstallResult {
|
|
10
|
+
hook: "pre-commit" | "post-checkout" | "post-merge" | "post-rewrite";
|
|
11
|
+
result: InstallHookResult;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Installed kibi-managed hooks whose managed section differs from what this
|
|
15
|
+
* CLI installs, such as a pre-commit gate written before `check-generated`
|
|
16
|
+
* joined it. User-authored hooks without kibi markers are not reported.
|
|
17
|
+
*/
|
|
18
|
+
export declare function outdatedManagedHooks(hooksDir: string): string[];
|
|
19
|
+
/** Whether any hook in the directory carries a kibi-managed section. */
|
|
20
|
+
export declare function hasManagedHooks(hooksDir: string): boolean;
|
|
21
|
+
export declare function installGitHooks(hooksDir: string, options?: {
|
|
22
|
+
hooksPathOrigin?: string | null;
|
|
23
|
+
}): GitHookInstallResult[];
|
|
9
24
|
//# sourceMappingURL=init-helpers.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init-helpers.d.ts","sourceRoot":"","sources":["../../src/commands/init-helpers.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"init-helpers.d.ts","sourceRoot":"","sources":["../../src/commands/init-helpers.ts"],"names":[],"mappings":"AAyIA,wBAAsB,gBAAgB,CACpC,GAAG,GAAE,MAAsB,GAC1B,OAAO,CAAC,MAAM,CAAC,CASjB;AAED,wBAAgB,0BAA0B,CACxC,KAAK,EAAE,MAAM,EACb,aAAa,EAAE,MAAM,GACpB,IAAI,CAUN;AAED,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAGtD;AAED,wBAAgB,eAAe,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CA6BjD;AAkDD,wBAAgB,yBAAyB,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAU3D;AAED,wBAAsB,eAAe,CACnC,KAAK,EAAE,MAAM,EACb,eAAe,EAAE,MAAM,GACtB,OAAO,CAAC,IAAI,CAAC,CAYf;AASD,MAAM,MAAM,iBAAiB,GACzB,WAAW,GACX,SAAS,GACT,iBAAiB,GACjB,iBAAiB,GACjB,qBAAqB,CAAC;AAoB1B,wBAAgB,WAAW,CACzB,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,MAAM,GACd,iBAAiB,CAyEnB;AAED,MAAM,WAAW,oBAAoB;IACnC,IAAI,EAAE,YAAY,GAAG,eAAe,GAAG,YAAY,GAAG,cAAc,CAAC;IACrE,MAAM,EAAE,iBAAiB,CAAC;CAC3B;AAiBD;;;;GAIG;AAEH,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,EAAE,CAU/D;AAED,wEAAwE;AAExE,wBAAgB,eAAe,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAQzD;AAED,wBAAgB,eAAe,CAC7B,QAAQ,EAAE,MAAM,EAChB,OAAO,GAAE;IAAE,eAAe,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CAAO,GAChD,oBAAoB,EAAE,CA8CxB"}
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
You should have received a copy of the GNU Affero General Public License
|
|
16
16
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
17
17
|
*/
|
|
18
|
-
import { chmodSync, copyFileSync, existsSync, mkdirSync, readFileSync, writeFileSync, } from "node:fs";
|
|
18
|
+
import { chmodSync, copyFileSync, existsSync, lstatSync, mkdirSync, readFileSync, writeFileSync, } from "node:fs";
|
|
19
19
|
import * as path from "node:path";
|
|
20
20
|
import fg from "fast-glob";
|
|
21
21
|
import { getBranchDiagnostic, resolveActiveBranch, } from "../utils/branch-resolver.js";
|
|
@@ -236,41 +236,141 @@ const KIBI_HOOK_END = "# END kibi-managed";
|
|
|
236
236
|
function escapeRegex(s) {
|
|
237
237
|
return s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
238
238
|
}
|
|
239
|
+
function hookIntegrationRecipe(hook) {
|
|
240
|
+
// Recipes must reproduce the exact checks the Kibi template runs for that
|
|
241
|
+
// hook, with failure propagation, or the delegation is weaker than the
|
|
242
|
+
// template it replaces.
|
|
243
|
+
switch (hook) {
|
|
244
|
+
case "pre-commit":
|
|
245
|
+
return "delegate from that hook with 'kibi check-generated --staged --changed-only && kibi check --staged' (both commands must succeed; '&&' propagates the first failure)";
|
|
246
|
+
case "post-checkout":
|
|
247
|
+
return "delegate from that hook to 'kibi sync' on branch checkouts (the template skips file checkouts)";
|
|
248
|
+
case "post-merge":
|
|
249
|
+
return "delegate from that hook to 'kibi sync'";
|
|
250
|
+
case "post-rewrite":
|
|
251
|
+
return "delegate from that hook to 'kibi sync' after rebase/amend rewrites";
|
|
252
|
+
default:
|
|
253
|
+
return "delegate to the matching Kibi template command";
|
|
254
|
+
}
|
|
255
|
+
}
|
|
239
256
|
export function installHook(hookPath, content) {
|
|
240
257
|
// implements REQ-008
|
|
258
|
+
// implements REQ-git-hook-effective-install
|
|
241
259
|
const kibiSection = `${KIBI_HOOK_BEGIN}\n${content}\n${KIBI_HOOK_END}`;
|
|
242
|
-
|
|
260
|
+
let hookStats;
|
|
261
|
+
try {
|
|
262
|
+
hookStats = lstatSync(hookPath);
|
|
263
|
+
}
|
|
264
|
+
catch (error) {
|
|
265
|
+
if (error.code === "ENOENT" ||
|
|
266
|
+
error.code === "ENOTDIR") {
|
|
267
|
+
// Missing hook: create it through the parent directory. Refuse when an
|
|
268
|
+
// ancestor is itself a symlink whose target leaves the resolved path
|
|
269
|
+
// (realpath is checked by the caller's hooks-dir guard).
|
|
270
|
+
writeFileSync(hookPath, `#!/bin/sh\n${kibiSection}\n`, { mode: 0o755 });
|
|
271
|
+
chmodSync(hookPath, 0o755);
|
|
272
|
+
return "installed";
|
|
273
|
+
}
|
|
274
|
+
console.error(`! Unable to inspect ${hookPath}: ${error.message}; leaving it untouched.`);
|
|
275
|
+
return "skipped-unsupported";
|
|
276
|
+
}
|
|
277
|
+
if (hookStats.isSymbolicLink()) {
|
|
278
|
+
// Never follow a symlinked hook: read/write/chmod would modify an
|
|
279
|
+
// arbitrary target outside our guard. Dangling symlinks are treated the
|
|
280
|
+
// same (the intended target must not be auto-created either).
|
|
281
|
+
return "skipped-symlink";
|
|
282
|
+
}
|
|
283
|
+
if (!hookStats.isFile()) {
|
|
284
|
+
return "skipped-unsupported";
|
|
285
|
+
}
|
|
286
|
+
try {
|
|
243
287
|
const existing = readFileSync(hookPath, "utf8");
|
|
244
288
|
if (existing.includes(KIBI_HOOK_BEGIN) &&
|
|
245
289
|
existing.includes(KIBI_HOOK_END)) {
|
|
246
290
|
// Replace only the kibi-managed section, preserving any user-authored content
|
|
247
291
|
const updated = existing.replace(new RegExp(`${escapeRegex(KIBI_HOOK_BEGIN)}[\\s\\S]*?${escapeRegex(KIBI_HOOK_END)}`), kibiSection);
|
|
248
292
|
writeFileSync(hookPath, updated, { mode: 0o755 });
|
|
293
|
+
chmodSync(hookPath, 0o755);
|
|
294
|
+
return "updated";
|
|
249
295
|
}
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
else {
|
|
254
|
-
const shebang = existing.startsWith("#!/") ? "" : "#!/bin/sh\n";
|
|
255
|
-
writeFileSync(hookPath, `${shebang}${existing.trimEnd()}\n${kibiSection}\n`, { mode: 0o755 });
|
|
296
|
+
if (existing.trim().length > 0) {
|
|
297
|
+
// A hook we did not write: never overwrite foreign enforcement.
|
|
298
|
+
return "skipped-foreign";
|
|
256
299
|
}
|
|
300
|
+
const shebang = existing.startsWith("#!/") ? "" : "#!/bin/sh\n";
|
|
301
|
+
writeFileSync(hookPath, `${shebang}${existing.trimEnd()}\n${kibiSection}\n`, { mode: 0o755 });
|
|
302
|
+
chmodSync(hookPath, 0o755);
|
|
303
|
+
return "installed";
|
|
257
304
|
}
|
|
258
|
-
|
|
259
|
-
|
|
305
|
+
catch (error) {
|
|
306
|
+
console.error(`! Unable to read ${hookPath}: ${error.message}; leaving it untouched.`);
|
|
307
|
+
return "skipped-unsupported";
|
|
260
308
|
}
|
|
261
|
-
// Explicitly ensure hook is executable
|
|
262
|
-
chmodSync(hookPath, 0o755);
|
|
263
309
|
}
|
|
264
|
-
|
|
265
|
-
|
|
310
|
+
/** Kibi-managed hooks in install order, with the template each one installs. */
|
|
311
|
+
const MANAGED_HOOK_TEMPLATES = [
|
|
312
|
+
["post-checkout", POST_CHECKOUT_HOOK],
|
|
313
|
+
["post-merge", POST_MERGE_HOOK],
|
|
314
|
+
["post-rewrite", POST_REWRITE_HOOK],
|
|
315
|
+
["pre-commit", PRE_COMMIT_HOOK],
|
|
316
|
+
];
|
|
317
|
+
function managedHookBody(template) {
|
|
318
|
+
return template.replace("#!/bin/sh\n", "");
|
|
319
|
+
}
|
|
320
|
+
/**
|
|
321
|
+
* Installed kibi-managed hooks whose managed section differs from what this
|
|
322
|
+
* CLI installs, such as a pre-commit gate written before `check-generated`
|
|
323
|
+
* joined it. User-authored hooks without kibi markers are not reported.
|
|
324
|
+
*/
|
|
325
|
+
// implements REQ-cli-doctor
|
|
326
|
+
export function outdatedManagedHooks(hooksDir) {
|
|
327
|
+
const managed = new RegExp(`${escapeRegex(KIBI_HOOK_BEGIN)}\\n([\\s\\S]*?)\\n${escapeRegex(KIBI_HOOK_END)}`);
|
|
328
|
+
return MANAGED_HOOK_TEMPLATES.filter(([hook, template]) => {
|
|
329
|
+
const hookPath = path.join(hooksDir, hook);
|
|
330
|
+
if (!existsSync(hookPath))
|
|
331
|
+
return false;
|
|
332
|
+
const section = managed.exec(readFileSync(hookPath, "utf8"));
|
|
333
|
+
return section !== null && section[1] !== managedHookBody(template);
|
|
334
|
+
}).map(([hook]) => hook);
|
|
335
|
+
}
|
|
336
|
+
/** Whether any hook in the directory carries a kibi-managed section. */
|
|
337
|
+
// implements REQ-cli-doctor
|
|
338
|
+
export function hasManagedHooks(hooksDir) {
|
|
339
|
+
return MANAGED_HOOK_TEMPLATES.some(([hook]) => {
|
|
340
|
+
const hookPath = path.join(hooksDir, hook);
|
|
341
|
+
return (existsSync(hookPath) &&
|
|
342
|
+
readFileSync(hookPath, "utf8").includes(KIBI_HOOK_BEGIN));
|
|
343
|
+
});
|
|
344
|
+
}
|
|
345
|
+
export function installGitHooks(hooksDir, options = {}) {
|
|
346
|
+
// implements REQ-git-hook-effective-install
|
|
266
347
|
mkdirSync(hooksDir, { recursive: true });
|
|
267
|
-
const
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
348
|
+
const results = MANAGED_HOOK_TEMPLATES.map(([hook, template]) => ({
|
|
349
|
+
hook,
|
|
350
|
+
result: installHook(path.join(hooksDir, hook), managedHookBody(template)),
|
|
351
|
+
}));
|
|
352
|
+
for (const { hook, result } of results) {
|
|
353
|
+
if (result === "skipped-foreign") {
|
|
354
|
+
console.log(`! ${hook}: existing non-Kibi hook left untouched; Kibi enforcement is NOT installed for this hook. To integrate: ${hookIntegrationRecipe(hook)}.`);
|
|
355
|
+
}
|
|
356
|
+
else if (result === "skipped-symlink") {
|
|
357
|
+
console.log(`! ${hook}: hook is a symlink; Kibi never edits symlink targets. Manage the target manually (${hookIntegrationRecipe(hook)}).`);
|
|
358
|
+
}
|
|
359
|
+
else if (result === "skipped-unsupported") {
|
|
360
|
+
console.log(`! ${hook}: hook path is not a regular file; left untouched.`);
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
const installedOrUpdated = results.filter((entry) => entry.result === "installed" || entry.result === "updated");
|
|
364
|
+
if (installedOrUpdated.length > 0) {
|
|
365
|
+
console.log(`✓ Installed/updated Kibi git hooks at ${hooksDir} (${installedOrUpdated.map((entry) => entry.hook).join(", ")})`);
|
|
366
|
+
}
|
|
367
|
+
else {
|
|
368
|
+
console.log(`! No Kibi git hooks installed at ${hooksDir} (all hooks were skipped).`);
|
|
369
|
+
}
|
|
370
|
+
if (options.hooksPathOrigin) {
|
|
371
|
+
// Configuration/location reporting stays neutral about what happened:
|
|
372
|
+
// the per-hook lines and the aggregate above carry the install verdict.
|
|
373
|
+
console.log(`! core.hooksPath is configured (${options.hooksPathOrigin}); the effective hooks directory for THIS checkout is ${hooksDir}. Git resolves a relative hooks path separately under every worktree, so coverage of other worktrees is INCOMPLETE/UNVERIFIED: commit a versioned launcher that delegates to kibi, or run 'kibi init' in each checkout. Kibi will not change core.hooksPath.`);
|
|
374
|
+
}
|
|
375
|
+
return results;
|
|
276
376
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../src/commands/init.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../src/commands/init.ts"],"names":[],"mappings":"AAmGA,UAAU,WAAW;IACnB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAoDD,wBAAsB,WAAW,CAC/B,OAAO,EAAE,WAAW,GACnB,OAAO,CAAC;IAAE,QAAQ,EAAE,MAAM,CAAA;CAAE,CAAC,CAwI/B"}
|