展示HN:workz – 一条命令即可将任何Git工作树变成完整的开发环境
Git 工作树现在随处可见——Claude Code、Conductor、Claude Squad 以及大多数 AI 代理工具都使用它们来进行并行隔离的会话。但工作树只隔离代码。你的 .env 文件、node_modules、Docker 状态和端口都是缺失或共享的。
我在每个项目中都不断编写相同的设置脚本,因此我构建了 workz——一个自动处理这些问题的 Rust CLI 工具:
- 自动检测项目类型(Node/Rust/Python/Go/Java)
- 创建 node_modules、target/、.venv 及其他 19 个目录的符号链接(每个工作树节省数 GB)
- 复制 .env、.envrc、.npmrc、密钥(17 种模式)
- 从锁定文件自动安装依赖(pnpm/yarn/npm/bun/uv/poetry/pip/cargo)
- 新增:--isolated 标志分配唯一端口,命名 Docker compose 的命名空间,生成每个工作树的数据库名称
零配置。单一 Rust 二进制文件。可以独立工作,也可以作为 Conductor/Claude Squad/任何编排工具的设置钩子。
<a href="https://github.com/rohansx/workz" rel="nofollow">https://github.com/rohansx/workz</a>
查看原文
Git worktrees are everywhere now — Claude Code, Conductor, Claude Squad, and most AI agent tools use them for parallel isolated sessions. But worktrees only isolate code. Your .env files, node_modules, Docker state, and ports are all missing or shared.
I kept writing the same setup bash for every project, so I built workz — a Rust CLI that handles it automatically:<p>Auto-detects project type (Node/Rust/Python/Go/Java)
Symlinks node_modules, target/, .venv, and 19 more dirs (saves GBs per worktree)
Copies .env, .envrc, .npmrc, secrets (17 patterns)
Auto-installs deps from lockfiles (pnpm/yarn/npm/bun/uv/poetry/pip/cargo)
New: --isolated flag assigns unique ports, namespaces Docker compose, generates per-worktree DB names<p>Zero config. Single Rust binary. Works standalone or as a setup hook for Conductor/Claude Squad/any orchestrator.<p><a href="https://github.com/rohansx/workz" rel="nofollow">https://github.com/rohansx/workz</a>