@getnote/cli 0.1.3 → 0.1.4

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 (2) hide show
  1. package/README.md +159 -81
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -1,133 +1,201 @@
1
- # getnote-cli
1
+ # Get笔记 CLI
2
2
 
3
- CLI tool for [Get笔记](https://biji.com) — manage notes and knowledge bases from the terminal.
3
+ [English](./README.en.md) | 中文
4
4
 
5
- Designed for both humans and AI agents.
5
+ Get笔记的命令行工具,让你在终端和 AI Agent 里直接管理笔记和知识库。
6
6
 
7
- ## Installation
7
+ 存链接、记文字、搜笔记、管知识库——一条命令搞定,支持脚本和 AI Agent 调用。
8
8
 
9
- ### npm (recommended)
9
+ ---
10
+
11
+ ## 安装
10
12
 
11
13
  ```bash
12
14
  npm install -g @getnote/cli
13
15
  ```
14
16
 
15
- ### Manual
17
+ 或者从 [Releases](https://github.com/iswalle/getnote-cli/releases) 下载对应平台的二进制文件,放到 `$PATH` 里。
16
18
 
17
- Download the latest binary from [Releases](https://github.com/iswalle/getnote-cli/releases) and place it on your `$PATH`.
19
+ ---
18
20
 
19
- ### Build from source
21
+ ## 三步开始用
20
22
 
23
+ **第一步:安装**
21
24
  ```bash
22
- git clone https://github.com/iswalle/getnote-cli.git
23
- cd getnote-cli
24
- make install
25
+ npm install -g @getnote/cli
25
26
  ```
26
27
 
27
- ## Quick Start
28
-
28
+ **第二步:登录**
29
29
  ```bash
30
- # Authenticate (OAuth browser flow)
31
30
  getnote auth login
31
+ ```
32
+ 会自动打开浏览器完成授权。也可以直接用 API Key:
33
+ ```bash
34
+ getnote auth login --api-key gk_live_xxx
35
+ ```
32
36
 
33
- # Save a URL
34
- getnote save https://example.com/article --title "Great article"
37
+ **第三步:开始用**
38
+ ```bash
39
+ # 存一篇文章
40
+ getnote save https://example.com/article --tag 阅读
35
41
 
36
- # Save plain text
37
- getnote save "Remember to review the docs" --tag work
42
+ # 记一条文字
43
+ getnote save "周五前要回复王总的邮件" --tag 待办
38
44
 
39
- # List recent notes
45
+ # 看最近的笔记
40
46
  getnote notes
41
-
42
- # List all notes (auto-paginate)
43
- getnote notes --all
44
47
  ```
45
48
 
46
- ## Commands
49
+ ---
50
+
51
+ ## 典型使用场景
47
52
 
48
- ### Authentication
53
+ **场景 1:边看边存**
54
+ ```bash
55
+ # 存链接,自动抓取页面内容
56
+ getnote save https://simonwillison.net/2024/llms-reading-list/ --tag ai
49
57
 
58
+ # 存完自动展示笔记内容,不用再手动查
50
59
  ```
51
- getnote auth login Authenticate via OAuth (browser)
52
- getnote auth login --api-key <key> Authenticate with API key directly
53
- getnote auth status Show authentication status
54
- getnote auth logout Remove saved credentials
60
+
61
+ **场景 2:搜索笔记**
62
+ ```bash
63
+ # 全局搜索
64
+ getnote search "LLM 推荐阅读"
65
+
66
+ # 在某个知识库内搜索
67
+ getnote search "产品设计" --kb vnrOAaGY
55
68
  ```
56
69
 
57
- ### Save & Tasks
70
+ **场景 3:管理知识库**
71
+ ```bash
72
+ # 列出所有知识库
73
+ getnote kbs
58
74
 
75
+ # 查看某个知识库的笔记
76
+ getnote kb vnrOAaGY --all
77
+
78
+ # 把笔记加入知识库
79
+ getnote kb add vnrOAaGY 1234567890
59
80
  ```
60
- getnote save <url|text> Save a URL or text note
61
- --title <title> Optional title
62
- --tag <tag> Tag (repeatable)
63
81
 
64
- getnote task <task_id> Check the progress of an async save task
82
+ **场景 4:脚本批处理**
83
+ ```bash
84
+ # 导出所有笔记为 JSON
85
+ getnote notes --all -o json > all-notes.json
86
+
87
+ # 取出某条笔记的正文
88
+ getnote note 1234567890 --field content | pbcopy
65
89
  ```
66
90
 
67
- ### Notes
91
+ ---
92
+
93
+ ## AI Agent 使用
94
+
95
+ 所有命令支持 `-o json` 输出结构化数据,AI Agent 可以直接解析:
68
96
 
97
+ ```bash
98
+ getnote notes -o json
99
+ getnote note 1234567890 -o json
100
+ getnote search "关键词" -o json
101
+ getnote save https://example.com -o json # 自动轮询,返回最终笔记
69
102
  ```
70
- getnote notes List recent notes (default 20)
71
- --limit <n> Number of notes (default 20)
72
- --since-id <id> Pagination cursor
73
- --all Fetch all notes (auto-paginate)
74
103
 
75
- getnote note <id> Show note details
76
- --field <name> Output a single field as plain text
77
- (id, title, content, type,
78
- created_at, updated_at, url, excerpt)
104
+ `skills/` 目录下有 Claude Code 专用的 Skill 文件,加到项目上下文后,AI Agent 可以直接用自然语言操作笔记。
105
+
106
+ ---
107
+
108
+ ## 完整命令参考
79
109
 
80
- getnote note update <id> Update a note
81
- --title <title>
82
- --content <content> plain_text notes only
83
- --tag <tags> Comma-separated, replaces existing tags
110
+ ### 认证
84
111
 
85
- getnote note delete <id> Delete a note (moves to trash)
86
- -y, --yes Skip confirmation
87
112
  ```
113
+ getnote auth login OAuth 登录(浏览器授权)
114
+ getnote auth login --api-key <key> 直接用 API Key 登录
115
+ getnote auth status 查看当前登录状态
116
+ getnote auth logout 退出登录
117
+ ```
118
+
119
+ ### 保存笔记
88
120
 
89
- ### Knowledge Bases
121
+ ```
122
+ getnote save <url|文字|图片路径> 保存链接/文字/图片笔记
123
+ --title <标题> 可选标题
124
+ --tag <标签> 标签(可重复)
90
125
 
126
+ getnote task <task_id> 查看异步任务进度
91
127
  ```
92
- getnote kbs List all knowledge bases
93
128
 
94
- getnote kb <topic_id> List notes in a knowledge base
95
- --limit <n> Number of notes (default 20)
96
- --all Fetch all notes (auto-paginate)
129
+ 链接笔记是异步处理的,CLI 会自动轮询等待完成,完成后直接展示内容。`-o json` 模式下静默轮询,返回最终笔记 JSON。
97
130
 
98
- getnote kb create <name> Create a knowledge base
99
- --desc <description>
131
+ ### 查看和管理笔记
100
132
 
101
- getnote kb add <topic_id> <note_id> [note_id...] Add notes
102
- getnote kb remove <topic_id> <note_id> [note_id...] Remove notes
133
+ ```
134
+ getnote notes 最近 20 条笔记
135
+ --limit <n> 自定义数量
136
+ --all 获取全部(自动翻页)
137
+
138
+ getnote note <id> 笔记详情
139
+ --field <字段名> 只输出某个字段的值
140
+ (id/title/content/type/
141
+ created_at/url/excerpt)
142
+
143
+ getnote note update <id> 更新笔记
144
+ --title <标题>
145
+ --content <内容> 仅文字笔记可用
146
+ --tag <标签> 逗号分隔,会替换现有标签
147
+
148
+ getnote note delete <id> 删除笔记(移入回收站)
149
+ -y 跳过确认
103
150
  ```
104
151
 
105
- ## Global Flags
152
+ ### 搜索
106
153
 
107
- | Flag | Description |
108
- |------|-------------|
109
- | `--api-key <key>` | Override API key for this command |
110
- | `-o, --output json\|table` | Output format (default: `table`) |
111
- | `--env prod\|dev` | Target environment (default: `prod`) |
154
+ ```
155
+ getnote search <关键词> 全局语义搜索
156
+ --limit <n> 返回数量(默认 10)
157
+ --kb <topic_id> 限定在某个知识库内搜索
158
+ ```
112
159
 
113
- ## Field Output (Pipe-friendly)
160
+ ### 标签
114
161
 
115
- Use `--field` to extract a single value for use in scripts:
162
+ ```
163
+ getnote tag add <note_id> <标签> 给笔记加标签
164
+ getnote tag remove <note_id> <标签> 删除笔记标签
165
+ getnote tag list <note_id> 查看笔记的所有标签
166
+ ```
116
167
 
117
- ```bash
118
- # Get note content
119
- getnote note 1234567890 --field content
168
+ ### 知识库
169
+
170
+ ```
171
+ getnote kbs 列出所有知识库
120
172
 
121
- # Get source URL of a link note
122
- getnote note 1234567890 --field url
173
+ getnote kb <topic_id> 知识库内的笔记
174
+ --limit <n>
175
+ --all 获取全部
123
176
 
124
- # Pipe into another command
125
- getnote note 1234567890 --field content | pbcopy
177
+ getnote kb create <名称> 新建知识库
178
+ --desc <描述>
179
+
180
+ getnote kb add <topic_id> <note_id> [note_id...] 加入知识库
181
+ getnote kb remove <topic_id> <note_id> [note_id...] 移出知识库
126
182
  ```
127
183
 
128
- ## Configuration
184
+ ---
129
185
 
130
- Credentials are stored in `~/.getnote/config.json`:
186
+ ## 全局参数
187
+
188
+ | 参数 | 说明 |
189
+ |------|------|
190
+ | `--api-key <key>` | 临时覆盖 API Key |
191
+ | `-o, --output json\|table` | 输出格式(默认 table) |
192
+ | `--env prod\|dev` | 切换 API 环境 |
193
+
194
+ ---
195
+
196
+ ## 配置
197
+
198
+ 凭证保存在 `~/.getnote/config.json`:
131
199
 
132
200
  ```json
133
201
  {
@@ -136,17 +204,27 @@ Credentials are stored in `~/.getnote/config.json`:
136
204
  }
137
205
  ```
138
206
 
139
- Environment variables (higher priority than config file):
207
+ 也支持环境变量(优先级更高):
140
208
 
141
- | Variable | Description |
142
- |----------|-------------|
143
- | `GETNOTE_API_KEY` | API key |
209
+ | 变量 | 说明 |
210
+ |------|------|
211
+ | `GETNOTE_API_KEY` | API Key |
144
212
  | `GETNOTE_CLIENT_ID` | Client ID |
145
- | `GETNOTE_API_URL` | Override the API base URL |
213
+ | `GETNOTE_API_URL` | 覆盖 API 地址 |
214
+
215
+ ---
216
+
217
+ ## 从源码构建
146
218
 
147
- ## AI Agent Usage
219
+ 需要 Go 1.21+。
220
+
221
+ ```bash
222
+ git clone https://github.com/iswalle/getnote-cli.git
223
+ cd getnote-cli
224
+ make install
225
+ ```
148
226
 
149
- All commands support `-o json` for machine-readable output. See the [skills/](./skills/) directory for agent skill documentation.
227
+ ---
150
228
 
151
229
  ## License
152
230
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@getnote/cli",
3
- "version": "0.1.3",
3
+ "version": "0.1.4",
4
4
  "description": "CLI tool for Get笔记 — manage notes and knowledge bases from the terminal",
5
5
  "keywords": [
6
6
  "getnote",