CODEAFAR / GET STARTED

从安装到第一次对话。From install to your first conversation.

先选择直装版、APK 或 TestFlight,再按本机或远程流程操作。登录、API 配置与项目文件都在编程电脑上;手机只作为客户端。

Choose a direct download, APK, or TestFlight build, then follow the local or remote path. Provider login, API configuration, and projects stay on the coding computer; your phone is a client.

00 / CHOOSE A PATH

你要连接哪台电脑?Which computer are you connecting to?

连接地址永远指向运行 Codex CLI / Claude Code 与 CodeAfar Host 的电脑,不是运行 CodeAfar App 的手机或电脑。

The endpoint always identifies the computer running Codex CLI / Claude Code and CodeAfar Host—never the phone or computer running the CodeAfar app.

i

版本区别:macOS 只发行官网 CodeAfar 安装包,支持本机与远程 Host;iPhone 与 iPad 使用 TestFlight,Android 使用官网签名 APK,三种移动设备都只连接远程 Host。macOS 不再提供 TestFlight 或 App Store 安装方式。手机和平板没有本机 Host。开放状态以下载页为准。

Channels: macOS is a direct-download CodeAfar app with local and remote Hosts. iPhone and iPad use TestFlight; Android uses the signed APK from this site. All mobile builds connect to remote Hosts only. There is no macOS TestFlight or App Store distribution. Check downloads for availability.

在 iPhone / iPad 安装:接受测试邀请,然后在该设备的 TestFlight 中安装或更新 CodeAfar。最新上传版本为 0.1.0(41);已确认可用于内部测试。暂不提供公开邀请链接。在 Mac 上请从官网下载安装包,不要安装“为 iPhone 设计”的版本。

On iPhone / iPad: accept your invitation, then install or update CodeAfar in TestFlight. Latest uploaded build: 0.1.0 (41). Internal testing availability is confirmed. There is no public invitation link yet. On a Mac, use the website download, not the app designed for iPhone.

在 Android 安装:从官网下载已签名 APK。当前版本为 0.1.0(41)。浏览器提示时,只为当前浏览器或文件管理器临时允许“安装未知应用”,完成后可关闭该权限。后续下载同一签名的新 APK 可直接覆盖升级并保留配对数据。不要从第三方镜像下载。

On Android: download the signed APK from this site. Current build: 0.1.0 (41). If prompted, temporarily allow app installation for that browser or file manager, then turn the permission off. A newer APK with the same signature upgrades in place and preserves pairing data. Do not use third-party mirrors.

01 / DIRECT DESKTOP

同机使用,打开 App 即可。Same machine: just open the app.

此流程仅适用于官网 macOS 直装版 CodeAfar,不适用于 TestFlight。App 使用随包附带的本机连接组件,直接复用当前系统用户的 Codex CLI、Codex Desktop 所带 CLI 或 Claude Code 的配置与历史;无需另装 CodeAfar CLI。

This path is for the direct-download macOS CodeAfar, not TestFlight. Its bundled local connector reuses the current OS user's Codex CLI, Codex Desktop bundled CLI, or Claude Code configuration and history. No separate CodeAfar CLI install is required.

  1. 1
    确认 Codex 或 Claude 可在终端运行Run Codex or Claude successfully in Terminal
  2. 2
    安装并打开 CodeAfarInstall and open CodeAfar

    从官网下载 ZIP,解压后将 CodeAfar.app 拖入“应用程序”,再打开。首次从旧的 CodeAfar Desktop 升级时,先结束本机任务并退出旧版,再安装 CodeAfar。打开确认原有配置与会话正常后,可将旧的应用包移到废纸篓;不要删除用户数据。之后检测到新版本时,侧边栏 CodeAfar 右侧才会出现更新按钮,点击后按提示下载、验证并重启。未发送的草稿或正在执行的本机任务会阻止重启。安装包已使用 Developer ID 签名并通过 Apple 公证。侧边栏会出现带 LOCAL 标记的本机 Host。

    Download the ZIP from the official site, extract it, drag CodeAfar.app into Applications, then open it. For the first upgrade from CodeAfar Desktop, finish local tasks, quit it, and install CodeAfar. Verify your existing configuration and sessions before moving the old application bundle to Trash; do not delete user data. Future updates appear as a button beside CodeAfar in the sidebar only when a newer version is available. Follow its prompts to download, verify and restart. Unsent drafts or running local tasks prevent restart. The download is Developer ID signed and notarized by Apple. A Host marked LOCAL appears in the sidebar.

  3. 3
    选择工作区并创建 SessionSelect a workspace and create a session

    模型与受支持的选项来自本机 Provider。已有历史按 Provider 分组。若未检测到,前往 Settings → AI providers → Rescan;自定义 CLI 路径和非默认配置目录需要使用相同的 Provider 运行环境。

    Models and supported options come from the local provider. Existing history is grouped by provider. If detection fails, use Settings → AI providers → Rescan. Custom executables and data directories must use the same provider environment.

