cnote

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

云端笔记

Cloud Notes

概述

Overview

在 OneDrive
Notes
文件夹中管理 HTML 笔记。需要先登录 Microsoft 账号(登录方式见 cyeam-cli skill 的"登录方式")。
bash
cyeam cnote list                     # 列出所有笔记
cyeam cnote get "笔记标题"            # 查看(默认 markdown 格式)
cyeam cnote get "笔记标题" --format text
cyeam cnote new "笔记标题" < note.html
cyeam cnote append "笔记标题" < more.html
Manage HTML notes in the OneDrive
Notes
folder. You must first sign in with a Microsoft account (see "Sign-in method" in the cyeam-cli skill).
bash
cyeam cnote list                     # 列出所有笔记
cyeam cnote get "笔记标题"            # 查看(默认 markdown 格式)
cyeam cnote get "笔记标题" --format text
cyeam cnote new "笔记标题" < note.html
cyeam cnote append "笔记标题" < more.html

安装

Installation

安装前先阅读下面的命令。示例固定为 v1.1.4,不跟随 latest;下载的是可执行程序归档。 仅在需要安装 CLI 时执行,不要在每次调用命令时重复安装。
Before installing, read the commands below. The examples are pinned to v1.1.4 and do not follow
latest
; the downloaded file is an executable archive. Run these steps only when you need to install the CLI; do not repeat the installation every time you invoke a command.

macOS / Linux:校验后安装到用户目录

macOS / Linux: Verify and install to the user directory

在 Bash 或 Zsh 中执行;需要
curl
、
tar
、
install
,以及
shasum
或
sha256sum
。 脚本自动选择 macOS / Linux 的 arm64 或 x86_64,其他平台会停止。
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 '不支持的平台,请查看固定版本的 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 确保下载或校验失败时,不会解压或安装。
  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。 摘要用于核对发布文件一致性,不等同于独立签名或安全审计。
Run in Bash or Zsh;
curl
,
tar
,
install
, and either
shasum
or
sha256sum
are required. The script automatically selects arm64 or x86_64 on macOS/Linux 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 '不支持的平台,请查看固定版本的 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 确保下载或校验失败时,不会解压或安装。
  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
)
The script writes only to a temporary directory and
~/.local/bin/cyeam
(an existing executable with the same name is replaced). It requires no administrator privileges and does not modify system directories, services, or shell configuration.
To use it in the current shell:
bash
export PATH="$HOME/.local/bin:$PATH"
To make it permanent, you can add the line above to your shell configuration.
You can verify the digest on the v1.1.4 release page and checksums.txt. When upgrading a pinned version, you must verify and replace both the version number and corresponding SHA-256. The digest verifies the consistency of the release file; it is not equivalent to independent signing or a security audit.

外部请求和权限用途

External Requests and Permission Purposes

  • 安装下载:只从 GitHub 的固定 Release 下载选定归档;GitHub 可能重定向到其资产 CDN。 下载后先验证文档中固定的 SHA-256,再解压单个
    cyeam
    文件。安装检查关闭统计与更新提示。
  • Microsoft 授权:仅在需要云端功能时运行
    cyeam login
    ,通过
    https://login.microsoftonline.com/consumers
    的设备码流程登录,并尝试打开授权页面。 请求
    Files.ReadWrite
    (读写 OneDrive 文件)、
    User.Read
    (读取账号信息)、
    offline_access
    (刷新令牌,免于每次登录)。文件权限覆盖授权账号的 OneDrive 文件, 不局限于本技能的文件夹;令牌优先存系统钥匙串,不可用时回退到
    ~/.cyeam/token.json
    。
  • 云笔记:通过
    https://graph.microsoft.com/v1.0
    读写 OneDrive 的
    Notes/
    文件夹; Microsoft 的文件下载可能重定向到其存储域名。
    list/get
    读取文件信息或内容,
    new
    上传 stdin 中的 HTML(同名文件会被替换),
    append
    读取原文再上传追加后的全文。 这些操作需要用户要求的笔记内容和目标标题,不需要系统管理员权限。
  • 使用统计:默认向
    https://us.i.posthog.com
    发送命令名称、CLI 版本、系统信息和随机安装编号, 服务端可根据出口 IP 解析地域;不发送命令参数、图片内容或登录凭证。 随机编号保存在
    ~/.cyeam/analytics-id
    ,用
    --no-analytics
    或
    CYEAM_CLI_NO_ANALYTICS=1
    关闭。
  • 更新提示:默认最多每 24 小时向 GitHub 检查最新版本,并缓存到
    ~/.cyeam/update-state.json
    , 提示本身不会替换程序。设置
    CYEAM_CLI_NO_UPDATE_NOTIFIER=1
    关闭。
    cyeam update
    是显式升级命令,会下载并校验最新 Release、替换当前程序,成功后还会尝试通过
    npx skills add
    同步 skills;需要保持固定版本时不要运行它,按上述步骤安装选定版本。
