calligraphy-composition

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Calligraphy Composition

书法合成

Retrieve running-script calligraphy for text or individual Chinese characters, inspect radicals and components, and synthesize missing glyphs when needed. For seal-script image recognition, use the separate
seal-script-ocr
skill.
检索文本或单个汉字的行书书法,分析偏旁部首与构件,并在需要时合成缺失字形。篆书图像识别请使用单独的
seal-script-ocr
skill。

Commands

命令

bash
cyeam mo guwen "兰亭序"                       # Retrieve glyphs for text
cyeam mo guwen "兰亭序" --ai-compose          # Synthesize missing glyphs only
cyeam mo char detail "之"                     # Original glyph candidates and sources
cyeam mo char composition "曦"               # Radicals and components
cyeam mo char compose "曦" --out char.png     # Force component-based synthesis
bash
cyeam mo guwen "兰亭序"                       # Retrieve glyphs for text
cyeam mo guwen "兰亭序" --ai-compose          # Synthesize missing glyphs only
cyeam mo char detail "之"                     # Original glyph candidates and sources
cyeam mo char composition "曦"               # Radicals and components
cyeam mo char compose "曦" --out char.png     # Force component-based synthesis

Glyph selection rules

字形选择规则

When asked to write, return, or display a character, look up an original glyph first; do not default to
char compose
.
  1. For one character, run
    cyeam mo char detail <char>
    and use an original glyph when candidates exist.
  2. For a passage, run
    cyeam mo guwen <text>
    . By default, it returns only original glyphs from the library; missing glyphs are empty.
  3. Use synthesis only when original candidates are absent, the passage contains missing glyphs, or the user explicitly requests component-based synthesis. Use
    guwen --ai-compose
    for text and
    char compose
    for a single character.
char compose
always forces component-based synthesis, even when a complete original glyph exists. For example, look up
char detail "无"
first; use
char compose "无"
only when component-based synthesis is appropriate.
当用户要求书写、返回或显示某个汉字时,必须先查找原始字形;不要默认使用
char compose
。
  1. 对于单个汉字,运行
    cyeam mo char detail <char>
    ;如果存在候选字形,则使用原始字形。
  2. 对于一段文本,运行
    cyeam mo guwen <text>
    。默认情况下,它只返回字库中的原始字形;缺失字形为空。
  3. 仅当不存在原始候选字形、文本中包含缺失字形,或用户明确要求基于构件合成时,才使用合成功能。文本使用
    guwen --ai-compose
    ,单个汉字使用
    char compose
    。
char compose
始终强制执行基于构件的合成,即使存在完整的原始字形。例如,应先查找
char detail "无"
;仅在适合基于构件合成时,才使用
char compose "无"
。

Image delivery

图片呈现

When the user wants to see a glyph or calligraphy image, embed the selected candidate's
image
URL as a Markdown image and include its
source
. Do not return only a URL.
md
「无」 — 王羲之《临锺繇千字文》

