conductor-setup
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseSet up this Rails project for Conductor, the Mac app for parallel coding agents.
为适用于并行编码Agent的Mac应用Conductor配置Rails项目。
What to Create
需要创建的内容
1. conductor.json (project root)
1. conductor.json(项目根目录)
Create in the project root if it doesn't already exist:
conductor.jsonjson
{
"scripts": {
"setup": "bin/conductor-setup",
"run": "script/server"
}
}如果项目根目录中尚未存在,请创建该文件:
conductor.jsonjson
{
"scripts": {
"setup": "bin/conductor-setup",
"run": "script/server"
}
}2. bin/conductor-setup (executable)
2. bin/conductor-setup(可执行文件)
Create if it doesn't already exist:
bin/conductor-setupbash
#!/bin/bash
set -e如果尚未存在,请创建该文件:
bin/conductor-setupbash
#!/bin/bash
set -eSymlink .env from repo root (where secrets live, outside worktrees)
从仓库根目录(密钥存储位置,位于工作区外)创建.env的符号链接
[ -f "$CONDUCTOR_ROOT_PATH/.env" ] && ln -sf "$CONDUCTOR_ROOT_PATH/.env" .env
[ -f "$CONDUCTOR_ROOT_PATH/.env" ] && ln -sf "$CONDUCTOR_ROOT_PATH/.env" .env
Symlink Rails master key
创建Rails主密钥的符号链接
[ -f "$CONDUCTOR_ROOT_PATH/config/master.key" ] && ln -sf "$CONDUCTOR_ROOT_PATH/config/master.key" config/master.key
[ -f "$CONDUCTOR_ROOT_PATH/config/master.key" ] && ln -sf "$CONDUCTOR_ROOT_PATH/config/master.key" config/master.key
Install dependencies
安装依赖
bundle install
npm install
Make it executable with `chmod +x bin/conductor-setup`.bundle install
npm install
执行`chmod +x bin/conductor-setup`使其成为可执行文件。3. script/server (executable)
3. script/server(可执行文件)
Create the directory if needed, then create if it doesn't already exist:
scriptscript/serverbash
#!/bin/bash如果需要,先创建目录,然后在尚未存在的情况下创建该文件:
scriptscript/serverbash
#!/bin/bash=== Port Configuration ===
=== 端口配置 ===
export PORT=${CONDUCTOR_PORT:-3000}
export VITE_RUBY_PORT=$((PORT + 1000))
export PORT=${CONDUCTOR_PORT:-3000}
export VITE_RUBY_PORT=$((PORT + 1000))
=== Redis Isolation ===
=== Redis隔离 ===
if [ -n "$CONDUCTOR_WORKSPACE_NAME" ]; then
HASH=$(printf '%s' "$CONDUCTOR_WORKSPACE_NAME" | cksum | cut -d' ' -f1)
REDIS_DB=$((HASH % 16))
export REDIS_URL="redis://localhost:6379/${REDIS_DB}"
fi
exec bin/dev
Make it executable with `chmod +x script/server`.if [ -n "$CONDUCTOR_WORKSPACE_NAME" ]; then
HASH=$(printf '%s' "$CONDUCTOR_WORKSPACE_NAME" | cksum | cut -d' ' -f1)
REDIS_DB=$((HASH % 16))
export REDIS_URL="redis://localhost:6379/${REDIS_DB}"
fi
exec bin/dev
执行`chmod +x script/server`使其成为可执行文件。4. Update Rails Config Files
4. 更新Rails配置文件
For each of the following files, if they exist and contain Redis configuration, update them to use or with a fallback:
ENV.fetch('REDIS_URL', ...)ENV['REDIS_URL']对于以下每个文件,如果文件存在且包含Redis配置,请更新为使用或带有回退值的:
ENV.fetch('REDIS_URL', ...)ENV['REDIS_URL']config/initializers/sidekiq.rb
config/initializers/sidekiq.rb
If this file exists and configures Redis, update it to use:
ruby
redis_url = ENV.fetch('REDIS_URL', 'redis://localhost:6379/0')如果该文件存在且配置了Redis,请更新为使用:
ruby
redis_url = ENV.fetch('REDIS_URL', 'redis://localhost:6379/0')config/cable.yml
config/cable.yml
If this file exists, update the development adapter to use:
yaml
development:
adapter: redis
url: <%= ENV.fetch('REDIS_URL', 'redis://localhost:6379/1') %>如果该文件存在,请更新development适配器配置为:
yaml
development:
adapter: redis
url: <%= ENV.fetch('REDIS_URL', 'redis://localhost:6379/1') %>config/environments/development.rb
config/environments/development.rb
If this file configures Redis for caching, update to use:
ruby
config.cache_store = :redis_cache_store, { url: ENV.fetch('REDIS_URL', 'redis://localhost:6379/0') }如果该文件配置了Redis缓存,请更新为:
ruby
config.cache_store = :redis_cache_store, { url: ENV.fetch('REDIS_URL', 'redis://localhost:6379/0') }config/initializers/rack_attack.rb
config/initializers/rack_attack.rb
If this file exists and configures a Redis cache store, update to use:
ruby
Rack::Attack.cache.store = ActiveSupport::Cache::RedisCacheStore.new(url: ENV.fetch('REDIS_URL', 'redis://localhost:6379/0'))如果该文件存在且配置了Redis缓存存储,请更新为:
ruby
Rack::Attack.cache.store = ActiveSupport::Cache::RedisCacheStore.new(url: ENV.fetch('REDIS_URL', 'redis://localhost:6379/0'))Implementation Notes
实现注意事项
- Don't overwrite existing files: Check if conductor.json, bin/conductor-setup, and script/server exist before creating them. If they exist, skip creation and inform the user.
- Rails config updates: Only modify Redis-related configuration. If a file doesn't exist or doesn't use Redis, skip it gracefully.
- Create directories as needed: Create directory if it doesn't exist.
script/
- 不要覆盖现有文件:在创建conductor.json、bin/conductor-setup和script/server之前,先检查它们是否已存在。如果已存在,请跳过创建并通知用户。
- Rails配置更新:仅修改与Redis相关的配置。如果文件不存在或未使用Redis,请优雅地跳过。
- 按需创建目录:如果目录不存在,请创建该目录。
script/
Verification
验证步骤
After creating the files:
- Confirm all Conductor files exist and scripts are executable
- Run to verify it starts without errors
script/server - Check that Rails configs properly reference or
ENV['REDIS_URL']ENV.fetch('REDIS_URL', ...)
创建文件后:
- 确认所有Conductor相关文件已存在且脚本具备可执行权限
- 运行以验证其可正常启动且无错误
script/server - 检查Rails配置是否正确引用了或
ENV['REDIS_URL']ENV.fetch('REDIS_URL', ...)