zele 0.3.20 → 0.3.21
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 +20 -15
- package/dist/commands/auth-cmd.js +58 -52
- package/dist/commands/auth-cmd.js.map +1 -1
- package/dist/commands/calendar.js +13 -14
- package/dist/commands/calendar.js.map +1 -1
- package/dist/commands/draft.js +11 -12
- package/dist/commands/draft.js.map +1 -1
- package/dist/commands/label.js +5 -6
- package/dist/commands/label.js.map +1 -1
- package/dist/commands/mail.js +10 -10
- package/dist/commands/mail.js.map +1 -1
- package/dist/commands/watch.js +2 -2
- package/dist/commands/watch.js.map +1 -1
- package/package.json +2 -1
- package/skills/zele/SKILL.md +8 -1
- package/src/commands/auth-cmd.ts +64 -54
- package/src/commands/calendar.ts +13 -14
- package/src/commands/draft.ts +11 -12
- package/src/commands/label.ts +5 -6
- package/src/commands/mail.ts +10 -10
- package/src/commands/watch.ts +2 -2
package/src/commands/mail.ts
CHANGED
|
@@ -52,15 +52,15 @@ export function registerMailCommands(cli: ZeleCli) {
|
|
|
52
52
|
cli
|
|
53
53
|
.command('mail list', 'List email threads')
|
|
54
54
|
.option('--folder [folder]', 'Folder to list (inbox, sent, trash, spam, starred, drafts, archive, all) (default: inbox)')
|
|
55
|
-
.option('--
|
|
55
|
+
.option('--limit [limit]', 'Max threads to show (default: 20)')
|
|
56
56
|
.option('--page <page>', 'Pagination token (requires --account, only works for a single account)')
|
|
57
57
|
.option('--label <label>', 'Filter by label name')
|
|
58
58
|
.option('--filter <filter>', 'Gmail search filter (e.g. "is:unread", "from:github", "has:attachment")')
|
|
59
59
|
.action(async (options) => {
|
|
60
|
-
// `options.folder` / `options.
|
|
60
|
+
// `options.folder` / `options.limit` are `string | undefined` now.
|
|
61
61
|
// `''` (bare flag) falls back to the default via `||`.
|
|
62
62
|
const folder = options.folder || 'inbox'
|
|
63
|
-
const
|
|
63
|
+
const limit = options.limit ? Number(options.limit) : 20
|
|
64
64
|
const clients = await getClients(options.account)
|
|
65
65
|
|
|
66
66
|
if (options.page && clients.length > 1) {
|
|
@@ -73,7 +73,7 @@ export function registerMailCommands(cli: ZeleCli) {
|
|
|
73
73
|
clients.map(async ({ email, client, accountType }) => {
|
|
74
74
|
const result = await client.listThreads({
|
|
75
75
|
folder,
|
|
76
|
-
maxResults:
|
|
76
|
+
maxResults: limit,
|
|
77
77
|
labelIds: options.label ? [options.label] : undefined,
|
|
78
78
|
pageToken: options.page,
|
|
79
79
|
query: options.filter,
|
|
@@ -102,13 +102,13 @@ export function registerMailCommands(cli: ZeleCli) {
|
|
|
102
102
|
const labelMap = new Map<string, string>()
|
|
103
103
|
for (const r of allResults) for (const [id, name] of r.labelMap) labelMap.set(id, name)
|
|
104
104
|
|
|
105
|
-
// Merge threads from all accounts, sorted by date descending, capped at
|
|
105
|
+
// Merge threads from all accounts, sorted by date descending, capped at limit
|
|
106
106
|
const merged = allResults
|
|
107
107
|
.flatMap(({ email, result }) =>
|
|
108
108
|
result.threads.map((t) => ({ ...t, account: email })),
|
|
109
109
|
)
|
|
110
110
|
.sort((a, b) => new Date(b.date).getTime() - new Date(a.date).getTime())
|
|
111
|
-
.slice(0,
|
|
111
|
+
.slice(0, limit)
|
|
112
112
|
|
|
113
113
|
if (merged.length === 0) {
|
|
114
114
|
out.printList([], { summary: 'No threads found' })
|
|
@@ -150,10 +150,10 @@ export function registerMailCommands(cli: ZeleCli) {
|
|
|
150
150
|
|
|
151
151
|
cli
|
|
152
152
|
.command('mail search <query>', 'Search email threads using Gmail query syntax (from:, to:, subject:, has:attachment, etc). See https://support.google.com/mail/answer/7190')
|
|
153
|
-
.option('--
|
|
153
|
+
.option('--limit [limit]', 'Max results to show (default: 20)')
|
|
154
154
|
.option('--page <page>', 'Pagination token (requires --account, only works for a single account)')
|
|
155
155
|
.action(async (query, options) => {
|
|
156
|
-
const
|
|
156
|
+
const limit = options.limit ? Number(options.limit) : 20
|
|
157
157
|
const clients = await getClients(options.account)
|
|
158
158
|
|
|
159
159
|
if (options.page && clients.length > 1) {
|
|
@@ -166,7 +166,7 @@ export function registerMailCommands(cli: ZeleCli) {
|
|
|
166
166
|
clients.map(async ({ email, client, accountType }) => {
|
|
167
167
|
const result = await client.listThreads({
|
|
168
168
|
query,
|
|
169
|
-
maxResults:
|
|
169
|
+
maxResults: limit,
|
|
170
170
|
pageToken: options.page,
|
|
171
171
|
})
|
|
172
172
|
if (result instanceof Error) return result
|
|
@@ -197,7 +197,7 @@ export function registerMailCommands(cli: ZeleCli) {
|
|
|
197
197
|
result.threads.map((t) => ({ ...t, account: email })),
|
|
198
198
|
)
|
|
199
199
|
.sort((a, b) => new Date(b.date).getTime() - new Date(a.date).getTime())
|
|
200
|
-
.slice(0,
|
|
200
|
+
.slice(0, limit)
|
|
201
201
|
|
|
202
202
|
if (merged.length === 0) {
|
|
203
203
|
out.printList([], { summary: `No results for "${query}"` })
|
package/src/commands/watch.ts
CHANGED
|
@@ -18,7 +18,7 @@ export function registerWatchCommands(cli: ZeleCli) {
|
|
|
18
18
|
.command('mail watch', 'Watch for new emails (poll via History API)')
|
|
19
19
|
.option('--interval [interval]', z.string().describe('Poll interval in seconds (default: 15)'))
|
|
20
20
|
.option('--folder [folder]', z.string().describe('Folder to watch (default: inbox)'))
|
|
21
|
-
.option('--
|
|
21
|
+
.option('--filter [filter]', z.string().describe('Filter messages client-side (from:, to:, cc:, subject:, is:unread, is:starred, has:attachment, -negate). See https://support.google.com/mail/answer/7190'))
|
|
22
22
|
.option('--once', z.boolean().describe('Print changes once and exit (no loop)'))
|
|
23
23
|
.action(async (options) => {
|
|
24
24
|
const interval = options.interval ? Number(options.interval) : 15
|
|
@@ -43,7 +43,7 @@ export function registerWatchCommands(cli: ZeleCli) {
|
|
|
43
43
|
client.watchInbox({
|
|
44
44
|
folder,
|
|
45
45
|
intervalMs: interval * 1000,
|
|
46
|
-
query: options.
|
|
46
|
+
query: options.filter,
|
|
47
47
|
once: options.once,
|
|
48
48
|
}),
|
|
49
49
|
)
|