Skip to content
Apothem
运维手册

跨主机同步验证清单

用于在全新主机上确认 Claude Code 适配器能够正确安装、校验并卸载的验证流程,包含完整的可移植性检查。

范围。 本清单用于在全新的第二台主机上验证 Claude Code 适配器 的安装 / 卸载可移植性层。其他工具的逐主机验证方案记录在 site/content/docs/harnesses/<harness>.mdx 下。

两条路径,两种角色。 阅读本清单时请将二者区分开来。$HOME/.apothem 是 引擎主目录——源码树克隆至此,安装器也从此处读取,可通过 APOTHEM_HOME 覆盖。~/.claude/ 是 Claude Code 配置根目录——适配器的输出表面,物化后的 settings.json 与支持子树落在此处。引擎绝不会安装到 ~/.claude/ 中;在验证其他工具时,请替换为该适配器原生的输出路径。

由操作员驱动,在全新的第二台主机上验证安装 / 卸载可移植性层。 发布层级(vX.Y.Z)是在单台 Windows 主机上编写的;可移植性声明(CLAUDE.md portability: universal)需要在第二台主机上完成端到端演练,多主机不变量才具有分量。本清单即标准的第二台主机验证方案(Claude Code 适配器)。


1. 第二台主机的前置条件

在开始验证之前,请先在第二台主机上运行:

项目命令预期
已安装 Gitgit --versionGit 2.40+
可用的 Python 3.10+python3 --version(POSIX)或 py -3 --version(Windows)3.10 / 3.11 / 3.12 / 3.13
GitHub 认证(可选,用于经认证的克隆 / API 检查)gh auth status使用经认证的工作流时,以仓库授权账户登录
可用的 Shellbash --version(POSIX)或 pwsh --version(Windows)Bash 4+ 或 PowerShell 7+
不存在已有的引擎主目录ls "$HOME/.apothem" 2>&1"No such file or directory" — 如果存在,请先备份再继续

2. 克隆并安装验证

在第二台主机上执行:

# Clone the published repo to the engine home. This is NOT ~/.claude — that
# is the Claude Code configuration root the adapter writes into, and cloning
# a source tree on top of it would bury the harness's own config.
git clone https://github.com/ahmed-g-gad/apothem.git "$HOME/.apothem"
cd "$HOME/.apothem"

# (POSIX path) Run scripts/installer/install.sh dry-run first
bash scripts/installer/install.sh --dry-run                                    # exit 0; prints Dry-run complete — no changes were made.

# (POSIX path) Run scripts/installer/install.sh for real
bash scripts/installer/install.sh                                               # exit 0; idempotent

# (Windows path) PowerShell parallel
pwsh -File scripts/installer/install.ps1 -DryRun                                # exit 0; prints Dry-run complete - no changes were made.
pwsh -File scripts/installer/install.ps1                                        # exit 0

记录每条命令的退出码与标准输出横幅,并记录到 <second-host>/.audit/cross-machine-clone-install.md。

3. 四要素纪律(依据 src/apothem/rules/production-ready-prs.md)

在第二台主机上逐项验证以下四条不变量:

3.1 既有目标安全

# Re-run installer at the same destination.
bash scripts/installer/install.sh                                               # POSIX
pwsh -File scripts/installer/install.ps1                                        # Windows

预期: 安装器检测到已存在的引擎主目录,在其中检出发布标签,而非重新安装或重复安装;退出码 0。

3.2 前置条件已检查

# Run from a copy outside any checkout, with git not on PATH.
d="$(mktemp -d)" && cp scripts/installer/install.sh "$d/" && PATH=<directory holding python3, click, rich and coreutils, but no git> /bin/sh "$d/install.sh"                            # POSIX (no git)

预期: 安装器拒绝运行,并输出明确的 "git not found" 诊断信息;退出码非零。

3.3 幂等重复运行

# Run installer N times back-to-back.
for i in 1 2 3 4 5; do bash scripts/installer/install.sh; done                  # POSIX
1..5 | ForEach-Object { pwsh -File scripts/installer/install.ps1 }              # Windows

预期: 每次调用都以退出码 0 结束;首次调用之后无副作用;无重复文件;不会重复写入 shell 配置文件(RC)。

3.4 可通过环境变量配置

# Install to a non-default engine home. APOTHEM_HOME is the destination
# override the installers actually read; see the installer-environment-variables
# reference for the full set.
APOTHEM_HOME=/tmp/alt-apothem bash scripts/installer/install.sh                 # POSIX
$env:APOTHEM_HOME='C:\tmp\alt-apothem'; pwsh -File scripts/installer/install.ps1   # Windows

预期: 安装器遵循该环境变量;默认的 $HOME/.apothem 不会被创建;备用目标位置包含预期的布局。

