连接 HTTP 远端
Graft 可以通过实现 remote service protocol 的服务 fetch 和 push repository objects。
wire contract 见与实现无关的
Remote Service 协议。本 repository 还提供
framework-neutral 的 @eidos.space/graft-remote protocol engine、
@eidos.space/graft-remote-hono routing adapter、可复用的
@eidos.space/graft-remote-cloudflare storage adapter,以及可部署的
Cloudflare reference service,源码位于
services/graft-remote-cloudflare;但 Graft 不会自动部署它。
配置 Remote
Section titled “配置 Remote”把 bearer token 放进进程环境,然后添加 remote:
export GRAFT_REMOTE_TOKEN='grt_...'graft remote add origin \ 'https://example.com/acme/archive'该 URL 与 Git HTTPS remote 一样保持简单。显式 alias
graft+https://example.com/acme/archive 选择同一 transport,并继续用于兼容。
如果 token 位于其他环境变量,使用 token_env:
export GRAFT_ARCHIVE_TOKEN='grt_...'graft remote add origin \ 'https://example.com/acme/archive?token_env=GRAFT_ARCHIVE_TOKEN'不要把 token 本身写进 URI 或 .graft/config.toml。
push 前先检查 URL 和远端 refs:
graft remote get-url origingraft ls-remote origingraft push origin main在另一个 worktree 中:
graft clone \ 'https://example.com/acme/archive' \ mainclone 进程需要使用同一个 token 环境变量。
本地协议开发
Section titled “本地协议开发”只在自己控制的本地服务中使用 graft+http://:
export GRAFT_REMOTE_TOKEN='dev-token'graft remote add origin \ 'graft+http://127.0.0.1:8787/acme/archive'生产环境应使用 HTTPS,并由服务端负责 repository authorization、object integrity、request limits 和 durable storage。
部署 Cloudflare Reference Service
Section titled “部署 Cloudflare Reference Service”verification service 负责组装三个 package。Cloudflare package 提供 authentication helper、每个 repository 一个 SQLite Durable Object 实现原子 ref,并用 R2 保存不可变 字节。service README 包含 bucket 创建、secret 配置、本地开发、测试和部署命令。
在其他平台使用 Hono 时,可以安装 @eidos.space/graft-remote-hono,挂载
createGraftRemote(),并实现 storage、authentication 和 authorization interface。
其他 framework 可以基于 @eidos.space/graft-remote 编写很薄的 routing adapter;core
package 不依赖 Hono 或 Cloudflare。
URI 语法见 Remote URI,分支同步流程见 远端同步。