@vm0/cli 9.251.1 → 9.252.0
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/{agent-BNFNLNHG.js → agent-DJY6SYVC.js} +7 -7
- package/{banking-TCGIBAP6.js → banking-SV5ZIH44.js} +5 -5
- package/{chat-YPDUENU7.js → chat-G2KQYYK5.js} +6 -6
- package/{chunk-DLKSV2HZ.js → chunk-AWLNHCAC.js} +4 -4
- package/{chunk-GO2ZC4S5.js → chunk-BKSVVARX.js} +2 -2
- package/{chunk-BRSUIBNM.js → chunk-BSDS7GCS.js} +5 -4
- package/chunk-BSDS7GCS.js.map +1 -0
- package/{chunk-B7MK54AY.js → chunk-CUAL7MH6.js} +2 -2
- package/{chunk-4CCCO3QU.js → chunk-DK3C2ME6.js} +13 -1
- package/chunk-DK3C2ME6.js.map +1 -0
- package/{chunk-4GD76EQ4.js → chunk-E2DKMMGY.js} +3 -3
- package/{chunk-CV7MCB2U.js → chunk-I56DJKTX.js} +3 -3
- package/{chunk-CV7MCB2U.js.map → chunk-I56DJKTX.js.map} +1 -1
- package/{chunk-KHZ4LMY2.js → chunk-IX2GN2TI.js} +2 -2
- package/{chunk-PP2JWZSG.js → chunk-QL2BWE6J.js} +343 -20
- package/chunk-QL2BWE6J.js.map +1 -0
- package/{chunk-6AKLTZUH.js → chunk-RGHA7C2O.js} +2 -2
- package/{chunk-U3VV27JW.js → chunk-TRFIH4R5.js} +2 -2
- package/{computer-use-VXYMW7DO.js → computer-use-FUBM53XG.js} +5 -5
- package/{connector-UIBA5P4Z.js → connector-3GCLB6HW.js} +8 -8
- package/{credit-GWNSOZOX.js → credit-SXRYMKSD.js} +7 -7
- package/{developer-support-QOTFHN2S.js → developer-support-LQHWOQLY.js} +5 -5
- package/{doctor-G4UUSU3R.js → doctor-RVC32BKE.js} +7 -7
- package/feishu-62E2QMM5.js +277 -0
- package/feishu-62E2QMM5.js.map +1 -0
- package/{finance-QEB2AYB4.js → finance-HP4WFZUY.js} +5 -5
- package/{generate-Y2GBOZ4T.js → generate-PTBOIM6B.js} +7 -7
- package/{github-JX5PFWTW.js → github-62XSFEWF.js} +5 -5
- package/{goal-ETVDARSU.js → goal-VRWB2AS3.js} +5 -5
- package/{host-OTBNOMJO.js → host-OKISPSSS.js} +5 -5
- package/{logs-MK4VKYGE.js → logs-53CMUU4J.js} +6 -6
- package/{mail-4WPLYKL5.js → mail-E6R5V6F6.js} +7 -7
- package/{maps-7YWGDMU4.js → maps-B7F3CODU.js} +5 -5
- package/{model-P5TLS3KD.js → model-2VZQVFTE.js} +6 -6
- package/{model-provider-YUQ65CGB.js → model-provider-XALJ5BZB.js} +6 -6
- package/{org-BO46UGHP.js → org-JIAZYZUL.js} +5 -5
- package/package.json +1 -1
- package/{people-search-6JZNG46F.js → people-search-LZ2BRXA6.js} +5 -5
- package/{phone-OLPRI3UD.js → phone-MXUV3YD3.js} +5 -5
- package/{preference-OSLWFBAT.js → preference-LONJZKPE.js} +5 -5
- package/{resource-6IX3QB3W.js → resource-26IQ2JCS.js} +5 -5
- package/{scrape-T6XHTU6J.js → scrape-H2ZA5AJD.js} +5 -5
- package/{search-KYW4WRMQ.js → search-R62IJFT4.js} +6 -6
- package/{secret-ORODPPSX.js → secret-PHZZWEE3.js} +5 -5
- package/{slack-CXZCQ5HU.js → slack-DQJUJIWY.js} +174 -47
- package/slack-DQJUJIWY.js.map +1 -0
- package/{teams-CGDBFXQ2.js → teams-B5NDIX3U.js} +5 -5
- package/{telegram-SCGQFOYI.js → telegram-R67CYOON.js} +5 -5
- package/{upgrade-3LEF7WD7.js → upgrade-FJKXJO6L.js} +4 -4
- package/{variable-G6WZKJJG.js → variable-GNCE5TUG.js} +5 -5
- package/{video-JKYPCENK.js → video-UDPAFI36.js} +4 -4
- package/{weather-3WQV3JMX.js → weather-O6L5SALA.js} +5 -5
- package/{web-3FRUHVEN.js → web-6I5S773Q.js} +5 -5
- package/{web-search-H6WV4RFE.js → web-search-GQAKFVCC.js} +5 -5
- package/{whoami-BMNW6CH3.js → whoami-MEJV5DZB.js} +7 -7
- package/{workflow-O6CVNJWM.js → workflow-PEVNMY2N.js} +5 -5
- package/zero.js +42 -42
- package/chunk-4CCCO3QU.js.map +0 -1
- package/chunk-BRSUIBNM.js.map +0 -1
- package/chunk-PP2JWZSG.js.map +0 -1
- package/feishu-GQEAUNH3.js +0 -119
- package/feishu-GQEAUNH3.js.map +0 -1
- package/slack-CXZCQ5HU.js.map +0 -1
- /package/{agent-BNFNLNHG.js.map → agent-DJY6SYVC.js.map} +0 -0
- /package/{banking-TCGIBAP6.js.map → banking-SV5ZIH44.js.map} +0 -0
- /package/{chat-YPDUENU7.js.map → chat-G2KQYYK5.js.map} +0 -0
- /package/{chunk-DLKSV2HZ.js.map → chunk-AWLNHCAC.js.map} +0 -0
- /package/{chunk-GO2ZC4S5.js.map → chunk-BKSVVARX.js.map} +0 -0
- /package/{chunk-B7MK54AY.js.map → chunk-CUAL7MH6.js.map} +0 -0
- /package/{chunk-4GD76EQ4.js.map → chunk-E2DKMMGY.js.map} +0 -0
- /package/{chunk-KHZ4LMY2.js.map → chunk-IX2GN2TI.js.map} +0 -0
- /package/{chunk-6AKLTZUH.js.map → chunk-RGHA7C2O.js.map} +0 -0
- /package/{chunk-U3VV27JW.js.map → chunk-TRFIH4R5.js.map} +0 -0
- /package/{computer-use-VXYMW7DO.js.map → computer-use-FUBM53XG.js.map} +0 -0
- /package/{connector-UIBA5P4Z.js.map → connector-3GCLB6HW.js.map} +0 -0
- /package/{credit-GWNSOZOX.js.map → credit-SXRYMKSD.js.map} +0 -0
- /package/{developer-support-QOTFHN2S.js.map → developer-support-LQHWOQLY.js.map} +0 -0
- /package/{doctor-G4UUSU3R.js.map → doctor-RVC32BKE.js.map} +0 -0
- /package/{finance-QEB2AYB4.js.map → finance-HP4WFZUY.js.map} +0 -0
- /package/{generate-Y2GBOZ4T.js.map → generate-PTBOIM6B.js.map} +0 -0
- /package/{github-JX5PFWTW.js.map → github-62XSFEWF.js.map} +0 -0
- /package/{goal-ETVDARSU.js.map → goal-VRWB2AS3.js.map} +0 -0
- /package/{host-OTBNOMJO.js.map → host-OKISPSSS.js.map} +0 -0
- /package/{logs-MK4VKYGE.js.map → logs-53CMUU4J.js.map} +0 -0
- /package/{mail-4WPLYKL5.js.map → mail-E6R5V6F6.js.map} +0 -0
- /package/{maps-7YWGDMU4.js.map → maps-B7F3CODU.js.map} +0 -0
- /package/{model-P5TLS3KD.js.map → model-2VZQVFTE.js.map} +0 -0
- /package/{model-provider-YUQ65CGB.js.map → model-provider-XALJ5BZB.js.map} +0 -0
- /package/{org-BO46UGHP.js.map → org-JIAZYZUL.js.map} +0 -0
- /package/{people-search-6JZNG46F.js.map → people-search-LZ2BRXA6.js.map} +0 -0
- /package/{phone-OLPRI3UD.js.map → phone-MXUV3YD3.js.map} +0 -0
- /package/{preference-OSLWFBAT.js.map → preference-LONJZKPE.js.map} +0 -0
- /package/{resource-6IX3QB3W.js.map → resource-26IQ2JCS.js.map} +0 -0
- /package/{scrape-T6XHTU6J.js.map → scrape-H2ZA5AJD.js.map} +0 -0
- /package/{search-KYW4WRMQ.js.map → search-R62IJFT4.js.map} +0 -0
- /package/{secret-ORODPPSX.js.map → secret-PHZZWEE3.js.map} +0 -0
- /package/{teams-CGDBFXQ2.js.map → teams-B5NDIX3U.js.map} +0 -0
- /package/{telegram-SCGQFOYI.js.map → telegram-R67CYOON.js.map} +0 -0
- /package/{upgrade-3LEF7WD7.js.map → upgrade-FJKXJO6L.js.map} +0 -0
- /package/{variable-G6WZKJJG.js.map → variable-GNCE5TUG.js.map} +0 -0
- /package/{video-JKYPCENK.js.map → video-UDPAFI36.js.map} +0 -0
- /package/{weather-3WQV3JMX.js.map → weather-O6L5SALA.js.map} +0 -0
- /package/{web-3FRUHVEN.js.map → web-6I5S773Q.js.map} +0 -0
- /package/{web-search-H6WV4RFE.js.map → web-search-GQAKFVCC.js.map} +0 -0
- /package/{whoami-BMNW6CH3.js.map → whoami-MEJV5DZB.js.map} +0 -0
- /package/{workflow-O6CVNJWM.js.map → workflow-PEVNMY2N.js.map} +0 -0
package/feishu-GQEAUNH3.js
DELETED
|
@@ -1,119 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import { createRequire as __createRequire } from "node:module";
|
|
3
|
-
const require = __createRequire(import.meta.url);
|
|
4
|
-
import {
|
|
5
|
-
sendFeishuMessage
|
|
6
|
-
} from "./chunk-PP2JWZSG.js";
|
|
7
|
-
import "./chunk-BRSUIBNM.js";
|
|
8
|
-
import "./chunk-SB7EZ2ZO.js";
|
|
9
|
-
import {
|
|
10
|
-
source_default,
|
|
11
|
-
withErrorHandler
|
|
12
|
-
} from "./chunk-4GD76EQ4.js";
|
|
13
|
-
import "./chunk-4CCCO3QU.js";
|
|
14
|
-
import {
|
|
15
|
-
Command
|
|
16
|
-
} from "./chunk-LD4ZVU4O.js";
|
|
17
|
-
import {
|
|
18
|
-
init_esm_shims
|
|
19
|
-
} from "./chunk-3VVCUQPB.js";
|
|
20
|
-
|
|
21
|
-
// src/commands/zero/feishu/index.ts
|
|
22
|
-
init_esm_shims();
|
|
23
|
-
|
|
24
|
-
// src/commands/zero/feishu/message/index.ts
|
|
25
|
-
init_esm_shims();
|
|
26
|
-
|
|
27
|
-
// src/commands/zero/feishu/message/send.ts
|
|
28
|
-
init_esm_shims();
|
|
29
|
-
import { readFileSync } from "fs";
|
|
30
|
-
function isRecord(value) {
|
|
31
|
-
return Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
32
|
-
}
|
|
33
|
-
function parseCard(input) {
|
|
34
|
-
if (!input) {
|
|
35
|
-
return void 0;
|
|
36
|
-
}
|
|
37
|
-
let parsed;
|
|
38
|
-
try {
|
|
39
|
-
parsed = JSON.parse(input);
|
|
40
|
-
} catch {
|
|
41
|
-
throw new Error("Invalid JSON for --card flag", {
|
|
42
|
-
cause: new Error("Provide a valid Feishu card JSON object")
|
|
43
|
-
});
|
|
44
|
-
}
|
|
45
|
-
if (!isRecord(parsed)) {
|
|
46
|
-
throw new Error("Invalid JSON for --card", {
|
|
47
|
-
cause: new Error("Provide a Feishu card JSON object")
|
|
48
|
-
});
|
|
49
|
-
}
|
|
50
|
-
return parsed;
|
|
51
|
-
}
|
|
52
|
-
var sendCommand = new Command().name("send").description("Send a message to a Feishu chat or user").option("-i, --installation <id>", "Feishu installation ID").option("-c, --chat <id>", "Feishu chat ID").option("-u, --user <open-id>", 'Feishu user open ID (use "me" for yourself)').option("-r, --reply <message-id>", "Message ID to reply to").option("--thread", "Reply in a Feishu thread").option("-t, --text <message>", "Message text").option("--card <json>", "Feishu interactive card JSON").addHelpText(
|
|
53
|
-
"after",
|
|
54
|
-
`
|
|
55
|
-
Examples:
|
|
56
|
-
Chat message: zero feishu message send -c oc_xxx -t "Hello!"
|
|
57
|
-
Direct message: zero feishu message send -u ou_xxx -t "Hello!"
|
|
58
|
-
DM yourself: zero feishu message send -u me -t "Hello!"
|
|
59
|
-
Thread reply: zero feishu message send -r om_xxx --thread -t "Reply"
|
|
60
|
-
Interactive card: zero feishu message send -c oc_xxx --card '{"schema":"2.0","body":{"elements":[]}}'
|
|
61
|
-
Select a custom app: zero feishu message send -i <installation-id> -c oc_xxx -t "Hello!"
|
|
62
|
-
|
|
63
|
-
Notes:
|
|
64
|
-
- Exactly one of --chat, --user, or --reply is required
|
|
65
|
-
- Exactly one of --text or --card is required
|
|
66
|
-
- --installation is required when the organization has multiple Feishu bots`
|
|
67
|
-
).action(
|
|
68
|
-
withErrorHandler(async (options) => {
|
|
69
|
-
const targets = [options.chat, options.user, options.reply].filter(
|
|
70
|
-
Boolean
|
|
71
|
-
);
|
|
72
|
-
if (targets.length !== 1) {
|
|
73
|
-
throw new Error(
|
|
74
|
-
"Exactly one of --chat, --user, or --reply must be provided"
|
|
75
|
-
);
|
|
76
|
-
}
|
|
77
|
-
if (options.thread && !options.reply) {
|
|
78
|
-
throw new Error("--thread requires --reply");
|
|
79
|
-
}
|
|
80
|
-
let text = options.text;
|
|
81
|
-
if (!text && !options.card && !process.stdin.isTTY) {
|
|
82
|
-
try {
|
|
83
|
-
text = readFileSync("/dev/stdin", "utf8").trim();
|
|
84
|
-
} catch {
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
const card = parseCard(options.card);
|
|
88
|
-
if (Boolean(text) === Boolean(card)) {
|
|
89
|
-
throw new Error("Exactly one of --text or --card must be provided");
|
|
90
|
-
}
|
|
91
|
-
const result = await sendFeishuMessage({
|
|
92
|
-
installationId: options.installation,
|
|
93
|
-
chat: options.chat,
|
|
94
|
-
user: options.user,
|
|
95
|
-
replyToMessageId: options.reply,
|
|
96
|
-
replyInThread: options.thread,
|
|
97
|
-
text,
|
|
98
|
-
card
|
|
99
|
-
});
|
|
100
|
-
console.log(source_default.green(`\u2713 Message sent (message: ${result.messageId})`));
|
|
101
|
-
})
|
|
102
|
-
);
|
|
103
|
-
|
|
104
|
-
// src/commands/zero/feishu/message/index.ts
|
|
105
|
-
var zeroFeishuMessageCommand = new Command().name("message").description("Send Feishu messages").addCommand(sendCommand);
|
|
106
|
-
|
|
107
|
-
// src/commands/zero/feishu/index.ts
|
|
108
|
-
var zeroFeishuCommand = new Command().name("feishu").description("Send messages to Feishu as an organization bot").addCommand(zeroFeishuMessageCommand).addHelpText(
|
|
109
|
-
"after",
|
|
110
|
-
`
|
|
111
|
-
Examples:
|
|
112
|
-
Send to a chat: zero feishu message send -c <chat-id> -t "Hello!"
|
|
113
|
-
Send a DM: zero feishu message send -u <open-id> -t "Hello!"
|
|
114
|
-
Reply in a thread: zero feishu message send -r <message-id> --thread -t "Reply"`
|
|
115
|
-
);
|
|
116
|
-
export {
|
|
117
|
-
zeroFeishuCommand
|
|
118
|
-
};
|
|
119
|
-
//# sourceMappingURL=feishu-GQEAUNH3.js.map
|
package/feishu-GQEAUNH3.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/commands/zero/feishu/index.ts","../src/commands/zero/feishu/message/index.ts","../src/commands/zero/feishu/message/send.ts"],"sourcesContent":["import { Command } from \"commander\";\n\nimport { zeroFeishuMessageCommand } from \"./message\";\n\nexport const zeroFeishuCommand = new Command()\n .name(\"feishu\")\n .description(\"Send messages to Feishu as an organization bot\")\n .addCommand(zeroFeishuMessageCommand)\n .addHelpText(\n \"after\",\n `\nExamples:\n Send to a chat: zero feishu message send -c <chat-id> -t \"Hello!\"\n Send a DM: zero feishu message send -u <open-id> -t \"Hello!\"\n Reply in a thread: zero feishu message send -r <message-id> --thread -t \"Reply\"`,\n );\n","import { Command } from \"commander\";\n\nimport { sendCommand } from \"./send\";\n\nexport const zeroFeishuMessageCommand = new Command()\n .name(\"message\")\n .description(\"Send Feishu messages\")\n .addCommand(sendCommand);\n","import { readFileSync } from \"node:fs\";\n\nimport chalk from \"chalk\";\nimport { Command } from \"commander\";\n\nimport { sendFeishuMessage } from \"../../../../lib/api\";\nimport { withErrorHandler } from \"../../../../lib/command\";\n\ninterface SendFeishuOptions {\n readonly installation?: string;\n readonly chat?: string;\n readonly user?: string;\n readonly reply?: string;\n readonly thread?: boolean;\n readonly text?: string;\n readonly card?: string;\n}\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return Boolean(value) && typeof value === \"object\" && !Array.isArray(value);\n}\n\nfunction parseCard(\n input: string | undefined,\n): Record<string, unknown> | undefined {\n if (!input) {\n return undefined;\n }\n let parsed: unknown;\n try {\n parsed = JSON.parse(input);\n } catch {\n throw new Error(\"Invalid JSON for --card flag\", {\n cause: new Error(\"Provide a valid Feishu card JSON object\"),\n });\n }\n if (!isRecord(parsed)) {\n throw new Error(\"Invalid JSON for --card\", {\n cause: new Error(\"Provide a Feishu card JSON object\"),\n });\n }\n return parsed;\n}\n\nexport const sendCommand = new Command()\n .name(\"send\")\n .description(\"Send a message to a Feishu chat or user\")\n .option(\"-i, --installation <id>\", \"Feishu installation ID\")\n .option(\"-c, --chat <id>\", \"Feishu chat ID\")\n .option(\"-u, --user <open-id>\", 'Feishu user open ID (use \"me\" for yourself)')\n .option(\"-r, --reply <message-id>\", \"Message ID to reply to\")\n .option(\"--thread\", \"Reply in a Feishu thread\")\n .option(\"-t, --text <message>\", \"Message text\")\n .option(\"--card <json>\", \"Feishu interactive card JSON\")\n .addHelpText(\n \"after\",\n `\nExamples:\n Chat message: zero feishu message send -c oc_xxx -t \"Hello!\"\n Direct message: zero feishu message send -u ou_xxx -t \"Hello!\"\n DM yourself: zero feishu message send -u me -t \"Hello!\"\n Thread reply: zero feishu message send -r om_xxx --thread -t \"Reply\"\n Interactive card: zero feishu message send -c oc_xxx --card '{\"schema\":\"2.0\",\"body\":{\"elements\":[]}}'\n Select a custom app: zero feishu message send -i <installation-id> -c oc_xxx -t \"Hello!\"\n\nNotes:\n - Exactly one of --chat, --user, or --reply is required\n - Exactly one of --text or --card is required\n - --installation is required when the organization has multiple Feishu bots`,\n )\n .action(\n withErrorHandler(async (options: SendFeishuOptions) => {\n const targets = [options.chat, options.user, options.reply].filter(\n Boolean,\n );\n if (targets.length !== 1) {\n throw new Error(\n \"Exactly one of --chat, --user, or --reply must be provided\",\n );\n }\n if (options.thread && !options.reply) {\n throw new Error(\"--thread requires --reply\");\n }\n\n let text = options.text;\n if (!text && !options.card && !process.stdin.isTTY) {\n try {\n text = readFileSync(\"/dev/stdin\", \"utf8\").trim();\n } catch {\n // stdin is not readable; fall through to normal input validation.\n }\n }\n const card = parseCard(options.card);\n if (Boolean(text) === Boolean(card)) {\n throw new Error(\"Exactly one of --text or --card must be provided\");\n }\n\n const result = await sendFeishuMessage({\n installationId: options.installation,\n chat: options.chat,\n user: options.user,\n replyToMessageId: options.reply,\n replyInThread: options.thread,\n text,\n card,\n });\n console.log(chalk.green(`✓ Message sent (message: ${result.messageId})`));\n }),\n );\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;;;ACAA;;;ACAA;AAAA,SAAS,oBAAoB;AAkB7B,SAAS,SAAS,OAAkD;AAClE,SAAO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,OAAO;AAClD,UAAI;AACF,eAAO,aAAa,cAAc,MAAM,EAAE,KAAK;AAAA,MACjD,QAAQ;AAAA,MAER;AAAA,IACF;AACA,UAAM,OAAO,UAAU,QAAQ,IAAI;AACnC,QAAI,QAAQ,IAAI,MAAM,QAAQ,IAAI,GAAG;AACnC,YAAM,IAAI,MAAM,kDAAkD;AAAA,IACpE;AAEA,UAAM,SAAS,MAAM,kBAAkB;AAAA,MACrC,gBAAgB,QAAQ;AAAA,MACxB,MAAM,QAAQ;AAAA,MACd,MAAM,QAAQ;AAAA,MACd,kBAAkB,QAAQ;AAAA,MAC1B,eAAe,QAAQ;AAAA,MACvB;AAAA,MACA;AAAA,IACF,CAAC;AACD,YAAQ,IAAI,eAAM,MAAM,iCAA4B,OAAO,SAAS,GAAG,CAAC;AAAA,EAC1E,CAAC;AACH;;;ADxGK,IAAM,2BAA2B,IAAI,QAAQ,EACjD,KAAK,SAAS,EACd,YAAY,sBAAsB,EAClC,WAAW,WAAW;;;ADHlB,IAAM,oBAAoB,IAAI,QAAQ,EAC1C,KAAK,QAAQ,EACb,YAAY,gDAAgD,EAC5D,WAAW,wBAAwB,EACnC;AAAA,EACC;AAAA,EACA;AAAA;AAAA;AAAA;AAAA;AAKF;","names":[]}
|
package/slack-CXZCQ5HU.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/commands/zero/slack/index.ts","../src/commands/zero/slack/message/index.ts","../src/commands/zero/slack/message/send.ts","../src/commands/zero/slack/upload-file.ts","../src/commands/zero/slack/download-file.ts"],"sourcesContent":["import { Command } from \"commander\";\nimport { zeroSlackMessageCommand } from \"./message\";\nimport { uploadFileCommand } from \"./upload-file\";\nimport { downloadFileCommand } from \"./download-file\";\n\nexport const zeroSlackCommand = new Command()\n .name(\"slack\")\n .description(\n \"Send messages, upload files, and download files from Slack as the bot\",\n )\n .addCommand(zeroSlackMessageCommand)\n .addCommand(uploadFileCommand)\n .addCommand(downloadFileCommand)\n .addHelpText(\n \"after\",\n `\nExamples:\n Send a message: zero slack message send -c <channel-id> -t \"Hello!\"\n Reply in a thread: zero slack message send -c <channel-id> --thread <ts> -t \"reply\"\n Upload a file: zero slack upload-file -f /tmp/report.pdf -c <channel-id>\n Download a file: zero slack download-file <file-id> -o /tmp/out.png`,\n );\n","import { Command } from \"commander\";\nimport { sendCommand } from \"./send\";\n\nexport const zeroSlackMessageCommand = new Command()\n .name(\"message\")\n .description(\"Manage Slack messages\")\n .addCommand(sendCommand)\n .addHelpText(\n \"after\",\n `\nExamples:\n zero slack message send -c <channel-id> -t \"Hello!\"`,\n );\n","import { readFileSync } from \"fs\";\nimport { Command } from \"commander\";\nimport chalk from \"chalk\";\nimport { sendSlackMessage } from \"../../../../lib/api\";\nimport { withErrorHandler } from \"../../../../lib/command\";\n\nexport const sendCommand = new Command()\n .name(\"send\")\n .description(\"Send a message to a Slack channel or DM a user\")\n .option(\"-c, --channel <id>\", \"Channel ID\")\n .option(\"-u, --user <id>\", 'Slack user ID for DM (use \"me\" for yourself)')\n .option(\"-t, --text <message>\", \"Message text\")\n .option(\"--thread <ts>\", \"Thread timestamp for replies\")\n .option(\"--blocks <json>\", \"Block Kit JSON string\")\n .addHelpText(\n \"after\",\n `\nExamples:\n Simple message: zero slack message send -c C01234 -t \"Hello!\"\n DM a user: zero slack message send -u U0A8V9X98QJ -t \"Hello!\"\n DM yourself: zero slack message send -u me -t \"Hello!\"\n Reply in thread: zero slack message send -c C01234 --thread 1234567890.123456 -t \"reply\"\n Rich blocks: zero slack message send -c C01234 --blocks '[{\"type\":\"section\",\"text\":{\"type\":\"mrkdwn\",\"text\":\"*Bold*\"}}]'\n\nNotes:\n - Either --channel or --user is required; they are mutually exclusive\n - Either --text or --blocks is required; both can be used together`,\n )\n .action(\n withErrorHandler(\n async (options: {\n channel?: string;\n user?: string;\n text?: string;\n thread?: string;\n blocks?: string;\n }) => {\n let text = options.text;\n const { channel, user, thread, blocks: blocksStr } = options;\n\n // Validate mutual exclusion: exactly one of --channel or --user\n if (!channel && !user) {\n throw new Error(\"Either --channel or --user must be provided\", {\n cause: new Error(\n 'Usage: zero slack message send -c CHANNEL_ID -t \"your message\"\\n zero slack message send -u USER_ID -t \"your message\"',\n ),\n });\n }\n if (channel && user) {\n throw new Error(\"--channel and --user are mutually exclusive\", {\n cause: new Error(\n \"Provide either --channel to send to a channel or --user to DM a user, not both\",\n ),\n });\n }\n\n // Read from stdin if text not provided and stdin is not a TTY\n // (isTTY is true only for an interactive terminal, undefined when piped).\n if (!text && !process.stdin.isTTY) {\n try {\n text = readFileSync(\"/dev/stdin\", \"utf8\").trim();\n } catch {\n // stdin not readable (e.g. test runner with no piped input);\n // fall through to the missing-text validation below.\n }\n }\n\n // Parse blocks JSON if provided\n let blocks: Array<{ type: string; [key: string]: unknown }> | undefined;\n if (blocksStr) {\n try {\n blocks = JSON.parse(blocksStr) as Array<{\n type: string;\n [key: string]: unknown;\n }>;\n } catch {\n throw new Error(\"Invalid JSON for --blocks flag\", {\n cause: new Error(\n \"Provide a valid JSON array of Block Kit blocks\",\n ),\n });\n }\n }\n\n // Validate at least one of text or blocks\n if (!text && !blocks) {\n throw new Error(\"Either --text or --blocks must be provided\", {\n cause: new Error(\n 'Usage: zero slack message send -c CHANNEL_ID -t \"your message\"',\n ),\n });\n }\n\n const result = await sendSlackMessage({\n channel: channel || undefined,\n user: user || undefined,\n text: text || undefined,\n threadTs: thread,\n blocks,\n });\n\n const tsInfo = result.ts ? ` (ts: ${result.ts})` : \"\";\n console.log(chalk.green(`✓ Message sent${tsInfo}`));\n },\n ),\n );\n","import { statSync, readFileSync } from \"fs\";\nimport { basename } from \"path\";\nimport { Command } from \"commander\";\nimport chalk from \"chalk\";\nimport { initSlackFileUpload, completeSlackFileUpload } from \"../../../lib/api\";\nimport { withErrorHandler } from \"../../../lib/command\";\n\nexport const uploadFileCommand = new Command()\n .name(\"upload-file\")\n .description(\"Upload a file to a Slack channel as the bot\")\n .requiredOption(\"-f, --file <path>\", \"Local file path to upload\")\n .requiredOption(\"-c, --channel <id>\", \"Slack channel ID\")\n .option(\"--thread <ts>\", \"Thread timestamp to post as a reply\")\n .option(\"--title <title>\", \"Display title for the file\")\n .option(\"--comment <text>\", \"Initial comment to accompany the file\")\n .addHelpText(\n \"after\",\n `\nExamples:\n Upload a file: zero slack upload-file -f /tmp/report.pdf -c C01234\n Upload to thread: zero slack upload-file -f /tmp/log.txt -c C01234 --thread 1234567890.123456\n With title and comment: zero slack upload-file -f /tmp/data.csv -c C01234 --title \"Daily Report\" --comment \"Here's the report\"\n\nNotes:\n - Uses the bot token (not user SLACK_TOKEN), so no files:write permission is needed\n - Returns file_id and permalink for reference`,\n )\n .action(\n withErrorHandler(\n async (options: {\n file: string;\n channel: string;\n thread?: string;\n title?: string;\n comment?: string;\n }) => {\n // Validate file exists and get size\n let fileSize: number;\n try {\n const stat = statSync(options.file);\n fileSize = stat.size;\n } catch {\n throw new Error(`File not found: ${options.file}`);\n }\n\n if (fileSize === 0) {\n throw new Error(\"File is empty\");\n }\n\n const filename = basename(options.file);\n\n // Step 1: Get pre-signed upload URL from server\n const { uploadUrl, fileId } = await initSlackFileUpload({\n filename,\n length: fileSize,\n });\n\n // Step 2: Upload file directly to Slack's pre-signed URL\n const fileContent = readFileSync(options.file);\n const uploadResponse = await fetch(uploadUrl, {\n method: \"POST\",\n body: fileContent,\n });\n\n if (!uploadResponse.ok) {\n throw new Error(\n `File upload failed: ${uploadResponse.status} ${uploadResponse.statusText}`,\n );\n }\n\n // Step 3: Complete the upload and share to channel/thread\n const result = await completeSlackFileUpload({\n fileId,\n channel: options.channel,\n threadTs: options.thread,\n title: options.title,\n initialComment: options.comment,\n });\n\n console.log(chalk.green(`✓ File uploaded (file_id: ${result.fileId})`));\n console.log(chalk.dim(` permalink: ${result.permalink}`));\n },\n ),\n );\n","import { basename, join } from \"path\";\nimport { tmpdir } from \"os\";\nimport { Command } from \"commander\";\nimport { downloadSlackFile } from \"../../../lib/api\";\nimport { withErrorHandler } from \"../../../lib/command\";\n\n/**\n * Derive a local output path for a Slack file id.\n * Uses the system temp directory; extension is appended later once the\n * mimetype is known.\n *\n * `basename` strips any path separators from `fileId` so a hostile id like\n * `../etc/passwd` cannot escape `tmpdir()`.\n */\nfunction defaultOutPath(fileId: string): string {\n return join(tmpdir(), `slack-${basename(fileId)}`);\n}\n\nexport const downloadFileCommand = new Command()\n .name(\"download-file\")\n .description(\"Download a Slack file by id using the bot token\")\n .argument(\"<file-id>\", \"Slack file id (e.g. F01234ABCD)\")\n .option(\n \"-o, --out <path>\",\n \"Output path for the downloaded file (default: /tmp/slack-<file-id>)\",\n )\n .addHelpText(\n \"after\",\n `\nExamples:\n Download to default temp path: zero slack download-file F01234ABCD\n Download to explicit path: zero slack download-file F01234ABCD -o /tmp/image.png\n\nOutput:\n Prints a JSON object to stdout on success:\n {\"path\":\"/tmp/slack-F01234ABCD\",\"mimetype\":\"image/png\",\"size\":12345}\n\nHow to read the downloaded file:\n - Images (png/jpg/gif/webp/svg): open the file path with your image viewing tool\n - Videos (mp4/mov/webm): transcribe audio first with\n zero video transcribe --url <download-url>\n or extract frames with\n ffmpeg -i <path> -vf \"fps=1\" -q:v 2 /tmp/<file-id>_frame_%03d.jpg\n - PDF/text/csv/json/markdown: read the file directly\n\nNotes:\n - Uses the bot token on the server side; no user Slack token is needed\n - Streams the file bytes directly to disk`,\n )\n .action(\n withErrorHandler(async (fileId: string, options: { out?: string }) => {\n const outPath = options.out ?? defaultOutPath(fileId);\n const result = await downloadSlackFile(fileId, outPath);\n console.log(JSON.stringify(result));\n }),\n );\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;ACAA;;;ACAA;AAAA,SAAS,oBAAoB;AAMtB,IAAM,cAAc,IAAI,QAAQ,EACpC,KAAK,MAAM,EACX,YAAY,gDAAgD,EAC5D,OAAO,sBAAsB,YAAY,EACzC,OAAO,mBAAmB,8CAA8C,EACxE,OAAO,wBAAwB,cAAc,EAC7C,OAAO,i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
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|