4. 校验器套件验证(安装后)

cd "$HOME/.apothem"
make validate                                                 # conformity gate --all --strict; exit 0
make headers-doctor                                           # file-header-grep → passed:true
make ai-surfaces-doctor                                       # multi-surface-coherence → passed:true
make plans-doctor                                             # no-global-plans + plans-discipline-language
make lint                                                     # ruff check + ruff format --check + mypy
make test                                                     # exit 0, no failures

预期: 每道闸门均通过。记录退出码与摘要行。

5. 卸载验证

# POSIX path — interactive uninstall
bash scripts/installer/uninstall.sh                           # answers: "y" to confirm
PYTHONPATH="$HOME/.apothem/src/apothem/_vendor:$HOME/.apothem/src" python3 -m apothem verify --harness claude-code    # reports the harness as not installed

# Re-install from the kept checkout, then uninstall non-interactively
bash scripts/installer/install.sh
bash scripts/installer/uninstall.sh --yes
PYTHONPATH="$HOME/.apothem/src/apothem/_vendor:$HOME/.apothem/src" python3 -m apothem verify --harness claude-code    # reports the harness as not installed

预期: 交互式流程会给出提示;--yes 在批量运行时跳过提示;两种流程之后,Claude Code 配置根目录中都不再残留 Apothem 物化的文件;apothem 垫片会被移除(~/.local/bin/apothem;%LOCALAPPDATA%\Microsoft\WindowsApps 中的 apothem.cmd 垫片仅由 uninstall.ps1 移除)。

6. 安全护栏验证

卸载程序的护栏是源码树形状检查,而非哨兵文件:只有当目标同时包含 src/apothem/ 以及 pyproject.toml 或 .claude-plugin/ 之一时,才会继续执行。请使用 APOTHEM_HOME 驱动这些探针——即脚本所读取的变量。若探针针对的是脚本会忽略的变量,它便无法检验护栏,反而会针对你的真实安装运行卸载程序。

# Run uninstall against a directory that is not an apothem source tree.
mkdir -p /tmp/not-an-apothem-install
APOTHEM_HOME=/tmp/not-an-apothem-install bash scripts/installer/uninstall.sh --yes

预期: 卸载程序拒绝执行,并输出 No apothem source found at /tmp/not-an-apothem-install — nothing to uninstall;退出码非零。该路径未被触碰。

# Run uninstall against $HOME and /.
APOTHEM_HOME=$HOME bash scripts/installer/uninstall.sh --yes 2>&1 | tail -3
APOTHEM_HOME=/ bash scripts/installer/uninstall.sh --yes 2>&1 | tail -3

预期: APOTHEM_HOME=$HOME 与 APOTHEM_HOME=/ 均以 No apothem source found at … 诊断拒绝执行,且二者都不会触碰文件系统。空的 APOTHEM_HOME 有意不纳入此检查:它会回退到 ~/.apothem,而真实安装可能就位于该处。

# An explicit APOTHEM_SOURCE that is not a source tree is rejected separately.
APOTHEM_SOURCE=/tmp/not-an-apothem-install bash scripts/installer/uninstall.sh --yes

预期: 以 APOTHEM_SOURCE is not an apothem source tree: /tmp/not-an-apothem-install 拒绝执行;退出码非零。

7. 报告

完成第二台主机上的运行后,请将结果记录到:

  • <second-host>/.audit/cross-machine-clone-install.md(克隆与安装命令的结果)
  • <second-host>/.audit/cross-machine-validators.md(第 4 节校验器结果)
  • <second-host>/.audit/cross-machine-uninstall.md(第 5–6 节卸载与安全结果)

向维护者反馈发现的问题:

  • ✅ 四要素纪律的全部不变量成立,全部校验器闸门均通过,且全部卸载安全护栏均拒绝了不安全的目标 → 发布的 portability: universal 声明已完成端到端验证
  • ❌ 任何失败 → 请在 https://github.com/ahmed-g-gad/apothem/issues/new 提交工单,附上失败的章节与捕获的输出;由维护者分诊

8. 验收标准

  • §1 前置条件已满足
  • §2 克隆并安装在 POSIX 与 Windows 两种 Shell 上均成功
  • §3 四要素纪律成立(既有目标安全;前置条件已检查;幂等;可通过环境变量配置)
  • §4 每道校验器闸门均通过
  • §5 交互式卸载成功;--yes 无需提示即可成功
  • §6 每一道安全护栏的拒绝均被触发
  • §7 结果已记录至文档中的审计路径

当上述每一项在全新的第二台主机上都被勾选后,跨机器同步验证即告完成,portability: universal 声明即已完成端到端验证。

On this page