rote-toolkit 0.3.2 → 0.3.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.
package/README.md CHANGED
@@ -1,100 +1,144 @@
1
1
  # Rote Toolkit
2
2
 
3
- Rote Toolkit 是一个基于 TypeScript 的增强工具包,主要用于在终端或 AI Agents 侧连接和增强你的 [Rote](https://rote.ink) 笔记系统。基于 Rote OpenKey API 授权,即插即用,无需繁复的登录流程。
3
+ <p align="right">English | <a href="./README.zh-CN.md">中文</a></p>
4
4
 
5
- ## 特性
5
+ Rote Toolkit is a TypeScript toolkit for connecting to and extending your [Rote](https://rote.ink) note system from terminal workflows and AI agents. It uses the Rote OpenKey API for simple, reusable authentication.
6
6
 
7
- - **CLI 模式**:通过终端快速记笔记、搜索笔记。
8
- - **MCP 模式**:作为 Model Context Protocol 服务端,让 AI (Claude/Cursor) 能够安全、规范地读写 Rote 笔记。
9
- - **无感鉴权**:只需一次配置 OpenKey 即可长期使用。
7
+ Main project repository: [`Rabithua/rote`](https://github.com/Rabithua/rote).
10
8
 
11
- ## 安装
9
+ ## Features
12
10
 
13
- > 要求 Node.js v18 或更高版本。
11
+ - **CLI mode**: quickly create and search notes from terminal.
12
+ - **MCP mode**: run as a Model Context Protocol server so AI tools (Claude/Cursor/VS Code) can safely read and write Rote notes.
13
+ - **Simple auth**: configure OpenKey once and reuse it.
14
+
15
+ ## Install
16
+
17
+ > Node.js v18 or higher is required.
14
18
 
15
19
  ```bash
16
20
  npm install -g rote-toolkit
17
21
  ```
18
22
 
19
- ## 配置鉴权
23
+ ## Configure Auth
20
24
 
21
- 运行以下命令进行全局配置:
25
+ Run this command once:
22
26
 
23
27
  ```bash
24
28
  rote config
25
29
  ```
26
30
 
27
- 系统会提示你输入:
31
+ You will be prompted for:
28
32
 
29
- 1. **Rote API URL**:例如 `https://your-rote-domain.com`
30
- 2. **OpenKey**:你的 API 密钥
33
+ 1. **Rote API URL**: for example `https://your-rote-domain.com`
34
+ 2. **OpenKey**: your API key
31
35
 
32
- 凭证会保存在本地:`~/.rote-toolkit/config.json`。
36
+ Credentials are stored at: `~/.rote-toolkit/config.json`.
33
37
 
34
- ## CLI 模式使用指南
38
+ ## CLI Usage
35
39
 
36
- ### 1) 快速记录笔记
40
+ ### 1) Create a note
37
41
 
38
42
  ```bash
39
- rote add "今天学到了 MCP 协议,非常有趣!"
43
+ rote add "Today I learned MCP and it is great"
40
44
  ```
41
45
 
42
- 附带标签、设为公开并置顶:
46
+ Add tags, publish as public, and pin:
43
47
 
44
48
  ```bash
45
- rote add "实现了一个新的前端组件" -t "代码,前端,React" --public --pin
49
+ rote add "Built a new frontend component" -t "code,frontend,React" --public --pin
46
50
  ```
47
51
 
48
- ### 2) 搜索和获取笔记
52
+ ### 2) Search and list notes
49
53
 
50
- 搜索包含 "MCP" 的笔记:
54
+ Search notes containing `MCP`:
51
55
 
52
56
  ```bash
53
57
  rote search "MCP"
54
58
  ```
55
59
 
56
- 获取最近的笔记(支持过滤归档和标签):
60
+ List recent notes (with archive/tag filters):
57
61
 
58
62
  ```bash
59
- rote list --limit 5 --archived -t "知识管理"
63
+ rote list --limit 5 --archived -t "knowledge"
60
64
  ```
61
65
 
62
- ## MCP 模式使用指南
66
+ ## MCP Usage
67
+
68
+ ### Do I need pre-installation?
69
+
70
+ No.
71
+ If you configure MCP with `npx` or `bunx`, the package is downloaded and run automatically when the MCP server starts.
63
72
 
64
- 启动 MCP Server:
73
+ Global install is only needed when you want to run commands directly on your machine:
65
74
 
66
75
  ```bash
67
- rote mcp
76
+ npm install -g rote-toolkit
68
77
  ```
69
78
 
70
- 或独立命令:
79
+ ### 1) Configure credentials first (one time)
71
80
 
72
81
  ```bash
82
+ rote config
83
+ ```
84
+
85
+ ### 2) Manual local start (optional, for debugging)
86
+
87
+ These two commands are equivalent:
88
+
89
+ ```bash
90
+ rote mcp
73
91
  rote-mcp
74
92
  ```
75
93
 
76
- ### Claude Desktop 配置示例
94
+ ### 3) Claude Desktop example
77
95
 
78
96
  ```json
79
97
  {
80
98
  "mcpServers": {
81
99
  "rote-toolkit": {
82
100
  "command": "npx",
83
- "args": ["-y", "rote-toolkit", "mcp"]
101
+ "args": ["-y", "-p", "rote-toolkit@latest", "rote-mcp"]
84
102
  }
85
103
  }
86
104
  }
87
105
  ```
88
106
 
89
- ### AI 可使用的能力 (Tools)
107
+ ### 4) VS Code example
108
+
109
+ ```json
110
+ {
111
+ "servers": {
112
+ "rote-toolkit": {
113
+ "type": "stdio",
114
+ "command": "bunx",
115
+ "args": ["-y", "--package", "rote-toolkit@latest", "rote-mcp"]
116
+ }
117
+ }
118
+ }
119
+ ```
120
+
121
+ ### Version strategy
122
+
123
+ - Track latest: `rote-toolkit@latest`
124
+ - Reproducible setup: pin a version, for example `rote-toolkit@0.3.3`
125
+
126
+ ### Common errors
127
+
128
+ - `could not determine executable to run`: usually incorrect `npx` args, use `-p rote-toolkit@... rote-mcp`.
129
+ - `unknown command 'rote-mcp'` (bunx): include `--package`, for example `bunx -y --package rote-toolkit@latest rote-mcp`.
130
+
131
+ ### Available AI Tools
90
132
 
91
133
  - `rote_create_note`
134
+ - `rote_update_note`
135
+ - `rote_delete_note`
92
136
  - `rote_search_notes`
93
137
  - `rote_list_notes`
94
138
 
95
- ## 本地开发
139
+ ## Local Development
96
140
 
97
- [text](../../../Downloads/API-KEY-GUIDE.md)
141
+ [API Key Usage Guide](./API-KEY-GUIDE.md)
98
142
 
99
143
  ```bash
100
144
  npm install
@@ -102,31 +146,31 @@ npm run build
102
146
  npm run dev -- --help
103
147
  ```
104
148
 
105
- ## 发布到 npm
149
+ ## Publish to npm
106
150
 
107
- 首次发布前先登录:
151
+ Login first:
108
152
 
109
153
  ```bash
110
154
  npm login
111
155
  ```
112
156
 
113
- 自动构建 + 自动升级版本 + 发布:
157
+ Build + bump version + publish:
114
158
 
115
159
  ```bash
116
160
  npm run release:patch
117
161
  ```
118
162
 
119
- 也支持:
163
+ Also available:
120
164
 
121
165
  ```bash
122
166
  npm run release:minor
123
167
  npm run release:major
124
168
  ```
125
169
 
126
- 发布脚本会执行:
170
+ Release script steps:
127
171
 
128
- 1. 检查 git 工作区是否干净
129
- 2. 检查 npm 登录状态
172
+ 1. Ensure git workspace is clean
173
+ 2. Check npm login state
130
174
  3. `npm run build`
131
175
  4. `npm pack --dry-run`
132
176
  5. `npm version <patch|minor|major>`
@@ -0,0 +1,177 @@
1
+ # Rote Toolkit
2
+
3
+ <p align="right"><a href="./README.md">English</a> | 中文</p>
4
+
5
+ Rote Toolkit 是一个基于 TypeScript 的增强工具包,主要用于在终端或 AI Agents 侧连接和增强你的 [Rote](https://rote.ink) 笔记系统。基于 Rote OpenKey API 授权,即插即用,无需繁复的登录流程。
6
+
7
+ 主项目仓库:[`Rabithua/rote`](https://github.com/Rabithua/rote)。
8
+
9
+ ## 特性
10
+
11
+ - **CLI 模式**:通过终端快速记笔记、搜索笔记。
12
+ - **MCP 模式**:作为 Model Context Protocol 服务端,让 AI (Claude/Cursor) 能够安全、规范地读写 Rote 笔记。
13
+ - **无感鉴权**:只需一次配置 OpenKey 即可长期使用。
14
+
15
+ ## 安装
16
+
17
+ > 要求 Node.js v18 或更高版本。
18
+
19
+ ```bash
20
+ npm install -g rote-toolkit
21
+ ```
22
+
23
+ ## 配置鉴权
24
+
25
+ 运行以下命令进行全局配置:
26
+
27
+ ```bash
28
+ rote config
29
+ ```
30
+
31
+ 系统会提示你输入:
32
+
33
+ 1. **Rote API URL**:例如 `https://your-rote-domain.com`
34
+ 2. **OpenKey**:你的 API 密钥
35
+
36
+ 凭证会保存在本地:`~/.rote-toolkit/config.json`。
37
+
38
+ ## CLI 模式使用指南
39
+
40
+ ### 1) 快速记录笔记
41
+
42
+ ```bash
43
+ rote add "今天学到了 MCP 协议,非常有趣!"
44
+ ```
45
+
46
+ 附带标签、设为公开并置顶:
47
+
48
+ ```bash
49
+ rote add "实现了一个新的前端组件" -t "代码,前端,React" --public --pin
50
+ ```
51
+
52
+ ### 2) 搜索和获取笔记
53
+
54
+ 搜索包含 "MCP" 的笔记:
55
+
56
+ ```bash
57
+ rote search "MCP"
58
+ ```
59
+
60
+ 获取最近的笔记(支持过滤归档和标签):
61
+
62
+ ```bash
63
+ rote list --limit 5 --archived -t "知识管理"
64
+ ```
65
+
66
+ ## MCP 模式使用指南
67
+
68
+ ### 是否需要提前安装?
69
+
70
+ 不需要。
71
+ 在 VS Code / Claude Desktop 里使用 `npx` 或 `bunx` 配置时,会在启动 MCP Server 时自动下载并运行 `rote-toolkit`。
72
+
73
+ 仅当你希望本机直接运行命令时,才需要全局安装:
74
+
75
+ ```bash
76
+ npm install -g rote-toolkit
77
+ ```
78
+
79
+ ### 1) 先完成凭证配置(一次即可)
80
+
81
+ ```bash
82
+ rote config
83
+ ```
84
+
85
+ ### 2) 本机手动启动(可选,用于调试)
86
+
87
+ 以下两条命令等价:
88
+
89
+ ```bash
90
+ rote mcp
91
+ rote-mcp
92
+ ```
93
+
94
+ ### 3) Claude Desktop 配置示例
95
+
96
+ ```json
97
+ {
98
+ "mcpServers": {
99
+ "rote-toolkit": {
100
+ "command": "npx",
101
+ "args": ["-y", "-p", "rote-toolkit@latest", "rote-mcp"]
102
+ }
103
+ }
104
+ }
105
+ ```
106
+
107
+ ### 4) VS Code 配置示例
108
+
109
+ ```json
110
+ {
111
+ "servers": {
112
+ "rote-toolkit": {
113
+ "type": "stdio",
114
+ "command": "bunx",
115
+ "args": ["-y", "--package", "rote-toolkit@latest", "rote-mcp"]
116
+ }
117
+ }
118
+ }
119
+ ```
120
+
121
+ ### 版本建议
122
+
123
+ - 追踪最新版:`rote-toolkit@latest`
124
+ - 需要稳定可复现:固定版本号,例如 `rote-toolkit@0.3.3`
125
+
126
+ ### 常见问题
127
+
128
+ - 报错 `could not determine executable to run`:通常是 `npx` 参数写法不对,确认使用 `-p rote-toolkit@... rote-mcp`。
129
+ - 报错 `unknown command 'rote-mcp'`(bunx):需要 `--package`,例如 `bunx -y --package rote-toolkit@latest rote-mcp`。
130
+
131
+ ### AI 可使用的能力 (Tools)
132
+
133
+ - `rote_create_note`
134
+ - `rote_update_note`
135
+ - `rote_delete_note`
136
+ - `rote_search_notes`
137
+ - `rote_list_notes`
138
+
139
+ ## 本地开发
140
+
141
+ [API Key Usage Guide](./API-KEY-GUIDE.md)
142
+
143
+ ```bash
144
+ npm install
145
+ npm run build
146
+ npm run dev -- --help
147
+ ```
148
+
149
+ ## 发布到 npm
150
+
151
+ 首次发布前先登录:
152
+
153
+ ```bash
154
+ npm login
155
+ ```
156
+
157
+ 自动构建 + 自动升级版本 + 发布:
158
+
159
+ ```bash
160
+ npm run release:patch
161
+ ```
162
+
163
+ 也支持:
164
+
165
+ ```bash
166
+ npm run release:minor
167
+ npm run release:major
168
+ ```
169
+
170
+ 发布脚本会执行:
171
+
172
+ 1. 检查 git 工作区是否干净
173
+ 2. 检查 npm 登录状态
174
+ 3. `npm run build`
175
+ 4. `npm pack --dry-run`
176
+ 5. `npm version <patch|minor|major>`
177
+ 6. `npm publish`
package/dist/api.d.ts CHANGED
@@ -1,9 +1,11 @@
1
- import type { AddReactionInput, CreateArticleInput, CreateNoteInput, ListNotesInput, RemoveReactionInput, RemoveReactionResponse, RoteArticle, RoteNote, RotePermissions, RoteProfile, RoteReaction, SearchNotesInput, ToolkitConfig, UpdateProfileInput } from "./types.js";
1
+ import type { AddReactionInput, CreateArticleInput, CreateNoteInput, ListNotesInput, RemoveReactionInput, RemoveReactionResponse, RoteArticle, RoteNote, RotePermissions, RoteProfile, RoteReaction, SearchNotesInput, ToolkitConfig, UpdateNoteInput, UpdateProfileInput } from "./types.js";
2
2
  export declare class RoteClient {
3
3
  private readonly apiUrl;
4
4
  private readonly openKey;
5
5
  constructor(config?: ToolkitConfig);
6
6
  createNote(input: CreateNoteInput): Promise<RoteNote>;
7
+ updateNote(input: UpdateNoteInput): Promise<RoteNote>;
8
+ deleteNote(noteId: string): Promise<unknown>;
7
9
  searchNotes(input: SearchNotesInput): Promise<RoteNote[]>;
8
10
  listNotes(input?: ListNotesInput): Promise<RoteNote[]>;
9
11
  createArticle(input: CreateArticleInput): Promise<RoteArticle>;
package/dist/api.js CHANGED
@@ -26,6 +26,59 @@ export class RoteClient {
26
26
  body: JSON.stringify(body),
27
27
  });
28
28
  }
29
+ async updateNote(input) {
30
+ const noteId = input.noteId?.trim();
31
+ if (!noteId) {
32
+ throw new Error("noteId is required");
33
+ }
34
+ const hasUpdates = input.content !== undefined ||
35
+ input.title !== undefined ||
36
+ input.tags !== undefined ||
37
+ input.isPublic !== undefined ||
38
+ input.pin !== undefined ||
39
+ input.archived !== undefined ||
40
+ input.articleId !== undefined;
41
+ if (!hasUpdates) {
42
+ throw new Error("at least one field to update is required");
43
+ }
44
+ const body = {
45
+ openkey: this.openKey,
46
+ };
47
+ if (input.content !== undefined) {
48
+ body.content = input.content;
49
+ }
50
+ if (input.title !== undefined) {
51
+ body.title = input.title;
52
+ }
53
+ if (input.tags !== undefined) {
54
+ body.tags = input.tags;
55
+ }
56
+ if (input.isPublic !== undefined) {
57
+ body.state = input.isPublic ? "public" : "private";
58
+ }
59
+ if (input.pin !== undefined) {
60
+ body.pin = input.pin;
61
+ }
62
+ if (input.archived !== undefined) {
63
+ body.archived = input.archived;
64
+ }
65
+ if (input.articleId !== undefined) {
66
+ body.articleId = input.articleId;
67
+ }
68
+ return this.request(`/v2/api/openkey/notes/${encodeURIComponent(noteId)}`, {
69
+ method: "PUT",
70
+ headers: { "Content-Type": "application/json" },
71
+ body: JSON.stringify(body),
72
+ });
73
+ }
74
+ async deleteNote(noteId) {
75
+ const resolved = noteId?.trim();
76
+ if (!resolved) {
77
+ throw new Error("noteId is required");
78
+ }
79
+ const params = new URLSearchParams({ openkey: this.openKey });
80
+ return this.request(`/v2/api/openkey/notes/${encodeURIComponent(resolved)}?${params.toString()}`, { method: "DELETE" });
81
+ }
29
82
  async searchNotes(input) {
30
83
  if (!input.keyword?.trim()) {
31
84
  throw new Error("keyword is required");
package/dist/cli.js CHANGED
File without changes
File without changes
package/dist/mcp.js CHANGED
@@ -40,6 +40,60 @@ export async function startMcpServer() {
40
40
  ],
41
41
  };
42
42
  });
43
+ server.registerTool("rote_update_note", {
44
+ description: "Update an existing note in Rote via OpenKey API.",
45
+ inputSchema: {
46
+ noteId: z.string().min(1).describe("Note ID"),
47
+ content: z.string().optional().describe("Updated note content"),
48
+ title: z.string().optional().describe("Updated note title"),
49
+ tags: z.array(z.string()).optional().describe("Updated list of tags"),
50
+ isPublic: z
51
+ .boolean()
52
+ .optional()
53
+ .describe("Set note visibility (public/private)"),
54
+ pin: z.boolean().optional().describe("Whether to pin the note"),
55
+ archived: z.boolean().optional().describe("Whether to archive the note"),
56
+ articleId: z
57
+ .string()
58
+ .optional()
59
+ .describe("Optional article ID to bind to"),
60
+ },
61
+ }, async ({ noteId, content, title, tags, isPublic, pin, archived, articleId }) => {
62
+ const note = await client.updateNote({
63
+ noteId,
64
+ content,
65
+ title,
66
+ tags,
67
+ isPublic,
68
+ pin,
69
+ archived,
70
+ articleId,
71
+ });
72
+ return {
73
+ content: [
74
+ {
75
+ type: "text",
76
+ text: `Updated note ${note.id}: ${truncateSingleLine(note.content, 100)}`,
77
+ },
78
+ ],
79
+ };
80
+ });
81
+ server.registerTool("rote_delete_note", {
82
+ description: "Delete a note in Rote via OpenKey API.",
83
+ inputSchema: {
84
+ noteId: z.string().min(1).describe("Note ID"),
85
+ },
86
+ }, async ({ noteId }) => {
87
+ await client.deleteNote(noteId);
88
+ return {
89
+ content: [
90
+ {
91
+ type: "text",
92
+ text: `Deleted note ${noteId}`,
93
+ },
94
+ ],
95
+ };
96
+ });
43
97
  server.registerTool("rote_create_article", {
44
98
  description: "Create an article in Rote via OpenKey API.",
45
99
  inputSchema: {
package/dist/types.d.ts CHANGED
@@ -24,6 +24,16 @@ export interface CreateNoteInput {
24
24
  pin?: boolean;
25
25
  articleId?: string;
26
26
  }
27
+ export interface UpdateNoteInput {
28
+ noteId: string;
29
+ content?: string;
30
+ title?: string;
31
+ tags?: string[];
32
+ isPublic?: boolean;
33
+ pin?: boolean;
34
+ archived?: boolean;
35
+ articleId?: string;
36
+ }
27
37
  export interface RoteArticle {
28
38
  id: string;
29
39
  content: string;
package/package.json CHANGED
@@ -1,10 +1,11 @@
1
1
  {
2
2
  "name": "rote-toolkit",
3
- "version": "0.3.2",
3
+ "version": "0.3.4",
4
4
  "description": "CLI and MCP toolkit for Rote OpenKey API",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
7
7
  "bin": {
8
+ "rote-toolkit": "dist/cli.js",
8
9
  "rote": "dist/cli.js",
9
10
  "rote-mcp": "dist/mcp-standalone.js"
10
11
  },