✓

手机端没有“本机 Host”。iPhone、iPad 和 Android 必须连接另一台运行 CodeAfar Host CLI 的电脑。

Mobile has no “local Host.” iPhone, iPad, and Android must connect to another computer running CodeAfar Host CLI.

02 / REMOTE: INSTALL HOST CLI

只在远程 Host 上安装。Install only on a remote Host.

在保存项目并运行 Codex CLI 或 Claude Code 的电脑上执行安装命令。本机 Desktop 模式不需要安装 CodeAfar CLI。

Run the installer on the computer that stores the project and runs Codex CLI or Claude Code. Local Desktop mode does not need CodeAfar CLI.

⌘
macOS / Linuxarm64 · x64
$ curl -fsSL https://codeafar.com/install.sh | sh

默认写入 ~/.local/bin,不需要 sudo。

Installs to ~/.local/bin by default without sudo.

⊞
WindowsPowerShell 5.1 / 7 · x64
> irm https://codeafar.com/install.ps1 | iex

使用 Windows 10 / 11 x64 的 PowerShell,不是在 CMD 中粘贴此命令。无需预先安装 Node.js、npm、Git 或 WSL。安装器默认放在 %LOCALAPPDATA%\CodeAfar\bin\codeafar.exe,安装完成后当前 PowerShell 即可使用;其他已经打开的终端需重新打开。Windows ARM64 暂不提供 Host 安装包。

Use PowerShell on Windows 10 / 11 x64, not CMD. Node.js, npm, Git, and WSL are not prerequisites. The default binary is %LOCALAPPDATA%\CodeAfar\bin\codeafar.exe; it is usable in this PowerShell immediately after installation. Reopen other existing terminals to refresh their PATH. A Windows ARM64 Host package is not available yet.

0.1

空 Windows 电脑:单独安装并登录 CodexFresh Windows computer: install and sign in to Codex separately

CodeAfar 不包含 Codex 或 Claude,也不代替它们的登录。若电脑尚未安装 Provider,在同一 Windows 用户的普通、非管理员 PowerShell 中按 OpenAI 官方安装说明安装 Codex:

CodeAfar does not bundle Codex or Claude or replace their sign-in. If no provider is installed, use a normal, non-administrator PowerShell under the same Windows account and follow OpenAI's installation instructions:

> irm https://chatgpt.com/codex/install.ps1 | iex

安装器如果提示重新打开终端,先照做,再运行以下检查。首次运行 codex 时选择登录方式,或按 Provider 官方说明配置 API。确认它可以实际回复一条测试消息,再配置 CodeAfar。只有安装成功但未登录、API 不可用或没有模型权限时,配对成功仍不能发送消息。

Reopen PowerShell first if the Codex installer requests it, then run these checks. On first running codex, choose a sign-in method or configure an API according to the provider's official instructions. Confirm that it can actually answer a test message before configuring CodeAfar. Installation alone is not sufficient: missing sign-in, an unavailable API, or missing model access can prevent sending even after successful pairing.

> codex --version
> codex

已安装并可正常使用 Codex 的电脑无需重复安装。Claude Code 是可选 Provider,使用 Claude 官方安装与登录流程;缺少 Claude 不影响 Codex。

If Codex already answers successfully, do not reinstall it. Claude Code is optional; use Claude's official setup and sign-in instructions. Missing Claude does not affect Codex.

1.0

运行引导式配置Run guided setup

setup 会依次设置 Host 名称、监听地址、授权目录并安装用户级后台服务。默认采用 Restricted 权限,任何远程监听或 Full access 都会明确显示并确认。Windows 请从已登录桌面打开非管理员 PowerShell执行;共享普通权限的 Codex Desktop 时必须处于同一用户、相同权限级别,不要从提升权限的 SSH 终端配置。

setup configures the Host name, listen address, authorized roots, and per-user background service. Restricted access is the default; remote listening and Full access remain explicit. On Windows, use a non-administrator PowerShell on the signed-in desktop. Sharing a standard-integrity Codex Desktop requires the same user and integrity level, not an elevated SSH terminal.

