Files
jackwener__opencli/clis/mubu/recent.js
SherlockSalvatore 2aee4caa10 feat(mubu): add Mubu adapter with 5 commands (#964)
* feat(mubu): add mubu (mubu.com) adapter with 5 commands

Commands: doc, docs, notes, recent, search.

- Uses COOKIE strategy; API calls via in-page XHR with Jwt-Token
  from localStorage (matches the web app's own mechanism).
- Renders node trees to Markdown (default) or plain text;
  supports tables, tasks, images, emoji, mentions, strikethrough,
  underline, and nested structures.
- notes supports flexible time ranges: single day, month, year,
  or custom --from/--to spans, plus a --list overview mode.
- search returns full-text matches with hit count and snippets
  for both folders and documents.

* fix(manifest): register mubu commands in runtime manifest

---------

Co-authored-by: jackwener <jakevingoo@gmail.com>
2026-04-13 16:50:32 +08:00

28 lines
737 B
JavaScript

import { cli, Strategy } from '@jackwener/opencli/registry';
import { formatDate, mubuPost } from './utils.js';
cli({
site: 'mubu',
name: 'recent',
description: '最近编辑的幕布文档',
domain: 'mubu.com',
strategy: Strategy.COOKIE,
args: [
{ name: 'limit', type: 'int', default: 20, help: '最多显示条数' },
],
columns: ['id', 'name', 'updated'],
func: async (page, kwargs) => {
const limit = kwargs.limit;
await page.goto('https://mubu.com/app');
const data = await mubuPost(page, '/list/get', { folderId: 'recent' });
return (data.documents ?? []).slice(0, limit).map((doc) => ({
id: doc.id,
name: doc.name,
updated: formatDate(doc.updateTime),
}));
},
});