Initialize project with Conductor artifacts (product definition, tech stack, workflow, style guides)
Set up the explicitly selected Rails development project for the Conductor app. Frontmatter tool/context hints are host-specific, not authorization to delegate, alter secrets or broaden permissions. Review existing scripts and lockfiles before running installs; preserve unrelated settings.
conductor.json, bin/conductor-setup, and script/server scaffolding for a Rails repo.Create conductor.json in the project root if it doesn't already exist:
{
"scripts": {
"setup": "bin/conductor-setup",
"run": "script/server"
}
}
Create bin/conductor-setup if it doesn't already exist:
#!/usr/bin/env bash
set -euo pipefail
: "${CONDUCTOR_ROOT_PATH:?Set the reviewed repository root first}"
# Link only an explicitly approved local development secret source.
# Preserve any existing destination, including dangling symlinks; never use ln -sf.
link_if_absent() {
local source_path="$1" destination="$2"
if [[ -f "$source_path" && ! -e "$destination" && ! -L "$destination" ]]; then
ln -s -- "$source_path" "$destination"
fi
}
link_if_absent "$CONDUCTOR_ROOT_PATH/.env" .env
mkdir -p config
link_if_absent "$CONDUCTOR_ROOT_PATH/config/master.key" config/master.key
# Dependency installation may execute trusted project code and access the network.
# Review Gemfile.lock/package-lock.json and lifecycle behavior before this step.
bundle install
if [[ -f package-lock.json ]]; then
npm ci --ignore-scripts
elif [[ -f package.json ]]; then
printf '%s\n' 'A reviewed npm lockfile is required; no silent npm install.' >&2
exit 1
fi
Make it executable with chmod +x bin/conductor-setup.
Create the script directory if needed, then create script/server if it doesn't already exist:
#!/usr/bin/env bash
set -euo pipefail
# Reserve distinct ports through the workspace manager, not by assuming uniqueness.
PORT="${CONDUCTOR_PORT:-3000}"
[[ "$PORT" =~ ^[0-9]{1,5}$ ]] || { printf '%s\n' 'Invalid port' >&2; exit 1; }
PORT=$((10#$PORT))
(( PORT >= 1024 && PORT <= 64535 )) || { printf '%s\n' 'Port outside safe range' >&2; exit 1; }
export PORT
export VITE_RUBY_PORT=$((PORT + 1000))
# Supply a dedicated disposable Redis instance/namespace explicitly.
# Hashing a workspace name modulo 16 causes collisions and is not isolation.
: "${REDIS_URL:?Set an approved workspace-specific development Redis URL}"
export REDIS_URL
exec bin/dev
Make it executable with chmod +x script/server.
For each of the following files, if they exist and contain Redis configuration, update them to use ENV.fetch('REDIS_URL', ...) or ENV['REDIS_URL'] with a fallback:
If this file exists and configures Redis, update it to use:
redis_url = ENV.fetch('REDIS_URL', 'redis://localhost:6379/0')
If this file exists, update the development adapter to use:
development:
adapter: redis
url: <%= ENV.fetch('REDIS_URL', 'redis://localhost:6379/1') %>
If this file configures Redis for caching, update to use:
config.cache_store = :redis_cache_store, { url: ENV.fetch('REDIS_URL', 'redis://localhost:6379/0') }
If this file exists and configures a Redis cache store, update to use:
Rack::Attack.cache.store = ActiveSupport::Cache::RedisCacheStore.new(url: ENV.fetch('REDIS_URL', 'redis://localhost:6379/0'))
script/ directory if it doesn't exist.After creating the files:
ENV['REDIS_URL'] or ENV.fetch('REDIS_URL', ...)