$ codeafar setup
$ codeafar host status

确认状态为 Running 后再配对。配对只授予设备权限,不会替代 Host 后台运行或 Provider 登录。局域网连接时,在 Windows 防火墙中只对可信的专用网络允许设置的 TCP 端口(默认 7443),不要关闭整个防火墙。

Confirm the Host is Running before pairing. Pairing authorizes a device; it does not keep a stopped Host running or sign in to a provider. For LAN access, allow the configured TCP port (7443 by default) on trusted private networks in Windows Firewall; do not disable the firewall.

1.1

检查或安装更新Check for or install updates

Host 最多每天检查一次签名清单,只提示、不自动安装。--check 仅检查;update 才会下载。下载会显示百分比、速率和预计时间,支持失败重试与断点续传。CLI 会验证 Ed25519 签名、归档大小和 SHA-256。macOS / Linux 支持原子替换并刷新受管理的 Host 服务,重启健康检查失败会回滚。配置、授权目录、设备和会话数据库都会保留。

The Host checks the signed manifest at most daily and only notifies—it never auto-installs. --check checks; update downloads with percent, rate, ETA, retry, and resume. The CLI verifies the Ed25519 signature, size, and SHA-256. On macOS / Linux it atomically replaces the binaries and refreshes the managed Host, rolling back if the restarted service fails its health check. Configuration, roots, devices, and sessions are preserved.

$ codeafar update --check
$ codeafar update
!

Windows 已安装 Host 的升级:当前 Windows 的 update 不会同步更新后台服务使用的程序副本。等当前任务结束后,在原来的同一 Windows 用户 PowerShell 中依次运行以下命令:停止 Host、重新安装经过校验的 CLI、刷新计划任务、确认 Running。它们不删除配置、证书或既有配对。不要只更新命令行程序就认为后台 Host 也已升级。

Upgrading an installed Windows Host: Windows update does not yet refresh the binary copy used by its background service. After active tasks finish, run these commands in order under the same Windows account: stop the Host, install the verified CLI, refresh the scheduled task, and confirm Running. Configuration, certificates, and existing pairings are retained. Updating only the command-line executable does not upgrade the background Host.

> codeafar host stop
> irm https://codeafar.com/install.ps1 | iex
> codeafar host install
> codeafar host status
1.2

确认 Provider 已安装并登录Confirm the provider is installed and signed in

先在 Host 终端成功运行一次 codex 或 claude。Claude Code 是可选项。

Run codex or claude successfully once in the Host terminal. Claude Code is optional.

$ codeafar doctor
i

doctor 现在输出易读的检查清单和可直接执行的修复提示。脚本需要原始字段时追加 --json。缺少 Claude 不会影响 Codex。

doctor now prints a readable checklist with executable repair hints. Add --json when a script needs the raw fields. Missing Claude does not affect Codex.

03 / REMOTE HOST

明确开放监听与文件范围。Explicitly enable listening and file access.

先完成远程 Host 安装,并以运行服务的同一系统用户验证 Codex 或 Claude 能正常回复。若已运行 codeafar setup,以下是对应的手动配置命令,无需重复更改已设置的权限。

Complete Host installation and verify a provider response as the same OS user running the service. If you used codeafar setup, the following are equivalent manual commands; do not change already configured permissions unnecessarily.

3.1

监听所有可用网卡Listen on all available interfaces

$ codeafar host configure --listen 0.0.0.0:7443 --enable-remote

0.0.0.0 是服务端监听地址,意思是接受到达这台 Host 的所有 IPv4 网卡流量。它不能作为 App 的连接地址。

0.0.0.0 is a server listen address: accept traffic arriving on any IPv4 interface. It is not a destination the app can connect to.

3.2

授权可用文件夹Authorize workspace folders

$ codeafar access restricted
$ codeafar roots add /absolute/path/to/projects

Restricted 模式只允许 App 在已加入根目录及其子目录中选择或新建工作区。可重复添加多个绝对路径。

Restricted mode lets the app choose or create workspaces only inside added roots. Repeat with additional absolute paths as needed.

$ codeafar access full

Full access 会开放该 Host 系统用户本来可访问的所有目录,并在交互式终端要求确认。自动化环境必须显式追加 --yes。

Full access exposes every directory available to the Host OS user and asks for confirmation in a terminal. Non-interactive automation must explicitly add --yes.

3.3

启动并检查 HostStart and inspect the Host

