lystbot 0.3.0 โ†’ 0.3.2

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 (3) hide show
  1. package/package.json +1 -1
  2. package/src/index.js +35 -3
  3. package/src/mcp.js +11 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lystbot",
3
- "version": "0.3.0",
3
+ "version": "0.3.2",
4
4
  "description": "LystBot CLI - Manage your lists from the terminal",
5
5
  "main": "src/index.js",
6
6
  "bin": {
package/src/index.js CHANGED
@@ -323,6 +323,38 @@ program
323
323
  console.log(`๐Ÿ—‘๏ธ Removed: ${item.text}`);
324
324
  });
325
325
 
326
+ // โ”€โ”€ clear โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
327
+ program
328
+ .command('clear <list>')
329
+ .description('Remove all checked (completed) items from a list')
330
+ .option('--force', 'Skip confirmation')
331
+ .action(async (listQuery, options) => {
332
+ config.getApiKey();
333
+ const { list, detail } = await api.resolveList(listQuery, { withItems: true });
334
+ const checked = (detail.items || []).filter(i => i.checked);
335
+
336
+ if (checked.length === 0) {
337
+ console.log(`โœจ No checked items in ${list.emoji || '๐Ÿ“‹'} ${list.title || list.name}`);
338
+ return;
339
+ }
340
+
341
+ if (!options.force) {
342
+ const rl = readline.createInterface({ input: process.stdin, output: process.stdout });
343
+ const answer = await new Promise(resolve =>
344
+ rl.question(`๐Ÿงน Remove ${checked.length} checked item(s) from '${list.emoji || ''} ${list.title || list.name}'? (y/N) `, resolve)
345
+ );
346
+ rl.close();
347
+
348
+ if (answer.toLowerCase() !== 'y') {
349
+ console.log('Cancelled.');
350
+ process.exit(0);
351
+ }
352
+ }
353
+
354
+ const result = await api.request('DELETE', `/lists/${list.id}/items/checked`);
355
+ console.log(`๐Ÿงน Cleared ${result.deleted_count} checked item(s) from ${list.emoji || '๐Ÿ“‹'} ${list.title || list.name}`);
356
+ });
357
+
326
358
  // โ”€โ”€ create โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
327
359
  program
328
360
  .command('create <name>')
@@ -377,8 +409,8 @@ program
377
409
 
378
410
  const result = await api.request('POST', `/lists/${list.id}/share`);
379
411
  console.log(`\n๐Ÿ”— Share code for ${list.emoji || '๐Ÿ“‹'} ${list.title || list.name}:\n`);
380
- console.log(` ${result.shareCode}\n`);
381
- console.log(` Others can join with: lystbot join ${result.shareCode}`);
412
+ console.log(` ${result.share_code}\n`);
413
+ console.log(` Others can join with: lystbot join ${result.share_code}`);
382
414
  });
383
415
 
384
416
  // โ”€โ”€ join โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
@@ -387,7 +419,7 @@ program
387
419
  .description('Join a shared list using a share code')
388
420
  .action(async (code) => {
389
421
  config.getApiKey();
390
- const list = await api.request('POST', '/lists/join', { shareCode: code });
422
+ const list = await api.request('POST', '/lists/join', { code });
391
423
  console.log(`๐Ÿค Joined: ${list.emoji || '๐Ÿ“‹'} ${list.title || list.name} (${list.item_count || 0} items)`);
392
424
  });
393
425
 
package/src/mcp.js CHANGED
@@ -203,6 +203,17 @@ async function startMcpServer() {
203
203
  return { content: [{ type: 'text', text: `๐Ÿ—‘๏ธ Removed: ${found.text}` }] };
204
204
  });
205
205
 
206
+ server.tool('clear_checked', 'Remove all checked (completed) items from a list', {
207
+ list: { type: 'string', description: 'List name or ID' },
208
+ }, async ({ list: query }) => {
209
+ const all = await api('GET', '/lists');
210
+ const match = findList(all.lists || all, query);
211
+ if (!match) throw new Error(`List "${query}" not found`);
212
+
213
+ const data = await api('DELETE', `/lists/${match.id}/items/checked`);
214
+ return { content: [{ type: 'text', text: `๐Ÿงน Cleared ${data.deleted_count} checked item(s) from ${match.emoji || '๐Ÿ“‹'} ${match.title}` }] };
215
+ });
216
+
206
217
  server.tool('share_list', 'Generate a share code for a list', {
207
218
  list: { type: 'string', description: 'List name or ID' },
208
219
  }, async ({ list: query }) => {