关闭 CLI 统计和更新提示(业务本身的网络请求不受影响),可在当前 shell 设置:
bash
export CYEAM_CLI_NO_ANALYTICS=1
export CYEAM_CLI_NO_UPDATE_NOTIFIER=1
  • Installation download: Downloads only the selected archive from the pinned GitHub Release; GitHub may redirect to its asset CDN. After downloading, first verify the fixed SHA-256 in this document, then extract only the
    cyeam
    file. The installation check disables analytics and update notifications.
  • Microsoft authorization: Run
    cyeam login
    only when cloud features are needed. It signs in through the device-code flow at
    https://login.microsoftonline.com/consumers
    and attempts to open the authorization page. It requests
    Files.ReadWrite
    (read and write OneDrive files),
    User.Read
    (read account information), and
    offline_access
    (refresh tokens, avoiding the need to sign in each time). The file permission applies to OneDrive files in the authorized account and is not limited to this skill's folder; tokens are stored in the system keychain when available and fall back to
    ~/.cyeam/token.json
    .
  • Cloud notes: Reads and writes the
    Notes/
    folder in OneDrive through
    https://graph.microsoft.com/v1.0
    ; Microsoft file downloads may redirect to its storage domain.
    list/get
    reads file information or content,
    new
    uploads HTML from stdin (replacing a file with the same name), and
    append
    reads the original content and uploads the full text with the addition. These operations require the note content and target title supplied by the user and do not require system administrator privileges.
  • Usage analytics: By default, sends command names, the CLI version, system information, and a random installation identifier to
    https://us.i.posthog.com
    . The server may infer the geographic region from the egress IP; command arguments, image content, and login credentials are not sent. The random identifier is stored in
    ~/.cyeam/analytics-id
    and can be disabled with
    --no-analytics
    or
    CYEAM_CLI_NO_ANALYTICS=1
    .
  • Update notifications: By default, checks GitHub for the latest version at most once every 24 hours and caches the result in
    ~/.cyeam/update-state.json
    ; the notification itself does not replace the executable. Set
    CYEAM_CLI_NO_UPDATE_NOTIFIER=1
    to disable it.
    cyeam update
    is an explicit upgrade command that downloads and verifies the latest Release, replaces the current executable, and, on success, also attempts to synchronize skills through
    npx skills add
    . Do not run it when you need to keep a pinned version; install the selected version using the steps above.
To disable CLI analytics and update notifications (network requests required by the feature itself are unaffected), set the following in the current shell:
bash
export CYEAM_CLI_NO_ANALYTICS=1
export CYEAM_CLI_NO_UPDATE_NOTIFIER=1

命令

Commands

cyeam whoami                         查看登录状态(登录方式见 cyeam-cli skill)

cyeam cnote list                     列出笔记(显示文件名、修改时间、可点击链接)
cyeam cnote get <title>              读取笔记内容(默认 markdown 渲染)
cyeam cnote get <title> --format text
cyeam cnote new <title> < note.html  从 stdin 创建笔记
cyeam cnote append <title> < note.html
cyeam whoami                         查看登录状态(登录方式见 cyeam-cli skill)

cyeam cnote list                     列出笔记(显示文件名、修改时间、可点击链接)
cyeam cnote get <title>              读取笔记内容(默认 markdown 渲染)
cyeam cnote get <title> --format text
cyeam cnote new <title> < note.html  从 stdin 创建笔记
cyeam cnote append <title> < note.html

数据存储

Data Storage

笔记存储在 OneDrive 的
Notes/
文件夹下,每篇笔记是一个
.html
文件。列表时如果有
webUrl
会显示可点击的"打开"链接。
Notes are stored in the OneDrive
Notes/
folder, and each note is a
.html
file. When listing notes, a clickable "Open" link is displayed if
webUrl
is available.

注意事项

Notes

  • 需要 Microsoft 账号登录,使用 Device Code 流程(登录方式见 cyeam-cli skill)
  • 登录后 token 自动刷新(带 refresh_token)
  • 内容是纯 HTML,
    get
    命令会解析并转换为 markdown/text 显示
  • new
    和
    append
    从 stdin 读取,适合管道:
    echo "<h1>hello</h1>" | cyeam cnote new test
  • A Microsoft account is required. Sign-in uses the Device Code flow (see "Sign-in method" in the cyeam-cli skill).
  • After sign-in, the token refreshes automatically using
    refresh_token
    .
  • The content is plain HTML. The
    get
    command parses it and converts it to markdown/text for display.
  • new
    and
    append
    read from stdin and are suitable for use in pipelines:
    echo "<h1>hello</h1>" | cyeam cnote new test