replit

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Replit toolkit — one skill, four lanes

Replit 工具包——一个 skill,四条路径

Everything here is specific to running on a Replit/Nix workspace. The platform breaks normal Linux assumptions ($HOME wiped, /nix/store GC, npm firewall), and each lane below is a verified playbook for one job.
Read
references/platform.md
first if you are new to the box
— every other lane assumes its persistence rules.
You want to…ReadScripts
persist data/env/rc/git, understand what survives a restart, fix env-var plumbing
references/platform.md
setup.sh
,
replit_userenv.py
get a system lib that isn't installed (GTK, libatomic, any .so), debug
cannot open shared object file
references/nix.md
generate-closure.sh
,
libpool.sh
drive Playwright without downloading a browser (the box ships Chromium)
references/playwright-chromium.md
ensure_browser.sh
,
monitor.sh
,
browser_monitor.py
open bot-hardened sites (Cloudflare/Turnstile/WAF), keep logged-in Firefox sessions alive, agent browsing on Hermes (camofox MCP —
browser_exec
is broken here)
references/camofox.md
start-camofox.sh
,
camofox.py
Hermes-on-Replit recovery specifically (uv
--locked
trailing-slash failures, official Node ≥22 tarballs needing libatomic):
references/hermes-on-replit.md
.
以下内容均专用于在 Replit/Nix 工作区上运行。该平台会打破常规 Linux 假设($HOME 会被清空、/nix/store 会被 GC、npm 存在包防火墙),而下面的每条路径都是针对单一任务验证过的操作手册。
如果刚接触该环境,请先阅读
references/platform.md
——其他所有路径都以此处的持久化规则为前提。
你想要……阅读脚本
持久化数据、环境变量、rc 和 git,了解重启后哪些内容仍会保留,修复环境变量传递
references/platform.md
setup.sh
、
replit_userenv.py
获取尚未安装的系统库(GTK、libatomic、任意 .so),调试
cannot open shared object file
references/nix.md
generate-closure.sh
、
libpool.sh
无需下载浏览器即可驱动 Playwright(环境中已附带 Chromium)
references/playwright-chromium.md
ensure_browser.sh
、
monitor.sh
、
browser_monitor.py
访问针对机器人强化防护的站点(Cloudflare/Turnstile/WAF),保持已登录的 Firefox 会话,并在 Hermes 上进行 Agent 浏览(camofox MCP——此处的
browser_exec
无法正常工作)
references/camofox.md
start-camofox.sh
、
camofox.py
Hermes 在 Replit 上的专项恢复方案(uv
--locked
尾随斜杠错误、官方 Node ≥22 tarball 需要 libatomic):
references/hermes-on-replit.md
。

The platform in five facts (detail in platform.md)

平台的五个关键事实(详见 platform.md)

  1. $HOME
    (
    /home/runner
    ) is wiped on recreate;
    $REPL_HOME
    (
    /home/runner/workspace
    ) is persistent.
    Anything you want to survive lives under the workspace. The XDG vars are pre-set into the workspace, but do not trust that implicitly — check with
    printenv | grep XDG_
    .
  2. Everything system-level comes from
    /nix/store
    , and store paths get GC'd.
    A path that worked yesterday may not exist today; long-lived things need a durable copy outside the store (see nix.md, hermes-on-replit.md).
  3. $REPLIT_LD_LIBRARY_PATH
    is never enough
    for GUI browsers — you need the full transitive closure (nix.md §3;
    generate-closure.sh
    ).
  4. npm is behind a package firewall; pin
    --registry=https://registry.npmjs.org/
    .
  5. Replit ships a Playwright-managed Chromium —
    $REPLIT_PLAYWRIGHT_CHROMIUM_EXECUTABLE
    ; never
    playwright install
    .
  1. $HOME
    (
    /home/runner
    )会在重新创建时被清空;
    $REPL_HOME
    (
    /home/runner/workspace
    )则会持久保留。
    所有需要保留的内容都应放在 workspace 中。XDG 环境变量已预设到 workspace 中,但不要想当然地依赖这一行为——请通过
    printenv | grep XDG_
    检查。
  2. 所有系统级内容均来自
    /nix/store
    ,且 store 路径会被 GC。
    昨天可用的路径今天可能已不存在;需要长期保留的组件必须在 store 之外保存一份持久副本(参见 nix.md、hermes-on-replit.md)。
  3. 对于 GUI 浏览器,仅设置
    $REPLIT_LD_LIBRARY_PATH
    远远不够
    ——还需要完整的传递闭包(nix.md §3;
    generate-closure.sh
    )。
  4. npm 位于包防火墙之后;请固定使用
    --registry=https://registry.npmjs.org/
    。
  5. Replit 自带由 Playwright 管理的 Chromium——路径为
    $REPLIT_PLAYWRIGHT_CHROMIUM_EXECUTABLE
    ;切勿执行
    playwright install
    。

