siyuan-cli 1.6.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. siyuan_cli-1.6.0/LICENSE +21 -0
  2. siyuan_cli-1.6.0/PKG-INFO +265 -0
  3. siyuan_cli-1.6.0/README.md +247 -0
  4. siyuan_cli-1.6.0/pyproject.toml +49 -0
  5. siyuan_cli-1.6.0/setup.cfg +4 -0
  6. siyuan_cli-1.6.0/siyuan_cli/__init__.py +7 -0
  7. siyuan_cli-1.6.0/siyuan_cli/__main__.py +5 -0
  8. siyuan_cli-1.6.0/siyuan_cli/cli.py +422 -0
  9. siyuan_cli-1.6.0/siyuan_cli/client.py +175 -0
  10. siyuan_cli-1.6.0/siyuan_cli/commands/__init__.py +1 -0
  11. siyuan_cli-1.6.0/siyuan_cli/commands/asset.py +126 -0
  12. siyuan_cli-1.6.0/siyuan_cli/commands/attr.py +56 -0
  13. siyuan_cli-1.6.0/siyuan_cli/commands/batch.py +222 -0
  14. siyuan_cli-1.6.0/siyuan_cli/commands/block.py +194 -0
  15. siyuan_cli-1.6.0/siyuan_cli/commands/config_cmd.py +83 -0
  16. siyuan_cli-1.6.0/siyuan_cli/commands/doc.py +233 -0
  17. siyuan_cli-1.6.0/siyuan_cli/commands/export_cmd.py +43 -0
  18. siyuan_cli-1.6.0/siyuan_cli/commands/file_cmd.py +180 -0
  19. siyuan_cli-1.6.0/siyuan_cli/commands/notebook.py +131 -0
  20. siyuan_cli-1.6.0/siyuan_cli/commands/notify.py +39 -0
  21. siyuan_cli-1.6.0/siyuan_cli/commands/search.py +44 -0
  22. siyuan_cli-1.6.0/siyuan_cli/commands/stats.py +64 -0
  23. siyuan_cli-1.6.0/siyuan_cli/commands/tag.py +107 -0
  24. siyuan_cli-1.6.0/siyuan_cli/commands/template.py +47 -0
  25. siyuan_cli-1.6.0/siyuan_cli/config.py +141 -0
  26. siyuan_cli-1.6.0/siyuan_cli/exceptions.py +100 -0
  27. siyuan_cli-1.6.0/siyuan_cli/utils.py +120 -0
  28. siyuan_cli-1.6.0/siyuan_cli.egg-info/PKG-INFO +265 -0
  29. siyuan_cli-1.6.0/siyuan_cli.egg-info/SOURCES.txt +35 -0
  30. siyuan_cli-1.6.0/siyuan_cli.egg-info/dependency_links.txt +1 -0
  31. siyuan_cli-1.6.0/siyuan_cli.egg-info/entry_points.txt +2 -0
  32. siyuan_cli-1.6.0/siyuan_cli.egg-info/requires.txt +6 -0
  33. siyuan_cli-1.6.0/siyuan_cli.egg-info/top_level.txt +1 -0
  34. siyuan_cli-1.6.0/tests/test_client.py +167 -0
  35. siyuan_cli-1.6.0/tests/test_config.py +62 -0
  36. siyuan_cli-1.6.0/tests/test_exceptions.py +137 -0
  37. siyuan_cli-1.6.0/tests/test_utils.py +167 -0
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 RowanGrove
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,265 @@
1
+ Metadata-Version: 2.4
2
+ Name: siyuan-cli
3
+ Version: 1.6.0
4
+ Summary: CLI tool and Agent Skills for SiYuan Note
5
+ License-Expression: MIT
6
+ Project-URL: Homepage, https://github.com/RowanGrove/siyuan-skills
7
+ Project-URL: Repository, https://github.com/RowanGrove/siyuan-skills
8
+ Keywords: siyuan,notes,markdown,pkm,self-hosted
9
+ Requires-Python: >=3.9
10
+ Description-Content-Type: text/markdown
11
+ License-File: LICENSE
12
+ Provides-Extra: dev
13
+ Requires-Dist: pytest>=8; extra == "dev"
14
+ Requires-Dist: pytest-timeout; extra == "dev"
15
+ Requires-Dist: ruff>=0.6; extra == "dev"
16
+ Requires-Dist: mypy>=1.10; extra == "dev"
17
+ Dynamic: license-file
18
+
19
+ # SiYuan Skills
20
+
21
+ Agent Skills for [SiYuan Note](https://github.com/siyuan-note/siyuan) — the self-hosted, block-based note-taking platform.
22
+
23
+ These skills follow the [Agent Skills specification](https://agentskills.io/specification) so they can be used by any skills-compatible agent, including Claude Code, Codex, OpenCode, and Hermes.
24
+
25
+ > Like [obsidian-skills](https://github.com/kepano/obsidian-skills) but for SiYuan.
26
+
27
+ ---
28
+
29
+ ## Skills
30
+
31
+ | Skill | Description |
32
+ |-------|-------------|
33
+ | [siyuan-cli](skills/siyuan-cli) | Create, read, search, and manage notes using the `siyuan` CLI tool (recommended) |
34
+ | [siyuan-api](skills/siyuan-api) | Call the SiYuan REST API directly with curl — no CLI needed |
35
+ | [siyuan-markdown](skills/siyuan-markdown) | How to write SiYuan-flavored Markdown with block references, tags, and embeds |
36
+
37
+ ---
38
+
39
+ ## Quick Start
40
+
41
+ ### Install the CLI (one command)
42
+
43
+ ```bash
44
+ curl -fsSL https://raw.githubusercontent.com/RowanGrove/siyuan-skills/main/scripts/install.sh | bash
45
+ ```
46
+
47
+ What it does:
48
+ 1. Downloads `siyuan-cli.py` to `/usr/local/bin/siyuan` (or `~/.local/bin`)
49
+ 2. Auto-detects API token from common SiYuan config paths
50
+ 3. Writes `~/.siyuan/config.json` so it works immediately
51
+ 4. Runs `siyuan stats` to verify
52
+
53
+ If auto-detection didn't find your SiYuan config:
54
+
55
+ ```bash
56
+ siyuan config set token "your-api-token"
57
+ ```
58
+
59
+ > **Where's the token?** SiYuan Desktop → Settings → API → Token.
60
+ > Docker/1Panel: `conf.json → api.token` (accessible via Web UI or container exec).
61
+
62
+ > **Windows:** The CLI is pure Python 3. Run `py scripts/siyuan-cli.py` or set up a batch alias.
63
+ > Token path: `%USERPROFILE%\.siyuan\config.json` works natively.
64
+
65
+ ### Switch between instances
66
+
67
+ ```bash
68
+ # Local Desktop (default)
69
+ siyuan stats
70
+
71
+ # Hong Kong server (one-off)
72
+ SIYUAN_URL=http://your-server:6806 siyuan list-notebooks
73
+
74
+ # Save a different default
75
+ siyuan config set url "http://192.168.1.100:6806"
76
+ siyuan config set token "other-token"
77
+ ```
78
+
79
+ ### Install the skills for your AI agent
80
+
81
+ **OpenCode:**
82
+ ```bash
83
+ git clone https://github.com/RowanGrove/siyuan-skills.git ~/.opencode/skills/siyuan-skills
84
+ ```
85
+
86
+ **Codex CLI:**
87
+ ```bash
88
+ cp -r skills/* ~/.codex/skills/
89
+ ```
90
+
91
+ **Claude Code:**
92
+ Add the `skills/` directory to your project's `.claude/skills/` folder.
93
+
94
+ **Hermes Agent:**
95
+ ```bash
96
+ cp -r skills/* ~/.hermes/skills/
97
+ ```
98
+
99
+ **Via npx skills:**
100
+ ```bash
101
+ npx skills add https://github.com/RowanGrove/siyuan-skills
102
+ ```
103
+
104
+ ---
105
+
106
+ ## CLI Reference
107
+
108
+ ```
109
+ # Documents (flat — legacy, shorter)
110
+ siyuan create <path> [content] Create a note
111
+ siyuan read <path> Read note content
112
+ siyuan delete <path> [--id] Delete a note (by path or block ID)
113
+ siyuan export <path> Export note as Markdown
114
+ siyuan tree [notebook_id] Show document tree
115
+
116
+ # Documents (hierarchical — richer)
117
+ siyuan doc create <path> [content] Create a note
118
+ siyuan doc read <path> Read note content
119
+ siyuan doc delete <path> Delete a note
120
+ siyuan doc export <path> Export note as Markdown
121
+ siyuan doc tree [notebook_id] Show document tree
122
+ siyuan doc rename <title> [--id|--path] Rename a document
123
+ siyuan doc move <paths...> [--to-notebook] Move document(s)
124
+ siyuan doc get-path <id> Resolve block ID to path
125
+
126
+ # Search & SQL
127
+ siyuan search <query> Full-text search
128
+ siyuan sql <statement> Query the blocks table
129
+
130
+ # Notebooks
131
+ siyuan list-notebooks List notebooks (alias)
132
+ siyuan notebook list List notebooks with icons & status
133
+ siyuan notebook create <name> Create a notebook
134
+ siyuan notebook remove <id> Remove a notebook (irreversible)
135
+ siyuan notebook rename <id> <name> Rename a notebook
136
+ siyuan notebook conf <id> Get notebook configuration
137
+ siyuan notebook set-conf <id> k=v Update notebook configuration
138
+ siyuan notebook open <id> Open a notebook
139
+ siyuan notebook close <id> Close a notebook
140
+
141
+ # Blocks
142
+ siyuan block get <id> Get block info
143
+ siyuan block children <id> Get child blocks
144
+ siyuan block insert <parent> -c Insert block after sibling
145
+ siyuan block prepend <id> -c Prepend block as first child
146
+ siyuan block append <id> -c Append block as last child
147
+ siyuan block update <id> -c Update block content
148
+ siyuan block delete <id> Delete a block
149
+ siyuan block move <id> --parent Move a block
150
+ siyuan block fold <id> Fold (collapse) a block
151
+ siyuan block unfold <id> Unfold (expand) a block
152
+ siyuan block transfer-ref <f> <t> Transfer block references
153
+
154
+ # Tags
155
+ siyuan tag list List all tags
156
+ siyuan tag blocks <tag> Find blocks with a tag
157
+ siyuan tag rename <old> <new> Rename a tag (SQL-based)
158
+ siyuan tag remove <tag> Remove a tag (SQL-based)
159
+
160
+ # Assets
161
+ siyuan asset upload <file> Upload an asset file
162
+ siyuan asset list List uploaded assets
163
+
164
+ # Attributes
165
+ siyuan attr get <id> Get block attributes
166
+ siyuan attr set <id> <k> <v> Set block attribute
167
+
168
+ # Templates
169
+ siyuan template render <id> <path> Render a template file
170
+ siyuan template render-sprig <str> Render a Sprig template string
171
+
172
+ # File operations (workspace files)
173
+ siyuan file get <path> [-o out] Read file from workspace
174
+ siyuan file put <local> <dest> Write file to workspace
175
+ siyuan file remove <path> Delete a workspace file
176
+ siyuan file rename <a> <b> Rename a workspace file
177
+ siyuan file list <dir> List workspace directory
178
+
179
+ # Export
180
+ siyuan export2 md <id> Export document by block ID
181
+ siyuan export2 resources <paths> Export files/folders as zip
182
+
183
+ # Notifications
184
+ siyuan notify push <msg> Push notification to SiYuan UI
185
+ siyuan notify push-err <msg> Push error notification
186
+
187
+ # Config & Stats
188
+ siyuan config Show CLI connection config
189
+ siyuan config set <key> <val> Save CLI config (url|token)
190
+ siyuan config-get [key] Read SiYuan server config value
191
+ siyuan stats Show workspace statistics
192
+ ```
193
+
194
+ Config resolution order: `SIYUAN_*` env var > `~/.siyuan/config.json` > `/tmp/siyuan_token`
195
+
196
+ ---
197
+
198
+ ## Agent Workflows
199
+
200
+ Once the CLI and skills are installed, your agent can:
201
+
202
+ | Task | Example prompt |
203
+ |------|---------------|
204
+ | Create a note | "在思源建一个笔记,记录今天的会议" |
205
+ | Read notes | "帮我读一下技术笔记里的部署记录" |
206
+ | Search | "搜一下思源里关于 API 的内容" |
207
+ | List notebooks | "看看我有哪些笔记本" |
208
+ | Stats | "思源现在有多少笔记了?" |
209
+ | Export | "把这个笔记导出来" |
210
+
211
+ ---
212
+
213
+ ## Architecture
214
+
215
+ ```
216
+ ┌─────────────────────────────────────────────────────┐
217
+ │ Agent │
218
+ │ ┌──────────────┐ SSH / direct ┌──────────┐ │
219
+ │ │ SKILL.md │ ──── instructs ──▶ │ siyuan │ │
220
+ │ │ guides the │ │ CLI │──┼──▶ SiYuan API
221
+ │ │ agent │ ◀─── returns ───── │ (Python)│ │ (port 6806)
222
+ │ └──────────────┘ └──────────┘ │
223
+ │ │
224
+ │ Config: ~/.siyuan/config.json │
225
+ │ Env: SIYUAN_URL, SIYUAN_TOKEN │
226
+ └─────────────────────────────────────────────────────┘
227
+ ```
228
+
229
+ The `siyuan` CLI is a single-file Python 3 script (stdlib only — no pip). The agent runs it via SSH (remote) or directly (local). The SKILL.md teaches the agent the available commands.
230
+
231
+ ---
232
+
233
+ ## Repository Structure
234
+
235
+ ```
236
+ siyuan-skills/
237
+ ├── .claude-plugin/
238
+ │ ├── marketplace.json # Plugin marketplace registration
239
+ │ └── plugin.json # Plugin metadata
240
+ ├── skills/
241
+ │ ├── siyuan-cli/SKILL.md # CLI tool usage (recommended)
242
+ │ ├── siyuan-api/SKILL.md # Direct API calls via curl
243
+ │ └── siyuan-markdown/SKILL.md # SiYuan markdown syntax
244
+ ├── scripts/
245
+ │ ├── siyuan-cli.py # The CLI (single file, no deps)
246
+ │ └── install.sh # One-command installer
247
+ ├── references/
248
+ │ └── api-endpoints.md # All known API endpoints
249
+ ├── README.md
250
+ └── LICENSE (MIT)
251
+ ```
252
+
253
+ ## Compatibility
254
+
255
+ | Agent/Platform | Status | Notes |
256
+ |----------------|--------|-------|
257
+ | Claude Code | ✅ Confirmed | Skills spec v1 compatible |
258
+ | Codex CLI | ✅ Confirmed | Standard SKILL.md format |
259
+ | OpenCode | ✅ Confirmed | Auto-discovers SKILL.md files |
260
+ | Hermes Agent | ✅ Confirmed | Skills installed and tested |
261
+ | Cursor | ⚠️ Untested | Should work via skills spec |
262
+
263
+ ## License
264
+
265
+ MIT
@@ -0,0 +1,247 @@
1
+ # SiYuan Skills
2
+
3
+ Agent Skills for [SiYuan Note](https://github.com/siyuan-note/siyuan) — the self-hosted, block-based note-taking platform.
4
+
5
+ These skills follow the [Agent Skills specification](https://agentskills.io/specification) so they can be used by any skills-compatible agent, including Claude Code, Codex, OpenCode, and Hermes.
6
+
7
+ > Like [obsidian-skills](https://github.com/kepano/obsidian-skills) but for SiYuan.
8
+
9
+ ---
10
+
11
+ ## Skills
12
+
13
+ | Skill | Description |
14
+ |-------|-------------|
15
+ | [siyuan-cli](skills/siyuan-cli) | Create, read, search, and manage notes using the `siyuan` CLI tool (recommended) |
16
+ | [siyuan-api](skills/siyuan-api) | Call the SiYuan REST API directly with curl — no CLI needed |
17
+ | [siyuan-markdown](skills/siyuan-markdown) | How to write SiYuan-flavored Markdown with block references, tags, and embeds |
18
+
19
+ ---
20
+
21
+ ## Quick Start
22
+
23
+ ### Install the CLI (one command)
24
+
25
+ ```bash
26
+ curl -fsSL https://raw.githubusercontent.com/RowanGrove/siyuan-skills/main/scripts/install.sh | bash
27
+ ```
28
+
29
+ What it does:
30
+ 1. Downloads `siyuan-cli.py` to `/usr/local/bin/siyuan` (or `~/.local/bin`)
31
+ 2. Auto-detects API token from common SiYuan config paths
32
+ 3. Writes `~/.siyuan/config.json` so it works immediately
33
+ 4. Runs `siyuan stats` to verify
34
+
35
+ If auto-detection didn't find your SiYuan config:
36
+
37
+ ```bash
38
+ siyuan config set token "your-api-token"
39
+ ```
40
+
41
+ > **Where's the token?** SiYuan Desktop → Settings → API → Token.
42
+ > Docker/1Panel: `conf.json → api.token` (accessible via Web UI or container exec).
43
+
44
+ > **Windows:** The CLI is pure Python 3. Run `py scripts/siyuan-cli.py` or set up a batch alias.
45
+ > Token path: `%USERPROFILE%\.siyuan\config.json` works natively.
46
+
47
+ ### Switch between instances
48
+
49
+ ```bash
50
+ # Local Desktop (default)
51
+ siyuan stats
52
+
53
+ # Hong Kong server (one-off)
54
+ SIYUAN_URL=http://your-server:6806 siyuan list-notebooks
55
+
56
+ # Save a different default
57
+ siyuan config set url "http://192.168.1.100:6806"
58
+ siyuan config set token "other-token"
59
+ ```
60
+
61
+ ### Install the skills for your AI agent
62
+
63
+ **OpenCode:**
64
+ ```bash
65
+ git clone https://github.com/RowanGrove/siyuan-skills.git ~/.opencode/skills/siyuan-skills
66
+ ```
67
+
68
+ **Codex CLI:**
69
+ ```bash
70
+ cp -r skills/* ~/.codex/skills/
71
+ ```
72
+
73
+ **Claude Code:**
74
+ Add the `skills/` directory to your project's `.claude/skills/` folder.
75
+
76
+ **Hermes Agent:**
77
+ ```bash
78
+ cp -r skills/* ~/.hermes/skills/
79
+ ```
80
+
81
+ **Via npx skills:**
82
+ ```bash
83
+ npx skills add https://github.com/RowanGrove/siyuan-skills
84
+ ```
85
+
86
+ ---
87
+
88
+ ## CLI Reference
89
+
90
+ ```
91
+ # Documents (flat — legacy, shorter)
92
+ siyuan create <path> [content] Create a note
93
+ siyuan read <path> Read note content
94
+ siyuan delete <path> [--id] Delete a note (by path or block ID)
95
+ siyuan export <path> Export note as Markdown
96
+ siyuan tree [notebook_id] Show document tree
97
+
98
+ # Documents (hierarchical — richer)
99
+ siyuan doc create <path> [content] Create a note
100
+ siyuan doc read <path> Read note content
101
+ siyuan doc delete <path> Delete a note
102
+ siyuan doc export <path> Export note as Markdown
103
+ siyuan doc tree [notebook_id] Show document tree
104
+ siyuan doc rename <title> [--id|--path] Rename a document
105
+ siyuan doc move <paths...> [--to-notebook] Move document(s)
106
+ siyuan doc get-path <id> Resolve block ID to path
107
+
108
+ # Search & SQL
109
+ siyuan search <query> Full-text search
110
+ siyuan sql <statement> Query the blocks table
111
+
112
+ # Notebooks
113
+ siyuan list-notebooks List notebooks (alias)
114
+ siyuan notebook list List notebooks with icons & status
115
+ siyuan notebook create <name> Create a notebook
116
+ siyuan notebook remove <id> Remove a notebook (irreversible)
117
+ siyuan notebook rename <id> <name> Rename a notebook
118
+ siyuan notebook conf <id> Get notebook configuration
119
+ siyuan notebook set-conf <id> k=v Update notebook configuration
120
+ siyuan notebook open <id> Open a notebook
121
+ siyuan notebook close <id> Close a notebook
122
+
123
+ # Blocks
124
+ siyuan block get <id> Get block info
125
+ siyuan block children <id> Get child blocks
126
+ siyuan block insert <parent> -c Insert block after sibling
127
+ siyuan block prepend <id> -c Prepend block as first child
128
+ siyuan block append <id> -c Append block as last child
129
+ siyuan block update <id> -c Update block content
130
+ siyuan block delete <id> Delete a block
131
+ siyuan block move <id> --parent Move a block
132
+ siyuan block fold <id> Fold (collapse) a block
133
+ siyuan block unfold <id> Unfold (expand) a block
134
+ siyuan block transfer-ref <f> <t> Transfer block references
135
+
136
+ # Tags
137
+ siyuan tag list List all tags
138
+ siyuan tag blocks <tag> Find blocks with a tag
139
+ siyuan tag rename <old> <new> Rename a tag (SQL-based)
140
+ siyuan tag remove <tag> Remove a tag (SQL-based)
141
+
142
+ # Assets
143
+ siyuan asset upload <file> Upload an asset file
144
+ siyuan asset list List uploaded assets
145
+
146
+ # Attributes
147
+ siyuan attr get <id> Get block attributes
148
+ siyuan attr set <id> <k> <v> Set block attribute
149
+
150
+ # Templates
151
+ siyuan template render <id> <path> Render a template file
152
+ siyuan template render-sprig <str> Render a Sprig template string
153
+
154
+ # File operations (workspace files)
155
+ siyuan file get <path> [-o out] Read file from workspace
156
+ siyuan file put <local> <dest> Write file to workspace
157
+ siyuan file remove <path> Delete a workspace file
158
+ siyuan file rename <a> <b> Rename a workspace file
159
+ siyuan file list <dir> List workspace directory
160
+
161
+ # Export
162
+ siyuan export2 md <id> Export document by block ID
163
+ siyuan export2 resources <paths> Export files/folders as zip
164
+
165
+ # Notifications
166
+ siyuan notify push <msg> Push notification to SiYuan UI
167
+ siyuan notify push-err <msg> Push error notification
168
+
169
+ # Config & Stats
170
+ siyuan config Show CLI connection config
171
+ siyuan config set <key> <val> Save CLI config (url|token)
172
+ siyuan config-get [key] Read SiYuan server config value
173
+ siyuan stats Show workspace statistics
174
+ ```
175
+
176
+ Config resolution order: `SIYUAN_*` env var > `~/.siyuan/config.json` > `/tmp/siyuan_token`
177
+
178
+ ---
179
+
180
+ ## Agent Workflows
181
+
182
+ Once the CLI and skills are installed, your agent can:
183
+
184
+ | Task | Example prompt |
185
+ |------|---------------|
186
+ | Create a note | "在思源建一个笔记,记录今天的会议" |
187
+ | Read notes | "帮我读一下技术笔记里的部署记录" |
188
+ | Search | "搜一下思源里关于 API 的内容" |
189
+ | List notebooks | "看看我有哪些笔记本" |
190
+ | Stats | "思源现在有多少笔记了?" |
191
+ | Export | "把这个笔记导出来" |
192
+
193
+ ---
194
+
195
+ ## Architecture
196
+
197
+ ```
198
+ ┌─────────────────────────────────────────────────────┐
199
+ │ Agent │
200
+ │ ┌──────────────┐ SSH / direct ┌──────────┐ │
201
+ │ │ SKILL.md │ ──── instructs ──▶ │ siyuan │ │
202
+ │ │ guides the │ │ CLI │──┼──▶ SiYuan API
203
+ │ │ agent │ ◀─── returns ───── │ (Python)│ │ (port 6806)
204
+ │ └──────────────┘ └──────────┘ │
205
+ │ │
206
+ │ Config: ~/.siyuan/config.json │
207
+ │ Env: SIYUAN_URL, SIYUAN_TOKEN │
208
+ └─────────────────────────────────────────────────────┘
209
+ ```
210
+
211
+ The `siyuan` CLI is a single-file Python 3 script (stdlib only — no pip). The agent runs it via SSH (remote) or directly (local). The SKILL.md teaches the agent the available commands.
212
+
213
+ ---
214
+
215
+ ## Repository Structure
216
+
217
+ ```
218
+ siyuan-skills/
219
+ ├── .claude-plugin/
220
+ │ ├── marketplace.json # Plugin marketplace registration
221
+ │ └── plugin.json # Plugin metadata
222
+ ├── skills/
223
+ │ ├── siyuan-cli/SKILL.md # CLI tool usage (recommended)
224
+ │ ├── siyuan-api/SKILL.md # Direct API calls via curl
225
+ │ └── siyuan-markdown/SKILL.md # SiYuan markdown syntax
226
+ ├── scripts/
227
+ │ ├── siyuan-cli.py # The CLI (single file, no deps)
228
+ │ └── install.sh # One-command installer
229
+ ├── references/
230
+ │ └── api-endpoints.md # All known API endpoints
231
+ ├── README.md
232
+ └── LICENSE (MIT)
233
+ ```
234
+
235
+ ## Compatibility
236
+
237
+ | Agent/Platform | Status | Notes |
238
+ |----------------|--------|-------|
239
+ | Claude Code | ✅ Confirmed | Skills spec v1 compatible |
240
+ | Codex CLI | ✅ Confirmed | Standard SKILL.md format |
241
+ | OpenCode | ✅ Confirmed | Auto-discovers SKILL.md files |
242
+ | Hermes Agent | ✅ Confirmed | Skills installed and tested |
243
+ | Cursor | ⚠️ Untested | Should work via skills spec |
244
+
245
+ ## License
246
+
247
+ MIT
@@ -0,0 +1,49 @@
1
+ [build-system]
2
+ requires = ["setuptools>=64"]
3
+ build-backend = "setuptools.build_meta:__legacy__"
4
+
5
+ [project]
6
+ name = "siyuan-cli"
7
+ version = "1.6.0"
8
+ description = "CLI tool and Agent Skills for SiYuan Note"
9
+ readme = "README.md"
10
+ license = "MIT"
11
+ requires-python = ">=3.9"
12
+ keywords = ["siyuan", "notes", "markdown", "pkm", "self-hosted"]
13
+
14
+ [project.urls]
15
+ Homepage = "https://github.com/RowanGrove/siyuan-skills"
16
+ Repository = "https://github.com/RowanGrove/siyuan-skills"
17
+
18
+ [project.scripts]
19
+ siyuan = "siyuan_cli.cli:main"
20
+
21
+ [project.optional-dependencies]
22
+ dev = ["pytest>=8", "pytest-timeout", "ruff>=0.6", "mypy>=1.10"]
23
+
24
+ [tool.setuptools.packages.find]
25
+ include = ["siyuan_cli", "siyuan_cli.*"]
26
+
27
+ [tool.ruff]
28
+ target-version = "py39"
29
+ line-length = 100
30
+
31
+ [tool.ruff.lint]
32
+ select = ["E", "F", "W", "I", "N", "UP", "SIM"]
33
+
34
+ [tool.ruff.lint.per-file-ignores]
35
+ "tests/*" = ["N802", "N803", "N806"]
36
+
37
+ [tool.ruff.format]
38
+ quote-style = "double"
39
+
40
+ [tool.mypy]
41
+ python_version = "3.9"
42
+ strict = false
43
+ ignore_missing_imports = true
44
+ explicit_package_bases = true
45
+
46
+ [tool.pytest.ini_options]
47
+ testpaths = ["tests"]
48
+ python_files = ["test_*.py"]
49
+ timeout = 30
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,7 @@
1
+ """siyuan-cli — SiYuan Note command-line tool.
2
+
3
+ Package for interacting with SiYuan Note's HTTP API.
4
+ Create, read, search, and manage notes, blocks, tags, and assets.
5
+ """
6
+
7
+ __version__ = "1.6.0"
@@ -0,0 +1,5 @@
1
+ """Entry point for `python3 -m siyuan_cli`."""
2
+
3
+ from siyuan_cli.cli import main
4
+
5
+ main()