kibi-cli 0.12.8 → 0.16.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/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 -210
- 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 +2 -1
- package/dist/commands/check.d.ts.map +1 -1
- package/dist/commands/check.js +145 -152
- package/dist/commands/coverage.d.ts.map +1 -1
- package/dist/commands/coverage.js +12 -17
- package/dist/commands/discovery-shared.d.ts +3 -1
- package/dist/commands/discovery-shared.d.ts.map +1 -1
- package/dist/commands/discovery-shared.js +8 -209
- package/dist/commands/discovery-table.d.ts +3 -0
- package/dist/commands/discovery-table.d.ts.map +1 -0
- package/dist/commands/discovery-table.js +204 -0
- 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/discovery.d.ts.map +1 -1
- package/dist/commands/sync/discovery.js +8 -1
- package/dist/commands/sync/extraction.d.ts +6 -1
- package/dist/commands/sync/extraction.d.ts.map +1 -1
- package/dist/commands/sync/extraction.js +7 -3
- package/dist/commands/sync/manifest.d.ts +1 -1
- package/dist/commands/sync/manifest.d.ts.map +1 -1
- package/dist/commands/sync/manifest.js +9 -17
- package/dist/commands/sync/persistence.d.ts.map +1 -1
- package/dist/commands/sync/persistence.js +51 -2
- package/dist/extractors/manifest.d.ts.map +1 -1
- package/dist/extractors/manifest.js +18 -0
- package/dist/extractors/markdown.d.ts +20 -2
- package/dist/extractors/markdown.d.ts.map +1 -1
- package/dist/extractors/markdown.js +38 -1
- package/dist/extractors/symbols-coordinator.d.ts +1 -1
- package/dist/extractors/symbols-coordinator.d.ts.map +1 -1
- package/dist/extractors/symbols-ts.d.ts.map +1 -1
- package/dist/extractors/symbols-ts.js +73 -1
- 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/model-requirement.d.ts +10 -0
- package/dist/operations/modeling/model-requirement.d.ts.map +1 -0
- package/dist/operations/modeling/model-requirement.js +108 -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 +104 -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 +148 -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 +88 -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 +24 -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 +61 -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 +49 -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 +134 -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 +85 -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 +67 -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 +112 -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 +271 -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 +19 -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 +18 -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 +135 -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 +9 -2
- package/dist/prolog.d.ts +5 -0
- package/dist/prolog.d.ts.map +1 -1
- package/dist/prolog.js +82 -30
- package/dist/public/impact/analyzer.d.ts +3 -0
- package/dist/public/impact/analyzer.d.ts.map +1 -0
- package/dist/public/impact/analyzer.js +54 -0
- package/dist/public/impact/coverage-depth-quality.d.ts +4 -0
- package/dist/public/impact/coverage-depth-quality.d.ts.map +1 -0
- package/dist/public/impact/coverage-depth-quality.js +179 -0
- package/dist/public/impact/diagnostics.d.ts +7 -0
- package/dist/public/impact/diagnostics.d.ts.map +1 -0
- package/dist/public/impact/diagnostics.js +126 -0
- package/dist/public/impact/diff-meaning.d.ts +2 -0
- package/dist/public/impact/diff-meaning.d.ts.map +1 -0
- package/dist/public/impact/diff-meaning.js +101 -0
- package/dist/public/impact/full-kb-quality.d.ts +10 -0
- package/dist/public/impact/full-kb-quality.d.ts.map +1 -0
- package/dist/public/impact/full-kb-quality.js +191 -0
- package/dist/public/impact/manifest.d.ts +5 -0
- package/dist/public/impact/manifest.d.ts.map +1 -0
- package/dist/public/impact/manifest.js +43 -0
- package/dist/public/impact/requirement-quality.d.ts +4 -0
- package/dist/public/impact/requirement-quality.d.ts.map +1 -0
- package/dist/public/impact/requirement-quality.js +199 -0
- package/dist/public/impact/source-changes.d.ts +5 -0
- package/dist/public/impact/source-changes.d.ts.map +1 -0
- package/dist/public/impact/source-changes.js +129 -0
- package/dist/public/impact/summaries.d.ts +6 -0
- package/dist/public/impact/summaries.d.ts.map +1 -0
- package/dist/public/impact/summaries.js +68 -0
- package/dist/public/impact/symbol-quality-model.d.ts +21 -0
- package/dist/public/impact/symbol-quality-model.d.ts.map +1 -0
- package/dist/public/impact/symbol-quality-model.js +116 -0
- package/dist/public/impact/symbol-quality.d.ts +4 -0
- package/dist/public/impact/symbol-quality.d.ts.map +1 -0
- package/dist/public/impact/symbol-quality.js +159 -0
- package/dist/public/impact/types.d.ts +79 -0
- package/dist/public/impact/types.d.ts.map +1 -0
- package/dist/public/impact/types.js +1 -0
- package/dist/public/impact-diagnostics.d.ts +7 -0
- package/dist/public/impact-diagnostics.d.ts.map +1 -0
- package/dist/public/impact-diagnostics.js +5 -0
- package/dist/public/operations/catalog.d.ts +907 -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 +20 -0
- package/dist/public/operations/index.d.ts.map +1 -0
- package/dist/public/operations/index.js +18 -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 +62 -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 +126 -0
- package/dist/public/operations/specs/modeling.d.ts.map +1 -0
- package/dist/public/operations/specs/modeling.js +117 -0
- package/dist/public/operations/specs/mutation-schemas.d.ts +233 -0
- package/dist/public/operations/specs/mutation-schemas.d.ts.map +1 -0
- package/dist/public/operations/specs/mutation-schemas.js +267 -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 +53 -0
- package/dist/public/operations/specs/semantic.d.ts.map +1 -0
- package/dist/public/operations/specs/semantic.js +105 -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 +256 -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 +48 -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 +123 -95
- package/dist/public/skills/kibi-usage/resources/fact-lanes.md +107 -5
- package/dist/public/skills/kibi-usage/resources/operation-access.md +44 -0
- package/dist/public/skills/kibi-usage/resources/relationship-directions.md +30 -0
- package/dist/public/skills/kibi-usage/resources/workflows.md +40 -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 +1 -1
- package/dist/public/symbol-granularity.d.ts.map +1 -1
- package/dist/public/symbol-granularity.js +2 -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 +23 -0
- package/dist/traceability/evidence-model.d.ts +1 -1
- package/dist/traceability/evidence-model.d.ts.map +1 -1
- package/dist/traceability/evidence-model.js +1 -1
- package/dist/traceability/staged-diagnostics.d.ts +6 -6
- package/dist/traceability/staged-diagnostics.d.ts.map +1 -1
- package/dist/traceability/staged-diagnostics.js +12 -6
- 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 +60 -27
- package/dist/traceability/symbol-extract.d.ts.map +1 -1
- package/dist/traceability/symbol-extract.js +58 -1
- package/dist/traceability/temp-kb.d.ts.map +1 -1
- package/dist/traceability/temp-kb.js +34 -1
- package/dist/types/entities.d.ts +8 -1
- package/dist/types/entities.d.ts.map +1 -1
- package/dist/utils/prolog-query-plan-safety.d.ts +8 -0
- package/dist/utils/prolog-query-plan-safety.d.ts.map +1 -0
- package/dist/utils/prolog-query-plan-safety.js +47 -0
- package/dist/utils/rule-registry.d.ts.map +1 -1
- package/dist/utils/rule-registry.js +18 -0
- package/package.json +60 -2
- package/schema/entities.pl +4 -0
- package/src/public/impact/analyzer.ts +90 -0
- package/src/public/impact/coverage-depth-quality.ts +268 -0
- package/src/public/impact/diagnostics.ts +199 -0
- package/src/public/impact/diff-meaning.ts +121 -0
- package/src/public/impact/full-kb-quality.ts +230 -0
- package/src/public/impact/manifest.ts +57 -0
- package/src/public/impact/requirement-quality.ts +262 -0
- package/src/public/impact/source-changes.ts +180 -0
- package/src/public/impact/summaries.ts +100 -0
- package/src/public/impact/symbol-quality-model.ts +171 -0
- package/src/public/impact/symbol-quality.ts +207 -0
- package/src/public/impact/types.ts +99 -0
- package/src/public/impact-diagnostics.ts +22 -0
- 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 +19 -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 +72 -0
- package/src/public/operations/specs/discovery.ts +126 -0
- package/src/public/operations/specs/modeling.ts +154 -0
- package/src/public/operations/specs/mutation-schemas.ts +296 -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 +135 -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 +50 -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 +123 -95
- package/src/public/skills/kibi-usage/resources/fact-lanes.md +107 -5
- package/src/public/skills/kibi-usage/resources/operation-access.md +44 -0
- package/src/public/skills/kibi-usage/resources/relationship-directions.md +30 -0
- package/src/public/skills/kibi-usage/resources/workflows.md +40 -3
- package/src/public/skills.ts +18 -427
- package/src/public/symbol-granularity.ts +4 -0
- package/src/schemas/entity.schema.json +23 -0
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
import { execSync } from "node:child_process";
|
|
2
|
+
import { existsSync, readFileSync } from "node:fs";
|
|
3
|
+
import * as path from "node:path";
|
|
4
|
+
import type { HunkRange } from "../../traceability/git-staged.js";
|
|
5
|
+
import {
|
|
6
|
+
getStagedFiles,
|
|
7
|
+
parseHunksFromDiff,
|
|
8
|
+
} from "../../traceability/git-staged.js";
|
|
9
|
+
import { hasMeaningfulSourceDiff } from "./diff-meaning.js";
|
|
10
|
+
import type { ChangedFileImpactOptions, SourceChange } from "./types.js";
|
|
11
|
+
|
|
12
|
+
const SOURCE_EXTENSIONS = new Set([
|
|
13
|
+
".ts",
|
|
14
|
+
".tsx",
|
|
15
|
+
".js",
|
|
16
|
+
".jsx",
|
|
17
|
+
".mts",
|
|
18
|
+
".cts",
|
|
19
|
+
".mjs",
|
|
20
|
+
".cjs",
|
|
21
|
+
]);
|
|
22
|
+
|
|
23
|
+
function isSupportedSourcePath(filePath: string): boolean {
|
|
24
|
+
return SOURCE_EXTENSIONS.has(path.extname(filePath));
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export function normalizeSourceFile(
|
|
28
|
+
workspaceRoot: string,
|
|
29
|
+
sourceFile: string,
|
|
30
|
+
): string {
|
|
31
|
+
const relativePath = path.isAbsolute(sourceFile)
|
|
32
|
+
? path.relative(workspaceRoot, sourceFile)
|
|
33
|
+
: sourceFile;
|
|
34
|
+
return relativePath.split(path.sep).join("/");
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export function uniqueSorted(values: Iterable<string>): string[] {
|
|
38
|
+
return [...new Set(values)].sort();
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
function escapeGitPath(filePath: string): string {
|
|
42
|
+
return filePath.replace(/\\/g, "\\\\").replace(/"/g, '\\"');
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
function runGit(workspaceRoot: string, command: string): string {
|
|
46
|
+
return execSync(command, { cwd: workspaceRoot, encoding: "utf8" });
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
function readWorkingTreeSource(
|
|
50
|
+
workspaceRoot: string,
|
|
51
|
+
sourceFile: string,
|
|
52
|
+
): string | null {
|
|
53
|
+
const absolutePath = path.resolve(workspaceRoot, sourceFile);
|
|
54
|
+
if (!existsSync(absolutePath)) return null;
|
|
55
|
+
return readFileSync(absolutePath, "utf8");
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
function fullFileHunk(content: string): HunkRange[] {
|
|
59
|
+
return [{ start: 1, end: Math.max(1, content.split(/\r?\n/).length) }];
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
function getWorkingTreeDiffSourceFiles(workspaceRoot: string): string[] {
|
|
63
|
+
try {
|
|
64
|
+
return uniqueSorted(
|
|
65
|
+
runGit(workspaceRoot, "git diff --name-only --diff-filter=ACMR")
|
|
66
|
+
.split(/\r?\n/)
|
|
67
|
+
.map((filePath) => normalizeSourceFile(workspaceRoot, filePath.trim()))
|
|
68
|
+
.filter((filePath) => filePath.length > 0)
|
|
69
|
+
.filter(isSupportedSourcePath),
|
|
70
|
+
);
|
|
71
|
+
} catch {
|
|
72
|
+
return [];
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
function getWorkingTreeHunks(
|
|
77
|
+
workspaceRoot: string,
|
|
78
|
+
sourceFile: string,
|
|
79
|
+
): HunkRange[] {
|
|
80
|
+
try {
|
|
81
|
+
const diffText = runGit(
|
|
82
|
+
workspaceRoot,
|
|
83
|
+
`git diff -U0 -- "${escapeGitPath(sourceFile)}"`,
|
|
84
|
+
);
|
|
85
|
+
return parseHunksFromDiff(diffText);
|
|
86
|
+
} catch {
|
|
87
|
+
return [];
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
function getStagedSourceChanges(
|
|
92
|
+
workspaceRoot: string,
|
|
93
|
+
sourceFileFilter: ReadonlySet<string>,
|
|
94
|
+
): SourceChange[] {
|
|
95
|
+
const stagedFiles = getStagedFiles((command, options) =>
|
|
96
|
+
execSync(command, { ...options, cwd: workspaceRoot }),
|
|
97
|
+
);
|
|
98
|
+
|
|
99
|
+
return stagedFiles
|
|
100
|
+
.filter((file) => isSupportedSourcePath(file.path))
|
|
101
|
+
.filter(
|
|
102
|
+
(file) => sourceFileFilter.size === 0 || sourceFileFilter.has(file.path),
|
|
103
|
+
)
|
|
104
|
+
.flatMap((file): SourceChange[] => {
|
|
105
|
+
if (file.content === undefined || file.hunkRanges.length === 0) return [];
|
|
106
|
+
if (
|
|
107
|
+
file.diffText !== undefined &&
|
|
108
|
+
!hasMeaningfulSourceDiff(file.diffText)
|
|
109
|
+
) {
|
|
110
|
+
return [];
|
|
111
|
+
}
|
|
112
|
+
return [
|
|
113
|
+
{
|
|
114
|
+
file: file.path,
|
|
115
|
+
status: file.status,
|
|
116
|
+
hunkRanges: file.hunkRanges,
|
|
117
|
+
content: file.content,
|
|
118
|
+
},
|
|
119
|
+
];
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
function getWorkingTreeSourceChanges(
|
|
124
|
+
workspaceRoot: string,
|
|
125
|
+
sourceFileFilter: ReadonlySet<string>,
|
|
126
|
+
): SourceChange[] {
|
|
127
|
+
const sourceFiles =
|
|
128
|
+
sourceFileFilter.size > 0
|
|
129
|
+
? [...sourceFileFilter]
|
|
130
|
+
: getWorkingTreeDiffSourceFiles(workspaceRoot);
|
|
131
|
+
|
|
132
|
+
return sourceFiles.flatMap((sourceFile): SourceChange[] => {
|
|
133
|
+
const content = readWorkingTreeSource(workspaceRoot, sourceFile);
|
|
134
|
+
if (content === null) return [];
|
|
135
|
+
const diffText = runGit(
|
|
136
|
+
workspaceRoot,
|
|
137
|
+
`git diff -U0 -- "${escapeGitPath(sourceFile)}"`,
|
|
138
|
+
);
|
|
139
|
+
if (!hasMeaningfulSourceDiff(diffText)) return [];
|
|
140
|
+
const hunkRanges = getWorkingTreeHunks(workspaceRoot, sourceFile);
|
|
141
|
+
if (hunkRanges.length === 0) return [];
|
|
142
|
+
return [{ file: sourceFile, status: "M", hunkRanges, content }];
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
function getExplicitSourceChanges(
|
|
147
|
+
workspaceRoot: string,
|
|
148
|
+
sourceFileFilter: ReadonlySet<string>,
|
|
149
|
+
): SourceChange[] {
|
|
150
|
+
return [...sourceFileFilter].flatMap((sourceFile): SourceChange[] => {
|
|
151
|
+
const content = readWorkingTreeSource(workspaceRoot, sourceFile);
|
|
152
|
+
if (content === null) return [];
|
|
153
|
+
return [
|
|
154
|
+
{
|
|
155
|
+
file: sourceFile,
|
|
156
|
+
status: "M",
|
|
157
|
+
hunkRanges: fullFileHunk(content),
|
|
158
|
+
content,
|
|
159
|
+
},
|
|
160
|
+
];
|
|
161
|
+
});
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
export function collectSourceChanges(
|
|
165
|
+
options: ChangedFileImpactOptions,
|
|
166
|
+
): SourceChange[] {
|
|
167
|
+
const workspaceRoot = path.resolve(options.workspaceRoot);
|
|
168
|
+
const sourceFileFilter = new Set(
|
|
169
|
+
(options.sourceFiles ?? [])
|
|
170
|
+
.map((sourceFile) => normalizeSourceFile(workspaceRoot, sourceFile))
|
|
171
|
+
.filter(isSupportedSourcePath),
|
|
172
|
+
);
|
|
173
|
+
|
|
174
|
+
if (options.staged)
|
|
175
|
+
return getStagedSourceChanges(workspaceRoot, sourceFileFilter);
|
|
176
|
+
if (options.includeWorkingTreeDiff) {
|
|
177
|
+
return getWorkingTreeSourceChanges(workspaceRoot, sourceFileFilter);
|
|
178
|
+
}
|
|
179
|
+
return getExplicitSourceChanges(workspaceRoot, sourceFileFilter);
|
|
180
|
+
}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import type { ExtractionResult } from "../../extractors/markdown.js";
|
|
2
|
+
import type { ExtractedSymbol } from "../../traceability/symbol-extract.js";
|
|
3
|
+
import { isTraceabilityRelationshipType } from "../symbol-granularity.js";
|
|
4
|
+
import { uniqueSorted } from "./source-changes.js";
|
|
5
|
+
import type {
|
|
6
|
+
ImpactExtractedSymbol,
|
|
7
|
+
ImpactLinkedEntity,
|
|
8
|
+
SymbolsByFile,
|
|
9
|
+
} from "./types.js";
|
|
10
|
+
|
|
11
|
+
function linkedEntityIdsFor(symbol: ExtractedSymbol): string[] {
|
|
12
|
+
return uniqueSorted(
|
|
13
|
+
(symbol.relationships ?? [])
|
|
14
|
+
.filter((relationship) =>
|
|
15
|
+
isTraceabilityRelationshipType(relationship.type),
|
|
16
|
+
)
|
|
17
|
+
.map((relationship) => relationship.to),
|
|
18
|
+
);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export function formatExtractedSymbols(
|
|
22
|
+
symbolsByFile: SymbolsByFile,
|
|
23
|
+
): ImpactExtractedSymbol[] {
|
|
24
|
+
return [...symbolsByFile.values()]
|
|
25
|
+
.flatMap((symbols) => [...symbols])
|
|
26
|
+
.map((symbol) => ({
|
|
27
|
+
id: symbol.id,
|
|
28
|
+
name: symbol.name,
|
|
29
|
+
kind: symbol.kind,
|
|
30
|
+
role: symbol.role,
|
|
31
|
+
location: symbol.location,
|
|
32
|
+
hunkRanges: symbol.hunkRanges,
|
|
33
|
+
linkedEntityIds: linkedEntityIdsFor(symbol),
|
|
34
|
+
}))
|
|
35
|
+
.sort((left, right) => left.name.localeCompare(right.name));
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export function collectLinkedEntities(
|
|
39
|
+
symbolsByFile: SymbolsByFile,
|
|
40
|
+
manifestResults: readonly ExtractionResult[],
|
|
41
|
+
activeSourceFiles: ReadonlySet<string>,
|
|
42
|
+
): ImpactLinkedEntity[] {
|
|
43
|
+
const linkedEntities = new Map<string, ImpactLinkedEntity>();
|
|
44
|
+
const add = (entity: ImpactLinkedEntity): void => {
|
|
45
|
+
linkedEntities.set(
|
|
46
|
+
`${entity.sourceSymbolId}:${entity.relationshipType}:${entity.id}`,
|
|
47
|
+
entity,
|
|
48
|
+
);
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
for (const symbols of symbolsByFile.values()) {
|
|
52
|
+
for (const symbol of symbols) {
|
|
53
|
+
for (const relationship of symbol.relationships ?? []) {
|
|
54
|
+
if (!isTraceabilityRelationshipType(relationship.type)) continue;
|
|
55
|
+
add({
|
|
56
|
+
id: relationship.to,
|
|
57
|
+
relationshipType: relationship.type,
|
|
58
|
+
sourceSymbolId: symbol.id,
|
|
59
|
+
sourceSymbolName: symbol.name,
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
for (const result of manifestResults) {
|
|
66
|
+
if (
|
|
67
|
+
result.sourceFile === undefined ||
|
|
68
|
+
!activeSourceFiles.has(result.sourceFile)
|
|
69
|
+
) {
|
|
70
|
+
continue;
|
|
71
|
+
}
|
|
72
|
+
for (const relationship of result.relationships) {
|
|
73
|
+
if (!isTraceabilityRelationshipType(relationship.type)) continue;
|
|
74
|
+
add({
|
|
75
|
+
id: relationship.to,
|
|
76
|
+
relationshipType: relationship.type,
|
|
77
|
+
sourceSymbolId: result.entity.id,
|
|
78
|
+
sourceSymbolName: result.entity.title,
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
return [...linkedEntities.values()].sort((left, right) =>
|
|
84
|
+
left.id.localeCompare(right.id),
|
|
85
|
+
);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
export function buildNextActions(sourceFiles: readonly string[]): string[] {
|
|
89
|
+
if (sourceFiles.length === 0) return [];
|
|
90
|
+
|
|
91
|
+
return [
|
|
92
|
+
`kb_search({ query: "${sourceFiles.join(" ")}" }) to discover requirements/tests that may describe the changed behavior.`,
|
|
93
|
+
...sourceFiles.map(
|
|
94
|
+
(sourceFile) =>
|
|
95
|
+
`kb_query({ sourceFile: "${sourceFile}" }) to inspect exact source-linked Kibi entities before deciding whether requirements/tests need updates.`,
|
|
96
|
+
),
|
|
97
|
+
"Update narrower symbols, requirements, tests, or strict facts when diagnostics show broad or stale modeling.",
|
|
98
|
+
"rerun kb_check with the same sourceFiles/impact options after Kibi updates.",
|
|
99
|
+
];
|
|
100
|
+
}
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
import type { ExtractionResult } from "../../extractors/markdown.js";
|
|
2
|
+
import type { ExtractedSymbol } from "../../traceability/symbol-extract.js";
|
|
3
|
+
import {
|
|
4
|
+
type SymbolKind,
|
|
5
|
+
type SymbolRole,
|
|
6
|
+
getSymbolRole,
|
|
7
|
+
} from "../symbol-granularity.js";
|
|
8
|
+
import type { SymbolQualityDiagnosticsOptions } from "./types.js";
|
|
9
|
+
|
|
10
|
+
export type SymbolMetadata = {
|
|
11
|
+
readonly result: ExtractionResult;
|
|
12
|
+
readonly id: string;
|
|
13
|
+
readonly title: string;
|
|
14
|
+
readonly sourceFile: string;
|
|
15
|
+
readonly source: string;
|
|
16
|
+
readonly kind: SymbolKind | "component" | "service" | "module" | "config";
|
|
17
|
+
readonly role: SymbolRole;
|
|
18
|
+
readonly requirementTargetIds: readonly string[];
|
|
19
|
+
readonly coordinateKey: string | null;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export const AGGREGATE_KINDS: ReadonlySet<string> = new Set([
|
|
23
|
+
"class",
|
|
24
|
+
"component",
|
|
25
|
+
"service",
|
|
26
|
+
"module",
|
|
27
|
+
]);
|
|
28
|
+
|
|
29
|
+
function isActiveSymbol(result: ExtractionResult): boolean {
|
|
30
|
+
return result.entity.type === "symbol" && result.entity.status === "active";
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
function getRequirementTargets(result: ExtractionResult): readonly string[] {
|
|
34
|
+
return [
|
|
35
|
+
...new Set(
|
|
36
|
+
result.relationships
|
|
37
|
+
.filter(
|
|
38
|
+
(relationship) =>
|
|
39
|
+
relationship.type === "implements" &&
|
|
40
|
+
relationship.to.startsWith("REQ-"),
|
|
41
|
+
)
|
|
42
|
+
.map((relationship) => relationship.to),
|
|
43
|
+
),
|
|
44
|
+
].sort();
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
function inferKind(result: ExtractionResult): SymbolMetadata["kind"] {
|
|
48
|
+
const explicitKind = result.entity.symbol_kind;
|
|
49
|
+
if (
|
|
50
|
+
explicitKind === "component" ||
|
|
51
|
+
explicitKind === "service" ||
|
|
52
|
+
explicitKind === "module" ||
|
|
53
|
+
explicitKind === "config"
|
|
54
|
+
) {
|
|
55
|
+
return explicitKind;
|
|
56
|
+
}
|
|
57
|
+
if (
|
|
58
|
+
explicitKind === "function" ||
|
|
59
|
+
explicitKind === "class" ||
|
|
60
|
+
explicitKind === "method" ||
|
|
61
|
+
explicitKind === "property" ||
|
|
62
|
+
explicitKind === "accessor" ||
|
|
63
|
+
explicitKind === "interface" ||
|
|
64
|
+
explicitKind === "type" ||
|
|
65
|
+
explicitKind === "variable" ||
|
|
66
|
+
explicitKind === "enum" ||
|
|
67
|
+
explicitKind === "unknown"
|
|
68
|
+
) {
|
|
69
|
+
return explicitKind;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
if (result.entity.title.endsWith("Component")) return "component";
|
|
73
|
+
if (result.entity.title.endsWith("Service")) return "service";
|
|
74
|
+
if (result.entity.title.endsWith("Module")) return "module";
|
|
75
|
+
if (result.entity.title.endsWith("Config")) return "config";
|
|
76
|
+
if (result.entity.title.includes(".")) return "method";
|
|
77
|
+
return "unknown";
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
function inferRole(
|
|
81
|
+
result: ExtractionResult,
|
|
82
|
+
kind: SymbolMetadata["kind"],
|
|
83
|
+
): SymbolRole {
|
|
84
|
+
const explicitRole = result.entity.symbol_role;
|
|
85
|
+
if (
|
|
86
|
+
explicitRole === "behavioral" ||
|
|
87
|
+
explicitRole === "structural" ||
|
|
88
|
+
explicitRole === "type-shape" ||
|
|
89
|
+
explicitRole === "config" ||
|
|
90
|
+
explicitRole === "module" ||
|
|
91
|
+
explicitRole === "unknown"
|
|
92
|
+
) {
|
|
93
|
+
return explicitRole;
|
|
94
|
+
}
|
|
95
|
+
if (kind === "component" || kind === "service") return "behavioral";
|
|
96
|
+
if (kind === "module") return "module";
|
|
97
|
+
if (kind === "config") return "config";
|
|
98
|
+
return getSymbolRole({ name: result.entity.title, kind });
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
function getCoordinateKey(result: ExtractionResult): string | null {
|
|
102
|
+
const { sourceLine, sourceColumn, sourceEndLine, sourceEndColumn } =
|
|
103
|
+
result.entity;
|
|
104
|
+
if (
|
|
105
|
+
sourceLine === undefined ||
|
|
106
|
+
sourceColumn === undefined ||
|
|
107
|
+
sourceEndLine === undefined ||
|
|
108
|
+
sourceEndColumn === undefined
|
|
109
|
+
) {
|
|
110
|
+
return null;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
return `${sourceLine}:${sourceColumn}:${sourceEndLine}:${sourceEndColumn}`;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
export function collectSymbols(
|
|
117
|
+
options: SymbolQualityDiagnosticsOptions,
|
|
118
|
+
): readonly SymbolMetadata[] {
|
|
119
|
+
return options.manifestResults
|
|
120
|
+
.filter((result) =>
|
|
121
|
+
options.activeEntityIds === undefined
|
|
122
|
+
? isActiveSymbol(result)
|
|
123
|
+
: isActiveSymbol(result) &&
|
|
124
|
+
options.activeEntityIds.has(result.entity.id),
|
|
125
|
+
)
|
|
126
|
+
.flatMap((result) => {
|
|
127
|
+
if (result.sourceFile === undefined) return [];
|
|
128
|
+
const kind = inferKind(result);
|
|
129
|
+
return [
|
|
130
|
+
{
|
|
131
|
+
result,
|
|
132
|
+
id: result.entity.id,
|
|
133
|
+
title: result.entity.title,
|
|
134
|
+
sourceFile: result.sourceFile,
|
|
135
|
+
source: result.entity.source,
|
|
136
|
+
kind,
|
|
137
|
+
role: inferRole(result, kind),
|
|
138
|
+
requirementTargetIds: getRequirementTargets(result),
|
|
139
|
+
coordinateKey: getCoordinateKey(result),
|
|
140
|
+
},
|
|
141
|
+
];
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
export function isModuleOrConfig(symbol: SymbolMetadata): boolean {
|
|
146
|
+
return symbol.role === "module" || symbol.role === "config";
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
export function narrowerManifestSymbols(
|
|
150
|
+
symbol: SymbolMetadata,
|
|
151
|
+
symbols: readonly SymbolMetadata[],
|
|
152
|
+
): readonly SymbolMetadata[] {
|
|
153
|
+
return symbols.filter(
|
|
154
|
+
(candidate) =>
|
|
155
|
+
candidate.id !== symbol.id &&
|
|
156
|
+
candidate.sourceFile === symbol.sourceFile &&
|
|
157
|
+
candidate.title.startsWith(`${symbol.title}.`),
|
|
158
|
+
);
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
export function narrowerExtractedSymbols(
|
|
162
|
+
symbol: SymbolMetadata,
|
|
163
|
+
symbolsByFile: ReadonlyMap<string, readonly ExtractedSymbol[]>,
|
|
164
|
+
): readonly ExtractedSymbol[] {
|
|
165
|
+
return (symbolsByFile.get(symbol.sourceFile) ?? []).filter(
|
|
166
|
+
(candidate) =>
|
|
167
|
+
candidate.name !== symbol.title &&
|
|
168
|
+
candidate.name.startsWith(`${symbol.title}.`) &&
|
|
169
|
+
candidate.role === "behavioral",
|
|
170
|
+
);
|
|
171
|
+
}
|
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
import type { ExtractionResult } from "../../extractors/markdown.js";
|
|
2
|
+
import type { KibiImpactDiagnostic } from "../../traceability/staged-diagnostics.js";
|
|
3
|
+
import { isAllowedGranularityReason } from "../symbol-granularity.js";
|
|
4
|
+
import {
|
|
5
|
+
AGGREGATE_KINDS,
|
|
6
|
+
type SymbolMetadata,
|
|
7
|
+
collectSymbols,
|
|
8
|
+
isModuleOrConfig,
|
|
9
|
+
narrowerExtractedSymbols,
|
|
10
|
+
narrowerManifestSymbols,
|
|
11
|
+
} from "./symbol-quality-model.js";
|
|
12
|
+
import type { SymbolQualityDiagnosticsOptions } from "./types.js";
|
|
13
|
+
|
|
14
|
+
function thresholdFor(symbol: SymbolMetadata): number {
|
|
15
|
+
return AGGREGATE_KINDS.has(symbol.kind) ? 4 : 2;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
function isMultiRequirementCandidate(symbol: SymbolMetadata): boolean {
|
|
19
|
+
if (isModuleOrConfig(symbol)) {
|
|
20
|
+
return !isAllowedGranularityReason(symbol.result.entity.granularity_reason);
|
|
21
|
+
}
|
|
22
|
+
return symbol.role === "behavioral";
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
function createMultiRequirementDiagnostics(
|
|
26
|
+
symbols: readonly SymbolMetadata[],
|
|
27
|
+
): readonly KibiImpactDiagnostic[] {
|
|
28
|
+
return symbols.flatMap((symbol) => {
|
|
29
|
+
if (!isMultiRequirementCandidate(symbol)) return [];
|
|
30
|
+
const threshold = thresholdFor(symbol);
|
|
31
|
+
if (symbol.requirementTargetIds.length <= threshold) return [];
|
|
32
|
+
|
|
33
|
+
return [
|
|
34
|
+
{
|
|
35
|
+
id: "multi_requirement_symbol_review",
|
|
36
|
+
severity: "review",
|
|
37
|
+
blocking: false,
|
|
38
|
+
category: "symbol",
|
|
39
|
+
entityId: symbol.id,
|
|
40
|
+
source: symbol.source,
|
|
41
|
+
files: [symbol.source, symbol.sourceFile],
|
|
42
|
+
docs: ["docs/symbol-traceability-taxonomy.md"],
|
|
43
|
+
message: `Symbol ${symbol.id} implements ${symbol.requirementTargetIds.length} requirements, above the ${threshold} target review threshold.`,
|
|
44
|
+
suggestion:
|
|
45
|
+
"Review whether this symbol owns multiple unrelated behaviors; move relationships to narrower behavioral symbols or add a valid granularity_reason when broad ownership is intentional.",
|
|
46
|
+
evidence: {
|
|
47
|
+
targetIds: symbol.requirementTargetIds,
|
|
48
|
+
targetCount: symbol.requirementTargetIds.length,
|
|
49
|
+
threshold,
|
|
50
|
+
symbolKind: symbol.kind,
|
|
51
|
+
symbolRole: symbol.role,
|
|
52
|
+
sourceFile: symbol.sourceFile,
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
];
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
function hasDistinctCoordinates(symbols: readonly SymbolMetadata[]): boolean {
|
|
60
|
+
const coordinateKeys = symbols.map((symbol) => symbol.coordinateKey);
|
|
61
|
+
if (coordinateKeys.some((key) => key === null)) return false;
|
|
62
|
+
return new Set(coordinateKeys).size === coordinateKeys.length;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
function createDuplicateCoordinateDiagnostics(
|
|
66
|
+
symbols: readonly SymbolMetadata[],
|
|
67
|
+
): readonly KibiImpactDiagnostic[] {
|
|
68
|
+
const groups = Map.groupBy(
|
|
69
|
+
symbols,
|
|
70
|
+
(symbol) => `${symbol.sourceFile}\u0000${symbol.title}`,
|
|
71
|
+
);
|
|
72
|
+
|
|
73
|
+
return [...groups.values()].flatMap((group) => {
|
|
74
|
+
if (group.length < 2) return [];
|
|
75
|
+
if (hasDistinctCoordinates(group)) return [];
|
|
76
|
+
const first = group[0];
|
|
77
|
+
if (first === undefined) return [];
|
|
78
|
+
const candidateIds = group.map((symbol) => symbol.id).sort();
|
|
79
|
+
|
|
80
|
+
return [
|
|
81
|
+
{
|
|
82
|
+
id: "duplicate_symbol_coordinate_review",
|
|
83
|
+
severity: "review",
|
|
84
|
+
blocking: false,
|
|
85
|
+
category: "coordinate",
|
|
86
|
+
entityId: first.id,
|
|
87
|
+
source: first.source,
|
|
88
|
+
files: [first.source, first.sourceFile],
|
|
89
|
+
docs: ["docs/symbol-traceability-taxonomy.md"],
|
|
90
|
+
message: `Symbols ${candidateIds.join(", ")} share title ${first.title} and source ${first.sourceFile} without distinct coordinate evidence.`,
|
|
91
|
+
suggestion:
|
|
92
|
+
"Refresh symbol coordinates or rename member-level manifest entries so duplicate modeled symbols are distinguishable after parsing.",
|
|
93
|
+
evidence: {
|
|
94
|
+
candidateIds,
|
|
95
|
+
title: first.title,
|
|
96
|
+
sourceFile: first.sourceFile,
|
|
97
|
+
},
|
|
98
|
+
},
|
|
99
|
+
];
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
function requirementTagsById(
|
|
104
|
+
results: readonly ExtractionResult[],
|
|
105
|
+
): ReadonlyMap<string, readonly string[]> {
|
|
106
|
+
const tagsById = new Map<string, readonly string[]>();
|
|
107
|
+
for (const result of results) {
|
|
108
|
+
if (result.entity.type !== "req") continue;
|
|
109
|
+
tagsById.set(result.entity.id, [...(result.entity.tags ?? [])].sort());
|
|
110
|
+
}
|
|
111
|
+
return tagsById;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
function tagsForTargets(
|
|
115
|
+
targetIds: readonly string[],
|
|
116
|
+
tagsByRequirementId: ReadonlyMap<string, readonly string[]>,
|
|
117
|
+
): readonly string[] {
|
|
118
|
+
return [
|
|
119
|
+
...new Set(
|
|
120
|
+
targetIds.flatMap((targetId) => tagsByRequirementId.get(targetId) ?? []),
|
|
121
|
+
),
|
|
122
|
+
].sort();
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
function hasSharedRequirementTag(
|
|
126
|
+
targetIds: readonly string[],
|
|
127
|
+
tagsByRequirementId: ReadonlyMap<string, readonly string[]>,
|
|
128
|
+
): boolean {
|
|
129
|
+
const tagSets = targetIds
|
|
130
|
+
.map((targetId) => new Set(tagsByRequirementId.get(targetId) ?? []))
|
|
131
|
+
.filter((tagSet) => tagSet.size > 0);
|
|
132
|
+
const first = tagSets[0];
|
|
133
|
+
if (first === undefined || tagSets.length !== targetIds.length) return false;
|
|
134
|
+
return [...first].some((tag) => tagSets.every((tagSet) => tagSet.has(tag)));
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
function isMixedPurposeCandidate(symbol: SymbolMetadata): boolean {
|
|
138
|
+
return AGGREGATE_KINDS.has(symbol.kind) || isModuleOrConfig(symbol);
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
function createMixedPurposeDiagnostics(
|
|
142
|
+
symbols: readonly SymbolMetadata[],
|
|
143
|
+
options: SymbolQualityDiagnosticsOptions,
|
|
144
|
+
): readonly KibiImpactDiagnostic[] {
|
|
145
|
+
const tagsByRequirementId = requirementTagsById(options.manifestResults);
|
|
146
|
+
return symbols.flatMap((symbol) => {
|
|
147
|
+
if (!isMixedPurposeCandidate(symbol)) return [];
|
|
148
|
+
const manifestChildren = narrowerManifestSymbols(symbol, symbols);
|
|
149
|
+
const extractedChildren = narrowerExtractedSymbols(
|
|
150
|
+
symbol,
|
|
151
|
+
options.symbolsByFile,
|
|
152
|
+
);
|
|
153
|
+
if (manifestChildren.length === 0 && extractedChildren.length === 0)
|
|
154
|
+
return [];
|
|
155
|
+
const requirementTags = tagsForTargets(
|
|
156
|
+
symbol.requirementTargetIds,
|
|
157
|
+
tagsByRequirementId,
|
|
158
|
+
);
|
|
159
|
+
if (requirementTags.length < 3) return [];
|
|
160
|
+
if (
|
|
161
|
+
hasSharedRequirementTag(symbol.requirementTargetIds, tagsByRequirementId)
|
|
162
|
+
) {
|
|
163
|
+
return [];
|
|
164
|
+
}
|
|
165
|
+
const narrowerSymbolIds = [
|
|
166
|
+
...new Set([
|
|
167
|
+
...manifestChildren.map((child) => child.id),
|
|
168
|
+
...extractedChildren.map((child) => child.id),
|
|
169
|
+
]),
|
|
170
|
+
].sort();
|
|
171
|
+
|
|
172
|
+
return [
|
|
173
|
+
{
|
|
174
|
+
id: "component_mixed_purpose_review",
|
|
175
|
+
severity: "review",
|
|
176
|
+
blocking: false,
|
|
177
|
+
category: "mixed-purpose",
|
|
178
|
+
entityId: symbol.id,
|
|
179
|
+
source: symbol.source,
|
|
180
|
+
files: [symbol.source, symbol.sourceFile],
|
|
181
|
+
docs: ["docs/symbol-traceability-taxonomy.md"],
|
|
182
|
+
message: `Symbol ${symbol.id} spans unrelated requirement tag clusters while narrower same-file symbols exist.`,
|
|
183
|
+
suggestion:
|
|
184
|
+
"Move unrelated requirement ownership to narrower class members/components/services or split the coarse symbol into cohesive behavioral anchors.",
|
|
185
|
+
evidence: {
|
|
186
|
+
targetIds: symbol.requirementTargetIds,
|
|
187
|
+
requirementTags,
|
|
188
|
+
narrowerSymbolIds,
|
|
189
|
+
sourceFile: symbol.sourceFile,
|
|
190
|
+
symbolKind: symbol.kind,
|
|
191
|
+
symbolRole: symbol.role,
|
|
192
|
+
},
|
|
193
|
+
},
|
|
194
|
+
];
|
|
195
|
+
});
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
export function createSymbolQualityDiagnostics(
|
|
199
|
+
options: SymbolQualityDiagnosticsOptions,
|
|
200
|
+
): KibiImpactDiagnostic[] {
|
|
201
|
+
const symbols = collectSymbols(options);
|
|
202
|
+
return [
|
|
203
|
+
...createMultiRequirementDiagnostics(symbols),
|
|
204
|
+
...createDuplicateCoordinateDiagnostics(symbols),
|
|
205
|
+
...createMixedPurposeDiagnostics(symbols, options),
|
|
206
|
+
];
|
|
207
|
+
}
|