Skip to content
Open
Show file tree
Hide file tree
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
46 changes: 46 additions & 0 deletions bun.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@
},
"dependencies": {
"@aws-sdk/client-s3": "3.933.0",
"@ff-labs/fff-bun": "0.6.4",
"@opencode-ai/plugin": "workspace:*",
"@opencode-ai/script": "workspace:*",
"@opencode-ai/sdk": "workspace:*",
Expand Down
2 changes: 1 addition & 1 deletion packages/app/src/components/dialog-select-directory.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ function useDirectorySearch(args: {
if (!isPath) {
const results = await find()
if (!active()) return []
return results.map((rel) => joinPath(scopedInput.directory, rel)).slice(0, 50)
return results.map((item) => joinPath(scopedInput.directory, item.path)).slice(0, 50)
}

const segments = query.replace(/^\/+/, "").split("/")
Expand Down
7 changes: 6 additions & 1 deletion packages/app/src/components/prompt-input.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -591,14 +591,19 @@ export const PromptInput: Component<PromptInputProps> = (props) => {
const seen = new Set(open)
const pinned: AtOption[] = open.map((path) => ({ type: "file", path, display: path, recent: true }))
if (!query.trim()) return [...agents, ...pinned]
const paths = await files.searchFilesAndDirectories(query)
const pathy = /[./\\]/.test(query)
const seek = query.replaceAll("\\", "/")
const paths = await files.searchFiles(seek)
const fileOptions: AtOption[] = paths
.filter((path) => !seen.has(path))
.map((path) => ({ type: "file", path, display: path }))
if (pathy) return fileOptions
return [...agents, ...pinned, ...fileOptions]
},
key: atKey,
filterKeys: ["display"],
stale: false,
fuzzy: (query) => !/[./\\]/.test(query),
groupBy: (item) => {
if (item.type === "agent") return "agent"
if (item.recent) return "recent"
Expand Down
2 changes: 1 addition & 1 deletion packages/app/src/context/file.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ export const { use: useFile, provider: FileProvider } = createSimpleContext({

const search = (query: string, dirs: "true" | "false") =>
sdk.client.find.files({ query, dirs }).then(
(x) => (x.data ?? []).map(path.normalize),
(x) => (x.data ?? []).map((item) => path.normalize(item.path)),
() => [],
)

Expand Down
5 changes: 5 additions & 0 deletions packages/core/src/util/log.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@ const keep = 10

let level: Level = "INFO"

/** Exposes internal log level at runtime */
export function currentLevel() {
return level
}

function shouldLog(input: Level): boolean {
return levelPriority[input] >= levelPriority[level]
}
Expand Down
40 changes: 40 additions & 0 deletions packages/opencode/bench-fff.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import { Fff } from "./src/file/fff"
import { Instance } from "./src/project/instance"

const dir = process.cwd()

await Instance.provide({
directory: dir,
fn: async () => {
const t0 = performance.now()
const picker = await Fff.picker(dir)
console.log(`picker create: ${(performance.now() - t0).toFixed(1)}ms`)

// wait for scan to complete so results are populated
const tw = performance.now()
picker.waitForScan(10000)
console.log(`wait for scan: ${(performance.now() - tw).toFixed(1)}ms`)

const t1 = performance.now()
const files = await Fff.files({ cwd: dir, query: "fff" })
console.log(`file search "fff": ${(performance.now() - t1).toFixed(1)}ms (${files.items.length} results)`)

const t2 = performance.now()
const files2 = await Fff.files({ cwd: dir, query: "package.json" })
console.log(`file search "package.json": ${(performance.now() - t2).toFixed(1)}ms (${files2.items.length} results)`)

const t3 = performance.now()
const grep = await Fff.grep({ cwd: dir, query: "FileFinder", mode: "plain" })
console.log(`grep "FileFinder": ${(performance.now() - t3).toFixed(1)}ms (${grep.items.length} matches)`)

const t4 = performance.now()
const grep2 = await Fff.grep({ cwd: dir, query: "import", mode: "plain" })
console.log(`grep "import": ${(performance.now() - t4).toFixed(1)}ms (${grep2.items.length} matches)`)

const t5 = performance.now()
const search = await Fff.search({ cwd: dir, pattern: "FileFinder" })
console.log(`search "FileFinder": ${(performance.now() - t5).toFixed(1)}ms (${search.length} results)`)

await Instance.dispose()
},
})
1 change: 1 addition & 0 deletions packages/opencode/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@
"@clack/prompts": "1.0.0-alpha.1",
"@effect/opentelemetry": "catalog:",
"@effect/platform-node": "catalog:",
"@ff-labs/fff-bun": "0.6.4",
"@gitlab/opencode-gitlab-auth": "1.3.3",
"@hono/node-server": "1.19.11",
"@hono/node-ws": "1.3.0",
Expand Down
4 changes: 2 additions & 2 deletions packages/opencode/src/cli/cmd/debug/file.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { EOL } from "os"
import { AppRuntime } from "@/effect/app-runtime"
import { File } from "../../../file"
import { Ripgrep } from "@/file/ripgrep"
import { Fff } from "@/file/fff"
import { bootstrap } from "../../bootstrap"
import { cmd } from "../cmd"

Expand Down Expand Up @@ -79,7 +79,7 @@ const FileTreeCommand = cmd({
}),
async handler(args) {
await bootstrap(process.cwd(), async () => {
const tree = await AppRuntime.runPromise(Ripgrep.Service.use((svc) => svc.tree({ cwd: args.dir, limit: 200 })))
const tree = await Fff.tree({ cwd: args.dir, limit: 200 })
console.log(JSON.stringify(tree, null, 2))
})
},
Expand Down
4 changes: 2 additions & 2 deletions packages/opencode/src/cli/cmd/debug/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { cmd } from "../cmd"
import { ConfigCommand } from "./config"
import { FileCommand } from "./file"
import { LSPCommand } from "./lsp"
import { RipgrepCommand } from "./ripgrep"
import { SearchCommand } from "./search"
import { ScrapCommand } from "./scrap"
import { SkillCommand } from "./skill"
import { SnapshotCommand } from "./snapshot"
Expand All @@ -18,7 +18,7 @@ export const DebugCommand = cmd({
yargs
.command(ConfigCommand)
.command(LSPCommand)
.command(RipgrepCommand)
.command(SearchCommand)
.command(FileCommand)
.command(ScrapCommand)
.command(SkillCommand)
Expand Down
105 changes: 0 additions & 105 deletions packages/opencode/src/cli/cmd/debug/ripgrep.ts

This file was deleted.

Loading
Loading