@desplega.ai/slack-mock 0.1.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/README.md +113 -0
- package/dist/body.d.ts +6 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +94 -0
- package/dist/events.d.ts +36 -0
- package/dist/ids.d.ts +8 -0
- package/dist/index-thgwpw70.js +3693 -0
- package/dist/index-v7mbr1cx.js +48 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.js +17 -0
- package/dist/render/blocks.d.ts +7 -0
- package/dist/render/index.d.ts +25 -0
- package/dist/render/mrkdwn.d.ts +16 -0
- package/dist/screenshot.d.ts +13 -0
- package/dist/screenshot.js +9 -0
- package/dist/server.d.ts +240 -0
- package/dist/socket-mode.d.ts +73 -0
- package/dist/store.d.ts +150 -0
- package/dist/types.d.ts +211 -0
- package/dist/web-api.d.ts +26 -0
- package/package.json +60 -0
- package/src/body.ts +84 -0
- package/src/cli.ts +89 -0
- package/src/events.ts +281 -0
- package/src/ids.ts +29 -0
- package/src/index.ts +13 -0
- package/src/render/blocks.ts +392 -0
- package/src/render/index.ts +846 -0
- package/src/render/mrkdwn.ts +321 -0
- package/src/screenshot.ts +59 -0
- package/src/server.ts +1198 -0
- package/src/socket-mode.ts +261 -0
- package/src/store.ts +654 -0
- package/src/types.ts +159 -0
- package/src/web-api.ts +694 -0
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
export interface SlackUser {
|
|
2
|
+
id: string;
|
|
3
|
+
team_id: string;
|
|
4
|
+
name: string;
|
|
5
|
+
real_name: string;
|
|
6
|
+
deleted: boolean;
|
|
7
|
+
is_bot: boolean;
|
|
8
|
+
is_admin: boolean;
|
|
9
|
+
is_app_user: boolean;
|
|
10
|
+
tz: string;
|
|
11
|
+
profile: {
|
|
12
|
+
real_name: string;
|
|
13
|
+
display_name: string;
|
|
14
|
+
real_name_normalized: string;
|
|
15
|
+
display_name_normalized: string;
|
|
16
|
+
email?: string;
|
|
17
|
+
image_72?: string;
|
|
18
|
+
team: string;
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
export interface SlackChannel {
|
|
22
|
+
id: string;
|
|
23
|
+
name: string;
|
|
24
|
+
is_channel: boolean;
|
|
25
|
+
is_group: boolean;
|
|
26
|
+
is_im: boolean;
|
|
27
|
+
is_mpim: boolean;
|
|
28
|
+
is_private: boolean;
|
|
29
|
+
is_archived: boolean;
|
|
30
|
+
is_general: boolean;
|
|
31
|
+
created: number;
|
|
32
|
+
creator: string;
|
|
33
|
+
/** Peer user id for DMs. */
|
|
34
|
+
user?: string;
|
|
35
|
+
topic: {
|
|
36
|
+
value: string;
|
|
37
|
+
creator: string;
|
|
38
|
+
last_set: number;
|
|
39
|
+
};
|
|
40
|
+
purpose: {
|
|
41
|
+
value: string;
|
|
42
|
+
creator: string;
|
|
43
|
+
last_set: number;
|
|
44
|
+
};
|
|
45
|
+
/** Not a Slack field on the wire; exposed via conversations.members. */
|
|
46
|
+
members: string[];
|
|
47
|
+
}
|
|
48
|
+
export interface SlackFile {
|
|
49
|
+
id: string;
|
|
50
|
+
created: number;
|
|
51
|
+
timestamp: number;
|
|
52
|
+
name: string;
|
|
53
|
+
title: string;
|
|
54
|
+
mimetype: string;
|
|
55
|
+
filetype: string;
|
|
56
|
+
pretty_type: string;
|
|
57
|
+
user: string;
|
|
58
|
+
size: number;
|
|
59
|
+
mode: string;
|
|
60
|
+
is_external: boolean;
|
|
61
|
+
is_public: boolean;
|
|
62
|
+
url_private: string;
|
|
63
|
+
url_private_download: string;
|
|
64
|
+
permalink: string;
|
|
65
|
+
channels: string[];
|
|
66
|
+
/** Raw bytes; stripped before the object is put on the wire. */
|
|
67
|
+
bytes?: Uint8Array;
|
|
68
|
+
}
|
|
69
|
+
export interface SlackReaction {
|
|
70
|
+
name: string;
|
|
71
|
+
users: string[];
|
|
72
|
+
count: number;
|
|
73
|
+
}
|
|
74
|
+
export interface SlackMessage {
|
|
75
|
+
type: "message";
|
|
76
|
+
subtype?: string;
|
|
77
|
+
channel: string;
|
|
78
|
+
team: string;
|
|
79
|
+
user?: string;
|
|
80
|
+
text: string;
|
|
81
|
+
ts: string;
|
|
82
|
+
thread_ts?: string;
|
|
83
|
+
parent_user_id?: string;
|
|
84
|
+
blocks?: unknown[];
|
|
85
|
+
attachments?: unknown[];
|
|
86
|
+
metadata?: {
|
|
87
|
+
event_type: string;
|
|
88
|
+
event_payload?: Record<string, unknown>;
|
|
89
|
+
};
|
|
90
|
+
files?: SlackFile[];
|
|
91
|
+
bot_id?: string;
|
|
92
|
+
app_id?: string;
|
|
93
|
+
username?: string;
|
|
94
|
+
icons?: Record<string, string>;
|
|
95
|
+
bot_profile?: {
|
|
96
|
+
id: string;
|
|
97
|
+
name: string;
|
|
98
|
+
app_id: string;
|
|
99
|
+
team_id: string;
|
|
100
|
+
deleted: boolean;
|
|
101
|
+
};
|
|
102
|
+
reactions?: SlackReaction[];
|
|
103
|
+
edited?: {
|
|
104
|
+
user: string;
|
|
105
|
+
ts: string;
|
|
106
|
+
};
|
|
107
|
+
reply_count?: number;
|
|
108
|
+
reply_users?: string[];
|
|
109
|
+
reply_users_count?: number;
|
|
110
|
+
latest_reply?: string;
|
|
111
|
+
client_msg_id?: string;
|
|
112
|
+
/** Set on messages created by chat.startStream: "in_progress" until chat.stopStream. */
|
|
113
|
+
streaming_state?: string;
|
|
114
|
+
thumb_64?: string;
|
|
115
|
+
/** Mock-only: the user who can see an ephemeral message. Stripped on the wire. */
|
|
116
|
+
ephemeral_user?: string;
|
|
117
|
+
}
|
|
118
|
+
export interface SlackView {
|
|
119
|
+
id: string;
|
|
120
|
+
team_id: string;
|
|
121
|
+
type: string;
|
|
122
|
+
callback_id?: string;
|
|
123
|
+
private_metadata?: string;
|
|
124
|
+
title?: unknown;
|
|
125
|
+
submit?: unknown;
|
|
126
|
+
close?: unknown;
|
|
127
|
+
blocks: unknown[];
|
|
128
|
+
hash: string;
|
|
129
|
+
external_id?: string;
|
|
130
|
+
/** Mock-only bookkeeping. */
|
|
131
|
+
opened_by: string;
|
|
132
|
+
trigger_id: string;
|
|
133
|
+
state: {
|
|
134
|
+
values: Record<string, Record<string, unknown>>;
|
|
135
|
+
};
|
|
136
|
+
root_view_id: string;
|
|
137
|
+
app_id: string;
|
|
138
|
+
bot_id: string;
|
|
139
|
+
clear_on_close: boolean;
|
|
140
|
+
notify_on_close: boolean;
|
|
141
|
+
}
|
|
142
|
+
export interface ApiCall {
|
|
143
|
+
at: string;
|
|
144
|
+
method: string;
|
|
145
|
+
args: Record<string, unknown>;
|
|
146
|
+
ok: boolean;
|
|
147
|
+
error?: string;
|
|
148
|
+
}
|
|
149
|
+
export type Change = {
|
|
150
|
+
kind: "message.add";
|
|
151
|
+
message: SlackMessage;
|
|
152
|
+
} | {
|
|
153
|
+
kind: "message.update";
|
|
154
|
+
message: SlackMessage;
|
|
155
|
+
previous: SlackMessage;
|
|
156
|
+
} | {
|
|
157
|
+
kind: "message.delete";
|
|
158
|
+
message: SlackMessage;
|
|
159
|
+
} | {
|
|
160
|
+
kind: "reaction.add";
|
|
161
|
+
message: SlackMessage;
|
|
162
|
+
name: string;
|
|
163
|
+
user: string;
|
|
164
|
+
} | {
|
|
165
|
+
kind: "reaction.remove";
|
|
166
|
+
message: SlackMessage;
|
|
167
|
+
name: string;
|
|
168
|
+
user: string;
|
|
169
|
+
} | {
|
|
170
|
+
kind: "channel.add";
|
|
171
|
+
channel: SlackChannel;
|
|
172
|
+
} | {
|
|
173
|
+
kind: "channel.update";
|
|
174
|
+
channel: SlackChannel;
|
|
175
|
+
} | {
|
|
176
|
+
kind: "member.join";
|
|
177
|
+
channel: SlackChannel;
|
|
178
|
+
user: string;
|
|
179
|
+
inviter?: string;
|
|
180
|
+
} | {
|
|
181
|
+
kind: "user.add";
|
|
182
|
+
user: SlackUser;
|
|
183
|
+
} | {
|
|
184
|
+
kind: "file.add";
|
|
185
|
+
file: SlackFile;
|
|
186
|
+
} | {
|
|
187
|
+
kind: "view.open";
|
|
188
|
+
view: SlackView;
|
|
189
|
+
} | {
|
|
190
|
+
kind: "view.update";
|
|
191
|
+
view: SlackView;
|
|
192
|
+
} | {
|
|
193
|
+
kind: "assistant.status";
|
|
194
|
+
channel: string;
|
|
195
|
+
thread_ts: string;
|
|
196
|
+
status: string;
|
|
197
|
+
} | {
|
|
198
|
+
kind: "assistant.title";
|
|
199
|
+
channel: string;
|
|
200
|
+
thread_ts: string;
|
|
201
|
+
title: string;
|
|
202
|
+
} | {
|
|
203
|
+
kind: "assistant.prompts";
|
|
204
|
+
channel: string;
|
|
205
|
+
thread_ts: string;
|
|
206
|
+
prompts: unknown[];
|
|
207
|
+
title?: string;
|
|
208
|
+
} | {
|
|
209
|
+
kind: "api.call";
|
|
210
|
+
call: ApiCall;
|
|
211
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { type Args } from "./body.ts";
|
|
2
|
+
import type { SocketModeHub } from "./socket-mode.ts";
|
|
3
|
+
import { type Store } from "./store.ts";
|
|
4
|
+
export interface Actor {
|
|
5
|
+
userId: string;
|
|
6
|
+
isBot: boolean;
|
|
7
|
+
}
|
|
8
|
+
export interface ApiContext {
|
|
9
|
+
store: Store;
|
|
10
|
+
hub: SocketModeHub;
|
|
11
|
+
baseUrl: string;
|
|
12
|
+
wsUrl: string;
|
|
13
|
+
actor: Actor;
|
|
14
|
+
/** Trigger ids issued with interactive payloads, with their expiry. */
|
|
15
|
+
triggerIds: Map<string, number>;
|
|
16
|
+
/** Files created by files.getUploadURLExternal that still await bytes. */
|
|
17
|
+
pendingUploads: Map<string, {
|
|
18
|
+
name: string;
|
|
19
|
+
length: number;
|
|
20
|
+
alt_text?: string;
|
|
21
|
+
user: string;
|
|
22
|
+
}>;
|
|
23
|
+
}
|
|
24
|
+
export type Handler = (ctx: ApiContext, args: Args) => Record<string, unknown>;
|
|
25
|
+
export declare const handlers: Record<string, Handler>;
|
|
26
|
+
export declare function newTriggerId(): string;
|
package/package.json
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@desplega.ai/slack-mock",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Mock Slack server (Web API + Socket Mode) for end-to-end testing Slack bots",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"bin": {
|
|
8
|
+
"slack-mock": "./dist/cli.js"
|
|
9
|
+
},
|
|
10
|
+
"exports": {
|
|
11
|
+
".": {
|
|
12
|
+
"types": "./dist/index.d.ts",
|
|
13
|
+
"bun": "./src/index.ts",
|
|
14
|
+
"default": "./dist/index.js"
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
"scripts": {
|
|
18
|
+
"start": "bun run src/cli.ts serve",
|
|
19
|
+
"demo": "bun scripts/demo.ts",
|
|
20
|
+
"build": "rm -rf dist && bun build src/index.ts src/cli.ts src/screenshot.ts --target=bun --outdir dist --splitting && tsc -p tsconfig.build.json",
|
|
21
|
+
"test": "bun test",
|
|
22
|
+
"test:e2e": "SLACK_MOCK_E2E=1 bun test test/agent-swarm.e2e.test.ts",
|
|
23
|
+
"typecheck": "tsc --noEmit",
|
|
24
|
+
"lint": "biome check .",
|
|
25
|
+
"lint:fix": "biome check --write .",
|
|
26
|
+
"prepublishOnly": "bun run typecheck && bun run lint && bun test && bun run build",
|
|
27
|
+
"release": "npm publish"
|
|
28
|
+
},
|
|
29
|
+
"devDependencies": {
|
|
30
|
+
"@biomejs/biome": "^2.4.5",
|
|
31
|
+
"@slack/bolt": "^4.6.0",
|
|
32
|
+
"@types/bun": "latest",
|
|
33
|
+
"typescript": "^5"
|
|
34
|
+
},
|
|
35
|
+
"repository": {
|
|
36
|
+
"type": "git",
|
|
37
|
+
"url": "git+https://github.com/desplega-ai/slack-mock.git"
|
|
38
|
+
},
|
|
39
|
+
"homepage": "https://github.com/desplega-ai/slack-mock#readme",
|
|
40
|
+
"keywords": [
|
|
41
|
+
"slack",
|
|
42
|
+
"mock",
|
|
43
|
+
"socket-mode",
|
|
44
|
+
"bolt",
|
|
45
|
+
"testing",
|
|
46
|
+
"e2e"
|
|
47
|
+
],
|
|
48
|
+
"types": "./dist/index.d.ts",
|
|
49
|
+
"files": [
|
|
50
|
+
"dist",
|
|
51
|
+
"src",
|
|
52
|
+
"README.md"
|
|
53
|
+
],
|
|
54
|
+
"publishConfig": {
|
|
55
|
+
"access": "public"
|
|
56
|
+
},
|
|
57
|
+
"engines": {
|
|
58
|
+
"bun": ">=1.2"
|
|
59
|
+
}
|
|
60
|
+
}
|
package/src/body.ts
ADDED
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
// Parse Slack Web API request bodies. @slack/web-api sends
|
|
2
|
+
// application/x-www-form-urlencoded with nested values JSON-stringified;
|
|
3
|
+
// other SDKs send application/json; legacy file uploads send multipart.
|
|
4
|
+
|
|
5
|
+
export type Args = Record<string, unknown>;
|
|
6
|
+
|
|
7
|
+
const JSON_FIELDS = new Set([
|
|
8
|
+
"blocks",
|
|
9
|
+
"attachments",
|
|
10
|
+
"metadata",
|
|
11
|
+
"files",
|
|
12
|
+
"view",
|
|
13
|
+
"prompts",
|
|
14
|
+
"icons",
|
|
15
|
+
"user_ids",
|
|
16
|
+
"types",
|
|
17
|
+
"chunks",
|
|
18
|
+
"loading_messages",
|
|
19
|
+
]);
|
|
20
|
+
|
|
21
|
+
function coerce(key: string, value: string): unknown {
|
|
22
|
+
// Only the fields the SDKs JSON-stringify are parsed; `text` and friends stay opaque strings.
|
|
23
|
+
if (JSON_FIELDS.has(key)) {
|
|
24
|
+
try {
|
|
25
|
+
return JSON.parse(value);
|
|
26
|
+
} catch {
|
|
27
|
+
return value;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
if (value === "true") return true;
|
|
31
|
+
if (value === "false") return false;
|
|
32
|
+
return value;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export async function parseArgs(req: Request): Promise<Args> {
|
|
36
|
+
const url = new URL(req.url);
|
|
37
|
+
const args: Args = {};
|
|
38
|
+
for (const [k, v] of url.searchParams) args[k] = coerce(k, v);
|
|
39
|
+
if (req.method !== "POST") return args;
|
|
40
|
+
|
|
41
|
+
const contentType = req.headers.get("content-type") ?? "";
|
|
42
|
+
if (contentType.includes("application/json")) {
|
|
43
|
+
const text = await req.text();
|
|
44
|
+
if (text.trim()) Object.assign(args, JSON.parse(text));
|
|
45
|
+
return args;
|
|
46
|
+
}
|
|
47
|
+
if (contentType.includes("multipart/form-data")) {
|
|
48
|
+
const form = await req.formData();
|
|
49
|
+
form.forEach((v, k) => {
|
|
50
|
+
args[k] = typeof v === "string" ? coerce(k, v) : v;
|
|
51
|
+
});
|
|
52
|
+
return args;
|
|
53
|
+
}
|
|
54
|
+
const text = await req.text();
|
|
55
|
+
if (!text) return args;
|
|
56
|
+
for (const [k, v] of new URLSearchParams(text)) args[k] = coerce(k, v);
|
|
57
|
+
return args;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export function bearerToken(req: Request, args: Args): string | undefined {
|
|
61
|
+
const header = req.headers.get("authorization");
|
|
62
|
+
if (header?.toLowerCase().startsWith("bearer ")) return header.slice(7).trim();
|
|
63
|
+
if (typeof args.token === "string") return args.token;
|
|
64
|
+
return undefined;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export function str(args: Args, key: string): string | undefined {
|
|
68
|
+
const v = args[key];
|
|
69
|
+
return typeof v === "string" ? v : v == null ? undefined : String(v);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
export function num(args: Args, key: string, fallback: number): number {
|
|
73
|
+
const v = args[key];
|
|
74
|
+
const n = typeof v === "number" ? v : typeof v === "string" ? Number.parseInt(v, 10) : Number.NaN;
|
|
75
|
+
return Number.isFinite(n) ? n : fallback;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
export function bool(args: Args, key: string): boolean | undefined {
|
|
79
|
+
const v = args[key];
|
|
80
|
+
if (typeof v === "boolean") return v;
|
|
81
|
+
if (v === "true" || v === "1" || v === 1) return true;
|
|
82
|
+
if (v === "false" || v === "0" || v === 0) return false;
|
|
83
|
+
return undefined;
|
|
84
|
+
}
|
package/src/cli.ts
ADDED
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
#!/usr/bin/env bun
|
|
2
|
+
import { parseArgs } from "node:util";
|
|
3
|
+
import { screenshot } from "./screenshot.ts";
|
|
4
|
+
import { SlackMock } from "./server.ts";
|
|
5
|
+
|
|
6
|
+
const USAGE = `slack-mock: a mock Slack server (Web API + Socket Mode) for testing bots
|
|
7
|
+
|
|
8
|
+
Usage:
|
|
9
|
+
slack-mock serve [--port 4040] [--host 127.0.0.1] [--data ./data/slack.jsonl] [--manifest app.json] [--no-seed] [--quiet] [--panel 50]
|
|
10
|
+
slack-mock screenshot <url> --out shot.png [--width 800] [--height 1000]
|
|
11
|
+
|
|
12
|
+
serve prints the env vars to give your bot (SLACK_BOT_TOKEN, SLACK_APP_TOKEN, SLACK_API_URL)
|
|
13
|
+
and the URLs of the HTML views. Inject messages with the admin API, e.g.
|
|
14
|
+
curl -X POST http://127.0.0.1:4040/mock/messages -H 'content-type: application/json' \\
|
|
15
|
+
-d '{"channel":"general","user":"alice","text":"<@U0BOT00000> hello"}'
|
|
16
|
+
`;
|
|
17
|
+
|
|
18
|
+
async function main(argv: string[]): Promise<void> {
|
|
19
|
+
const [command, ...rest] = argv;
|
|
20
|
+
if (command === "serve") {
|
|
21
|
+
const { values } = parseArgs({
|
|
22
|
+
args: rest,
|
|
23
|
+
options: {
|
|
24
|
+
port: { type: "string", default: "4040" },
|
|
25
|
+
host: { type: "string", default: "127.0.0.1" },
|
|
26
|
+
data: { type: "string" },
|
|
27
|
+
manifest: { type: "string" },
|
|
28
|
+
"no-seed": { type: "boolean", default: false },
|
|
29
|
+
quiet: { type: "boolean", default: false },
|
|
30
|
+
panel: { type: "string" },
|
|
31
|
+
},
|
|
32
|
+
});
|
|
33
|
+
const mock = await SlackMock.start({
|
|
34
|
+
panelWidth: values.panel,
|
|
35
|
+
port: Number(values.port),
|
|
36
|
+
host: values.host,
|
|
37
|
+
dataFile: values.data,
|
|
38
|
+
manifest: values.manifest,
|
|
39
|
+
seed: !values["no-seed"],
|
|
40
|
+
log: !values.quiet,
|
|
41
|
+
});
|
|
42
|
+
console.log(`slack-mock listening on ${mock.baseUrl}`);
|
|
43
|
+
console.log("");
|
|
44
|
+
console.log("Bot environment:");
|
|
45
|
+
for (const [k, v] of Object.entries(mock.env)) console.log(` ${k}=${v}`);
|
|
46
|
+
console.log("");
|
|
47
|
+
console.log(
|
|
48
|
+
`Workspace: ${mock.baseUrl}/ (bot user ${mock.bot.userId}, team ${mock.team.id})`,
|
|
49
|
+
);
|
|
50
|
+
for (const c of mock.store.channels.values())
|
|
51
|
+
console.log(` #${c.name}: ${mock.baseUrl}/c/${c.id}`);
|
|
52
|
+
console.log("");
|
|
53
|
+
console.log(`Admin API: POST ${mock.baseUrl}/mock/messages {channel,user,text,thread_ts}`);
|
|
54
|
+
const stop = async () => {
|
|
55
|
+
await mock.stop();
|
|
56
|
+
process.exit(0);
|
|
57
|
+
};
|
|
58
|
+
process.on("SIGINT", stop);
|
|
59
|
+
process.on("SIGTERM", stop);
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
if (command === "screenshot") {
|
|
63
|
+
const { values, positionals } = parseArgs({
|
|
64
|
+
args: rest,
|
|
65
|
+
allowPositionals: true,
|
|
66
|
+
options: {
|
|
67
|
+
out: { type: "string", default: "slack-mock.png" },
|
|
68
|
+
width: { type: "string", default: "800" },
|
|
69
|
+
height: { type: "string", default: "1000" },
|
|
70
|
+
},
|
|
71
|
+
});
|
|
72
|
+
const url = positionals[0];
|
|
73
|
+
if (!url) throw new Error("screenshot needs a URL");
|
|
74
|
+
const out = await screenshot(url, {
|
|
75
|
+
out: values.out,
|
|
76
|
+
width: Number(values.width),
|
|
77
|
+
height: Number(values.height),
|
|
78
|
+
});
|
|
79
|
+
console.log(out);
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
console.log(USAGE);
|
|
83
|
+
if (command && command !== "help" && command !== "--help") process.exit(1);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
main(process.argv.slice(2)).catch((e) => {
|
|
87
|
+
console.error(e instanceof Error ? e.message : e);
|
|
88
|
+
process.exit(1);
|
|
89
|
+
});
|