mirror of
https://github.com/AutoMaker-Org/automaker.git
synced 2026-01-30 14:22:02 +00:00
- Added a `sanitizeProjectName` function to ensure project names are safe for shell commands and Docker image names by converting them to lowercase and removing non-alphanumeric characters. - Updated `dev.mjs` and `start.mjs` to utilize the new sanitization function when determining Docker image names, enhancing security and consistency. - Refactored the Docker entrypoint script to ensure proper permissions for the Cursor CLI config directory, improving setup reliability. - Clarified documentation regarding the storage location of OAuth tokens for the Cursor CLI on Linux. These changes improve the robustness of the Docker setup and enhance the overall development workflow.
46 lines
1.6 KiB
Bash
Executable File
46 lines
1.6 KiB
Bash
Executable File
#!/bin/sh
|
|
set -e
|
|
|
|
# Ensure Claude CLI config directory exists with correct permissions
|
|
if [ ! -d "/home/automaker/.claude" ]; then
|
|
mkdir -p /home/automaker/.claude
|
|
fi
|
|
|
|
# If CLAUDE_OAUTH_CREDENTIALS is set, write it to the credentials file
|
|
# This allows passing OAuth tokens from host (especially macOS where they're in Keychain)
|
|
if [ -n "$CLAUDE_OAUTH_CREDENTIALS" ]; then
|
|
echo "$CLAUDE_OAUTH_CREDENTIALS" > /home/automaker/.claude/.credentials.json
|
|
chmod 600 /home/automaker/.claude/.credentials.json
|
|
fi
|
|
|
|
# Fix permissions on Claude CLI config directory
|
|
chown -R automaker:automaker /home/automaker/.claude
|
|
chmod 700 /home/automaker/.claude
|
|
|
|
# Ensure Cursor CLI config directory exists with correct permissions
|
|
# This handles both: mounted volumes (owned by root) and empty directories
|
|
if [ ! -d "/home/automaker/.cursor" ]; then
|
|
mkdir -p /home/automaker/.cursor
|
|
fi
|
|
chown -R automaker:automaker /home/automaker/.cursor
|
|
chmod -R 700 /home/automaker/.cursor
|
|
|
|
# If CURSOR_AUTH_TOKEN is set, write it to the cursor auth file
|
|
# On Linux, cursor-agent uses ~/.config/cursor/auth.json for file-based credential storage
|
|
# The env var CURSOR_AUTH_TOKEN is also checked directly by cursor-agent
|
|
if [ -n "$CURSOR_AUTH_TOKEN" ]; then
|
|
CURSOR_CONFIG_DIR="/home/automaker/.config/cursor"
|
|
mkdir -p "$CURSOR_CONFIG_DIR"
|
|
# Write auth.json with the access token
|
|
cat > "$CURSOR_CONFIG_DIR/auth.json" << EOF
|
|
{
|
|
"accessToken": "$CURSOR_AUTH_TOKEN"
|
|
}
|
|
EOF
|
|
chmod 600 "$CURSOR_CONFIG_DIR/auth.json"
|
|
chown -R automaker:automaker /home/automaker/.config
|
|
fi
|
|
|
|
# Switch to automaker user and execute the command
|
|
exec gosu automaker "$@"
|