@tencent-ai/agent-sdk 0.3.99 → 0.3.100
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cli/CHANGELOG.md +26 -0
- package/cli/dist/codebuddy-headless.js +53 -53
- package/cli/dist/web-ui/assets/index-BoMlEqUE.js +439 -0
- package/cli/dist/web-ui/assets/index-Dt1puyHn.css +32 -0
- package/cli/dist/web-ui/docs/cn/cli/acp.md +152 -0
- package/cli/dist/web-ui/docs/cn/cli/agent-teams.md +327 -0
- package/cli/dist/web-ui/docs/cn/cli/bash-sandboxing.md +290 -0
- package/cli/dist/web-ui/docs/cn/cli/best-practices.md +554 -0
- package/cli/dist/web-ui/docs/cn/cli/channels-reference.md +293 -0
- package/cli/dist/web-ui/docs/cn/cli/channels.md +215 -0
- package/cli/dist/web-ui/docs/cn/cli/checkpointing.md +51 -0
- package/cli/dist/web-ui/docs/cn/cli/cli-reference.md +187 -0
- package/cli/dist/web-ui/docs/cn/cli/common-workflows.md +1013 -0
- package/cli/dist/web-ui/docs/cn/cli/costs.md +174 -0
- package/cli/dist/web-ui/docs/cn/cli/devcontainer.md +553 -0
- package/cli/dist/web-ui/docs/cn/cli/env-vars.md +326 -0
- package/cli/dist/web-ui/docs/cn/cli/gitlab-ci-cd.md +357 -0
- package/cli/dist/web-ui/docs/cn/cli/headless.md +258 -0
- package/cli/dist/web-ui/docs/cn/cli/hooks-guide.md +9 -0
- package/cli/dist/web-ui/docs/cn/cli/hooks.md +805 -0
- package/cli/dist/web-ui/docs/cn/cli/iam.md +530 -0
- package/cli/dist/web-ui/docs/cn/cli/ide-integrations.md +92 -0
- package/cli/dist/web-ui/docs/cn/cli/installation.md +291 -0
- package/cli/dist/web-ui/docs/cn/cli/interactive-mode.md +233 -0
- package/cli/dist/web-ui/docs/cn/cli/mcp.md +739 -0
- package/cli/dist/web-ui/docs/cn/cli/memory.md +436 -0
- package/cli/dist/web-ui/docs/cn/cli/models.md +356 -0
- package/cli/dist/web-ui/docs/cn/cli/overview.md +100 -0
- package/cli/dist/web-ui/docs/cn/cli/plugin-marketplaces.md +533 -0
- package/cli/dist/web-ui/docs/cn/cli/plugins-reference.md +774 -0
- package/cli/dist/web-ui/docs/cn/cli/plugins.md +689 -0
- package/cli/dist/web-ui/docs/cn/cli/quickstart.md +249 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/README.md +199 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.10.0.md +23 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.10.1.md +5 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.11.0.md +24 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.12.0.md +21 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.13.0.md +20 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.14.0.md +22 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.14.1.md +8 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.15.0.md +18 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.15.1.md +11 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.16.0.md +20 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.17.0.md +29 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.18.0.md +17 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.19.0.md +11 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.19.1.md +14 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.19.2.md +11 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.20.0.md +23 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.20.1.md +15 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.21.0.md +13 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.22.0.md +16 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.23.0.md +20 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.23.2.md +5 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.23.3.md +5 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.23.4.md +15 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.23.5.md +11 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.24.0.md +17 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.25.0.md +18 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.25.1.md +21 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.26.0.md +18 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.27.0.md +16 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.27.1.md +16 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.27.2.md +7 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.27.3.md +15 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.28.0.md +26 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.28.1.md +5 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.29.0.md +35 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.3.1.md +16 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.30.0.md +19 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.30.1.md +5 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.31.0.md +51 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.31.1.md +11 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.31.2.md +16 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.32.0.md +19 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.33.0.md +28 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.33.1.md +7 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.36.3.md +17 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.37.0.md +15 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.37.1.md +15 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.37.10.md +5 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.37.11.md +8 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.37.12.md +14 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.37.13.md +11 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.37.14.md +24 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.37.15.md +11 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.37.16.md +9 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.37.17.md +5 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.37.18.md +9 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.37.19.md +5 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.37.2.md +28 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.37.20.md +8 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.37.3.md +22 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.37.4.md +19 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.37.5.md +5 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.37.6.md +5 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.37.7.md +5 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.37.8.md +5 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.37.9.md +8 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.38.0.md +22 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.38.1.md +6 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.38.2.md +9 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.39.0.md +18 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.4.0.md +19 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.40.0.md +20 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.40.1.md +6 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.41.0.md +15 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.41.1.md +6 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.41.2.md +5 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.41.3.md +8 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.41.4.md +5 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.41.5.md +10 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.41.6.md +9 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.41.7.md +14 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.41.8.md +18 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.42.0.md +39 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.42.1.md +8 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.42.3.md +18 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.43.0.md +27 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.43.1.md +27 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.44.0.md +11 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.44.1.md +22 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.45.0.md +34 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.45.1.md +7 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.46.0.md +12 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.47.0.md +20 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.48.0.md +32 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.48.1.md +11 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.49.0.md +26 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.49.1.md +14 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.49.2.md +39 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.49.3.md +7 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.49.5.md +11 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.49.6.md +9 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.49.7.md +7 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.5.0.md +24 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.50.0.md +25 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.50.1.md +9 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.50.2.md +11 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.50.3.md +5 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.50.4.md +17 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.50.5.md +16 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.50.6.md +15 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.50.7.md +15 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.51.0.md +24 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.51.1.md +17 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.51.2.md +5 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.52.0.md +30 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.52.1.md +28 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.52.2.md +12 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.52.3.md +13 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.52.4.md +27 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.52.5.md +21 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.52.6.md +7 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.53.0.md +29 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.54.0.md +26 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.55.0.md +21 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.55.1.md +13 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.56.0.md +20 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.56.1.md +5 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.57.0.md +32 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.57.1.md +10 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.58.0.md +34 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.59.0.md +28 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.6.0.md +5 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.6.1.md +10 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.60.0.md +20 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.61.0.md +29 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.61.1.md +5 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.61.2.md +6 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.61.3.md +13 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.62.0.md +21 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.62.1.md +11 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.63.0.md +19 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.63.1.md +5 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.63.2.md +7 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.63.3.md +6 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.63.4.md +8 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.63.5.md +6 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.64.0.md +37 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.64.1.md +6 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.64.2.md +11 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.65.0.md +19 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.65.1.md +11 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.66.0.md +15 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.66.1.md +14 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.66.2.md +5 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.67.0.md +33 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.7.0.md +16 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.8.0.md +18 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.8.1.md +17 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.8.2.md +5 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.8.3.md +14 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.8.4.md +9 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.8.5.md +5 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.8.6.md +14 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.9.0.md +5 -0
- package/cli/dist/web-ui/docs/cn/cli/remote-control.md +247 -0
- package/cli/dist/web-ui/docs/cn/cli/sandboxing.md +316 -0
- package/cli/dist/web-ui/docs/cn/cli/scheduled-tasks.md +161 -0
- package/cli/dist/web-ui/docs/cn/cli/sdk-custom-tools.md +1195 -0
- package/cli/dist/web-ui/docs/cn/cli/sdk-demos.md +347 -0
- package/cli/dist/web-ui/docs/cn/cli/sdk-hooks.md +803 -0
- package/cli/dist/web-ui/docs/cn/cli/sdk-mcp.md +643 -0
- package/cli/dist/web-ui/docs/cn/cli/sdk-permissions.md +501 -0
- package/cli/dist/web-ui/docs/cn/cli/sdk-python.md +783 -0
- package/cli/dist/web-ui/docs/cn/cli/sdk-sessions.md +332 -0
- package/cli/dist/web-ui/docs/cn/cli/sdk-typescript.md +759 -0
- package/cli/dist/web-ui/docs/cn/cli/sdk.md +1105 -0
- package/cli/dist/web-ui/docs/cn/cli/security.md +387 -0
- package/cli/dist/web-ui/docs/cn/cli/settings.md +602 -0
- package/cli/dist/web-ui/docs/cn/cli/skills.md +448 -0
- package/cli/dist/web-ui/docs/cn/cli/slash-commands.md +397 -0
- package/cli/dist/web-ui/docs/cn/cli/statusline.md +525 -0
- package/cli/dist/web-ui/docs/cn/cli/sub-agents.md +634 -0
- package/cli/dist/web-ui/docs/cn/cli/terminal-config.md +77 -0
- package/cli/dist/web-ui/docs/cn/cli/tools-reference.md +99 -0
- package/cli/dist/web-ui/docs/cn/cli/troubleshooting.md +190 -0
- package/cli/dist/web-ui/docs/cn/cli/web-ui.md +164 -0
- package/cli/dist/web-ui/docs/cn/cli/wecom-bot-setup.md +274 -0
- package/cli/dist/web-ui/docs/cn/cli/worktree.md +660 -0
- package/cli/dist/web-ui/docs/en/cli/acp.md +126 -0
- package/cli/dist/web-ui/docs/en/cli/agent-teams.md +327 -0
- package/cli/dist/web-ui/docs/en/cli/bash-sandboxing.md +357 -0
- package/cli/dist/web-ui/docs/en/cli/best-practices.md +554 -0
- package/cli/dist/web-ui/docs/en/cli/channels-reference.md +293 -0
- package/cli/dist/web-ui/docs/en/cli/channels.md +215 -0
- package/cli/dist/web-ui/docs/en/cli/checkpointing.md +53 -0
- package/cli/dist/web-ui/docs/en/cli/cli-reference.md +187 -0
- package/cli/dist/web-ui/docs/en/cli/common-workflows.md +1011 -0
- package/cli/dist/web-ui/docs/en/cli/costs.md +174 -0
- package/cli/dist/web-ui/docs/en/cli/devcontainer.md +553 -0
- package/cli/dist/web-ui/docs/en/cli/env-vars.md +326 -0
- package/cli/dist/web-ui/docs/en/cli/gitlab-ci-cd.md +357 -0
- package/cli/dist/web-ui/docs/en/cli/headless.md +258 -0
- package/cli/dist/web-ui/docs/en/cli/hooks-guide.md +9 -0
- package/cli/dist/web-ui/docs/en/cli/hooks.md +801 -0
- package/cli/dist/web-ui/docs/en/cli/iam.md +526 -0
- package/cli/dist/web-ui/docs/en/cli/ide-integrations.md +92 -0
- package/cli/dist/web-ui/docs/en/cli/installation.md +266 -0
- package/cli/dist/web-ui/docs/en/cli/interactive-mode.md +233 -0
- package/cli/dist/web-ui/docs/en/cli/mcp.md +739 -0
- package/cli/dist/web-ui/docs/en/cli/memory.md +436 -0
- package/cli/dist/web-ui/docs/en/cli/models.md +355 -0
- package/cli/dist/web-ui/docs/en/cli/overview.md +100 -0
- package/cli/dist/web-ui/docs/en/cli/plugin-marketplaces.md +534 -0
- package/cli/dist/web-ui/docs/en/cli/plugins-reference.md +774 -0
- package/cli/dist/web-ui/docs/en/cli/plugins.md +688 -0
- package/cli/dist/web-ui/docs/en/cli/quickstart.md +249 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/README.md +193 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.10.0.md +23 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.10.1.md +5 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.11.0.md +24 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.12.0.md +21 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.13.0.md +20 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.14.0.md +22 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.14.1.md +8 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.15.0.md +18 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.15.1.md +11 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.16.0.md +20 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.17.0.md +29 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.18.0.md +17 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.19.0.md +11 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.19.1.md +14 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.19.2.md +11 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.20.0.md +23 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.20.1.md +15 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.21.0.md +13 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.22.0.md +16 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.23.0.md +41 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.23.2.md +5 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.23.3.md +5 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.23.4.md +15 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.23.5.md +11 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.24.0.md +17 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.25.0.md +18 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.25.1.md +21 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.26.0.md +18 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.27.0.md +16 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.27.1.md +16 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.27.2.md +7 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.27.3.md +15 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.28.0.md +26 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.28.1.md +5 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.29.0.md +35 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.3.1.md +16 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.30.0.md +19 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.30.1.md +5 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.31.0.md +51 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.31.1.md +11 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.31.2.md +16 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.32.0.md +19 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.33.0.md +28 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.33.1.md +7 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.34.0.md +27 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.34.1.md +7 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.35.0.md +22 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.36.0.md +23 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.36.1.md +5 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.36.2.md +22 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.36.3.md +17 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.37.0.md +15 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.37.1.md +15 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.37.10.md +5 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.37.11.md +8 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.37.12.md +14 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.37.13.md +11 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.37.14.md +24 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.37.15.md +11 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.37.16.md +9 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.37.17.md +5 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.37.18.md +9 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.37.19.md +5 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.37.2.md +28 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.37.20.md +8 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.37.3.md +22 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.37.4.md +19 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.37.5.md +5 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.37.6.md +5 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.37.7.md +5 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.37.8.md +5 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.37.9.md +8 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.38.0.md +22 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.38.1.md +6 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.38.2.md +9 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.39.0.md +18 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.4.0.md +19 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.40.0.md +20 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.40.1.md +6 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.41.0.md +15 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.41.1.md +6 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.41.2.md +5 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.41.3.md +8 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.41.4.md +5 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.41.5.md +10 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.41.6.md +9 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.41.7.md +14 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.41.8.md +18 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.42.0.md +39 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.42.1.md +8 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.42.3.md +18 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.43.0.md +27 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.43.1.md +27 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.44.0.md +11 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.44.1.md +22 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.45.0.md +34 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.45.1.md +7 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.46.0.md +12 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.47.0.md +20 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.48.0.md +32 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.48.1.md +11 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.49.0.md +26 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.49.1.md +14 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.49.2.md +39 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.49.3.md +7 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.49.5.md +11 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.49.6.md +9 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.49.7.md +7 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.5.0.md +24 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.50.0.md +25 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.50.1.md +9 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.50.2.md +11 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.50.3.md +5 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.50.4.md +17 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.50.5.md +16 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.50.6.md +15 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.50.7.md +15 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.51.0.md +24 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.51.1.md +17 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.51.2.md +5 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.52.0.md +30 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.52.1.md +28 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.52.2.md +12 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.52.3.md +13 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.52.4.md +27 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.52.5.md +21 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.52.6.md +7 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.53.0.md +29 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.54.0.md +26 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.55.0.md +21 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.55.1.md +13 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.56.0.md +20 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.56.1.md +5 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.57.0.md +32 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.57.1.md +10 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.58.0.md +34 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.59.0.md +28 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.6.0.md +5 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.6.1.md +10 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.60.0.md +20 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.61.0.md +29 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.61.1.md +5 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.61.2.md +6 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.61.3.md +13 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.62.0.md +21 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.62.1.md +11 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.63.0.md +19 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.63.1.md +5 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.63.2.md +7 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.63.3.md +6 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.63.4.md +8 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.63.5.md +6 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.64.0.md +37 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.64.1.md +6 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.64.2.md +11 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.65.0.md +19 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.65.1.md +11 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.66.0.md +15 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.66.1.md +14 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.66.2.md +5 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.67.0.md +33 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.7.0.md +16 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.8.0.md +18 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.8.1.md +17 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.8.2.md +5 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.8.3.md +14 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.8.4.md +9 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.8.5.md +5 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.8.6.md +14 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.9.0.md +5 -0
- package/cli/dist/web-ui/docs/en/cli/remote-control.md +247 -0
- package/cli/dist/web-ui/docs/en/cli/sandboxing.md +316 -0
- package/cli/dist/web-ui/docs/en/cli/scheduled-tasks.md +160 -0
- package/cli/dist/web-ui/docs/en/cli/sdk-custom-tools.md +1131 -0
- package/cli/dist/web-ui/docs/en/cli/sdk-demos.md +347 -0
- package/cli/dist/web-ui/docs/en/cli/sdk-hooks.md +813 -0
- package/cli/dist/web-ui/docs/en/cli/sdk-mcp.md +645 -0
- package/cli/dist/web-ui/docs/en/cli/sdk-permissions.md +461 -0
- package/cli/dist/web-ui/docs/en/cli/sdk-python.md +797 -0
- package/cli/dist/web-ui/docs/en/cli/sdk-sessions.md +340 -0
- package/cli/dist/web-ui/docs/en/cli/sdk-typescript.md +770 -0
- package/cli/dist/web-ui/docs/en/cli/sdk.md +1103 -0
- package/cli/dist/web-ui/docs/en/cli/security.md +388 -0
- package/cli/dist/web-ui/docs/en/cli/settings.md +602 -0
- package/cli/dist/web-ui/docs/en/cli/skills.md +448 -0
- package/cli/dist/web-ui/docs/en/cli/slash-commands.md +397 -0
- package/cli/dist/web-ui/docs/en/cli/statusline.md +525 -0
- package/cli/dist/web-ui/docs/en/cli/sub-agents.md +621 -0
- package/cli/dist/web-ui/docs/en/cli/terminal-config.md +77 -0
- package/cli/dist/web-ui/docs/en/cli/tools-reference.md +99 -0
- package/cli/dist/web-ui/docs/en/cli/troubleshooting.md +190 -0
- package/cli/dist/web-ui/docs/en/cli/web-ui.md +164 -0
- package/cli/dist/web-ui/docs/en/cli/wecom-bot-setup.md +274 -0
- package/cli/dist/web-ui/docs/en/cli/worktree.md +660 -0
- package/cli/dist/web-ui/docs/search-index-en.json +1 -0
- package/cli/dist/web-ui/docs/search-index-zh.json +1 -0
- package/cli/dist/web-ui/docs/sidebar-en.json +1 -0
- package/cli/dist/web-ui/docs/sidebar-zh.json +1 -0
- package/cli/dist/web-ui/index.html +2 -2
- package/cli/package.json +1 -1
- package/cli/product.cloudhosted.json +2 -2
- package/cli/product.internal.json +2 -2
- package/cli/product.ioa.json +2 -2
- package/cli/product.json +3 -3
- package/cli/product.selfhosted.json +2 -2
- package/package.json +1 -1
- package/cli/dist/web-ui/assets/index-BPT-qRRx.js +0 -411
- package/cli/dist/web-ui/assets/index-f_ibHSHw.css +0 -32
|
@@ -0,0 +1,660 @@
|
|
|
1
|
+
# Git Worktree 支持
|
|
2
|
+
|
|
3
|
+
> 在独立工作区中运行 CodeBuddy,实现并行开发和安全隔离。
|
|
4
|
+
|
|
5
|
+
## 概述
|
|
6
|
+
|
|
7
|
+
Git worktree 允许在同一仓库中同时拥有多个工作目录,每个目录可以检出不同的分支。CodeBuddy Code 利用这一特性提供:
|
|
8
|
+
|
|
9
|
+
- **并行开发**:在不影响主工作区的情况下进行实验性开发
|
|
10
|
+
- **安全隔离**:AI 的所有更改都在独立目录中进行
|
|
11
|
+
- **零存储开销**:worktree 共享 Git 对象,不会复制整个仓库
|
|
12
|
+
- **子代理隔离**:支持多个 AI 子代理在独立 worktree 中并行工作
|
|
13
|
+
- **tmux 集成**:可选在独立的 tmux 会话中运行
|
|
14
|
+
- **非 Git 支持**:通过 WorktreeCreate/WorktreeRemove hooks,SVN、Perforce 等项目也能使用 worktree 隔离
|
|
15
|
+
|
|
16
|
+
## 快速开始
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
# 自动生成名称创建 worktree
|
|
20
|
+
codebuddy --worktree
|
|
21
|
+
|
|
22
|
+
# 指定名称创建 worktree
|
|
23
|
+
codebuddy --worktree feature-auth
|
|
24
|
+
|
|
25
|
+
# 指定基础分支创建 worktree
|
|
26
|
+
codebuddy --worktree --worktree-branch origin/develop # 基于远程 develop 分支
|
|
27
|
+
codebuddy --worktree --worktree-branch feature/foo # 基于本地 feature/foo 分支
|
|
28
|
+
|
|
29
|
+
# 在 tmux 会话中运行(推荐用于长时间任务)
|
|
30
|
+
codebuddy --worktree --tmux
|
|
31
|
+
|
|
32
|
+
# 基于 PR/MR 创建 worktree(用于代码审查)
|
|
33
|
+
codebuddy --worktree "#123" # GitHub PR 编号
|
|
34
|
+
codebuddy --worktree "https://github.com/owner/repo/pull/123" # GitHub PR 链接
|
|
35
|
+
codebuddy --worktree "https://gitlab.com/owner/repo/-/merge_requests/456" # GitLab MR 链接
|
|
36
|
+
codebuddy --worktree "https://cnb.woa.com/owner/repo/-/pulls/789" # CNB PR 链接
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
### 在会话中创建
|
|
40
|
+
|
|
41
|
+
已启动 CodeBuddy Code 会话后,可以通过自然语言请求创建 worktree:
|
|
42
|
+
|
|
43
|
+
```
|
|
44
|
+
> start a worktree
|
|
45
|
+
> work in a worktree
|
|
46
|
+
> 启动 worktree
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
AI 会自动调用 `EnterWorktree` 工具创建隔离工作目录并切换过去。
|
|
50
|
+
|
|
51
|
+
> **注意**:只有明确提到 "worktree" 时才会触发,说 "帮我开一个分支" 或 "修复这个 bug" 不会自动创建 worktree。
|
|
52
|
+
|
|
53
|
+
## CLI 参数
|
|
54
|
+
|
|
55
|
+
| 参数 | 说明 | 示例 |
|
|
56
|
+
|:-----|:-----|:-----|
|
|
57
|
+
| `--worktree [name]` | 创建并进入 worktree | `--worktree` 或 `--worktree my-feature` |
|
|
58
|
+
| `--worktree-branch <branch>` | 指定基础分支(需配合 `--worktree`) | `--worktree-branch origin/develop` 或 `--worktree-branch feature/foo` |
|
|
59
|
+
| `--tmux` | 在 tmux 会话中运行(需要安装 tmux) | `--worktree --tmux` |
|
|
60
|
+
| `--tmux-classic` | 使用传统 tmux 模式(不使用 popup) | `--worktree --tmux --tmux-classic` |
|
|
61
|
+
|
|
62
|
+
## 工作流程
|
|
63
|
+
|
|
64
|
+
### 创建 Worktree
|
|
65
|
+
|
|
66
|
+
当使用 `--worktree` 参数启动时:
|
|
67
|
+
|
|
68
|
+
1. CodeBuddy 在 `.codebuddy/worktrees/` 目录下创建新的 worktree
|
|
69
|
+
2. 确定基础分支:
|
|
70
|
+
- 如果指定了 `--worktree-branch origin/xxx`,基于远程分支 `origin/xxx`
|
|
71
|
+
- 如果指定了 `--worktree-branch xxx`,基于本地分支 `xxx`
|
|
72
|
+
- 如果未指定,默认基于远程默认分支(通常是 `origin/main` 或 `origin/master`)
|
|
73
|
+
3. 自动创建对应的分支(如 `worktree-feature-auth`)
|
|
74
|
+
4. 将工作目录切换到 worktree
|
|
75
|
+
5. 执行初始化(复制设置、创建符号链接、复制 `.worktreeinclude` 文件等)
|
|
76
|
+
|
|
77
|
+
**分支不存在时的行为**:
|
|
78
|
+
- 如果指定的分支(远程或本地)不存在,会打印警告并自动降级到远程默认分支继续创建
|
|
79
|
+
- 不会中断启动流程
|
|
80
|
+
|
|
81
|
+
### 退出时的选择
|
|
82
|
+
|
|
83
|
+
当你退出 worktree 会话时,CodeBuddy 会检测变更并提供选项:
|
|
84
|
+
|
|
85
|
+
- **保留 Worktree**:保留所有更改和分支,可以稍后继续
|
|
86
|
+
- **删除 Worktree**:清理 worktree 和关联分支
|
|
87
|
+
- **保留但退出 tmux**:(tmux 模式)保留 worktree 但关闭 tmux 会话
|
|
88
|
+
|
|
89
|
+
### 变更检测
|
|
90
|
+
|
|
91
|
+
退出前,CodeBuddy 会检测:
|
|
92
|
+
|
|
93
|
+
- 未提交的文件变更
|
|
94
|
+
- 未推送的提交
|
|
95
|
+
|
|
96
|
+
如果没有任何变更,worktree 会自动清理。
|
|
97
|
+
|
|
98
|
+
## 配置
|
|
99
|
+
|
|
100
|
+
在 `settings.json` 中配置 worktree 行为:
|
|
101
|
+
|
|
102
|
+
```json
|
|
103
|
+
{
|
|
104
|
+
"worktree": {
|
|
105
|
+
"symlinkDirectories": ["node_modules", ".next", ".cache", "dist"]
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
### 配置项
|
|
111
|
+
|
|
112
|
+
| 配置项 | 说明 | 默认值 |
|
|
113
|
+
|:-------|:-----|:-------|
|
|
114
|
+
| `symlinkDirectories` | 从主仓库符号链接到 worktree 的目录 | `[]` |
|
|
115
|
+
|
|
116
|
+
符号链接目录可以避免在每个 worktree 中重复安装依赖,节省时间和磁盘空间。
|
|
117
|
+
|
|
118
|
+
### 同步本地忽略文件(.worktreeinclude)
|
|
119
|
+
|
|
120
|
+
`.env.local`、`.env.development` 等本地配置文件通常被 `.gitignore` 排除,但新 worktree 中同样需要它们才能正常运行。
|
|
121
|
+
|
|
122
|
+
**解决方式**:在仓库根目录创建 `.worktreeinclude` 文件,列出需要复制的文件(语法与 `.gitignore` 相同):
|
|
123
|
+
|
|
124
|
+
```gitignore
|
|
125
|
+
# .worktreeinclude
|
|
126
|
+
# 列出需要复制到新 worktree 的本地文件
|
|
127
|
+
|
|
128
|
+
# 环境变量
|
|
129
|
+
.env.local
|
|
130
|
+
.env.development.local
|
|
131
|
+
.env.test.local
|
|
132
|
+
|
|
133
|
+
# 本地 IDE 配置
|
|
134
|
+
.vscode/settings.json
|
|
135
|
+
|
|
136
|
+
# 本地证书或密钥(如有)
|
|
137
|
+
certs/localhost.pem
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
每次创建新 worktree 时,这些文件会自动从主仓库根目录复制过去。**复用已有 worktree 时不会重新复制**。
|
|
141
|
+
|
|
142
|
+
> **提示**:`.worktreeinclude` 应该提交到 Git,这样团队成员都能受益。
|
|
143
|
+
|
|
144
|
+
## Hook-based Worktree
|
|
145
|
+
|
|
146
|
+
默认情况下,worktree 功能依赖 Git 内置的 `git worktree` 命令。对于使用 SVN、Perforce 或没有版本控制的项目,可以通过配置 **WorktreeCreate / WorktreeRemove hooks** 来使用 worktree 隔离功能。
|
|
147
|
+
|
|
148
|
+
### 决策优先级
|
|
149
|
+
|
|
150
|
+
```
|
|
151
|
+
1. 配置了 WorktreeCreate hook? → 使用 hook 创建(即使在 Git 仓库中也优先使用 hook)
|
|
152
|
+
2. 在 Git 仓库中? → 使用 git worktree
|
|
153
|
+
3. 都不满足? → 报错并提示配置 hook
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
**核心规则**:
|
|
157
|
+
- **Hook 优先于 Git**:配置了 WorktreeCreate hook 后,即使在 Git 仓库中也走 hook,不走 `git worktree`
|
|
158
|
+
- **创建失败不降级**:WorktreeCreate hook 失败时不会回退到 git worktree,直接报错
|
|
159
|
+
- **删除失败不阻塞**:WorktreeRemove hook 失败只记录警告,不阻止退出流程
|
|
160
|
+
|
|
161
|
+
### 配置方式
|
|
162
|
+
|
|
163
|
+
在 `.codebuddy/settings.json`(项目级)或 `~/.codebuddy/settings.json`(全局)中配置:
|
|
164
|
+
|
|
165
|
+
```json
|
|
166
|
+
{
|
|
167
|
+
"hooks": {
|
|
168
|
+
"WorktreeCreate": [
|
|
169
|
+
{
|
|
170
|
+
"hooks": [
|
|
171
|
+
{
|
|
172
|
+
"type": "command",
|
|
173
|
+
"command": "bash ~/.codebuddy/hooks/worktree-create.sh"
|
|
174
|
+
}
|
|
175
|
+
]
|
|
176
|
+
}
|
|
177
|
+
],
|
|
178
|
+
"WorktreeRemove": [
|
|
179
|
+
{
|
|
180
|
+
"hooks": [
|
|
181
|
+
{
|
|
182
|
+
"type": "command",
|
|
183
|
+
"command": "bash ~/.codebuddy/hooks/worktree-remove.sh"
|
|
184
|
+
}
|
|
185
|
+
]
|
|
186
|
+
}
|
|
187
|
+
]
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
两个 hook 独立配置——可以只配 WorktreeCreate 不配 WorktreeRemove(此时退出时不会自动清理,会提示手动删除目录)。
|
|
193
|
+
|
|
194
|
+
### 输入数据(stdin)
|
|
195
|
+
|
|
196
|
+
Hook 脚本通过 **stdin** 接收 JSON 格式的上下文数据。
|
|
197
|
+
|
|
198
|
+
**WorktreeCreate 输入**:
|
|
199
|
+
|
|
200
|
+
```json
|
|
201
|
+
{
|
|
202
|
+
"hook_event_name": "WorktreeCreate",
|
|
203
|
+
"session_id": "abc123def456",
|
|
204
|
+
"cwd": "/Users/user/project",
|
|
205
|
+
"transcript_path": "/Users/user/.codebuddy/sessions/abc123/transcript.md",
|
|
206
|
+
"name": "feature-auth"
|
|
207
|
+
}
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
| 字段 | 说明 |
|
|
211
|
+
|:-----|:-----|
|
|
212
|
+
| `name` | worktree 名称(用户指定或系统自动生成) |
|
|
213
|
+
| `cwd` | 当前工作目录 |
|
|
214
|
+
| `session_id` | 当前会话 ID |
|
|
215
|
+
| `transcript_path` | 对话记录文件路径 |
|
|
216
|
+
|
|
217
|
+
**WorktreeRemove 输入**:
|
|
218
|
+
|
|
219
|
+
```json
|
|
220
|
+
{
|
|
221
|
+
"hook_event_name": "WorktreeRemove",
|
|
222
|
+
"session_id": "abc123def456",
|
|
223
|
+
"cwd": "/Users/user/project",
|
|
224
|
+
"transcript_path": "/Users/user/.codebuddy/sessions/abc123/transcript.md",
|
|
225
|
+
"worktree_path": "/tmp/codebuddy-worktrees/feature-auth"
|
|
226
|
+
}
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
| 字段 | 说明 |
|
|
230
|
+
|:-----|:-----|
|
|
231
|
+
| `worktree_path` | 要删除的 worktree 绝对路径 |
|
|
232
|
+
|
|
233
|
+
### 输出与 Exit Code
|
|
234
|
+
|
|
235
|
+
**WorktreeCreate**:
|
|
236
|
+
|
|
237
|
+
- **stdout**:必须输出创建好的 worktree **绝对路径**(取最后一行非空行)
|
|
238
|
+
- **stderr**:可输出日志,不影响路径解析
|
|
239
|
+
- **exit code 0**:成功,解析 stdout 中的路径
|
|
240
|
+
- **exit code 非 0**:创建失败,报错并退出(不降级到 git worktree)
|
|
241
|
+
|
|
242
|
+
```bash
|
|
243
|
+
# 正确示例:日志输出到 stderr,路径输出到 stdout
|
|
244
|
+
echo "Initializing SVN checkout..." >&2
|
|
245
|
+
echo "/home/user/.codebuddy/worktrees/feature-auth"
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
**WorktreeRemove**:
|
|
249
|
+
|
|
250
|
+
- 没有决定控制:任何 exit code 都不会阻止退出流程
|
|
251
|
+
- 失败仅记录警告日志
|
|
252
|
+
|
|
253
|
+
### 退出行为差异
|
|
254
|
+
|
|
255
|
+
与 Git worktree 不同,hook-based worktree 退出时**始终显示 keep/remove 菜单**,不做变更检测(因为非 Git 项目没有 `git status`)。
|
|
256
|
+
|
|
257
|
+
### Hook 脚本模板
|
|
258
|
+
|
|
259
|
+
**WorktreeCreate** (`~/.codebuddy/hooks/worktree-create.sh`):
|
|
260
|
+
|
|
261
|
+
```bash
|
|
262
|
+
#!/bin/bash
|
|
263
|
+
set -e
|
|
264
|
+
|
|
265
|
+
INPUT=$(cat)
|
|
266
|
+
NAME=$(echo "$INPUT" | jq -r '.name')
|
|
267
|
+
CWD=$(echo "$INPUT" | jq -r '.cwd')
|
|
268
|
+
|
|
269
|
+
WORKTREE_PATH="$HOME/.codebuddy/worktrees/$NAME"
|
|
270
|
+
mkdir -p "$WORKTREE_PATH"
|
|
271
|
+
|
|
272
|
+
# 在这里添加 VCS 初始化逻辑(SVN checkout、P4 sync、目录复制等)
|
|
273
|
+
cp -r "$CWD"/* "$WORKTREE_PATH/" 2>/dev/null || true
|
|
274
|
+
|
|
275
|
+
# 最后一行输出绝对路径到 stdout(必需)
|
|
276
|
+
echo "$WORKTREE_PATH"
|
|
277
|
+
```
|
|
278
|
+
|
|
279
|
+
**WorktreeRemove** (`~/.codebuddy/hooks/worktree-remove.sh`):
|
|
280
|
+
|
|
281
|
+
```bash
|
|
282
|
+
#!/bin/bash
|
|
283
|
+
|
|
284
|
+
INPUT=$(cat)
|
|
285
|
+
WORKTREE_PATH=$(echo "$INPUT" | jq -r '.worktree_path')
|
|
286
|
+
|
|
287
|
+
# 安全检查:确保路径在预期范围内
|
|
288
|
+
if [[ "$WORKTREE_PATH" != "$HOME/.codebuddy/worktrees/"* ]]; then
|
|
289
|
+
echo "Refusing to remove path outside worktrees directory: $WORKTREE_PATH" >&2
|
|
290
|
+
exit 1
|
|
291
|
+
fi
|
|
292
|
+
|
|
293
|
+
rm -rf "$WORKTREE_PATH"
|
|
294
|
+
```
|
|
295
|
+
|
|
296
|
+
> **提示**:脚本依赖 `jq` 解析 JSON。macOS:`brew install jq`,Linux:`apt install jq`。
|
|
297
|
+
|
|
298
|
+
### 实战示例
|
|
299
|
+
|
|
300
|
+
**SVN 项目**:
|
|
301
|
+
|
|
302
|
+
```json
|
|
303
|
+
{
|
|
304
|
+
"hooks": {
|
|
305
|
+
"WorktreeCreate": [
|
|
306
|
+
{
|
|
307
|
+
"hooks": [
|
|
308
|
+
{
|
|
309
|
+
"type": "command",
|
|
310
|
+
"command": "bash -c 'INPUT=$(cat); NAME=$(echo $INPUT | jq -r .name); DIR=\"$HOME/.codebuddy/worktrees/$NAME\"; svn checkout https://svn.example.com/repo/trunk \"$DIR\" >&2 && echo \"$DIR\"'"
|
|
311
|
+
}
|
|
312
|
+
]
|
|
313
|
+
}
|
|
314
|
+
],
|
|
315
|
+
"WorktreeRemove": [
|
|
316
|
+
{
|
|
317
|
+
"hooks": [
|
|
318
|
+
{
|
|
319
|
+
"type": "command",
|
|
320
|
+
"command": "bash -c 'cat | jq -r .worktree_path | xargs rm -rf'"
|
|
321
|
+
}
|
|
322
|
+
]
|
|
323
|
+
}
|
|
324
|
+
]
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
```
|
|
328
|
+
|
|
329
|
+
**无 VCS 的项目(目录复制)**:
|
|
330
|
+
|
|
331
|
+
```json
|
|
332
|
+
{
|
|
333
|
+
"hooks": {
|
|
334
|
+
"WorktreeCreate": [
|
|
335
|
+
{
|
|
336
|
+
"hooks": [
|
|
337
|
+
{
|
|
338
|
+
"type": "command",
|
|
339
|
+
"command": "bash -c 'INPUT=$(cat); NAME=$(echo $INPUT | jq -r .name); CWD=$(echo $INPUT | jq -r .cwd); DIR=\"$HOME/.codebuddy/worktrees/$NAME\"; cp -r \"$CWD\" \"$DIR\" && echo \"$DIR\"'"
|
|
340
|
+
}
|
|
341
|
+
]
|
|
342
|
+
}
|
|
343
|
+
],
|
|
344
|
+
"WorktreeRemove": [
|
|
345
|
+
{
|
|
346
|
+
"hooks": [
|
|
347
|
+
{
|
|
348
|
+
"type": "command",
|
|
349
|
+
"command": "bash -c 'cat | jq -r .worktree_path | xargs rm -rf'"
|
|
350
|
+
}
|
|
351
|
+
]
|
|
352
|
+
}
|
|
353
|
+
]
|
|
354
|
+
}
|
|
355
|
+
}
|
|
356
|
+
```
|
|
357
|
+
|
|
358
|
+
## tmux 集成
|
|
359
|
+
|
|
360
|
+
使用 `--tmux` 参数可以在独立的 tmux 会话中运行 CodeBuddy:
|
|
361
|
+
|
|
362
|
+
```bash
|
|
363
|
+
# 基本用法
|
|
364
|
+
codebuddy --worktree --tmux
|
|
365
|
+
|
|
366
|
+
# 使用传统模式(不使用 popup)
|
|
367
|
+
codebuddy --worktree --tmux --tmux-classic
|
|
368
|
+
```
|
|
369
|
+
|
|
370
|
+
### tmux 要求
|
|
371
|
+
|
|
372
|
+
- tmux 版本 3.2 或更高(支持 popup 功能)
|
|
373
|
+
- 如果版本较低,会自动回退到传统模式
|
|
374
|
+
|
|
375
|
+
### 退出 tmux 会话
|
|
376
|
+
|
|
377
|
+
- 按 `Ctrl+D` 或输入 `/exit` 退出 CodeBuddy
|
|
378
|
+
- tmux 会话会根据你的选择保留或关闭
|
|
379
|
+
|
|
380
|
+
## 目录结构
|
|
381
|
+
|
|
382
|
+
```
|
|
383
|
+
your-repo/
|
|
384
|
+
├── .codebuddy/
|
|
385
|
+
│ └── worktrees/
|
|
386
|
+
│ ├── feature-auth/ # worktree 目录
|
|
387
|
+
│ │ ├── node_modules -> ../../node_modules # 符号链接
|
|
388
|
+
│ │ └── ...
|
|
389
|
+
│ └── fix-bug-123/
|
|
390
|
+
├── .worktreeinclude # 定义需要复制的本地文件(建议提交)
|
|
391
|
+
└── ...
|
|
392
|
+
```
|
|
393
|
+
|
|
394
|
+
## 手动管理 Worktree
|
|
395
|
+
|
|
396
|
+
CodeBuddy Code 在会话退出时会自动处理 worktree 的清理。但有时需要在会话外手动管理——比如清理残留的 worktree,或者需要更灵活地控制分支和目录位置。
|
|
397
|
+
|
|
398
|
+
### 在会话外清理 Worktree
|
|
399
|
+
|
|
400
|
+
直接使用 Git 命令清理:
|
|
401
|
+
|
|
402
|
+
```bash
|
|
403
|
+
# 查看当前所有 worktree
|
|
404
|
+
git worktree list
|
|
405
|
+
|
|
406
|
+
# 删除指定 worktree(worktree 内没有未提交改动时)
|
|
407
|
+
git worktree remove .codebuddy/worktrees/feature-auth
|
|
408
|
+
|
|
409
|
+
# 强制删除(有未提交改动时)
|
|
410
|
+
git worktree remove --force .codebuddy/worktrees/feature-auth
|
|
411
|
+
|
|
412
|
+
# 同时删除对应的分支
|
|
413
|
+
git branch -D worktree-feature-auth
|
|
414
|
+
|
|
415
|
+
# 清理失效的 worktree 引用(目录已删但 Git 还记着)
|
|
416
|
+
git worktree prune
|
|
417
|
+
```
|
|
418
|
+
|
|
419
|
+
### 用 Git 直接创建 Worktree
|
|
420
|
+
|
|
421
|
+
有时需要检出已有分支,或者把 worktree 放到仓库目录之外,可以绕开 CodeBuddy Code 直接用 Git 创建,然后再在里面启动会话:
|
|
422
|
+
|
|
423
|
+
```bash
|
|
424
|
+
# 新建分支并创建 worktree(放在仓库外)
|
|
425
|
+
git worktree add ../project-feature-a -b feature-a
|
|
426
|
+
|
|
427
|
+
# 检出已有分支
|
|
428
|
+
git worktree add ../project-bugfix bugfix-123
|
|
429
|
+
|
|
430
|
+
# 进入 worktree,启动 CodeBuddy Code
|
|
431
|
+
cd ../project-feature-a && codebuddy
|
|
432
|
+
|
|
433
|
+
# 用完后清理
|
|
434
|
+
git worktree remove ../project-feature-a
|
|
435
|
+
```
|
|
436
|
+
|
|
437
|
+
这种方式适合需要把 worktree 放在特定位置、或者复用现有分支的场景。
|
|
438
|
+
|
|
439
|
+
## 子代理隔离
|
|
440
|
+
|
|
441
|
+
当让 CodeBuddy Code 启动多个子代理并行工作时,可以让每个子代理运行在独立的 worktree 中,避免文件冲突。
|
|
442
|
+
|
|
443
|
+
### `isolation: worktree` 是什么
|
|
444
|
+
|
|
445
|
+
在自定义 Agent 的 frontmatter 中加上 `isolation: worktree`,每次用 `Task` 工具启动这个 Agent 时,系统会自动为它创建一个独立的 worktree,而不是在主仓库目录里直接运行。
|
|
446
|
+
|
|
447
|
+
这意味着:
|
|
448
|
+
- 多个子代理可以同时修改同名文件,互不影响
|
|
449
|
+
- 主仓库目录保持干净,子代理的临时改动不会污染它
|
|
450
|
+
- 子代理完成后,worktree 按需保留或删除
|
|
451
|
+
|
|
452
|
+
### 创建隔离型自定义 Agent
|
|
453
|
+
|
|
454
|
+
在 `.codebuddy/agents/` 目录下创建 Markdown 文件:
|
|
455
|
+
|
|
456
|
+
```markdown
|
|
457
|
+
|
|
458
|
+
你在一个独立的 git worktree 中运行。
|
|
459
|
+
请专注完成分配给你的任务,完成后汇报结果。
|
|
460
|
+
```
|
|
461
|
+
|
|
462
|
+
### 使用效果
|
|
463
|
+
|
|
464
|
+
主 Agent 用 `Task` 工具启动该 Agent 时,会自动为它创建独立的 worktree。多个子代理可以同时工作,即使修改了相同的文件也不会冲突。
|
|
465
|
+
|
|
466
|
+
子代理完成后:
|
|
467
|
+
- **没有变更**:worktree 自动删除
|
|
468
|
+
- **有变更**:worktree 保留,主 Agent 会收到 worktree 位置信息
|
|
469
|
+
|
|
470
|
+
### 验证隔离效果
|
|
471
|
+
|
|
472
|
+
```
|
|
473
|
+
> 使用 isolated-worker agent,在当前目录创建 test.txt,写入 "hello"
|
|
474
|
+
```
|
|
475
|
+
|
|
476
|
+
检查结果:
|
|
477
|
+
|
|
478
|
+
```bash
|
|
479
|
+
# 主仓库里没有这个文件
|
|
480
|
+
ls test.txt
|
|
481
|
+
# → No such file or directory ✓
|
|
482
|
+
|
|
483
|
+
# 文件在子代理的 worktree 里
|
|
484
|
+
ls .codebuddy/worktrees/agent-xxx/test.txt
|
|
485
|
+
# → 存在 ✓
|
|
486
|
+
```
|
|
487
|
+
|
|
488
|
+
## 典型使用场景
|
|
489
|
+
|
|
490
|
+
### 场景一:基于特定分支开发
|
|
491
|
+
|
|
492
|
+
**问题**:需要在 develop 分支上开发新功能,而不是基于 main 分支。
|
|
493
|
+
|
|
494
|
+
**解决方案**:
|
|
495
|
+
|
|
496
|
+
```bash
|
|
497
|
+
# 基于远程 develop 分支创建 worktree
|
|
498
|
+
codebuddy --worktree feature-xxx --worktree-branch origin/develop
|
|
499
|
+
|
|
500
|
+
# 基于本地分支创建(保留本地未推送的提交)
|
|
501
|
+
codebuddy --worktree feature-yyy --worktree-branch my-local-branch
|
|
502
|
+
```
|
|
503
|
+
|
|
504
|
+
### 场景二:并行处理紧急 Bug
|
|
505
|
+
|
|
506
|
+
**问题**:正在开发新功能,代码改了一半,突然需要修紧急 bug。
|
|
507
|
+
|
|
508
|
+
**解决方案**:
|
|
509
|
+
|
|
510
|
+
```bash
|
|
511
|
+
# 终端 1:继续开发新功能
|
|
512
|
+
codebuddy --worktree feature-payment
|
|
513
|
+
|
|
514
|
+
# 终端 2:专门修 bug,互不干扰
|
|
515
|
+
codebuddy --worktree hotfix-login-crash
|
|
516
|
+
```
|
|
517
|
+
|
|
518
|
+
两个 worktree 同时打开,互不影响。bug 修完提交 PR,再回到功能开发。
|
|
519
|
+
|
|
520
|
+
### 场景三:高风险重构
|
|
521
|
+
|
|
522
|
+
**问题**:想尝试大规模重构,但不确定能否成功,不想污染主仓库。
|
|
523
|
+
|
|
524
|
+
**解决方案**:
|
|
525
|
+
|
|
526
|
+
```bash
|
|
527
|
+
codebuddy --worktree refactor-esm
|
|
528
|
+
```
|
|
529
|
+
|
|
530
|
+
在会话中:
|
|
531
|
+
```
|
|
532
|
+
> 帮我把 src/core 目录从 CommonJS 迁移到 ESM
|
|
533
|
+
```
|
|
534
|
+
|
|
535
|
+
结果:
|
|
536
|
+
- **成功**:提交,推 PR,合并
|
|
537
|
+
- **失败**:退出时选择 "Remove worktree",所有改动一键丢弃
|
|
538
|
+
|
|
539
|
+
### 场景四:审查 PR
|
|
540
|
+
|
|
541
|
+
**问题**:想在本地跑一下同事的 PR 代码,但不想污染工作目录。
|
|
542
|
+
|
|
543
|
+
**解决方案**:
|
|
544
|
+
|
|
545
|
+
```bash
|
|
546
|
+
codebuddy --worktree "#456"
|
|
547
|
+
```
|
|
548
|
+
|
|
549
|
+
在会话中:
|
|
550
|
+
```
|
|
551
|
+
> 帮我看看这次 PR 改了什么,有没有潜在问题
|
|
552
|
+
> 运行一下测试
|
|
553
|
+
```
|
|
554
|
+
|
|
555
|
+
审查完直接退出,worktree 自动清理。
|
|
556
|
+
|
|
557
|
+
### 场景五:并行任务
|
|
558
|
+
|
|
559
|
+
**问题**:有多个独立任务(写文档、加测试、开发新接口),想分别推进。
|
|
560
|
+
|
|
561
|
+
**解决方案**:
|
|
562
|
+
|
|
563
|
+
```bash
|
|
564
|
+
codebuddy --worktree task-docs --tmux
|
|
565
|
+
codebuddy --worktree task-tests --tmux
|
|
566
|
+
codebuddy --worktree task-new-api --tmux
|
|
567
|
+
```
|
|
568
|
+
|
|
569
|
+
每个 worktree 让 AI 专注做一件事,配合 tmux 实现真正并行工作。
|
|
570
|
+
|
|
571
|
+
### 场景六:子代理协作
|
|
572
|
+
|
|
573
|
+
**问题**:大型任务需要多个 AI 并行处理不同模块。
|
|
574
|
+
|
|
575
|
+
**解决方案**:
|
|
576
|
+
|
|
577
|
+
首先创建隔离型 Agent(见上文 "子代理隔离" 章节),然后:
|
|
578
|
+
|
|
579
|
+
```
|
|
580
|
+
> 使用三个并行的 api-worker 子代理:
|
|
581
|
+
第一个处理 src/api/user/ 目录
|
|
582
|
+
第二个处理 src/api/order/ 目录
|
|
583
|
+
第三个处理 src/api/product/ 目录
|
|
584
|
+
```
|
|
585
|
+
|
|
586
|
+
三个子代理各自在独立 worktree 中工作,即使修改了共享文件也不会冲突。
|
|
587
|
+
|
|
588
|
+
## 常见问题
|
|
589
|
+
|
|
590
|
+
**Q: `--worktree-branch` 应该传远程分支还是本地分支?**
|
|
591
|
+
|
|
592
|
+
严格区分:
|
|
593
|
+
- `--worktree-branch origin/xxx` → 使用远程分支(会先 fetch 最新代码)
|
|
594
|
+
- `--worktree-branch xxx` → 使用本地分支(保留本地未推送的提交)
|
|
595
|
+
|
|
596
|
+
如果指定的分支不存在,会打印警告并降级到远程默认分支,不会中断启动。
|
|
597
|
+
|
|
598
|
+
**Q:worktree 会占用很多磁盘空间吗?**
|
|
599
|
+
|
|
600
|
+
不会。所有 worktree 共享 Git 对象数据库,只需要存储工作文件本身。如果配置了 `symlinkDirectories`,大型目录也会共享,几乎不占额外空间。
|
|
601
|
+
|
|
602
|
+
**Q:复用已有 worktree 时,.env.local 等文件还会重新复制吗?**
|
|
603
|
+
|
|
604
|
+
不会。复用时直接进入已有目录,跳过初始化。如需同步新配置,需删除 worktree 后重建:
|
|
605
|
+
|
|
606
|
+
```bash
|
|
607
|
+
git worktree remove --force .codebuddy/worktrees/my-feature
|
|
608
|
+
git branch -D worktree-my-feature
|
|
609
|
+
codebuddy --worktree my-feature
|
|
610
|
+
```
|
|
611
|
+
|
|
612
|
+
**Q:worktree 里的提交会影响主仓库吗?**
|
|
613
|
+
|
|
614
|
+
不会。worktree 有独立分支,提交只在该分支上。要合并到主分支,需走正常 PR 流程或手动 `git merge`。
|
|
615
|
+
|
|
616
|
+
**Q:创建 worktree 中途断开了,留下残缺目录怎么办?**
|
|
617
|
+
|
|
618
|
+
```bash
|
|
619
|
+
git worktree remove --force .codebuddy/worktrees/<名称>
|
|
620
|
+
git branch -D worktree-<名称>
|
|
621
|
+
```
|
|
622
|
+
|
|
623
|
+
然后重新创建即可。
|
|
624
|
+
|
|
625
|
+
**Q:symlinkDirectories 配置了但没生效?**
|
|
626
|
+
|
|
627
|
+
复用已有 worktree 时不会重新初始化。删除旧 worktree 重建一次即可。
|
|
628
|
+
|
|
629
|
+
**Q:子代理隔离是安全沙箱吗?**
|
|
630
|
+
|
|
631
|
+
不是。子代理在文件层面隔离,但权限与主 Agent 相同,理论上可操作 worktree 之外的文件。这个功能的目的是防止多个 Agent 之间的**文件冲突**,而非安全限制。
|
|
632
|
+
|
|
633
|
+
**Q:配置了 WorktreeCreate hook 后还能用 Git Worktree 吗?**
|
|
634
|
+
|
|
635
|
+
不能同时使用。Hook 优先级高于 Git——一旦配置了 WorktreeCreate hook,所有 worktree 操作都走 hook,即使在 Git 仓库中也是如此。要恢复使用 git worktree,删除 settings.json 中的 WorktreeCreate 配置即可。
|
|
636
|
+
|
|
637
|
+
**Q:只配了 WorktreeCreate 没配 WorktreeRemove 会怎样?**
|
|
638
|
+
|
|
639
|
+
创建正常工作,但退出时不会自动清理。系统会提示 worktree 目录保留在哪里,需要手动删除。
|
|
640
|
+
|
|
641
|
+
**Q:Hook 脚本执行失败了怎么办?**
|
|
642
|
+
|
|
643
|
+
WorktreeCreate 失败会直接报错,不会降级到 git worktree,检查脚本的 stderr 输出排查问题。WorktreeRemove 失败只记录警告,不影响退出流程。
|
|
644
|
+
|
|
645
|
+
**Q:在非 Git 项目中使用 hook-based worktree,退出时为什么没有自动清理?**
|
|
646
|
+
|
|
647
|
+
hook-based worktree 退出时始终显示 keep/remove 菜单,不进行变更检测(因为非 Git 项目没有 `git status`)。需要手动选择是否删除。
|
|
648
|
+
|
|
649
|
+
## 注意事项
|
|
650
|
+
|
|
651
|
+
- **Git 仓库或 Hook**:`--worktree` 需要 Git 仓库或配置 WorktreeCreate hook(非 Git 项目如 SVN、Perforce 可通过 hook 支持)
|
|
652
|
+
- **分支命名**:自动创建的分支以 `worktree-` 为前缀
|
|
653
|
+
- **清理**:长时间未使用的 worktree 不会自动清理,需要手动删除或使用 `/rewind` 命令
|
|
654
|
+
- **符号链接**:某些工具可能不支持符号链接的目录,请根据项目需求配置
|
|
655
|
+
|
|
656
|
+
## 相关文档
|
|
657
|
+
|
|
658
|
+
- [CLI 参考](./cli-reference.md) - 完整的命令行参数说明
|
|
659
|
+
- [Hooks 参考](./hooks.md) - Hook 系统详细文档
|
|
660
|
+
- [设置配置](./settings.md) - 配置文件说明
|