diff --git a/lib/generators.sh b/lib/generators.sh index 96bccb8..cabdf71 100644 --- a/lib/generators.sh +++ b/lib/generators.sh @@ -66,7 +66,10 @@ _generate_local_model_services() { volumes: - agents-${service_name}-data:/home/agent/data - project-repos:/home/agent/repos - - ${HOME}/.ssh:/home/agent/.ssh:ro + - \${HOME}/.claude:/home/agent/.claude + - \${HOME}/.claude.json:/home/agent/.claude.json:ro + - CLAUDE_BIN_PLACEHOLDER:/usr/local/bin/claude:ro + - \${HOME}/.ssh:/home/agent/.ssh:ro environment: FORGE_URL: http://forgejo:3000 FORGE_TOKEN: \${FORGE_TOKEN:-} @@ -389,18 +392,6 @@ COMPOSEEOF # (Docker Compose cannot resolve it; it's a shell variable, not a .env var) sed -i "s|\${PROJECT_NAME:-project}|${PROJECT_NAME}|g" "$compose_file" - # Patch the Claude CLI binary path — resolve from host PATH at init time. - local claude_bin - claude_bin="$(command -v claude 2>/dev/null || true)" - if [ -n "$claude_bin" ]; then - # Resolve symlinks to get the real binary path - claude_bin="$(readlink -f "$claude_bin")" - sed -i "s|CLAUDE_BIN_PLACEHOLDER|${claude_bin}|" "$compose_file" - else - echo "Warning: claude CLI not found in PATH — update docker-compose.yml volumes manually" >&2 - sed -i "s|CLAUDE_BIN_PLACEHOLDER|/usr/local/bin/claude|" "$compose_file" - fi - # Patch the forgejo port mapping into the file if non-default if [ "$forge_port" != "3000" ]; then # Add port mapping to forgejo service so it's reachable from host during init @@ -410,8 +401,22 @@ COMPOSEEOF fi # Append local-model agent services if any are configured + # (must run before CLAUDE_BIN_PLACEHOLDER substitution so the placeholder + # in local-model services is also resolved) _generate_local_model_services "$compose_file" + # Patch the Claude CLI binary path — resolve from host PATH at init time. + local claude_bin + claude_bin="$(command -v claude 2>/dev/null || true)" + if [ -n "$claude_bin" ]; then + # Resolve symlinks to get the real binary path + claude_bin="$(readlink -f "$claude_bin")" + sed -i "s|CLAUDE_BIN_PLACEHOLDER|${claude_bin}|g" "$compose_file" + else + echo "Warning: claude CLI not found in PATH — update docker-compose.yml volumes manually" >&2 + sed -i "s|CLAUDE_BIN_PLACEHOLDER|/usr/local/bin/claude|g" "$compose_file" + fi + echo "Created: ${compose_file}" }