diff --git a/src/agents/skills/refresh.test.ts b/src/agents/skills/refresh.test.ts index 51b86e7f7..30fdfa838 100644 --- a/src/agents/skills/refresh.test.ts +++ b/src/agents/skills/refresh.test.ts @@ -12,7 +12,7 @@ vi.mock("chokidar", () => { }); describe("ensureSkillsWatcher", () => { - it("ignores node_modules, dist, and .git by default", async () => { + it("ignores node_modules, dist, .git, and Python venvs by default", async () => { const mod = await import("./refresh.js"); mod.ensureSkillsWatcher({ workspaceDir: "/tmp/workspace" }); @@ -21,11 +21,35 @@ describe("ensureSkillsWatcher", () => { expect(opts.ignored).toBe(mod.DEFAULT_SKILLS_WATCH_IGNORED); const ignored = mod.DEFAULT_SKILLS_WATCH_IGNORED; + + // Node/JS paths expect(ignored.some((re) => re.test("/tmp/workspace/skills/node_modules/pkg/index.js"))).toBe( true, ); expect(ignored.some((re) => re.test("/tmp/workspace/skills/dist/index.js"))).toBe(true); expect(ignored.some((re) => re.test("/tmp/workspace/skills/.git/config"))).toBe(true); + + // Python virtual environments and caches + expect(ignored.some((re) => re.test("/tmp/workspace/skills/scripts/.venv/bin/python"))).toBe( + true, + ); + expect(ignored.some((re) => re.test("/tmp/workspace/skills/venv/lib/python3.10/site.py"))).toBe( + true, + ); + expect(ignored.some((re) => re.test("/tmp/workspace/skills/__pycache__/module.pyc"))).toBe( + true, + ); + expect(ignored.some((re) => re.test("/tmp/workspace/skills/.mypy_cache/3.10/foo.json"))).toBe( + true, + ); + expect(ignored.some((re) => re.test("/tmp/workspace/skills/.pytest_cache/v/cache"))).toBe(true); + + // Build artifacts and caches + expect(ignored.some((re) => re.test("/tmp/workspace/skills/build/output.js"))).toBe(true); + expect(ignored.some((re) => re.test("/tmp/workspace/skills/.cache/data.json"))).toBe(true); + + // Should NOT ignore normal skill files expect(ignored.some((re) => re.test("/tmp/.hidden/skills/index.md"))).toBe(false); + expect(ignored.some((re) => re.test("/tmp/workspace/skills/my-skill/SKILL.md"))).toBe(false); }); }); diff --git a/src/agents/skills/refresh.ts b/src/agents/skills/refresh.ts index 8f78e0d2b..615c0b728 100644 --- a/src/agents/skills/refresh.ts +++ b/src/agents/skills/refresh.ts @@ -31,6 +31,15 @@ export const DEFAULT_SKILLS_WATCH_IGNORED: RegExp[] = [ /(^|[\\/])\.git([\\/]|$)/, /(^|[\\/])node_modules([\\/]|$)/, /(^|[\\/])dist([\\/]|$)/, + // Python virtual environments and caches + /(^|[\\/])\.venv([\\/]|$)/, + /(^|[\\/])venv([\\/]|$)/, + /(^|[\\/])__pycache__([\\/]|$)/, + /(^|[\\/])\.mypy_cache([\\/]|$)/, + /(^|[\\/])\.pytest_cache([\\/]|$)/, + // Build artifacts and caches + /(^|[\\/])build([\\/]|$)/, + /(^|[\\/])\.cache([\\/]|$)/, ]; function bumpVersion(current: number): number {