macOS / Linux / Windows service
$ codeafar host install
$ codeafar host status

状态页会直接显示 Running、自动启动信息和 PID。Windows 使用当前用户的低权限计划任务,在该用户登录后启动,关闭 PowerShell 或 SSH 不会关闭后台服务;退出 Windows 用户会话或关机后不能远程使用。如提示 Windows 防火墙需要授权,按显示的修复步骤一次性允许专用网络 TCP 7443;仅此系统配置步骤可能需要管理员确认,实际 Host 仍以低权限运行。

Status shows Running, startup information, and PID. Windows uses a least-privilege scheduled task that starts when this user signs in. Closing PowerShell or SSH does not stop it; signing out of Windows or shutting down makes the Host unavailable. If Windows Firewall needs authorization, follow the displayed repair instructions to allow private-network TCP 7443. Only this system configuration may require administrator approval; the actual Host still runs with least privilege.

Linux 如果尚未开启 linger,会同时显示原因和可复制的一次性 sudo loginctl enable-linger <uid> 命令;执行后 Host 会随系统启动并在 SSH 退出后继续运行。如 Provider 依赖 API 或代理环境变量,请先在当前终端设置,再运行 host install;Host 只保留明确允许的 Provider、代理与证书设置,并用仅当前用户可读的服务配置保存。

If Linux linger is disabled, status prints the reason and a copyable one-time sudo loginctl enable-linger <uid> command; afterward the Host starts at boot and survives SSH logout. If a provider needs API or proxy environment variables, set them in the current terminal before host install. The Host retains only an explicit provider/proxy/certificate allowlist in a user-readable-only service definition.

可选:临时前台运行Optional: temporary foreground Host
$ codeafar host serve

适用于三种桌面系统的临时调试,不是必须步骤。不要同时启动已运行的后台 Host;终端会显示实际监听地址,前台模式需保持窗口打开。

This optional debugging mode works on all three desktop systems. Do not launch it while the background Host is already running. The terminal shows the effective listen address; foreground mode requires the window to stay open.

旧测试版迁移到新官网Move an older test build to the new domain

CodeAfar 官网与下载服务已统一为 codeafar.com,原测试域名已停用。如果旧版 CLI 的更新失败,在运行 Host 的电脑上执行以下一次性命令:

The website and downloads now use codeafar.com. The former test domain is retired. If an older CLI cannot update, run this one-time command on the Host computer:

$ curl -fsSL https://codeafar.com/install.sh | CODEAFAR_VERSION=0.1.0-beta.22 CODEAFAR_UPDATE_MODE=1 sh

这是旧测试域名和旧签名链的一次性迁移:安装器校验 beta.22 的 SHA-256,保留原有配对、目录授权与会话数据;如果运行中的托管服务属于当前配置,安装器会在任务结束后刷新并重启它。使用自定义数据目录时同时设置原有的 CODEAFAR_DATA_DIR。迁移后直接运行 codeafar update。新安装仍使用上方安装命令。

This is a one-time migration from the retired test domain and release key: the installer verifies beta.22's SHA-256 and preserves pairings, workspace access, and session data. If the managed service belongs to this configuration, it is refreshed and restarted after you finish active tasks. Pass the same CODEAFAR_DATA_DIR when customized. After migration, use codeafar update. For a new install, use the installer above.

macOS beta.13 / beta.14 一次性修复:这两个版本的旧更新器可能在 Host 已成功重启后误判健康检查并回滚。请执行 curl -fsSL https://codeafar.com/install.sh | CODEAFAR_UPDATE_MODE=1 sh。安装器会校验下载、保留所有数据并刷新已有服务;升级至 beta.15 后恢复使用普通 codeafar update。

One-time fix for macOS beta.13 / beta.14: those updaters can roll back after a successful Host restart. Run curl -fsSL https://codeafar.com/install.sh | CODEAFAR_UPDATE_MODE=1 sh. The installer verifies the download, preserves all data, and refreshes the existing service. Normal codeafar update works again from beta.15 onward.

!

beta.22 签名密钥轮换(必须一次性迁移):beta.21 及更早版本内置旧的发布公钥,无法验证 beta.22 之后的新清单。请在运行 Host 的电脑上先完成当前任务,再执行下面的安装器;它只替换 CLI、保留配对/授权/会话数据,并按 CODEAFAR_UPDATE_MODE=1 刷新已有后台服务。迁移后恢复使用 codeafar update。如果使用了自定义数据目录,请同时设置原来的 CODEAFAR_DATA_DIR,避免刷新错误的服务。

