headless-codeany
GitHub用于在Linux、macOS或Windows上安装CodeAny独立服务器,启动后台服务并登录codeany.ai账户,使CodeAny Desktop能够连接本机。
触发场景
安装
npx skills add codeany-ai/codeany --skill headless-codeany -g -y
SKILL.md
Frontmatter
{
"name": "headless-codeany",
"description": "Install the CodeAny standalone server, start its background service, and sign in with a codeany.ai account so CodeAny Desktop can connect to this machine."
}
Install and Connect CodeAny Server
Use this skill to install the standalone CodeAny server (codeany) on Linux, macOS, or Windows, start its background service, and link the machine to the user's codeany.ai account.
Supported Platforms
- Linux (
x86_64,aarch64) - macOS (
aarch64/ Apple Silicon,x86_64) - Windows (
x86_64, PowerShell)
Step 1: Detect the OS and Existing Installation
Check the operating system and whether codeany is already installed:
- Linux / macOS:
uname -sm command -v codeany || ls -l "$HOME/.local/bin/codeany" 2>/dev/null - Windows (PowerShell):
$bin = Join-Path $env:LOCALAPPDATA 'CodeAny\bin\codeany.exe' Test-Path $bin
If codeany is already installed, check its version (codeany --version) and whether the background service is running (codeany service probe).
Step 2: Install (or Update) the CodeAny Server Binary
The official installers download the latest checksum-verified release and restart any already-running service.
-
Linux / macOS:
curl -fsSL 'https://cdn.codeany.ai/scripts/headless-codeany/install.sh' | sh- Installs to
~/.local/bin/codeanyby default (CODEANY_INSTALL_DIRoverrides the directory). - If
~/.local/binis not inPATH, use"$HOME/.local/bin/codeany"directly in the following commands, and let the user know how to add it toPATH.
- Installs to
-
Windows (PowerShell):
& ([scriptblock]::Create((Invoke-RestMethod -ErrorAction Stop -Uri 'https://cdn.codeany.ai/scripts/headless-codeany/install.ps1')))- Installs to
%LOCALAPPDATA%\CodeAny\bin\codeany.exeby default (CODEANY_INSTALL_DIRoverrides it).
- Installs to
Step 3: Start the Background Service
Ensure codeany serve is running and stays running across logins/reboots.
-
Linux / macOS:
- Run:
(Or"${HOME}/.local/bin/codeany" service installcodeany service installifcodeanyis already inPATH.) - If user
systemdis unavailable (for example inside a container or minimal Linux host wheresystemctl --usercannot connect), start the service directly in the background:data="${CODEANY_HOME:-$HOME/.codeany}" (umask 077; mkdir -p "$data"; nohup "${HOME}/.local/bin/codeany" serve </dev/null >>"$data/serve.log" 2>&1 &) - Verify the service is ready (retry for a few seconds if just started):
"${HOME}/.local/bin/codeany" service probe
- Run:
-
Windows (PowerShell):
$bin = Join-Path $env:LOCALAPPDATA 'CodeAny\bin\codeany.exe' & $bin service install & $bin service probe
Step 4: Sign In with codeany.ai
codeany login performs an interactive OAuth sign-in. It prints an authorization URL, tries to open a local browser, and waits for either a loopback callback (on a machine with a browser) or the user pasting the redirected URL / authorization code into stdin (on a headless remote server).
Important for AI Agents:
- Do not run
codeany loginas a blocking command without surfacing its output to the user — it will wait for OAuth completion until it times out. - Start
codeany loginin a background process (or interactive terminal/PTY) whose stdout you can read and whose stdin you can write to:- Linux / macOS:
"${HOME}/.local/bin/codeany" login - Windows:
& (Join-Path $env:LOCALAPPDATA 'CodeAny\bin\codeany.exe') login
- Linux / macOS:
- Check its initial output:
- If it prints
Already signed in to codeany.ai (...)and exits with code0, this machine is already connected! Ask the user if they want to switch accounts (codeany login --force), otherwise skip to Step 5. - Otherwise, it will print a link starting with
https://codeany.ai/connect/codeany?....
- If it prints
- Send that exact URL to the user and ask them to:
- Open the URL in their browser and sign in with the same
codeany.aiaccount used in their CodeAny Desktop app. - If they approved it in a browser on this same machine, sign-in completes automatically.
- If this is a remote headless server without a local browser, the browser will redirect to
http://127.0.0.1:...(which will fail to load on their local machine — that is expected). Ask the user to copy and paste that redirected URL (or the authorization code) back to you.
- Open the URL in their browser and sign in with the same
- When the user sends the redirected URL or code, write it (followed by a newline) to the running
codeany loginprocess's stdin. - Confirm
codeany loginprintsSigned in to codeany.ai ...and exits with code0.
Step 5: Verify and Report
- Confirm the background service is healthy:
codeany service probe - Remind the user:
- This machine will now appear under Settings → Devices → Script connection (and Shared devices) in CodeAny Desktop.
- Any coding agents they want to run remotely (such as Claude Code, Codex, etc.) should be installed and signed in as this same OS user on this machine.
- Future server updates can be triggered from CodeAny Desktop or by running
codeany update.
版本历史
- a84d276 当前 2026-12-04 14:51


