asciinema
$ asciinema 官方出品 中风险asciinema 将终端会话捕获为紧凑的带时间戳 NDJSON .cast 文件,替代体积庞大的视频录制。Agent 可使用 asciinema rec -c 录制脚本命令、通过 asciinema convert -f txt 去除 ANSI 转义符提取纯文本,并用 asciinema cat 拼接多个录制文件。
brew install asciinema 使用 -c 录制非交互命令并通过 asciinema convert -f txt 提取纯文本记录均属于本地 shell 工作流。
Agent 友好度体检单
当前为静态评估(本机尚未安装或尚未运行探针)。可在本地运行 npm run data:probe 并提交 data/probes/ 升级为实测证据。
FCRS-1.0 六维评分拆解
.cast 原生采用 NDJSON 格式且 convert -f txt 输出整洁文本,但未传 -c 的 rec 会启动交互式 shell 且 play 依赖 TTY。
.castoutput is native NDJSON;convert -f txtstrips escape codesrecwithout filename prompts to upload;playis interactive
未指定文件名直接运行 asciinema rec 会在结束时提示上传至 asciinema.org,存在意外泄露终端敏感信息的风险。
uploadand interactivereccan send terminal captures to remote servers
可通过 Homebrew、Cargo 与 Linux 包安装,但因依赖 POSIX PTY 而不支持原生 Windows。
- macOS and Linux support only; requires POSIX PTY
极小巧的纯文本 .cast 制品可替代数兆字节录屏,并可无损转换为文本、原始流或 v2/v3 格式。
- Supports
rec,convert,cat,play, andstream
asciinema 官方 CLI(asciinema/asciinema),v3 起基于 Rust 重写并采用 GPL-3.0-or-later。
- Official
asciinema/asciinemaGitHub repository
docs.asciinema.org 文档与内置 --help 清晰,但老旧 Linux 发行版上的 v2(Python)与 v3(Rust)在 cat 等子命令上存在差异。
- Official CLI docs at docs.asciinema.org/manual/cli/usage
安全边界、鉴权与放权指南
可选将 asciinema.org 的安装 ID 与认证信息保存在 ~/.config/asciinema/config.toml(仅 asciinema upload / auth 需要)。
免费,基于 GPL-3.0-or-later 协议的开源 Rust CLI(asciinema v3+)。
# asciinema Agent Rules - Always pass an explicit local `<filename>.cast` and `-c "<command>"` on `asciinema rec` so it neither spawns an interactive shell nor prompts to upload. - Never run `asciinema upload` or `asciinema stream` without explicit user consent, as terminal output may contain secrets.
Agent 高频安全命令配方
只读查询(安全推荐)
asciinema convert -f txt demo.cast -
剥离 ANSI 转义序列与时间戳元数据,向标准输出输出可读的文本记录。
受控写入与预演
asciinema rec --overwrite -c "ls -la" demo.cast
将 ls -la 的完整输出与时序捕获至 demo.cast,不触发交互提示或上传。
核心优势
- + 原生 NDJSON
.cast格式与asciinema convert -f txt让终端录屏极易被 Agent 检查分析。 - +
asciinema rec -c "..." out.cast可干净地自动化捕获单条命令过程。
注意事项与踩坑点
- ! 不支持 Windows(依赖 POSIX PTY);部分旧 Linux 发行版仍自带 v2,
cat行为与 v3 不同。 - ! 未提供文件名与
-c参数时运行asciinema rec会进入交互 shell 并在退出时询问上传。