Skip to content

fix(agents): resolve built-in agents dir with fileURLToPath for Windows - #324

Merged
jeff-r2026 merged 1 commit into
mainfrom
fix/issue-322-windows-agents-path
Aug 25, 2026
Merged

jeff-r2026 merged 1 commit into
mainfrom
fix/issue-322-windows-agents-path

Conversation

@jeff-r2026

@jeff-r2026 jeff-r2026 commented Aug 25, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Refs #322 (intentionally not auto-closing) — on Windows, teamai pull silently skipped deploying built-in subagents (teamai-recall), so teamai recall enable would inject recall rules into CLAUDE.md pointing at a subagent that never got deployed.

Root cause: getBuiltinAgentsDir() used new URL(import.meta.url).pathname, which on Windows produces a leading-slash path like /C:/.../dist that fs cannot resolve. pathExists(builtinDir) then returned false, and deployBuiltinAgents() took the "dev environment without build step" early return.

Skills were unaffected because the sibling getBuiltinSkillsDir() in src/builtin-skills.ts already uses fileURLToPath. This PR makes builtin-agents.ts consistent with it.

Change

-  const distDir = path.dirname(new URL(import.meta.url).pathname);
+  const distDir = path.dirname(fileURLToPath(import.meta.url));

Plus the import { fileURLToPath } from 'node:url' import.

Test Plan

  • npx tsc --noEmit — passes
  • npx vitest run — full suite, 2187 tests pass (163 files)
  • npx vitest run src/__tests__/builtin-agents.test.ts — 5/5 pass; the deploys built-in agent files to every installed tool case actually deploys teamai-recall.md to .claude/agents/ and .codebuddy/agents/ and asserts the files land
  • npm run build — passes; verified the compiled dist/index.js emits path.dirname(fileURLToPath(import.meta.url)) and that ../agents/teamai-recall.md resolves from the dist/ layout

Note: the platform-specific fileURLToPath divergence can't be reproduced on macOS (the function is platform-aware), but the fix is byte-for-byte the pattern that already works for skills on Windows per the issue report.

getBuiltinAgentsDir() used new URL(import.meta.url).pathname, which on
Windows yields a leading-slash path like /C:/.../dist that fs cannot
resolve. pathExists(builtinDir) then returned false and
deployBuiltinAgents() took the dev-environment early return, so the
teamai-recall subagent was never deployed on Windows (skills worked
because builtin-skills.ts already used fileURLToPath).

Mirror builtin-skills.ts by using path.dirname(fileURLToPath(import.meta.url)).

Refs #322
@jeff-r2026
jeff-r2026 force-pushed the fix/issue-322-windows-agents-path branch from 1dde35d to 34689af Compare August 25, 2026 09:41
@jeff-r2026
jeff-r2026 merged commit 8f5cd94 into main Aug 25, 2026
7 checks passed
@jeff-r2026
jeff-r2026 deleted the fix/issue-322-windows-agents-path branch August 26, 2026 06:59
Walternater pushed a commit to Walternater/teamai-cli that referenced this pull request Nov 2, 2026
…ws (Tencent#324)

getBuiltinAgentsDir() used new URL(import.meta.url).pathname, which on
Windows yields a leading-slash path like /C:/.../dist that fs cannot
resolve. pathExists(builtinDir) then returned false and
deployBuiltinAgents() took the dev-environment early return, so the
teamai-recall subagent was never deployed on Windows (skills worked
because builtin-skills.ts already used fileURLToPath).

Mirror builtin-skills.ts by using path.dirname(fileURLToPath(import.meta.url)).

Refs Tencent#322
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant