Skip to content
Merged
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
17 changes: 17 additions & 0 deletions src-tauri/capabilities/default.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,23 @@
},
"dialog:default",
"fs:default",
{
"identifier": "fs:scope",
"allow": [
{ "path": "**/.agent" },
{ "path": "**/.agent/**" },
{ "path": "**/.claude" },
{ "path": "**/.claude/**" },
{ "path": "**/.codex" },
{ "path": "**/.codex/**" },
{ "path": "**/.cursor" },
{ "path": "**/.cursor/**" },
{ "path": "**/.github" },
{ "path": "**/.github/**" },
{ "path": "**/.vscode" },
{ "path": "**/.vscode/**" }
]
},
{
"identifier": "fs:allow-read-text-file",
"allow": [{ "path": "**" }]
Expand Down
20 changes: 17 additions & 3 deletions src/lib/files.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ export function joinPath(parent: string, child: string): string {

export async function listFolder(path: string): Promise<FileEntry[]> {
const entries = await readDir(path);
return entries
.filter((e) => !e.name.startsWith("."))
return (entries || [])
.filter((e) => e?.name && isVisibleTreeEntryName(e.name))
.map((e) => ({
name: e.name,
path: joinPath(path, e.name),
Expand All @@ -86,6 +86,20 @@ export type FlatFileEntry = {
rel: string;
};

/** Modern dev/AI tool folders that start with a dot but are not hidden files. */
const DOT_PREFIX_ALLOWLIST = new Set([
".agent",
".claude",
".codex",
".cursor",
".github",
".vscode",
]);

export function isVisibleTreeEntryName(name: string): boolean {
return !name.startsWith(".") || DOT_PREFIX_ALLOWLIST.has(name);
}

const WALK_SKIP = new Set([
"node_modules",
".git",
Expand Down Expand Up @@ -113,7 +127,7 @@ export async function walkSupportedTextFiles(root: string): Promise<FlatFileEntr
}
for (const e of entries) {
if (out.length >= WALK_MAX_FILES) return;
if (e.name.startsWith(".")) continue;
if (!isVisibleTreeEntryName(e.name)) continue;
if (e.isDirectory && WALK_SKIP.has(e.name)) continue;
const childPath = joinPath(dir, e.name);
const childRel = relPrefix ? `${relPrefix}${sep}${e.name}` : e.name;
Expand Down
19 changes: 19 additions & 0 deletions tests/files.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { expect, test } from "bun:test";
import { isVisibleTreeEntryName } from "../src/lib/files";

test("shows common dot-prefixed tool folders", () => {
for (const name of [".agent", ".claude", ".codex", ".cursor", ".github", ".vscode"]) {
expect(isVisibleTreeEntryName(name)).toBe(true);
}
});

test("keeps noisy hidden entries filtered", () => {
for (const name of [".git", ".DS_Store", ".cache", ".env"]) {
expect(isVisibleTreeEntryName(name)).toBe(false);
}
});

test("shows regular entries", () => {
expect(isVisibleTreeEntryName("notes")).toBe(true);
expect(isVisibleTreeEntryName("readme.md")).toBe(true);
});