@lih-x-x/kmr 1.0.66 → 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.
Files changed (2) hide show
  1. package/dist/cli.js +32 -15
  2. package/package.json +1 -1
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.66") {
9
+ if (data.version && data.version !== "1.0.67") {
10
10
  console.log(`
11
- \u2B06\uFE0F \u65B0\u7248\u672C\u53EF\u7528: ${"1.0.66"} \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,7 +56,7 @@ 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.66");
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");
@@ -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
  }
@@ -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(" ");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lih-x-x/kmr",
3
- "version": "1.0.66",
3
+ "version": "1.0.67",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "bin": {