@@ -5,7 +5,8 @@ import path from "path" |
5 | 5 | import { Context, Effect, Layer, Scope } from "effect" |
6 | 6 | import { Fff } from "#fff" |
7 | 7 | import fuzzysort from "fuzzysort" |
8 | | -import { FileSystem } from "../filesystem" |
| 8 | +import { Entry, Match } from "@opencode-ai/schema/filesystem" |
| 9 | +import type { FileSystem } from "../filesystem" |
9 | 10 | import { FSUtil } from "../fs-util" |
10 | 11 | import { Location } from "../location" |
11 | 12 | import { Ripgrep } from "../ripgrep" |
@@ -61,7 +62,7 @@ export const ripgrepLayer = Layer.effect( |
61 | 62 | .pipe( |
62 | 63 | Effect.map((result) => |
63 | 64 | result.map((entry) => |
64 | | - FileSystem.Entry.make({ |
| 65 | + Entry.make({ |
65 | 66 | ...entry, |
66 | 67 | path: RelativePath.make(path.relative(location.directory, path.resolve(cwd, entry.path))), |
67 | 68 | }), |
@@ -86,9 +87,9 @@ export const ripgrepLayer = Layer.effect( |
86 | 87 | .pipe( |
87 | 88 | Effect.map((result) => |
88 | 89 | result.map((match) => |
89 | | - FileSystem.Match.make({ |
| 90 | + Match.make({ |
90 | 91 | ...match, |
91 | | - entry: FileSystem.Entry.make({ |
| 92 | + entry: Entry.make({ |
92 | 93 | ...match.entry, |
93 | 94 | path: RelativePath.make(path.relative(location.directory, path.resolve(cwd, match.entry.path))), |
94 | 95 | }), |
@@ -109,7 +110,7 @@ export const ripgrepLayer = Layer.effect( |
109 | 110 | return fuzzysort.go(input.query, items, { limit: input.limit ?? 50 }).map((item) => { |
110 | 111 | const relative = item.target |
111 | 112 | const type = relative.endsWith(path.sep) ? ("directory" as const) : ("file" as const) |
112 | | - return FileSystem.Entry.make({ |
| 113 | + return Entry.make({ |
113 | 114 | path: RelativePath.make(relative), |
114 | 115 | type, |
115 | 116 | }) |
@@ -154,7 +155,7 @@ export const fffLayer = Layer.effect( |
154 | 155 | }) |
155 | 156 | if (!found.ok) throw found.error |
156 | 157 | return found.value.items.map((item) => |
157 | | - FileSystem.Entry.make({ |
| 158 | + Entry.make({ |
158 | 159 | path: RelativePath.make(item.relativePath.replaceAll("\\", "/")), |
159 | 160 | type: "file", |
160 | 161 | }), |
@@ -172,8 +173,8 @@ export const fffLayer = Layer.effect( |
172 | 173 | if (!found.ok) throw found.error |
173 | 174 | return found.value.items.map((match) => { |
174 | 175 | const bytes = Buffer.from(match.lineContent) |
175 | | - return FileSystem.Match.make({ |
176 | | - entry: FileSystem.Entry.make({ |
| 176 | + return Match.make({ |
| 177 | + entry: Entry.make({ |
177 | 178 | path: RelativePath.make(match.relativePath.replaceAll("\\", "/")), |
178 | 179 | type: "file", |
179 | 180 | }), |
@@ -222,7 +223,7 @@ export const fffLayer = Layer.effect( |
222 | 223 | .sort((a, b) => b.score - a.score || a.path.length - b.path.length) |
223 | 224 | .map((item) => { |
224 | 225 | const relative = item.path.replaceAll("\\", "/").replace(/\/$/, "") |
225 | | - return FileSystem.Entry.make({ |
| 226 | + return Entry.make({ |
226 | 227 | path: RelativePath.make(relative + (item.type === "directory" ? path.sep : "")), |
227 | 228 | type: item.type, |
228 | 229 | }) |
|