@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
|
@@ -2,6 +2,7 @@ import { renderEvidenceListDisclosure } from "../analysis/evidence.ts";
|
|
|
2
2
|
import { toDisplayPath } from "../analysis/search/paths.ts";
|
|
3
3
|
import { assembledNextQueries } from "./result/assembly.ts";
|
|
4
4
|
import type { RefactorApplyResultAssembly, RefactorPlanResultAssembly } from "./result/refactor.ts";
|
|
5
|
+
import { buildRefactorPreview, type RefactorPreviewEntry } from "./result/refactor-preview.ts";
|
|
5
6
|
|
|
6
7
|
/** Render a refactor plan from its canonical assembled evidence. */
|
|
7
8
|
export function renderRefactorPlanResult(assembly: RefactorPlanResultAssembly): string {
|
|
@@ -14,14 +15,14 @@ export function renderRefactorPlanResult(assembly: RefactorPlanResultAssembly):
|
|
|
14
15
|
lines.push("");
|
|
15
16
|
lines.push(`**Plan ID:** \`${plan.id}\``);
|
|
16
17
|
lines.push(`**Operation:** \`${plan.operation}\``);
|
|
17
|
-
lines.push(
|
|
18
|
-
`**Target:** \`${toDisplayPath(cwd, plan.targetFile)}\`:${plan.targetLine}:${plan.targetCharacter}`,
|
|
19
|
-
);
|
|
18
|
+
lines.push(`**${plan.target ? "Target" : "File"}:** ${formatPlanScope(plan, cwd)}`);
|
|
20
19
|
if (plan.newName) {
|
|
21
20
|
lines.push(`**New name:** \`${plan.newName}\``);
|
|
22
21
|
}
|
|
23
|
-
if (plan.
|
|
24
|
-
lines.push(`**
|
|
22
|
+
if (plan.action) {
|
|
23
|
+
lines.push(`**Action:** ${plan.action.title} (\`${plan.action.kind}\`)`);
|
|
24
|
+
const source = actionSource(plan.action.provenance);
|
|
25
|
+
if (source) lines.push(`**Source:** ${source}`);
|
|
25
26
|
}
|
|
26
27
|
lines.push(`**Confidence:** \`${assembly.assembled.confidence}\``);
|
|
27
28
|
lines.push(`**Files to change:** ${fileCount} file${fileCount !== 1 ? "s" : ""}`);
|
|
@@ -37,14 +38,8 @@ export function renderRefactorPlanResult(assembly: RefactorPlanResultAssembly):
|
|
|
37
38
|
lines.push("");
|
|
38
39
|
lines.push("## Preview");
|
|
39
40
|
lines.push("");
|
|
40
|
-
for (const
|
|
41
|
-
|
|
42
|
-
lines.push(
|
|
43
|
-
`- \`${toDisplayPath(cwd, edit.file)}\` L${range.start.line + 1}:${range.start.character + 1} → L${range.end.line + 1}:${range.end.character + 1}`,
|
|
44
|
-
);
|
|
45
|
-
lines.push(" ```");
|
|
46
|
-
lines.push(` ${edit.newText.split("\n").join("\n ")}`);
|
|
47
|
-
lines.push(" ```");
|
|
41
|
+
for (const entry of buildRefactorPreview(edits.items)) {
|
|
42
|
+
lines.push(...renderPreviewEntry(entry, cwd));
|
|
48
43
|
}
|
|
49
44
|
const disclosure = renderEvidenceListDisclosure(edits);
|
|
50
45
|
if (disclosure) {
|
|
@@ -73,14 +68,28 @@ export function renderRefactorApplyResult(assembly: RefactorApplyResultAssembly)
|
|
|
73
68
|
if (plan.newName) {
|
|
74
69
|
lines.push(`- New name: \`${plan.newName}\``);
|
|
75
70
|
}
|
|
76
|
-
if (plan.
|
|
77
|
-
lines.push(`-
|
|
71
|
+
if (plan.action) {
|
|
72
|
+
lines.push(`- Action: ${plan.action.title} (\`${plan.action.kind}\`)`);
|
|
78
73
|
}
|
|
79
74
|
const followUps = assembledNextQueries(assembly.assembled);
|
|
80
75
|
if (followUps.length > 0) lines.push("", ...followUps);
|
|
81
76
|
return lines.join("\n");
|
|
82
77
|
}
|
|
83
78
|
|
|
79
|
+
/** Render the operation scope: a rename target point, a code-action range, or a whole file. */
|
|
80
|
+
function formatPlanScope(
|
|
81
|
+
plan: RefactorPlanResultAssembly["assembled"]["data"]["plan"],
|
|
82
|
+
cwd: string,
|
|
83
|
+
): string {
|
|
84
|
+
const file = `\`${toDisplayPath(cwd, plan.file)}\``;
|
|
85
|
+
if (plan.target) return `${file}:${plan.target.line}:${plan.target.character}`;
|
|
86
|
+
if (plan.range) {
|
|
87
|
+
const { start, end } = plan.range;
|
|
88
|
+
return `${file} L${start.line}:${start.character} → L${end.line}:${end.character}`;
|
|
89
|
+
}
|
|
90
|
+
return `${file} (whole file)`;
|
|
91
|
+
}
|
|
92
|
+
|
|
84
93
|
function collectChangedFiles(
|
|
85
94
|
plan: RefactorPlanResultAssembly["assembled"]["data"]["plan"],
|
|
86
95
|
): Array<[file: string, count: number]> {
|
|
@@ -90,3 +99,34 @@ function collectChangedFiles(
|
|
|
90
99
|
}
|
|
91
100
|
return [...counts.entries()];
|
|
92
101
|
}
|
|
102
|
+
|
|
103
|
+
/** Describe how a code-action plan obtained its edits. */
|
|
104
|
+
function actionSource(provenance: "edit" | "captured-command" | undefined): string | null {
|
|
105
|
+
if (provenance === "edit") return "code action edit";
|
|
106
|
+
if (provenance === "captured-command") {
|
|
107
|
+
return "edit captured from the server command; it was refused, not applied";
|
|
108
|
+
}
|
|
109
|
+
return null;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
/** Render one server edit as its replacement text, or a combined line as before/after. */
|
|
113
|
+
function renderPreviewEntry(entry: RefactorPreviewEntry, cwd: string): string[] {
|
|
114
|
+
if (entry.kind === "line") {
|
|
115
|
+
const at = `L${entry.line + 1}`;
|
|
116
|
+
return [
|
|
117
|
+
`- \`${toDisplayPath(cwd, entry.file)}\` ${at}:${entry.startCharacter + 1} → ${at}:${entry.endCharacter + 1} (${entry.editCount} edits)`,
|
|
118
|
+
" ```",
|
|
119
|
+
` - ${entry.before}`,
|
|
120
|
+
` + ${entry.after}`,
|
|
121
|
+
" ```",
|
|
122
|
+
];
|
|
123
|
+
}
|
|
124
|
+
const { edit } = entry;
|
|
125
|
+
const range = edit.range;
|
|
126
|
+
return [
|
|
127
|
+
`- \`${toDisplayPath(cwd, edit.file)}\` L${range.start.line + 1}:${range.start.character + 1} → L${range.end.line + 1}:${range.end.character + 1}`,
|
|
128
|
+
" ```",
|
|
129
|
+
` ${edit.newText.split("\n").join("\n ")}`,
|
|
130
|
+
" ```",
|
|
131
|
+
];
|
|
132
|
+
}
|
package/src/tool/register.ts
CHANGED
|
@@ -12,6 +12,7 @@ import {
|
|
|
12
12
|
type CodeIntelligenceToolPromptSurfaceMap,
|
|
13
13
|
} from "./guidance.ts";
|
|
14
14
|
import { boundCodeToolResult } from "./infra/truncate.ts";
|
|
15
|
+
import { CODE_TOOL_NAMESPACE } from "./namespace.ts";
|
|
15
16
|
import { CODE_INTELLIGENCE_TOOL_SPECS, type CodeIntelligenceToolDefinitionSpec } from "./specs.ts";
|
|
16
17
|
|
|
17
18
|
/**
|
|
@@ -101,6 +102,8 @@ export function registerCodeIntelligenceTools(
|
|
|
101
102
|
pi.registerTool({
|
|
102
103
|
name: spec.name,
|
|
103
104
|
label: spec.label,
|
|
105
|
+
namespace: CODE_TOOL_NAMESPACE,
|
|
106
|
+
annotations: spec.annotations,
|
|
104
107
|
description: surface.description,
|
|
105
108
|
promptSnippet: surface.promptSnippet,
|
|
106
109
|
promptGuidelines: surface.promptGuidelines,
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Candidate selection: the one public result shape for target-selection
|
|
3
|
+
* outcomes (disambiguation and Symbol-kind mismatch) shared by code_graph,
|
|
4
|
+
* code_resolve, and code_orientation.
|
|
5
|
+
*
|
|
6
|
+
* The module owns the markdown, display section, status, message, and default
|
|
7
|
+
* next queries. Tools keep their own details type and structured content and
|
|
8
|
+
* may supply only recovery wording.
|
|
9
|
+
*/
|
|
10
|
+
import {
|
|
11
|
+
type EvidenceListMetadata,
|
|
12
|
+
type EvidenceNoun,
|
|
13
|
+
rekeyEvidence,
|
|
14
|
+
renderEvidenceListMetadataDisclosure,
|
|
15
|
+
} from "../../analysis/evidence.ts";
|
|
16
|
+
import { toDisplayPath } from "../../analysis/search/paths.ts";
|
|
17
|
+
import type { AnchorKind } from "../../session/target-store.ts";
|
|
18
|
+
import { createToolDisplaySection } from "./display.ts";
|
|
19
|
+
import type { ToolDisplaySection } from "./types.ts";
|
|
20
|
+
|
|
21
|
+
/** Candidate fields used by target-selection rows. */
|
|
22
|
+
export interface CandidateRowData {
|
|
23
|
+
readonly targetId: string;
|
|
24
|
+
readonly name: string;
|
|
25
|
+
readonly kind: string | null;
|
|
26
|
+
readonly file: string;
|
|
27
|
+
readonly line: number;
|
|
28
|
+
readonly character: number;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/** One target candidate as the session reports it, with an absolute file. */
|
|
32
|
+
export interface SelectionCandidate extends CandidateRowData {
|
|
33
|
+
readonly container: string | null;
|
|
34
|
+
readonly rank: number;
|
|
35
|
+
readonly anchorKind?: AnchorKind;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/** Target-selection outcome shared by the target-taking session workflows. */
|
|
39
|
+
export type CandidateSelectionOutcome<C extends SelectionCandidate = SelectionCandidate> =
|
|
40
|
+
| {
|
|
41
|
+
readonly kind: "disambiguation";
|
|
42
|
+
readonly candidates: readonly C[];
|
|
43
|
+
readonly candidateEvidence: EvidenceListMetadata;
|
|
44
|
+
}
|
|
45
|
+
| {
|
|
46
|
+
readonly kind: "kind-mismatch";
|
|
47
|
+
readonly requestedKind: string;
|
|
48
|
+
readonly candidates: readonly C[];
|
|
49
|
+
readonly candidateEvidence: EvidenceListMetadata;
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
/** Public candidate evidence key for one tool. */
|
|
53
|
+
export type CandidateSelectionKey =
|
|
54
|
+
| "graph.candidates"
|
|
55
|
+
| "resolve.candidates"
|
|
56
|
+
| "orientation.candidates";
|
|
57
|
+
|
|
58
|
+
/** Inputs for {@link assembleCandidateSelection}. */
|
|
59
|
+
export interface CandidateSelectionInput<C extends SelectionCandidate> {
|
|
60
|
+
readonly outcome: CandidateSelectionOutcome<C>;
|
|
61
|
+
readonly key: CandidateSelectionKey;
|
|
62
|
+
readonly cwd: string;
|
|
63
|
+
/** Tool-specific next step replacing the default recovery wording. */
|
|
64
|
+
readonly recovery?: string;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/** Assembled candidate selection; tools project it into their own details and schema. */
|
|
68
|
+
export interface CandidateSelection<C extends SelectionCandidate> {
|
|
69
|
+
readonly content: string;
|
|
70
|
+
/** Section title: "Near matches" for a Symbol-kind mismatch, else "Candidates". */
|
|
71
|
+
readonly title: string;
|
|
72
|
+
/** Candidates with display-relative file paths, in rank order. */
|
|
73
|
+
readonly candidates: readonly C[];
|
|
74
|
+
/** Candidate Evidence list re-keyed to the tool's public key. */
|
|
75
|
+
readonly evidence: EvidenceListMetadata;
|
|
76
|
+
readonly displaySections: readonly ToolDisplaySection[];
|
|
77
|
+
/** Selection is not invalid usage, including for a Symbol-kind mismatch. */
|
|
78
|
+
readonly status: "disambiguation";
|
|
79
|
+
readonly message: string;
|
|
80
|
+
readonly nextQueries: readonly string[];
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
const CANDIDATE_NOUN: EvidenceNoun = { one: "candidate", other: "candidates" };
|
|
84
|
+
const DISAMBIGUATION_RECOVERY =
|
|
85
|
+
"Choose one candidate handle, or narrow the symbol selector with scope or symbolKind";
|
|
86
|
+
const MISMATCH_RECOVERY =
|
|
87
|
+
"Retry without symbolKind, use an observed provider kind, or choose a near-match handle";
|
|
88
|
+
|
|
89
|
+
/** Assemble the canonical result for a target-selection outcome. */
|
|
90
|
+
export function assembleCandidateSelection<C extends SelectionCandidate>(
|
|
91
|
+
input: CandidateSelectionInput<C>,
|
|
92
|
+
): CandidateSelection<C> {
|
|
93
|
+
const { outcome, key, cwd } = input;
|
|
94
|
+
const mismatch = outcome.kind === "kind-mismatch";
|
|
95
|
+
const candidates = outcome.candidates.map((candidate) => ({
|
|
96
|
+
...candidate,
|
|
97
|
+
file: toDisplayPath(cwd, candidate.file),
|
|
98
|
+
}));
|
|
99
|
+
const evidence = rekeyEvidence(outcome.candidateEvidence, key);
|
|
100
|
+
const recovery = input.recovery ?? (mismatch ? MISMATCH_RECOVERY : DISAMBIGUATION_RECOVERY);
|
|
101
|
+
const title = mismatch ? "Near matches" : "Candidates";
|
|
102
|
+
|
|
103
|
+
const lines = mismatch
|
|
104
|
+
? [`# No target matched provider kind \`${outcome.requestedKind}\``, "", "Near matches:", ""]
|
|
105
|
+
: ["# Multiple targets match", ""];
|
|
106
|
+
for (const candidate of candidates) lines.push(formatCandidateMarkdownRow(candidate));
|
|
107
|
+
const disclosure = renderEvidenceListMetadataDisclosure(evidence, CANDIDATE_NOUN);
|
|
108
|
+
if (disclosure) lines.push("", disclosure);
|
|
109
|
+
lines.push("", `${recovery}.`);
|
|
110
|
+
|
|
111
|
+
return Object.freeze({
|
|
112
|
+
content: lines.join("\n"),
|
|
113
|
+
title,
|
|
114
|
+
candidates,
|
|
115
|
+
evidence,
|
|
116
|
+
displaySections: [
|
|
117
|
+
createToolDisplaySection({
|
|
118
|
+
key,
|
|
119
|
+
title,
|
|
120
|
+
items: candidates,
|
|
121
|
+
evidence,
|
|
122
|
+
format: (candidate: C) => formatCandidateRow(candidate),
|
|
123
|
+
}),
|
|
124
|
+
],
|
|
125
|
+
status: "disambiguation" as const,
|
|
126
|
+
message: mismatch
|
|
127
|
+
? `No target matched provider kind ${outcome.requestedKind}.`
|
|
128
|
+
: "Multiple target matches require one candidate.",
|
|
129
|
+
nextQueries: [recovery],
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
/** Plain handle-first candidate row for TUI display sections and fallbacks. */
|
|
134
|
+
export function formatCandidateRow(candidate: CandidateRowData): string {
|
|
135
|
+
return `${candidate.targetId} — ${candidate.name} (${candidate.kind ?? "unknown"}) at ${candidate.file}:${candidate.line}:${candidate.character}`;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
function formatCandidateMarkdownRow(candidate: SelectionCandidate): string {
|
|
139
|
+
const container = candidate.container ? ` in \`${candidate.container}\`` : "";
|
|
140
|
+
return `- \`${candidate.targetId}\` — **${candidate.name}** (\`${candidate.kind ?? "unknown"}\`)${container} at \`${candidate.file}\`:${candidate.line}:${candidate.character}`;
|
|
141
|
+
}
|
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
import {
|
|
2
|
+
describeEvidenceList,
|
|
3
|
+
type EvidenceListMetadata,
|
|
4
|
+
readEvidenceListFacts,
|
|
5
|
+
toEvidenceListFacts,
|
|
6
|
+
} from "../../analysis/evidence.ts";
|
|
1
7
|
import type { ToolDisplaySection } from "./types.ts";
|
|
2
8
|
|
|
3
9
|
/** Maximum number of rows shown for one expanded TUI section. */
|
|
@@ -8,49 +14,53 @@ export const MAX_TUI_DISPLAY_LINE_LENGTH = 240;
|
|
|
8
14
|
|
|
9
15
|
/** Inputs for one bounded structured TUI section. */
|
|
10
16
|
export interface ToolDisplaySectionInput<T> {
|
|
11
|
-
key
|
|
17
|
+
/** Section key; defaults to the evidence key. */
|
|
18
|
+
key?: string;
|
|
12
19
|
title: string;
|
|
20
|
+
/** Rows to show; the view may hide some as Display omissions. */
|
|
13
21
|
items: readonly T[];
|
|
22
|
+
/** Canonical Evidence list metadata this section previews; only constructors produce it. */
|
|
23
|
+
evidence: EvidenceListMetadata;
|
|
14
24
|
format: (item: T) => string;
|
|
15
|
-
totalCount?: number | null;
|
|
16
|
-
omittedCount?: number | null;
|
|
17
|
-
partialReason?: string | null;
|
|
18
|
-
/** Provider explanation for incomplete collection, when available. */
|
|
19
|
-
partialMessage?: string;
|
|
20
25
|
maxItems?: number;
|
|
21
26
|
/** Explicit content-count meaning when display rows are not individual Evidence atoms. */
|
|
22
27
|
preview?: ToolDisplaySection["preview"];
|
|
23
28
|
}
|
|
24
29
|
|
|
25
|
-
/**
|
|
30
|
+
/**
|
|
31
|
+
* Build a bounded, serializable TUI section. Evidence facts are copied
|
|
32
|
+
* unchanged; rows the view cap hides are reported as a separate Display
|
|
33
|
+
* omission and never merged into evidence counts.
|
|
34
|
+
*/
|
|
26
35
|
export function createToolDisplaySection<T>(input: ToolDisplaySectionInput<T>): ToolDisplaySection {
|
|
27
36
|
const maxItems = Math.max(0, input.maxItems ?? MAX_TUI_DISPLAY_ITEMS);
|
|
28
37
|
const items = input.items.slice(0, maxItems);
|
|
29
|
-
const lines = items.map((item) => truncateDisplayText(input.format(item)));
|
|
30
|
-
const displayOmittedCount = Math.max(0, input.items.length - items.length);
|
|
31
|
-
let totalCount: number | null;
|
|
32
|
-
if (input.totalCount === undefined) totalCount = input.items.length;
|
|
33
|
-
else totalCount = input.totalCount;
|
|
34
|
-
const omittedCount =
|
|
35
|
-
totalCount === null
|
|
36
|
-
? input.omittedCount === null || input.omittedCount === undefined
|
|
37
|
-
? displayOmittedCount || null
|
|
38
|
-
: input.omittedCount + displayOmittedCount
|
|
39
|
-
: Math.max(0, totalCount - lines.length);
|
|
40
|
-
|
|
41
38
|
return {
|
|
42
|
-
key: input.key,
|
|
39
|
+
key: input.key ?? input.evidence.key,
|
|
43
40
|
title: input.title,
|
|
44
|
-
lines,
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
omittedCount,
|
|
48
|
-
partialReason: input.partialReason ?? null,
|
|
49
|
-
...(input.partialMessage === undefined ? {} : { partialMessage: input.partialMessage }),
|
|
41
|
+
lines: items.map((item) => truncateDisplayText(input.format(item))),
|
|
42
|
+
evidence: toEvidenceListFacts(input.evidence),
|
|
43
|
+
displayOmittedCount: input.items.length - items.length,
|
|
50
44
|
...(input.preview ? { preview: { ...input.preview } } : {}),
|
|
51
45
|
};
|
|
52
46
|
}
|
|
53
47
|
|
|
48
|
+
/** Canonical Display omission phrase, e.g. `5 rows hidden in view`; null when none. */
|
|
49
|
+
export function describeDisplayOmission(count: number, unit = "row"): string | null {
|
|
50
|
+
return count > 0 ? `${count} ${unit}${count === 1 ? "" : "s"} hidden in view` : null;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/** Canonical bounds suffix for one TUI section title, e.g. ` (3 of 5; 2 omitted)`. */
|
|
54
|
+
export function formatDisplaySectionBounds(section: ToolDisplaySection): string {
|
|
55
|
+
const unit = section.preview?.unit;
|
|
56
|
+
const parts = [
|
|
57
|
+
section.preview?.evidenceSummary ?? (unit ? null : describeEvidenceList(section.evidence)),
|
|
58
|
+
unit ? `${section.lines.length} preview ${unit}${section.lines.length === 1 ? "" : "s"}` : null,
|
|
59
|
+
describeDisplayOmission(section.displayOmittedCount, unit ? `preview ${unit}` : "row"),
|
|
60
|
+
].filter((part): part is string => Boolean(part));
|
|
61
|
+
return parts.length ? ` (${parts.join("; ")})` : "";
|
|
62
|
+
}
|
|
63
|
+
|
|
54
64
|
/** Keep structured TUI rows readable without parsing or emitting Markdown. */
|
|
55
65
|
export function truncateDisplayText(
|
|
56
66
|
value: string,
|
|
@@ -72,15 +82,14 @@ export function readToolDisplaySections(value: unknown): ToolDisplaySection[] {
|
|
|
72
82
|
return value.flatMap((entry) => {
|
|
73
83
|
if (typeof entry !== "object" || entry === null || Array.isArray(entry)) return [];
|
|
74
84
|
const record = entry as Record<string, unknown>;
|
|
85
|
+
const evidence = readEvidenceListFacts(record.evidence);
|
|
75
86
|
if (
|
|
76
87
|
typeof record.key !== "string" ||
|
|
77
88
|
typeof record.title !== "string" ||
|
|
78
89
|
!Array.isArray(record.lines) ||
|
|
79
90
|
!record.lines.every((line) => typeof line === "string") ||
|
|
80
|
-
!
|
|
81
|
-
!
|
|
82
|
-
!isNullableCount(record.omittedCount) ||
|
|
83
|
-
!isNullableString(record.partialReason)
|
|
91
|
+
!evidence ||
|
|
92
|
+
!isCount(record.displayOmittedCount)
|
|
84
93
|
) {
|
|
85
94
|
return [];
|
|
86
95
|
}
|
|
@@ -92,13 +101,8 @@ export function readToolDisplaySections(value: unknown): ToolDisplaySection[] {
|
|
|
92
101
|
lines: record.lines
|
|
93
102
|
.slice(0, MAX_TUI_DISPLAY_ITEMS)
|
|
94
103
|
.map((line) => truncateDisplayText(line)),
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
omittedCount: record.omittedCount,
|
|
98
|
-
partialReason: record.partialReason,
|
|
99
|
-
...(typeof record.partialMessage === "string"
|
|
100
|
-
? { partialMessage: record.partialMessage }
|
|
101
|
-
: {}),
|
|
104
|
+
evidence,
|
|
105
|
+
displayOmittedCount: record.displayOmittedCount,
|
|
102
106
|
...(preview ? { preview } : {}),
|
|
103
107
|
},
|
|
104
108
|
];
|
|
@@ -120,11 +124,3 @@ function readPreview(value: unknown): ToolDisplaySection["preview"] {
|
|
|
120
124
|
function isCount(value: unknown): value is number {
|
|
121
125
|
return typeof value === "number" && Number.isInteger(value) && value >= 0;
|
|
122
126
|
}
|
|
123
|
-
|
|
124
|
-
function isNullableCount(value: unknown): value is number | null {
|
|
125
|
-
return value === null || isCount(value);
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
function isNullableString(value: unknown): value is string | null {
|
|
129
|
-
return value === null || typeof value === "string";
|
|
130
|
-
}
|
|
@@ -118,6 +118,7 @@ export function healthErrorResult(content: string, reason?: string): CodeIntelRe
|
|
|
118
118
|
serverInventoryAvailable: false,
|
|
119
119
|
serverInventoryScope: "workspace",
|
|
120
120
|
diagnosticObservation: { kind: "not-requested", entries: [] },
|
|
121
|
+
diagnosticCoverage: null,
|
|
121
122
|
refresh: {
|
|
122
123
|
kind: "not-attempted",
|
|
123
124
|
reason: reason ?? content,
|
|
@@ -1,4 +1,11 @@
|
|
|
1
|
+
import { classifyDiagnosticCoverage, type DiagnosticCoverage } from "../../diagnostics/coverage.ts";
|
|
2
|
+
import type { HealthDiagnosticScope } from "../../session/health-types.ts";
|
|
1
3
|
import type { CodeIntelResult } from "../../types/index.ts";
|
|
4
|
+
import {
|
|
5
|
+
DIAGNOSTIC_NEXT_ACTION,
|
|
6
|
+
isPassiveTrackedSnapshot,
|
|
7
|
+
PASSIVE_SNAPSHOT_NOTE,
|
|
8
|
+
} from "../code_health/guidance.ts";
|
|
2
9
|
import { formatSemanticHealthState } from "../code_health/semantic-state.ts";
|
|
3
10
|
import type { HealthDetails, SearchDetails } from "./types.ts";
|
|
4
11
|
|
|
@@ -168,6 +175,21 @@ function searchFacts(data: SearchDetails): string[] {
|
|
|
168
175
|
return lines;
|
|
169
176
|
}
|
|
170
177
|
|
|
178
|
+
/** Keep the zero-coverage and passive-snapshot guidance when the full markdown is truncated. */
|
|
179
|
+
function coverageNote(
|
|
180
|
+
coverage: DiagnosticCoverage,
|
|
181
|
+
scope: HealthDiagnosticScope,
|
|
182
|
+
refresh: HealthDetails["refresh"],
|
|
183
|
+
): string | null {
|
|
184
|
+
if (coverage === "none") {
|
|
185
|
+
return `No source diagnostics checked; this is not a clean result. Next: ${DIAGNOSTIC_NEXT_ACTION}.`;
|
|
186
|
+
}
|
|
187
|
+
if (coverage === "confirmed" && isPassiveTrackedSnapshot(scope, refresh)) {
|
|
188
|
+
return `${PASSIVE_SNAPSHOT_NOTE}.`;
|
|
189
|
+
}
|
|
190
|
+
return null;
|
|
191
|
+
}
|
|
192
|
+
|
|
171
193
|
function healthFacts(data: HealthDetails): string[] {
|
|
172
194
|
const observation = data.diagnosticObservation;
|
|
173
195
|
const lines = [
|
|
@@ -178,10 +200,13 @@ function healthFacts(data: HealthDetails): string[] {
|
|
|
178
200
|
if ("reason" in data.refresh) lines.push(`Refresh reason: ${data.refresh.reason}`);
|
|
179
201
|
if (observation.kind !== "not-requested") {
|
|
180
202
|
const scope = observation.scope;
|
|
203
|
+
const coverage = classifyDiagnosticCoverage(observation);
|
|
181
204
|
lines.push(
|
|
182
205
|
`Diagnostics: ${observation.kind}; ${scope.kind === "file" ? `file=${scope.path}` : `tracked-file snapshot; filter=${scope.filter ?? "none"}; not workspace-wide verification`}.`,
|
|
183
|
-
`Diagnostic coverage: requested=${observation.evidence.requested}, confirmed=${observation.evidence.confirmed}, unconfirmed=${observation.evidence.unconfirmed}, failed=${observation.evidence.failed}, removed=${observation.evidence.removed}.`,
|
|
206
|
+
`Diagnostic coverage: ${coverage}; requested=${observation.evidence.requested}, confirmed=${observation.evidence.confirmed}, unconfirmed=${observation.evidence.unconfirmed}, failed=${observation.evidence.failed}, removed=${observation.evidence.removed}.`,
|
|
184
207
|
);
|
|
208
|
+
const note = coverageNote(coverage, scope, data.refresh);
|
|
209
|
+
if (note) lines.push(note);
|
|
185
210
|
if ("reason" in observation) lines.push(`Diagnostic limitation: ${observation.reason}`);
|
|
186
211
|
if (observation.scopeStatus)
|
|
187
212
|
lines.push(`File scope status: ${JSON.stringify(observation.scopeStatus)}`);
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Readable preview entries for refactor plans.
|
|
3
|
+
*
|
|
4
|
+
* Some servers (kotlin-lsp) return minimal character-level edits, so renaming
|
|
5
|
+
* `total` to `sumDoubled` arrives as `sumD`, `ub`, `ed`. The preview combines
|
|
6
|
+
* consecutive single-line edits on one line into one before/after entry. The
|
|
7
|
+
* stored plan and its edits stay exactly as the server returned them.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import { readFileSync } from "node:fs";
|
|
11
|
+
import type { FileEdit } from "@mrclrchtr/supi-code-runtime/api";
|
|
12
|
+
|
|
13
|
+
/** One preview entry: a server edit as is, or several edits on one line combined. */
|
|
14
|
+
export type RefactorPreviewEntry =
|
|
15
|
+
| { readonly kind: "edit"; readonly edit: FileEdit }
|
|
16
|
+
| {
|
|
17
|
+
readonly kind: "line";
|
|
18
|
+
readonly file: string;
|
|
19
|
+
/** Zero-based line and UTF-16 span covering every combined edit. */
|
|
20
|
+
readonly line: number;
|
|
21
|
+
readonly startCharacter: number;
|
|
22
|
+
readonly endCharacter: number;
|
|
23
|
+
readonly before: string;
|
|
24
|
+
readonly after: string;
|
|
25
|
+
readonly editCount: number;
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Number of leading edits to show so that at least `maxResults` are shown and
|
|
30
|
+
* the last shown edit does not split a group of edits on the same line.
|
|
31
|
+
*/
|
|
32
|
+
export function previewEditCount(edits: readonly FileEdit[], maxResults: number): number {
|
|
33
|
+
let count = Math.min(Math.max(0, maxResults), edits.length);
|
|
34
|
+
while (count > 0 && count < edits.length) {
|
|
35
|
+
const last = edits[count - 1] as FileEdit;
|
|
36
|
+
const next = edits[count] as FileEdit;
|
|
37
|
+
if (!isInlineEdit(last) || !isInlineEdit(next) || !sameLine(last, next)) break;
|
|
38
|
+
count++;
|
|
39
|
+
}
|
|
40
|
+
return count;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/** Combine consecutive edits on one line when the current file text allows it. */
|
|
44
|
+
export function buildRefactorPreview(edits: readonly FileEdit[]): RefactorPreviewEntry[] {
|
|
45
|
+
const lines = new Map<string, readonly string[] | null>();
|
|
46
|
+
const entries: RefactorPreviewEntry[] = [];
|
|
47
|
+
for (let index = 0; index < edits.length; ) {
|
|
48
|
+
let end = index + 1;
|
|
49
|
+
const first = edits[index] as FileEdit;
|
|
50
|
+
while (
|
|
51
|
+
end < edits.length &&
|
|
52
|
+
isInlineEdit(first) &&
|
|
53
|
+
isInlineEdit(edits[end] as FileEdit) &&
|
|
54
|
+
sameLine(first, edits[end] as FileEdit)
|
|
55
|
+
) {
|
|
56
|
+
end++;
|
|
57
|
+
}
|
|
58
|
+
const group = edits.slice(index, end);
|
|
59
|
+
const combined = group.length > 1 ? combineLine(group, fileLines(first.file, lines)) : null;
|
|
60
|
+
if (combined) entries.push(combined);
|
|
61
|
+
else entries.push(...group.map((edit) => ({ kind: "edit" as const, edit })));
|
|
62
|
+
index = end;
|
|
63
|
+
}
|
|
64
|
+
return entries;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
function isInlineEdit(edit: FileEdit): boolean {
|
|
68
|
+
return edit.range.start.line === edit.range.end.line && !/[\r\n]/u.test(edit.newText);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
function sameLine(a: FileEdit, b: FileEdit): boolean {
|
|
72
|
+
return a.file === b.file && a.range.start.line === b.range.start.line;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
function fileLines(
|
|
76
|
+
file: string,
|
|
77
|
+
cache: Map<string, readonly string[] | null>,
|
|
78
|
+
): readonly string[] | null {
|
|
79
|
+
if (!cache.has(file)) {
|
|
80
|
+
try {
|
|
81
|
+
cache.set(file, readFileSync(file, "utf8").split(/\r\n|\r|\n/u));
|
|
82
|
+
} catch {
|
|
83
|
+
cache.set(file, null);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
return cache.get(file) ?? null;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/** Apply sorted, non-overlapping edits to their line; null when that is not possible. */
|
|
90
|
+
function combineLine(
|
|
91
|
+
group: readonly FileEdit[],
|
|
92
|
+
lines: readonly string[] | null,
|
|
93
|
+
): RefactorPreviewEntry | null {
|
|
94
|
+
const first = group[0] as FileEdit;
|
|
95
|
+
const text = lines?.[first.range.start.line];
|
|
96
|
+
if (text === undefined) return null;
|
|
97
|
+
const sorted = [...group].sort((a, b) => a.range.start.character - b.range.start.character);
|
|
98
|
+
let after = "";
|
|
99
|
+
let cursor = (sorted[0] as FileEdit).range.start.character;
|
|
100
|
+
const startCharacter = cursor;
|
|
101
|
+
for (const edit of sorted) {
|
|
102
|
+
const { start, end } = edit.range;
|
|
103
|
+
if (start.character < cursor || end.character < start.character) return null;
|
|
104
|
+
if (end.character > text.length) return null;
|
|
105
|
+
after += text.slice(cursor, start.character) + edit.newText;
|
|
106
|
+
cursor = end.character;
|
|
107
|
+
}
|
|
108
|
+
return {
|
|
109
|
+
kind: "line",
|
|
110
|
+
file: first.file,
|
|
111
|
+
line: first.range.start.line,
|
|
112
|
+
startCharacter,
|
|
113
|
+
endCharacter: cursor,
|
|
114
|
+
before: text.slice(startCharacter, cursor),
|
|
115
|
+
after,
|
|
116
|
+
editCount: group.length,
|
|
117
|
+
};
|
|
118
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/** Unavailable reasons shared by code_refactor_plan and code_refactor_apply. */
|
|
2
|
+
|
|
3
|
+
/** supi-lsp text for a request superseded by a file change while it ran. */
|
|
4
|
+
const SEMANTIC_INPUT_CHANGED = "Semantic input changed";
|
|
5
|
+
const CONCURRENT_EDIT_HINT = "Retry after concurrent edits finish.";
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Add a recovery hint to a reason caused by a concurrent edit, for example a
|
|
9
|
+
* plan running in parallel with an apply. Other reasons are returned unchanged.
|
|
10
|
+
*/
|
|
11
|
+
export function refactorUnavailableReason(reason: string): string {
|
|
12
|
+
if (!reason.includes(SEMANTIC_INPUT_CHANGED) || reason.includes(CONCURRENT_EDIT_HINT)) {
|
|
13
|
+
return reason;
|
|
14
|
+
}
|
|
15
|
+
return `${reason} ${CONCURRENT_EDIT_HINT}`;
|
|
16
|
+
}
|
|
@@ -1,10 +1,15 @@
|
|
|
1
1
|
import type { FileEdit } from "@mrclrchtr/supi-code-runtime/api";
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
createEvidenceList,
|
|
4
|
+
type EvidenceList,
|
|
5
|
+
knownEvidenceCount,
|
|
6
|
+
} from "../../analysis/evidence.ts";
|
|
3
7
|
import type { ApplyResult } from "../../analysis/refactor/apply.ts";
|
|
4
8
|
import { toDisplayPath } from "../../analysis/search/paths.ts";
|
|
5
9
|
import type { RefactorPlan } from "../../session/refactor-plans.ts";
|
|
6
10
|
import { assembledNextQueries, assembleToolResult, type ToolResultAssembly } from "./assembly.ts";
|
|
7
11
|
import { createToolDisplaySection } from "./display.ts";
|
|
12
|
+
import { previewEditCount } from "./refactor-preview.ts";
|
|
8
13
|
import type { SearchDetails, ToolDisplaySection } from "./types.ts";
|
|
9
14
|
|
|
10
15
|
export interface RefactorPlanAssemblyData {
|
|
@@ -45,7 +50,7 @@ export function assembleRefactorPlanDetails(
|
|
|
45
50
|
const edits = createEvidenceList({
|
|
46
51
|
key: "refactor.edits",
|
|
47
52
|
items: [...plan.edits.edits],
|
|
48
|
-
maxResults,
|
|
53
|
+
maxResults: previewEditCount(plan.edits.edits, maxResults),
|
|
49
54
|
});
|
|
50
55
|
const evidenceSource = plan.evidenceSource ?? "semantic";
|
|
51
56
|
const provenance = [
|
|
@@ -67,8 +72,13 @@ export function assembleRefactorPlanDetails(
|
|
|
67
72
|
},
|
|
68
73
|
],
|
|
69
74
|
evidenceLists: [edits.metadata],
|
|
70
|
-
nextQueries: [
|
|
71
|
-
|
|
75
|
+
nextQueries: [
|
|
76
|
+
`Use code_refactor_apply with planId: "${plan.id}" to apply this refactor`,
|
|
77
|
+
...(plan.operation === "code_action"
|
|
78
|
+
? ["After applying, use rename_symbol to rename any server-generated names"]
|
|
79
|
+
: []),
|
|
80
|
+
],
|
|
81
|
+
candidateCount: knownEvidenceCount(edits.metadata),
|
|
72
82
|
confidence: evidenceSource,
|
|
73
83
|
provenance,
|
|
74
84
|
});
|
|
@@ -80,10 +90,8 @@ export function assembleRefactorPlanDetails(
|
|
|
80
90
|
key: "refactor.edits",
|
|
81
91
|
title: "Proposed edits",
|
|
82
92
|
items: edits.items,
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
partialReason: edits.metadata.partialReason,
|
|
86
|
-
format: (edit) => formatEdit(edit, cwd),
|
|
93
|
+
evidence: edits.metadata,
|
|
94
|
+
format: (edit: (typeof edits.items)[number]) => formatEdit(edit, cwd),
|
|
87
95
|
}),
|
|
88
96
|
],
|
|
89
97
|
details: {
|
|
@@ -147,8 +155,9 @@ export function assembleRefactorApplyDetails(
|
|
|
147
155
|
key: "refactor.changedFiles",
|
|
148
156
|
title: "Changed files",
|
|
149
157
|
items: changedFiles,
|
|
150
|
-
|
|
151
|
-
|
|
158
|
+
evidence: createEvidenceList({ key: "refactor.changedFiles", items: changedFiles })
|
|
159
|
+
.metadata,
|
|
160
|
+
format: (file: string) => file,
|
|
152
161
|
}),
|
|
153
162
|
]
|
|
154
163
|
: [],
|
|
@@ -5,10 +5,11 @@ export const ConfidenceSchema = Type.Enum(["semantic", "structural", "heuristic"
|
|
|
5
5
|
type: "string",
|
|
6
6
|
});
|
|
7
7
|
|
|
8
|
-
/** Canonical evidence counts
|
|
8
|
+
/** Canonical evidence counts and Evidence completeness state; readers never infer completeness. */
|
|
9
9
|
export const EvidenceListSchema = Type.Object(
|
|
10
10
|
{
|
|
11
11
|
key: Type.String(),
|
|
12
|
+
completeness: Type.Enum(["complete", "capped", "partial", "unbounded"], { type: "string" }),
|
|
12
13
|
totalCount: Type.Union([Type.Integer(), Type.Null()]),
|
|
13
14
|
shownCount: Type.Integer(),
|
|
14
15
|
omittedCount: Type.Union([Type.Integer(), Type.Null()]),
|