@getnote/cli 1.2.1 → 1.3.1
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.
- package/README.md +17 -3
- package/bin/getnote.js +25 -0
- package/package.json +4 -4
- package/skills/getnote-auth/SKILL.md +2 -1
- package/skills/getnote-kb/SKILL.md +5 -3
- package/skills/getnote-note/SKILL.md +12 -10
- package/skills/getnote-search/SKILL.md +1 -1
- package/skills/getnote-tag/SKILL.md +1 -1
- package/bin/getnote +0 -0
package/README.md
CHANGED
|
@@ -30,7 +30,7 @@ npm install -g @getnote/cli --ignore-scripts
|
|
|
30
30
|
>
|
|
31
31
|
> OpenAPI(包括本 CLI 和 Skill)仅对**得到大脑会员**开放。未开通会员时执行命令会提示 `OpenAPI 仅对会员开放`。
|
|
32
32
|
>
|
|
33
|
-
>
|
|
33
|
+
> 开通会员:[前往得到大脑会员购买页](https://www.biji.com/checkout?product_alias=9Ab36BB3ZD&spm=openapi_cli)。
|
|
34
34
|
|
|
35
35
|
---
|
|
36
36
|
|
|
@@ -153,6 +153,9 @@ getnote auth logout 退出登录
|
|
|
153
153
|
getnote save <url|文字|图片路径> 保存链接/文字/图片笔记
|
|
154
154
|
--title <标题> 可选标题
|
|
155
155
|
--tag <标签> 标签(可重复)
|
|
156
|
+
--topic-id <topic_id> 直接存入普通/书籍/客户档案知识库
|
|
157
|
+
--parent-id <note_id> 创建子笔记(ID 推荐传字符串)
|
|
158
|
+
--idempotency-key <key> 同一创建请求重试时复用的幂等键
|
|
156
159
|
|
|
157
160
|
getnote task <task_id> 查看异步任务进度
|
|
158
161
|
```
|
|
@@ -179,6 +182,9 @@ getnote note update <id> 更新笔记
|
|
|
179
182
|
|
|
180
183
|
getnote note delete <id> 删除笔记(移入回收站)
|
|
181
184
|
-y 跳过确认
|
|
185
|
+
|
|
186
|
+
getnote note share <id> 生成公开分享链接
|
|
187
|
+
--exclude-audio 分享时排除音频
|
|
182
188
|
```
|
|
183
189
|
|
|
184
190
|
### 字段语义说明(适合 AI Agent 参考)
|
|
@@ -214,7 +220,7 @@ getnote tag list <note_id> 查看笔记的所有标签
|
|
|
214
220
|
### 知识库
|
|
215
221
|
|
|
216
222
|
```
|
|
217
|
-
getnote kbs
|
|
223
|
+
getnote kbs 列出所有自有知识库(DEFAULT / BOOKSPACE / CUSTOMER)
|
|
218
224
|
|
|
219
225
|
getnote kb <topic_id> 知识库内的笔记
|
|
220
226
|
--limit <n>
|
|
@@ -226,7 +232,7 @@ getnote kb create <名称> 新建知识库
|
|
|
226
232
|
|
|
227
233
|
getnote kb add <topic_id> <note_id> [note_id...] 加入知识库
|
|
228
234
|
getnote kb remove <topic_id> <note_id> [note_id...] 移出知识库
|
|
229
|
-
getnote kb live-follow <url>
|
|
235
|
+
getnote kb live-follow <topic_id> <url> 订阅得到直播课,直播结束后 AI 摘要自动入库
|
|
230
236
|
|
|
231
237
|
getnote kbs-sub 获取我订阅的知识库列表
|
|
232
238
|
```
|
|
@@ -262,6 +268,14 @@ getnote kbs-sub 获取我订阅的知识库
|
|
|
262
268
|
| `GETNOTE_CLIENT_ID` | Client ID |
|
|
263
269
|
| `GETNOTE_API_URL` | 覆盖 API 地址 |
|
|
264
270
|
|
|
271
|
+
`GETNOTE_API_URL` 可传站点根地址、`/open` 或完整 `/open/api/v1`,业务请求和 OAuth 会同时使用该地址;未设置时仍使用生产环境。
|
|
272
|
+
|
|
273
|
+
### 新版 API 兼容约定
|
|
274
|
+
|
|
275
|
+
- `note_id`、`parent_note_id`、`children_ids`、`cursor` 等雪花 ID 按字符串无损输出;历史 `id` / `next_cursor` 数字字段继续保留。
|
|
276
|
+
- HTTP 200 且 `success:false` 仍按失败处理并返回非零退出码;错误保留 `code/reason/retryable/field/constraint/expected_type/request_id`。
|
|
277
|
+
- `getnote save --idempotency-key` 用于防止网络重试产生重复笔记;同一请求必须复用同一个键。
|
|
278
|
+
|
|
265
279
|
---
|
|
266
280
|
|
|
267
281
|
## 从源码构建
|
package/bin/getnote.js
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// Platform-agnostic launcher for getnote binary
|
|
3
|
+
|
|
4
|
+
'use strict';
|
|
5
|
+
|
|
6
|
+
const { spawn } = require('child_process');
|
|
7
|
+
const path = require('path');
|
|
8
|
+
const os = require('os');
|
|
9
|
+
|
|
10
|
+
const platform = os.platform();
|
|
11
|
+
const binaryName = platform === 'win32' ? 'getnote.exe' : 'getnote';
|
|
12
|
+
const binaryPath = path.join(__dirname, binaryName);
|
|
13
|
+
|
|
14
|
+
const child = spawn(binaryPath, process.argv.slice(2), {
|
|
15
|
+
stdio: 'inherit',
|
|
16
|
+
windowsHide: true
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
child.on('exit', (code, signal) => {
|
|
20
|
+
if (signal) {
|
|
21
|
+
process.kill(process.pid, signal);
|
|
22
|
+
} else {
|
|
23
|
+
process.exit(code);
|
|
24
|
+
}
|
|
25
|
+
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@getnote/cli",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.1",
|
|
4
4
|
"description": "CLI tool for 得到大脑(Get笔记) — manage notes and knowledge bases from the terminal",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"getnote",
|
|
@@ -15,15 +15,15 @@
|
|
|
15
15
|
},
|
|
16
16
|
"license": "MIT",
|
|
17
17
|
"bin": {
|
|
18
|
-
"getnote": "./bin/getnote"
|
|
18
|
+
"getnote": "./bin/getnote.js"
|
|
19
19
|
},
|
|
20
20
|
"scripts": {
|
|
21
21
|
"postinstall": "node scripts/postinstall.js"
|
|
22
22
|
},
|
|
23
23
|
"files": [
|
|
24
|
-
"bin/",
|
|
24
|
+
"bin/getnote.js",
|
|
25
25
|
"scripts/",
|
|
26
26
|
"skills/",
|
|
27
27
|
"README.md"
|
|
28
28
|
]
|
|
29
|
-
}
|
|
29
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: getnote-auth
|
|
3
|
-
version: 0.
|
|
3
|
+
version: 0.5.0
|
|
4
4
|
description: Manage authentication for Get笔记 CLI
|
|
5
5
|
---
|
|
6
6
|
|
|
@@ -67,3 +67,4 @@ getnote auth logout
|
|
|
67
67
|
- If not authenticated, prompt the user to run `getnote auth login`.
|
|
68
68
|
- `--api-key` on any command is a temporary per-invocation override and does not save credentials.
|
|
69
69
|
- Credentials saved at `~/.getnote/config.json`; env vars `GETNOTE_API_KEY` / `GETNOTE_CLIENT_ID` take higher priority.
|
|
70
|
+
- `GETNOTE_API_URL` may override the business API host for an explicitly selected test environment; otherwise production remains the default.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: getnote-kb
|
|
3
|
-
version: 0.
|
|
3
|
+
version: 0.6.0
|
|
4
4
|
description: Manage knowledge bases in Get笔记 via the getnote CLI
|
|
5
5
|
---
|
|
6
6
|
|
|
@@ -20,13 +20,15 @@ Manage knowledge bases — list, create, browse notes, add/remove notes. Also su
|
|
|
20
20
|
getnote kbs
|
|
21
21
|
```
|
|
22
22
|
|
|
23
|
-
Returns all knowledge bases. Each item includes
|
|
23
|
+
Returns all owned knowledge bases, including `DEFAULT` (normal), `BOOKSPACE` (book), and `CUSTOMER` (customer profile). Each item includes `topic_id`, `name`, `scope`, `description`, and stats.
|
|
24
24
|
|
|
25
25
|
```bash
|
|
26
26
|
getnote kbs
|
|
27
27
|
getnote kbs -o json
|
|
28
28
|
```
|
|
29
29
|
|
|
30
|
+
> When saving into a named knowledge base, select it from the complete list by `name` and `scope`, then call `getnote save ... --topic-id <topic_id>`. Do not filter the list to `DEFAULT` only.
|
|
31
|
+
|
|
30
32
|
---
|
|
31
33
|
|
|
32
34
|
### List subscribed knowledge bases
|
|
@@ -231,7 +233,7 @@ getnote quota -o json
|
|
|
231
233
|
- `kbs -o json` returns `{"success":true,"data":{"topics":[...],"total":N}}`
|
|
232
234
|
- `kbs-sub -o json` returns the same shape as `kbs -o json`.
|
|
233
235
|
- `kb <topic_id> -o json` returns `{"success":true,"data":{"notes":[...],"has_more":...}}`
|
|
234
|
-
- Get `topic_id` from `getnote kbs -o json` or `getnote kbs-sub -o json` → `data.topics[].topic_id` field (not `id`).
|
|
236
|
+
- Get `topic_id` from `getnote kbs -o json` or `getnote kbs-sub -o json` → `data.topics[].topic_id` field (not `id`). Owned lists include DEFAULT / BOOKSPACE / CUSTOMER.
|
|
235
237
|
- `kb add` / `kb remove` accept multiple note IDs — prefer batching over multiple calls.
|
|
236
238
|
- **Subscribed KBs are read-only** unless the user is an admin of that KB. `kb add` / `kb remove` will return an API error on subscribed KBs owned by others. Use `getnote kbs` (owned) vs `getnote kbs-sub` (subscribed) to distinguish.
|
|
237
239
|
- `kb bloggers` → get `follow_id` → `kb blogger-contents` → get `post_id_alias` → `kb blogger-content` for full text.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: getnote-note
|
|
3
|
-
version: 0.
|
|
3
|
+
version: 0.5.0
|
|
4
4
|
description: Manage notes in Get笔记 via the getnote CLI
|
|
5
5
|
---
|
|
6
6
|
|
|
@@ -17,13 +17,16 @@ Save, list, view, update, and delete notes in Get笔记.
|
|
|
17
17
|
### Save a note
|
|
18
18
|
|
|
19
19
|
```
|
|
20
|
-
getnote save <url|text|image_path> [--title <title>] [--tag <tag>]...
|
|
20
|
+
getnote save <url|text|image_path> [--title <title>] [--tag <tag>]... [--topic-id <topic_id>] [--parent-id <note_id>] [--idempotency-key <key>]
|
|
21
21
|
```
|
|
22
22
|
|
|
23
23
|
| Flag | Description |
|
|
24
24
|
|------|-------------|
|
|
25
25
|
| `--title` | Optional title |
|
|
26
26
|
| `--tag` | Tag to apply; may be repeated |
|
|
27
|
+
| `--topic-id` | Save directly into an owned DEFAULT / BOOKSPACE / CUSTOMER knowledge base |
|
|
28
|
+
| `--parent-id` | Create a child note; pass the snowflake ID as a decimal string |
|
|
29
|
+
| `--idempotency-key` | Stable 1-128 character request key; reuse it for retries of the same create request |
|
|
27
30
|
|
|
28
31
|
- URL (`http://` or `https://`) → link note:
|
|
29
32
|
- **Share link** (`biji.com/note/share_note/*` or `d.biji.com/*` short link) → **sync**, returns `note_id` directly, no polling needed
|
|
@@ -61,14 +64,15 @@ Returns `status` (`pending` / `processing` / `success` / `failed`) and `note_id`
|
|
|
61
64
|
### List recent notes
|
|
62
65
|
|
|
63
66
|
```
|
|
64
|
-
getnote notes [--cursor <cursor>] [--all]
|
|
67
|
+
getnote notes [--cursor <cursor>] [--limit <n>] [--all]
|
|
65
68
|
```
|
|
66
69
|
|
|
67
|
-
|
|
70
|
+
The API fetches 20 notes per page. `--limit` returns the first N and rewrites `cursor` to the last visible note, so the next page does not skip data.
|
|
68
71
|
|
|
69
72
|
| Flag | Description |
|
|
70
73
|
|------|-------------|
|
|
71
74
|
| `--cursor` | Pagination cursor (the `cursor` value from the previous page) |
|
|
75
|
+
| `--limit` | Number of notes to return from the fetched page |
|
|
72
76
|
| `--all` | Fetch all notes (auto-paginate, streams output) |
|
|
73
77
|
|
|
74
78
|
```bash
|
|
@@ -171,13 +175,11 @@ Returns: `share_url` (e.g. `https://biji.com/note/share_note/rBzdMlXrzgYVM`)
|
|
|
171
175
|
## Agent Usage Notes
|
|
172
176
|
|
|
173
177
|
- Use `-o json` when parsing responses programmatically.
|
|
174
|
-
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
- `save` (regular link/image): returns `{"data":{"tasks":[{"task_id":"..."}],...}}`
|
|
178
|
-
- `task`: returns `{"success":true,"data":{"status":"...","note_id":"..."}}`
|
|
179
|
-
- `notes` list returns **20 per page** (no `--limit`); paginate with `--cursor` (the `cursor` value from the previous page).
|
|
178
|
+
- JSON responses preserve the API envelope `{"success":true,"data":{...}}`.
|
|
179
|
+
- Link/image saves read the async ID from `data.tasks[0].task_id`; task polling only treats `error_msg` as meaningful when `status=failed`.
|
|
180
|
+
- `notes` fetches 20 from the API and may apply a smaller local `--limit`; paginate with the returned string `cursor`.
|
|
180
181
|
- Note IDs are int64 — always handle as strings to avoid precision loss in JavaScript.
|
|
182
|
+
- HTTP 200 with `success:false` is still an error. The CLI exits non-zero and preserves `code`, `reason`, `retryable`, `field`, `constraint`, `expected_type`, and `request_id`.
|
|
181
183
|
- Exit code `0` = success; non-zero = error. Error details go to stderr.
|
|
182
184
|
|
|
183
185
|
### 字段语义提示("原文" vs AI 总结)
|
package/bin/getnote
DELETED
|
Binary file
|