chore: generate
This commit is contained in:
@@ -13,9 +13,9 @@ const tmpdir = (init?: (dir: string) => Effect.Effect<void>) =>
|
|||||||
Effect.acquireRelease(
|
Effect.acquireRelease(
|
||||||
Effect.promise(async () => fs.realpath(await fs.mkdtemp(path.join(os.tmpdir(), "opencode-test-")))),
|
Effect.promise(async () => fs.realpath(await fs.mkdtemp(path.join(os.tmpdir(), "opencode-test-")))),
|
||||||
(dir) =>
|
(dir) =>
|
||||||
Effect.promise(() =>
|
Effect.promise(() => fs.rm(dir, { recursive: true, force: true, maxRetries: 5, retryDelay: 100 })).pipe(
|
||||||
fs.rm(dir, { recursive: true, force: true, maxRetries: 5, retryDelay: 100 }),
|
Effect.ignore,
|
||||||
).pipe(Effect.ignore),
|
),
|
||||||
).pipe(Effect.tap((dir) => init?.(dir) ?? Effect.void))
|
).pipe(Effect.tap((dir) => init?.(dir) ?? Effect.void))
|
||||||
|
|
||||||
const write = (file: string, data: string) => Effect.promise(() => Bun.write(file, data))
|
const write = (file: string, data: string) => Effect.promise(() => Bun.write(file, data))
|
||||||
@@ -69,10 +69,7 @@ describe("file.search", () => {
|
|||||||
Effect.gen(function* () {
|
Effect.gen(function* () {
|
||||||
expect(Fff.available()).toBe(true)
|
expect(Fff.available()).toBe(true)
|
||||||
const dir = yield* tmpdir()
|
const dir = yield* tmpdir()
|
||||||
yield* write(
|
yield* write(path.join(dir, "matches.txt"), Array.from({ length: 150 }, (_, idx) => `needle ${idx}\n`).join(""))
|
||||||
path.join(dir, "matches.txt"),
|
|
||||||
Array.from({ length: 150 }, (_, idx) => `needle ${idx}\n`).join(""),
|
|
||||||
)
|
|
||||||
|
|
||||||
const search = yield* Search.Service
|
const search = yield* Search.Service
|
||||||
const result = yield* search.search({ cwd: dir, pattern: "needle" })
|
const result = yield* search.search({ cwd: dir, pattern: "needle" })
|
||||||
|
|||||||
@@ -113,4 +113,3 @@ for (const q of GLOB_QUERIES) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
process.exit(0)
|
process.exit(0)
|
||||||
|
|
||||||
|
|||||||
@@ -113,9 +113,7 @@ export const GrepTool = Tool.define(
|
|||||||
|
|
||||||
if (result.hasNextPage) {
|
if (result.hasNextPage) {
|
||||||
output.push("")
|
output.push("")
|
||||||
output.push(
|
output.push(`(Results truncated. Consider using a more specific path or pattern.)`)
|
||||||
`(Results truncated. Consider using a more specific path or pattern.)`,
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (result.partial) {
|
if (result.partial) {
|
||||||
|
|||||||
Reference in New Issue
Block a user