Communitygithub.com

cli-anything-siyuan

SiYuan(思源筆記)CLI — 從終端管理記事本、文件、區塊,以及搜尋知識庫。

cli-anything-siyuan 是什麼?

此技能提供一個命令列介面,用於與 SiYuan(思源筆記)的核心 HTTP API 進行互動。它讓開發者和 AI 代理能夠以程式化方式管理記事本、文件、區塊,並執行全文搜尋,而無需開啟圖形化介面。此 CLI 工具適用於 Claude Code、Cursor 和 Codex 等平台,支援結構化的輸出格式(如 JSON)以便於機器解析。透過 pip 安裝後,即可連接到本機執行的 SiYuan 實例,並執行記事本操作、文件增刪改查、區塊編輯、SQL 查詢及 Markdown 匯出等任務。錯誤處理會回傳標準的 API 錯誤碼,並支援透過設定檔或環境變數進行認證。

相容平台~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/HKUDS/CLI-Anything/tree/main/skills/cli-anything-siyuan

在你喜歡的 AI 中提問

開啟一個已預先載入此 Agent Skill 的新對話。

說明文件

cli-anything-siyuan 是做什麼的?

用於 SiYuan(思源筆記)的命令列工具, 一個注重本地優先的知識管理與筆記應用程式。

此 CLI 透過 HTTP API (http://127.0.0.1:6806) 連接到正在執行的 SiYuan 核心, 並提供對記事本、文件、區塊、搜尋以及匯出的結構化存取。

先決條件

  • SiYuan 必須正在執行(設定 → 關於會顯示 API token)
  • Python 3.10+
  • 安裝:pip install cli-anything-siyuan 或從 agent-harness/ 目錄執行 pip install -e .

命令群組

notebook — 記事本管理

子命令說明
list列出所有記事本
create <name>建立新記事本
rename <id> <name>重新命名記事本
remove <id>刪除記事本
open <id>開啟記事本

doc — 文件管理

子命令說明
create <notebook> <path> [--md "content"]建立文件
list <notebook> [path]列出文件
tree <notebook> [--path / --depth]顯示文件樹
get <id>依 ID 取得文件路徑
rename <id> <title>重新命名文件
remove <id>刪除文件

block — 區塊操作

子命令說明
insert <data> [--previous / --parent]插入區塊
update <id> <data>更新區塊
delete <id>刪除區塊
get <id>取得區塊的 kramdown 原始碼
children <id>取得子區塊

其他命令

命令說明
sql <stmt>對區塊資料庫執行 SQL
search <query>跨區塊進行全文搜尋
export md <doc-id>將文件匯出為 Markdown
tag list列出所有標籤
version顯示 SiYuan 核心版本
status顯示連線與工作階段狀態
repl啟動互動式 REPL

代理指引

  • 請一律使用 --json 以取得機器可讀的輸出
  • 進階搜尋:使用 sql "SELECT * FROM blocks WHERE content LIKE '%keyword%'" 進行 SQL 層級的存取
  • 文件 ID 格式如 20210817205410-2kvfpfn(基於時間戳)
  • API token 可在 SiYuan 設定 → 關於中找到
  • 連線預設值:http://127.0.0.1:6806

範例

# 列出記事本(JSON 格式)
cli-anything-siyuan --json notebook list

# 以 Markdown 建立文件(--md 標記,注意 shell 跳脫)
cli-anything-siyuan doc create nb1 /projects/new --md "## Title\n\nContent"

# 建立文件 — 透過標準輸入傳入 Markdown(避免 shell 跳脫問題)
# PowerShell here-string(逐字,無需跳脫):
@'
## Title
Content with `backticks` and (parentheses) and "quotes"
'@ | cli-anything-siyuan doc create nb1 /projects/new --md -

# Bash heredoc:
# cat <<'EOF' | cli-anything-siyuan doc create nb1 /projects/new --md -
# ## Title
# Content with `backticks` and (parentheses)
# EOF

# SQL 搜尋
cli-anything-siyuan sql "SELECT id, content FROM blocks WHERE content LIKE '%meeting%' LIMIT 5"

# 匯出
cli-anything-siyuan export md doc123

# 進入 REPL
cli-anything-siyuan

錯誤處理

  • 連線錯誤:請確認 SiYuan 正在執行且 API token 正確
  • API 錯誤:回傳 {"code": N, "msg": "..."} — 請檢查 msg 欄位
  • 認證錯誤:請確認 ~/.siyuan-cli.json 或 SIYUAN_TOKEN 環境變數中的 token

Individual skills in this repo

This repo contains 20 individual skills — each has its own dedicated page.

cli-anything-adguardhome

>-

cli-anything-anygen

>-

cli-anything-audacity

>-

cli-anything-blender

>-

cli-anything-browser

Browser automation CLI using DOMShell MCP server. Maps Chrome

cli-anything-calibre

>-

cli-anything-ccswitch

CLI interface for CC Switch — manage AI coding tool configurations from the terminal

cli-anything-chromadb

>-

cli-anything-cloudanalyzer

Command-line interface for CloudAnalyzer — Agent-friendly harness for CloudAnalyzer, a QA platform for mapping, localization, and perception outputs. Supports 27 commands across 8 groups: point cloud evaluation, trajectory evaluation, ground segmentation QA, config-driven quality gates, baseline evolution, processing, visualization, and interactive REPL.

cli-anything-cloudcompare

Command-line interface for CloudCompare — Agent-friendly harness for CloudCompare, the open-source 3D point cloud and mesh processing software. Supports 41 commands across 9 groups: project management, session control, point cloud operations (subsample, filter, segment, analyze), mesh operations, distance computation (C2C, C2M), transformations (ICP, matrix), export (LAS/LAZ/PLY/PCD/OBJ/STL/E57), and interactive REPL.

cli-anything-comfyui

>-

cli-anything-dify-workflow

Wrapper for the Dify workflow DSL CLI. Create, inspect, validate, edit, and export Dify workflow files through a CLI-Anything harness.

cli-anything-drawio

>-

cli-anything-eez-studio

Use EEZ Studio from the command line: inspect and modify native .eez-project files, edit LVGL screens/widgets, manage SCPI commands, and invoke the real EEZ Studio backend for LVGL builds.

cli-anything-eth2-quickstart

>-

cli-anything-exa

>-

cli-anything-firefly-iii

Firefly III CLI - Personal finance management via CLI-Anything

cli-anything-freecad

Complete CLI harness for FreeCAD parametric 3D CAD modeler (258 commands). Covers ALL workbenches: Part (29 primitives + boolean + mirror + loft + sweep), Sketcher (26 cmds: geometry + constraints + editing), PartDesign (38 cmds: pad/pocket/groove/fillet/chamfer/patterns/hole/datum), Assembly (11 cmds), Mesh (16 cmds), TechDraw (15 cmds: views + dimensions + PDF/SVG), Draft (33 cmds: 2D shapes + arrays + transforms), FEM (12 cmds), CAM/CNC (10 cmds), Surface (6 cmds), Spreadsheet (7 cmds), Import (13 formats), Export (17 formats), Measure (12 cmds), Materials (21 presets). Headless FreeCAD export to STEP/IGES/STL/OBJ/DXF/PDF/glTF/3MF.

cli-anything-gimp

>-

cli-anything-godot

>-

相關技能