Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions packages/core/src/filesystem/search.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import path from "path"
import os from "os"
import { Context, Deferred, Effect, Layer, Option, Stream } from "effect"
import type { PlatformError } from "effect/PlatformError"
import { FSUtil } from "../fs-util"
Expand Down Expand Up @@ -208,6 +209,7 @@ export const layer: Layer.Layer<Service, never, FSUtil.Service | Ripgrep.Service
wait: new Map<string, Deferred.Deferred<Picker, Error>>(),
recent: [] as Query[],
}
const home = FSUtil.resolve(os.homedir())

yield* fs.ensureDir(root).pipe(Effect.ignore)
yield* Effect.addFinalizer(() =>
Expand Down Expand Up @@ -278,10 +280,9 @@ export const layer: Layer.Layer<Service, never, FSUtil.Service | Ripgrep.Service
frecencyDbPath: path.join(root, `${id}.frecency.mdb`),
historyDbPath: path.join(root, `${id}.history.mdb`),
aiMode: true,
// only the first toolcall picker can accumulate resources to index
// home directory, if the user specifically opened opencode at the
// $HOME level or asked it to search there on purpose, otherwise fallback
enableHomeDirScanning: isFirstPicker,
// FFF rejects home scanning unless opted in. Preserve the existing
// first-picker opt-in and also allow explicit $HOME picker requests.
enableHomeDirScanning: dir === home || isFirstPicker,
// on unix system it is 99.9% that you do not need to search for the
// content at the / so make fff fail creation and fallback to rg
enableFsRootScanning: isFirstPicker && process.platform === "win32",
Expand Down
Loading