rote-toolkit 0.2.1 → 0.3.0
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 +1 -1
- package/dist/api.js +12 -0
- package/dist/cli.js +29 -1
- package/dist/config.js +2 -2
- package/dist/mcp.js +19 -5
- package/dist/types.d.ts +4 -0
- package/package.json +1 -1
package/README.md
CHANGED
package/dist/api.js
CHANGED
|
@@ -37,6 +37,12 @@ export class RoteClient {
|
|
|
37
37
|
limit: String(input.limit ?? 10),
|
|
38
38
|
skip: String(input.skip ?? 0),
|
|
39
39
|
});
|
|
40
|
+
if (input.archived !== undefined) {
|
|
41
|
+
params.set("archived", String(input.archived));
|
|
42
|
+
}
|
|
43
|
+
if (input.tag) {
|
|
44
|
+
input.tag.forEach((t) => params.append("tag", t));
|
|
45
|
+
}
|
|
40
46
|
return this.request(`/v2/api/openkey/notes/search?${params.toString()}`);
|
|
41
47
|
}
|
|
42
48
|
async listNotes(input = {}) {
|
|
@@ -45,6 +51,12 @@ export class RoteClient {
|
|
|
45
51
|
limit: String(input.limit ?? 10),
|
|
46
52
|
skip: String(input.skip ?? 0),
|
|
47
53
|
});
|
|
54
|
+
if (input.archived !== undefined) {
|
|
55
|
+
params.set("archived", String(input.archived));
|
|
56
|
+
}
|
|
57
|
+
if (input.tag) {
|
|
58
|
+
input.tag.forEach((t) => params.append("tag", t));
|
|
59
|
+
}
|
|
48
60
|
return this.request(`/v2/api/openkey/notes?${params.toString()}`);
|
|
49
61
|
}
|
|
50
62
|
async createArticle(input) {
|
package/dist/cli.js
CHANGED
|
@@ -9,7 +9,8 @@ import { startMcpServer } from "./mcp.js";
|
|
|
9
9
|
const program = new Command();
|
|
10
10
|
program.name("rote").description("Rote Toolkit CLI").version("0.1.0");
|
|
11
11
|
program
|
|
12
|
-
.command("
|
|
12
|
+
.command("config")
|
|
13
|
+
.alias("login")
|
|
13
14
|
.description("Configure Rote API URL and OpenKey")
|
|
14
15
|
.action(async () => {
|
|
15
16
|
const rl = createInterface({ input, output });
|
|
@@ -30,6 +31,8 @@ program
|
|
|
30
31
|
.option("-t, --tags <tags>", "comma-separated tags")
|
|
31
32
|
.option("--title <title>", "title")
|
|
32
33
|
.option("--state <state>", "note state", "private")
|
|
34
|
+
.option("--type <type>", "note type", "rote")
|
|
35
|
+
.option("--pin", "pin the note")
|
|
33
36
|
.option("--article-id <articleId>", "bind to an existing article")
|
|
34
37
|
.action(async (content, options) => {
|
|
35
38
|
const client = new RoteClient();
|
|
@@ -39,6 +42,8 @@ program
|
|
|
39
42
|
tags,
|
|
40
43
|
title: options.title,
|
|
41
44
|
state: options.state,
|
|
45
|
+
type: options.type,
|
|
46
|
+
pin: options.pin,
|
|
42
47
|
articleId: options.articleId,
|
|
43
48
|
});
|
|
44
49
|
console.log(`Created note: ${note.id}`);
|
|
@@ -117,12 +122,35 @@ program
|
|
|
117
122
|
.argument("<keyword>", "search keyword")
|
|
118
123
|
.option("-l, --limit <limit>", "max results", parseInt, 10)
|
|
119
124
|
.option("-s, --skip <skip>", "offset", parseInt, 0)
|
|
125
|
+
.option("--archived", "include archived notes")
|
|
126
|
+
.option("-t, --tag <tags>", "comma-separated tags to filter by")
|
|
120
127
|
.action(async (keyword, options) => {
|
|
121
128
|
const client = new RoteClient();
|
|
129
|
+
const tag = parseTags(options.tag);
|
|
122
130
|
const notes = await client.searchNotes({
|
|
123
131
|
keyword,
|
|
124
132
|
limit: options.limit,
|
|
125
133
|
skip: options.skip,
|
|
134
|
+
archived: options.archived,
|
|
135
|
+
tag: tag.length > 0 ? tag : undefined,
|
|
136
|
+
});
|
|
137
|
+
printNotes(notes);
|
|
138
|
+
});
|
|
139
|
+
program
|
|
140
|
+
.command("list")
|
|
141
|
+
.description("List recent notes")
|
|
142
|
+
.option("-l, --limit <limit>", "max results", parseInt, 10)
|
|
143
|
+
.option("-s, --skip <skip>", "offset", parseInt, 0)
|
|
144
|
+
.option("--archived", "include archived notes")
|
|
145
|
+
.option("-t, --tag <tags>", "comma-separated tags to filter by")
|
|
146
|
+
.action(async (options) => {
|
|
147
|
+
const client = new RoteClient();
|
|
148
|
+
const tag = parseTags(options.tag);
|
|
149
|
+
const notes = await client.listNotes({
|
|
150
|
+
limit: options.limit,
|
|
151
|
+
skip: options.skip,
|
|
152
|
+
archived: options.archived,
|
|
153
|
+
tag: tag.length > 0 ? tag : undefined,
|
|
126
154
|
});
|
|
127
155
|
printNotes(notes);
|
|
128
156
|
});
|
package/dist/config.js
CHANGED
|
@@ -19,12 +19,12 @@ export function saveConfig(config) {
|
|
|
19
19
|
}
|
|
20
20
|
export function loadConfig() {
|
|
21
21
|
if (!existsSync(CONFIG_PATH)) {
|
|
22
|
-
throw new Error(`Config not found at ${CONFIG_PATH}. Run "rote
|
|
22
|
+
throw new Error(`Config not found at ${CONFIG_PATH}. Run "rote config" first.`);
|
|
23
23
|
}
|
|
24
24
|
const raw = readFileSync(CONFIG_PATH, 'utf8');
|
|
25
25
|
const parsed = JSON.parse(raw);
|
|
26
26
|
if (!parsed.apiUrl || !parsed.openKey) {
|
|
27
|
-
throw new Error(`Invalid config at ${CONFIG_PATH}. Run "rote
|
|
27
|
+
throw new Error(`Invalid config at ${CONFIG_PATH}. Run "rote config" again.`);
|
|
28
28
|
}
|
|
29
29
|
return {
|
|
30
30
|
apiUrl: normalizeApiUrl(parsed.apiUrl),
|
package/dist/mcp.js
CHANGED
|
@@ -16,17 +16,21 @@ export async function startMcpServer() {
|
|
|
16
16
|
title: z.string().optional().describe("Optional note title"),
|
|
17
17
|
tags: z.array(z.string()).optional().describe("Optional list of tags"),
|
|
18
18
|
state: z.string().optional().describe("Note state, default private"),
|
|
19
|
+
type: z.string().optional().describe("Note type, default rote"),
|
|
20
|
+
pin: z.boolean().optional().describe("Whether to pin the note"),
|
|
19
21
|
articleId: z
|
|
20
22
|
.string()
|
|
21
23
|
.optional()
|
|
22
24
|
.describe("Optional article ID to bind to"),
|
|
23
25
|
},
|
|
24
|
-
}, async ({ content, title, tags, state, articleId }) => {
|
|
26
|
+
}, async ({ content, title, tags, state, type, pin, articleId }) => {
|
|
25
27
|
const note = await client.createNote({
|
|
26
28
|
content,
|
|
27
29
|
title,
|
|
28
30
|
tags,
|
|
29
31
|
state,
|
|
32
|
+
type,
|
|
33
|
+
pin,
|
|
30
34
|
articleId,
|
|
31
35
|
});
|
|
32
36
|
return {
|
|
@@ -163,9 +167,17 @@ export async function startMcpServer() {
|
|
|
163
167
|
.min(0)
|
|
164
168
|
.optional()
|
|
165
169
|
.describe("Pagination offset, default 0"),
|
|
170
|
+
archived: z.boolean().optional().describe("Include archived notes"),
|
|
171
|
+
tag: z.array(z.string()).optional().describe("Tag filter"),
|
|
166
172
|
},
|
|
167
|
-
}, async ({ keyword, limit, skip }) => {
|
|
168
|
-
const notes = await client.searchNotes({
|
|
173
|
+
}, async ({ keyword, limit, skip, archived, tag }) => {
|
|
174
|
+
const notes = await client.searchNotes({
|
|
175
|
+
keyword,
|
|
176
|
+
limit,
|
|
177
|
+
skip,
|
|
178
|
+
archived,
|
|
179
|
+
tag,
|
|
180
|
+
});
|
|
169
181
|
const lines = notes.map((note, i) => `${i + 1}. ${truncateSingleLine(note.content, 100)}`);
|
|
170
182
|
return {
|
|
171
183
|
content: [
|
|
@@ -192,9 +204,11 @@ export async function startMcpServer() {
|
|
|
192
204
|
.min(0)
|
|
193
205
|
.optional()
|
|
194
206
|
.describe("Pagination offset, default 0"),
|
|
207
|
+
archived: z.boolean().optional().describe("Include archived notes"),
|
|
208
|
+
tag: z.array(z.string()).optional().describe("Tag filter"),
|
|
195
209
|
},
|
|
196
|
-
}, async ({ limit, skip }) => {
|
|
197
|
-
const notes = await client.listNotes({ limit, skip });
|
|
210
|
+
}, async ({ limit, skip, archived, tag }) => {
|
|
211
|
+
const notes = await client.listNotes({ limit, skip, archived, tag });
|
|
198
212
|
const lines = notes.map((note, i) => `${i + 1}. ${truncateSingleLine(note.content, 100)}`);
|
|
199
213
|
return {
|
|
200
214
|
content: [
|
package/dist/types.d.ts
CHANGED
|
@@ -83,8 +83,12 @@ export interface SearchNotesInput {
|
|
|
83
83
|
keyword: string;
|
|
84
84
|
limit?: number;
|
|
85
85
|
skip?: number;
|
|
86
|
+
archived?: boolean;
|
|
87
|
+
tag?: string[];
|
|
86
88
|
}
|
|
87
89
|
export interface ListNotesInput {
|
|
88
90
|
limit?: number;
|
|
89
91
|
skip?: number;
|
|
92
|
+
archived?: boolean;
|
|
93
|
+
tag?: string[];
|
|
90
94
|
}
|