@lih-x-x/kmr 1.0.65 → 1.0.67

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.
@@ -52,14 +52,17 @@ var TaskCreator = class {
52
52
  taskBody.due = { timestamp: dueDate.getTime().toString(), is_all_day: true };
53
53
  updateFields.push("due");
54
54
  }
55
- console.log(`[task] \u66F4\u65B0\u98DE\u4E66\u4EFB\u52A1: taskId=${taskId}`);
56
- await this.client.task.v2.task.patch({
57
- path: { task_guid: taskId },
58
- params: { user_id_type: "open_id" },
59
- data: { task: taskBody, update_fields: updateFields }
60
- });
55
+ if (updateFields.length > 0) {
56
+ console.log(`[task] patch \u4EFB\u52A1\u5B57\u6BB5: ${updateFields.join(", ")}`);
57
+ await this.client.task.v2.task.patch({
58
+ path: { task_guid: taskId },
59
+ params: { user_id_type: "open_id" },
60
+ data: { task: taskBody, update_fields: updateFields }
61
+ });
62
+ }
61
63
  if (params.assigneeOpenId) {
62
64
  try {
65
+ console.log(`[task] addMembers: taskId=${taskId}, assignee=${params.assigneeOpenId}`);
63
66
  await this.client.task.v2.task.addMembers({
64
67
  path: { task_guid: taskId },
65
68
  params: { user_id_type: "open_id" },
package/dist/cli.js CHANGED
@@ -6,9 +6,9 @@ async function checkUpdate() {
6
6
  try {
7
7
  const res = await fetch(`https://registry.npmjs.org/${"@lih-x-x/kmr"}/latest`, { signal: AbortSignal.timeout(3e3) });
8
8
  const data = await res.json();
9
- if (data.version && data.version !== "1.0.65") {
9
+ if (data.version && data.version !== "1.0.67") {
10
10
  console.log(`
11
- \u2B06\uFE0F \u65B0\u7248\u672C\u53EF\u7528: ${"1.0.65"} \u2192 ${data.version}`);
11
+ \u2B06\uFE0F \u65B0\u7248\u672C\u53EF\u7528: ${"1.0.67"} \u2192 ${data.version}`);
12
12
  console.log(` \u8FD0\u884C npm install -g ${"@lih-x-x/kmr"} \u66F4\u65B0
13
13
  `);
14
14
  }
@@ -56,12 +56,12 @@ KMR\uFF08Key Meetings Record\uFF09\u2014 \u4F1A\u8BAE\u6316\u6398\u673A
56
56
  kmr --help \u663E\u793A\u5E2E\u52A9
57
57
  `);
58
58
  } else if (command === "--version" || command === "-v") {
59
- console.log("1.0.65");
59
+ console.log("1.0.67");
60
60
  } else if (command === "list") {
61
61
  const { loadConfig } = await import("./config-WIQGW5OC.js");
62
62
  const { JsonStore } = await import("./jsonStore-AL73KEUG.js");
63
63
  const { createLarkClient } = await import("./client-DFBBDD77.js");
64
- const { TaskCreator } = await import("./taskCreator-Z76NRK3F.js");
64
+ const { TaskCreator } = await import("./taskCreator-3W5BJ4Z7.js");
65
65
  const { syncTaskStatuses } = await import("./sync-FJA2I3HE.js");
66
66
  const config = loadConfig();
67
67
  const store = new JsonStore(config.storage.dataDir);
@@ -84,7 +84,7 @@ KMR\uFF08Key Meetings Record\uFF09\u2014 \u4F1A\u8BAE\u6316\u6398\u673A
84
84
  const { loadConfig } = await import("./config-WIQGW5OC.js");
85
85
  const { JsonStore } = await import("./jsonStore-AL73KEUG.js");
86
86
  const { createLarkClient } = await import("./client-DFBBDD77.js");
87
- const { TaskCreator } = await import("./taskCreator-Z76NRK3F.js");
87
+ const { TaskCreator } = await import("./taskCreator-3W5BJ4Z7.js");
88
88
  const { syncTaskStatuses } = await import("./sync-FJA2I3HE.js");
89
89
  const config = loadConfig();
90
90
  const store = new JsonStore(config.storage.dataDir);
@@ -101,7 +101,7 @@ KMR\uFF08Key Meetings Record\uFF09\u2014 \u4F1A\u8BAE\u6316\u6398\u673A
101
101
  const { loadConfig } = await import("./config-WIQGW5OC.js");
102
102
  const { JsonStore } = await import("./jsonStore-AL73KEUG.js");
103
103
  const { createLarkClient } = await import("./client-DFBBDD77.js");
104
- const { TaskCreator } = await import("./taskCreator-Z76NRK3F.js");
104
+ const { TaskCreator } = await import("./taskCreator-3W5BJ4Z7.js");
105
105
  const { syncTaskStatuses } = await import("./sync-FJA2I3HE.js");
106
106
  const config = loadConfig();
107
107
  const store = new JsonStore(config.storage.dataDir);
@@ -162,7 +162,7 @@ KMR\uFF08Key Meetings Record\uFF09\u2014 \u4F1A\u8BAE\u6316\u6398\u673A
162
162
  }
163
163
  const { loadConfig } = await import("./config-WIQGW5OC.js");
164
164
  const { createLarkClient } = await import("./client-DFBBDD77.js");
165
- const { TaskCreator } = await import("./taskCreator-Z76NRK3F.js");
165
+ const { TaskCreator } = await import("./taskCreator-3W5BJ4Z7.js");
166
166
  const { UserResolver } = await import("./userResolver-F76R3ZMT.js");
167
167
  const { JsonStore } = await import("./jsonStore-AL73KEUG.js");
168
168
  const config = loadConfig();
@@ -200,7 +200,14 @@ KMR\uFF08Key Meetings Record\uFF09\u2014 \u4F1A\u8BAE\u6316\u6398\u673A
200
200
  if (!record) {
201
201
  console.error(`\u26A0\uFE0F \u672A\u627E\u5230\u4F1A\u8BAE\u8BB0\u5F55 "${meetingId}"\uFF0C\u4EFB\u52A1\u672A\u5173\u8054\u4FDD\u5B58`);
202
202
  } else {
203
- record.createdTasks = [...record.createdTasks || [], taskEntry];
203
+ const todoIdx = record.todos.length;
204
+ record.todos = [...record.todos, {
205
+ content: desc ? `${summary}\uFF1A${desc}` : summary,
206
+ owner: assignee || "",
207
+ deadline: due || "",
208
+ status: "open"
209
+ }];
210
+ record.createdTasks = [...record.createdTasks || [], { ...taskEntry, todoIndex: todoIdx }];
204
211
  await store.save(record);
205
212
  console.log(` \u5DF2\u5173\u8054\u5230\u4F1A\u8BAE: ${record.summary.title}`);
206
213
  }
@@ -223,6 +230,12 @@ KMR\uFF08Key Meetings Record\uFF09\u2014 \u4F1A\u8BAE\u6316\u6398\u673A
223
230
  };
224
231
  }
225
232
  standalone.createdTasks = [...standalone.createdTasks || [], taskEntry];
233
+ standalone.todos = [...standalone.todos || [], {
234
+ content: desc ? `${summary}\uFF1A${desc}` : summary,
235
+ owner: assignee || "",
236
+ deadline: due || "",
237
+ status: "open"
238
+ }];
226
239
  await store.save(standalone);
227
240
  console.log(` \u5DF2\u4FDD\u5B58\u5230\u72EC\u7ACB\u4EFB\u52A1\u8BB0\u5F55`);
228
241
  }
@@ -251,7 +264,7 @@ KMR\uFF08Key Meetings Record\uFF09\u2014 \u4F1A\u8BAE\u6316\u6398\u673A
251
264
  }
252
265
  const { loadConfig } = await import("./config-WIQGW5OC.js");
253
266
  const { createLarkClient } = await import("./client-DFBBDD77.js");
254
- const { TaskCreator } = await import("./taskCreator-Z76NRK3F.js");
267
+ const { TaskCreator } = await import("./taskCreator-3W5BJ4Z7.js");
255
268
  const { UserResolver } = await import("./userResolver-F76R3ZMT.js");
256
269
  const { JsonStore } = await import("./jsonStore-AL73KEUG.js");
257
270
  const config = loadConfig();
@@ -276,18 +289,22 @@ KMR\uFF08Key Meetings Record\uFF09\u2014 \u4F1A\u8BAE\u6316\u6398\u673A
276
289
  }
277
290
  await taskCreator.updateTask(taskId, { summary, due, assigneeOpenId });
278
291
  console.log(`\u2705 \u4EFB\u52A1\u5DF2\u66F4\u65B0: ${taskId}`);
279
- if (summary) {
280
- const all = await store.list();
281
- for (const record of all) {
282
- if (!record.createdTasks) continue;
283
- const task = record.createdTasks.find((t) => t.taskId === taskId);
284
- if (task) {
285
- task.summary = summary;
286
- await store.save(record);
287
- console.log(` \u672C\u5730\u8BB0\u5F55\u5DF2\u540C\u6B65\u66F4\u65B0`);
288
- break;
289
- }
292
+ const all = await store.list();
293
+ for (const record of all) {
294
+ if (!record.createdTasks) continue;
295
+ const taskIdx = record.createdTasks.findIndex((t) => t.taskId === taskId);
296
+ if (taskIdx === -1) continue;
297
+ const task = record.createdTasks[taskIdx];
298
+ if (summary) task.summary = summary;
299
+ const todoIdx = task.todoIndex !== void 0 ? task.todoIndex : record.todos.findIndex((t) => t.content.startsWith(task.summary) || task.summary.startsWith(t.content.split("\uFF1A")[0]));
300
+ if (todoIdx >= 0 && record.todos[todoIdx]) {
301
+ if (summary) record.todos[todoIdx].content = summary;
302
+ if (due) record.todos[todoIdx].deadline = due;
303
+ if (assignee) record.todos[todoIdx].owner = assignee;
290
304
  }
305
+ await store.save(record);
306
+ console.log(` \u672C\u5730\u8BB0\u5F55\u5DF2\u540C\u6B65\u66F4\u65B0`);
307
+ break;
291
308
  }
292
309
  } else if (command === "find") {
293
310
  const query = argv.slice(3).join(" ");
@@ -300,7 +317,7 @@ KMR\uFF08Key Meetings Record\uFF09\u2014 \u4F1A\u8BAE\u6316\u6398\u673A
300
317
  const { QueryHandler } = await import("./handler-46CQQIA2.js");
301
318
  const { JsonStore } = await import("./jsonStore-AL73KEUG.js");
302
319
  const { createLarkClient } = await import("./client-DFBBDD77.js");
303
- const { TaskCreator } = await import("./taskCreator-Z76NRK3F.js");
320
+ const { TaskCreator } = await import("./taskCreator-3W5BJ4Z7.js");
304
321
  const { syncTaskStatuses } = await import("./sync-FJA2I3HE.js");
305
322
  const config = loadConfig();
306
323
  const store = new JsonStore(config.storage.dataDir);
package/dist/index.js CHANGED
@@ -22,7 +22,7 @@ import {
22
22
  } from "./chunk-3F3LSPSA.js";
23
23
  import {
24
24
  TaskCreator
25
- } from "./chunk-QI7CDIMQ.js";
25
+ } from "./chunk-JEMQGVQB.js";
26
26
  import {
27
27
  syncTaskStatuses
28
28
  } from "./chunk-XQVLJTP4.js";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  TaskCreator
3
- } from "./chunk-QI7CDIMQ.js";
3
+ } from "./chunk-JEMQGVQB.js";
4
4
  export {
5
5
  TaskCreator
6
6
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lih-x-x/kmr",
3
- "version": "1.0.65",
3
+ "version": "1.0.67",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "bin": {