![无](https://res.cloudinary.com/.../word.webp)
The URLs from
char detail
point to original copybook images and can be embedded directly. Do not switch to
char compose
just to obtain a displayable image. Use an image link as a fallback only when the client cannot render Markdown images.
当用户希望查看某个字形或书法图像时,将所选候选字形的
image
URL 作为 Markdown 图片嵌入,并附上其
source
。不要只返回 URL。
md
「无」 — 王羲之《临锺繇千字文》

![无](https://res.cloudinary.com/.../word.webp)
char detail
返回的 URL 指向原始字帖图像,可以直接嵌入。不要仅为获得可显示的图像而切换到
char compose
。仅当客户端无法渲染 Markdown 图片时,才使用图像链接作为后备方案。

Output and scope

输出与适用范围

  • guwen
    ,
    char detail
    , and
    char composition
    write JSON to stdout.
  • char detail
    candidates include original glyph images and their sources.
  • char compose
    writes a PNG to the required
    --out
    path. It always synthesizes components and does not represent an original copybook glyph.
  • This workflow covers running script (行书), not regular script (楷书) or clerical script (隶书).
  • --ai-compose
    fills only missing glyphs; preserve existing original glyphs.
  • No login is required.
  • guwen
    、
    char detail
    和
    char composition
    将 JSON 写入 stdout。
  • char detail
    的候选结果包含原始字形图像及其来源。
  • char compose
    将 PNG 写入指定的
    --out
    路径。它始终合成构件,并不代表原始字帖字形。
  • 此工作流仅适用于行书,不适用于楷书或隶书。
  • --ai-compose
    仅填充缺失字形;保留已有的原始字形。
  • 无需登录。

Installation

安装

Review the commands before installing. These examples pin v1.1.4, rather than latest, and download an executable archive. Install only when the CLI is needed; do not reinstall for every command.
安装前请先检查这些命令。这些示例固定使用 v1.1.4,而非最新版本,并下载可执行文件归档。仅在需要 CLI 时安装;不要每次执行命令都重新安装。

macOS / Linux: verify and install in the user directory

macOS / Linux:在用户目录中验证并安装

Run in Bash or Zsh with
curl
,
tar
,
install
, and either
shasum
or
sha256sum
. The script selects macOS / Linux on arm64 or x86_64 and stops on other platforms.
bash
(
  set -eu
  version='v1.1.4'
  case "$(uname -s)/$(uname -m)" in
    Darwin/arm64)
      asset='cyeam_Darwin_arm64.tar.gz'
      sha256='06b5af004ab4f0f05d5829ea6bd18b97c4449c262af7df14c67175f7d3cb29db' ;;
    Darwin/x86_64)
      asset='cyeam_Darwin_x86_64.tar.gz'
      sha256='107342bb9d2fa444b96155c468e71b8cc63e0f5ad0acc784698afe221548efa6' ;;
    Linux/aarch64|Linux/arm64)
      asset='cyeam_Linux_arm64.tar.gz'
      sha256='ed87697f3948bead67b585e9881c3bef20e8d2d903beb5b125587281a5091c5b' ;;
    Linux/x86_64)
      asset='cyeam_Linux_x86_64.tar.gz'
      sha256='873d6805fab8ab56540bb034aaf2f57f12eb672fcabd322ebe401e8250a5966d' ;;
    *) echo 'Unsupported platform; see the pinned release.' >&2; exit 1 ;;
  esac
  workdir=$(mktemp -d)
  trap 'rm -rf "$workdir"' EXIT
  cd "$workdir"
  curl --fail --show-error --silent --location --proto '=https' --proto-redir '=https' \
    --output "$asset" "https://github.com/mnhkahn/cyeam-cli/releases/download/$version/$asset"
  printf '%s  %s\n' "$sha256" "$asset" > expected.sha256
  if command -v sha256sum >/dev/null 2>&1; then
    sha256sum -c expected.sha256
  else
    shasum -a 256 -c expected.sha256
  fi
  # set -e prevents extraction or installation if download or verification fails.
  tar -xzf "$asset" cyeam
  mkdir -p "$HOME/.local/bin"
  install -m 0755 cyeam "$HOME/.local/bin/cyeam"
  CYEAM_CLI_NO_UPDATE_NOTIFIER=1 "$HOME/.local/bin/cyeam" --no-analytics version
)
This writes only to a temporary directory and
~/.local/bin/cyeam
(replacing an existing binary). No administrator privileges are needed; system directories, services, and shell configuration are unchanged. For the current shell:
bash
export PATH="$HOME/.local/bin:$PATH"
For persistent access, add that line to your shell configuration. Check the v1.1.4 release page and checksums.txt for checksums. When changing the pinned version, verify and replace both the version and its SHA-256 values. Checksums confirm release-file consistency; they are not an independent signature or security audit.
在 Bash 或 Zsh 中运行,需要使用
curl
、
tar
、
install
,以及
shasum
或
sha256sum
中的任意一种。
该脚本会根据 arm64 或 x86_64 架构选择适用于 macOS / Linux 的版本,并在其他平台上停止运行。
bash
(
  set -eu
  version='v1.1.4'
  case "$(uname -s)/$(uname -m)" in
    Darwin/arm64)
      asset='cyeam_Darwin_arm64.tar.gz'
      sha256='06b5af004ab4f0f05d5829ea6bd18b97c4449c262af7df14c67175f7d3cb29db' ;;
    Darwin/x86_64)
      asset='cyeam_Darwin_x86_64.tar.gz'
      sha256='107342bb9d2fa444b96155c468e71b8cc63e0f5ad0acc784698afe221548efa6' ;;
    Linux/aarch64|Linux/arm64)
      asset='cyeam_Linux_arm64.tar.gz'
      sha256='ed87697f3948bead67b585e9881c3bef20e8d2d903beb5b125587281a5091c5b' ;;
    Linux/x86_64)
      asset='cyeam_Linux_x86_64.tar.gz'
      sha256='873d6805fab8ab56540bb034aaf2f57f12eb672fcabd322ebe401e8250a5966d' ;;
    *) echo 'Unsupported platform; see the pinned release.' >&2; exit 1 ;;
  esac
  workdir=$(mktemp -d)
  trap 'rm -rf "$workdir"' EXIT
  cd "$workdir"
  curl --fail --show-error --silent --location --proto '=https' --proto-redir '=https' \
    --output "$asset" "https://github.com/mnhkahn/cyeam-cli/releases/download/$version/$asset"
  printf '%s  %s\n' "$sha256" "$asset" > expected.sha256
  if command -v sha256sum >/dev/null 2>&1; then
    sha256sum -c expected.sha256
  else
    shasum -a 256 -c expected.sha256
  fi
  # set -e prevents extraction or installation if download or verification fails.
  tar -xzf "$asset" cyeam
  mkdir -p "$HOME/.local/bin"
  install -m 0755 cyeam "$HOME/.local/bin/cyeam"
  CYEAM_CLI_NO_UPDATE_NOTIFIER=1 "$HOME/.local/bin/cyeam" --no-analytics version
)
这只会写入临时目录和
~/.local/bin/cyeam
(替换已有二进制文件)。 无需管理员权限;不会更改系统目录、服务或 shell 配置。对于当前 shell:
bash
export PATH="$HOME/.local/bin:$PATH"
如需长期使用,将该行添加到 shell 配置中。 查看 v1.1.4 发布页面 和 checksums.txt 以获取校验和。更换固定版本时,必须同时验证并替换版本号及其 SHA-256 值。 校验和只能确认发布文件的一致性,不能替代独立签名或安全审计。

