@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,57 +1,38 @@
|
|
|
1
1
|
/** Session-owned refactor planning and apply workflows. */
|
|
2
2
|
|
|
3
|
-
import type {
|
|
4
|
-
RefactorOperation,
|
|
5
|
-
RefactorResult,
|
|
6
|
-
SemanticProvider,
|
|
7
|
-
SourceRange,
|
|
8
|
-
} from "@mrclrchtr/supi-code-runtime/api";
|
|
9
3
|
import { toLspPosition } from "@mrclrchtr/supi-lsp/api";
|
|
10
|
-
import { SEMANTIC_READINESS_TIMEOUT_REASON } from "../analysis/readiness.ts";
|
|
11
4
|
import { applyWorkspaceEdit } from "../analysis/refactor/apply.ts";
|
|
12
5
|
import {
|
|
13
6
|
isLatexSectionTarget,
|
|
14
7
|
refineLatexSectionRenameResult,
|
|
15
8
|
} from "../analysis/refactor/latex-section-rename.ts";
|
|
16
|
-
import {
|
|
17
|
-
establishMutationAuthority,
|
|
18
|
-
revalidateMutationAuthority,
|
|
19
|
-
} from "../analysis/refactor/mutation-authority.ts";
|
|
9
|
+
import { revalidateMutationAuthority } from "../analysis/refactor/mutation-authority.ts";
|
|
20
10
|
import { validateEdit } from "../analysis/refactor/safety.ts";
|
|
21
11
|
import { normalizePath } from "../analysis/search/paths.ts";
|
|
22
|
-
import type { CapabilityAdapter } from "./capability-adapter.ts";
|
|
23
12
|
import {
|
|
24
13
|
parseRefactorApplyWorkflowInput,
|
|
25
14
|
parseRefactorPlanWorkflowInput,
|
|
26
15
|
} from "./input/health-refactor.ts";
|
|
27
|
-
import {
|
|
28
|
-
import {
|
|
29
|
-
computeFileFingerprint,
|
|
30
|
-
generatePlanId,
|
|
31
|
-
isPlanFresh,
|
|
32
|
-
type RefactorPlan,
|
|
33
|
-
validateSynchronizedContentFingerprints,
|
|
34
|
-
} from "./refactor-plans.ts";
|
|
16
|
+
import { planFileAction } from "./refactor-file-actions.ts";
|
|
35
17
|
import {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
type
|
|
41
|
-
|
|
42
|
-
|
|
18
|
+
ensureFileReadiness,
|
|
19
|
+
finishProviderPlan,
|
|
20
|
+
immutablePlan,
|
|
21
|
+
planWithProvider,
|
|
22
|
+
type RefactorWorkflowDeps,
|
|
23
|
+
} from "./refactor-plan-pipeline.ts";
|
|
24
|
+
import { computeFileFingerprint, isPlanFresh } from "./refactor-plans.ts";
|
|
25
|
+
import type {
|
|
26
|
+
RefactorApplyWorkflowInput,
|
|
27
|
+
RefactorApplyWorkflowOutcome,
|
|
28
|
+
RefactorOperationInput,
|
|
29
|
+
RefactorPlanWorkflowInput,
|
|
30
|
+
RefactorPlanWorkflowOutcome,
|
|
43
31
|
} from "./refactor-types.ts";
|
|
44
32
|
import type { TargetStoreEntry } from "./target-store.ts";
|
|
45
|
-
import { resolveTargetWorkflow
|
|
33
|
+
import { resolveTargetWorkflow } from "./target-workflow.ts";
|
|
46
34
|
import { reportProgress, throwIfAborted, type WorkflowControl } from "./workflow-control.ts";
|
|
47
35
|
|
|
48
|
-
export interface RefactorWorkflowDeps extends TargetWorkflowDeps {
|
|
49
|
-
readonly capability: CapabilityAdapter;
|
|
50
|
-
readonly storePlan: (plan: RefactorPlan) => string;
|
|
51
|
-
readonly getPlan: (id: string) => RefactorPlan | undefined;
|
|
52
|
-
readonly removePlan: (id: string) => void;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
36
|
/** Plan one precise refactor without mutating files. */
|
|
56
37
|
export async function runRefactorPlanWorkflow(
|
|
57
38
|
input: RefactorPlanWorkflowInput,
|
|
@@ -60,24 +41,27 @@ export async function runRefactorPlanWorkflow(
|
|
|
60
41
|
): Promise<RefactorPlanWorkflowOutcome> {
|
|
61
42
|
const validatedInput = parseRefactorPlanWorkflowInput(input);
|
|
62
43
|
if (validatedInput.kind === "invalid-input") return validatedInput;
|
|
63
|
-
const
|
|
64
|
-
const parsed = parseOperation(request.operation);
|
|
65
|
-
if (parsed.kind === "invalid-input") return parsed;
|
|
66
|
-
const rangeError = parsed.range ? validateRange(parsed.range) : null;
|
|
67
|
-
if (rangeError) return { kind: "invalid-input", message: rangeError };
|
|
68
|
-
|
|
44
|
+
const { operation } = validatedInput.value;
|
|
69
45
|
throwIfAborted(control);
|
|
46
|
+
if ("rename_symbol" in operation) {
|
|
47
|
+
return planRename(operation.rename_symbol, deps, control);
|
|
48
|
+
}
|
|
49
|
+
return planFileAction(operation, deps, control);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
async function planRename(
|
|
53
|
+
input: Extract<RefactorOperationInput, { rename_symbol: unknown }>["rename_symbol"],
|
|
54
|
+
deps: RefactorWorkflowDeps,
|
|
55
|
+
control?: WorkflowControl,
|
|
56
|
+
): Promise<RefactorPlanWorkflowOutcome> {
|
|
70
57
|
reportProgress(control, {
|
|
71
58
|
intent: "refactor-plan",
|
|
72
59
|
phase: "target",
|
|
73
60
|
message: "Resolving refactor target",
|
|
74
61
|
});
|
|
75
62
|
const target = await resolveTargetWorkflow(
|
|
76
|
-
|
|
77
|
-
{
|
|
78
|
-
fileLevelAllowed: false,
|
|
79
|
-
nameAnchorRequired: parsed.operation === "rename_symbol",
|
|
80
|
-
},
|
|
63
|
+
input.target,
|
|
64
|
+
{ fileLevelAllowed: false, nameAnchorRequired: true },
|
|
81
65
|
deps,
|
|
82
66
|
control,
|
|
83
67
|
);
|
|
@@ -86,28 +70,48 @@ export async function runRefactorPlanWorkflow(
|
|
|
86
70
|
return {
|
|
87
71
|
kind: "invalid-input",
|
|
88
72
|
message:
|
|
89
|
-
"
|
|
73
|
+
"Rename requires one declaration, not a whole file. Pass one handle from the file outline as target.handle.",
|
|
90
74
|
};
|
|
91
75
|
}
|
|
92
76
|
if (target.kind === "disambiguation" || target.kind === "kind-mismatch") {
|
|
93
77
|
return {
|
|
94
78
|
kind: "invalid-input",
|
|
95
|
-
message: "
|
|
79
|
+
message: "Rename requires one precise target handle or anchor.",
|
|
96
80
|
};
|
|
97
81
|
}
|
|
98
82
|
if (target.kind !== "resolved") return target;
|
|
99
83
|
|
|
100
|
-
const
|
|
101
|
-
|
|
102
|
-
|
|
84
|
+
const file = normalizePath(target.entry.file, deps.cwd);
|
|
85
|
+
const readiness = await ensureFileReadiness(file, deps, control);
|
|
86
|
+
if (readiness) return readiness;
|
|
87
|
+
const sectionRename = await planWithLatexSafety({
|
|
88
|
+
newName: input.newName,
|
|
89
|
+
target: target.entry,
|
|
90
|
+
file,
|
|
91
|
+
deps,
|
|
103
92
|
control,
|
|
104
|
-
);
|
|
105
|
-
if (
|
|
106
|
-
|
|
93
|
+
});
|
|
94
|
+
if (
|
|
95
|
+
sectionRename.result.kind === "precise" &&
|
|
96
|
+
sectionRename.sourceFingerprint &&
|
|
97
|
+
computeFileFingerprint(file) !== sectionRename.sourceFingerprint
|
|
98
|
+
) {
|
|
99
|
+
return {
|
|
100
|
+
kind: "unavailable",
|
|
101
|
+
reason: "The LaTeX source changed before the title rename plan was stored.",
|
|
102
|
+
};
|
|
107
103
|
}
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
104
|
+
return finishProviderPlan(sectionRename.result, deps, {
|
|
105
|
+
operation: "rename_symbol",
|
|
106
|
+
file,
|
|
107
|
+
discriminator: `${target.entry.displayLine}:${target.entry.displayCharacter}:${input.newName}`,
|
|
108
|
+
fields: {
|
|
109
|
+
newName: input.newName,
|
|
110
|
+
target: { line: target.entry.displayLine, character: target.entry.displayCharacter },
|
|
111
|
+
},
|
|
112
|
+
evidenceSource: sectionRename.evidenceSource,
|
|
113
|
+
sourceFingerprint: sectionRename.sourceFingerprint,
|
|
114
|
+
});
|
|
111
115
|
}
|
|
112
116
|
|
|
113
117
|
/** Revalidate and apply one stored plan through the per-file mutation queue. */
|
|
@@ -157,94 +161,17 @@ export async function runRefactorApplyWorkflow(
|
|
|
157
161
|
return { kind: "completed", plan: immutablePlan(plan), result };
|
|
158
162
|
}
|
|
159
163
|
|
|
160
|
-
type ParsedRefactorOperation = Extract<ReturnType<typeof parseOperation>, { kind: "ok" }>;
|
|
161
164
|
type RefinedRefactorResult = Awaited<ReturnType<typeof refineLatexSectionRenameResult>>;
|
|
162
165
|
|
|
163
|
-
async function planResolvedRefactor(
|
|
164
|
-
parsed: ParsedRefactorOperation,
|
|
165
|
-
target: Readonly<TargetStoreEntry>,
|
|
166
|
-
deps: RefactorWorkflowDeps,
|
|
167
|
-
control?: WorkflowControl,
|
|
168
|
-
): Promise<RefactorPlanWorkflowOutcome> {
|
|
169
|
-
const file = normalizePath(target.file, deps.cwd);
|
|
170
|
-
const sectionRename = await planWithLatexSafety({ parsed, target, file, deps, control });
|
|
171
|
-
const result = sectionRename.result;
|
|
172
|
-
if (result.kind === "unavailable") return result;
|
|
173
|
-
if (result.kind === "ambiguous") {
|
|
174
|
-
return { kind: "ambiguous", candidates: result.candidates };
|
|
175
|
-
}
|
|
176
|
-
if (
|
|
177
|
-
sectionRename.sourceFingerprint &&
|
|
178
|
-
computeFileFingerprint(file) !== sectionRename.sourceFingerprint
|
|
179
|
-
) {
|
|
180
|
-
return {
|
|
181
|
-
kind: "unavailable",
|
|
182
|
-
reason: "The LaTeX source changed before the title rename plan was stored.",
|
|
183
|
-
};
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
const validation = validateEdit(result.edits);
|
|
187
|
-
if (!validation.safe) {
|
|
188
|
-
return { kind: "invalid-input", message: `Refactor safety check failed: ${validation.reason}` };
|
|
189
|
-
}
|
|
190
|
-
const authority = establishMutationAuthority(
|
|
191
|
-
result.edits.edits.map((edit) => edit.file),
|
|
192
|
-
result.authorizedMutationRoots,
|
|
193
|
-
);
|
|
194
|
-
if (authority.kind === "unavailable") return authority;
|
|
195
|
-
const fileFingerprints = collectFileFingerprints(
|
|
196
|
-
result.edits.edits,
|
|
197
|
-
sectionRename.sourceFingerprint
|
|
198
|
-
? { file, fingerprint: sectionRename.sourceFingerprint }
|
|
199
|
-
: undefined,
|
|
200
|
-
);
|
|
201
|
-
const snapshotError = validateSynchronizedContentFingerprints(
|
|
202
|
-
result.edits.documentPreconditions,
|
|
203
|
-
fileFingerprints,
|
|
204
|
-
deps.cwd,
|
|
205
|
-
);
|
|
206
|
-
if (snapshotError) return { kind: "unavailable", reason: snapshotError };
|
|
207
|
-
const changed = dropIdentityEdits(result.edits, fileFingerprints);
|
|
208
|
-
if (changed.kind === "unavailable") return changed;
|
|
209
|
-
if (changed.edits.edits.length === 0) {
|
|
210
|
-
return {
|
|
211
|
-
kind: "invalid-input",
|
|
212
|
-
message: `The ${parsed.operation} refactor produces no changes; every planned edit matches the current text.`,
|
|
213
|
-
};
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
const plan: RefactorPlan = {
|
|
217
|
-
id: generatePlanId(
|
|
218
|
-
parsed.operation,
|
|
219
|
-
file,
|
|
220
|
-
target.displayLine,
|
|
221
|
-
target.displayCharacter,
|
|
222
|
-
parsed.newName,
|
|
223
|
-
),
|
|
224
|
-
operation: parsed.operation,
|
|
225
|
-
newName: parsed.newName,
|
|
226
|
-
targetFile: file,
|
|
227
|
-
targetLine: target.displayLine,
|
|
228
|
-
targetCharacter: target.displayCharacter,
|
|
229
|
-
edits: changed.edits,
|
|
230
|
-
evidenceSource: sectionRename.evidenceSource,
|
|
231
|
-
authorizedMutationRoots: authority.canonicalRoots,
|
|
232
|
-
fileFingerprints: changed.fileFingerprints,
|
|
233
|
-
createdAt: Date.now(),
|
|
234
|
-
};
|
|
235
|
-
deps.storePlan(plan);
|
|
236
|
-
return { kind: "completed", plan: immutablePlan(plan) };
|
|
237
|
-
}
|
|
238
|
-
|
|
239
166
|
async function planWithLatexSafety(input: {
|
|
240
|
-
readonly
|
|
167
|
+
readonly newName: string;
|
|
241
168
|
readonly target: Readonly<TargetStoreEntry>;
|
|
242
169
|
readonly file: string;
|
|
243
170
|
readonly deps: RefactorWorkflowDeps;
|
|
244
171
|
readonly control?: WorkflowControl;
|
|
245
172
|
}): Promise<RefinedRefactorResult> {
|
|
246
|
-
const {
|
|
247
|
-
const isLatexRename =
|
|
173
|
+
const { newName, target, file, deps, control } = input;
|
|
174
|
+
const isLatexRename = isLatexSectionTarget(target);
|
|
248
175
|
if (isLatexRename && computeFileFingerprint(file) !== target.fileFingerprint) {
|
|
249
176
|
return {
|
|
250
177
|
result: {
|
|
@@ -258,11 +185,10 @@ async function planWithLatexSafety(input: {
|
|
|
258
185
|
const result = await planWithProvider(
|
|
259
186
|
deps.capability.getSemanticProvider(deps.cwd),
|
|
260
187
|
{
|
|
261
|
-
operation:
|
|
188
|
+
operation: "rename_symbol",
|
|
262
189
|
file,
|
|
263
190
|
position: toLspPosition(target.displayLine, target.displayCharacter),
|
|
264
|
-
|
|
265
|
-
newName: parsed.newName,
|
|
191
|
+
newName,
|
|
266
192
|
},
|
|
267
193
|
control,
|
|
268
194
|
);
|
|
@@ -276,11 +202,11 @@ async function planWithLatexSafety(input: {
|
|
|
276
202
|
};
|
|
277
203
|
}
|
|
278
204
|
return refineLatexSectionRenameResult({
|
|
279
|
-
operation:
|
|
205
|
+
operation: "rename_symbol",
|
|
280
206
|
result,
|
|
281
207
|
target,
|
|
282
208
|
file,
|
|
283
|
-
newName
|
|
209
|
+
newName,
|
|
284
210
|
structural: deps.capability.getStructuralProvider(deps.cwd),
|
|
285
211
|
documentVersionReader: getDocumentVersionReader(deps),
|
|
286
212
|
control,
|
|
@@ -295,104 +221,3 @@ function getDocumentVersionReader(
|
|
|
295
221
|
if (typeof state.runtime.getOpenDocumentVersion !== "function") return undefined;
|
|
296
222
|
return (file) => state.runtime.getOpenDocumentVersion(file);
|
|
297
223
|
}
|
|
298
|
-
|
|
299
|
-
function parseOperation(input: RefactorOperationInput):
|
|
300
|
-
| {
|
|
301
|
-
kind: "ok";
|
|
302
|
-
operation: RefactorOperation;
|
|
303
|
-
newName?: string;
|
|
304
|
-
range?: PublicSourceRange;
|
|
305
|
-
}
|
|
306
|
-
| { kind: "invalid-input"; message: string } {
|
|
307
|
-
const keys = PUBLIC_REFACTOR_OPERATION_NAMES.filter((key) => key in input);
|
|
308
|
-
if (keys.length !== 1) {
|
|
309
|
-
return { kind: "invalid-input", message: "Select exactly one refactor operation." };
|
|
310
|
-
}
|
|
311
|
-
if ("rename_symbol" in input) {
|
|
312
|
-
return {
|
|
313
|
-
kind: "ok",
|
|
314
|
-
operation: "rename_symbol",
|
|
315
|
-
newName: input.rename_symbol.newName,
|
|
316
|
-
};
|
|
317
|
-
}
|
|
318
|
-
if ("extract_function" in input) {
|
|
319
|
-
return {
|
|
320
|
-
kind: "ok",
|
|
321
|
-
operation: "extract_function",
|
|
322
|
-
newName: input.extract_function.newName,
|
|
323
|
-
range: input.extract_function.range,
|
|
324
|
-
};
|
|
325
|
-
}
|
|
326
|
-
if ("extract_variable" in input) {
|
|
327
|
-
return {
|
|
328
|
-
kind: "ok",
|
|
329
|
-
operation: "extract_variable",
|
|
330
|
-
newName: input.extract_variable.newName,
|
|
331
|
-
range: input.extract_variable.range,
|
|
332
|
-
};
|
|
333
|
-
}
|
|
334
|
-
return {
|
|
335
|
-
kind: "ok",
|
|
336
|
-
operation: "update_imports" in input ? "update_imports" : "delete_dead_code",
|
|
337
|
-
};
|
|
338
|
-
}
|
|
339
|
-
|
|
340
|
-
function validateRange(range: PublicSourceRange): string | null {
|
|
341
|
-
if (
|
|
342
|
-
range.end.line < range.start.line ||
|
|
343
|
-
(range.end.line === range.start.line && range.end.character <= range.start.character)
|
|
344
|
-
) {
|
|
345
|
-
return "range.end must be after range.start.";
|
|
346
|
-
}
|
|
347
|
-
return null;
|
|
348
|
-
}
|
|
349
|
-
|
|
350
|
-
function toLspRange(range: PublicSourceRange): SourceRange {
|
|
351
|
-
return {
|
|
352
|
-
start: toLspPosition(range.start.line, range.start.character),
|
|
353
|
-
end: toLspPosition(range.end.line, range.end.character),
|
|
354
|
-
};
|
|
355
|
-
}
|
|
356
|
-
|
|
357
|
-
async function planWithProvider(
|
|
358
|
-
provider: SemanticProvider | null,
|
|
359
|
-
request: {
|
|
360
|
-
operation: RefactorOperation;
|
|
361
|
-
file: string;
|
|
362
|
-
position: { line: number; character: number };
|
|
363
|
-
range?: SourceRange;
|
|
364
|
-
newName?: string;
|
|
365
|
-
},
|
|
366
|
-
control?: WorkflowControl,
|
|
367
|
-
): Promise<RefactorResult> {
|
|
368
|
-
if (!provider) return { kind: "unavailable", reason: "No semantic provider is active." };
|
|
369
|
-
if (provider.refactor) return provider.refactor(request, control);
|
|
370
|
-
if (request.operation === "rename_symbol" && request.newName !== undefined && provider.rename) {
|
|
371
|
-
return provider.rename(request.file, request.position, request.newName, control);
|
|
372
|
-
}
|
|
373
|
-
return {
|
|
374
|
-
kind: "unavailable",
|
|
375
|
-
reason: `The semantic provider cannot plan ${request.operation}.`,
|
|
376
|
-
};
|
|
377
|
-
}
|
|
378
|
-
|
|
379
|
-
function immutablePlan(plan: RefactorPlan): Readonly<RefactorPlan> {
|
|
380
|
-
return Object.freeze({
|
|
381
|
-
...plan,
|
|
382
|
-
edits: Object.freeze({
|
|
383
|
-
...plan.edits,
|
|
384
|
-
edits: Object.freeze(plan.edits.edits.map((edit) => Object.freeze({ ...edit }))),
|
|
385
|
-
documentPreconditions: plan.edits.documentPreconditions
|
|
386
|
-
? Object.freeze(
|
|
387
|
-
plan.edits.documentPreconditions.map((precondition) =>
|
|
388
|
-
Object.freeze({ ...precondition }),
|
|
389
|
-
),
|
|
390
|
-
)
|
|
391
|
-
: undefined,
|
|
392
|
-
}),
|
|
393
|
-
authorizedMutationRoots: Object.freeze([...plan.authorizedMutationRoots]),
|
|
394
|
-
fileFingerprints: Object.freeze(
|
|
395
|
-
plan.fileFingerprints.map((fingerprint) => Object.freeze({ ...fingerprint })),
|
|
396
|
-
),
|
|
397
|
-
}) as Readonly<RefactorPlan>;
|
|
398
|
-
}
|
|
@@ -7,6 +7,11 @@
|
|
|
7
7
|
// biome-ignore lint/style/noExcessiveLinesPerFile: target workflow keeps anchored, symbol, and file resolution together.
|
|
8
8
|
import { existsSync } from "node:fs";
|
|
9
9
|
import type { CodeRequestControl } from "@mrclrchtr/supi-code-runtime/api";
|
|
10
|
+
import {
|
|
11
|
+
createEvidenceList,
|
|
12
|
+
createPartialEvidenceList,
|
|
13
|
+
type EvidenceListMetadata,
|
|
14
|
+
} from "../analysis/evidence.ts";
|
|
10
15
|
import { withSemanticRequestControl, withStructuralRequestControl } from "../analysis/provider.ts";
|
|
11
16
|
import { normalizePath, resolveScope } from "../analysis/search/paths.ts";
|
|
12
17
|
import { resolveAnchoredSymbolTarget } from "../analysis/target/anchored.ts";
|
|
@@ -63,8 +68,8 @@ export type TargetWorkflowOutcome =
|
|
|
63
68
|
confidence: ResolvedTargetData["confidence"];
|
|
64
69
|
discoveryProvenance: FileOutlineData["discoveryProvenance"];
|
|
65
70
|
targets: ReadonlyArray<Readonly<TargetStoreEntry>>;
|
|
66
|
-
|
|
67
|
-
|
|
71
|
+
/** Declaration Evidence list: exact total, visible handles only. */
|
|
72
|
+
targetEvidence: EvidenceListMetadata;
|
|
68
73
|
unknownLevelCount: number;
|
|
69
74
|
partial?: FileOutlineData["partial"];
|
|
70
75
|
notListed: FileOutlineData["notListed"];
|
|
@@ -328,19 +333,9 @@ function toWorkflowOutcome(
|
|
|
328
333
|
kind: "kind-mismatch",
|
|
329
334
|
requestedKind: outcome.requestedKind,
|
|
330
335
|
candidates,
|
|
331
|
-
|
|
332
|
-
omittedCount: outcome.omittedCount,
|
|
333
|
-
partialReason: outcome.partialReason,
|
|
334
|
-
partialMessage: outcome.partialMessage,
|
|
336
|
+
candidateEvidence: outcome.candidateEvidence,
|
|
335
337
|
}
|
|
336
|
-
: {
|
|
337
|
-
kind: "disambiguation",
|
|
338
|
-
candidates,
|
|
339
|
-
totalCount: outcome.totalCount,
|
|
340
|
-
omittedCount: outcome.omittedCount,
|
|
341
|
-
partialReason: outcome.partialReason,
|
|
342
|
-
partialMessage: outcome.partialMessage,
|
|
343
|
-
};
|
|
338
|
+
: { kind: "disambiguation", candidates, candidateEvidence: outcome.candidateEvidence };
|
|
344
339
|
}
|
|
345
340
|
|
|
346
341
|
function registerFileOutline(
|
|
@@ -348,8 +343,21 @@ function registerFileOutline(
|
|
|
348
343
|
deps: TargetWorkflowDeps,
|
|
349
344
|
maxResults: number,
|
|
350
345
|
): TargetWorkflowOutcome {
|
|
351
|
-
|
|
352
|
-
const
|
|
346
|
+
// A partial outline enumerated what syntax recovery exposed; more may exist.
|
|
347
|
+
const visible = outline.partial
|
|
348
|
+
? createPartialEvidenceList({
|
|
349
|
+
key: "resolve.targets",
|
|
350
|
+
items: outline.targets,
|
|
351
|
+
maxResults: Math.max(0, maxResults),
|
|
352
|
+
partialReason: "provider-limited",
|
|
353
|
+
partialMessage: outline.partial.reason,
|
|
354
|
+
})
|
|
355
|
+
: createEvidenceList({
|
|
356
|
+
key: "resolve.targets",
|
|
357
|
+
items: outline.targets,
|
|
358
|
+
maxResults: Math.max(0, maxResults),
|
|
359
|
+
});
|
|
360
|
+
const visibleTargets = visible.items;
|
|
353
361
|
const fingerprint = computeFileFingerprint(outline.file);
|
|
354
362
|
const fileFingerprint = fingerprint.kind === "ok" ? fingerprint.fingerprint : "unfingerprinted";
|
|
355
363
|
const targets = visibleTargets.map((target) =>
|
|
@@ -361,8 +369,7 @@ function registerFileOutline(
|
|
|
361
369
|
confidence: outline.confidence,
|
|
362
370
|
discoveryProvenance: Object.freeze([...outline.discoveryProvenance]),
|
|
363
371
|
targets: Object.freeze(targets),
|
|
364
|
-
|
|
365
|
-
omittedCount: totalCount - targets.length,
|
|
372
|
+
targetEvidence: visible.metadata,
|
|
366
373
|
unknownLevelCount: outline.unknownLevelCount,
|
|
367
374
|
...(outline.partial ? { partial: outline.partial } : {}),
|
|
368
375
|
notListed: outline.notListed,
|
|
@@ -1,16 +1,13 @@
|
|
|
1
1
|
/** Thin Pi adapter for the session-owned code_find workflow. */
|
|
2
2
|
|
|
3
|
-
import type {
|
|
3
|
+
import type { FindSearchInput, FindWorkflowInput } from "../../session/find-types.ts";
|
|
4
4
|
import type { CodeIntelResult, CodeIntelToolExecCtx } from "../../types/index.ts";
|
|
5
5
|
import { toWorkflowControl } from "../infra/workflow-control.ts";
|
|
6
|
-
import type { CodeFindAstKind } from "./ast-kinds.ts";
|
|
7
6
|
import { finishFindResult } from "./result.ts";
|
|
8
7
|
|
|
9
8
|
export interface CodeFindToolParams {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
mode: FindMode;
|
|
13
|
-
kind?: CodeFindAstKind;
|
|
9
|
+
search: FindSearchInput;
|
|
10
|
+
scopes?: string[];
|
|
14
11
|
maxResults?: number;
|
|
15
12
|
}
|
|
16
13
|
|
|
@@ -19,5 +16,7 @@ export async function executeFindTool(
|
|
|
19
16
|
ctx: CodeIntelToolExecCtx,
|
|
20
17
|
): Promise<CodeIntelResult> {
|
|
21
18
|
const outcome = await ctx.session.find(params as FindWorkflowInput, toWorkflowControl(ctx));
|
|
22
|
-
|
|
19
|
+
const semantic =
|
|
20
|
+
typeof params.search === "object" && params.search !== null && "semantic" in params.search;
|
|
21
|
+
return finishFindResult(outcome, ctx.cwd, params.scopes, semantic ? "semantic" : "ast");
|
|
23
22
|
}
|
|
@@ -65,11 +65,9 @@ export function assembleFindWorkflowResult(
|
|
|
65
65
|
createToolDisplaySection({
|
|
66
66
|
key: `find.${outcome.data.kind}`,
|
|
67
67
|
title: outcome.data.kind === "semantic" ? "Symbols" : "Matches",
|
|
68
|
-
items: findItems(outcome.data),
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
partialReason: evidence.metadata.partialReason,
|
|
72
|
-
format: (item) => formatFindDisplayItem(outcome.data.kind, item),
|
|
68
|
+
items: findItems(outcome.data).slice(0, evidence.metadata.shownCount),
|
|
69
|
+
evidence: evidence.metadata,
|
|
70
|
+
format: (item: unknown) => formatFindDisplayItem(outcome.data.kind, item),
|
|
73
71
|
}),
|
|
74
72
|
];
|
|
75
73
|
|
|
@@ -79,8 +77,8 @@ export function assembleFindWorkflowResult(
|
|
|
79
77
|
key: "find.excludedPaths",
|
|
80
78
|
title: "Excluded path examples",
|
|
81
79
|
items: exclusion.examples,
|
|
82
|
-
|
|
83
|
-
|
|
80
|
+
evidence: createEvidenceList({ key: "find.excludedPaths", items: exclusion.examples })
|
|
81
|
+
.metadata,
|
|
84
82
|
format: describeExcludedPath,
|
|
85
83
|
}),
|
|
86
84
|
);
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import { Type } from "typebox";
|
|
2
2
|
import type { CodeIntelToolExecCtx } from "../../types/index.ts";
|
|
3
|
-
import {
|
|
4
|
-
import { CODE_FIND_AST_KINDS } from "./ast-kinds.ts";
|
|
3
|
+
import { FindScopesParam, FindSearchParam, MaxResultsParam } from "../schemas.ts";
|
|
5
4
|
import { executeFindTool } from "./execute.ts";
|
|
6
|
-
import { CODE_FIND_MODES } from "./modes.ts";
|
|
7
5
|
import { FindOutputSchema } from "./structured.ts";
|
|
8
6
|
import { renderFindCall, renderFindResult } from "./tui.ts";
|
|
9
7
|
|
|
@@ -14,22 +12,17 @@ export const CODE_FIND_TOOL_LABEL = "Code Find";
|
|
|
14
12
|
export const codeFindSpec = {
|
|
15
13
|
name: CODE_FIND_TOOL_NAME,
|
|
16
14
|
label: CODE_FIND_TOOL_LABEL,
|
|
15
|
+
annotations: {
|
|
16
|
+
readOnlyHint: true,
|
|
17
|
+
destructiveHint: false,
|
|
18
|
+
idempotentHint: true,
|
|
19
|
+
openWorldHint: false,
|
|
20
|
+
},
|
|
17
21
|
outputSchema: FindOutputSchema,
|
|
18
22
|
parameters: Type.Object(
|
|
19
23
|
{
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
mode: Type.Enum(CODE_FIND_MODES, {
|
|
23
|
-
type: "string",
|
|
24
|
-
description:
|
|
25
|
-
"Required code-aware search mode. AST mode requires `kind`; semantic mode rejects `kind`.",
|
|
26
|
-
}),
|
|
27
|
-
kind: Type.Optional(
|
|
28
|
-
Type.Enum(CODE_FIND_AST_KINDS, {
|
|
29
|
-
type: "string",
|
|
30
|
-
description: 'AST structure kind; required only for mode:"ast".',
|
|
31
|
-
}),
|
|
32
|
-
),
|
|
24
|
+
search: FindSearchParam,
|
|
25
|
+
scopes: Type.Optional(FindScopesParam),
|
|
33
26
|
maxResults: Type.Optional(MaxResultsParam),
|
|
34
27
|
},
|
|
35
28
|
{ additionalProperties: false },
|
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
type ToolRendererContext,
|
|
9
9
|
type ToolResult,
|
|
10
10
|
} from "../../ui/tui/common.ts";
|
|
11
|
-
import
|
|
11
|
+
import { CODE_FIND_MODES } from "./modes.ts";
|
|
12
12
|
|
|
13
13
|
/** Render the compact code_find call header. */
|
|
14
14
|
export function renderFindCall(
|
|
@@ -16,15 +16,21 @@ export function renderFindCall(
|
|
|
16
16
|
theme: Theme,
|
|
17
17
|
_context: ToolRendererContext | undefined,
|
|
18
18
|
): Text {
|
|
19
|
-
|
|
20
|
-
const
|
|
19
|
+
// Streaming calls arrive partial, so every level is read defensively.
|
|
20
|
+
const search = ((args ?? {}) as { search?: unknown }).search;
|
|
21
|
+
const branches = (search && typeof search === "object" ? search : {}) as Record<
|
|
22
|
+
string,
|
|
23
|
+
{ query?: unknown; kind?: unknown } | undefined
|
|
24
|
+
>;
|
|
25
|
+
const mode = CODE_FIND_MODES.find((candidate) => branches[candidate] !== undefined);
|
|
26
|
+
const branch = (mode ? branches[mode] : undefined) ?? {};
|
|
21
27
|
|
|
22
28
|
let content = theme.fg("toolTitle", "code_find");
|
|
23
|
-
const query = formatCallValue(
|
|
29
|
+
const query = formatCallValue(branch.query);
|
|
24
30
|
if (query) content += ` ${theme.fg("accent", JSON.stringify(query))}`;
|
|
25
|
-
content += ` ${theme.fg("muted", mode)}`;
|
|
31
|
+
content += ` ${theme.fg("muted", mode ?? "mode?")}`;
|
|
26
32
|
|
|
27
|
-
const kind = formatCallValue(
|
|
33
|
+
const kind = formatCallValue(branch.kind, 30);
|
|
28
34
|
if (kind) content += theme.fg("dim", ` [${kind}]`);
|
|
29
35
|
|
|
30
36
|
return new Text(content, 0, 0);
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { createEvidenceList } from "../../analysis/evidence.ts";
|
|
1
2
|
import type { CallEntry, ReferenceEntry } from "../../analysis/relations/types.ts";
|
|
2
3
|
import { toDisplayPath } from "../../analysis/search/paths.ts";
|
|
3
4
|
import { createToolDisplaySection } from "../result/display.ts";
|
|
@@ -20,6 +21,7 @@ export function graphDisplaySection(
|
|
|
20
21
|
key: `graph.${section.rel}`,
|
|
21
22
|
title: section.rel,
|
|
22
23
|
items: [],
|
|
24
|
+
evidence: createEvidenceList({ key: `graph.${section.rel}`, items: [] }).metadata,
|
|
23
25
|
format: () => "",
|
|
24
26
|
}),
|
|
25
27
|
fileGroups: [],
|
|
@@ -30,11 +32,8 @@ export function graphDisplaySection(
|
|
|
30
32
|
key: `graph.${section.rel}`,
|
|
31
33
|
title: section.rel,
|
|
32
34
|
items,
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
partialReason: section.evidence.metadata.partialReason,
|
|
36
|
-
partialMessage: section.evidence.metadata.partialMessage,
|
|
37
|
-
format: (item) => {
|
|
35
|
+
evidence: section.evidence.metadata,
|
|
36
|
+
format: (item: CallEntry | ReferenceEntry) => {
|
|
38
37
|
const site = `L${item.line}:${item.character}`;
|
|
39
38
|
if (section.rel !== "callees") return site;
|
|
40
39
|
const call = item as CallEntry;
|
|
@@ -42,7 +41,7 @@ export function graphDisplaySection(
|
|
|
42
41
|
},
|
|
43
42
|
});
|
|
44
43
|
const groups = new Map<string, string[]>();
|
|
45
|
-
for (let index = 0; index < display.
|
|
44
|
+
for (let index = 0; index < display.lines.length; index++) {
|
|
46
45
|
const file = toDisplayPath(cwd, items[index].file);
|
|
47
46
|
const rows = groups.get(file) ?? [];
|
|
48
47
|
rows.push(display.lines[index]);
|