From c3e7b8030cce05fff55830940755c5a8c5cd31eb Mon Sep 17 00:00:00 2001 From: Aiden Cline Date: Sat, 31 Jan 2026 20:48:50 -0600 Subject: [PATCH 1/2] fix: ensure the --hidden flag is passed to ripgrep by default so that you can @ folders/files that start with a '.' that aren't git ignored --- packages/opencode/src/file/ripgrep.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/opencode/src/file/ripgrep.ts b/packages/opencode/src/file/ripgrep.ts index dd94cc6097a2..463a9fb362f7 100644 --- a/packages/opencode/src/file/ripgrep.ts +++ b/packages/opencode/src/file/ripgrep.ts @@ -215,7 +215,7 @@ export namespace Ripgrep { const args = [await filepath(), "--files", "--glob=!.git/*"] if (input.follow) args.push("--follow") - if (input.hidden) args.push("--hidden") + if (input.hidden !== false) args.push("--hidden") if (input.maxDepth !== undefined) args.push(`--max-depth=${input.maxDepth}`) if (input.glob) { for (const g of input.glob) { From 5e6e2bb0070b84a093f3fdc38b87b2b03ff8470a Mon Sep 17 00:00:00 2001 From: Aiden Cline Date: Sat, 31 Jan 2026 21:01:39 -0600 Subject: [PATCH 2/2] test: add ripgrep test --- packages/opencode/test/file/ripgrep.test.ts | 39 +++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 packages/opencode/test/file/ripgrep.test.ts diff --git a/packages/opencode/test/file/ripgrep.test.ts b/packages/opencode/test/file/ripgrep.test.ts new file mode 100644 index 000000000000..ac46f1131b09 --- /dev/null +++ b/packages/opencode/test/file/ripgrep.test.ts @@ -0,0 +1,39 @@ +import { describe, expect, test } from "bun:test" +import fs from "fs/promises" +import path from "path" +import { tmpdir } from "../fixture/fixture" +import { Ripgrep } from "../../src/file/ripgrep" + +describe("file.ripgrep", () => { + test("defaults to include hidden", async () => { + await using tmp = await tmpdir({ + init: async (dir) => { + await Bun.write(path.join(dir, "visible.txt"), "hello") + await fs.mkdir(path.join(dir, ".opencode"), { recursive: true }) + await Bun.write(path.join(dir, ".opencode", "thing.json"), "{}") + }, + }) + + const files = await Array.fromAsync(Ripgrep.files({ cwd: tmp.path })) + const hasVisible = files.includes("visible.txt") + const hasHidden = files.includes(path.join(".opencode", "thing.json")) + expect(hasVisible).toBe(true) + expect(hasHidden).toBe(true) + }) + + test("hidden false excludes hidden", async () => { + await using tmp = await tmpdir({ + init: async (dir) => { + await Bun.write(path.join(dir, "visible.txt"), "hello") + await fs.mkdir(path.join(dir, ".opencode"), { recursive: true }) + await Bun.write(path.join(dir, ".opencode", "thing.json"), "{}") + }, + }) + + const files = await Array.fromAsync(Ripgrep.files({ cwd: tmp.path, hidden: false })) + const hasVisible = files.includes("visible.txt") + const hasHidden = files.includes(path.join(".opencode", "thing.json")) + expect(hasVisible).toBe(true) + expect(hasHidden).toBe(false) + }) +})