kibi-cli 0.14.0 → 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 -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 +52 -94
- 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 +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 +22 -1
- package/dist/extractors/markdown.d.ts +14 -2
- package/dist/extractors/markdown.d.ts.map +1 -1
- package/dist/extractors/markdown.js +38 -1
- package/dist/extractors/symbols-ts.d.ts.map +1 -1
- package/dist/extractors/symbols-ts.js +11 -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/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 +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 +27 -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 +119 -99
- package/dist/public/skills/kibi-usage/resources/fact-lanes.md +102 -0
- package/dist/public/skills/kibi-usage/resources/operation-access.md +44 -0
- package/dist/public/skills/kibi-usage/resources/workflows.md +26 -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/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/staged-diagnostics.d.ts +1 -1
- package/dist/traceability/staged-diagnostics.d.ts.map +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 +38 -27
- 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 +34 -1
- package/dist/types/entities.d.ts +3 -0
- package/dist/types/entities.d.ts.map +1 -1
- package/dist/utils/rule-registry.d.ts.map +1 -1
- package/dist/utils/rule-registry.js +6 -0
- package/package.json +56 -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 +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 +27 -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 +119 -99
- package/src/public/skills/kibi-usage/resources/fact-lanes.md +102 -0
- package/src/public/skills/kibi-usage/resources/operation-access.md +44 -0
- package/src/public/skills/kibi-usage/resources/workflows.md +26 -3
- package/src/public/skills.ts +18 -427
- package/src/schemas/entity.schema.json +23 -0
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import { normalizeSubjectKey, strictSuggestion, } from "./shared.js";
|
|
2
|
+
import { detectCountStrictSuggestion } from "./strict-count-rules.js";
|
|
3
|
+
function suggestion(payload, match, claim, rationale, confidence, evidence = match[0]) {
|
|
4
|
+
return strictSuggestion(payload, evidence, claim, rationale, confidence);
|
|
5
|
+
}
|
|
6
|
+
// implements REQ-mcp-semantic-advisor-preflight
|
|
7
|
+
export function detectStrictSuggestion(payload, statement) {
|
|
8
|
+
const expiry = statement.match(/^(?<subject>.+?)\s+expir(?:e|es)\s+after\s+(?<value>\d+)\s+(?<unit>days?|months?|years?|hours?|minutes?)\.?$/i);
|
|
9
|
+
if (expiry?.groups?.subject && expiry.groups.value && expiry.groups.unit) {
|
|
10
|
+
const unit = expiry.groups.unit.toLowerCase().replace(/s?$/, "s");
|
|
11
|
+
return suggestion(payload, expiry, {
|
|
12
|
+
subject_key: normalizeSubjectKey(expiry.groups.subject),
|
|
13
|
+
property_key: `expiry_${unit}`,
|
|
14
|
+
operator: "eq",
|
|
15
|
+
value_type: "int",
|
|
16
|
+
value_int: Number(expiry.groups.value),
|
|
17
|
+
unit,
|
|
18
|
+
}, "Expiry duration is a scalar strict property and should be explicit.", 0.88, `expire after ${expiry.groups.value} ${expiry.groups.unit}`);
|
|
19
|
+
}
|
|
20
|
+
const comparative = statement.match(/^(?<subject>.+?)\s+(?:must|shall|should)\s+be\s+(?<operator>less\s+than|greater\s+than|below|above|minimum|maximum|at\s+least|at\s+most)\s+(?<value>\d+)\.?$/i);
|
|
21
|
+
if (comparative?.groups?.subject &&
|
|
22
|
+
comparative.groups.operator &&
|
|
23
|
+
comparative.groups.value) {
|
|
24
|
+
const operatorText = comparative.groups.operator.toLowerCase();
|
|
25
|
+
const operator = /less|below/.test(operatorText)
|
|
26
|
+
? "lt"
|
|
27
|
+
: /greater|above/.test(operatorText)
|
|
28
|
+
? "gt"
|
|
29
|
+
: /minimum|least/.test(operatorText)
|
|
30
|
+
? "gte"
|
|
31
|
+
: "lte";
|
|
32
|
+
return suggestion(payload, comparative, {
|
|
33
|
+
subject_key: normalizeSubjectKey(comparative.groups.subject),
|
|
34
|
+
property_key: "value",
|
|
35
|
+
operator,
|
|
36
|
+
value_type: "int",
|
|
37
|
+
value_int: Number(comparative.groups.value),
|
|
38
|
+
}, "Comparative numeric prose is a strict property constraint.", 0.86, `${comparative.groups.operator} ${comparative.groups.value}`);
|
|
39
|
+
}
|
|
40
|
+
const precision = statement.match(/^.+?\s+(?:must|shall|should)\s+normalize\s+into\s+canonical\s+integer\s+decisecond\s+(?<subject>[a-z][a-z0-9_-]*)\s+values?\.?$/i);
|
|
41
|
+
if (precision?.groups?.subject) {
|
|
42
|
+
return suggestion(payload, precision, {
|
|
43
|
+
subject_key: normalizeSubjectKey(precision.groups.subject),
|
|
44
|
+
property_key: "slot_precision",
|
|
45
|
+
operator: "eq",
|
|
46
|
+
value_type: "string",
|
|
47
|
+
value_string: "decisecond",
|
|
48
|
+
}, "Canonical decisecond slot prose is a strict precision property.", 0.9);
|
|
49
|
+
}
|
|
50
|
+
const threshold = statement.match(/^(?<subject>.+?)\s+(?:must|shall|should)\s+return\s+within\s+(?<value>\d+)\s+(?<unit>ms|milliseconds?|s|sec|secs|seconds?)\.?$/i);
|
|
51
|
+
if (threshold?.groups?.subject &&
|
|
52
|
+
threshold.groups.value &&
|
|
53
|
+
threshold.groups.unit) {
|
|
54
|
+
const unit = threshold.groups.unit.toLowerCase().startsWith("m")
|
|
55
|
+
? "ms"
|
|
56
|
+
: "seconds";
|
|
57
|
+
return suggestion(payload, threshold, {
|
|
58
|
+
subject_key: normalizeSubjectKey(threshold.groups.subject),
|
|
59
|
+
property_key: unit === "ms" ? "latency_ms" : "latency_seconds",
|
|
60
|
+
operator: "lte",
|
|
61
|
+
value_type: "int",
|
|
62
|
+
value_int: Number(threshold.groups.value),
|
|
63
|
+
unit,
|
|
64
|
+
}, "Response-time thresholds are bounded numeric properties and should be modeled explicitly.", 0.88, `within ${threshold.groups.value} ${threshold.groups.unit}`);
|
|
65
|
+
}
|
|
66
|
+
const booleanState = statement.match(/^(?<subject>.+?)\s+(?:must|shall|should)\s+be\s+(?<state>enabled|disabled)\.?$/i);
|
|
67
|
+
if (booleanState?.groups?.subject && booleanState.groups.state) {
|
|
68
|
+
return suggestion(payload, booleanState, {
|
|
69
|
+
subject_key: normalizeSubjectKey(booleanState.groups.subject),
|
|
70
|
+
property_key: "enabled",
|
|
71
|
+
operator: "eq",
|
|
72
|
+
value_type: "bool",
|
|
73
|
+
value_bool: booleanState.groups.state.toLowerCase() === "enabled",
|
|
74
|
+
}, "Enabled/disabled requirements are boolean properties and can participate in strict checks.", 0.88, `be ${booleanState.groups.state}`);
|
|
75
|
+
}
|
|
76
|
+
const retention = statement.match(/^(?<subject>.+?)\s+(?:must|shall|should)\s+be\s+retained\s+for\s+(?<value>\d+)\s+(?<unit>days?|months?|years?)\.?$/i);
|
|
77
|
+
if (retention?.groups?.subject &&
|
|
78
|
+
retention.groups.value &&
|
|
79
|
+
retention.groups.unit) {
|
|
80
|
+
const unit = retention.groups.unit.toLowerCase().replace(/s$/, "s");
|
|
81
|
+
return suggestion(payload, retention, {
|
|
82
|
+
subject_key: normalizeSubjectKey(retention.groups.subject),
|
|
83
|
+
property_key: `retention_${unit}`,
|
|
84
|
+
operator: "eq",
|
|
85
|
+
value_type: "int",
|
|
86
|
+
value_int: Number(retention.groups.value),
|
|
87
|
+
unit,
|
|
88
|
+
}, "Retention duration is a scalar strict property and can participate in contradiction checks.", 0.92, `retained for ${retention.groups.value} ${retention.groups.unit}`);
|
|
89
|
+
}
|
|
90
|
+
const enumSet = statement.match(/^(?<subject>.+?)\s+(?:must|shall|should)\s+be\s+one\s+of\s+(?<values>.+?)\.?$/i);
|
|
91
|
+
if (enumSet?.groups?.subject && enumSet.groups.values) {
|
|
92
|
+
const values = enumSet.groups.values
|
|
93
|
+
.split(/,|\bor\b/i)
|
|
94
|
+
.map((value) => value.trim())
|
|
95
|
+
.filter(Boolean);
|
|
96
|
+
if (values.length > 1)
|
|
97
|
+
return suggestion(payload, enumSet, {
|
|
98
|
+
subject_key: normalizeSubjectKey(enumSet.groups.subject),
|
|
99
|
+
property_key: "allowed_values",
|
|
100
|
+
operator: "eq",
|
|
101
|
+
value_type: "string",
|
|
102
|
+
value_string: values.join("|"),
|
|
103
|
+
}, "Allowed enum sets are explicit property values and should not remain prose-only.", 0.86, `one of ${enumSet.groups.values}`);
|
|
104
|
+
}
|
|
105
|
+
return detectCountStrictSuggestion(payload, statement);
|
|
106
|
+
}
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
export type SemanticAdvisorLane = "strict_property" | "predicate" | "observation_review" | "none";
|
|
2
|
+
export type SemanticAdvisorReadiness = "modeled" | "needs_modeling" | "not_applicable";
|
|
3
|
+
export type SemanticLogicCoverageStatus = "complete" | "partial" | "unverified" | "not_applicable";
|
|
4
|
+
export type SemanticSignalKind = "normative_modal" | "numeric_cardinality" | "numeric_threshold" | "conditional" | "permission" | "state_or_default";
|
|
5
|
+
export interface SemanticSignal {
|
|
6
|
+
readonly kind: SemanticSignalKind;
|
|
7
|
+
readonly evidence: string;
|
|
8
|
+
readonly candidate_lane: SemanticAdvisorLane;
|
|
9
|
+
readonly confidence: number;
|
|
10
|
+
}
|
|
11
|
+
export interface SemanticAmbiguityWitness {
|
|
12
|
+
readonly signal_kind: SemanticSignalKind;
|
|
13
|
+
readonly evidence: string;
|
|
14
|
+
readonly interpretations: readonly string[];
|
|
15
|
+
readonly message: string;
|
|
16
|
+
}
|
|
17
|
+
export interface SemanticStrictPropertyClaim {
|
|
18
|
+
readonly subject_key: string;
|
|
19
|
+
readonly property_key: string;
|
|
20
|
+
readonly operator: "eq" | "neq" | "lt" | "lte" | "gt" | "gte";
|
|
21
|
+
readonly value_type: "string" | "int" | "number" | "bool";
|
|
22
|
+
readonly value_string?: string;
|
|
23
|
+
readonly value_int?: number;
|
|
24
|
+
readonly value_number?: number;
|
|
25
|
+
readonly value_bool?: boolean;
|
|
26
|
+
readonly unit?: string;
|
|
27
|
+
}
|
|
28
|
+
export interface SemanticPredicateClaim {
|
|
29
|
+
readonly predicate_name: string;
|
|
30
|
+
readonly predicate_args: readonly string[];
|
|
31
|
+
readonly canonical_key: string;
|
|
32
|
+
readonly polarity: "assert" | "deny";
|
|
33
|
+
}
|
|
34
|
+
export type SemanticModelingSuggestion = {
|
|
35
|
+
readonly kind: "strict_property";
|
|
36
|
+
readonly claim_key: string;
|
|
37
|
+
readonly claim_text: string;
|
|
38
|
+
readonly confidence: number;
|
|
39
|
+
readonly evidence: string;
|
|
40
|
+
readonly rationale: string;
|
|
41
|
+
readonly suggested_next_tool: "kb_model_requirement";
|
|
42
|
+
readonly claim: SemanticStrictPropertyClaim;
|
|
43
|
+
readonly rejected_alternatives: readonly string[];
|
|
44
|
+
readonly applyPlan: readonly Readonly<Record<string, unknown>>[];
|
|
45
|
+
} | {
|
|
46
|
+
readonly kind: "predicate";
|
|
47
|
+
readonly claim_key: string;
|
|
48
|
+
readonly claim_text: string;
|
|
49
|
+
readonly confidence: number;
|
|
50
|
+
readonly evidence: string;
|
|
51
|
+
readonly rationale: string;
|
|
52
|
+
readonly suggested_next_tool: "kb_suggest_predicates";
|
|
53
|
+
readonly predicate: SemanticPredicateClaim;
|
|
54
|
+
readonly rejected_alternatives: readonly string[];
|
|
55
|
+
readonly applyPlan: readonly Readonly<Record<string, unknown>>[];
|
|
56
|
+
readonly relationshipPlan: Readonly<Record<string, unknown>> | null;
|
|
57
|
+
} | {
|
|
58
|
+
readonly kind: "ambiguity_observation";
|
|
59
|
+
readonly claim_key: string;
|
|
60
|
+
readonly claim_text: string;
|
|
61
|
+
readonly confidence: number;
|
|
62
|
+
readonly evidence: string;
|
|
63
|
+
readonly rationale: string;
|
|
64
|
+
readonly ambiguity: readonly string[];
|
|
65
|
+
readonly suggested_next_tool: "kb_model_requirement" | "kb_suggest_predicates";
|
|
66
|
+
readonly applyPlan: readonly Readonly<Record<string, unknown>>[];
|
|
67
|
+
} | {
|
|
68
|
+
readonly kind: "ontology_gap";
|
|
69
|
+
readonly claim_key: string;
|
|
70
|
+
readonly claim_text: string;
|
|
71
|
+
readonly confidence: number;
|
|
72
|
+
readonly evidence: string;
|
|
73
|
+
readonly rationale: string;
|
|
74
|
+
readonly suggested_next_tool: "kb_suggest_predicates";
|
|
75
|
+
readonly recommendedPredicateSchema: {
|
|
76
|
+
readonly predicate_name: string;
|
|
77
|
+
readonly argument_names: readonly string[];
|
|
78
|
+
readonly argument_types: readonly string[];
|
|
79
|
+
} | null;
|
|
80
|
+
readonly applyPlan: readonly Readonly<Record<string, unknown>>[];
|
|
81
|
+
};
|
|
82
|
+
export interface SemanticAdvisorReceipt {
|
|
83
|
+
readonly version: string;
|
|
84
|
+
readonly payload_hash: string;
|
|
85
|
+
readonly logic_readiness: SemanticAdvisorReadiness;
|
|
86
|
+
readonly candidate_lane: SemanticAdvisorLane;
|
|
87
|
+
readonly signals: readonly SemanticSignal[];
|
|
88
|
+
readonly ambiguity_witnesses: readonly SemanticAmbiguityWitness[];
|
|
89
|
+
readonly suggestions: readonly SemanticModelingSuggestion[];
|
|
90
|
+
readonly clauses: readonly {
|
|
91
|
+
readonly claim_key: string;
|
|
92
|
+
readonly text: string;
|
|
93
|
+
readonly index: number;
|
|
94
|
+
readonly normative: boolean;
|
|
95
|
+
readonly source: "detected" | "supplied";
|
|
96
|
+
readonly suggestion_indexes: readonly number[];
|
|
97
|
+
}[];
|
|
98
|
+
readonly logic_coverage: {
|
|
99
|
+
readonly status: SemanticLogicCoverageStatus;
|
|
100
|
+
readonly expected_claim_keys: readonly string[];
|
|
101
|
+
readonly declared_claim_keys: readonly string[];
|
|
102
|
+
readonly missing_claim_keys: readonly string[];
|
|
103
|
+
readonly unresolved_claim_keys: readonly string[];
|
|
104
|
+
};
|
|
105
|
+
readonly suggested_next_tools: readonly string[];
|
|
106
|
+
readonly summary: string;
|
|
107
|
+
}
|
|
108
|
+
export interface SemanticAdvisorInput {
|
|
109
|
+
readonly payload: Readonly<Record<string, unknown>>;
|
|
110
|
+
readonly clauses?: readonly string[];
|
|
111
|
+
}
|
|
112
|
+
export interface SemanticAdvisorAnalysisResult {
|
|
113
|
+
readonly receipt: SemanticAdvisorReceipt;
|
|
114
|
+
readonly warnings: readonly string[];
|
|
115
|
+
}
|
|
116
|
+
export interface SemanticAdvisorArgs {
|
|
117
|
+
readonly text: string;
|
|
118
|
+
readonly clauses?: readonly string[];
|
|
119
|
+
readonly type?: string;
|
|
120
|
+
readonly id?: string;
|
|
121
|
+
readonly title?: string;
|
|
122
|
+
readonly source?: string;
|
|
123
|
+
readonly status?: string;
|
|
124
|
+
}
|
|
125
|
+
export interface SemanticAdvisorOperationResult {
|
|
126
|
+
readonly content: readonly {
|
|
127
|
+
readonly type: "text";
|
|
128
|
+
readonly text: string;
|
|
129
|
+
}[];
|
|
130
|
+
readonly structuredContent: {
|
|
131
|
+
readonly receipt: SemanticAdvisorReceipt;
|
|
132
|
+
readonly warnings: readonly string[];
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/operations/semantic-advisor/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,mBAAmB,GAC3B,iBAAiB,GACjB,WAAW,GACX,oBAAoB,GACpB,MAAM,CAAC;AAEX,MAAM,MAAM,wBAAwB,GAChC,SAAS,GACT,gBAAgB,GAChB,gBAAgB,CAAC;AACrB,MAAM,MAAM,2BAA2B,GACnC,UAAU,GACV,SAAS,GACT,YAAY,GACZ,gBAAgB,CAAC;AACrB,MAAM,MAAM,kBAAkB,GAC1B,iBAAiB,GACjB,qBAAqB,GACrB,mBAAmB,GACnB,aAAa,GACb,YAAY,GACZ,kBAAkB,CAAC;AAEvB,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,IAAI,EAAE,kBAAkB,CAAC;IAClC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,cAAc,EAAE,mBAAmB,CAAC;IAC7C,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;CAC7B;AAED,MAAM,WAAW,wBAAwB;IACvC,QAAQ,CAAC,WAAW,EAAE,kBAAkB,CAAC;IACzC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,eAAe,EAAE,SAAS,M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KAAK,CAAC,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAmBlE;AAED,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,KAAK,CAAC,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC,CAoBzE;AAuDD;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,MAAM,GAAG,eAAe,EAAE,CA6DjE"}
|
package/dist/prolog/codec.js
CHANGED
|
@@ -138,7 +138,7 @@ export function parseEntityFromList(data) {
|
|
|
138
138
|
return { ...props, id: normalizeEntityId(stripOuterQuotes(id)), type };
|
|
139
139
|
}
|
|
140
140
|
export function parsePropertyList(propsStr) {
|
|
141
|
-
// implements REQ-009
|
|
141
|
+
// implements REQ-009, REQ-skillopt-logical-evidence-fidelity
|
|
142
142
|
const props = {};
|
|
143
143
|
let cleaned = propsStr.trim();
|
|
144
144
|
if (cleaned.startsWith("[")) {
|
|
@@ -158,7 +158,14 @@ export function parsePropertyList(propsStr) {
|
|
|
158
158
|
continue;
|
|
159
159
|
}
|
|
160
160
|
const parsed = parsePrologValue(value);
|
|
161
|
-
props
|
|
161
|
+
if (!Object.hasOwn(props, key)) {
|
|
162
|
+
props[key] = parsed;
|
|
163
|
+
continue;
|
|
164
|
+
}
|
|
165
|
+
const existing = props[key];
|
|
166
|
+
props[key] = Array.isArray(existing)
|
|
167
|
+
? [...existing, parsed]
|
|
168
|
+
: [existing, parsed];
|
|
162
169
|
}
|
|
163
170
|
return props;
|
|
164
171
|
}
|
package/dist/prolog.d.ts
CHANGED
|
@@ -13,7 +13,10 @@ export declare class PrologProcess {
|
|
|
13
13
|
private swiplPath;
|
|
14
14
|
private timeout;
|
|
15
15
|
private outputBuffer;
|
|
16
|
+
private outputBufferBytes;
|
|
17
|
+
private outputOverflowed;
|
|
16
18
|
private errorBuffer;
|
|
19
|
+
private errorBufferBytes;
|
|
17
20
|
private cache;
|
|
18
21
|
private interactiveQueryTail;
|
|
19
22
|
private terminationPromise;
|
|
@@ -32,6 +35,8 @@ export declare class PrologProcess {
|
|
|
32
35
|
private execOneShot;
|
|
33
36
|
private normalizeGoal;
|
|
34
37
|
private clearQueryBuffers;
|
|
38
|
+
private appendOutputChunk;
|
|
39
|
+
private appendErrorChunk;
|
|
35
40
|
private isProcessUsable;
|
|
36
41
|
private extractBindings;
|
|
37
42
|
private translateError;
|
package/dist/prolog.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prolog.d.ts","sourceRoot":"","sources":["../src/prolog.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"prolog.d.ts","sourceRoot":"","sources":["../src/prolog.ts"],"names":[],"mappings":"AAgCA,wBAAgB,eAAe,IAAI,MAAM,CAsCxC;AACD,MAAM,WAAW,aAAa;IAC5B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,WAAW;IAC1B,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjC,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,qBAAa,aAAa;IACxB,OAAO,CAAC,OAAO,CAA6B;IAC5C,OAAO,CAAC,SAAS,CAAS;IAC1B,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,YAAY,CAAM;IAC1B,OAAO,CAAC,iBAAiB,CAAK;IAC9B,OAAO,CAAC,gBAAgB,CAAS;IACjC,OAAO,CAAC,WAAW,CAAM;IACzB,OAAO,CAAC,gBAAgB,CAAK;IAC7B,OAAO,CAAC,KAAK,CAAuC;IACpD,OAAO,CAAC,oBAAoB,CAAoC;IAChE,OAAO,CAAC,kBAAkB,CAA8B;IACxD,OAAO,CAAC,cAAc,CACyC;IAC/D,OAAO,CAAC,cAAc,CAAuB;IAC7C,OAAO,CAAC,aAAa,CAA6B;gBAEtC,OAAO,GAAE,aAAkB;IAKjC,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;YAuCd,YAAY;IAyCpB,KAAK,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,OAAO,CAAC,WAAW,CAAC;IAgL1D,eAAe,IAAI,IAAI;IAIvB,OAAO,CAAC,eAAe;IAavB,OAAO,CAAC,cAAc;IAStB,OAAO,CAAC,kBAAkB;YAIZ,YAAY;IA2C1B,OAAO,CAAC,WAAW;IA+GnB,OAAO,CAAC,aAAa;IAIrB,OAAO,CAAC,iBAAiB;IAQzB,OAAO,CAAC,iBAAiB;IAazB,OAAO,CAAC,gBAAgB;IAcxB,OAAO,CAAC,eAAe;IAQvB,OAAO,CAAC,eAAe;IAkBvB,OAAO,CAAC,cAAc;IA6DtB,SAAS,IAAI,OAAO;IAMpB,MAAM,IAAI,MAAM;IAIV,SAAS,IAAI,OAAO,CAAC,IAAI,CAAC;CAwCjC"}
|
package/dist/prolog.js
CHANGED
|
@@ -22,6 +22,9 @@ import path from "node:path";
|
|
|
22
22
|
import { fileURLToPath } from "node:url";
|
|
23
23
|
import { getKbPlPathOverride, isPrologDebugEnabled } from "./env.js";
|
|
24
24
|
const importMetaDir = path.dirname(fileURLToPath(import.meta.url));
|
|
25
|
+
const PROLOG_OUTPUT_MAX_BUFFER_BYTES = 8 * 1024 * 1024;
|
|
26
|
+
const PROLOG_OUTPUT_OVERFLOW_ERROR = "Query exceeded bounded Prolog output capacity (ENOBUFS); narrow the operation or reduce stored entity size";
|
|
27
|
+
const INTERACTIVE_QUERY_FRAME_END = "__KIBI_QUERY_FRAME_END__";
|
|
25
28
|
const require = createRequire(import.meta.url);
|
|
26
29
|
export function resolveKbPlPath() {
|
|
27
30
|
// implements REQ-009
|
|
@@ -64,7 +67,10 @@ export class PrologProcess {
|
|
|
64
67
|
swiplPath;
|
|
65
68
|
timeout;
|
|
66
69
|
outputBuffer = "";
|
|
70
|
+
outputBufferBytes = 0;
|
|
71
|
+
outputOverflowed = false;
|
|
67
72
|
errorBuffer = "";
|
|
73
|
+
errorBufferBytes = 0;
|
|
68
74
|
cache = new Map();
|
|
69
75
|
interactiveQueryTail = Promise.resolve();
|
|
70
76
|
terminationPromise = null;
|
|
@@ -90,10 +96,10 @@ export class PrologProcess {
|
|
|
90
96
|
throw new Error("Failed to spawn Prolog process");
|
|
91
97
|
}
|
|
92
98
|
this.process.stdout.on("data", (chunk) => {
|
|
93
|
-
this.
|
|
99
|
+
this.appendOutputChunk(chunk);
|
|
94
100
|
});
|
|
95
101
|
this.process.stderr.on("data", (chunk) => {
|
|
96
|
-
this.
|
|
102
|
+
this.appendErrorChunk(chunk);
|
|
97
103
|
});
|
|
98
104
|
this.process.stdin.write("true.\n");
|
|
99
105
|
if (!this.onProcessExit) {
|
|
@@ -118,8 +124,7 @@ export class PrologProcess {
|
|
|
118
124
|
throw new Error(`Failed to load kb module: ${this.translateError(this.errorBuffer)}`);
|
|
119
125
|
}
|
|
120
126
|
if (this.outputBuffer.includes("true.")) {
|
|
121
|
-
this.
|
|
122
|
-
this.errorBuffer = "";
|
|
127
|
+
this.clearQueryBuffers();
|
|
123
128
|
return;
|
|
124
129
|
}
|
|
125
130
|
// brief pause
|
|
@@ -130,8 +135,7 @@ export class PrologProcess {
|
|
|
130
135
|
if (this.errorBuffer.includes("ERROR")) {
|
|
131
136
|
throw new Error(`Failed to load kb module: ${this.translateError(this.errorBuffer)}`);
|
|
132
137
|
}
|
|
133
|
-
this.
|
|
134
|
-
this.errorBuffer = "";
|
|
138
|
+
this.clearQueryBuffers();
|
|
135
139
|
}
|
|
136
140
|
// implements REQ-core-prolog-process-management
|
|
137
141
|
async query(goal) {
|
|
@@ -172,7 +176,7 @@ export class PrologProcess {
|
|
|
172
176
|
if (debug) {
|
|
173
177
|
console.error(`[prolog debug] start query: ${normalizedGoal}`);
|
|
174
178
|
}
|
|
175
|
-
this.process?.stdin?.write(`${wrappedGoal}.\n`);
|
|
179
|
+
this.process?.stdin?.write(`${wrappedGoal}.\nwriteln('${INTERACTIVE_QUERY_FRAME_END}').\n`);
|
|
176
180
|
return new Promise((resolve, reject) => {
|
|
177
181
|
let settled = false;
|
|
178
182
|
const timeoutId = setTimeout(() => {
|
|
@@ -193,6 +197,28 @@ export class PrologProcess {
|
|
|
193
197
|
if (settled) {
|
|
194
198
|
return;
|
|
195
199
|
}
|
|
200
|
+
if (this.outputOverflowed) {
|
|
201
|
+
clearTimeout(timeoutId);
|
|
202
|
+
settled = true;
|
|
203
|
+
void this.terminate().finally(() => {
|
|
204
|
+
resolve({
|
|
205
|
+
success: false,
|
|
206
|
+
bindings: {},
|
|
207
|
+
error: PROLOG_OUTPUT_OVERFLOW_ERROR,
|
|
208
|
+
});
|
|
209
|
+
});
|
|
210
|
+
return;
|
|
211
|
+
}
|
|
212
|
+
if (!this.isProcessUsable()) {
|
|
213
|
+
clearTimeout(timeoutId);
|
|
214
|
+
settled = true;
|
|
215
|
+
resolve({
|
|
216
|
+
success: false,
|
|
217
|
+
bindings: {},
|
|
218
|
+
error: "Query interrupted because the Prolog process terminated",
|
|
219
|
+
});
|
|
220
|
+
return;
|
|
221
|
+
}
|
|
196
222
|
if (this.errorBuffer.length > 0 &&
|
|
197
223
|
this.errorBuffer.includes("ERROR")) {
|
|
198
224
|
clearTimeout(timeoutId);
|
|
@@ -207,14 +233,22 @@ export class PrologProcess {
|
|
|
207
233
|
});
|
|
208
234
|
return;
|
|
209
235
|
}
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
this.outputBuffer.match(/\]\s*$/m)) {
|
|
236
|
+
const frameEnd = this.outputBuffer.indexOf(INTERACTIVE_QUERY_FRAME_END);
|
|
237
|
+
if (frameEnd >= 0) {
|
|
213
238
|
clearTimeout(timeoutId);
|
|
214
239
|
settled = true;
|
|
240
|
+
const framedOutput = this.outputBuffer.slice(0, frameEnd).trimEnd();
|
|
241
|
+
if (/(?:^|\n)(?:false|fail)\.\s*$/.test(framedOutput)) {
|
|
242
|
+
resolve({
|
|
243
|
+
success: false,
|
|
244
|
+
bindings: {},
|
|
245
|
+
error: "Query failed",
|
|
246
|
+
});
|
|
247
|
+
return;
|
|
248
|
+
}
|
|
215
249
|
const result = {
|
|
216
250
|
success: true,
|
|
217
|
-
bindings: this.extractBindings(
|
|
251
|
+
bindings: this.extractBindings(framedOutput),
|
|
218
252
|
};
|
|
219
253
|
// Treat any batch/compound goal as non-cacheable to preserve
|
|
220
254
|
// read-after-write consistency. A batch goal is produced when
|
|
@@ -234,25 +268,6 @@ export class PrologProcess {
|
|
|
234
268
|
resolve(result);
|
|
235
269
|
return;
|
|
236
270
|
}
|
|
237
|
-
if (this.outputBuffer.includes("false.") ||
|
|
238
|
-
this.outputBuffer.includes("fail.")) {
|
|
239
|
-
clearTimeout(timeoutId);
|
|
240
|
-
settled = true;
|
|
241
|
-
if (debug) {
|
|
242
|
-
console.error(`[prolog debug] query failed (false): ${normalizedGoal}`);
|
|
243
|
-
}
|
|
244
|
-
// Check errorBuffer first — Prolog catch/3 writes ERROR to stderr
|
|
245
|
-
// then fail to stdout. If stderr has the real error, surface it.
|
|
246
|
-
const errorMessage = this.errorBuffer.length > 0 && this.errorBuffer.includes("ERROR")
|
|
247
|
-
? this.translateError(this.errorBuffer)
|
|
248
|
-
: "Query failed";
|
|
249
|
-
resolve({
|
|
250
|
-
success: false,
|
|
251
|
-
bindings: {},
|
|
252
|
-
error: errorMessage,
|
|
253
|
-
});
|
|
254
|
-
return;
|
|
255
|
-
}
|
|
256
271
|
setTimeout(checkResult, 50);
|
|
257
272
|
};
|
|
258
273
|
checkResult();
|
|
@@ -369,6 +384,7 @@ export class PrologProcess {
|
|
|
369
384
|
const result = spawnSync(this.swiplPath, ["-q", "-g", prologGoal, "-t", "halt"], {
|
|
370
385
|
encoding: "utf8",
|
|
371
386
|
timeout: this.timeout,
|
|
387
|
+
maxBuffer: PROLOG_OUTPUT_MAX_BUFFER_BYTES,
|
|
372
388
|
env: {
|
|
373
389
|
...process.env,
|
|
374
390
|
KIBI_GOAL: combinedGoal,
|
|
@@ -382,6 +398,13 @@ export class PrologProcess {
|
|
|
382
398
|
result.error.message.includes("ETIMEDOUT"))) {
|
|
383
399
|
throw new Error(`Query timeout after ${this.timeout / 1000}s`);
|
|
384
400
|
}
|
|
401
|
+
if (result.error?.message.includes("ENOBUFS")) {
|
|
402
|
+
return {
|
|
403
|
+
success: false,
|
|
404
|
+
bindings: {},
|
|
405
|
+
error: PROLOG_OUTPUT_OVERFLOW_ERROR,
|
|
406
|
+
};
|
|
407
|
+
}
|
|
385
408
|
const stdout = result.stdout ?? "";
|
|
386
409
|
const stderr = result.stderr ?? "";
|
|
387
410
|
if (stderr.includes("ERROR")) {
|
|
@@ -419,7 +442,36 @@ export class PrologProcess {
|
|
|
419
442
|
}
|
|
420
443
|
clearQueryBuffers() {
|
|
421
444
|
this.outputBuffer = "";
|
|
445
|
+
this.outputBufferBytes = 0;
|
|
446
|
+
this.outputOverflowed = false;
|
|
422
447
|
this.errorBuffer = "";
|
|
448
|
+
this.errorBufferBytes = 0;
|
|
449
|
+
}
|
|
450
|
+
appendOutputChunk(chunk) {
|
|
451
|
+
if (this.outputOverflowed)
|
|
452
|
+
return;
|
|
453
|
+
const remaining = PROLOG_OUTPUT_MAX_BUFFER_BYTES - this.outputBufferBytes;
|
|
454
|
+
if (chunk.byteLength > remaining) {
|
|
455
|
+
this.outputBuffer += chunk.subarray(0, remaining).toString();
|
|
456
|
+
this.outputBufferBytes = PROLOG_OUTPUT_MAX_BUFFER_BYTES;
|
|
457
|
+
this.outputOverflowed = true;
|
|
458
|
+
return;
|
|
459
|
+
}
|
|
460
|
+
this.outputBuffer += chunk.toString();
|
|
461
|
+
this.outputBufferBytes += chunk.byteLength;
|
|
462
|
+
}
|
|
463
|
+
appendErrorChunk(chunk) {
|
|
464
|
+
if (this.outputOverflowed)
|
|
465
|
+
return;
|
|
466
|
+
const remaining = PROLOG_OUTPUT_MAX_BUFFER_BYTES - this.errorBufferBytes;
|
|
467
|
+
if (chunk.byteLength > remaining) {
|
|
468
|
+
this.errorBuffer += chunk.subarray(0, remaining).toString();
|
|
469
|
+
this.errorBufferBytes = PROLOG_OUTPUT_MAX_BUFFER_BYTES;
|
|
470
|
+
this.outputOverflowed = true;
|
|
471
|
+
return;
|
|
472
|
+
}
|
|
473
|
+
this.errorBuffer += chunk.toString();
|
|
474
|
+
this.errorBufferBytes += chunk.byteLength;
|
|
423
475
|
}
|
|
424
476
|
// implements REQ-009
|
|
425
477
|
isProcessUsable() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"diagnostics.d.ts","sourceRoot":"","sources":["../../../src/public/impact/diagnostics.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,0CAA0C,CAAC;AAWrF,OAAO,KAAK,EACV,iBAAiB,EACjB,gCAAgC,EAChC,mCAAmC,EACpC,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"diagnostics.d.ts","sourceRoot":"","sources":["../../../src/public/impact/diagnostics.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,0CAA0C,CAAC;AAWrF,OAAO,KAAK,EACV,iBAAiB,EACjB,gCAAgC,EAChC,mCAAmC,EACpC,MAAM,YAAY,CAAC;AA2FpB,wBAAgB,kCAAkC,CAChD,OAAO,EAAE,mCAAmC,GAC3C,oBAAoB,EAAE,CA+CxB;AAED,wBAAgB,+BAA+B,CAC7C,OAAO,EAAE,gCAAgC,GACxC,oBAAoB,EAAE,CAsBxB;AAED,wBAAgB,4BAA4B,CAC1C,WAAW,EAAE,SAAS,oBAAoB,EAAE,GAC3C,OAAO,CAET;AAED,wBAAgB,6BAA6B,CAC3C,WAAW,EAAE,SAAS,iBAAiB,EAAE,GACxC,OAAO,CAIT"}
|
|
@@ -38,8 +38,12 @@ function readSourceSymbols(sourceFile, sourceContentByFile, workspaceRoot) {
|
|
|
38
38
|
});
|
|
39
39
|
}
|
|
40
40
|
function getGranularSymbolsForSourceFile(sourceFile, options) {
|
|
41
|
-
|
|
42
|
-
|
|
41
|
+
const sourceSymbols = readSourceSymbols(sourceFile, options.sourceContentByFile, options.workspaceRoot ?? process.cwd());
|
|
42
|
+
const changedSymbols = options.symbolsByFile.get(sourceFile);
|
|
43
|
+
return {
|
|
44
|
+
candidateSymbols: changedSymbols ?? sourceSymbols,
|
|
45
|
+
sourceSymbols: sourceSymbols.length > 0 ? sourceSymbols : (changedSymbols ?? []),
|
|
46
|
+
};
|
|
43
47
|
}
|
|
44
48
|
function formatRelationshipTargets(symbol) {
|
|
45
49
|
const targets = [
|
|
@@ -69,8 +73,8 @@ export function createSymbolGranularityDiagnostics(options) {
|
|
|
69
73
|
continue;
|
|
70
74
|
if (hasValidGranularityReason(result))
|
|
71
75
|
continue;
|
|
72
|
-
const
|
|
73
|
-
const narrowerSymbols =
|
|
76
|
+
const { candidateSymbols, sourceSymbols } = getGranularSymbolsForSourceFile(result.sourceFile, options);
|
|
77
|
+
const narrowerSymbols = candidateSymbols.filter((symbol) => isNarrowerSymbol(result.entity.title, symbol, sourceSymbols));
|
|
74
78
|
if (narrowerSymbols.length === 0)
|
|
75
79
|
continue;
|
|
76
80
|
const behavioralNames = getBehavioralSymbolNames(narrowerSymbols);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { PrologProcess } from "../../prolog.js";
|
|
2
2
|
import type { QualityDiagnostic } from "./types.js";
|
|
3
3
|
type FullKbQualityDiagnosticsOptions = {
|
|
4
|
-
readonly prolog: PrologProcess
|
|
4
|
+
readonly prolog: Pick<PrologProcess, "query">;
|
|
5
5
|
readonly hardViolationEntityIds?: ReadonlySet<string>;
|
|
6
6
|
readonly maxDiagnostics?: number;
|
|
7
7
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"full-kb-quality.d.ts","sourceRoot":"","sources":["../../../src/public/impact/full-kb-quality.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AASrD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAqBpD,KAAK,+BAA+B,GAAG;IACrC,QAAQ,CAAC,MAAM,EAAE,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"full-kb-quality.d.ts","sourceRoot":"","sources":["../../../src/public/impact/full-kb-quality.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AASrD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAqBpD,KAAK,+BAA+B,GAAG;IACrC,QAAQ,CAAC,MAAM,EAAE,IAAI,CAAC,aAAa,EAAE,OAAO,CAAC,CAAC;IAC9C,QAAQ,CAAC,sBAAsB,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IACtD,QAAQ,CAAC,cAAc,CAAC,EAAE,MAAM,CAAC;CAClC,CAAC;AA0KF,wBAAsB,+BAA+B,CACnD,OAAO,EAAE,+BAA+B,GACvC,OAAO,CAAC,SAAS,iBAAiB,EAAE,CAAC,CAmBvC"}
|
|
@@ -63,6 +63,9 @@ function toExtractedEntity(entity) {
|
|
|
63
63
|
const textRef = optionalStringField(entity, "text_ref");
|
|
64
64
|
if (textRef !== undefined)
|
|
65
65
|
extracted.text_ref = textRef;
|
|
66
|
+
const logicClaims = optionalStringArrayField(entity, "logic_claims");
|
|
67
|
+
if (logicClaims !== undefined)
|
|
68
|
+
extracted.logic_claims = logicClaims;
|
|
66
69
|
const granularityReason = optionalStringField(entity, "granularity_reason");
|
|
67
70
|
if (granularityReason !== undefined) {
|
|
68
71
|
extracted.granularity_reason = granularityReason;
|
|
@@ -95,9 +98,39 @@ function toExtractedEntity(entity) {
|
|
|
95
98
|
if (factKind === "subject" ||
|
|
96
99
|
factKind === "property_value" ||
|
|
97
100
|
factKind === "observation" ||
|
|
98
|
-
factKind === "meta"
|
|
101
|
+
factKind === "meta" ||
|
|
102
|
+
factKind === "predicate_schema" ||
|
|
103
|
+
factKind === "predicate") {
|
|
99
104
|
extracted.fact_kind = factKind;
|
|
100
105
|
}
|
|
106
|
+
const claimKey = optionalStringField(entity, "claim_key");
|
|
107
|
+
if (claimKey !== undefined)
|
|
108
|
+
extracted.claim_key = claimKey;
|
|
109
|
+
const claimText = optionalStringField(entity, "claim_text");
|
|
110
|
+
if (claimText !== undefined)
|
|
111
|
+
extracted.claim_text = claimText;
|
|
112
|
+
const predicateName = optionalStringField(entity, "predicate_name");
|
|
113
|
+
if (predicateName !== undefined)
|
|
114
|
+
extracted.predicate_name = predicateName;
|
|
115
|
+
const predicateNamespace = optionalStringField(entity, "predicate_namespace");
|
|
116
|
+
if (predicateNamespace !== undefined) {
|
|
117
|
+
extracted.predicate_namespace = predicateNamespace;
|
|
118
|
+
}
|
|
119
|
+
const predicateArity = optionalNumberField(entity, "predicate_arity");
|
|
120
|
+
if (predicateArity !== undefined)
|
|
121
|
+
extracted.predicate_arity = predicateArity;
|
|
122
|
+
for (const field of [
|
|
123
|
+
"argument_names",
|
|
124
|
+
"argument_types",
|
|
125
|
+
"argument_descriptions",
|
|
126
|
+
"aliases",
|
|
127
|
+
"examples",
|
|
128
|
+
"predicate_args",
|
|
129
|
+
]) {
|
|
130
|
+
const values = optionalStringArrayField(entity, field);
|
|
131
|
+
if (values !== undefined)
|
|
132
|
+
extracted[field] = values;
|
|
133
|
+
}
|
|
101
134
|
return extracted;
|
|
102
135
|
}
|
|
103
136
|
function sourceFileFor(entity) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"requirement-quality.d.ts","sourceRoot":"","sources":["../../../src/public/impact/requirement-quality.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,0CAA0C,CAAC;AACrF,OAAO,KAAK,EAAE,oCAAoC,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"requirement-quality.d.ts","sourceRoot":"","sources":["../../../src/public/impact/requirement-quality.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,0CAA0C,CAAC;AACrF,OAAO,KAAK,EAAE,oCAAoC,EAAE,MAAM,YAAY,CAAC;AA2PvE,wBAAgB,mCAAmC,CACjD,OAAO,EAAE,oCAAoC,GAC5C,oBAAoB,EAAE,CAMxB"}
|