Scripts (flat, all in
scripts/
)

脚本(全部位于
scripts/
)

  • setup.sh
    — idempotent toolchain/env provisioning (node/uv/python pins, LD paths, rc chain); run it after any recreate.
    --doctor
    verifies installs + wiring read-only (exit 2 = wiring gaps);
    --fix
    rewrites ALL wiring (rc block, userenv, shim, ~/.profile, hermes shell_init_files, libatomic) with zero downloads/reinstalls — safe after a $HOME wipe or a partial recreate.
    --doctor --fix
    = report then repair. Re-running
    --fix
    is a byte-identical fixed point. Pitfall encoded in the script:
    --fix
    never execs the
    hermes
    launcher — any subcommand can boot the full source-update cycle (venv sync, npm build, GB-scale runtime clone). config.yaml is edited textually + verified instead.
  • replit_userenv.py
    — structural
    .replit [userenv]
    edits (tomlkit, no regex).
  • start-camofox.sh
    — one-command provision + launch of the Camoufox server.
  • camofox.py
    — the scraping CLI (open/nav/eval/screenshot, cookie import, keep-alive loop). See camofox.md for its env-file contract.
  • generate-closure.sh
    /
    libpool.sh
    — transitive lib closure (per-process) + pool healing (additive-only).
  • camofox_mcp_check.sh
    — one-shot MCP health probe (waits for REST, runs a real stdio handshake, asserts the 11
    camofox_*
    tools; exit 0 = live). Used by the
    .replit
    "camofox mcp" workflow — the adapter itself is stdio-only, running it standalone just idles forever.
  • ensure_browser.sh
    — idempotent CDP launcher for the bundled Chromium.
  • monitor.sh
    /
    browser_monitor.py
    — opt-in :5000 screenshot relay.
  • setup.sh
    — 幂等的工具链/环境预配置脚本(固定 node/uv/python 版本、LD 路径、rc 链);每次重新创建后都应运行。
    --doctor
    以只读方式验证安装与配置(退出码 2 = 配置存在缺口);
    --fix
    在不下载任何内容、不重新安装任何组件的情况下重写全部配置(rc 块、userenv、shim、
    ~/.profile
    、hermes shell_init_files、libatomic)——在 $HOME 被清空或工作区仅完成部分重新创建后仍可安全使用。
    --doctor --fix
    = 先报告再修复。重复运行
    --fix
    会得到字节完全一致的固定结果。 脚本中已编码这一注意事项:
    --fix
    绝不会执行
    hermes
    启动器——其任意子命令都可能启动完整的源码更新流程(venv 同步、npm 构建、GB 级运行时克隆)。因此改为以文本方式编辑 config.yaml 并进行验证。
  • replit_userenv.py
    — 以结构化方式编辑
    .replit [userenv]
    (使用 tomlkit,不使用正则表达式)。
  • start-camofox.sh
    — 通过一条命令完成 Camoufox 服务的配置与启动。
  • camofox.py
    — 抓取 CLI(open/nav/eval/screenshot、Cookie 导入、会话保活循环)。有关其环境文件约定,请参阅 camofox.md。
  • generate-closure.sh
    /
    libpool.sh
    — 传递式库闭包(按进程)+ 库池修复(仅执行增量添加)。
  • camofox_mcp_check.sh
    — 一次性 MCP 健康探测(等待 REST、执行真实的 stdio 握手、断言 11 个
    camofox_*
    工具;退出码 0 = 服务在线)。供
    .replit
    的 "camofox mcp" 工作流使用——适配器本身仅支持 stdio,单独运行它只会一直空转。
  • ensure_browser.sh
    — 用于内置 Chromium 的幂等 CDP 启动器。
  • monitor.sh
    /
    browser_monitor.py
    — 可选启用的 :5000 截图中继服务。

camofox.env.example

camofox.env.example

Every Camoufox-server tunable with its default; copy to
$CAMOFOX_ROOT/.env
(see camofox.md).
其中列出了 Camoufox 服务端的所有可调项及其默认值;请将其复制到
$CAMOFOX_ROOT/.env
(参见 camofox.md)。

Installing this skill pack

安装此 skill 包

One skill, one command:
bash
npx -y skills add skynight137/skills -s replit
一个 skill,一条命令:
bash
npx -y skills add skynight137/skills -s replit