npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

ai-relay-cli

v0.1.2

Published

Universal backup, export, import, and restore for AI coding CLI sessions.

Readme

AI Relay

English | 简体中文 | 日本語 | 한국어

AI Relay 海报

airelay 用于备份、恢复、检查和迁移本地 AI Coding CLI 会话。

当前默认模式是 V1.1 本地优先:

  • 检测 Claude Code 和 Codex CLI
  • 本地导出、导入、备份、恢复
  • 检查备份内容
  • 列出本地会话
  • 导出单个会话
  • 导入默认不覆盖本机文件
  • 每次导入前自动创建回滚快照
  • 支持空配置
  • V2 云同步需要显式配置存储后才会启用

为什么需要

AI Coding 工具会把有价值的会话历史保存在本机。换电脑、重装环境或做高风险操作前,如果手工复制 .claude.codex 目录,很容易漏文件或覆盖错内容。

AI Relay 把这个流程变成可重复的 CLI 工作流:

airelay export --output backup.zip
airelay import backup.zip
airelay rollback

默认导出只包含 session/history 数据。auth.json、token、凭证、配置文件、.env.pem.key、cache、tmp、logs、plugins 等隐私敏感文件会被排除。

从 npm 安装

安装已发布的 npm 包:

npm install -g ai-relay-cli

然后运行:

airelay doctor
airelay export
airelay inspect backup_2026-07-07.zip
airelay import backup_2026-07-07.zip

在交互式终端中运行时,AI Relay 最多每 24 小时检查一次 npm 稳定版更新。JSON 输出、CI、非交互命令和离线失败都会静默跳过;可设置 AIRELAY_NO_UPDATE_CHECK=1 显式关闭。

本地构建

用于本地开发:

npm install
npm run build
npm link

然后运行 link 后的命令:

airelay doctor
airelay export
airelay inspect backup_2026-07-07.zip
airelay import backup_2026-07-07.zip

不 link 也可以运行:

node dist/index.js doctor
node dist/index.js export --yes

常用流程

创建备份:

airelay export --output backup.zip

只导出某一个客户端:

airelay export --only claude --output claude-backup.zip --yes
airelay export --only codex --output codex-backup.zip --yes

导出指定会话:

airelay export --session claude:projects/my-project/session.jsonl

恢复前检查备份:

airelay inspect backup.zip

不覆盖本机文件地恢复:

airelay import backup.zip

换电脑时重写项目路径:

airelay import backup.zip --map-path /Users/alice/work=/Users/bob/dev

回滚到导入前的快照:

airelay rollback

命令

airelay doctor
airelay ls
airelay export
airelay export --session claude:projects/my-project/session.jsonl
airelay inspect backup.zip
airelay import backup.zip
airelay import backup.zip --map-path /Users/alice/work=/Users/bob/dev
airelay import backup.zip --overwrite
airelay rollback
airelay rollback --list

别名:

airelay backup
airelay restore backup.zip

V2 命令会在显式配置存储后才启用:

airelay push
airelay pull
airelay sync backup_2026-07-08.zip --yes

安全模型

airelay 默认采用本地优先和保守策略。

  • 默认导出只包含 session/history 数据。
  • Claude 默认覆盖 projectssessionsconversations 和根目录 history.jsonl;Codex 默认覆盖 sessionsarchived_sessions、根目录 history.jsonlsession_index.jsonl
  • --full 会导出更完整的非敏感客户端数据,但仍会排除隐私敏感文件。
  • 导入默认保留本机已有文件,除非显式传入 --overwrite
  • 每次导入前,airelay 会在 ~/.airelay/rollbacks/ 下创建回滚快照。
  • rollback --list 可查看可用快照,方便自动化或手动恢复。

导出更完整的非敏感数据:

airelay export --full

自动化场景:

airelay rollback --list
airelay rollback pre_import_20260707T150000Z --yes

配置

airelay 会先读取当前目录配置,再读取用户配置目录:

  • ./airelay.config.yml
  • ./airelay.config.yaml
  • ./airelay.config.json
  • ~/.airelay/config.yml
  • ~/.airelay/config.yaml
  • ~/.airelay/config.json

使用指定配置文件:

airelay --config /path/to/config.yml ...

配置是可选的。空配置等价于:

version: "1.1"
storage:
  type: local
cloud_sync:
  enabled: false

最小 MinIO/S3 兼容配置:

version: "2"
storage:
  type: s3
  bucket: airelay
  region: us-east-1
  endpoint: http://127.0.0.1:9000
  prefix: backups
  access_key_id: minioadmin
  secret_access_key: minioadmin
  force_path_style: true
cloud_sync:
  enabled: true

上传已有备份:

airelay push backup_2026-07-08.zip

下载并恢复备份:

airelay pull backup_2026-07-08.zip

把远程备份合并到本机会话,重新导出合并结果,并覆盖同一个远程对象:

airelay sync backup_2026-07-08.zip --yes

由于最后一步会替换选中的远程对象,非交互场景执行 sync 时必须显式传入 --yes

推广文案

AI Relay
把 AI Coding 会话安全带到下一台电脑
本地优先 / 隐私友好 / 可回滚

短文案:

换电脑不用再手工复制 .claude 和 .codex。AI Relay 帮你导出、检查、恢复和回滚 AI Coding 会话。

海报规格见 spec.md