diff --git a/README.md b/README.md index dd3b5e3..faa109d 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,43 @@ -# alfred-ide +# Alfred IDE +Cloud-native AI development environment built on code-server, with custom Commander extension, multi-provider AI chat, voice assistant, and sovereign infrastructure. + +## Architecture + +- **Base**: code-server 4.102.2 (VS Code for the web) +- **Extension**: Alfred Commander (3,551-line extension.js) — AI chat, stats, voice, walkthrough +- **Auth**: Cookie-based gating via Apache + PHP, PIN/email login +- **MCP**: 500+ tools via gocodeme-mcp service (port 3006) +- **Branding**: Patched workbench.js + NLS message files + +## Components + +| Component | Location | Purpose | +|-----------|----------|---------| +| `start.sh` | Server start script | Launches code-server with config | +| `config.yaml` | code-server config | Port 8443, auth:none (Apache handles auth) | +| `branding-patches.sh` | Branding automation | Patches "code-server" → "Alfred IDE" | +| Commander extension | `extensions/gositeme.alfred-commander-1.0.1/` | Full IDE UX | + +## Auth Flow + +1. User visits `gositeme.com/alfred-ide/` +2. Apache checks for `alfred_ide_token` cookie +3. Missing → redirect to `alfred-ide-auth.php` +4. Login via PIN (Commander) or email/password +5. Session created in DB, cookie set → proxy to code-server + +## Running + +```bash +# PM2 managed +pm2 start alfred-ide + +# Manual +./start.sh +# → http://127.0.0.1:8443 +``` + +## License + +AGPL-3.0 — GoSiteMe Inc. diff --git a/branding-patches.sh b/branding-patches.sh new file mode 100644 index 0000000..5e44b86 --- /dev/null +++ b/branding-patches.sh @@ -0,0 +1,21 @@ +#!/bin/bash +# Alfred IDE Branding Patches +# Applied to code-server workbench.js and NLS files +# See user memory notes for full details + +WORKBENCH="/home/gositeme/.local/share/code-server/lib/vscode/out/vs/workbench/workbench.web.main.js" + +# Product name patches +sed -i 's/nameShort:"code-server"/nameShort:"Alfred IDE"/g' "$WORKBENCH" +sed -i 's/nameLong:"code-server"/nameLong:"Alfred IDE"/g' "$WORKBENCH" + +# Secure context warning +sed -i 's/d(3228,null,"code-server")/d(3228,null,"Alfred IDE")/g' "$WORKBENCH" + +# Logout menu +sed -i 's/d(3230,null,"code-server")/d(3230,null,"Alfred IDE")/g' "$WORKBENCH" + +# Update notification +sed -i 's/\[code-server v/[Alfred IDE v/g' "$WORKBENCH" + +echo "Branding patches applied to $(basename $WORKBENCH)" diff --git a/config.yaml b/config.yaml new file mode 100644 index 0000000..50ae120 --- /dev/null +++ b/config.yaml @@ -0,0 +1,7 @@ +bind-addr: 127.0.0.1:8443 +auth: none +cert: false +app-name: Alfred IDE +welcome-text: Welcome, Commander +disable-telemetry: true +disable-update-check: true diff --git a/start.sh b/start.sh new file mode 100755 index 0000000..ddec2b1 --- /dev/null +++ b/start.sh @@ -0,0 +1,28 @@ +#!/bin/bash +# Alfred IDE - Start Script +# Launches code-server (rebranded as Alfred IDE) +# CRITICAL: unset VSCODE_IPC_HOOK_CLI or code-server detects VS Code and exits silently + +unset VSCODE_IPC_HOOK_CLI + +# Prevent file watcher from consuming all CPU when inotify fills up +export VSCODE_FILE_WATCHER_POLLING_INTERVAL=30000 +export CHOKIDAR_USEPOLLING=0 + +PORT=8443 +HOST=127.0.0.1 +CODE_SERVER_BIN=/home/gositeme/.local/bin/code-server + +# If Alfred IDE is already bound on the expected port, do not spawn a duplicate. +EXISTING_PID=$(ss -ltnp 2>/dev/null | awk -v addr="$HOST:$PORT" '$4 == addr { if (match($0, /pid=([0-9]+)/, m)) print m[1] }' | head -n 1) +if [[ -n "$EXISTING_PID" ]] && ps -p "$EXISTING_PID" -o args= 2>/dev/null | grep -q 'code-server'; then + echo "Alfred IDE already running on ${HOST}:${PORT} (pid ${EXISTING_PID})" + exit 0 +fi + +exec nice -n 15 ionice -c 3 /home/gositeme/.local/bin/code-server \ + --bind-addr ${HOST}:${PORT} \ + --disable-telemetry \ + --disable-update-check \ + --user-data-dir /home/gositeme/.local/share/code-server \ + /home/gositeme