refactor(core): unify filesystem search service (#31566)

This commit is contained in:
Dax
2026-06-09 20:38:02 -04:00
committed by GitHub
parent ce4e658e3f
commit a0409e64d8
57 changed files with 965 additions and 2855 deletions
@@ -1,5 +1,4 @@
import { FileSystem } from "@opencode-ai/core/filesystem"
import { Ripgrep } from "@opencode-ai/core/filesystem/ripgrep"
import { NonNegativeInt } from "@opencode-ai/core/schema"
import { LSP } from "@/lsp/lsp"
import { Schema } from "effect"
@@ -38,6 +37,20 @@ export const FindSymbolQuery = Schema.Struct({
query: Schema.String,
})
export const LegacyMatch = Schema.Struct({
path: Schema.Struct({ text: Schema.String }),
lines: Schema.Struct({ text: Schema.String }),
line_number: NonNegativeInt,
absolute_offset: NonNegativeInt,
submatches: Schema.Array(
Schema.Struct({
match: Schema.Struct({ text: Schema.String }),
start: NonNegativeInt,
end: NonNegativeInt,
}),
),
})
export const LegacyEntry = Schema.Struct({
name: Schema.String,
path: Schema.String,
@@ -94,7 +107,7 @@ export const FileApi = HttpApi.make("file")
.add(
HttpApiEndpoint.get("findText", FilePaths.findText, {
query: FindTextQuery,
success: described(Schema.Array(Ripgrep.SearchMatch), "Matches"),
success: described(Schema.Array(LegacyMatch), "Matches"),
}).annotateMerge(
OpenApi.annotations({
identifier: "find.text",