CLI 目录 横向对比 FCRS-1.0 标准 /llms.txt
← 返回 CLI 目录

Typst

$ typst 官方出品 低风险
Typst GmbH · 设计与文档排版 · Apache-2.0 · macos / linux / windows

Typst(typst)是一款高速可编程排版系统,旨在替代 LaTeX 生成技术报告、论文与账单。采用 Rust 编写,单二进制即可将 .typ 文件编译为 PDF、SVG 或 PNG,并通过 typst query 以 JSON 提取标题与元数据。

FCRS-1.0 综合评分
93 /100
极佳 (Excellent)
中置信度 (源码/文档)
零摩擦安装命令
brew install typst
CLI vs MCP 选型建议 仅 CLI 可用

Typst 可在毫秒内将本地 .typ 文件编译为 PDF/SVG/PNG 并提供 typst query JSON 检索,直接作为 CLI 使用即可。

Agent 友好度体检单

✓ 原生 JSON 输出
— 字段裁剪
✓ 无头非交互
— 支持 Dry-Run
— 只读模式开关
✓ 支持 NO_COLOR
✓ 自省/Schema 发现
— 官方 SKILL.md

当前为静态评估(本机尚未安装或尚未运行探针)。可在本地运行 npm run data:probe 并提交 data/probes/ 升级为实测证据。

FCRS-1.0 六维评分拆解

Agent 友好度 23 / 25

单遍 typst compile 与支持 JSON 输出的 typst query,报错信息精准且退出码确定,完全无交互提示。

  • typst query emits structured JSON for any selector
  • Deterministic millisecond compilation without multi-pass LaTeX reruns
安全与权限边界 23 / 25

文件访问受 --root 沙箱限制,且不存在类似 LaTeX --shell-escape 的任意命令执行风险。

  • No --shell-escape arbitrary code execution risk
  • --root confines file reads to the project directory
安装与运行摩擦 15 / 15

单个自包含 Rust 二进制,无需动辄数 GB 的 TeX 发行版,可通过 Homebrew、Cargo 或二进制包安装。

  • brew install typst and cargo install --locked typst-cli
能力覆盖与边际价值 14 / 15

在 Agent 生成 PDF、技术报告和图表方面比 LaTeX 更快、更简洁且更易纠错。

  • Supports PDF, SVG, PNG output and structured query introspection
维护与来源背书 9 / 10

Typst GmbH 官方仓库(typst/typst)以 Apache-2.0 协议高频迭代。

  • Official Typst GitHub organization
文档与可验证性 9 / 10

typst.app/docs 官方文档清晰现代,编译器错误提示极为友好。

  • Official docs at typst.app/docs/

安全边界、鉴权与放权指南

鉴权方式
无需鉴权
凭证存储位置

无需任何凭据;纯离线编译器,仅在系统缓存目录保存可选的第三方包缓存。

潜在副作用
只读查询 本地写入
费用与配额提示

CLI 开源免费(Apache-2.0);Typst 可选的在线协作 Web 平台提供免费版与付费版。

可复制到 CLAUDE.md / AGENTS.md 的安全护栏
# Typst CLI Agent Rules
- Run `typst compile` rather than `typst watch` in synchronous agent turns.
- Pin `--root` to the project directory when compiling untrusted `.typ` files.
- Use `typst query` to verify document structure or metadata programmatically.

Agent 高频安全命令配方

只读查询(安全推荐)

以 JSON 查询文档标题结构
typst query main.typ "heading"

求值 Typst 文档并将匹配的标题或元素以结构化 JSON 输出,不写入文件。

列出系统与内置可用字体
typst fonts

列举 Typst 在本地发现的所有字体家族。

受控写入与预演

将 Typst 文档编译为 PDF
typst compile main.typ dist/main.pdf

将 main.typ 确定性地编译输出到 dist/main.pdf。

核心优势

  • + 毫秒级单文件 Rust 编译器,彻底省去数 GB 体积的 TeX Live 环境。
  • + typst query 可直接以干净 JSON 提取文档标题、标签与元数据。
  • + 基于 --root 的沙箱机制杜绝编译期的任意 Shell 执行风险。

注意事项与踩坑点

  • ! typst watch 会持续阻塞监听,不适合同步调用。
  • ! 首次编译引用 @preview/... 社区包时需联网拉取到本地缓存。

已验证兼容的 Agent 宿主

Claude Code Codex CLI Gemini CLI