beta.22 signing-key rotation (one-time migration): beta.21 and older clients contain the previous release public key and cannot verify manifests after beta.22. Finish active tasks first, then run the installer below on the Host computer. It replaces only the CLI, preserves pairings, access roots, and sessions, and refreshes the existing service with CODEAFAR_UPDATE_MODE=1. After migration, use codeafar update normally. If your service uses a custom data directory, pass the same CODEAFAR_DATA_DIR value so the correct service is refreshed.

$ curl -fsSL https://codeafar.com/install.sh | CODEAFAR_VERSION=0.1.0-beta.22 CODEAFAR_UPDATE_MODE=1 sh

Windows 用户请从下载页获取 0.1.0-beta.22 的 x64 ZIP,解压后覆盖用户 PATH 中的 codeafar.exe;安装器会保留同一用户目录下的配置与会话。

On Windows, download the 0.1.0-beta.22 x64 ZIP from the downloads page and replace codeafar.exe in your user PATH; configuration and sessions under the same user profile are preserved.

04 / ENDPOINT & PAIRING

指定 App 真正能访问的 Host 地址。Use the Host address the app can actually reach.

--endpoint 中的 IP 或域名属于运行 CodeAfar Host CLI 的电脑,或者转发到它的 FRP 入口。它会写入配对 JSON,省去在 App 中再次输入地址。

The IP or domain in --endpoint belongs to the computer running CodeAfar Host CLI, or to an FRP gateway forwarding to it. It is embedded in pairing JSON so the app does not need a second address entry.

LAN

同一局域网Same local network

使用 Host 在路由器局域网中的地址。示例中 192.168.1.20 是 Host,不是手机。

Use the Host address on the router's LAN. In this example, 192.168.1.20 is the Host, not the phone.

$ codeafar pair create --json --endpoint wss://192.168.1.20:7443/cap
防火墙仅对专用网络开放 TCP 7443。Allow TCP 7443 only on the private network.
MESH

Tailscale / ZeroTier

使用 Host 的组网 IP 或组网 DNS 名称。两端设备需已加入同一 Tailnet 或 ZeroTier Network。

Use the Host's mesh IP or mesh DNS name. Both devices must join the same Tailnet or ZeroTier network.

$ codeafar pair create --json --endpoint wss://100.101.102.103:7443/cap
也可使用 MagicDNS,例如 dev-mac.tailnet.ts.net。MagicDNS names such as dev-mac.tailnet.ts.net also work.
FRP

经 FRP 访问Connect through FRP

使用 TCP 代理把公网端口原样转发到 Host 的 7443。必须保留 CodeAfar 自己的 TLS,不要使用会终止或替换证书的 HTTP/HTTPS 代理。

Use a TCP proxy that forwards a public port unchanged to Host port 7443. Preserve CodeAfar TLS; do not use an HTTP/HTTPS proxy that terminates or replaces its certificate.

# frpc.toml (on the Host)
[[proxies]]
name = "codeafar"
type = "tcp"
localIP = "127.0.0.1"
localPort = 7443
remotePort = 17443
$ codeafar pair create --json --endpoint wss://frp.example.com:17443/cap
在云服务器防火墙中只开放映射端口;优先限制来源 IP 或使用私有组网。Open only the mapped port on the server firewall; prefer source-IP restrictions or a private mesh.
!

端点必须以 wss:// 开头并以 /cap 结束。不要填写 0.0.0.0;它只用于 Host 监听。不要把一次性配对 JSON 发送给不受信任的人。

The endpoint must start with wss:// and end in /cap. Never enter 0.0.0.0; it is listen-only. Do not share one-time pairing JSON with anyone you do not trust.

4.1

在 App 中粘贴 JSONPaste JSON in the app

  1. 01

    在 Host 终端生成配对信息Create pairing data on the Host

    选择上面与你网络相符的命令。一次性密钥默认 5 分钟过期且只能成功使用一次。

    Use the command matching your network. The one-time secret expires after five minutes and succeeds only once.

  2. 02

    打开 CodeAfar 的 Pair hostOpen Pair host in CodeAfar

    首次启动直接进入配对;之后可从 Settings → Paired computers 添加 Host。

    First launch opens pairing directly; later use Settings → Paired computers.

  3. 03

    粘贴完整 JSON 并安全配对Paste the full JSON and pair securely

    App 会读取端点、验证证书指纹并创建设备签名身份。

    The app reads the endpoint, pins the certificate fingerprint, and creates a device signing identity.

