@mrclrchtr/supi-code-intelligence 3.2.0 → 4.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +154 -435
- package/node_modules/@mrclrchtr/supi-code-runtime/README.md +8 -0
- package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/package.json +2 -4
- package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/api.ts +0 -4
- package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/evidence-badge.ts +3 -2
- package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/index.ts +0 -4
- package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/llm.ts +0 -10
- package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/path-utils.ts +19 -15
- package/node_modules/@mrclrchtr/supi-code-runtime/package.json +2 -2
- package/node_modules/@mrclrchtr/supi-code-runtime/src/api.ts +10 -1
- package/node_modules/@mrclrchtr/supi-code-runtime/src/capability/types.ts +19 -29
- package/node_modules/@mrclrchtr/supi-code-runtime/src/index.ts +7 -1
- package/node_modules/@mrclrchtr/supi-code-runtime/src/query-result.ts +42 -0
- package/node_modules/@mrclrchtr/supi-code-runtime/src/types.ts +15 -10
- package/node_modules/@mrclrchtr/supi-core/package.json +2 -4
- package/node_modules/@mrclrchtr/supi-core/src/api.ts +0 -4
- package/node_modules/@mrclrchtr/supi-core/src/evidence-badge.ts +3 -2
- package/node_modules/@mrclrchtr/supi-core/src/index.ts +0 -4
- package/node_modules/@mrclrchtr/supi-core/src/llm.ts +0 -10
- package/node_modules/@mrclrchtr/supi-core/src/path-utils.ts +19 -15
- package/node_modules/@mrclrchtr/supi-lsp/README.md +72 -62
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/README.md +8 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/package.json +2 -4
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/api.ts +0 -4
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/evidence-badge.ts +3 -2
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/index.ts +0 -4
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/llm.ts +0 -10
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/path-utils.ts +19 -15
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/package.json +2 -2
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/src/api.ts +10 -1
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/src/capability/types.ts +19 -29
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/src/index.ts +7 -1
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/src/query-result.ts +42 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/src/types.ts +15 -10
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/package.json +2 -4
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/api.ts +0 -4
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/evidence-badge.ts +3 -2
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/index.ts +0 -4
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/llm.ts +0 -10
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/path-utils.ts +19 -15
- package/node_modules/@mrclrchtr/supi-lsp/package.json +4 -5
- package/node_modules/@mrclrchtr/supi-lsp/src/api.ts +9 -9
- package/node_modules/@mrclrchtr/supi-lsp/src/client/client.ts +70 -41
- package/node_modules/@mrclrchtr/supi-lsp/src/client/transport.ts +16 -13
- package/node_modules/@mrclrchtr/supi-lsp/src/config/config.ts +2 -2
- package/node_modules/@mrclrchtr/supi-lsp/src/config/lsp-settings.ts +0 -2
- package/node_modules/@mrclrchtr/supi-lsp/src/index.ts +6 -6
- package/node_modules/@mrclrchtr/supi-lsp/src/manager/manager-diagnostics.ts +5 -95
- package/node_modules/@mrclrchtr/supi-lsp/src/manager/manager-workspace-recovery.ts +4 -3
- package/node_modules/@mrclrchtr/supi-lsp/src/manager/manager-workspace-symbol.ts +44 -6
- package/node_modules/@mrclrchtr/supi-lsp/src/manager/manager.ts +47 -65
- package/node_modules/@mrclrchtr/supi-lsp/src/provider/lsp-semantic-provider.ts +132 -79
- package/node_modules/@mrclrchtr/supi-lsp/src/provider/refactor-planning.ts +6 -14
- package/node_modules/@mrclrchtr/supi-lsp/src/session/readiness.ts +38 -0
- package/node_modules/@mrclrchtr/supi-lsp/src/session/runtime-controller.ts +87 -75
- package/node_modules/@mrclrchtr/supi-lsp/src/session/runtime-registration.ts +5 -5
- package/node_modules/@mrclrchtr/supi-lsp/src/session/{service-registry.ts → runtime-registry.ts} +163 -71
- package/node_modules/@mrclrchtr/supi-tree-sitter/README.md +4 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/README.md +8 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/package.json +2 -4
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/api.ts +0 -4
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/evidence-badge.ts +3 -2
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/index.ts +0 -4
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/llm.ts +0 -10
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/path-utils.ts +19 -15
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/package.json +2 -2
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/src/api.ts +10 -1
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/src/capability/types.ts +19 -29
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/src/index.ts +7 -1
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/src/query-result.ts +42 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/src/types.ts +15 -10
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/package.json +2 -4
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/api.ts +0 -4
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/evidence-badge.ts +3 -2
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/index.ts +0 -4
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/llm.ts +0 -10
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/path-utils.ts +19 -15
- package/node_modules/@mrclrchtr/supi-tree-sitter/package.json +4 -21
- package/node_modules/@mrclrchtr/supi-tree-sitter/resources/grammars/bash/tree-sitter-bash.wasm +0 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/resources/grammars/bash/tree-sitter-bash.wasm.json +2 -2
- package/node_modules/@mrclrchtr/supi-tree-sitter/resources/grammars/c/tree-sitter-c.wasm +0 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/resources/grammars/c/tree-sitter-c.wasm.json +2 -2
- package/node_modules/@mrclrchtr/supi-tree-sitter/resources/grammars/go/tree-sitter-go.wasm +0 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/resources/grammars/go/tree-sitter-go.wasm.json +2 -2
- package/node_modules/@mrclrchtr/supi-tree-sitter/resources/grammars/javascript/tree-sitter-javascript.wasm +0 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/resources/grammars/javascript/tree-sitter-javascript.wasm.json +2 -2
- package/node_modules/@mrclrchtr/supi-tree-sitter/resources/grammars/kotlin/tree-sitter-kotlin.wasm +0 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/resources/grammars/kotlin/tree-sitter-kotlin.wasm.json +2 -2
- package/node_modules/@mrclrchtr/supi-tree-sitter/resources/grammars/python/tree-sitter-python.wasm +0 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/resources/grammars/python/tree-sitter-python.wasm.json +2 -2
- package/node_modules/@mrclrchtr/supi-tree-sitter/resources/grammars/r/tree-sitter-r.wasm +0 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/resources/grammars/r/tree-sitter-r.wasm.json +2 -2
- package/node_modules/@mrclrchtr/supi-tree-sitter/resources/grammars/rust/tree-sitter-rust.wasm.json +1 -1
- package/node_modules/@mrclrchtr/supi-tree-sitter/resources/grammars/sql/tree-sitter-sql.wasm +0 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/resources/grammars/sql/tree-sitter-sql.wasm.json +3 -3
- package/node_modules/@mrclrchtr/supi-tree-sitter/scripts/generate-kotlin-wasm.mjs +6 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/scripts/generate-sql-wasm.mjs +18 -4
- package/node_modules/@mrclrchtr/supi-tree-sitter/scripts/vendor-wasm.mjs +17 -1
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/api.ts +2 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/coordinates.ts +20 -41
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/index.ts +2 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/language.ts +7 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/operation-support.ts +40 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/session/session.ts +9 -7
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/tool/call-sites.ts +6 -1
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/tool/callees.ts +76 -37
- package/node_modules/yaml/LICENSE +13 -0
- package/node_modules/yaml/README.md +172 -0
- package/node_modules/yaml/bin.mjs +11 -0
- package/node_modules/yaml/browser/dist/compose/compose-collection.js +88 -0
- package/node_modules/yaml/browser/dist/compose/compose-doc.js +43 -0
- package/node_modules/yaml/browser/dist/compose/compose-node.js +109 -0
- package/node_modules/yaml/browser/dist/compose/compose-scalar.js +86 -0
- package/node_modules/yaml/browser/dist/compose/composer.js +219 -0
- package/node_modules/yaml/browser/dist/compose/resolve-block-map.js +115 -0
- package/node_modules/yaml/browser/dist/compose/resolve-block-scalar.js +198 -0
- package/node_modules/yaml/browser/dist/compose/resolve-block-seq.js +49 -0
- package/node_modules/yaml/browser/dist/compose/resolve-end.js +37 -0
- package/node_modules/yaml/browser/dist/compose/resolve-flow-collection.js +207 -0
- package/node_modules/yaml/browser/dist/compose/resolve-flow-scalar.js +225 -0
- package/node_modules/yaml/browser/dist/compose/resolve-props.js +146 -0
- package/node_modules/yaml/browser/dist/compose/util-contains-newline.js +34 -0
- package/node_modules/yaml/browser/dist/compose/util-empty-scalar-position.js +26 -0
- package/node_modules/yaml/browser/dist/compose/util-flow-indent-check.js +15 -0
- package/node_modules/yaml/browser/dist/compose/util-map-includes.js +13 -0
- package/node_modules/yaml/browser/dist/doc/Document.js +335 -0
- package/node_modules/yaml/browser/dist/doc/anchors.js +71 -0
- package/node_modules/yaml/browser/dist/doc/applyReviver.js +55 -0
- package/node_modules/yaml/browser/dist/doc/createNode.js +88 -0
- package/node_modules/yaml/browser/dist/doc/directives.js +176 -0
- package/node_modules/yaml/browser/dist/errors.js +57 -0
- package/node_modules/yaml/browser/dist/index.js +17 -0
- package/node_modules/yaml/browser/dist/log.js +11 -0
- package/node_modules/yaml/browser/dist/nodes/Alias.js +116 -0
- package/node_modules/yaml/browser/dist/nodes/Collection.js +147 -0
- package/node_modules/yaml/browser/dist/nodes/Node.js +38 -0
- package/node_modules/yaml/browser/dist/nodes/Pair.js +36 -0
- package/node_modules/yaml/browser/dist/nodes/Scalar.js +24 -0
- package/node_modules/yaml/browser/dist/nodes/YAMLMap.js +144 -0
- package/node_modules/yaml/browser/dist/nodes/YAMLSeq.js +113 -0
- package/node_modules/yaml/browser/dist/nodes/addPairToJSMap.js +63 -0
- package/node_modules/yaml/browser/dist/nodes/identity.js +36 -0
- package/node_modules/yaml/browser/dist/nodes/toJS.js +37 -0
- package/node_modules/yaml/browser/dist/parse/cst-scalar.js +214 -0
- package/node_modules/yaml/browser/dist/parse/cst-stringify.js +61 -0
- package/node_modules/yaml/browser/dist/parse/cst-visit.js +97 -0
- package/node_modules/yaml/browser/dist/parse/cst.js +98 -0
- package/node_modules/yaml/browser/dist/parse/lexer.js +721 -0
- package/node_modules/yaml/browser/dist/parse/line-counter.js +39 -0
- package/node_modules/yaml/browser/dist/parse/parser.js +975 -0
- package/node_modules/yaml/browser/dist/public-api.js +102 -0
- package/node_modules/yaml/browser/dist/schema/Schema.js +37 -0
- package/node_modules/yaml/browser/dist/schema/common/map.js +17 -0
- package/node_modules/yaml/browser/dist/schema/common/null.js +15 -0
- package/node_modules/yaml/browser/dist/schema/common/seq.js +17 -0
- package/node_modules/yaml/browser/dist/schema/common/string.js +14 -0
- package/node_modules/yaml/browser/dist/schema/core/bool.js +19 -0
- package/node_modules/yaml/browser/dist/schema/core/float.js +43 -0
- package/node_modules/yaml/browser/dist/schema/core/int.js +38 -0
- package/node_modules/yaml/browser/dist/schema/core/schema.js +23 -0
- package/node_modules/yaml/browser/dist/schema/json/schema.js +62 -0
- package/node_modules/yaml/browser/dist/schema/tags.js +96 -0
- package/node_modules/yaml/browser/dist/schema/yaml-1.1/binary.js +58 -0
- package/node_modules/yaml/browser/dist/schema/yaml-1.1/bool.js +26 -0
- package/node_modules/yaml/browser/dist/schema/yaml-1.1/float.js +46 -0
- package/node_modules/yaml/browser/dist/schema/yaml-1.1/int.js +71 -0
- package/node_modules/yaml/browser/dist/schema/yaml-1.1/merge.js +67 -0
- package/node_modules/yaml/browser/dist/schema/yaml-1.1/omap.js +74 -0
- package/node_modules/yaml/browser/dist/schema/yaml-1.1/pairs.js +78 -0
- package/node_modules/yaml/browser/dist/schema/yaml-1.1/schema.js +39 -0
- package/node_modules/yaml/browser/dist/schema/yaml-1.1/set.js +93 -0
- package/node_modules/yaml/browser/dist/schema/yaml-1.1/timestamp.js +101 -0
- package/node_modules/yaml/browser/dist/stringify/foldFlowLines.js +146 -0
- package/node_modules/yaml/browser/dist/stringify/stringify.js +129 -0
- package/node_modules/yaml/browser/dist/stringify/stringifyCollection.js +153 -0
- package/node_modules/yaml/browser/dist/stringify/stringifyComment.js +20 -0
- package/node_modules/yaml/browser/dist/stringify/stringifyDocument.js +85 -0
- package/node_modules/yaml/browser/dist/stringify/stringifyNumber.js +25 -0
- package/node_modules/yaml/browser/dist/stringify/stringifyPair.js +150 -0
- package/node_modules/yaml/browser/dist/stringify/stringifyString.js +336 -0
- package/node_modules/yaml/browser/dist/util.js +11 -0
- package/node_modules/yaml/browser/dist/visit.js +233 -0
- package/node_modules/yaml/browser/index.js +5 -0
- package/node_modules/yaml/browser/package.json +3 -0
- package/node_modules/yaml/dist/cli.d.ts +8 -0
- package/node_modules/yaml/dist/cli.mjs +201 -0
- package/node_modules/yaml/dist/compose/compose-collection.d.ts +11 -0
- package/node_modules/yaml/dist/compose/compose-collection.js +90 -0
- package/node_modules/yaml/dist/compose/compose-doc.d.ts +7 -0
- package/node_modules/yaml/dist/compose/compose-doc.js +45 -0
- package/node_modules/yaml/dist/compose/compose-node.d.ts +29 -0
- package/node_modules/yaml/dist/compose/compose-node.js +112 -0
- package/node_modules/yaml/dist/compose/compose-scalar.d.ts +5 -0
- package/node_modules/yaml/dist/compose/compose-scalar.js +88 -0
- package/node_modules/yaml/dist/compose/composer.d.ts +63 -0
- package/node_modules/yaml/dist/compose/composer.js +224 -0
- package/node_modules/yaml/dist/compose/resolve-block-map.d.ts +6 -0
- package/node_modules/yaml/dist/compose/resolve-block-map.js +117 -0
- package/node_modules/yaml/dist/compose/resolve-block-scalar.d.ts +11 -0
- package/node_modules/yaml/dist/compose/resolve-block-scalar.js +200 -0
- package/node_modules/yaml/dist/compose/resolve-block-seq.d.ts +6 -0
- package/node_modules/yaml/dist/compose/resolve-block-seq.js +51 -0
- package/node_modules/yaml/dist/compose/resolve-end.d.ts +6 -0
- package/node_modules/yaml/dist/compose/resolve-end.js +39 -0
- package/node_modules/yaml/dist/compose/resolve-flow-collection.d.ts +7 -0
- package/node_modules/yaml/dist/compose/resolve-flow-collection.js +209 -0
- package/node_modules/yaml/dist/compose/resolve-flow-scalar.d.ts +10 -0
- package/node_modules/yaml/dist/compose/resolve-flow-scalar.js +227 -0
- package/node_modules/yaml/dist/compose/resolve-props.d.ts +23 -0
- package/node_modules/yaml/dist/compose/resolve-props.js +148 -0
- package/node_modules/yaml/dist/compose/util-contains-newline.d.ts +2 -0
- package/node_modules/yaml/dist/compose/util-contains-newline.js +36 -0
- package/node_modules/yaml/dist/compose/util-empty-scalar-position.d.ts +2 -0
- package/node_modules/yaml/dist/compose/util-empty-scalar-position.js +28 -0
- package/node_modules/yaml/dist/compose/util-flow-indent-check.d.ts +3 -0
- package/node_modules/yaml/dist/compose/util-flow-indent-check.js +17 -0
- package/node_modules/yaml/dist/compose/util-map-includes.d.ts +4 -0
- package/node_modules/yaml/dist/compose/util-map-includes.js +15 -0
- package/node_modules/yaml/dist/doc/Document.d.ts +141 -0
- package/node_modules/yaml/dist/doc/Document.js +337 -0
- package/node_modules/yaml/dist/doc/anchors.d.ts +24 -0
- package/node_modules/yaml/dist/doc/anchors.js +76 -0
- package/node_modules/yaml/dist/doc/applyReviver.d.ts +9 -0
- package/node_modules/yaml/dist/doc/applyReviver.js +57 -0
- package/node_modules/yaml/dist/doc/createNode.d.ts +17 -0
- package/node_modules/yaml/dist/doc/createNode.js +90 -0
- package/node_modules/yaml/dist/doc/directives.d.ts +49 -0
- package/node_modules/yaml/dist/doc/directives.js +178 -0
- package/node_modules/yaml/dist/errors.d.ts +21 -0
- package/node_modules/yaml/dist/errors.js +62 -0
- package/node_modules/yaml/dist/index.d.ts +25 -0
- package/node_modules/yaml/dist/index.js +50 -0
- package/node_modules/yaml/dist/log.d.ts +3 -0
- package/node_modules/yaml/dist/log.js +19 -0
- package/node_modules/yaml/dist/nodes/Alias.d.ts +29 -0
- package/node_modules/yaml/dist/nodes/Alias.js +118 -0
- package/node_modules/yaml/dist/nodes/Collection.d.ts +73 -0
- package/node_modules/yaml/dist/nodes/Collection.js +151 -0
- package/node_modules/yaml/dist/nodes/Node.d.ts +53 -0
- package/node_modules/yaml/dist/nodes/Node.js +40 -0
- package/node_modules/yaml/dist/nodes/Pair.d.ts +22 -0
- package/node_modules/yaml/dist/nodes/Pair.js +39 -0
- package/node_modules/yaml/dist/nodes/Scalar.d.ts +47 -0
- package/node_modules/yaml/dist/nodes/Scalar.js +27 -0
- package/node_modules/yaml/dist/nodes/YAMLMap.d.ts +53 -0
- package/node_modules/yaml/dist/nodes/YAMLMap.js +147 -0
- package/node_modules/yaml/dist/nodes/YAMLSeq.d.ts +60 -0
- package/node_modules/yaml/dist/nodes/YAMLSeq.js +115 -0
- package/node_modules/yaml/dist/nodes/addPairToJSMap.d.ts +4 -0
- package/node_modules/yaml/dist/nodes/addPairToJSMap.js +65 -0
- package/node_modules/yaml/dist/nodes/identity.d.ts +23 -0
- package/node_modules/yaml/dist/nodes/identity.js +53 -0
- package/node_modules/yaml/dist/nodes/toJS.d.ts +29 -0
- package/node_modules/yaml/dist/nodes/toJS.js +39 -0
- package/node_modules/yaml/dist/options.d.ts +350 -0
- package/node_modules/yaml/dist/parse/cst-scalar.d.ts +64 -0
- package/node_modules/yaml/dist/parse/cst-scalar.js +218 -0
- package/node_modules/yaml/dist/parse/cst-stringify.d.ts +8 -0
- package/node_modules/yaml/dist/parse/cst-stringify.js +63 -0
- package/node_modules/yaml/dist/parse/cst-visit.d.ts +39 -0
- package/node_modules/yaml/dist/parse/cst-visit.js +99 -0
- package/node_modules/yaml/dist/parse/cst.d.ts +109 -0
- package/node_modules/yaml/dist/parse/cst.js +112 -0
- package/node_modules/yaml/dist/parse/lexer.d.ts +87 -0
- package/node_modules/yaml/dist/parse/lexer.js +723 -0
- package/node_modules/yaml/dist/parse/line-counter.d.ts +22 -0
- package/node_modules/yaml/dist/parse/line-counter.js +41 -0
- package/node_modules/yaml/dist/parse/parser.d.ts +84 -0
- package/node_modules/yaml/dist/parse/parser.js +980 -0
- package/node_modules/yaml/dist/public-api.d.ts +44 -0
- package/node_modules/yaml/dist/public-api.js +107 -0
- package/node_modules/yaml/dist/schema/Schema.d.ts +17 -0
- package/node_modules/yaml/dist/schema/Schema.js +39 -0
- package/node_modules/yaml/dist/schema/common/map.d.ts +2 -0
- package/node_modules/yaml/dist/schema/common/map.js +19 -0
- package/node_modules/yaml/dist/schema/common/null.d.ts +4 -0
- package/node_modules/yaml/dist/schema/common/null.js +17 -0
- package/node_modules/yaml/dist/schema/common/seq.d.ts +2 -0
- package/node_modules/yaml/dist/schema/common/seq.js +19 -0
- package/node_modules/yaml/dist/schema/common/string.d.ts +2 -0
- package/node_modules/yaml/dist/schema/common/string.js +16 -0
- package/node_modules/yaml/dist/schema/core/bool.d.ts +4 -0
- package/node_modules/yaml/dist/schema/core/bool.js +21 -0
- package/node_modules/yaml/dist/schema/core/float.d.ts +4 -0
- package/node_modules/yaml/dist/schema/core/float.js +47 -0
- package/node_modules/yaml/dist/schema/core/int.d.ts +4 -0
- package/node_modules/yaml/dist/schema/core/int.js +42 -0
- package/node_modules/yaml/dist/schema/core/schema.d.ts +1 -0
- package/node_modules/yaml/dist/schema/core/schema.js +25 -0
- package/node_modules/yaml/dist/schema/json/schema.d.ts +2 -0
- package/node_modules/yaml/dist/schema/json/schema.js +64 -0
- package/node_modules/yaml/dist/schema/json-schema.d.ts +69 -0
- package/node_modules/yaml/dist/schema/tags.d.ts +48 -0
- package/node_modules/yaml/dist/schema/tags.js +99 -0
- package/node_modules/yaml/dist/schema/types.d.ts +92 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/binary.d.ts +2 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/binary.js +70 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/bool.d.ts +7 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/bool.js +29 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/float.d.ts +4 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/float.js +50 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/int.d.ts +5 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/int.js +76 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/merge.d.ts +9 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/merge.js +71 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/omap.d.ts +22 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/omap.js +77 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/pairs.d.ts +10 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/pairs.js +82 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/schema.d.ts +1 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/schema.js +41 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/set.d.ts +28 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/set.js +96 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/timestamp.d.ts +6 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/timestamp.js +105 -0
- package/node_modules/yaml/dist/stringify/foldFlowLines.d.ts +34 -0
- package/node_modules/yaml/dist/stringify/foldFlowLines.js +151 -0
- package/node_modules/yaml/dist/stringify/stringify.d.ts +21 -0
- package/node_modules/yaml/dist/stringify/stringify.js +132 -0
- package/node_modules/yaml/dist/stringify/stringifyCollection.d.ts +17 -0
- package/node_modules/yaml/dist/stringify/stringifyCollection.js +155 -0
- package/node_modules/yaml/dist/stringify/stringifyComment.d.ts +10 -0
- package/node_modules/yaml/dist/stringify/stringifyComment.js +24 -0
- package/node_modules/yaml/dist/stringify/stringifyDocument.d.ts +4 -0
- package/node_modules/yaml/dist/stringify/stringifyDocument.js +87 -0
- package/node_modules/yaml/dist/stringify/stringifyNumber.d.ts +2 -0
- package/node_modules/yaml/dist/stringify/stringifyNumber.js +27 -0
- package/node_modules/yaml/dist/stringify/stringifyPair.d.ts +3 -0
- package/node_modules/yaml/dist/stringify/stringifyPair.js +152 -0
- package/node_modules/yaml/dist/stringify/stringifyString.d.ts +9 -0
- package/node_modules/yaml/dist/stringify/stringifyString.js +338 -0
- package/node_modules/yaml/dist/test-events.d.ts +4 -0
- package/node_modules/yaml/dist/test-events.js +134 -0
- package/node_modules/yaml/dist/util.d.ts +16 -0
- package/node_modules/yaml/dist/util.js +28 -0
- package/node_modules/yaml/dist/visit.d.ts +102 -0
- package/node_modules/yaml/dist/visit.js +236 -0
- package/node_modules/yaml/package.json +97 -0
- package/node_modules/yaml/util.js +2 -0
- package/package.json +9 -8
- package/src/analysis/architecture/discovery.ts +213 -227
- package/src/analysis/architecture/manifest.ts +147 -0
- package/src/analysis/architecture/model.ts +119 -52
- package/src/analysis/architecture/workspace-config.ts +229 -0
- package/src/analysis/{coverage/coverage-warnings.ts → capability/capability-warnings.ts} +41 -78
- package/src/analysis/evidence.ts +22 -5
- package/src/analysis/health/diagnostics.ts +183 -0
- package/src/analysis/health/recovery.ts +39 -0
- package/src/analysis/health/signals.ts +20 -0
- package/src/analysis/instruction-files.ts +60 -48
- package/src/analysis/provider.ts +31 -12
- package/src/analysis/readiness.ts +29 -9
- package/src/{tool/refactor-apply → analysis/refactor}/apply.ts +120 -26
- package/src/analysis/refactor/position.ts +6 -0
- package/src/analysis/refactor/safety.ts +4 -11
- package/src/analysis/references/locations.ts +20 -0
- package/src/analysis/references/semantic-refs.ts +21 -11
- package/src/{tool/graph → analysis/relations}/implementations.ts +27 -23
- package/src/analysis/relations/provider-locations.ts +179 -0
- package/src/{tool/graph → analysis/relations}/references.ts +25 -21
- package/src/{tool/graph → analysis/relations}/types.ts +4 -19
- package/src/analysis/search/ast-scan.ts +376 -0
- package/src/analysis/search/call-name.ts +68 -0
- package/src/analysis/search/deadline.ts +84 -0
- package/src/analysis/search/paths.ts +88 -0
- package/src/analysis/search/pattern.ts +290 -246
- package/src/analysis/target/anchored.ts +72 -27
- package/src/analysis/target/file.ts +292 -132
- package/src/analysis/target/identity.ts +237 -0
- package/src/analysis/target/symbol.ts +169 -86
- package/src/analysis/target/types.ts +36 -4
- package/src/api.ts +21 -4
- package/src/app/app.ts +53 -46
- package/src/extension.ts +68 -66
- package/src/session/capability-adapter.ts +26 -118
- package/src/session/find-types.ts +38 -0
- package/src/session/find-workflow.ts +141 -0
- package/src/session/graph/collect.ts +181 -0
- package/src/session/graph-types.ts +77 -0
- package/src/session/graph-workflow.ts +152 -0
- package/src/session/health-types.ts +134 -0
- package/src/session/health-workflow.ts +341 -0
- package/src/session/input/common.ts +216 -0
- package/src/session/input/health-refactor.ts +169 -0
- package/src/session/input/workflows.ts +211 -0
- package/src/session/inspect/collect.ts +304 -0
- package/src/session/inspect/file-point.ts +69 -0
- package/src/session/inspect-types.ts +78 -0
- package/src/session/inspect-workflow.ts +157 -0
- package/src/session/orientation/collect.ts +718 -0
- package/src/session/orientation/context-facts.ts +319 -0
- package/src/session/orientation/context-sections.ts +352 -0
- package/src/session/orientation-types.ts +97 -0
- package/src/session/orientation-workflow.ts +307 -0
- package/src/session/refactor-plans.ts +1 -1
- package/src/session/refactor-types.ts +51 -0
- package/src/session/refactor-workflow.ts +263 -0
- package/src/session/session.ts +263 -234
- package/src/session/target-candidates.ts +60 -0
- package/src/session/target-input.ts +98 -0
- package/src/session/target-store.ts +132 -29
- package/src/session/target-workflow.ts +254 -302
- package/src/session/workflow-control.ts +35 -0
- package/src/substrate/lsp/lifecycle.ts +9 -22
- package/src/substrate/lsp/maintenance.ts +75 -0
- package/src/substrate/lsp/recovery.ts +41 -25
- package/src/substrate/lsp/settings.ts +1 -10
- package/src/substrate/lsp/state.ts +2 -13
- package/src/tool/find/ast-kinds.ts +35 -0
- package/src/tool/find/execute.ts +22 -113
- package/src/tool/find/markdown.ts +85 -221
- package/src/tool/find/modes.ts +5 -0
- package/src/tool/find/render.ts +57 -0
- package/src/tool/find/tui.ts +1 -1
- package/src/tool/graph/calls-md.ts +17 -30
- package/src/tool/graph/execute.ts +42 -103
- package/src/tool/graph/implementations-md.ts +32 -54
- package/src/tool/graph/markdown-base.ts +73 -196
- package/src/tool/graph/provider-location-md.ts +9 -0
- package/src/tool/graph/references-md.ts +34 -27
- package/src/tool/graph/tui.ts +8 -26
- package/src/tool/guidance.ts +31 -48
- package/src/tool/health/execute.ts +15 -56
- package/src/tool/health/markdown.ts +199 -148
- package/src/tool/health/semantic-state.ts +24 -0
- package/src/tool/health/tui.ts +262 -36
- package/src/tool/infra/error-results.ts +0 -2
- package/src/tool/infra/progress.ts +2 -2
- package/src/tool/infra/workflow-control.ts +11 -0
- package/src/tool/inspect/execute.ts +23 -63
- package/src/tool/inspect/markdown.ts +114 -95
- package/src/tool/inspect/tui.ts +7 -7
- package/src/tool/orientation/execute.ts +50 -37
- package/src/tool/orientation/markdown.ts +26 -31
- package/src/tool/orientation/tui.ts +41 -39
- package/src/tool/refactor-apply/execute.ts +23 -9
- package/src/tool/refactor-apply/tui.ts +7 -3
- package/src/tool/refactor-plan/execute.ts +44 -61
- package/src/tool/refactor-plan/markdown.ts +33 -56
- package/src/tool/refactor-plan/tui.ts +10 -11
- package/src/tool/register.ts +6 -5
- package/src/tool/resolve/execute.ts +23 -69
- package/src/tool/resolve/markdown.ts +125 -114
- package/src/tool/resolve/tui.ts +11 -9
- package/src/tool/result/assembly.ts +125 -0
- package/src/tool/result/errors.ts +20 -34
- package/src/tool/result/find.ts +107 -21
- package/src/tool/result/graph.ts +163 -64
- package/src/tool/result/health.ts +170 -73
- package/src/tool/result/inspect.ts +183 -41
- package/src/tool/result/orientation.ts +118 -16
- package/src/tool/result/refactor.ts +101 -21
- package/src/tool/result/resolve.ts +243 -80
- package/src/tool/result/types.ts +100 -56
- package/src/tool/schemas.ts +160 -231
- package/src/tool/specs.ts +57 -168
- package/src/types/details.ts +2 -4
- package/src/types/execution.ts +6 -15
- package/src/types/index.ts +2 -4
- package/src/types/tool-names.ts +1 -2
- package/src/ui/footer.ts +3 -3
- package/src/ui/markdown/gather.ts +17 -65
- package/src/ui/markdown/overview-data.ts +143 -21
- package/src/ui/markdown/overview.ts +27 -8
- package/src/ui/markdown/types.ts +12 -16
- package/src/ui/status-command.ts +39 -31
- package/src/ui/status-overlay.ts +23 -15
- package/src/ui/tui/common.ts +121 -74
- package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/abort-utils.ts +0 -31
- package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/substrate-types.ts +0 -11
- package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/types.ts +0 -2
- package/node_modules/@mrclrchtr/supi-core/src/abort-utils.ts +0 -31
- package/node_modules/@mrclrchtr/supi-core/src/substrate-types.ts +0 -11
- package/node_modules/@mrclrchtr/supi-core/src/types.ts +0 -2
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/abort-utils.ts +0 -31
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/substrate-types.ts +0 -11
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/types.ts +0 -2
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/abort-utils.ts +0 -31
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/substrate-types.ts +0 -11
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/types.ts +0 -2
- package/node_modules/@mrclrchtr/supi-lsp/src/diagnostics/diagnostic-augmentation.ts +0 -82
- package/node_modules/@mrclrchtr/supi-lsp/src/diagnostics/diagnostic-context.ts +0 -116
- package/node_modules/@mrclrchtr/supi-lsp/src/diagnostics/diagnostic-display.ts +0 -69
- package/node_modules/@mrclrchtr/supi-lsp/src/manager/capability-index.ts +0 -24
- package/node_modules/@mrclrchtr/supi-lsp/src/manager/client-pool.ts +0 -33
- package/node_modules/@mrclrchtr/supi-lsp/src/manager/diagnostic-store.ts +0 -51
- package/node_modules/@mrclrchtr/supi-lsp/src/manager/manager-stale-resync.ts +0 -47
- package/node_modules/@mrclrchtr/supi-lsp/src/manager/recovery-coordinator.ts +0 -37
- package/node_modules/@mrclrchtr/supi-lsp/src/manager/workspace-router.ts +0 -44
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/abort-utils.ts +0 -31
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/substrate-types.ts +0 -11
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/types.ts +0 -2
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/abort-utils.ts +0 -31
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/substrate-types.ts +0 -11
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/types.ts +0 -2
- package/src/analysis/brief/directory.ts +0 -324
- package/src/analysis/brief/enrich.ts +0 -157
- package/src/analysis/brief/file.ts +0 -84
- package/src/analysis/brief/inventory.ts +0 -177
- package/src/analysis/brief/main.ts +0 -176
- package/src/analysis/brief/models.ts +0 -75
- package/src/analysis/brief/public-brief.ts +0 -179
- package/src/analysis/brief/summarize.ts +0 -208
- package/src/analysis/brief/types.ts +0 -27
- package/src/analysis/brief/use-case.ts +0 -264
- package/src/analysis/search/ripgrep.ts +0 -558
- package/src/analysis/signals/git.ts +0 -89
- package/src/analysis/signals/project.ts +0 -189
- package/src/analysis/target/bridge.ts +0 -152
- package/src/analysis/target/file-resolution.ts +0 -125
- package/src/analysis/target/planner.ts +0 -92
- package/src/analysis/target/query.ts +0 -74
- package/src/analysis/target/resolve-common.ts +0 -115
- package/src/analysis/target/service.ts +0 -229
- package/src/analysis/tests/likely-tests.ts +0 -174
- package/src/analysis/tests/test-discovery.ts +0 -540
- package/src/analysis/tests/vitest.ts +0 -87
- package/src/app/manager.ts +0 -65
- package/src/substrate/lsp/diagnostic-injection.ts +0 -203
- package/src/substrate/lsp/overrides.ts +0 -132
- package/src/tool/find/orchestrate.ts +0 -317
- package/src/tool/find/semantic-search.ts +0 -128
- package/src/tool/graph/collect-relation.ts +0 -372
- package/src/tool/graph/orchestrate.ts +0 -259
- package/src/tool/health/orchestrate.ts +0 -151
- package/src/tool/health/sections/diagnostics.ts +0 -182
- package/src/tool/health/sections/recovery.ts +0 -89
- package/src/tool/health/sections/signals.ts +0 -89
- package/src/tool/impact/analysis.ts +0 -220
- package/src/tool/impact/change-set-impact.ts +0 -152
- package/src/tool/impact/execute.ts +0 -125
- package/src/tool/impact/file-level-impact.ts +0 -82
- package/src/tool/impact/markdown.ts +0 -283
- package/src/tool/impact/orchestrate.ts +0 -97
- package/src/tool/impact/result.ts +0 -2
- package/src/tool/impact/single-impact.ts +0 -90
- package/src/tool/impact/tui.ts +0 -39
- package/src/tool/impact/types.ts +0 -34
- package/src/tool/infra/cross-field.ts +0 -335
- package/src/tool/infra/pipeline.ts +0 -334
- package/src/tool/infra/readiness-message.ts +0 -5
- package/src/tool/inspect/orchestrate.ts +0 -154
- package/src/tool/orientation/deps.ts +0 -63
- package/src/tool/orientation/mode.ts +0 -139
- package/src/tool/orientation/orchestrate.ts +0 -475
- package/src/tool/orientation/precise-target.ts +0 -253
- package/src/tool/params.ts +0 -15
- package/src/tool/refactor-apply/markdown.ts +0 -118
- package/src/tool/refactor-apply/orchestrate.ts +0 -84
- package/src/tool/refactor-plan/orchestrate.ts +0 -355
- package/src/tool/resolve/orchestrate.ts +0 -38
- package/src/tool/result/impact.ts +0 -50
- package/src/ui/markdown/brief.ts +0 -218
- package/src/ui/message-renderer.ts +0 -121
- package/src/ui/tui/index.ts +0 -37
- /package/src/{tool/graph → analysis/relations}/callees.ts +0 -0
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
/** Runtime parsers for health and refactor session workflows. */
|
|
2
|
+
|
|
3
|
+
import type { HealthSection, HealthWorkflowInput } from "../health-types.ts";
|
|
4
|
+
import type {
|
|
5
|
+
PublicSourceRange,
|
|
6
|
+
RefactorApplyWorkflowInput,
|
|
7
|
+
RefactorOperationInput,
|
|
8
|
+
RefactorPlanWorkflowInput,
|
|
9
|
+
} from "../refactor-types.ts";
|
|
10
|
+
import type { RefactorTargetInput } from "../target-input.ts";
|
|
11
|
+
import {
|
|
12
|
+
type InputValidation,
|
|
13
|
+
invalid,
|
|
14
|
+
optionalString,
|
|
15
|
+
parsePosition,
|
|
16
|
+
parseTargetInput,
|
|
17
|
+
requireOnlyKeys,
|
|
18
|
+
requireRecord,
|
|
19
|
+
requireString,
|
|
20
|
+
valid,
|
|
21
|
+
} from "./common.ts";
|
|
22
|
+
|
|
23
|
+
const HEALTH_SECTIONS = new Set<HealthSection>(["diagnostics", "servers"]);
|
|
24
|
+
|
|
25
|
+
export function parseHealthWorkflowInput(value: unknown): InputValidation<HealthWorkflowInput> {
|
|
26
|
+
const record = requireRecord(value, "code_health input");
|
|
27
|
+
if (record.kind === "invalid-input") return record;
|
|
28
|
+
const keysError = requireOnlyKeys(
|
|
29
|
+
record.value,
|
|
30
|
+
["scope", "refresh", "include", "level"],
|
|
31
|
+
"code_health input",
|
|
32
|
+
);
|
|
33
|
+
if (keysError) return invalid(keysError);
|
|
34
|
+
const scope = optionalString(record.value.scope, "scope");
|
|
35
|
+
if (scope.kind === "invalid-input") return scope;
|
|
36
|
+
const refresh = parseRefresh(record.value.refresh);
|
|
37
|
+
if (refresh.kind === "invalid-input") return refresh;
|
|
38
|
+
const level = parseHealthLevel(record.value.level);
|
|
39
|
+
if (level.kind === "invalid-input") return level;
|
|
40
|
+
const include = parseHealthSections(record.value.include);
|
|
41
|
+
if (include.kind === "invalid-input") return include;
|
|
42
|
+
return valid({
|
|
43
|
+
...(scope.value === undefined ? {} : { scope: scope.value }),
|
|
44
|
+
...(refresh.value === undefined ? {} : { refresh: refresh.value }),
|
|
45
|
+
...(include.value === undefined ? {} : { include: include.value }),
|
|
46
|
+
...(level.value === undefined ? {} : { level: level.value }),
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
function parseRefresh(value: unknown): InputValidation<boolean | undefined> {
|
|
51
|
+
if (value === undefined || typeof value === "boolean") return valid(value);
|
|
52
|
+
return invalid("refresh must be a boolean.");
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
function parseHealthLevel(value: unknown): InputValidation<"summary" | "detailed" | undefined> {
|
|
56
|
+
if (value === undefined || value === "summary" || value === "detailed") return valid(value);
|
|
57
|
+
return invalid('level must be "summary" or "detailed".');
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
function parseHealthSections(
|
|
61
|
+
value: unknown,
|
|
62
|
+
): InputValidation<readonly HealthSection[] | undefined> {
|
|
63
|
+
if (value === undefined) return valid(undefined);
|
|
64
|
+
if (!Array.isArray(value) || !value.every((item) => typeof item === "string")) {
|
|
65
|
+
return invalid("include must be an array of health sections.");
|
|
66
|
+
}
|
|
67
|
+
if (
|
|
68
|
+
new Set(value).size !== value.length ||
|
|
69
|
+
!value.every((item) => HEALTH_SECTIONS.has(item as HealthSection))
|
|
70
|
+
) {
|
|
71
|
+
return invalid("include contains an unsupported or duplicate health section.");
|
|
72
|
+
}
|
|
73
|
+
return valid(value as HealthSection[]);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export function parseRefactorPlanWorkflowInput(
|
|
77
|
+
value: unknown,
|
|
78
|
+
): InputValidation<RefactorPlanWorkflowInput> {
|
|
79
|
+
const record = requireRecord(value, "code_refactor_plan input");
|
|
80
|
+
if (record.kind === "invalid-input") return record;
|
|
81
|
+
const keysError = requireOnlyKeys(
|
|
82
|
+
record.value,
|
|
83
|
+
["target", "operation"],
|
|
84
|
+
"code_refactor_plan input",
|
|
85
|
+
);
|
|
86
|
+
if (keysError) return invalid(keysError);
|
|
87
|
+
const target = parseTargetInput(record.value.target, ["handle", "anchor"]);
|
|
88
|
+
if (target.kind === "invalid-input") return target;
|
|
89
|
+
const operation = parseRefactorOperation(record.value.operation);
|
|
90
|
+
if (operation.kind === "invalid-input") return operation;
|
|
91
|
+
return valid({ target: target.value as RefactorTargetInput, operation: operation.value });
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
function parseRefactorOperation(value: unknown): InputValidation<RefactorOperationInput> {
|
|
95
|
+
const record = requireRecord(value, "operation");
|
|
96
|
+
if (record.kind === "invalid-input") return record;
|
|
97
|
+
const keysError = requireOnlyKeys(
|
|
98
|
+
record.value,
|
|
99
|
+
["rename_symbol", "extract_function", "extract_variable"],
|
|
100
|
+
"operation",
|
|
101
|
+
);
|
|
102
|
+
if (keysError) return invalid(keysError);
|
|
103
|
+
const selected = (["rename_symbol", "extract_function", "extract_variable"] as const).filter(
|
|
104
|
+
(key) => record.value[key] !== undefined,
|
|
105
|
+
);
|
|
106
|
+
if (selected.length !== 1) return invalid("Select exactly one refactor operation.");
|
|
107
|
+
|
|
108
|
+
const name = selected[0];
|
|
109
|
+
const payload = requireRecord(record.value[name], `operation.${name}`);
|
|
110
|
+
if (payload.kind === "invalid-input") return payload;
|
|
111
|
+
if (name === "rename_symbol") return parseRenameOperation(payload.value);
|
|
112
|
+
return parseExtractOperation(name, payload.value);
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
function parseRenameOperation(
|
|
116
|
+
payload: Record<string, unknown>,
|
|
117
|
+
): InputValidation<RefactorOperationInput> {
|
|
118
|
+
const payloadError = requireOnlyKeys(payload, ["newName"], "operation.rename_symbol");
|
|
119
|
+
if (payloadError) return invalid(payloadError);
|
|
120
|
+
const newName = requireString(payload.newName, "operation.rename_symbol.newName", {
|
|
121
|
+
nonEmpty: true,
|
|
122
|
+
});
|
|
123
|
+
return newName.kind === "valid" ? valid({ rename_symbol: { newName: newName.value } }) : newName;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
function parseExtractOperation(
|
|
127
|
+
name: "extract_function" | "extract_variable",
|
|
128
|
+
payload: Record<string, unknown>,
|
|
129
|
+
): InputValidation<RefactorOperationInput> {
|
|
130
|
+
const payloadError = requireOnlyKeys(payload, ["newName", "range"], `operation.${name}`);
|
|
131
|
+
if (payloadError) return invalid(payloadError);
|
|
132
|
+
const newName = requireString(payload.newName, `operation.${name}.newName`, { nonEmpty: true });
|
|
133
|
+
if (newName.kind === "invalid-input") return newName;
|
|
134
|
+
const range = parsePublicRange(payload.range);
|
|
135
|
+
if (range.kind === "invalid-input") return range;
|
|
136
|
+
return name === "extract_function"
|
|
137
|
+
? valid({ extract_function: { newName: newName.value, range: range.value } })
|
|
138
|
+
: valid({ extract_variable: { newName: newName.value, range: range.value } });
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
function parsePublicRange(value: unknown): InputValidation<PublicSourceRange> {
|
|
142
|
+
const record = requireRecord(value, "range");
|
|
143
|
+
if (record.kind === "invalid-input") return record;
|
|
144
|
+
const keysError = requireOnlyKeys(record.value, ["start", "end"], "range");
|
|
145
|
+
if (keysError) return invalid(keysError);
|
|
146
|
+
const start = parsePosition(record.value.start, "range.start");
|
|
147
|
+
if (start.kind === "invalid-input") return start;
|
|
148
|
+
const end = parsePosition(record.value.end, "range.end");
|
|
149
|
+
if (end.kind === "invalid-input") return end;
|
|
150
|
+
if (
|
|
151
|
+
end.value.line < start.value.line ||
|
|
152
|
+
(end.value.line === start.value.line && end.value.character <= start.value.character)
|
|
153
|
+
) {
|
|
154
|
+
return invalid("range.end must be after range.start.");
|
|
155
|
+
}
|
|
156
|
+
return valid({ start: start.value, end: end.value });
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
export function parseRefactorApplyWorkflowInput(
|
|
160
|
+
value: unknown,
|
|
161
|
+
): InputValidation<RefactorApplyWorkflowInput> {
|
|
162
|
+
const record = requireRecord(value, "code_refactor_apply input");
|
|
163
|
+
if (record.kind === "invalid-input") return record;
|
|
164
|
+
const keysError = requireOnlyKeys(record.value, ["planId"], "code_refactor_apply input");
|
|
165
|
+
if (keysError) return invalid(keysError);
|
|
166
|
+
const planId = requireString(record.value.planId, "planId");
|
|
167
|
+
if (planId.kind === "invalid-input") return planId;
|
|
168
|
+
return planId.value.trim() ? valid({ planId: planId.value }) : invalid("planId is required.");
|
|
169
|
+
}
|
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
/** Runtime parsers for inspection, Orientation, graph, and find workflows. */
|
|
2
|
+
|
|
3
|
+
import { type CodeFindAstKind, isCodeFindAstKind } from "../../tool/find/ast-kinds.ts";
|
|
4
|
+
import { CODE_FIND_MODES } from "../../tool/find/modes.ts";
|
|
5
|
+
import type { FindMode, FindWorkflowInput } from "../find-types.ts";
|
|
6
|
+
import type { GraphWorkflowInput, RequestedGraphRelation } from "../graph-types.ts";
|
|
7
|
+
import type { InspectWorkflowInput } from "../inspect-types.ts";
|
|
8
|
+
import type { OrientationFocusInput, OrientationWorkflowInput } from "../orientation-types.ts";
|
|
9
|
+
import type { GraphTargetInput, OrientationTargetInput } from "../target-input.ts";
|
|
10
|
+
import {
|
|
11
|
+
type InputValidation,
|
|
12
|
+
invalid,
|
|
13
|
+
optionalPositiveInteger,
|
|
14
|
+
parseSourcePoint,
|
|
15
|
+
parseTargetInput,
|
|
16
|
+
requireOnlyKeys,
|
|
17
|
+
requireRecord,
|
|
18
|
+
requireString,
|
|
19
|
+
valid,
|
|
20
|
+
} from "./common.ts";
|
|
21
|
+
|
|
22
|
+
const FIND_MODES = new Set<FindMode>(CODE_FIND_MODES);
|
|
23
|
+
const GRAPH_RELATIONS = new Set<RequestedGraphRelation>([
|
|
24
|
+
"all",
|
|
25
|
+
"references",
|
|
26
|
+
"callees",
|
|
27
|
+
"implements",
|
|
28
|
+
]);
|
|
29
|
+
|
|
30
|
+
export function parseInspectWorkflowInput(value: unknown): InputValidation<InspectWorkflowInput> {
|
|
31
|
+
const record = requireRecord(value, "code_inspect input");
|
|
32
|
+
if (record.kind === "invalid-input") return record;
|
|
33
|
+
const keysError = requireOnlyKeys(record.value, ["point", "maxResults"], "code_inspect input");
|
|
34
|
+
if (keysError) return invalid(keysError);
|
|
35
|
+
const point = parseSourcePoint(record.value.point);
|
|
36
|
+
if (point.kind === "invalid-input") return point;
|
|
37
|
+
const maxResults = optionalPositiveInteger(record.value.maxResults, "maxResults");
|
|
38
|
+
if (maxResults.kind === "invalid-input") return maxResults;
|
|
39
|
+
return valid({
|
|
40
|
+
point: point.value,
|
|
41
|
+
...(maxResults.value === undefined ? {} : { maxResults: maxResults.value }),
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export function parseOrientationWorkflowInput(
|
|
46
|
+
value: unknown,
|
|
47
|
+
): InputValidation<OrientationWorkflowInput> {
|
|
48
|
+
const record = requireRecord(value, "code_orientation input");
|
|
49
|
+
if (record.kind === "invalid-input") return record;
|
|
50
|
+
const keysError = requireOnlyKeys(
|
|
51
|
+
record.value,
|
|
52
|
+
["focus", "maxResults"],
|
|
53
|
+
"code_orientation input",
|
|
54
|
+
);
|
|
55
|
+
if (keysError) return invalid(keysError);
|
|
56
|
+
const focus = parseOrientationFocus(record.value.focus);
|
|
57
|
+
if (focus.kind === "invalid-input") return focus;
|
|
58
|
+
const maxResults = optionalPositiveInteger(record.value.maxResults, "maxResults");
|
|
59
|
+
if (maxResults.kind === "invalid-input") return maxResults;
|
|
60
|
+
return valid({
|
|
61
|
+
...(focus.value === undefined ? {} : { focus: focus.value }),
|
|
62
|
+
...(maxResults.value === undefined ? {} : { maxResults: maxResults.value }),
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
function parseOrientationFocus(value: unknown): InputValidation<OrientationFocusInput | undefined> {
|
|
67
|
+
if (value === undefined) return valid(undefined);
|
|
68
|
+
const record = requireRecord(value, "focus");
|
|
69
|
+
if (record.kind === "invalid-input") return record;
|
|
70
|
+
const keysError = requireOnlyKeys(record.value, ["path", "module", "target"], "focus");
|
|
71
|
+
if (keysError) return invalid(keysError);
|
|
72
|
+
const selected = (["path", "module", "target"] as const).filter(
|
|
73
|
+
(key) => record.value[key] !== undefined,
|
|
74
|
+
);
|
|
75
|
+
if (selected.length !== 1) {
|
|
76
|
+
return invalid("focus must contain exactly one of `path`, `module`, or `target`.");
|
|
77
|
+
}
|
|
78
|
+
if (selected[0] === "path") {
|
|
79
|
+
const path = requireString(record.value.path, "focus.path", { nonEmpty: true });
|
|
80
|
+
return path.kind === "valid" ? valid({ path: path.value }) : path;
|
|
81
|
+
}
|
|
82
|
+
if (selected[0] === "module") {
|
|
83
|
+
const module = requireString(record.value.module, "focus.module", { nonEmpty: true });
|
|
84
|
+
return module.kind === "valid" ? valid({ module: module.value }) : module;
|
|
85
|
+
}
|
|
86
|
+
const target = parseTargetInput(record.value.target, ["handle", "anchor", "symbol"]);
|
|
87
|
+
return target.kind === "valid"
|
|
88
|
+
? valid({ target: target.value as OrientationTargetInput })
|
|
89
|
+
: target;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
export function parseGraphWorkflowInput(value: unknown): InputValidation<GraphWorkflowInput> {
|
|
93
|
+
const record = requireRecord(value, "code_graph input");
|
|
94
|
+
if (record.kind === "invalid-input") return record;
|
|
95
|
+
const keysError = requireOnlyKeys(
|
|
96
|
+
record.value,
|
|
97
|
+
["target", "relations", "calleeDepth", "maxResults"],
|
|
98
|
+
"code_graph input",
|
|
99
|
+
);
|
|
100
|
+
if (keysError) return invalid(keysError);
|
|
101
|
+
const target = parseTargetInput(record.value.target, ["handle", "anchor", "symbol"]);
|
|
102
|
+
if (target.kind === "invalid-input") return target;
|
|
103
|
+
const relations = parseRelations(record.value.relations);
|
|
104
|
+
if (relations.kind === "invalid-input") return relations;
|
|
105
|
+
const calleeDepth = parseCalleeDepth(record.value.calleeDepth);
|
|
106
|
+
if (calleeDepth.kind === "invalid-input") return calleeDepth;
|
|
107
|
+
const maxResults = optionalPositiveInteger(record.value.maxResults, "maxResults");
|
|
108
|
+
if (maxResults.kind === "invalid-input") return maxResults;
|
|
109
|
+
return valid({
|
|
110
|
+
target: target.value as GraphTargetInput,
|
|
111
|
+
...(relations.value === undefined ? {} : { relations: relations.value }),
|
|
112
|
+
...(calleeDepth.value === undefined ? {} : { calleeDepth: calleeDepth.value }),
|
|
113
|
+
...(maxResults.value === undefined ? {} : { maxResults: maxResults.value }),
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
function parseRelations(
|
|
118
|
+
value: unknown,
|
|
119
|
+
): InputValidation<readonly RequestedGraphRelation[] | undefined> {
|
|
120
|
+
if (value === undefined) return valid(undefined);
|
|
121
|
+
if (
|
|
122
|
+
!Array.isArray(value) ||
|
|
123
|
+
value.length === 0 ||
|
|
124
|
+
!value.every((item) => typeof item === "string")
|
|
125
|
+
) {
|
|
126
|
+
return invalid("relations must be a non-empty array of supported relation names.");
|
|
127
|
+
}
|
|
128
|
+
if (
|
|
129
|
+
new Set(value).size !== value.length ||
|
|
130
|
+
!value.every((item) => GRAPH_RELATIONS.has(item as RequestedGraphRelation))
|
|
131
|
+
) {
|
|
132
|
+
return invalid("relations contains an unsupported or duplicate relation.");
|
|
133
|
+
}
|
|
134
|
+
if (value.includes("all") && value.length !== 1) {
|
|
135
|
+
return invalid('`relations: ["all"]` cannot be combined with named relations.');
|
|
136
|
+
}
|
|
137
|
+
return valid(value as RequestedGraphRelation[]);
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
function parseCalleeDepth(value: unknown): InputValidation<"direct" | "deep" | undefined> {
|
|
141
|
+
if (value === undefined) return valid(undefined);
|
|
142
|
+
return value === "direct" || value === "deep"
|
|
143
|
+
? valid(value)
|
|
144
|
+
: invalid('calleeDepth must be "direct" or "deep".');
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
export function parseFindWorkflowInput(value: unknown): InputValidation<FindWorkflowInput> {
|
|
148
|
+
const record = requireRecord(value, "code_find input");
|
|
149
|
+
if (record.kind === "invalid-input") return record;
|
|
150
|
+
const keysError = requireOnlyKeys(
|
|
151
|
+
record.value,
|
|
152
|
+
["query", "scope", "mode", "kind", "maxResults"],
|
|
153
|
+
"code_find input",
|
|
154
|
+
);
|
|
155
|
+
if (keysError) return invalid(keysError);
|
|
156
|
+
const query = requireString(record.value.query, "query", { nonEmpty: true });
|
|
157
|
+
if (query.kind === "invalid-input") return query;
|
|
158
|
+
const scope = parseFindScope(record.value.scope);
|
|
159
|
+
if (scope.kind === "invalid-input") return scope;
|
|
160
|
+
const mode = parseFindMode(record.value.mode);
|
|
161
|
+
if (mode.kind === "invalid-input") return mode;
|
|
162
|
+
const patternKind = parsePatternKind(record.value.kind);
|
|
163
|
+
if (patternKind.kind === "invalid-input") return patternKind;
|
|
164
|
+
const modeError = validateFindModeFields(mode.value, patternKind.value);
|
|
165
|
+
if (modeError) return invalid(modeError);
|
|
166
|
+
const maxResults = optionalPositiveInteger(record.value.maxResults, "maxResults");
|
|
167
|
+
if (maxResults.kind === "invalid-input") return maxResults;
|
|
168
|
+
return valid({
|
|
169
|
+
query: query.value,
|
|
170
|
+
...(scope.value === undefined ? {} : { scope: scope.value }),
|
|
171
|
+
mode: mode.value,
|
|
172
|
+
...(patternKind.value === undefined ? {} : { kind: patternKind.value }),
|
|
173
|
+
...(maxResults.value === undefined ? {} : { maxResults: maxResults.value }),
|
|
174
|
+
});
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
function parseFindScope(value: unknown): InputValidation<readonly string[] | undefined> {
|
|
178
|
+
if (value === undefined) return valid(undefined);
|
|
179
|
+
if (
|
|
180
|
+
!Array.isArray(value) ||
|
|
181
|
+
value.length === 0 ||
|
|
182
|
+
!value.every((item) => typeof item === "string")
|
|
183
|
+
) {
|
|
184
|
+
return invalid("scope must be a non-empty array of workspace-relative paths.");
|
|
185
|
+
}
|
|
186
|
+
if (value.some((item) => item.trim().length === 0)) {
|
|
187
|
+
return invalid("scope must not contain empty paths.");
|
|
188
|
+
}
|
|
189
|
+
return valid(value);
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
function parseFindMode(value: unknown): InputValidation<FindMode> {
|
|
193
|
+
return typeof value === "string" && FIND_MODES.has(value as FindMode)
|
|
194
|
+
? valid(value as FindMode)
|
|
195
|
+
: invalid("mode is required and must be one of ast or semantic.");
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
function parsePatternKind(value: unknown): InputValidation<CodeFindAstKind | undefined> {
|
|
199
|
+
if (value === undefined) return valid(undefined);
|
|
200
|
+
return isCodeFindAstKind(value) ? valid(value) : invalid("Unsupported AST kind.");
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
function validateFindModeFields(
|
|
204
|
+
mode: FindMode,
|
|
205
|
+
patternKind: CodeFindAstKind | undefined,
|
|
206
|
+
): string | null {
|
|
207
|
+
if (mode === "ast" && patternKind === undefined) return 'mode "ast" requires kind.';
|
|
208
|
+
return mode !== "ast" && patternKind !== undefined
|
|
209
|
+
? `kind is not valid with mode "${mode}".`
|
|
210
|
+
: null;
|
|
211
|
+
}
|
|
@@ -0,0 +1,304 @@
|
|
|
1
|
+
/** Independent substrate collection for exact point inspection. */
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
type CodePosition,
|
|
5
|
+
mapCodeQueryResult,
|
|
6
|
+
type OutlineData,
|
|
7
|
+
type SemanticProvider,
|
|
8
|
+
type StructuralProvider,
|
|
9
|
+
unavailableCodeQuery,
|
|
10
|
+
} from "@mrclrchtr/supi-code-runtime/api";
|
|
11
|
+
import { uriToFile } from "@mrclrchtr/supi-core/path";
|
|
12
|
+
import type { WorkspaceLspRuntimeState } from "@mrclrchtr/supi-lsp/api";
|
|
13
|
+
import { relativeDisplayPath } from "../../analysis/search/paths.ts";
|
|
14
|
+
import { diagnosticMessageString } from "../../substrate/lsp/utils.ts";
|
|
15
|
+
import type {
|
|
16
|
+
InspectDefinition,
|
|
17
|
+
InspectDiagnostic,
|
|
18
|
+
InspectEnclosingSymbol,
|
|
19
|
+
InspectNode,
|
|
20
|
+
InspectObservation,
|
|
21
|
+
InspectSections,
|
|
22
|
+
} from "../inspect-types.ts";
|
|
23
|
+
|
|
24
|
+
export interface InspectCollectionInput {
|
|
25
|
+
readonly cwd: string;
|
|
26
|
+
readonly file: string;
|
|
27
|
+
readonly line: number;
|
|
28
|
+
readonly character: number;
|
|
29
|
+
readonly lineCount: number;
|
|
30
|
+
readonly structural: StructuralProvider | null;
|
|
31
|
+
readonly semantic: SemanticProvider | null;
|
|
32
|
+
readonly semanticUnavailableReason: string;
|
|
33
|
+
readonly lspState: WorkspaceLspRuntimeState;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/** Collect every inspection section independently so one failure cannot erase siblings. */
|
|
37
|
+
export async function collectInspectSections(
|
|
38
|
+
input: InspectCollectionInput,
|
|
39
|
+
): Promise<InspectSections> {
|
|
40
|
+
const node = await collectNode(input);
|
|
41
|
+
const enclosingSymbol = await collectEnclosingSymbol(input);
|
|
42
|
+
const hover = await collectHover(input);
|
|
43
|
+
const definition = await collectDefinition(input);
|
|
44
|
+
const diagnostics = await collectDiagnostics(input);
|
|
45
|
+
return { node, enclosingSymbol, hover, definition, diagnostics };
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
async function collectNode(
|
|
49
|
+
input: InspectCollectionInput,
|
|
50
|
+
): Promise<InspectObservation<InspectNode | null>> {
|
|
51
|
+
if (!input.structural) return unavailableCodeQuery("No structural node provider is active.");
|
|
52
|
+
try {
|
|
53
|
+
const result = await input.structural.nodeAt(input.file, input.line, input.character);
|
|
54
|
+
if (result.kind !== "success") return unavailableCodeQuery(result.message);
|
|
55
|
+
return {
|
|
56
|
+
kind: "completed",
|
|
57
|
+
data: {
|
|
58
|
+
type: result.data.type,
|
|
59
|
+
text: result.data.text,
|
|
60
|
+
startLine: result.data.startLine,
|
|
61
|
+
startCharacter: result.data.startCharacter,
|
|
62
|
+
endLine: result.data.endLine,
|
|
63
|
+
endCharacter: result.data.endCharacter,
|
|
64
|
+
ancestry: result.data.ancestry ?? [],
|
|
65
|
+
},
|
|
66
|
+
};
|
|
67
|
+
} catch (error) {
|
|
68
|
+
return unavailableCodeQuery(failureReason("Structural node lookup", error));
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
async function collectEnclosingSymbol(
|
|
73
|
+
input: InspectCollectionInput,
|
|
74
|
+
): Promise<InspectObservation<InspectEnclosingSymbol | null>> {
|
|
75
|
+
if (!input.structural) return unavailableCodeQuery("No structural outline provider is active.");
|
|
76
|
+
try {
|
|
77
|
+
const result = await input.structural.outline(input.file);
|
|
78
|
+
if (result.kind !== "success") return unavailableCodeQuery(result.message);
|
|
79
|
+
return {
|
|
80
|
+
kind: "completed",
|
|
81
|
+
data: narrowestEnclosingSymbol(result.data, {
|
|
82
|
+
line: input.line,
|
|
83
|
+
character: input.character,
|
|
84
|
+
}),
|
|
85
|
+
};
|
|
86
|
+
} catch (error) {
|
|
87
|
+
return unavailableCodeQuery(failureReason("Structural outline lookup", error));
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
async function collectHover(
|
|
92
|
+
input: InspectCollectionInput,
|
|
93
|
+
): Promise<InspectObservation<string | null>> {
|
|
94
|
+
if (!input.semantic?.hover) return unavailableCodeQuery(input.semanticUnavailableReason);
|
|
95
|
+
try {
|
|
96
|
+
return mapCodeQueryResult(
|
|
97
|
+
await input.semantic.hover(input.file, toLspPosition(input)),
|
|
98
|
+
(hover) => hover?.contents ?? null,
|
|
99
|
+
);
|
|
100
|
+
} catch (error) {
|
|
101
|
+
return unavailableCodeQuery(failureReason("Hover lookup", error));
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
async function collectDefinition(
|
|
106
|
+
input: InspectCollectionInput,
|
|
107
|
+
): Promise<InspectObservation<readonly InspectDefinition[]>> {
|
|
108
|
+
if (!input.semantic?.definition) return unavailableCodeQuery(input.semanticUnavailableReason);
|
|
109
|
+
try {
|
|
110
|
+
const result = await input.semantic.definition(input.file, toLspPosition(input));
|
|
111
|
+
if (result.kind === "unavailable") return result;
|
|
112
|
+
const definitions: InspectDefinition[] = [];
|
|
113
|
+
let invalidCount = 0;
|
|
114
|
+
for (const location of result.data) {
|
|
115
|
+
try {
|
|
116
|
+
const file = uriToFile(location.uri);
|
|
117
|
+
definitions.push({
|
|
118
|
+
file: relativeDisplayPath(input.cwd, file, file),
|
|
119
|
+
line: location.range.start.line + 1,
|
|
120
|
+
character: location.range.start.character + 1,
|
|
121
|
+
});
|
|
122
|
+
} catch {
|
|
123
|
+
invalidCount++;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
const reasons = [
|
|
127
|
+
...(result.kind === "partial" ? [result.reason] : []),
|
|
128
|
+
...(invalidCount > 0 ? [`${invalidCount} invalid definition location(s) omitted.`] : []),
|
|
129
|
+
];
|
|
130
|
+
return reasons.length > 0
|
|
131
|
+
? { kind: "partial", data: definitions, reason: reasons.join(" ") }
|
|
132
|
+
: { kind: "completed", data: definitions };
|
|
133
|
+
} catch (error) {
|
|
134
|
+
return unavailableCodeQuery(failureReason("Definition lookup", error));
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
async function collectDiagnostics(
|
|
139
|
+
input: InspectCollectionInput,
|
|
140
|
+
): Promise<InspectObservation<readonly InspectDiagnostic[]>> {
|
|
141
|
+
if (input.lspState.kind !== "ready") {
|
|
142
|
+
return unavailableCodeQuery(lspUnavailableReason(input.lspState));
|
|
143
|
+
}
|
|
144
|
+
try {
|
|
145
|
+
const result = await input.lspState.runtime.fileDiagnostics(input.file, 4);
|
|
146
|
+
if (result.kind === "unavailable") return result;
|
|
147
|
+
const diagnostics = result.data
|
|
148
|
+
.filter((diagnostic) => diagnosticOverlapsWindow(diagnostic.range, input))
|
|
149
|
+
.map((diagnostic) => ({
|
|
150
|
+
line: diagnostic.range.start.line + 1,
|
|
151
|
+
character: diagnostic.range.start.character + 1,
|
|
152
|
+
endLine: diagnostic.range.end.line + 1,
|
|
153
|
+
endCharacter: diagnostic.range.end.character + 1,
|
|
154
|
+
severity: diagnostic.severity ?? 1,
|
|
155
|
+
message: diagnosticMessageString(diagnostic),
|
|
156
|
+
}))
|
|
157
|
+
.sort((left, right) => compareDiagnostics(left, right, input.line));
|
|
158
|
+
return result.kind === "partial"
|
|
159
|
+
? { kind: "partial", data: diagnostics, reason: result.reason }
|
|
160
|
+
: { kind: "completed", data: diagnostics };
|
|
161
|
+
} catch (error) {
|
|
162
|
+
return unavailableCodeQuery(failureReason("Diagnostic lookup", error));
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
function toLspPosition(input: Pick<InspectCollectionInput, "line" | "character">): CodePosition {
|
|
167
|
+
return { line: input.line - 1, character: input.character - 1 };
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
interface OutlineCandidate extends InspectEnclosingSymbol {
|
|
171
|
+
readonly depth: number;
|
|
172
|
+
readonly order: number;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
function narrowestEnclosingSymbol(
|
|
176
|
+
outline: readonly OutlineData[],
|
|
177
|
+
point: { line: number; character: number },
|
|
178
|
+
): InspectEnclosingSymbol | null {
|
|
179
|
+
const candidates = flattenOutline(outline).filter((candidate) => containsPoint(candidate, point));
|
|
180
|
+
const selected = candidates.sort(compareOutlineCandidates)[0];
|
|
181
|
+
if (!selected) return null;
|
|
182
|
+
const { depth: _depth, order: _order, ...symbol } = selected;
|
|
183
|
+
return symbol;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
function flattenOutline(
|
|
187
|
+
outline: readonly OutlineData[],
|
|
188
|
+
depth = 0,
|
|
189
|
+
state: { order: number } = { order: 0 },
|
|
190
|
+
): OutlineCandidate[] {
|
|
191
|
+
return outline.flatMap((item) => {
|
|
192
|
+
const candidate: OutlineCandidate = {
|
|
193
|
+
name: item.name,
|
|
194
|
+
kind: item.kind,
|
|
195
|
+
startLine: item.startLine,
|
|
196
|
+
startCharacter: item.startCharacter,
|
|
197
|
+
endLine: item.endLine,
|
|
198
|
+
endCharacter: item.endCharacter,
|
|
199
|
+
depth,
|
|
200
|
+
order: state.order++,
|
|
201
|
+
};
|
|
202
|
+
return [candidate, ...flattenOutline(item.children ?? [], depth + 1, state)];
|
|
203
|
+
});
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
function containsPoint(
|
|
207
|
+
range: InspectEnclosingSymbol,
|
|
208
|
+
point: { line: number; character: number },
|
|
209
|
+
): boolean {
|
|
210
|
+
return (
|
|
211
|
+
comparePosition(range.startLine, range.startCharacter, point.line, point.character) <= 0 &&
|
|
212
|
+
comparePosition(point.line, point.character, range.endLine, range.endCharacter) < 0
|
|
213
|
+
);
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
function compareOutlineCandidates(left: OutlineCandidate, right: OutlineCandidate): number {
|
|
217
|
+
const leftContainsRight = containsRange(left, right);
|
|
218
|
+
const rightContainsLeft = containsRange(right, left);
|
|
219
|
+
if (leftContainsRight !== rightContainsLeft) return leftContainsRight ? 1 : -1;
|
|
220
|
+
|
|
221
|
+
// Provider ranges may overlap without nesting. Prefer the smaller full range,
|
|
222
|
+
// then use source order so malformed or duplicate outlines remain deterministic.
|
|
223
|
+
const byLineSpan = left.endLine - left.startLine - (right.endLine - right.startLine);
|
|
224
|
+
const byCharacterSpan =
|
|
225
|
+
left.endCharacter - left.startCharacter - (right.endCharacter - right.startCharacter);
|
|
226
|
+
return (
|
|
227
|
+
byLineSpan ||
|
|
228
|
+
byCharacterSpan ||
|
|
229
|
+
right.depth - left.depth ||
|
|
230
|
+
comparePosition(left.startLine, left.startCharacter, right.startLine, right.startCharacter) ||
|
|
231
|
+
left.order - right.order
|
|
232
|
+
);
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
function containsRange(outer: InspectEnclosingSymbol, inner: InspectEnclosingSymbol): boolean {
|
|
236
|
+
return (
|
|
237
|
+
comparePosition(outer.startLine, outer.startCharacter, inner.startLine, inner.startCharacter) <=
|
|
238
|
+
0 &&
|
|
239
|
+
comparePosition(outer.endLine, outer.endCharacter, inner.endLine, inner.endCharacter) >= 0
|
|
240
|
+
);
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
function diagnosticOverlapsWindow(
|
|
244
|
+
range: { start: CodePosition; end: CodePosition },
|
|
245
|
+
input: Pick<InspectCollectionInput, "line" | "lineCount">,
|
|
246
|
+
): boolean {
|
|
247
|
+
const startLine = Math.max(1, input.line - 2) - 1;
|
|
248
|
+
const endExclusiveLine = Math.min(input.lineCount, input.line + 2);
|
|
249
|
+
const startsBeforeWindowEnd =
|
|
250
|
+
comparePosition(range.start.line, range.start.character, endExclusiveLine, 0) < 0;
|
|
251
|
+
const endsAfterWindowStart =
|
|
252
|
+
comparePosition(range.end.line, range.end.character, startLine, 0) > 0;
|
|
253
|
+
const emptyInsideWindow =
|
|
254
|
+
comparePosition(
|
|
255
|
+
range.start.line,
|
|
256
|
+
range.start.character,
|
|
257
|
+
range.end.line,
|
|
258
|
+
range.end.character,
|
|
259
|
+
) === 0 &&
|
|
260
|
+
range.start.line >= startLine &&
|
|
261
|
+
range.start.line < endExclusiveLine;
|
|
262
|
+
return startsBeforeWindowEnd && (endsAfterWindowStart || emptyInsideWindow);
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
function compareDiagnostics(
|
|
266
|
+
left: InspectDiagnostic,
|
|
267
|
+
right: InspectDiagnostic,
|
|
268
|
+
pointLine: number,
|
|
269
|
+
): number {
|
|
270
|
+
return (
|
|
271
|
+
Math.abs(left.line - pointLine) - Math.abs(right.line - pointLine) ||
|
|
272
|
+
left.line - right.line ||
|
|
273
|
+
left.character - right.character ||
|
|
274
|
+
left.severity - right.severity ||
|
|
275
|
+
left.message.localeCompare(right.message)
|
|
276
|
+
);
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
function comparePosition(
|
|
280
|
+
leftLine: number,
|
|
281
|
+
leftCharacter: number,
|
|
282
|
+
rightLine: number,
|
|
283
|
+
rightCharacter: number,
|
|
284
|
+
): number {
|
|
285
|
+
return leftLine - rightLine || leftCharacter - rightCharacter;
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
function lspUnavailableReason(state: Exclude<WorkspaceLspRuntimeState, { kind: "ready" }>): string {
|
|
289
|
+
switch (state.kind) {
|
|
290
|
+
case "unavailable":
|
|
291
|
+
return state.reason;
|
|
292
|
+
case "pending":
|
|
293
|
+
return "LSP diagnostics are still pending.";
|
|
294
|
+
case "inactive":
|
|
295
|
+
return "LSP diagnostics are inactive.";
|
|
296
|
+
case "disabled":
|
|
297
|
+
return "LSP diagnostics are disabled.";
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
function failureReason(operation: string, error: unknown): string {
|
|
302
|
+
const detail = error instanceof Error ? error.message : String(error);
|
|
303
|
+
return `${operation} failed: ${detail}`;
|
|
304
|
+
}
|