Skip to content

fix(config): merge custom toolPaths tool by tool over defaults (#1185) - #1204

Open
legend91019 wants to merge 2 commits into
Tencent:mainfrom
legend91019:fix/issue-1185-toolpaths-merge
Open

legend91019 wants to merge 2 commits into
Tencent:mainfrom
legend91019:fix/issue-1185-toolpaths-merge

Conversation

@legend91019

@legend91019 legend91019 commented Oct 18, 2026 •

Copy link
Copy Markdown

Summary

Extracts DEFAULT_TOOL_PATHS into an exported constant and updates TeamaiConfigBaseSchema.toolPaths to merge user-provided toolPaths tool-by-tool over defaults, preventing partial tool definitions from discarding default configurations for all other built-in tools (such as Claude Code, Cursor, Codex, and CodeBuddy).

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature causing existing behavior to change)
  • Documentation only
  • Refactor / internal cleanup

Test Plan

  • npx tsc --noEmit passes
  • npm run lint passes (oxlint 0 errors, 0 warnings)
  • npx vitest run passes for affected test suites (types.test.ts, tool-roots.test.ts)
  • Added/updated unit tests for the change:
    • Added unit test in src/__tests__/types.test.ts verifying DEFAULT_TOOL_PATHS export and default parse equivalence
    • Added unit test in src/__tests__/types.test.ts verifying tool-by-tool merging preserves unmentioned built-in tools
    • Added unit test in src/__tests__/types.test.ts verifying third-party custom agents can be declared alongside default tools
    • Added unit test in src/__tests__/tool-roots.test.ts verifying sparse declarations override only the named tool while retaining default paths for other tools
  • Real-CLI verification (npm run build -> node dist/index.js):
    • Added end-to-end test in src/__tests__/e2e/toolpaths-sparse-merge-1185.test.ts exercising compiled CLI (dist/index.js) against a local Git bare remote fixture with sparse toolPaths definition (zcode: { skills: '.zcode/skills', rules: '.zcode/rules' }).
    • Verified representative real-CLI run (init --provider git --agent claude,zcode and pull):
      === Real-CLI: teamai init ===
      ℹ Scope: workspace (...)
      ℹ Clone path: .../team-repo
      ✔ Registered as team member: ci
      ✔ Local config saved
      ✔ teamai initialized successfully!
      
      === Real-CLI: teamai pull ===
      ℹ workspace scope detected, skipped user scope
      ✔ [workspace] Synced 1 skills (1 new, 0 updated)
          new: hello-skill
      
      === Verification: delivered file locations ===
      .claude/skills/hello-skill/SKILL.md exists: true
      .zcode/skills/hello-skill/SKILL.md exists: true
      
    • npm run test:e2e -- toolpaths-sparse-merge-1185.test.ts passes:
      ✓ src/__tests__/e2e/toolpaths-sparse-merge-1185.test.ts (2 tests)
        ✓ sparse toolPaths merge over built-in defaults (issue #1185) > delivers skills to default Claude path even when teamai.yaml only declared zcode
        ✓ sparse toolPaths merge over built-in defaults (issue #1185) > also supports custom tool zcode alongside the default tools
      Test Files  1 passed (1)
      

Related Issues

Fixes #1185

Notes for Reviewers

  • In src/types.ts, toolPaths previously relied on .default({...}) on the whole record. Supplying any toolPaths in teamai.yaml bypassed .default(), wiping out all unmentioned tools.
  • We extracted DEFAULT_TOOL_PATHS and used .default({}).transform((custom) => ({ ...DEFAULT_TOOL_PATHS, ...custom })) so that:
    1. An override for a specific tool replaces that tool's entry whole (preserving intentional omission-as-opt-out for that tool's surfaces).
    2. Tools not named by the team retain their built-in defaults (e.g. CodeBuddy keeping its default mcpProject: .mcp.json).

@github-actions

Copy link
Copy Markdown
  • [P1 blocking] Missing real-CLI verification record — PR description, Test Plan. This changes runtime configuration parsing, but the description records only type checking, linting, and unit tests. The first ## Code Review Rules item requires an end-to-end / real-CLI record for runtime changes. Document one representative real-CLI run after npm run build, verifying that a single-tool override preserves other tools’ default paths.

No other confident findings in the specified diff. No PR code was run, built, or installed.

@legend91019

Copy link
Copy Markdown
Author

Resolved in commit 7a7cc4f.

Added a dedicated real-CLI end-to-end test in src/tests/e2e/toolpaths-sparse-merge-1185.test.ts exercising the compiled CLI artifact (dist/index.js) against a local Git bare remote fixture configured with sparse oolPaths (zcode: { skills: '.zcode/skills', rules: '.zcode/rules' }).

Representative real-CLI execution verifies that:

  1. Running eamai init and eamai pull with --agent claude,zcode delivers skills to both .claude/skills/hello-skill/SKILL.md (default built-in path preserved) and .zcode/skills/hello-skill/SKILL.md (custom path honored).
  2. The PR description Test Plan section has been updated with the full real-CLI verification record.

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.

codebuddy: project-scope MCP written to .codebuddy/mcp.json instead of .mcp.json (mcpProject unused)

2 participants