4.2

需要临时改地址时,分开填写Enter routing separately when needed

$ codeafar pair create --json

不带 --endpoint 时,JSON 只包含端口、一次性密钥和指纹。随后在 App 的 “Reachable Host address” 填入当前可达地址,例如从局域网切换到组网 IP,而无需让 CLI 猜测网络环境。

Without --endpoint, JSON carries only the port, one-time secret, and fingerprint. Enter the current route in “Reachable Host address,” for example when switching from LAN to a mesh IP.

05 / SESSIONS

从 Host、目录到第一次指令。From Host and folder to the first instruction.

  1. 1
    点击 New task 并选择 HostSelect New task and choose a Host

    多 Host 环境下先确认在线状态与主机名。

    In a multi-Host setup, confirm the hostname and online state first.

  2. 2
    选择 Codex 或 Claude CodeChoose Codex or Claude Code

    Provider 在创建 Session 时固定;模型与 Effort 选项由 Host 实时返回。

    The provider is fixed when the session is created; models and effort options come from the Host.

  3. 3
    选择或创建工作区Select or create a workspace

    可见范围由 Host 的 Restricted roots 或 Full access 决定。

    Visible folders are controlled by the Host's restricted roots or full access.

  4. 4
    发送指令并跨设备继续Send an instruction and continue across clients

    消息、审批、工具活动与历史属于同一个 Host Session。Plan、Goal、Effort 等选项取决于所选 Provider 与版本;未支持的能力不会伪装为已完成。

    Messages, approvals, tool activity, and history belong to the same Host session. Plan, Goal, effort, and other options depend on the provider and version; unavailable capabilities are not represented as completed.

SHARED SESSIONS

同一项工作,在终端与 App 继续。Continue the same work in Terminal and the app.

在已经配置并运行 CodeAfar Host 的电脑上,以同一系统用户运行以下命令。目录必须位于 Host 的授权范围。Codex 使用原生终端界面连接共享 app-server;Claude 使用 CodeAfar 的共享终端入口,与 App 共用 Host 中的同一个 Claude 运行实例。

Run these as the same OS user on a configured, running CodeAfar Host. Choose an authorized folder. Codex opens its native TUI on the shared app-server; Claude uses the CodeAfar terminal front end attached to the same Host-owned Claude runtime as the apps.

$ codeafar run codex --cwd /path/to/project
$ codeafar run claude --cwd /path/to/project

继续已有会话时追加 --session SESSION_ID(用实际会话 ID 替换)。App 打开同一 Host 的同一会话后可查看增量输出;运行中的补充指令与停止操作绑定当前轮次,不会误发到下一轮。关闭终端连接不会主动停止 Host 中的任务。

Add --session SESSION_ID, replacing the placeholder with the existing session ID. Open the same session on the same Host in the app to see incremental progress. Supplementary instructions and Stop target the observed turn, never a later one. Detaching Terminal does not deliberately stop the Host task.

i

不是所有独立 CLI 都能被远程控制。直接运行的旧版 Codex、独立 Claude 或使用另一个运行实例的 Codex Desktop,可能只开放已经落盘的进度。CodeAfar 会同步可读取的历史,但不会伪装成可停止或可补充的连接。需要完整接力时请使用上述共享入口。模型、Effort、Speed 和 / 菜单以 Host 当前 Provider 实际开放的能力为准;没有 Fast 权限时不显示 Speed,Claude 不显示 Codex 专属 Goal。

Independent CLIs are not always remotely controllable.Older Codex versions, independent Claude processes or Codex Desktop using another runtime may expose persisted progress only. CodeAfar syncs readable history without pretending it can stop or steer those processes. Use the shared entry for full handoff. Model, Effort, Speed and slash commands follow the installed provider's capabilities. Speed is hidden without Fast availability; Claude does not show Codex-only Goal.

06 / ACCESS & SECURITY

地址负责路由,凭据负责信任。Endpoints route. Credentials establish trust.

WSSTLS 证书指纹固定TLS fingerprint pinning1×一次性配对密钥One-time pairing secretKEY设备签名认证Device signatures

配对 JSON 中的端点可以按网络环境变化,但 App 仍会校验 Host 证书指纹。会话数据通过已认证的加密通道传输。Provider 登录凭据不通过 App 配置;代码执行在 Host 上,您查看的对话、代码片段与附件会传到已配对 App。

The endpoint may change with the network, while the app still verifies the Host certificate fingerprint. Session data travels over an authenticated encrypted channel. Provider credentials are not configured through the app. Code executes on the Host; conversations, code excerpts, and attachments you view are transmitted to paired apps.

