kibi-cli 0.14.0 → 0.17.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/bin/kibi +3 -1
- package/dist/cli-command.d.ts +5 -0
- package/dist/cli-command.d.ts.map +1 -0
- package/dist/cli-command.js +9 -0
- package/dist/cli-errors.d.ts +13 -0
- package/dist/cli-errors.d.ts.map +1 -0
- package/dist/cli-errors.js +26 -0
- package/dist/cli-input.d.ts +6 -0
- package/dist/cli-input.d.ts.map +1 -0
- package/dist/cli-input.js +54 -0
- package/dist/cli-json-command.d.ts +14 -0
- package/dist/cli-json-command.d.ts.map +1 -0
- package/dist/cli-json-command.js +96 -0
- package/dist/cli-protocol.d.ts +12 -0
- package/dist/cli-protocol.d.ts.map +1 -0
- package/dist/cli-protocol.js +37 -0
- package/dist/cli-register-foundation.d.ts +3 -0
- package/dist/cli-register-foundation.d.ts.map +1 -0
- package/dist/cli-register-foundation.js +90 -0
- package/dist/cli-register-maintenance.d.ts +3 -0
- package/dist/cli-register-maintenance.d.ts.map +1 -0
- package/dist/cli-register-maintenance.js +36 -0
- package/dist/cli-register-reporting.d.ts +3 -0
- package/dist/cli-register-reporting.d.ts.map +1 -0
- package/dist/cli-register-reporting.js +101 -0
- package/dist/cli-register-skills.d.ts +3 -0
- package/dist/cli-register-skills.d.ts.map +1 -0
- package/dist/cli-register-skills.js +71 -0
- package/dist/cli-validate.d.ts +18 -0
- package/dist/cli-validate.d.ts.map +1 -0
- package/dist/cli-validate.js +45 -0
- package/dist/cli.d.ts +4 -4
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +48 -211
- package/dist/commands/aggregated-checks.d.ts +1 -1
- package/dist/commands/aggregated-checks.d.ts.map +1 -1
- package/dist/commands/aggregated-checks.js +28 -34
- package/dist/commands/check.d.ts +1 -1
- package/dist/commands/check.d.ts.map +1 -1
- package/dist/commands/check.js +53 -95
- package/dist/commands/coverage.d.ts.map +1 -1
- package/dist/commands/coverage.js +12 -17
- package/dist/commands/discovery-shared.d.ts +2 -1
- package/dist/commands/discovery-shared.d.ts.map +1 -1
- package/dist/commands/discovery-shared.js +6 -18
- package/dist/commands/gaps.d.ts.map +1 -1
- package/dist/commands/gaps.js +15 -19
- package/dist/commands/graph.d.ts.map +1 -1
- package/dist/commands/graph.js +15 -21
- package/dist/commands/query.d.ts +7 -7
- package/dist/commands/query.d.ts.map +1 -1
- package/dist/commands/query.js +98 -204
- package/dist/commands/search.d.ts +4 -4
- package/dist/commands/search.d.ts.map +1 -1
- package/dist/commands/search.js +14 -27
- package/dist/commands/status.d.ts +1 -1
- package/dist/commands/status.d.ts.map +1 -1
- package/dist/commands/status.js +6 -7
- package/dist/commands/sync/manifest.d.ts +13 -2
- package/dist/commands/sync/manifest.d.ts.map +1 -1
- package/dist/commands/sync/manifest.js +31 -22
- package/dist/commands/sync/persistence.d.ts.map +1 -1
- package/dist/commands/sync/persistence.js +39 -1
- package/dist/extractors/markdown.d.ts +22 -2
- package/dist/extractors/markdown.d.ts.map +1 -1
- package/dist/extractors/markdown.js +50 -1
- package/dist/extractors/symbols-ts.d.ts.map +1 -1
- package/dist/extractors/symbols-ts.js +11 -1
- package/dist/logic/ir.d.ts +112 -0
- package/dist/logic/ir.d.ts.map +1 -0
- package/dist/logic/ir.js +729 -0
- package/dist/operations/autopilot/activation.d.ts +4 -0
- package/dist/operations/autopilot/activation.d.ts.map +1 -0
- package/dist/operations/autopilot/activation.js +130 -0
- package/dist/operations/autopilot/candidate-helpers.d.ts +13 -0
- package/dist/operations/autopilot/candidate-helpers.d.ts.map +1 -0
- package/dist/operations/autopilot/candidate-helpers.js +55 -0
- package/dist/operations/autopilot/candidates.d.ts +4 -0
- package/dist/operations/autopilot/candidates.d.ts.map +1 -0
- package/dist/operations/autopilot/candidates.js +114 -0
- package/dist/operations/autopilot/discovery-evidence.d.ts +10 -0
- package/dist/operations/autopilot/discovery-evidence.d.ts.map +1 -0
- package/dist/operations/autopilot/discovery-evidence.js +158 -0
- package/dist/operations/autopilot/discovery.d.ts +4 -0
- package/dist/operations/autopilot/discovery.d.ts.map +1 -0
- package/dist/operations/autopilot/discovery.js +100 -0
- package/dist/operations/autopilot/generate.d.ts +8 -0
- package/dist/operations/autopilot/generate.d.ts.map +1 -0
- package/dist/operations/autopilot/generate.js +112 -0
- package/dist/operations/autopilot/guidance-actions.d.ts +3 -0
- package/dist/operations/autopilot/guidance-actions.d.ts.map +1 -0
- package/dist/operations/autopilot/guidance-actions.js +79 -0
- package/dist/operations/autopilot/guidance.d.ts +14 -0
- package/dist/operations/autopilot/guidance.d.ts.map +1 -0
- package/dist/operations/autopilot/guidance.js +124 -0
- package/dist/operations/autopilot/markdown-candidates.d.ts +7 -0
- package/dist/operations/autopilot/markdown-candidates.d.ts.map +1 -0
- package/dist/operations/autopilot/markdown-candidates.js +134 -0
- package/dist/operations/autopilot/presentation.d.ts +13 -0
- package/dist/operations/autopilot/presentation.d.ts.map +1 -0
- package/dist/operations/autopilot/presentation.js +91 -0
- package/dist/operations/autopilot/requirement-claims.d.ts +3 -0
- package/dist/operations/autopilot/requirement-claims.d.ts.map +1 -0
- package/dist/operations/autopilot/requirement-claims.js +48 -0
- package/dist/operations/autopilot/types.d.ts +117 -0
- package/dist/operations/autopilot/types.d.ts.map +1 -0
- package/dist/operations/autopilot/types.js +8 -0
- package/dist/operations/modeling/logic-modeling.d.ts +22 -0
- package/dist/operations/modeling/logic-modeling.d.ts.map +1 -0
- package/dist/operations/modeling/logic-modeling.js +111 -0
- package/dist/operations/modeling/model-requirement.d.ts +10 -0
- package/dist/operations/modeling/model-requirement.d.ts.map +1 -0
- package/dist/operations/modeling/model-requirement.js +164 -0
- package/dist/operations/modeling/predicate-applyplan.d.ts +6 -0
- package/dist/operations/modeling/predicate-applyplan.d.ts.map +1 -0
- package/dist/operations/modeling/predicate-applyplan.js +117 -0
- package/dist/operations/modeling/predicate-catalog-1.d.ts +3 -0
- package/dist/operations/modeling/predicate-catalog-1.d.ts.map +1 -0
- package/dist/operations/modeling/predicate-catalog-1.js +200 -0
- package/dist/operations/modeling/predicate-catalog-2.d.ts +3 -0
- package/dist/operations/modeling/predicate-catalog-2.d.ts.map +1 -0
- package/dist/operations/modeling/predicate-catalog-2.js +197 -0
- package/dist/operations/modeling/predicate-catalog-3.d.ts +3 -0
- package/dist/operations/modeling/predicate-catalog-3.d.ts.map +1 -0
- package/dist/operations/modeling/predicate-catalog-3.js +193 -0
- package/dist/operations/modeling/predicate-catalog-4.d.ts +3 -0
- package/dist/operations/modeling/predicate-catalog-4.d.ts.map +1 -0
- package/dist/operations/modeling/predicate-catalog-4.js +149 -0
- package/dist/operations/modeling/predicate-catalog.d.ts +5 -0
- package/dist/operations/modeling/predicate-catalog.d.ts.map +1 -0
- package/dist/operations/modeling/predicate-catalog.js +29 -0
- package/dist/operations/modeling/predicate-inference-1.d.ts +16 -0
- package/dist/operations/modeling/predicate-inference-1.d.ts.map +1 -0
- package/dist/operations/modeling/predicate-inference-1.js +161 -0
- package/dist/operations/modeling/predicate-inference-2.d.ts +19 -0
- package/dist/operations/modeling/predicate-inference-2.d.ts.map +1 -0
- package/dist/operations/modeling/predicate-inference-2.js +169 -0
- package/dist/operations/modeling/predicate-inference-3.d.ts +15 -0
- package/dist/operations/modeling/predicate-inference-3.d.ts.map +1 -0
- package/dist/operations/modeling/predicate-inference-3.js +163 -0
- package/dist/operations/modeling/predicate-inference.d.ts +5 -0
- package/dist/operations/modeling/predicate-inference.d.ts.map +1 -0
- package/dist/operations/modeling/predicate-inference.js +163 -0
- package/dist/operations/modeling/predicate-loader.d.ts +10 -0
- package/dist/operations/modeling/predicate-loader.d.ts.map +1 -0
- package/dist/operations/modeling/predicate-loader.js +94 -0
- package/dist/operations/modeling/predicate-ranker.d.ts +3 -0
- package/dist/operations/modeling/predicate-ranker.d.ts.map +1 -0
- package/dist/operations/modeling/predicate-ranker.js +62 -0
- package/dist/operations/modeling/predicate-score-1.d.ts +3 -0
- package/dist/operations/modeling/predicate-score-1.d.ts.map +1 -0
- package/dist/operations/modeling/predicate-score-1.js +121 -0
- package/dist/operations/modeling/predicate-score-2.d.ts +3 -0
- package/dist/operations/modeling/predicate-score-2.d.ts.map +1 -0
- package/dist/operations/modeling/predicate-score-2.js +122 -0
- package/dist/operations/modeling/predicate-score-3.d.ts +3 -0
- package/dist/operations/modeling/predicate-score-3.d.ts.map +1 -0
- package/dist/operations/modeling/predicate-score-3.js +54 -0
- package/dist/operations/modeling/predicate-types.d.ts +64 -0
- package/dist/operations/modeling/predicate-types.d.ts.map +1 -0
- package/dist/operations/modeling/predicate-types.js +1 -0
- package/dist/operations/modeling/predicate-usage-hints-1.d.ts +3 -0
- package/dist/operations/modeling/predicate-usage-hints-1.d.ts.map +1 -0
- package/dist/operations/modeling/predicate-usage-hints-1.js +211 -0
- package/dist/operations/modeling/predicate-usage-hints-2.d.ts +3 -0
- package/dist/operations/modeling/predicate-usage-hints-2.d.ts.map +1 -0
- package/dist/operations/modeling/predicate-usage-hints-2.js +209 -0
- package/dist/operations/modeling/predicate-usage-hints-3.d.ts +3 -0
- package/dist/operations/modeling/predicate-usage-hints-3.d.ts.map +1 -0
- package/dist/operations/modeling/predicate-usage-hints-3.js +45 -0
- package/dist/operations/modeling/predicate-utils.d.ts +23 -0
- package/dist/operations/modeling/predicate-utils.d.ts.map +1 -0
- package/dist/operations/modeling/predicate-utils.js +187 -0
- package/dist/operations/modeling/requirement-applyplan.d.ts +4 -0
- package/dist/operations/modeling/requirement-applyplan.d.ts.map +1 -0
- package/dist/operations/modeling/requirement-applyplan.js +44 -0
- package/dist/operations/modeling/requirement-heuristics.d.ts +4 -0
- package/dist/operations/modeling/requirement-heuristics.d.ts.map +1 -0
- package/dist/operations/modeling/requirement-heuristics.js +114 -0
- package/dist/operations/modeling/requirement-modeler.d.ts +8 -0
- package/dist/operations/modeling/requirement-modeler.d.ts.map +1 -0
- package/dist/operations/modeling/requirement-modeler.js +70 -0
- package/dist/operations/modeling/requirement-types.d.ts +61 -0
- package/dist/operations/modeling/requirement-types.d.ts.map +1 -0
- package/dist/operations/modeling/requirement-types.js +1 -0
- package/dist/operations/modeling/requirement-utils.d.ts +10 -0
- package/dist/operations/modeling/requirement-utils.d.ts.map +1 -0
- package/dist/operations/modeling/requirement-utils.js +65 -0
- package/dist/operations/modeling/suggest-predicates.d.ts +6 -0
- package/dist/operations/modeling/suggest-predicates.d.ts.map +1 -0
- package/dist/operations/modeling/suggest-predicates.js +64 -0
- package/dist/operations/mutation/audit.d.ts +6 -0
- package/dist/operations/mutation/audit.d.ts.map +1 -0
- package/dist/operations/mutation/audit.js +22 -0
- package/dist/operations/mutation/contradictions.d.ts +10 -0
- package/dist/operations/mutation/contradictions.d.ts.map +1 -0
- package/dist/operations/mutation/contradictions.js +40 -0
- package/dist/operations/mutation/delete.d.ts +5 -0
- package/dist/operations/mutation/delete.d.ts.map +1 -0
- package/dist/operations/mutation/delete.js +67 -0
- package/dist/operations/mutation/relationships.d.ts +17 -0
- package/dist/operations/mutation/relationships.d.ts.map +1 -0
- package/dist/operations/mutation/relationships.js +142 -0
- package/dist/operations/mutation/save.d.ts +4 -0
- package/dist/operations/mutation/save.d.ts.map +1 -0
- package/dist/operations/mutation/save.js +14 -0
- package/dist/operations/mutation/serialization.d.ts +5 -0
- package/dist/operations/mutation/serialization.d.ts.map +1 -0
- package/dist/operations/mutation/serialization.js +88 -0
- package/dist/operations/mutation/strict-fact.d.ts +4 -0
- package/dist/operations/mutation/strict-fact.d.ts.map +1 -0
- package/dist/operations/mutation/strict-fact.js +132 -0
- package/dist/operations/mutation/symbol-granularity.d.ts +4 -0
- package/dist/operations/mutation/symbol-granularity.d.ts.map +1 -0
- package/dist/operations/mutation/symbol-granularity.js +109 -0
- package/dist/operations/mutation/symbol-refresh.d.ts +10 -0
- package/dist/operations/mutation/symbol-refresh.d.ts.map +1 -0
- package/dist/operations/mutation/symbol-refresh.js +105 -0
- package/dist/operations/mutation/types.d.ts +43 -0
- package/dist/operations/mutation/types.d.ts.map +1 -0
- package/dist/operations/mutation/types.js +1 -0
- package/dist/operations/mutation/upsert.d.ts +5 -0
- package/dist/operations/mutation/upsert.d.ts.map +1 -0
- package/dist/operations/mutation/upsert.js +103 -0
- package/dist/operations/mutation/validate-upsert.d.ts +5 -0
- package/dist/operations/mutation/validate-upsert.d.ts.map +1 -0
- package/dist/operations/mutation/validate-upsert.js +50 -0
- package/dist/operations/mutation/validation.d.ts +5 -0
- package/dist/operations/mutation/validation.d.ts.map +1 -0
- package/dist/operations/mutation/validation.js +107 -0
- package/dist/operations/mutation/warnings.d.ts +4 -0
- package/dist/operations/mutation/warnings.d.ts.map +1 -0
- package/dist/operations/mutation/warnings.js +17 -0
- package/dist/operations/semantic-advisor/analysis-receipt.d.ts +5 -0
- package/dist/operations/semantic-advisor/analysis-receipt.d.ts.map +1 -0
- package/dist/operations/semantic-advisor/analysis-receipt.js +120 -0
- package/dist/operations/semantic-advisor/analyze-prose.d.ts +5 -0
- package/dist/operations/semantic-advisor/analyze-prose.d.ts.map +1 -0
- package/dist/operations/semantic-advisor/analyze-prose.js +693 -0
- package/dist/operations/semantic-advisor/clauses.d.ts +10 -0
- package/dist/operations/semantic-advisor/clauses.d.ts.map +1 -0
- package/dist/operations/semantic-advisor/clauses.js +43 -0
- package/dist/operations/semantic-advisor/observation-plan.d.ts +3 -0
- package/dist/operations/semantic-advisor/observation-plan.d.ts.map +1 -0
- package/dist/operations/semantic-advisor/observation-plan.js +31 -0
- package/dist/operations/semantic-advisor/predicate-rule.d.ts +14 -0
- package/dist/operations/semantic-advisor/predicate-rule.d.ts.map +1 -0
- package/dist/operations/semantic-advisor/predicate-rule.js +22 -0
- package/dist/operations/semantic-advisor/predicate-rules-core.d.ts +79 -0
- package/dist/operations/semantic-advisor/predicate-rules-core.d.ts.map +1 -0
- package/dist/operations/semantic-advisor/predicate-rules-core.js +140 -0
- package/dist/operations/semantic-advisor/predicate-rules-policy.d.ts +83 -0
- package/dist/operations/semantic-advisor/predicate-rules-policy.d.ts.map +1 -0
- package/dist/operations/semantic-advisor/predicate-rules-policy.js +150 -0
- package/dist/operations/semantic-advisor/predicate-rules-product-tail.d.ts +48 -0
- package/dist/operations/semantic-advisor/predicate-rules-product-tail.d.ts.map +1 -0
- package/dist/operations/semantic-advisor/predicate-rules-product-tail.js +102 -0
- package/dist/operations/semantic-advisor/predicate-rules-product.d.ts +71 -0
- package/dist/operations/semantic-advisor/predicate-rules-product.d.ts.map +1 -0
- package/dist/operations/semantic-advisor/predicate-rules-product.js +133 -0
- package/dist/operations/semantic-advisor/prose-coverage-evaluator.d.ts +29 -0
- package/dist/operations/semantic-advisor/prose-coverage-evaluator.d.ts.map +1 -0
- package/dist/operations/semantic-advisor/prose-coverage-evaluator.js +54 -0
- package/dist/operations/semantic-advisor/shared.d.ts +19 -0
- package/dist/operations/semantic-advisor/shared.d.ts.map +1 -0
- package/dist/operations/semantic-advisor/shared.js +209 -0
- package/dist/operations/semantic-advisor/strict-count-rules.d.ts +4 -0
- package/dist/operations/semantic-advisor/strict-count-rules.d.ts.map +1 -0
- package/dist/operations/semantic-advisor/strict-count-rules.js +62 -0
- package/dist/operations/semantic-advisor/strict-rules.d.ts +4 -0
- package/dist/operations/semantic-advisor/strict-rules.d.ts.map +1 -0
- package/dist/operations/semantic-advisor/strict-rules.js +106 -0
- package/dist/operations/semantic-advisor/types.d.ts +195 -0
- package/dist/operations/semantic-advisor/types.d.ts.map +1 -0
- package/dist/operations/semantic-advisor/types.js +1 -0
- package/dist/prolog/codec.d.ts.map +1 -1
- package/dist/prolog/codec.js +20 -3
- package/dist/prolog.d.ts +5 -0
- package/dist/prolog.d.ts.map +1 -1
- package/dist/prolog.js +89 -32
- package/dist/public/impact/diagnostics.d.ts.map +1 -1
- package/dist/public/impact/diagnostics.js +8 -4
- package/dist/public/impact/full-kb-quality.d.ts +1 -1
- package/dist/public/impact/full-kb-quality.d.ts.map +1 -1
- package/dist/public/impact/full-kb-quality.js +34 -1
- package/dist/public/impact/requirement-quality.d.ts.map +1 -1
- package/dist/public/impact/requirement-quality.js +6 -23
- package/dist/public/operations/catalog.d.ts +986 -0
- package/dist/public/operations/catalog.d.ts.map +1 -0
- package/dist/public/operations/catalog.js +42 -0
- package/dist/public/operations/check-executor.d.ts +21 -0
- package/dist/public/operations/check-executor.d.ts.map +1 -0
- package/dist/public/operations/check-executor.js +111 -0
- package/dist/public/operations/check-format-shared.d.ts +36 -0
- package/dist/public/operations/check-format-shared.d.ts.map +1 -0
- package/dist/public/operations/check-format-shared.js +107 -0
- package/dist/public/operations/check-helpers.d.ts +10 -0
- package/dist/public/operations/check-helpers.d.ts.map +1 -0
- package/dist/public/operations/check-helpers.js +107 -0
- package/dist/public/operations/discovery-entities.d.ts +14 -0
- package/dist/public/operations/discovery-entities.d.ts.map +1 -0
- package/dist/public/operations/discovery-entities.js +91 -0
- package/dist/public/operations/discovery-executors.d.ts +39 -0
- package/dist/public/operations/discovery-executors.d.ts.map +1 -0
- package/dist/public/operations/discovery-executors.js +101 -0
- package/dist/public/operations/index.d.ts +21 -0
- package/dist/public/operations/index.d.ts.map +1 -0
- package/dist/public/operations/index.js +19 -0
- package/dist/public/operations/node-ports.d.ts +15 -0
- package/dist/public/operations/node-ports.d.ts.map +1 -0
- package/dist/public/operations/node-ports.js +57 -0
- package/dist/public/operations/prolog-json.d.ts +5 -0
- package/dist/public/operations/prolog-json.d.ts.map +1 -0
- package/dist/public/operations/prolog-json.js +44 -0
- package/dist/public/operations/runtime-types.d.ts +69 -0
- package/dist/public/operations/runtime-types.d.ts.map +1 -0
- package/dist/public/operations/runtime-types.js +17 -0
- package/dist/public/operations/specs/autopilot.d.ts +82 -0
- package/dist/public/operations/specs/autopilot.d.ts.map +1 -0
- package/dist/public/operations/specs/autopilot.js +72 -0
- package/dist/public/operations/specs/check.d.ts +51 -0
- package/dist/public/operations/specs/check.d.ts.map +1 -0
- package/dist/public/operations/specs/check.js +65 -0
- package/dist/public/operations/specs/discovery.d.ts +94 -0
- package/dist/public/operations/specs/discovery.d.ts.map +1 -0
- package/dist/public/operations/specs/discovery.js +98 -0
- package/dist/public/operations/specs/modeling.d.ts +142 -0
- package/dist/public/operations/specs/modeling.d.ts.map +1 -0
- package/dist/public/operations/specs/modeling.js +133 -0
- package/dist/public/operations/specs/mutation-schemas.d.ts +268 -0
- package/dist/public/operations/specs/mutation-schemas.d.ts.map +1 -0
- package/dist/public/operations/specs/mutation-schemas.js +294 -0
- package/dist/public/operations/specs/mutation.d.ts +56 -0
- package/dist/public/operations/specs/mutation.d.ts.map +1 -0
- package/dist/public/operations/specs/mutation.js +44 -0
- package/dist/public/operations/specs/reporting.d.ts +185 -0
- package/dist/public/operations/specs/reporting.d.ts.map +1 -0
- package/dist/public/operations/specs/reporting.js +158 -0
- package/dist/public/operations/specs/semantic.d.ts +81 -0
- package/dist/public/operations/specs/semantic.d.ts.map +1 -0
- package/dist/public/operations/specs/semantic.js +137 -0
- package/dist/public/operations/specs/skills.d.ts +70 -0
- package/dist/public/operations/specs/skills.d.ts.map +1 -0
- package/dist/public/operations/specs/skills.js +107 -0
- package/dist/public/operations/specs/sparql.d.ts +39 -0
- package/dist/public/operations/specs/sparql.d.ts.map +1 -0
- package/dist/public/operations/specs/sparql.js +121 -0
- package/dist/public/operations/specs/upsert.d.ts +291 -0
- package/dist/public/operations/specs/upsert.d.ts.map +1 -0
- package/dist/public/operations/specs/upsert.js +27 -0
- package/dist/public/operations/types.d.ts +24 -0
- package/dist/public/operations/types.d.ts.map +1 -0
- package/dist/public/operations/types.js +1 -0
- package/dist/public/schemas/entity.d.ts.map +1 -1
- package/dist/public/schemas/entity.js +317 -0
- package/dist/public/schemas/relationship.d.ts.map +1 -1
- package/dist/public/schemas/relationship.js +1 -0
- package/dist/public/skill-system/errors.d.ts +19 -0
- package/dist/public/skill-system/errors.d.ts.map +1 -0
- package/dist/public/skill-system/errors.js +36 -0
- package/dist/public/skill-system/loader.d.ts +9 -0
- package/dist/public/skill-system/loader.d.ts.map +1 -0
- package/dist/public/skill-system/loader.js +76 -0
- package/dist/public/skill-system/paths.d.ts +6 -0
- package/dist/public/skill-system/paths.d.ts.map +1 -0
- package/dist/public/skill-system/paths.js +25 -0
- package/dist/public/skill-system/types.d.ts +15 -0
- package/dist/public/skill-system/types.d.ts.map +1 -0
- package/dist/public/skill-system/types.js +1 -0
- package/dist/public/skill-system/validation.d.ts +10 -0
- package/dist/public/skill-system/validation.d.ts.map +1 -0
- package/dist/public/skill-system/validation.js +119 -0
- package/dist/public/skills/init-kibi/SKILL.md +62 -0
- package/dist/public/skills/kibi-freshness/SKILL.md +44 -0
- package/dist/public/skills/kibi-traceability/SKILL.md +54 -0
- package/dist/public/skills/kibi-usage/SKILL.md +145 -99
- package/dist/public/skills/kibi-usage/resources/fact-lanes.md +112 -0
- package/dist/public/skills/kibi-usage/resources/logic-ir.md +43 -0
- package/dist/public/skills/kibi-usage/resources/operation-access.md +44 -0
- package/dist/public/skills/kibi-usage/resources/ui-requirements.md +96 -0
- package/dist/public/skills/kibi-usage/resources/workflows.md +41 -3
- package/dist/public/skills.d.ts +4 -41
- package/dist/public/skills.d.ts.map +1 -1
- package/dist/public/skills.js +3 -270
- package/dist/public/symbol-granularity.d.ts +9 -0
- package/dist/public/symbol-granularity.d.ts.map +1 -1
- package/dist/public/symbol-granularity.js +16 -0
- package/dist/runtime/cli-runtime.d.ts +3 -0
- package/dist/runtime/cli-runtime.d.ts.map +1 -0
- package/dist/runtime/cli-runtime.js +96 -0
- package/dist/schemas/entity.schema.json +329 -3
- package/dist/traceability/staged-diagnostics.d.ts +2 -2
- package/dist/traceability/staged-diagnostics.d.ts.map +1 -1
- package/dist/traceability/staged-diagnostics.js +17 -10
- package/dist/traceability/staged-impact-contract.js +1 -1
- package/dist/traceability/staged-symbols-manifest.d.ts +1 -0
- package/dist/traceability/staged-symbols-manifest.d.ts.map +1 -1
- package/dist/traceability/staged-symbols-manifest.js +53 -24
- package/dist/traceability/symbol-extract.d.ts.map +1 -1
- package/dist/traceability/symbol-extract.js +17 -1
- package/dist/traceability/temp-kb.d.ts.map +1 -1
- package/dist/traceability/temp-kb.js +47 -1
- package/dist/types/entities.d.ts +3 -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/rule-registry.d.ts.map +1 -1
- package/dist/utils/rule-registry.js +24 -0
- package/dist/utils/schema-version.d.ts +1 -1
- package/dist/utils/schema-version.js +1 -1
- package/package.json +60 -2
- package/src/public/impact/diagnostics.ts +18 -11
- package/src/public/impact/full-kb-quality.ts +30 -3
- package/src/public/impact/requirement-quality.ts +6 -26
- package/src/public/operations/catalog.ts +60 -0
- package/src/public/operations/check-executor.ts +185 -0
- package/src/public/operations/check-format-shared.ts +178 -0
- package/src/public/operations/check-helpers.ts +141 -0
- package/src/public/operations/discovery-entities.ts +122 -0
- package/src/public/operations/discovery-executors.ts +176 -0
- package/src/public/operations/index.ts +20 -0
- package/src/public/operations/node-ports.ts +78 -0
- package/src/public/operations/prolog-json.ts +71 -0
- package/src/public/operations/runtime-types.ts +106 -0
- package/src/public/operations/specs/autopilot.ts +98 -0
- package/src/public/operations/specs/check.ts +75 -0
- package/src/public/operations/specs/discovery.ts +126 -0
- package/src/public/operations/specs/modeling.ts +174 -0
- package/src/public/operations/specs/mutation-schemas.ts +326 -0
- package/src/public/operations/specs/mutation.ts +58 -0
- package/src/public/operations/specs/reporting.ts +249 -0
- package/src/public/operations/specs/semantic.ts +174 -0
- package/src/public/operations/specs/skills.ts +142 -0
- package/src/public/operations/specs/sparql.ts +149 -0
- package/src/public/operations/specs/upsert.ts +40 -0
- package/src/public/operations/types.ts +57 -0
- package/src/public/schemas/entity.ts +324 -1
- package/src/public/schemas/relationship.ts +1 -0
- package/src/public/skill-system/errors.ts +38 -0
- package/src/public/skill-system/loader.ts +108 -0
- package/src/public/skill-system/paths.ts +27 -0
- package/src/public/skill-system/types.ts +14 -0
- package/src/public/skill-system/validation.ts +175 -0
- package/src/public/skills/init-kibi/SKILL.md +62 -0
- package/src/public/skills/kibi-freshness/SKILL.md +44 -0
- package/src/public/skills/kibi-traceability/SKILL.md +54 -0
- package/src/public/skills/kibi-usage/SKILL.md +145 -99
- package/src/public/skills/kibi-usage/resources/fact-lanes.md +112 -0
- package/src/public/skills/kibi-usage/resources/logic-ir.md +43 -0
- package/src/public/skills/kibi-usage/resources/operation-access.md +44 -0
- package/src/public/skills/kibi-usage/resources/ui-requirements.md +96 -0
- package/src/public/skills/kibi-usage/resources/workflows.md +41 -3
- package/src/public/skills.ts +18 -427
- package/src/public/symbol-granularity.ts +25 -0
- package/src/schemas/entity.schema.json +329 -3
- package/src/schemas/relationship.schema.json +1 -0
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
import { runAggregatedChecks } from "../../commands/aggregated-checks.js";
|
|
2
|
+
/*
|
|
3
|
+
Kibi — repo-local, per-branch, queryable long-term memory for software projects
|
|
4
|
+
Copyright (C) 2026 Piotr Franczyk
|
|
5
|
+
|
|
6
|
+
This program is free software: you can redistribute it and/or modify
|
|
7
|
+
it under the terms of the GNU Affero General Public License as published by
|
|
8
|
+
the Free Software Foundation, either version 3 of the License, or
|
|
9
|
+
(at your option) any later version.
|
|
10
|
+
|
|
11
|
+
This program is distributed in the hope that it will be useful,
|
|
12
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
13
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
14
|
+
GNU Affero General Public License for more details.
|
|
15
|
+
|
|
16
|
+
You should have received a copy of the GNU Affero General Public License
|
|
17
|
+
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
18
|
+
*/
|
|
19
|
+
import type { Violation } from "../check-types.js";
|
|
20
|
+
import { collectFullKbQualityDiagnostics } from "../impact-diagnostics.js";
|
|
21
|
+
import {
|
|
22
|
+
type CheckDiagnostic,
|
|
23
|
+
type CheckStructuredContent,
|
|
24
|
+
buildStructuredContent,
|
|
25
|
+
buildSummary,
|
|
26
|
+
} from "./check-format-shared.js";
|
|
27
|
+
import {
|
|
28
|
+
analyzeKbCheckImpact,
|
|
29
|
+
collectQueryPlanSafetyViolations,
|
|
30
|
+
getEffectiveRules,
|
|
31
|
+
loadChecksConfig,
|
|
32
|
+
qualityDiagnosticsFromImpact,
|
|
33
|
+
} from "./check-helpers.js";
|
|
34
|
+
import type { OperationContext, PrologPort } from "./runtime-types.js";
|
|
35
|
+
import type { OperationResult } from "./types.js";
|
|
36
|
+
|
|
37
|
+
// implements REQ-kibi-operation-interface-parity, REQ-002
|
|
38
|
+
export type CheckInput = {
|
|
39
|
+
readonly rules?: readonly string[];
|
|
40
|
+
readonly workspaceRoot?: string;
|
|
41
|
+
readonly sourceFiles?: readonly string[];
|
|
42
|
+
readonly staged?: boolean;
|
|
43
|
+
readonly includeWorkingTreeDiff?: boolean;
|
|
44
|
+
readonly includeImpactDiagnostics?: boolean;
|
|
45
|
+
readonly maxDiagnostics?: number;
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
export type CheckPayload = CheckStructuredContent;
|
|
49
|
+
export type { CheckDiagnostic, CheckStructuredContent };
|
|
50
|
+
export {
|
|
51
|
+
buildStructuredContent,
|
|
52
|
+
buildSummary,
|
|
53
|
+
getEffectiveRules,
|
|
54
|
+
loadChecksConfig,
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
export type CheckExecutionOptions = {
|
|
58
|
+
readonly collectFullQualityDiagnosticsForExplicitRules?: boolean;
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
function requireProlog(context: OperationContext): PrologPort {
|
|
62
|
+
if (context.prolog === undefined) {
|
|
63
|
+
throw new Error("Check operation requires a Prolog runtime");
|
|
64
|
+
}
|
|
65
|
+
return context.prolog;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
function invalidatePrologCache(prolog: PrologPort): void {
|
|
69
|
+
prolog.invalidateCache?.();
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
// implements REQ-kibi-operation-interface-parity, REQ-002
|
|
73
|
+
export async function executeCheck(
|
|
74
|
+
args: CheckInput,
|
|
75
|
+
context: OperationContext,
|
|
76
|
+
options: CheckExecutionOptions = {},
|
|
77
|
+
): Promise<OperationResult<CheckPayload>> {
|
|
78
|
+
try {
|
|
79
|
+
const workspaceRoot = args.workspaceRoot ?? context.workspaceRoot;
|
|
80
|
+
const prolog = requireProlog(context);
|
|
81
|
+
const checksConfig = await loadChecksConfig(workspaceRoot);
|
|
82
|
+
const rulesAllowlist =
|
|
83
|
+
args.rules === undefined
|
|
84
|
+
? getEffectiveRules(checksConfig.rules)
|
|
85
|
+
: args.rules.length === 0
|
|
86
|
+
? new Set<string>()
|
|
87
|
+
: getEffectiveRules(undefined, args.rules.join(","));
|
|
88
|
+
const hasExplicitRules = args.rules !== undefined;
|
|
89
|
+
const impactResult = analyzeKbCheckImpact(workspaceRoot, args);
|
|
90
|
+
const impactQualityDiagnostics = qualityDiagnosticsFromImpact(impactResult);
|
|
91
|
+
const maxDiagnosticsOption =
|
|
92
|
+
args.maxDiagnostics !== undefined
|
|
93
|
+
? { maxDiagnostics: args.maxDiagnostics }
|
|
94
|
+
: {};
|
|
95
|
+
|
|
96
|
+
if (rulesAllowlist.size === 0) {
|
|
97
|
+
const qualityDiagnostics =
|
|
98
|
+
hasExplicitRules &&
|
|
99
|
+
options.collectFullQualityDiagnosticsForExplicitRules !== true
|
|
100
|
+
? []
|
|
101
|
+
: impactResult
|
|
102
|
+
? impactQualityDiagnostics
|
|
103
|
+
: await collectFullKbQualityDiagnostics({
|
|
104
|
+
prolog,
|
|
105
|
+
...maxDiagnosticsOption,
|
|
106
|
+
});
|
|
107
|
+
return {
|
|
108
|
+
content: [
|
|
109
|
+
{
|
|
110
|
+
type: "text",
|
|
111
|
+
text: buildSummary({
|
|
112
|
+
violations: [],
|
|
113
|
+
impactResult,
|
|
114
|
+
qualityDiagnostics,
|
|
115
|
+
}),
|
|
116
|
+
},
|
|
117
|
+
],
|
|
118
|
+
structuredContent: buildStructuredContent({
|
|
119
|
+
violations: [],
|
|
120
|
+
diagnostics: [],
|
|
121
|
+
qualityDiagnostics,
|
|
122
|
+
impactResult,
|
|
123
|
+
}),
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
invalidatePrologCache(prolog);
|
|
128
|
+
|
|
129
|
+
const aggregatedViolations = await runAggregatedChecks(
|
|
130
|
+
prolog,
|
|
131
|
+
rulesAllowlist,
|
|
132
|
+
checksConfig.symbolTraceability.requireAdr,
|
|
133
|
+
);
|
|
134
|
+
const queryPlanViolations = rulesAllowlist.has("query-plan-safety")
|
|
135
|
+
? collectQueryPlanSafetyViolations()
|
|
136
|
+
: [];
|
|
137
|
+
const violations: Violation[] = [
|
|
138
|
+
...aggregatedViolations,
|
|
139
|
+
...queryPlanViolations,
|
|
140
|
+
];
|
|
141
|
+
|
|
142
|
+
const diagnostics: CheckDiagnostic[] = violations.map((v) => ({
|
|
143
|
+
category: "SYNC_ERROR",
|
|
144
|
+
severity: "error",
|
|
145
|
+
message: v.description,
|
|
146
|
+
...(v.source !== undefined ? { file: v.source } : {}),
|
|
147
|
+
...(v.suggestion !== undefined ? { suggestion: v.suggestion } : {}),
|
|
148
|
+
}));
|
|
149
|
+
|
|
150
|
+
const collectFullQualityDiagnostics =
|
|
151
|
+
!hasExplicitRules ||
|
|
152
|
+
options.collectFullQualityDiagnosticsForExplicitRules === true;
|
|
153
|
+
const qualityDiagnostics = !collectFullQualityDiagnostics
|
|
154
|
+
? impactQualityDiagnostics
|
|
155
|
+
: impactResult
|
|
156
|
+
? impactQualityDiagnostics
|
|
157
|
+
: await collectFullKbQualityDiagnostics({
|
|
158
|
+
prolog,
|
|
159
|
+
hardViolationEntityIds: new Set(violations.map((v) => v.entityId)),
|
|
160
|
+
...maxDiagnosticsOption,
|
|
161
|
+
});
|
|
162
|
+
|
|
163
|
+
return {
|
|
164
|
+
content: [
|
|
165
|
+
{
|
|
166
|
+
type: "text",
|
|
167
|
+
text: buildSummary({
|
|
168
|
+
violations,
|
|
169
|
+
impactResult,
|
|
170
|
+
qualityDiagnostics,
|
|
171
|
+
}),
|
|
172
|
+
},
|
|
173
|
+
],
|
|
174
|
+
structuredContent: buildStructuredContent({
|
|
175
|
+
violations,
|
|
176
|
+
diagnostics,
|
|
177
|
+
qualityDiagnostics,
|
|
178
|
+
impactResult,
|
|
179
|
+
}),
|
|
180
|
+
};
|
|
181
|
+
} catch (error) {
|
|
182
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
183
|
+
throw new Error(`Check execution failed: ${message}`);
|
|
184
|
+
}
|
|
185
|
+
}
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
import type { Violation } from "../check-types.js";
|
|
2
|
+
/*
|
|
3
|
+
Kibi — repo-local, per-branch, queryable long-term memory for software projects
|
|
4
|
+
Copyright (C) 2026 Piotr Franczyk
|
|
5
|
+
|
|
6
|
+
This program is free software: you can redistribute it and/or modify
|
|
7
|
+
it under the terms of the GNU Affero General Public License as published by
|
|
8
|
+
the Free Software Foundation, either version 3 of the License, or
|
|
9
|
+
(at your option) any later version.
|
|
10
|
+
|
|
11
|
+
This program is distributed in the hope that it will be useful,
|
|
12
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
13
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
14
|
+
GNU Affero General Public License for more details.
|
|
15
|
+
|
|
16
|
+
You should have received a copy of the GNU Affero General Public License
|
|
17
|
+
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
18
|
+
*/
|
|
19
|
+
import type { ChangedFileImpactResult } from "../impact-diagnostics.js";
|
|
20
|
+
import type { QualityDiagnostic } from "../impact-diagnostics.js";
|
|
21
|
+
|
|
22
|
+
// implements REQ-mcp-tool-check
|
|
23
|
+
export interface CheckDiagnostic {
|
|
24
|
+
readonly category: string;
|
|
25
|
+
readonly severity: "error" | "warning";
|
|
26
|
+
readonly message: string;
|
|
27
|
+
readonly file?: string;
|
|
28
|
+
readonly suggestion?: string;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
// implements REQ-mcp-tool-check
|
|
32
|
+
export interface CheckStructuredContent {
|
|
33
|
+
readonly violations: readonly Violation[];
|
|
34
|
+
readonly count: number;
|
|
35
|
+
readonly diagnostics: readonly CheckDiagnostic[];
|
|
36
|
+
readonly qualityDiagnostics?: readonly QualityDiagnostic[];
|
|
37
|
+
readonly impactDiagnostics?: ChangedFileImpactResult["impactDiagnostics"];
|
|
38
|
+
readonly sourceFiles?: ChangedFileImpactResult["sourceFiles"];
|
|
39
|
+
readonly extractedSymbols?: ChangedFileImpactResult["extractedSymbols"];
|
|
40
|
+
readonly linkedEntities?: ChangedFileImpactResult["linkedEntities"];
|
|
41
|
+
readonly nextActions?: ChangedFileImpactResult["nextActions"];
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
function formatDiagnostics(diagnostics: readonly CheckDiagnostic[]) {
|
|
45
|
+
return diagnostics.map((d) => ({
|
|
46
|
+
category: d.category,
|
|
47
|
+
severity: d.severity,
|
|
48
|
+
message: d.message,
|
|
49
|
+
...(d.file !== undefined ? { file: d.file } : {}),
|
|
50
|
+
...(d.suggestion !== undefined ? { suggestion: d.suggestion } : {}),
|
|
51
|
+
}));
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
// implements REQ-mcp-tool-check
|
|
55
|
+
export function formatImpactText(
|
|
56
|
+
impactResult: ChangedFileImpactResult,
|
|
57
|
+
): string {
|
|
58
|
+
if (impactResult.impactDiagnostics.length === 0) {
|
|
59
|
+
return "No impact diagnostics found";
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
const details = impactResult.impactDiagnostics.map((diagnostic) => {
|
|
63
|
+
const files =
|
|
64
|
+
diagnostic.files.length > 0
|
|
65
|
+
? diagnostic.files.join(", ")
|
|
66
|
+
: "unknown-source";
|
|
67
|
+
return `- ${diagnostic.id} | ${diagnostic.severity} | ${files} | ${diagnostic.message} Suggestion: ${diagnostic.suggestion}`;
|
|
68
|
+
});
|
|
69
|
+
return `${impactResult.impactDiagnostics.length} impact diagnostics found\n${details.join("\n")}`;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
function formatOptionalList(
|
|
73
|
+
label: string,
|
|
74
|
+
values: readonly string[] | undefined,
|
|
75
|
+
) {
|
|
76
|
+
if (values === undefined || values.length === 0) {
|
|
77
|
+
return [];
|
|
78
|
+
}
|
|
79
|
+
return [`${label}: ${values.join(", ")}`];
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
// implements REQ-mcp-tool-check
|
|
83
|
+
export function formatQualityDiagnosticsText(
|
|
84
|
+
diagnostics: readonly QualityDiagnostic[],
|
|
85
|
+
): string {
|
|
86
|
+
if (diagnostics.length === 0) {
|
|
87
|
+
return "No quality diagnostics found";
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
const details = diagnostics.map((diagnostic) => {
|
|
91
|
+
const parts = [
|
|
92
|
+
diagnostic.id,
|
|
93
|
+
diagnostic.severity,
|
|
94
|
+
diagnostic.category,
|
|
95
|
+
diagnostic.message,
|
|
96
|
+
];
|
|
97
|
+
const metadata = [
|
|
98
|
+
`Blocking: ${diagnostic.blocking ? "yes" : "no"}`,
|
|
99
|
+
...formatOptionalList("Files", diagnostic.files),
|
|
100
|
+
...formatOptionalList("Docs", diagnostic.docs),
|
|
101
|
+
...(diagnostic.entityId !== undefined
|
|
102
|
+
? [`Entity: ${diagnostic.entityId}`]
|
|
103
|
+
: []),
|
|
104
|
+
...(diagnostic.source !== undefined
|
|
105
|
+
? [`Source: ${diagnostic.source}`]
|
|
106
|
+
: []),
|
|
107
|
+
`Suggestion: ${diagnostic.suggestion}`,
|
|
108
|
+
];
|
|
109
|
+
return `- ${parts.join(" | ")}\n ${metadata.join("\n ")}`;
|
|
110
|
+
});
|
|
111
|
+
|
|
112
|
+
return `${diagnostics.length} quality diagnostic${diagnostics.length === 1 ? "" : "s"} found\n${details.join("\n")}`;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
// implements REQ-mcp-tool-check
|
|
116
|
+
export function formatViolationText(violations: readonly Violation[]): string {
|
|
117
|
+
if (violations.length === 0) {
|
|
118
|
+
return "No violations found";
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
const details = violations.map((violation) => {
|
|
122
|
+
const parts = [
|
|
123
|
+
violation.rule,
|
|
124
|
+
violation.entityId,
|
|
125
|
+
violation.source ?? "unknown-source",
|
|
126
|
+
violation.description,
|
|
127
|
+
];
|
|
128
|
+
if (violation.suggestion) {
|
|
129
|
+
parts.push(`Suggestion: ${violation.suggestion}`);
|
|
130
|
+
}
|
|
131
|
+
return `- ${parts.join(" | ")}`;
|
|
132
|
+
});
|
|
133
|
+
|
|
134
|
+
return `${violations.length} violations found\n${details.join("\n")}`;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
// implements REQ-mcp-tool-check
|
|
138
|
+
export function buildStructuredContent(input: {
|
|
139
|
+
violations: readonly Violation[];
|
|
140
|
+
diagnostics: readonly CheckDiagnostic[];
|
|
141
|
+
qualityDiagnostics?: readonly QualityDiagnostic[];
|
|
142
|
+
impactResult: ChangedFileImpactResult | undefined;
|
|
143
|
+
}): CheckStructuredContent {
|
|
144
|
+
const qualityDiagnostics = input.qualityDiagnostics ?? [];
|
|
145
|
+
return {
|
|
146
|
+
violations: [...input.violations],
|
|
147
|
+
count: input.violations.length,
|
|
148
|
+
diagnostics: formatDiagnostics(input.diagnostics),
|
|
149
|
+
...(qualityDiagnostics.length > 0
|
|
150
|
+
? { qualityDiagnostics: [...qualityDiagnostics] }
|
|
151
|
+
: {}),
|
|
152
|
+
...(input.impactResult
|
|
153
|
+
? {
|
|
154
|
+
impactDiagnostics: input.impactResult.impactDiagnostics,
|
|
155
|
+
sourceFiles: input.impactResult.sourceFiles,
|
|
156
|
+
extractedSymbols: input.impactResult.extractedSymbols,
|
|
157
|
+
linkedEntities: input.impactResult.linkedEntities,
|
|
158
|
+
nextActions: input.impactResult.nextActions,
|
|
159
|
+
}
|
|
160
|
+
: {}),
|
|
161
|
+
};
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
// implements REQ-mcp-tool-check
|
|
165
|
+
export function buildSummary(input: {
|
|
166
|
+
readonly violations: readonly Violation[];
|
|
167
|
+
readonly impactResult: ChangedFileImpactResult | undefined;
|
|
168
|
+
readonly qualityDiagnostics: readonly QualityDiagnostic[];
|
|
169
|
+
}): string {
|
|
170
|
+
const sections = [formatViolationText(input.violations)];
|
|
171
|
+
if (input.impactResult !== undefined) {
|
|
172
|
+
sections.push(formatImpactText(input.impactResult));
|
|
173
|
+
}
|
|
174
|
+
if (input.qualityDiagnostics.length > 0) {
|
|
175
|
+
sections.push(formatQualityDiagnosticsText(input.qualityDiagnostics));
|
|
176
|
+
}
|
|
177
|
+
return sections.join("\n");
|
|
178
|
+
}
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
import { readFileSync } from "node:fs";
|
|
2
|
+
/*
|
|
3
|
+
Kibi — repo-local, per-branch, queryable long-term memory for software projects
|
|
4
|
+
Copyright (C) 2026 Piotr Franczyk
|
|
5
|
+
|
|
6
|
+
This program is free software: you can redistribute it and/or modify
|
|
7
|
+
it under the terms of the GNU Affero General Public License as published by
|
|
8
|
+
the Free Software Foundation, either version 3 of the License, or
|
|
9
|
+
(at your option) any later version.
|
|
10
|
+
|
|
11
|
+
This program is distributed in the hope that it will be useful,
|
|
12
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
13
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
14
|
+
GNU Affero General Public License for more details.
|
|
15
|
+
|
|
16
|
+
You should have received a copy of the GNU Affero General Public License
|
|
17
|
+
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
18
|
+
*/
|
|
19
|
+
import { readFile } from "node:fs/promises";
|
|
20
|
+
import path from "node:path";
|
|
21
|
+
import { getKbPlPathOverride } from "../../env.js";
|
|
22
|
+
import { resolveKbPlPath } from "../../prolog.js";
|
|
23
|
+
import { analyzePrologQueryPlanSafety } from "../../utils/prolog-query-plan-safety.js";
|
|
24
|
+
import {
|
|
25
|
+
type ChecksConfig,
|
|
26
|
+
DEFAULT_CHECKS_CONFIG,
|
|
27
|
+
RULE_NAMES,
|
|
28
|
+
type Violation,
|
|
29
|
+
getEffectiveRules,
|
|
30
|
+
} from "../../utils/rule-registry.js";
|
|
31
|
+
import {
|
|
32
|
+
type ChangedFileImpactResult,
|
|
33
|
+
type QualityDiagnostic,
|
|
34
|
+
analyzeChangedFileImpact,
|
|
35
|
+
} from "../impact-diagnostics.js";
|
|
36
|
+
import type { CheckInput } from "./check-executor.js";
|
|
37
|
+
|
|
38
|
+
export { RULE_NAMES, getEffectiveRules };
|
|
39
|
+
|
|
40
|
+
function resolveChecksPlPath(): string {
|
|
41
|
+
const override = getKbPlPathOverride();
|
|
42
|
+
return path.join(path.dirname(override ?? resolveKbPlPath()), "checks.pl");
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
// implements REQ-mcp-tool-check
|
|
46
|
+
export function collectQueryPlanSafetyViolations(): Violation[] {
|
|
47
|
+
const checksPlPath = resolveChecksPlPath();
|
|
48
|
+
const source = readFileSync(checksPlPath, "utf8");
|
|
49
|
+
return analyzePrologQueryPlanSafety(source).map((v) => ({
|
|
50
|
+
rule: "query-plan-safety",
|
|
51
|
+
entityId: v.predicate,
|
|
52
|
+
description: v.description,
|
|
53
|
+
suggestion: v.suggestion,
|
|
54
|
+
source: `${checksPlPath}:${v.line}`,
|
|
55
|
+
}));
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
// implements REQ-mcp-tool-check
|
|
59
|
+
export async function loadChecksConfig(
|
|
60
|
+
workspaceRoot: string,
|
|
61
|
+
): Promise<ChecksConfig> {
|
|
62
|
+
const configPath = path.join(workspaceRoot, ".kb", "config.json");
|
|
63
|
+
try {
|
|
64
|
+
const content = await readFile(configPath, "utf8");
|
|
65
|
+
const parsed = JSON.parse(content) as {
|
|
66
|
+
checks?: Partial<ChecksConfig>;
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
const parsedRules = parsed.checks?.rules;
|
|
70
|
+
const normalizedRules: Record<string, boolean> = {
|
|
71
|
+
...DEFAULT_CHECKS_CONFIG.rules,
|
|
72
|
+
};
|
|
73
|
+
if (parsedRules && typeof parsedRules === "object") {
|
|
74
|
+
for (const [key, value] of Object.entries(parsedRules)) {
|
|
75
|
+
if (typeof value === "boolean") {
|
|
76
|
+
normalizedRules[key] = value;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
const parsedSt = parsed.checks?.symbolTraceability;
|
|
82
|
+
const normalizedSt = { ...DEFAULT_CHECKS_CONFIG.symbolTraceability };
|
|
83
|
+
if (
|
|
84
|
+
parsedSt &&
|
|
85
|
+
typeof parsedSt === "object" &&
|
|
86
|
+
typeof parsedSt.requireAdr === "boolean"
|
|
87
|
+
) {
|
|
88
|
+
normalizedSt.requireAdr = parsedSt.requireAdr;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
return { rules: normalizedRules, symbolTraceability: normalizedSt };
|
|
92
|
+
} catch {
|
|
93
|
+
return DEFAULT_CHECKS_CONFIG;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
// implements REQ-mcp-tool-check
|
|
98
|
+
export function hasImpactOptions(args: CheckInput): boolean {
|
|
99
|
+
return Boolean(
|
|
100
|
+
args.includeImpactDiagnostics ||
|
|
101
|
+
args.staged ||
|
|
102
|
+
args.includeWorkingTreeDiff ||
|
|
103
|
+
(args.sourceFiles !== undefined && args.sourceFiles.length > 0),
|
|
104
|
+
);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
// implements REQ-mcp-tool-check
|
|
108
|
+
export function analyzeKbCheckImpact(
|
|
109
|
+
workspaceRoot: string,
|
|
110
|
+
args: CheckInput,
|
|
111
|
+
): ChangedFileImpactResult | undefined {
|
|
112
|
+
if (!hasImpactOptions(args)) {
|
|
113
|
+
return undefined;
|
|
114
|
+
}
|
|
115
|
+
return analyzeChangedFileImpact({
|
|
116
|
+
workspaceRoot,
|
|
117
|
+
...(args.sourceFiles !== undefined
|
|
118
|
+
? { sourceFiles: args.sourceFiles }
|
|
119
|
+
: {}),
|
|
120
|
+
...(args.staged !== undefined ? { staged: args.staged } : {}),
|
|
121
|
+
...(args.includeWorkingTreeDiff !== undefined
|
|
122
|
+
? { includeWorkingTreeDiff: args.includeWorkingTreeDiff }
|
|
123
|
+
: {}),
|
|
124
|
+
...(args.includeImpactDiagnostics !== undefined
|
|
125
|
+
? { includeImpactDiagnostics: args.includeImpactDiagnostics }
|
|
126
|
+
: {}),
|
|
127
|
+
...(args.maxDiagnostics !== undefined
|
|
128
|
+
? { maxDiagnostics: args.maxDiagnostics }
|
|
129
|
+
: {}),
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
// implements REQ-mcp-tool-check
|
|
134
|
+
export function qualityDiagnosticsFromImpact(
|
|
135
|
+
impactResult: ChangedFileImpactResult | undefined,
|
|
136
|
+
): readonly QualityDiagnostic[] {
|
|
137
|
+
if (impactResult === undefined) return [];
|
|
138
|
+
return impactResult.impactDiagnostics.filter(
|
|
139
|
+
(d) => !d.blocking && d.severity !== "error",
|
|
140
|
+
);
|
|
141
|
+
}
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import {
|
|
2
|
+
escapeAtomContent,
|
|
3
|
+
parseEntityFromBinding,
|
|
4
|
+
parseEntityFromList,
|
|
5
|
+
parseListOfLists,
|
|
6
|
+
} from "../../prolog/codec.js";
|
|
7
|
+
import type { PrologPort } from "./runtime-types.js";
|
|
8
|
+
|
|
9
|
+
export type EntityQueryInput = {
|
|
10
|
+
readonly type?: string;
|
|
11
|
+
readonly id?: string;
|
|
12
|
+
readonly tags?: readonly string[];
|
|
13
|
+
readonly sourceFile?: string;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export const VALID_ENTITY_TYPES = [
|
|
17
|
+
"req",
|
|
18
|
+
"scenario",
|
|
19
|
+
"test",
|
|
20
|
+
"adr",
|
|
21
|
+
"flag",
|
|
22
|
+
"event",
|
|
23
|
+
"symbol",
|
|
24
|
+
"fact",
|
|
25
|
+
] as const;
|
|
26
|
+
|
|
27
|
+
// implements REQ-002, REQ-013
|
|
28
|
+
export function validateEntityType(type?: string): void {
|
|
29
|
+
if (type && !VALID_ENTITY_TYPES.some((candidate) => candidate === type)) {
|
|
30
|
+
throw new Error(
|
|
31
|
+
`Invalid type '${type}'. Valid types: ${VALID_ENTITY_TYPES.join(", ")}. Use a single type value, or omit this parameter to query all entities.`,
|
|
32
|
+
);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
// implements REQ-002, REQ-013
|
|
37
|
+
export function buildEntityGoal(input: EntityQueryInput): string {
|
|
38
|
+
const { type, id, tags, sourceFile } = input;
|
|
39
|
+
if (sourceFile) {
|
|
40
|
+
const safeSource = escapeAtomContent(sourceFile);
|
|
41
|
+
if (type) {
|
|
42
|
+
const safeType = escapeAtomContent(type);
|
|
43
|
+
return `findall([Id,'${safeType}',Props], (kb_entities_by_source('${safeSource}', SourceIds), member(Id, SourceIds), kb_entity(Id, '${safeType}', Props)), Results)`;
|
|
44
|
+
}
|
|
45
|
+
return `findall([Id,Type,Props], (kb_entities_by_source('${safeSource}', SourceIds), member(Id, SourceIds), kb_entity(Id, Type, Props)), Results)`;
|
|
46
|
+
}
|
|
47
|
+
if (id && type) {
|
|
48
|
+
const safeId = escapeAtomContent(id);
|
|
49
|
+
const safeType = escapeAtomContent(type);
|
|
50
|
+
return `findall(['${safeId}','${safeType}',Props], kb_entity('${safeId}', '${safeType}', Props), Results)`;
|
|
51
|
+
}
|
|
52
|
+
if (id) {
|
|
53
|
+
const safeId = escapeAtomContent(id);
|
|
54
|
+
return `findall(['${safeId}',Type,Props], kb_entity('${safeId}', Type, Props), Results)`;
|
|
55
|
+
}
|
|
56
|
+
if (tags && tags.length > 0) {
|
|
57
|
+
if (type) {
|
|
58
|
+
const safeType = escapeAtomContent(type);
|
|
59
|
+
return `findall([Id,'${safeType}',Props], kb_entity(Id, '${safeType}', Props), Results)`;
|
|
60
|
+
}
|
|
61
|
+
return "findall([Id,Type,Props], kb_entity(Id, Type, Props), Results)";
|
|
62
|
+
}
|
|
63
|
+
if (type) {
|
|
64
|
+
const safeType = escapeAtomContent(type);
|
|
65
|
+
return `findall([Id,'${safeType}',Props], kb_entity(Id, '${safeType}', Props), Results)`;
|
|
66
|
+
}
|
|
67
|
+
return "findall([Id,Type,Props], kb_entity(Id, Type, Props), Results)";
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
// implements REQ-002, REQ-013
|
|
71
|
+
export async function loadEntities(
|
|
72
|
+
prolog: Pick<PrologPort, "query">,
|
|
73
|
+
input: EntityQueryInput,
|
|
74
|
+
): Promise<Record<string, unknown>[]> {
|
|
75
|
+
validateEntityType(input.type);
|
|
76
|
+
const queryResult = await prolog.query(buildEntityGoal(input));
|
|
77
|
+
if (!queryResult.success) {
|
|
78
|
+
throw new Error(queryResult.error || "Query failed with unknown error");
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
let entities: Record<string, unknown>[] = [];
|
|
82
|
+
const resultsBinding = queryResult.bindings.Results;
|
|
83
|
+
const resultBinding = queryResult.bindings.Result;
|
|
84
|
+
if (resultsBinding) {
|
|
85
|
+
entities = parseListOfLists(resultsBinding).map(parseEntityFromList);
|
|
86
|
+
} else if (resultBinding) {
|
|
87
|
+
entities = [parseEntityFromBinding(resultBinding)];
|
|
88
|
+
}
|
|
89
|
+
if (input.tags && input.tags.length > 0) {
|
|
90
|
+
const requested = new Set(input.tags.map((tag) => tag.trim()));
|
|
91
|
+
entities = entities.filter((entity) => {
|
|
92
|
+
const tags = entity.tags;
|
|
93
|
+
return (
|
|
94
|
+
Array.isArray(tags) &&
|
|
95
|
+
tags.some((tag) => requested.has(String(tag).trim()))
|
|
96
|
+
);
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
return dedupeEntities(entities);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
// implements REQ-002
|
|
103
|
+
export function paginateResults<T>(
|
|
104
|
+
results: readonly T[],
|
|
105
|
+
limit = 100,
|
|
106
|
+
offset = 0,
|
|
107
|
+
): T[] {
|
|
108
|
+
return results.slice(offset, offset + limit);
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
// implements REQ-002
|
|
112
|
+
export function dedupeEntities(
|
|
113
|
+
entities: readonly Record<string, unknown>[],
|
|
114
|
+
): Record<string, unknown>[] {
|
|
115
|
+
const seen = new Set<string>();
|
|
116
|
+
return entities.filter((entity) => {
|
|
117
|
+
const key = `${String(entity.type ?? "")}::${String(entity.id ?? "")}`;
|
|
118
|
+
if (seen.has(key)) return false;
|
|
119
|
+
seen.add(key);
|
|
120
|
+
return true;
|
|
121
|
+
});
|
|
122
|
+
}
|