@mrclrchtr/supi-code-intelligence 11.4.0 → 13.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/CHANGELOG.md +39 -0
- package/README.md +17 -9
- package/node_modules/@mrclrchtr/supi-code-runtime/package.json +1 -1
- package/node_modules/@mrclrchtr/supi-code-runtime/src/api.ts +1 -0
- package/node_modules/@mrclrchtr/supi-code-runtime/src/types.ts +51 -23
- package/node_modules/@mrclrchtr/supi-core/package.json +3 -1
- package/node_modules/@mrclrchtr/supi-core/src/api.ts +4 -0
- package/node_modules/@mrclrchtr/supi-core/src/context/context-tag.ts +1 -1
- package/node_modules/@mrclrchtr/supi-core/src/debug-registry.ts +22 -3
- package/node_modules/@mrclrchtr/supi-core/src/retired-packages.ts +152 -0
- package/node_modules/@mrclrchtr/supi-core/src/session.ts +1 -0
- package/node_modules/@mrclrchtr/supi-core/src/shell-hints.ts +46 -0
- package/node_modules/@mrclrchtr/supi-core/src/spill.ts +93 -0
- package/node_modules/@mrclrchtr/supi-lsp/README.md +21 -16
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/package.json +1 -1
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/src/api.ts +1 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/src/types.ts +51 -23
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/package.json +3 -1
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/api.ts +4 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/context/context-tag.ts +1 -1
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/debug-registry.ts +22 -3
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/retired-packages.ts +152 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/session.ts +1 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/shell-hints.ts +46 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/spill.ts +93 -0
- package/node_modules/@mrclrchtr/supi-lsp/package.json +8 -8
- package/node_modules/@mrclrchtr/supi-lsp/src/api.ts +3 -2
- package/node_modules/@mrclrchtr/supi-lsp/src/client/client-diagnostic-cache.ts +102 -47
- package/node_modules/@mrclrchtr/supi-lsp/src/client/client-diagnostic-capabilities.ts +13 -3
- package/node_modules/@mrclrchtr/supi-lsp/src/client/client-diagnostic-host.ts +8 -0
- package/node_modules/@mrclrchtr/supi-lsp/src/client/client-diagnostic-refresh.ts +15 -1
- package/node_modules/@mrclrchtr/supi-lsp/src/client/client-diagnostic-request.ts +1 -1
- package/node_modules/@mrclrchtr/supi-lsp/src/client/client-diagnostics.ts +71 -13
- package/node_modules/@mrclrchtr/supi-lsp/src/client/client-disk-stamp.ts +60 -0
- package/node_modules/@mrclrchtr/supi-lsp/src/client/client-document-state.ts +3 -0
- package/node_modules/@mrclrchtr/supi-lsp/src/client/client-document-sync.ts +28 -6
- package/node_modules/@mrclrchtr/supi-lsp/src/client/client-edit-capture.ts +258 -0
- package/node_modules/@mrclrchtr/supi-lsp/src/client/client-file-state.ts +17 -3
- package/node_modules/@mrclrchtr/supi-lsp/src/client/client-semantic-input-barrier.ts +53 -4
- package/node_modules/@mrclrchtr/supi-lsp/src/client/client.ts +75 -14
- package/node_modules/@mrclrchtr/supi-lsp/src/config/capabilities.ts +8 -0
- package/node_modules/@mrclrchtr/supi-lsp/src/config/operation-support.ts +48 -79
- package/node_modules/@mrclrchtr/supi-lsp/src/config/tsconfig-extends.ts +2 -1
- package/node_modules/@mrclrchtr/supi-lsp/src/config/tsconfig-path.ts +2 -2
- package/node_modules/@mrclrchtr/supi-lsp/src/config/tsconfig-scope.ts +14 -5
- package/node_modules/@mrclrchtr/supi-lsp/src/config/typescript-module.ts +17 -0
- package/node_modules/@mrclrchtr/supi-lsp/src/diagnostics/evidence.ts +42 -0
- package/node_modules/@mrclrchtr/supi-lsp/src/manager/manager-client-state.ts +2 -17
- package/node_modules/@mrclrchtr/supi-lsp/src/manager/manager-removal-ledger.ts +52 -0
- package/node_modules/@mrclrchtr/supi-lsp/src/manager/manager.ts +43 -21
- package/node_modules/@mrclrchtr/supi-lsp/src/manager/typescript-file-local.ts +6 -1
- package/node_modules/@mrclrchtr/supi-lsp/src/provider/lsp-refactor-provider.ts +21 -35
- package/node_modules/@mrclrchtr/supi-lsp/src/provider/lsp-semantic-provider.ts +6 -1
- package/node_modules/@mrclrchtr/supi-lsp/src/provider/refactor-command-capture.ts +139 -0
- package/node_modules/@mrclrchtr/supi-lsp/src/provider/refactor-planning.ts +202 -47
- package/node_modules/@mrclrchtr/supi-lsp/src/provider/semantic-symbol-mapper.ts +13 -3
- package/node_modules/@mrclrchtr/supi-lsp/src/session/route-boundary.ts +26 -0
- package/node_modules/@mrclrchtr/supi-lsp/src/session/runtime-diagnostic-surface.ts +11 -0
- package/node_modules/@mrclrchtr/supi-lsp/src/session/runtime-diagnostics.ts +1 -0
- package/node_modules/@mrclrchtr/supi-lsp/src/session/runtime-registry.ts +74 -14
- package/node_modules/@mrclrchtr/supi-lsp/src/session/runtime-rename.ts +3 -0
- package/node_modules/@mrclrchtr/supi-lsp/src/session/runtime-transition-debug.ts +11 -1
- package/node_modules/@mrclrchtr/supi-lsp/src/session/workspace-lsp-runtime.ts +24 -1
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/package.json +1 -1
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/src/api.ts +1 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/src/types.ts +51 -23
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/package.json +3 -1
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/api.ts +4 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/context/context-tag.ts +1 -1
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/debug-registry.ts +22 -3
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/retired-packages.ts +152 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/session.ts +1 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/shell-hints.ts +46 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/spill.ts +93 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/debug/web-tree-sitter.cjs +50 -75
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/debug/web-tree-sitter.cjs.map +2 -2
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/debug/web-tree-sitter.js +50 -75
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/debug/web-tree-sitter.js.map +2 -2
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/debug/web-tree-sitter.wasm +0 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/debug/web-tree-sitter.wasm.map +6 -6
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/package.json +1 -1
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/web-tree-sitter.cjs +50 -75
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/web-tree-sitter.cjs.map +2 -2
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/web-tree-sitter.d.cts +7 -7
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/web-tree-sitter.d.cts.map +1 -1
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/web-tree-sitter.d.ts +7 -7
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/web-tree-sitter.d.ts.map +1 -1
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/web-tree-sitter.js +50 -75
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/web-tree-sitter.js.map +2 -2
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/web-tree-sitter.wasm +0 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/web-tree-sitter.wasm.map +5 -5
- package/node_modules/@mrclrchtr/supi-tree-sitter/package.json +5 -5
- package/node_modules/@mrclrchtr/supi-tree-sitter/resources/grammars/kotlin/tree-sitter-kotlin.wasm.json +1 -1
- package/node_modules/@mrclrchtr/supi-tree-sitter/resources/grammars/latex/tree-sitter-latex.wasm.json +1 -1
- package/node_modules/@mrclrchtr/supi-tree-sitter/resources/grammars/sql/tree-sitter-sql.wasm.json +1 -1
- package/node_modules/@mrclrchtr/supi-tree-sitter/resources/grammars/tsx/tree-sitter-tsx.wasm.json +1 -1
- package/node_modules/@mrclrchtr/supi-tree-sitter/resources/grammars/typescript/tree-sitter-typescript.wasm.json +1 -1
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/coordinates.ts +16 -2
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/session/structural-worker-client.ts +4 -3
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/syntax-errors.ts +2 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/tool/call-range.ts +94 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/tool/call-sites.ts +26 -6
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/tool/callees.ts +6 -3
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/tool/exports.ts +13 -4
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/worker/runtime.ts +1 -9
- package/node_modules/fast-xml-parser/CHANGELOG.md +886 -0
- package/node_modules/fast-xml-parser/LICENSE +21 -0
- package/node_modules/fast-xml-parser/README.md +204 -0
- package/node_modules/fast-xml-parser/lib/fxbuilder.min.js +2 -0
- package/node_modules/fast-xml-parser/lib/fxbuilder.min.js.map +1 -0
- package/node_modules/fast-xml-parser/lib/fxp.cjs +1 -0
- package/node_modules/fast-xml-parser/lib/fxp.d.cts +774 -0
- package/node_modules/fast-xml-parser/lib/fxp.min.js +2 -0
- package/node_modules/fast-xml-parser/lib/fxp.min.js.map +1 -0
- package/node_modules/fast-xml-parser/lib/fxparser.min.js +2 -0
- package/node_modules/fast-xml-parser/lib/fxparser.min.js.map +1 -0
- package/node_modules/fast-xml-parser/lib/fxvalidator.min.js +2 -0
- package/node_modules/fast-xml-parser/lib/fxvalidator.min.js.map +1 -0
- package/node_modules/fast-xml-parser/node_modules/@nodable/entities/README.md +92 -0
- package/node_modules/fast-xml-parser/node_modules/@nodable/entities/package.json +57 -0
- package/node_modules/fast-xml-parser/node_modules/@nodable/entities/src/EntityDecoder.js +644 -0
- package/node_modules/fast-xml-parser/node_modules/@nodable/entities/src/EntityEncoder.js +239 -0
- package/node_modules/fast-xml-parser/node_modules/@nodable/entities/src/all-entities.js +53 -0
- package/node_modules/fast-xml-parser/node_modules/@nodable/entities/src/entities.js +1139 -0
- package/node_modules/fast-xml-parser/node_modules/@nodable/entities/src/entityTries.js +60 -0
- package/node_modules/fast-xml-parser/node_modules/@nodable/entities/src/index.d.ts +358 -0
- package/node_modules/fast-xml-parser/node_modules/@nodable/entities/src/index.js +29 -0
- package/node_modules/fast-xml-parser/node_modules/fast-xml-builder/CHANGELOG.md +52 -0
- package/node_modules/fast-xml-parser/node_modules/fast-xml-builder/LICENSE +21 -0
- package/node_modules/fast-xml-parser/node_modules/fast-xml-builder/README.md +77 -0
- package/node_modules/fast-xml-parser/node_modules/fast-xml-builder/lib/fxb.cjs +1 -0
- package/node_modules/fast-xml-parser/node_modules/fast-xml-builder/lib/fxb.d.cts +270 -0
- package/node_modules/fast-xml-parser/node_modules/fast-xml-builder/lib/fxb.min.js +2 -0
- package/node_modules/fast-xml-parser/node_modules/fast-xml-builder/lib/fxb.min.js.map +1 -0
- package/node_modules/fast-xml-parser/node_modules/fast-xml-builder/package.json +77 -0
- package/node_modules/fast-xml-parser/node_modules/fast-xml-builder/src/fxb.d.ts +270 -0
- package/node_modules/fast-xml-parser/node_modules/fast-xml-builder/src/fxb.js +609 -0
- package/node_modules/fast-xml-parser/node_modules/fast-xml-builder/src/ignoreAttributes.js +18 -0
- package/node_modules/fast-xml-parser/node_modules/fast-xml-builder/src/orderedJs2Xml.js +360 -0
- package/node_modules/fast-xml-parser/node_modules/fast-xml-builder/src/prettifyJs2Xml.js +0 -0
- package/node_modules/fast-xml-parser/node_modules/fast-xml-builder/src/util.js +23 -0
- package/node_modules/fast-xml-parser/node_modules/is-unsafe/LICENSE +21 -0
- package/node_modules/fast-xml-parser/node_modules/is-unsafe/README.md +632 -0
- package/node_modules/fast-xml-parser/node_modules/is-unsafe/package.json +56 -0
- package/node_modules/fast-xml-parser/node_modules/is-unsafe/src/contexts/html.js +102 -0
- package/node_modules/fast-xml-parser/node_modules/is-unsafe/src/contexts/log.js +98 -0
- package/node_modules/fast-xml-parser/node_modules/is-unsafe/src/contexts/nosql.js +114 -0
- package/node_modules/fast-xml-parser/node_modules/is-unsafe/src/contexts/redos.js +60 -0
- package/node_modules/fast-xml-parser/node_modules/is-unsafe/src/contexts/shell.js +105 -0
- package/node_modules/fast-xml-parser/node_modules/is-unsafe/src/contexts/sql-strict.js +47 -0
- package/node_modules/fast-xml-parser/node_modules/is-unsafe/src/contexts/sql.js +95 -0
- package/node_modules/fast-xml-parser/node_modules/is-unsafe/src/contexts/svg.js +81 -0
- package/node_modules/fast-xml-parser/node_modules/is-unsafe/src/contexts/xml.js +79 -0
- package/node_modules/fast-xml-parser/node_modules/is-unsafe/src/index.cjs +27 -0
- package/node_modules/fast-xml-parser/node_modules/is-unsafe/src/index.d.ts +103 -0
- package/node_modules/fast-xml-parser/node_modules/is-unsafe/src/index.js +292 -0
- package/node_modules/fast-xml-parser/node_modules/is-unsafe/src/util/decode-entities.js +48 -0
- package/node_modules/fast-xml-parser/node_modules/path-expression-matcher/LICENSE +21 -0
- package/node_modules/fast-xml-parser/node_modules/path-expression-matcher/README.md +947 -0
- package/node_modules/fast-xml-parser/node_modules/path-expression-matcher/lib/pem.cjs +1 -0
- package/node_modules/fast-xml-parser/node_modules/path-expression-matcher/lib/pem.d.cts +725 -0
- package/node_modules/fast-xml-parser/node_modules/path-expression-matcher/lib/pem.min.js +2 -0
- package/node_modules/fast-xml-parser/node_modules/path-expression-matcher/lib/pem.min.js.map +1 -0
- package/node_modules/fast-xml-parser/node_modules/path-expression-matcher/package.json +79 -0
- package/node_modules/fast-xml-parser/node_modules/path-expression-matcher/src/Expression.js +232 -0
- package/node_modules/fast-xml-parser/node_modules/path-expression-matcher/src/ExpressionSet.js +225 -0
- package/node_modules/fast-xml-parser/node_modules/path-expression-matcher/src/Matcher.js +663 -0
- package/node_modules/fast-xml-parser/node_modules/path-expression-matcher/src/index.d.ts +589 -0
- package/node_modules/fast-xml-parser/node_modules/path-expression-matcher/src/index.js +30 -0
- package/node_modules/fast-xml-parser/node_modules/strnum/CHANGELOG.md +63 -0
- package/node_modules/fast-xml-parser/node_modules/strnum/LICENSE +21 -0
- package/node_modules/fast-xml-parser/node_modules/strnum/README.md +113 -0
- package/node_modules/fast-xml-parser/node_modules/strnum/node_modules/anynum/LICENSE +21 -0
- package/node_modules/fast-xml-parser/node_modules/strnum/node_modules/anynum/README.md +142 -0
- package/node_modules/fast-xml-parser/node_modules/strnum/node_modules/anynum/anynum.js +135 -0
- package/node_modules/fast-xml-parser/node_modules/strnum/node_modules/anynum/digitTable.js +116 -0
- package/node_modules/fast-xml-parser/node_modules/strnum/node_modules/anynum/package.json +42 -0
- package/node_modules/fast-xml-parser/node_modules/strnum/package.json +36 -0
- package/node_modules/fast-xml-parser/node_modules/strnum/strnum.js +176 -0
- package/node_modules/fast-xml-parser/node_modules/xml-naming/LICENSE +21 -0
- package/node_modules/fast-xml-parser/node_modules/xml-naming/README.md +287 -0
- package/node_modules/fast-xml-parser/node_modules/xml-naming/package.json +56 -0
- package/node_modules/fast-xml-parser/node_modules/xml-naming/src/index.d.ts +108 -0
- package/node_modules/fast-xml-parser/node_modules/xml-naming/src/index.js +382 -0
- package/node_modules/fast-xml-parser/package.json +93 -0
- package/node_modules/fast-xml-parser/src/cli/cli.js +97 -0
- package/node_modules/fast-xml-parser/src/cli/man.js +17 -0
- package/node_modules/fast-xml-parser/src/cli/read.js +43 -0
- package/node_modules/fast-xml-parser/src/fxp.d.ts +754 -0
- package/node_modules/fast-xml-parser/src/fxp.js +14 -0
- package/node_modules/fast-xml-parser/src/ignoreAttributes.js +18 -0
- package/node_modules/fast-xml-parser/src/util.js +61 -0
- package/node_modules/fast-xml-parser/src/v6/CharsSymbol.js +16 -0
- package/node_modules/fast-xml-parser/src/v6/EntitiesParser.js +106 -0
- package/node_modules/fast-xml-parser/src/v6/OptionsBuilder.js +61 -0
- package/node_modules/fast-xml-parser/src/v6/OutputBuilders/BaseOutputBuilder.js +69 -0
- package/node_modules/fast-xml-parser/src/v6/OutputBuilders/JsArrBuilder.js +103 -0
- package/node_modules/fast-xml-parser/src/v6/OutputBuilders/JsMinArrBuilder.js +100 -0
- package/node_modules/fast-xml-parser/src/v6/OutputBuilders/JsObjBuilder.js +154 -0
- package/node_modules/fast-xml-parser/src/v6/OutputBuilders/ParserOptionsBuilder.js +94 -0
- package/node_modules/fast-xml-parser/src/v6/Report.js +0 -0
- package/node_modules/fast-xml-parser/src/v6/TagPath.js +81 -0
- package/node_modules/fast-xml-parser/src/v6/TagPathMatcher.js +13 -0
- package/node_modules/fast-xml-parser/src/v6/XMLParser.js +83 -0
- package/node_modules/fast-xml-parser/src/v6/Xml2JsParser.js +235 -0
- package/node_modules/fast-xml-parser/src/v6/XmlPartReader.js +210 -0
- package/node_modules/fast-xml-parser/src/v6/XmlSpecialTagsReader.js +111 -0
- package/node_modules/fast-xml-parser/src/v6/inputSource/BufferSource.js +116 -0
- package/node_modules/fast-xml-parser/src/v6/inputSource/StringSource.js +121 -0
- package/node_modules/fast-xml-parser/src/v6/valueParsers/EntitiesParser.js +105 -0
- package/node_modules/fast-xml-parser/src/v6/valueParsers/booleanParser.js +22 -0
- package/node_modules/fast-xml-parser/src/v6/valueParsers/booleanParserExt.js +19 -0
- package/node_modules/fast-xml-parser/src/v6/valueParsers/currency.js +38 -0
- package/node_modules/fast-xml-parser/src/v6/valueParsers/join.js +13 -0
- package/node_modules/fast-xml-parser/src/v6/valueParsers/number.js +14 -0
- package/node_modules/fast-xml-parser/src/v6/valueParsers/trim.js +6 -0
- package/node_modules/fast-xml-parser/src/validator.js +518 -0
- package/node_modules/fast-xml-parser/src/xmlbuilder/json2xml.js +6 -0
- package/node_modules/fast-xml-parser/src/xmlparser/DocTypeReader.js +426 -0
- package/node_modules/fast-xml-parser/src/xmlparser/OptionsBuilder.js +164 -0
- package/node_modules/fast-xml-parser/src/xmlparser/OrderedObjParser.js +907 -0
- package/node_modules/fast-xml-parser/src/xmlparser/XMLParser.js +77 -0
- package/node_modules/fast-xml-parser/src/xmlparser/node2json.js +177 -0
- package/node_modules/fast-xml-parser/src/xmlparser/xmlNode.js +54 -0
- package/package.json +10 -8
- package/src/analysis/evidence.ts +331 -73
- package/src/analysis/health/diagnostics.ts +66 -18
- package/src/analysis/health/evidence-reason.ts +44 -0
- package/src/analysis/health/server-status.ts +41 -12
- package/src/analysis/search/pattern.ts +3 -3
- package/src/analysis/target/anchored-structural.ts +4 -1
- package/src/analysis/target/anchored.ts +3 -6
- package/src/analysis/target/symbol.ts +42 -48
- package/src/analysis/target/types.ts +4 -9
- package/src/analysis/workspace/cmake-parser.ts +207 -0
- package/src/analysis/workspace/cmake.ts +141 -0
- package/src/analysis/workspace/maven.ts +310 -0
- package/src/analysis/workspace/membership.ts +100 -26
- package/src/analysis/workspace/metadata.ts +6 -1
- package/src/analysis/workspace/observe.ts +6 -0
- package/src/analysis/workspace/types.ts +11 -3
- package/src/diagnostics/coverage.ts +49 -0
- package/src/diagnostics/evidence.ts +10 -2
- package/src/session/find-types.ts +8 -4
- package/src/session/find-workflow.ts +11 -16
- package/src/session/health-workflow.ts +6 -0
- package/src/session/input/common.ts +1 -1
- package/src/session/input/health-refactor.ts +48 -34
- package/src/session/input/workflows.ts +45 -46
- package/src/session/inspect/file-point.ts +2 -2
- package/src/session/inspect-types.ts +1 -1
- package/src/session/inspect-workflow.ts +3 -3
- package/src/session/orientation/collect.ts +42 -7
- package/src/session/orientation/context-facts.ts +3 -3
- package/src/session/orientation/context-sections.ts +13 -15
- package/src/session/orientation/facts.ts +5 -8
- package/src/session/orientation-workflow.ts +4 -19
- package/src/session/refactor-file-actions.ts +122 -0
- package/src/session/refactor-plan-pipeline.ts +152 -0
- package/src/session/refactor-plans.ts +18 -15
- package/src/session/refactor-types.ts +24 -12
- package/src/session/refactor-workflow.ts +68 -243
- package/src/session/target-workflow.ts +25 -18
- package/src/tool/code_find/execute.ts +6 -7
- package/src/tool/code_find/result.ts +5 -7
- package/src/tool/code_find/spec.ts +9 -16
- package/src/tool/code_find/tui.ts +12 -6
- package/src/tool/code_graph/display.ts +5 -6
- package/src/tool/code_graph/format.ts +8 -24
- package/src/tool/code_graph/result.ts +16 -75
- package/src/tool/code_graph/section.ts +21 -33
- package/src/tool/code_graph/spec.ts +6 -0
- package/src/tool/code_graph/tui.ts +10 -5
- package/src/tool/code_health/diagnostic-tui.ts +49 -0
- package/src/tool/code_health/guidance.ts +27 -0
- package/src/tool/code_health/markdown.ts +60 -8
- package/src/tool/code_health/result.ts +20 -9
- package/src/tool/code_health/spec.ts +6 -0
- package/src/tool/code_health/structured-schema.ts +18 -4
- package/src/tool/code_health/structured.ts +22 -18
- package/src/tool/code_health/tui.ts +33 -40
- package/src/tool/code_inspect/execute.ts +1 -1
- package/src/tool/code_inspect/markdown.ts +33 -6
- package/src/tool/code_inspect/result.ts +24 -19
- package/src/tool/code_inspect/spec.ts +14 -6
- package/src/tool/code_inspect/structured.ts +4 -21
- package/src/tool/code_inspect/tui.ts +2 -2
- package/src/tool/code_orientation/result.ts +53 -100
- package/src/tool/code_orientation/spec.ts +8 -0
- package/src/tool/code_orientation/structured-schema.ts +16 -12
- package/src/tool/code_orientation/structured-workspace.ts +13 -7
- package/src/tool/code_orientation/structured.ts +31 -39
- package/src/tool/code_orientation/workspace-format.ts +4 -10
- package/src/tool/code_orientation/workspace-instructions.ts +4 -5
- package/src/tool/code_orientation/workspace-observations.ts +2 -2
- package/src/tool/code_orientation/workspace-output.ts +16 -7
- package/src/tool/code_orientation/workspace-projects.ts +7 -10
- package/src/tool/code_orientation/workspace-sections.ts +13 -19
- package/src/tool/code_refactor_apply/result.ts +2 -1
- package/src/tool/code_refactor_apply/spec.ts +7 -0
- package/src/tool/code_refactor_plan/execute.ts +0 -2
- package/src/tool/code_refactor_plan/result.ts +23 -13
- package/src/tool/code_refactor_plan/spec.ts +8 -2
- package/src/tool/code_refactor_plan/structured.ts +59 -12
- package/src/tool/code_refactor_plan/tui.ts +14 -17
- package/src/tool/code_resolve/markdown.ts +5 -47
- package/src/tool/code_resolve/result.ts +43 -72
- package/src/tool/code_resolve/spec.ts +6 -0
- package/src/tool/infra/truncate.ts +2 -16
- package/src/tool/namespace.ts +14 -0
- package/src/tool/refactor-markdown.ts +55 -15
- package/src/tool/register.ts +3 -0
- package/src/tool/result/candidate-selection.ts +141 -0
- package/src/tool/result/display.ts +41 -45
- package/src/tool/result/errors.ts +1 -0
- package/src/tool/result/model-budget.ts +26 -1
- package/src/tool/result/refactor-preview.ts +118 -0
- package/src/tool/result/refactor-unavailable.ts +16 -0
- package/src/tool/result/refactor.ts +19 -10
- package/src/tool/result/structured.ts +2 -1
- package/src/tool/result/types.ts +9 -8
- package/src/tool/schemas.ts +76 -38
- package/src/tool/specs.ts +3 -0
- package/src/ui/footer.ts +2 -4
- package/src/ui/status-overlay.ts +1 -1
- package/src/ui/status-presentation.ts +4 -7
- package/src/ui/tui/candidate-selection.ts +40 -95
- package/src/ui/tui/common.ts +16 -70
- package/src/ui/tui/display.ts +6 -24
- package/src/tool/result/candidate-row.ts +0 -49
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
/** Shared bounded workspace observation used by overview and Orientation surfaces. */
|
|
2
2
|
|
|
3
3
|
import * as path from "node:path";
|
|
4
|
+
import { readCMakeDocument } from "./cmake.ts";
|
|
4
5
|
import { readGoDocument } from "./go.ts";
|
|
5
6
|
import { collectInventory, DEFAULT_MAX_INVENTORY_ENTRIES } from "./inventory.ts";
|
|
7
|
+
import { readMavenDocument } from "./maven.ts";
|
|
6
8
|
import { applyMemberships } from "./membership.ts";
|
|
7
9
|
import { readMetadataDocuments } from "./metadata.ts";
|
|
8
10
|
import type { DocumentContribution, ParsedDocument } from "./metadata-types.ts";
|
|
@@ -133,6 +135,10 @@ function readDocument(document: ParsedDocument): DocumentContribution {
|
|
|
133
135
|
case "go-mod":
|
|
134
136
|
case "go-work":
|
|
135
137
|
return readGoDocument(document);
|
|
138
|
+
case "maven-pom":
|
|
139
|
+
return readMavenDocument(document);
|
|
140
|
+
case "cmake-lists":
|
|
141
|
+
return readCMakeDocument(document);
|
|
136
142
|
}
|
|
137
143
|
}
|
|
138
144
|
|
|
@@ -76,7 +76,9 @@ export type MetadataDocumentKind =
|
|
|
76
76
|
| "pyproject"
|
|
77
77
|
| "cargo"
|
|
78
78
|
| "go-mod"
|
|
79
|
-
| "go-work"
|
|
79
|
+
| "go-work"
|
|
80
|
+
| "maven-pom"
|
|
81
|
+
| "cmake-lists";
|
|
80
82
|
|
|
81
83
|
/** Metadata read outcome retained for provenance. */
|
|
82
84
|
export interface MetadataDocument {
|
|
@@ -117,12 +119,18 @@ export interface WorkspaceMetadataObservation {
|
|
|
117
119
|
}
|
|
118
120
|
|
|
119
121
|
/** Native project declaration kinds supported by this collector. */
|
|
120
|
-
export type ProjectKind =
|
|
122
|
+
export type ProjectKind =
|
|
123
|
+
| "node-package"
|
|
124
|
+
| "python-project"
|
|
125
|
+
| "rust-package"
|
|
126
|
+
| "go-module"
|
|
127
|
+
| "maven-project"
|
|
128
|
+
| "cmake-project";
|
|
121
129
|
|
|
122
130
|
/** How one configuration explicitly established project membership. */
|
|
123
131
|
export interface ProjectMembership {
|
|
124
132
|
/** Native workspace declaration family. */
|
|
125
|
-
readonly kind: "node-workspace" | "cargo-workspace" | "go-work";
|
|
133
|
+
readonly kind: "node-workspace" | "cargo-workspace" | "go-work" | "maven-modules";
|
|
126
134
|
/** Root-relative configuration or manifest path that declared membership. */
|
|
127
135
|
readonly manifestPath: string;
|
|
128
136
|
/** Exact declaring field or directive. */
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import type { DiagnosticEvidenceSummary } from "@mrclrchtr/supi-lsp/api";
|
|
2
|
+
import type { HealthDiagnosticObservation } from "../session/health-types.ts";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* The single rule for complete diagnostic evidence: every requested file is confirmed. Unconfirmed,
|
|
6
|
+
* failed, and removed files all block completeness. A removed file blocks it because files that
|
|
7
|
+
* imported it may not have been re-checked yet (#371, #602).
|
|
8
|
+
*
|
|
9
|
+
* Collection uses it to choose a `completed` or `partial` observation, and
|
|
10
|
+
* {@link classifyDiagnosticCoverage} uses it for `confirmed`, so a `completed` observation is always
|
|
11
|
+
* `confirmed` or `none` coverage, never `incomplete`.
|
|
12
|
+
*/
|
|
13
|
+
export function allRequestedFilesConfirmed(
|
|
14
|
+
evidence: Omit<DiagnosticEvidenceSummary, "documents">,
|
|
15
|
+
): boolean {
|
|
16
|
+
return (
|
|
17
|
+
evidence.confirmed === evidence.requested &&
|
|
18
|
+
evidence.unconfirmed === 0 &&
|
|
19
|
+
evidence.failed === 0 &&
|
|
20
|
+
evidence.removed === 0
|
|
21
|
+
);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* What a requested diagnostic observation establishes, derived only from its kind and exact
|
|
26
|
+
* evidence counts. Shared by the model-facing `code_health` output and the status inspector.
|
|
27
|
+
*
|
|
28
|
+
* - `unavailable`: no diagnostic result could be collected.
|
|
29
|
+
* - `none`: zero files were requested and no diagnostics exist, so nothing was checked.
|
|
30
|
+
* - `incomplete`: some requested files are unconfirmed, failed, or removed, or collection was partial.
|
|
31
|
+
* - `confirmed`: every requested file was confirmed. This never establishes project-wide validity.
|
|
32
|
+
*/
|
|
33
|
+
export type DiagnosticCoverage = "unavailable" | "none" | "incomplete" | "confirmed";
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Classify a collected observation. `partial` is never `confirmed`. Zero requested files with no
|
|
37
|
+
* entries is `none`, even for a `partial` observation. Uses the same completeness rule as
|
|
38
|
+
* collection ({@link allRequestedFilesConfirmed}), so `completed` never classifies as `incomplete`.
|
|
39
|
+
*/
|
|
40
|
+
export function classifyDiagnosticCoverage(
|
|
41
|
+
observation: Exclude<HealthDiagnosticObservation, { kind: "not-requested" }>,
|
|
42
|
+
): DiagnosticCoverage {
|
|
43
|
+
if (observation.kind === "unavailable") return "unavailable";
|
|
44
|
+
const evidence = observation.evidence;
|
|
45
|
+
if (evidence.requested === 0 && observation.entries.length === 0) return "none";
|
|
46
|
+
return observation.kind === "completed" && allRequestedFilesConfirmed(evidence)
|
|
47
|
+
? "confirmed"
|
|
48
|
+
: "incomplete";
|
|
49
|
+
}
|
|
@@ -15,12 +15,20 @@ export function mergeDiagnosticEvidence(
|
|
|
15
15
|
const byFile = new Map<string, DiagnosticEvidenceDocument>();
|
|
16
16
|
for (const document of [...previous.documents, ...latest.documents]) {
|
|
17
17
|
const file = cwd ? path.relative(cwd, path.resolve(cwd, document.file)) : document.file;
|
|
18
|
-
const next = {
|
|
18
|
+
const next: DiagnosticEvidenceDocument = {
|
|
19
|
+
file,
|
|
20
|
+
status: document.status,
|
|
21
|
+
...(document.reason ? { reason: document.reason } : {}),
|
|
22
|
+
};
|
|
19
23
|
const previousDocument = byFile.get(file);
|
|
20
24
|
if (
|
|
21
25
|
!previousDocument ||
|
|
22
26
|
policy === "latest" ||
|
|
23
|
-
evidenceStatusRank(next.status) > evidenceStatusRank(previousDocument.status)
|
|
27
|
+
evidenceStatusRank(next.status) > evidenceStatusRank(previousDocument.status) ||
|
|
28
|
+
// Equal rank: keep a known cause instead of a reason-less duplicate.
|
|
29
|
+
(next.status === previousDocument.status &&
|
|
30
|
+
previousDocument.reason === undefined &&
|
|
31
|
+
next.reason !== undefined)
|
|
24
32
|
) {
|
|
25
33
|
byFile.set(file, next);
|
|
26
34
|
}
|
|
@@ -5,11 +5,15 @@ import type { CodeFindMode } from "../tool/code_find/modes.ts";
|
|
|
5
5
|
|
|
6
6
|
export type FindMode = CodeFindMode;
|
|
7
7
|
|
|
8
|
+
/** Exactly one search mode; each branch carries only the fields that mode honors. */
|
|
9
|
+
export type FindSearchInput =
|
|
10
|
+
| { readonly ast: { readonly kind: CodeFindAstKind; readonly query: string } }
|
|
11
|
+
| { readonly semantic: { readonly query: string } };
|
|
12
|
+
|
|
13
|
+
/** Canonical code_find workflow input. */
|
|
8
14
|
export interface FindWorkflowInput {
|
|
9
|
-
readonly
|
|
10
|
-
readonly
|
|
11
|
-
readonly mode: FindMode;
|
|
12
|
-
readonly kind?: CodeFindAstKind;
|
|
15
|
+
readonly search: FindSearchInput;
|
|
16
|
+
readonly scopes?: readonly string[];
|
|
13
17
|
readonly maxResults?: number;
|
|
14
18
|
}
|
|
15
19
|
|
|
@@ -6,7 +6,7 @@ import type { AutomaticLspPathPolicy } from "@mrclrchtr/supi-lsp/api";
|
|
|
6
6
|
import { SEMANTIC_READINESS_TIMEOUT_REASON } from "../analysis/readiness.ts";
|
|
7
7
|
import { resolveScopeSet } from "../analysis/search/paths.ts";
|
|
8
8
|
import { getStructuredPatternMatches } from "../analysis/search/pattern.ts";
|
|
9
|
-
import {
|
|
9
|
+
import type { CodeFindAstKind } from "../tool/code_find/ast-kinds.ts";
|
|
10
10
|
import type { CapabilityAdapter } from "./capability-adapter.ts";
|
|
11
11
|
import type { FindWorkflowInput, FindWorkflowOutcome } from "./find-types.ts";
|
|
12
12
|
import { parseFindWorkflowInput } from "./input/workflows.ts";
|
|
@@ -29,10 +29,9 @@ export async function runFindWorkflow(
|
|
|
29
29
|
const parsed = parseFindWorkflowInput(input);
|
|
30
30
|
if (parsed.kind === "invalid-input") return parsed;
|
|
31
31
|
const request = parsed.value;
|
|
32
|
-
const
|
|
33
|
-
const mode = request.mode;
|
|
32
|
+
const mode = "ast" in request.search ? "ast" : "semantic";
|
|
34
33
|
|
|
35
|
-
const scope = resolveScopeSet(request.
|
|
34
|
+
const scope = resolveScopeSet(request.scopes ? [...request.scopes] : undefined, deps.cwd);
|
|
36
35
|
if (scope.kind === "error") return { kind: "invalid-input", message: scope.reason };
|
|
37
36
|
|
|
38
37
|
if (mode === "ast") control?.signal?.throwIfAborted();
|
|
@@ -45,9 +44,9 @@ export async function runFindWorkflow(
|
|
|
45
44
|
|
|
46
45
|
const maxResults = request.maxResults ?? 8;
|
|
47
46
|
const scopeLabel = scope.display ?? ".";
|
|
48
|
-
if (
|
|
47
|
+
if ("semantic" in request.search) {
|
|
49
48
|
return runSemanticSearch({
|
|
50
|
-
query,
|
|
49
|
+
query: request.search.semantic.query,
|
|
51
50
|
scopePaths: scope.paths,
|
|
52
51
|
scopeLabel,
|
|
53
52
|
maxResults,
|
|
@@ -56,8 +55,7 @@ export async function runFindWorkflow(
|
|
|
56
55
|
});
|
|
57
56
|
}
|
|
58
57
|
return runAstSearch({
|
|
59
|
-
|
|
60
|
-
input: request,
|
|
58
|
+
search: request.search.ast,
|
|
61
59
|
scopePaths: scope.paths,
|
|
62
60
|
scopeLabel,
|
|
63
61
|
maxResults,
|
|
@@ -108,25 +106,22 @@ async function runSemanticSearch(options: {
|
|
|
108
106
|
}
|
|
109
107
|
|
|
110
108
|
async function runAstSearch(options: {
|
|
111
|
-
query: string;
|
|
112
|
-
input: FindWorkflowInput;
|
|
109
|
+
search: { readonly kind: CodeFindAstKind; readonly query: string };
|
|
113
110
|
scopePaths: readonly string[];
|
|
114
111
|
scopeLabel: string;
|
|
115
112
|
maxResults: number;
|
|
116
113
|
deps: FindWorkflowDeps;
|
|
117
114
|
control?: WorkflowControl;
|
|
118
115
|
}): Promise<FindWorkflowOutcome> {
|
|
119
|
-
const {
|
|
120
|
-
|
|
121
|
-
return { kind: "invalid-input", message: "Unsupported AST kind." };
|
|
122
|
-
}
|
|
116
|
+
const { search, scopePaths, scopeLabel, maxResults, deps, control } = options;
|
|
117
|
+
const { kind, query } = search;
|
|
123
118
|
const provider = deps.capability.getStructuralProvider(deps.cwd);
|
|
124
119
|
if (!provider) {
|
|
125
120
|
return { kind: "unavailable", reason: "No structural provider is active." };
|
|
126
121
|
}
|
|
127
122
|
control?.signal?.throwIfAborted();
|
|
128
123
|
const outcome = await getStructuredPatternMatches({
|
|
129
|
-
params: { pattern: query, kind
|
|
124
|
+
params: { pattern: query, kind },
|
|
130
125
|
roots: scopePaths,
|
|
131
126
|
cwd: deps.cwd,
|
|
132
127
|
structural: provider,
|
|
@@ -145,6 +140,6 @@ async function runAstSearch(options: {
|
|
|
145
140
|
mode: "ast",
|
|
146
141
|
scopeLabel,
|
|
147
142
|
maxResults,
|
|
148
|
-
data: { kind: "ast", astKind:
|
|
143
|
+
data: { kind: "ast", astKind: kind, result: outcome.result },
|
|
149
144
|
};
|
|
150
145
|
}
|
|
@@ -18,6 +18,7 @@ import {
|
|
|
18
18
|
collectDiagnostics,
|
|
19
19
|
diagnosticScope,
|
|
20
20
|
isScopedFile,
|
|
21
|
+
reportedRemovedFiles,
|
|
21
22
|
} from "../analysis/health/diagnostics.ts";
|
|
22
23
|
import { describeStructuralState } from "../analysis/health/recovery.ts";
|
|
23
24
|
import { deriveWorkspaceSemanticHealthState } from "../analysis/health/semantic-state.ts";
|
|
@@ -143,6 +144,11 @@ export async function runHealthWorkflow(
|
|
|
143
144
|
};
|
|
144
145
|
|
|
145
146
|
throwIfAborted(control);
|
|
147
|
+
// A refresh report delivers retained removals once; passive reads keep them
|
|
148
|
+
// so a later refresh still reports them.
|
|
149
|
+
if (request.refresh === true && runtime) {
|
|
150
|
+
runtime.acknowledgeRemovedTrackedFiles(reportedRemovedFiles(diagnostics, deps.cwd));
|
|
151
|
+
}
|
|
146
152
|
return { kind: "completed", data };
|
|
147
153
|
}
|
|
148
154
|
function healthNeedsSemantic(included: readonly HealthSection[]): boolean {
|
|
@@ -173,7 +173,7 @@ export function parseTargetInput(
|
|
|
173
173
|
"A target selector must contain exactly one of `handle`, `anchor`, `symbol`, or `file`.",
|
|
174
174
|
);
|
|
175
175
|
}
|
|
176
|
-
const branch = selected[0];
|
|
176
|
+
const branch: TargetBranch = selected[0];
|
|
177
177
|
if (!allowed.includes(branch)) return invalid(`This workflow does not support target.${branch}.`);
|
|
178
178
|
|
|
179
179
|
switch (branch) {
|
|
@@ -79,17 +79,11 @@ export function parseRefactorPlanWorkflowInput(
|
|
|
79
79
|
): InputValidation<RefactorPlanWorkflowInput> {
|
|
80
80
|
const record = requireRecord(value, "code_refactor_plan input");
|
|
81
81
|
if (record.kind === "invalid-input") return record;
|
|
82
|
-
const keysError = requireOnlyKeys(
|
|
83
|
-
record.value,
|
|
84
|
-
["target", "operation"],
|
|
85
|
-
"code_refactor_plan input",
|
|
86
|
-
);
|
|
82
|
+
const keysError = requireOnlyKeys(record.value, ["operation"], "code_refactor_plan input");
|
|
87
83
|
if (keysError) return invalid(keysError);
|
|
88
|
-
const target = parseTargetInput(record.value.target, ["handle", "anchor"]);
|
|
89
|
-
if (target.kind === "invalid-input") return target;
|
|
90
84
|
const operation = parseRefactorOperation(record.value.operation);
|
|
91
85
|
if (operation.kind === "invalid-input") return operation;
|
|
92
|
-
return valid({
|
|
86
|
+
return valid({ operation: operation.value });
|
|
93
87
|
}
|
|
94
88
|
|
|
95
89
|
function parseRefactorOperation(value: unknown): InputValidation<RefactorOperationInput> {
|
|
@@ -104,56 +98,76 @@ function parseRefactorOperation(value: unknown): InputValidation<RefactorOperati
|
|
|
104
98
|
const payload = requireRecord(record.value[name], `operation.${name}`);
|
|
105
99
|
if (payload.kind === "invalid-input") return payload;
|
|
106
100
|
if (name === "rename_symbol") return parseRenameOperation(payload.value);
|
|
107
|
-
|
|
108
|
-
return parseExtractOperation(name, payload.value);
|
|
109
|
-
}
|
|
110
|
-
const payloadError = requireOnlyKeys(payload.value, [], `operation.${name}`);
|
|
111
|
-
if (payloadError) return invalid(payloadError);
|
|
112
|
-
return name === "update_imports"
|
|
113
|
-
? valid({ update_imports: {} })
|
|
114
|
-
: valid({ delete_dead_code: {} });
|
|
101
|
+
return parseActionOperation(name, payload.value);
|
|
115
102
|
}
|
|
116
103
|
|
|
117
104
|
function parseRenameOperation(
|
|
118
105
|
payload: Record<string, unknown>,
|
|
119
106
|
): InputValidation<RefactorOperationInput> {
|
|
120
|
-
const payloadError = requireOnlyKeys(payload, ["newName"], "operation.rename_symbol");
|
|
107
|
+
const payloadError = requireOnlyKeys(payload, ["target", "newName"], "operation.rename_symbol");
|
|
121
108
|
if (payloadError) return invalid(payloadError);
|
|
109
|
+
const target = parseTargetInput(payload.target, ["handle", "anchor"]);
|
|
110
|
+
if (target.kind === "invalid-input") return target;
|
|
122
111
|
const newName = requireString(payload.newName, "operation.rename_symbol.newName", {
|
|
123
112
|
nonEmpty: true,
|
|
124
113
|
});
|
|
125
|
-
|
|
114
|
+
if (newName.kind === "invalid-input") return newName;
|
|
115
|
+
return valid({
|
|
116
|
+
rename_symbol: { target: target.value as RefactorTargetInput, newName: newName.value },
|
|
117
|
+
});
|
|
126
118
|
}
|
|
127
119
|
|
|
128
|
-
|
|
129
|
-
|
|
120
|
+
/** Kind family each action operation accepts; `quickfix` and `notebook` kinds are never valid. */
|
|
121
|
+
const ACTION_KIND_FAMILY = { code_action: "refactor", source_action: "source" } as const;
|
|
122
|
+
|
|
123
|
+
function parseActionOperation(
|
|
124
|
+
name: "code_action" | "source_action",
|
|
130
125
|
payload: Record<string, unknown>,
|
|
131
126
|
): InputValidation<RefactorOperationInput> {
|
|
132
|
-
const
|
|
127
|
+
const label = `operation.${name}`;
|
|
128
|
+
const allowed =
|
|
129
|
+
name === "code_action" ? ["file", "range", "kind", "title"] : ["file", "kind", "title"];
|
|
130
|
+
const payloadError = requireOnlyKeys(payload, allowed, label);
|
|
133
131
|
if (payloadError) return invalid(payloadError);
|
|
134
|
-
const
|
|
135
|
-
if (
|
|
136
|
-
const
|
|
132
|
+
const file = requireString(payload.file, `${label}.file`, { nonEmpty: true });
|
|
133
|
+
if (file.kind === "invalid-input") return file;
|
|
134
|
+
const kind = requireString(payload.kind, `${label}.kind`, { nonEmpty: true });
|
|
135
|
+
if (kind.kind === "invalid-input") return kind;
|
|
136
|
+
const family = ACTION_KIND_FAMILY[name];
|
|
137
|
+
if (kind.value !== family && !kind.value.startsWith(`${family}.`)) {
|
|
138
|
+
return invalid(`${label}.kind must be "${family}" or start with "${family}.".`);
|
|
139
|
+
}
|
|
140
|
+
const title =
|
|
141
|
+
payload.title === undefined
|
|
142
|
+
? valid(undefined)
|
|
143
|
+
: requireString(payload.title, `${label}.title`, { nonEmpty: true });
|
|
144
|
+
if (title.kind === "invalid-input") return title;
|
|
145
|
+
const selection = {
|
|
146
|
+
file: file.value,
|
|
147
|
+
kind: kind.value,
|
|
148
|
+
...(title.value === undefined ? {} : { title: title.value }),
|
|
149
|
+
};
|
|
150
|
+
if (name === "source_action") return valid({ source_action: selection });
|
|
151
|
+
const range = parsePublicRange(payload.range, `${label}.range`);
|
|
137
152
|
if (range.kind === "invalid-input") return range;
|
|
138
|
-
return
|
|
139
|
-
? valid({ extract_function: { newName: newName.value, range: range.value } })
|
|
140
|
-
: valid({ extract_variable: { newName: newName.value, range: range.value } });
|
|
153
|
+
return valid({ code_action: { ...selection, range: range.value } });
|
|
141
154
|
}
|
|
142
155
|
|
|
143
|
-
|
|
144
|
-
|
|
156
|
+
/** Parse a one-based range; an empty range (`start` equal to `end`) marks a cursor position. */
|
|
157
|
+
function parsePublicRange(value: unknown, label: string): InputValidation<PublicSourceRange> {
|
|
158
|
+
const record = requireRecord(value, label);
|
|
145
159
|
if (record.kind === "invalid-input") return record;
|
|
146
|
-
const keysError = requireOnlyKeys(record.value, ["start", "end"],
|
|
160
|
+
const keysError = requireOnlyKeys(record.value, ["start", "end"], label);
|
|
147
161
|
if (keysError) return invalid(keysError);
|
|
148
|
-
const start = parsePosition(record.value.start,
|
|
162
|
+
const start = parsePosition(record.value.start, `${label}.start`);
|
|
149
163
|
if (start.kind === "invalid-input") return start;
|
|
150
|
-
const end = parsePosition(record.value.end,
|
|
164
|
+
const end = parsePosition(record.value.end, `${label}.end`);
|
|
151
165
|
if (end.kind === "invalid-input") return end;
|
|
152
166
|
if (
|
|
153
167
|
end.value.line < start.value.line ||
|
|
154
|
-
(end.value.line === start.value.line && end.value.character
|
|
168
|
+
(end.value.line === start.value.line && end.value.character < start.value.character)
|
|
155
169
|
) {
|
|
156
|
-
return invalid(
|
|
170
|
+
return invalid(`${label}.end must not be before ${label}.start.`);
|
|
157
171
|
}
|
|
158
172
|
return valid({ start: start.value, end: end.value });
|
|
159
173
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/** Runtime parsers for inspection, Orientation, graph, and find workflows. */
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import { isCodeFindAstKind } from "../../tool/code_find/ast-kinds.ts";
|
|
4
4
|
import { CODE_FIND_MODES } from "../../tool/code_find/modes.ts";
|
|
5
|
-
import type { FindMode, FindWorkflowInput } from "../find-types.ts";
|
|
5
|
+
import type { FindMode, FindSearchInput, FindWorkflowInput } from "../find-types.ts";
|
|
6
6
|
import type { GraphWorkflowInput, RequestedGraphRelation } from "../graph-types.ts";
|
|
7
7
|
import type { InspectWorkflowInput } from "../inspect-types.ts";
|
|
8
8
|
import type { OrientationFocusInput, OrientationWorkflowInput } from "../orientation-types.ts";
|
|
@@ -19,7 +19,6 @@ import {
|
|
|
19
19
|
valid,
|
|
20
20
|
} from "./common.ts";
|
|
21
21
|
|
|
22
|
-
const FIND_MODES = new Set<FindMode>(CODE_FIND_MODES);
|
|
23
22
|
const GRAPH_RELATIONS = new Set<RequestedGraphRelation>([
|
|
24
23
|
"all",
|
|
25
24
|
"references",
|
|
@@ -30,14 +29,14 @@ const GRAPH_RELATIONS = new Set<RequestedGraphRelation>([
|
|
|
30
29
|
export function parseInspectWorkflowInput(value: unknown): InputValidation<InspectWorkflowInput> {
|
|
31
30
|
const record = requireRecord(value, "code_inspect input");
|
|
32
31
|
if (record.kind === "invalid-input") return record;
|
|
33
|
-
const keysError = requireOnlyKeys(record.value, ["
|
|
32
|
+
const keysError = requireOnlyKeys(record.value, ["anchor", "maxResults"], "code_inspect input");
|
|
34
33
|
if (keysError) return invalid(keysError);
|
|
35
|
-
const
|
|
36
|
-
if (
|
|
34
|
+
const anchor = parseSourcePoint(record.value.anchor, "anchor");
|
|
35
|
+
if (anchor.kind === "invalid-input") return anchor;
|
|
37
36
|
const maxResults = optionalPositiveInteger(record.value.maxResults, "maxResults");
|
|
38
37
|
if (maxResults.kind === "invalid-input") return maxResults;
|
|
39
38
|
return valid({
|
|
40
|
-
|
|
39
|
+
anchor: anchor.value,
|
|
41
40
|
...(maxResults.value === undefined ? {} : { maxResults: maxResults.value }),
|
|
42
41
|
});
|
|
43
42
|
}
|
|
@@ -149,63 +148,63 @@ export function parseFindWorkflowInput(value: unknown): InputValidation<FindWork
|
|
|
149
148
|
if (record.kind === "invalid-input") return record;
|
|
150
149
|
const keysError = requireOnlyKeys(
|
|
151
150
|
record.value,
|
|
152
|
-
["
|
|
151
|
+
["search", "scopes", "maxResults"],
|
|
153
152
|
"code_find input",
|
|
154
153
|
);
|
|
155
154
|
if (keysError) return invalid(keysError);
|
|
156
|
-
const
|
|
157
|
-
if (
|
|
158
|
-
const
|
|
159
|
-
if (
|
|
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);
|
|
155
|
+
const search = parseFindSearch(record.value.search);
|
|
156
|
+
if (search.kind === "invalid-input") return search;
|
|
157
|
+
const scopes = parseFindScopes(record.value.scopes);
|
|
158
|
+
if (scopes.kind === "invalid-input") return scopes;
|
|
166
159
|
const maxResults = optionalPositiveInteger(record.value.maxResults, "maxResults");
|
|
167
160
|
if (maxResults.kind === "invalid-input") return maxResults;
|
|
168
161
|
return valid({
|
|
169
|
-
|
|
170
|
-
...(
|
|
171
|
-
mode: mode.value,
|
|
172
|
-
...(patternKind.value === undefined ? {} : { kind: patternKind.value }),
|
|
162
|
+
search: search.value,
|
|
163
|
+
...(scopes.value === undefined ? {} : { scopes: scopes.value }),
|
|
173
164
|
...(maxResults.value === undefined ? {} : { maxResults: maxResults.value }),
|
|
174
165
|
});
|
|
175
166
|
}
|
|
176
167
|
|
|
177
|
-
function
|
|
168
|
+
function parseFindSearch(value: unknown): InputValidation<FindSearchInput> {
|
|
169
|
+
const record = requireRecord(value, "search");
|
|
170
|
+
if (record.kind === "invalid-input") return record;
|
|
171
|
+
const keysError = requireOnlyKeys(record.value, CODE_FIND_MODES, "search");
|
|
172
|
+
if (keysError) return invalid(keysError);
|
|
173
|
+
const selected = CODE_FIND_MODES.filter((mode) => record.value[mode] !== undefined);
|
|
174
|
+
if (selected.length !== 1) {
|
|
175
|
+
return invalid("search must contain exactly one of `ast` or `semantic`.");
|
|
176
|
+
}
|
|
177
|
+
const mode = selected[0] as FindMode;
|
|
178
|
+
const label = `search.${mode}`;
|
|
179
|
+
const branch = requireRecord(record.value[mode], label);
|
|
180
|
+
if (branch.kind === "invalid-input") return branch;
|
|
181
|
+
const branchKeysError = requireOnlyKeys(
|
|
182
|
+
branch.value,
|
|
183
|
+
mode === "ast" ? ["kind", "query"] : ["query"],
|
|
184
|
+
label,
|
|
185
|
+
);
|
|
186
|
+
if (branchKeysError) return invalid(branchKeysError);
|
|
187
|
+
const query = requireString(branch.value.query, `${label}.query`, { nonEmpty: true });
|
|
188
|
+
if (query.kind === "invalid-input") return query;
|
|
189
|
+
if (mode === "semantic") return valid({ semantic: { query: query.value } });
|
|
190
|
+
return isCodeFindAstKind(branch.value.kind)
|
|
191
|
+
? valid({ ast: { kind: branch.value.kind, query: query.value } })
|
|
192
|
+
: invalid(
|
|
193
|
+
branch.value.kind === undefined ? "search.ast.kind is required." : "Unsupported AST kind.",
|
|
194
|
+
);
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
function parseFindScopes(value: unknown): InputValidation<readonly string[] | undefined> {
|
|
178
198
|
if (value === undefined) return valid(undefined);
|
|
179
199
|
if (
|
|
180
200
|
!Array.isArray(value) ||
|
|
181
201
|
value.length === 0 ||
|
|
182
202
|
!value.every((item) => typeof item === "string")
|
|
183
203
|
) {
|
|
184
|
-
return invalid("
|
|
204
|
+
return invalid("scopes must be a non-empty array of workspace-relative paths.");
|
|
185
205
|
}
|
|
186
206
|
if (value.some((item) => item.trim().length === 0)) {
|
|
187
|
-
return invalid("
|
|
207
|
+
return invalid("scopes must not contain empty paths.");
|
|
188
208
|
}
|
|
189
209
|
return valid(value);
|
|
190
210
|
}
|
|
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
|
-
}
|
|
@@ -42,7 +42,7 @@ export function validateInspectPoint(
|
|
|
42
42
|
if (point.line > lines.length) {
|
|
43
43
|
return {
|
|
44
44
|
kind: "invalid-input",
|
|
45
|
-
message: `
|
|
45
|
+
message: `Anchor line ${point.line} is beyond the end of \`${point.file}\` (${lines.length} lines).`,
|
|
46
46
|
};
|
|
47
47
|
}
|
|
48
48
|
|
|
@@ -51,7 +51,7 @@ export function validateInspectPoint(
|
|
|
51
51
|
if (point.character > maximumCharacter) {
|
|
52
52
|
return {
|
|
53
53
|
kind: "invalid-input",
|
|
54
|
-
message: `
|
|
54
|
+
message: `Anchor character ${point.character} is beyond line ${point.line} of \`${point.file}\` (maximum ${maximumCharacter}, 1-based UTF-16).`,
|
|
55
55
|
};
|
|
56
56
|
}
|
|
57
57
|
|
|
@@ -7,7 +7,7 @@ import type { SourcePointInput } from "./target-input.ts";
|
|
|
7
7
|
|
|
8
8
|
/** Canonical code_inspect workflow input. */
|
|
9
9
|
export interface InspectWorkflowInput {
|
|
10
|
-
readonly
|
|
10
|
+
readonly anchor: SourcePointInput;
|
|
11
11
|
readonly maxResults?: number;
|
|
12
12
|
}
|
|
13
13
|
|
|
@@ -30,7 +30,7 @@ export async function runInspectWorkflow(
|
|
|
30
30
|
const parsed = parseInspectWorkflowInput(input);
|
|
31
31
|
if (parsed.kind === "invalid-input") return parsed;
|
|
32
32
|
const request = parsed.value;
|
|
33
|
-
const point = validateInspectPoint(request.
|
|
33
|
+
const point = validateInspectPoint(request.anchor, deps.cwd);
|
|
34
34
|
if (point.kind === "invalid-input") return point;
|
|
35
35
|
throwIfAborted(control);
|
|
36
36
|
|
|
@@ -63,7 +63,7 @@ export async function runInspectWorkflow(
|
|
|
63
63
|
structural: deps.capability.getStructuralProvider(deps.cwd),
|
|
64
64
|
semantic,
|
|
65
65
|
semanticUnavailableReason: semantic
|
|
66
|
-
? "Semantic
|
|
66
|
+
? "Semantic anchor query unavailable."
|
|
67
67
|
: semanticReadinessReason(readiness),
|
|
68
68
|
lspState,
|
|
69
69
|
});
|
|
@@ -72,7 +72,7 @@ export async function runInspectWorkflow(
|
|
|
72
72
|
if (everySectionUnavailable(sections)) {
|
|
73
73
|
return {
|
|
74
74
|
kind: "unavailable",
|
|
75
|
-
reason: "No semantic, structural, or diagnostic provider could inspect this
|
|
75
|
+
reason: "No semantic, structural, or diagnostic provider could inspect this anchor.",
|
|
76
76
|
};
|
|
77
77
|
}
|
|
78
78
|
|