i

“Full access” 描述的是 Host 文件权限,并不绕过 Codex / Claude 自己的审批策略。使用公网 FRP 会扩大可扫描攻击面,应配合云防火墙来源限制,并及时撤销不再使用的配对设备。

“Full access” describes Host file scope and does not bypass provider approval policy. Public FRP increases the exposed attack surface; restrict source IPs and revoke devices you no longer use.

07 / CLI REFERENCE

为人设计默认输出,为自动化保留稳定 JSON。Readable by default, stable JSON for automation.

CodeAfar CLI 默认显示简洁状态、必要字段与下一步提示。命令组可直接运行:codeafar host 等同于查看状态,roots、devices、providers 直接列出当前内容。追加 --json 才会输出 App 和脚本使用的原始结构。

CodeAfar CLI defaults to concise status, essential fields, and next actions. Command groups work directly: codeafar host shows status, while roots, devices, and providers list their current state. Add --json only for app or script data.

开始与服务Setup & service
$ codeafar setup
$ codeafar host
$ codeafar host configure
$ codeafar host install
$ codeafar host start
$ codeafar host stop
权限与设备Access & devices
$ codeafar access
$ codeafar roots
$ codeafar roots remove ROOT_ID
$ codeafar pair list
$ codeafar pair revoke DEVICE_ID
Provider 与配对Providers & pairing
$ codeafar providers
$ codeafar pair create
$ codeafar pair create --json --endpoint wss://HOST:7443/cap
$ codeafar context status
维护与诊断Maintenance & diagnostics
$ codeafar update --check
$ codeafar doctor
$ codeafar logs --lines 200
$ codeafar logs --follow
$ codeafar version
7.1

全局输出选项Global output options

$ codeafar host status --json
$ codeafar doctor --quiet
$ codeafar host status --color never

--json 保持 stdout 为 JSON,失败时 stderr 返回带稳定 code、message 与 hint 的 JSON 错误;成功退出码为 0,参数或操作失败为非 0。--quiet 关闭成功提示,--verbose 开启诊断日志,--color auto|always|never 控制 ANSI 颜色并遵循 NO_COLOR。

--json keeps stdout as JSON and returns a JSON error with stable code, message, and hint on stderr. Success exits 0; argument or operation failures are non-zero. --quiet suppresses success output, --verbose enables diagnostics, and --color auto|always|never controls ANSI color while honoring NO_COLOR.

7.2

危险操作与无人值守脚本Destructive operations and scripts

Full access、移除授权根目录、撤销设备和卸载服务会在终端以默认 No 进行确认。只有已经审查过目标的无人值守脚本才应追加 --yes;--json 模式不会尝试读取交互输入。

Full access, root removal, device revocation, and service uninstall prompt with a default of No. Add --yes only in unattended scripts that have already validated the target; --json never tries to read an interactive response.

$ codeafar devices revoke DEVICE_ID --yes --json
7.3

代理、更新检查与补全Proxy, update checks, and completion

更新下载遵循 HTTPS_PROXY、HTTP_PROXY 和 NO_PROXY。后台只做低频可用性检查,不含遥测;可用 codeafar host configure --no-update-check 或环境变量 CODEAFAR_DISABLE_UPDATE_CHECK=1 关闭。Shell 补全可生成到标准输出。

Update downloads honor HTTPS_PROXY, HTTP_PROXY, and NO_PROXY. The background task performs only a low-frequency availability check with no telemetry; disable it with codeafar host configure --no-update-check or CODEAFAR_DISABLE_UPDATE_CHECK=1. Shell completions are generated on stdout.

$ codeafar completion zsh > ~/.zfunc/_codeafar
08 / TROUBLESHOOTING

先检查可达性,再检查身份。Check reachability, then identity.

Codex CLI 能用,但 CodeAfar 返回 403Codex CLI works but CodeAfar receives 403+

先查看错误原因。如果上游提示 This account only allows Codex official clients,说明该账户或网关拒绝第三方客户端,而不是配对失败。请让上游管理员允许 CodeAfar,或在 Host 上配置允许第三方 app-server 接入的账户。重新配对、反复发消息或重建会话都不能解除这项限制;CodeAfar 不会冒充官方客户端。其他 403 错误还需检查模型权限与账户状态。