External requests and local state

外部请求与本地状态

  • Installation: Downloads the selected archive from a pinned GitHub release, which may redirect to GitHub's asset CDN. Verifies the pinned SHA-256 before extracting only
    cyeam
    . Installation verification disables analytics and update checks.
  • Calligraphy queries:
    mo guwen
    and
    mo char detail/composition/compose
    send the selected text, font, and synthesis options to
    https://www.cyeam.com/mo/api/*
    . Synthesized images are written to
    --out
    , which may overwrite an existing file. Original images may come from Cloudinary or another image CDN; displaying them requests their URLs.
  • Analytics: By default, sends command names, CLI version, system information, and a random installation ID to
    https://us.i.posthog.com
    . The server may infer location from the outgoing IP. Command arguments, image contents, and credentials are not included. The ID is stored in
    ~/.cyeam/analytics-id
    ; disable with
    --no-analytics
    or
    CYEAM_CLI_NO_ANALYTICS=1
    .
  • Update notices: Checks GitHub for the latest release at most once every 24 hours and caches state in
    ~/.cyeam/update-state.json
    . Notices do not replace the executable. Set
    CYEAM_CLI_NO_UPDATE_NOTIFIER=1
    to disable. The explicit
    cyeam update
    command downloads and verifies the latest release, replaces the executable, and then attempts to sync skills through
    npx skills add
    . To remain on a pinned version, use the installation steps above instead.
To keep only the network requests required for this skill in the current shell:
bash
export CYEAM_CLI_NO_ANALYTICS=1
export CYEAM_CLI_NO_UPDATE_NOTIFIER=1
  • 安装: 从固定版本的 GitHub Release 下载所选归档,重定向后可能会指向 GitHub 的资源 CDN。解压前验证固定的 SHA-256,并且只提取
    cyeam
    。用于安装验证的命令会禁用分析功能和更新检查。
  • 书法查询:
    mo guwen
    和
    mo char detail/composition/compose
    会将所选文本、字体及合成选项发送至
    https://www.cyeam.com/mo/api/*
    。合成图像会写入
    --out
    ,可能覆盖现有文件。原始图像可能来自 Cloudinary 或其他图像 CDN;显示它们会请求相应 URL。
  • 分析数据: 默认向
    https://us.i.posthog.com
    发送命令名称、CLI 版本、系统信息和随机安装 ID。服务器可能会根据出口 IP 推断位置。不会发送命令参数、图像内容和凭据。该 ID 存储在
    ~/.cyeam/analytics-id
    中;可使用
    --no-analytics
    或
    CYEAM_CLI_NO_ANALYTICS=1
    禁用。
  • 更新通知: 最多每 24 小时检查一次 GitHub 上的最新 Release,并将状态缓存到
    ~/.cyeam/update-state.json
    。通知不会替换可执行文件。可通过
    CYEAM_CLI_NO_UPDATE_NOTIFIER=1
    禁用。显式的
    cyeam update
    命令会下载并验证最新 Release,替换可执行文件,然后尝试通过
    npx skills add
    同步 skills。若要保持固定版本,请改用上述安装步骤。
若要在当前 shell 中仅保留此 skill 所需的网络请求:
bash
export CYEAM_CLI_NO_ANALYTICS=1
export CYEAM_CLI_NO_UPDATE_NOTIFIER=1