If the upstream says This account only allows Codex official clients, its account or gateway policy rejects third-party clients. Ask the administrator to allow CodeAfar, or configure a permitted account on the Host. Re-pairing, resending, and recreating a session cannot remove this restriction. CodeAfar does not impersonate official clients. Other 403 errors may require checking model and account permissions.

配置了 Key,旧会话仍提示 Provider errorConfigured a key but an existing session still fails+

不要删除会话。先以 Host 服务的同一用户、同一项目目录运行 claude 或 codex 并发送一条测试消息,再在 App 的该 Host → AI providers 中点击 Check again。终端临时 export 的变量不会自动进入已经启动的后台服务;请在任务空闲后,于同一终端重新运行 codeafar host install 来安全刷新允许的 Provider/代理环境,或按 Provider 官方方式持久化登录。错误也可能是版本不兼容、代理不可达或额度不足,并不一定是 Key 错误。不要在 App、网站或问题报告里提交 Key。

Do not delete the session. Run the provider as the Host service user in the same workspace and send a test message, then choose Check again under that Host's AI providers. Variables exported in a terminal do not enter an already-running service. When tasks are idle, rerun codeafar host install from that terminal to refresh the allowed provider/proxy environment safely, or persist login using the provider's official setup. Version incompatibility, proxy access, and quota can also cause errors. Never submit keys to the app, website, or issue reports.

App 无法连接 HostThe app cannot reach the Host+

在 Host 运行 codeafar host status 和 codeafar doctor。确认 App 填写的是 Host 的局域网/组网地址或 FRP 入口,而不是 0.0.0.0、127.0.0.1 或 App 自己的 IP。再检查 TCP 7443 或映射端口是否可达。

Run codeafar host status and codeafar doctor. Ensure the app uses the Host LAN/mesh address or FRP gateway—not 0.0.0.0, 127.0.0.1, or the app device IP. Then verify TCP 7443 or the mapped port is reachable.

FRP 能连端口但配对失败FRP port is open but pairing fails+

确认代理类型为 TCP,并原样透传 CodeAfar TLS。HTTP/HTTPS 反向代理、CDN 或证书替换会导致指纹校验失败。重新生成包含公网 FRP 端点的配对 JSON。

Use a raw TCP proxy that preserves CodeAfar TLS. HTTP/HTTPS reverse proxies, CDNs, or certificate replacement break fingerprint verification. Create fresh pairing JSON with the public FRP endpoint.

配对码过期或已经用过The pairing code expired or was already used+

回到 Host 重新运行 codeafar pair create --json --endpoint ...。每个码仅供一台客户端成功配对一次。

Run codeafar pair create --json --endpoint ... again on the Host. Each code pairs one client successfully once.

Codex 或 Claude 显示不可用Codex or Claude is unavailable+

以运行 Host 的同一系统用户在终端执行 Provider CLI 并完成登录,再运行 codeafar doctor。没有安装 Claude 时 Codex 仍可独立使用。

Run and sign in to the provider CLI as the same OS user running the Host, then run codeafar doctor. Codex still works when Claude is not installed.

SSH 退出后 Host 离线The Host stops after SSH logout+

运行 codeafar host status。Linux 用户服务需要启用 linger 才能脱离登录会话持续运行;按状态输出中 Try 下方的一次性命令执行,再确认 Starts at boot 显示 yes。

Run codeafar host status. A Linux user service needs linger to remain alive outside a login session; run the one-time command printed under Try, then confirm Starts at boot says yes.

codeafar update 看起来没有进度codeafar update shows no progress+

先确认版本为 0.1.0-beta.42 或更新版本:codeafar version。新版会持续显示百分比、已下载大小、速率与预计时间,并自动重试。代理网络请设置 HTTPS_PROXY;进一步排查可运行 codeafar update --check --verbose。

Confirm 0.1.0-beta.42 or newer with codeafar version. Current builds continuously show percent, bytes, rate, and ETA with automatic retries. Set HTTPS_PROXY when required, then try codeafar update --check --verbose.

工作区为空或无法创建文件夹No workspace is available+

在 Host 本机运行 codeafar access status,并用 codeafar roots add /绝对路径 添加授权根目录。App 不能远程扩大 Restricted 模式的根目录。

Run codeafar access status on the Host and add a root with codeafar roots add /absolute/path. The app cannot remotely expand restricted roots.

仍然无法连接?Still cannot connect?

运行 codeafar doctor 与 codeafar logs --lines 200,保留脱敏输出和 App 错误信息。

Run codeafar doctor and codeafar logs --lines 200, then keep redacted output with the app error.

提交问题Open an issue →