vit 0.0.1 → 0.1.3

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.
@@ -0,0 +1,477 @@
1
+ // SPDX-License-Identifier: MIT
2
+ // Copyright (c) 2026 sol pbc
3
+
4
+ import { DEFAULT_EXPLORE_URL } from '../lib/constants.js';
5
+ import { readProjectConfig } from '../lib/vit-dir.js';
6
+ import { brand } from '../lib/brand.js';
7
+ import { jsonOk, jsonError } from '../lib/json-output.js';
8
+
9
+ function timeAgo(isoString) {
10
+ const seconds = Math.floor((Date.now() - new Date(isoString).getTime()) / 1000);
11
+ if (seconds < 60) return `${seconds}s ago`;
12
+ const minutes = Math.floor(seconds / 60);
13
+ if (minutes < 60) return `${minutes}m ago`;
14
+ const hours = Math.floor(minutes / 60);
15
+ if (hours < 24) return `${hours}h ago`;
16
+ const days = Math.floor(hours / 24);
17
+ if (days < 30) return `${days}d ago`;
18
+ const months = Math.floor(days / 30);
19
+ if (months < 12) return `${months}mo ago`;
20
+ const years = Math.floor(days / 365);
21
+ return `${years}y ago`;
22
+ }
23
+
24
+ function resolveUrl(opts) {
25
+ return opts.exploreUrl || process.env.VIT_EXPLORE_URL || DEFAULT_EXPLORE_URL;
26
+ }
27
+
28
+ function unavailableMessage(baseUrl) {
29
+ try {
30
+ return `${new URL(baseUrl).host} is unavailable. try 'vit scan' for network-wide discovery or 'vit skim' for your followed accounts.`;
31
+ } catch {
32
+ return `${baseUrl} is unavailable. try 'vit scan' for network-wide discovery or 'vit skim' for your followed accounts.`;
33
+ }
34
+ }
35
+
36
+ function mergeExploreOpts(opts, command) {
37
+ return {
38
+ ...(command?.parent?.opts?.() || {}),
39
+ ...(command?.opts?.() || opts || {}),
40
+ };
41
+ }
42
+
43
+ async function fetchAndShowStats(opts) {
44
+ const baseUrl = resolveUrl(opts);
45
+ try {
46
+ const url = new URL('/api/stats', baseUrl);
47
+ const res = await fetch(url);
48
+ if (!res.ok) throw new Error(`explore API returned ${res.status}`);
49
+ const data = await res.json();
50
+
51
+ if (opts.json) {
52
+ jsonOk(data);
53
+ return;
54
+ }
55
+
56
+ console.log(`${brand} explore stats`);
57
+ console.log(` caps: ${data.total_caps} skills: ${data.total_skills}`);
58
+ console.log(` vouches: ${data.total_vouches} beacons: ${data.total_beacons}`);
59
+ console.log(` active dids: ${data.active_dids} skill publishers: ${data.skill_publishers}`);
60
+ } catch (err) {
61
+ const msg = err instanceof Error ? err.message : String(err);
62
+ const finalMsg = msg.startsWith('explore API returned ')
63
+ ? msg
64
+ : unavailableMessage(baseUrl);
65
+ if (opts.json) {
66
+ jsonError(finalMsg);
67
+ return;
68
+ }
69
+ console.error(finalMsg);
70
+ process.exitCode = 1;
71
+ }
72
+ }
73
+
74
+ export default function register(program) {
75
+ const explore = program
76
+ .command('explore')
77
+ .description('Query the explore index for caps, skills, beacons, vouches, and stats')
78
+ .option('--json', 'Output as JSON')
79
+ .option('--explore-url <url>', 'Explore API base URL')
80
+ .action(async (opts) => {
81
+ await fetchAndShowStats(opts);
82
+ });
83
+
84
+ explore
85
+ .command('cap')
86
+ .argument('<ref>', 'Cap ref to look up')
87
+ .description('Show details for a single cap')
88
+ .option('--beacon <beacon>', 'Scope lookup to a beacon')
89
+ .option('--json', 'Output as JSON')
90
+ .option('--explore-url <url>', 'Explore API base URL')
91
+ .action(async (ref, opts, command) => {
92
+ opts = mergeExploreOpts(opts, command);
93
+ const baseUrl = resolveUrl(opts);
94
+
95
+ try {
96
+ const url = new URL('/api/cap', baseUrl);
97
+ url.searchParams.set('ref', ref);
98
+ if (opts.beacon) url.searchParams.set('beacon', opts.beacon);
99
+
100
+ const res = await fetch(url);
101
+ if (!res.ok) throw new Error(`explore API returned ${res.status}`);
102
+ const data = await res.json();
103
+
104
+ if (!data.cap) {
105
+ const msg = `no cap found with ref '${ref}'`;
106
+ if (opts.json) {
107
+ jsonError(msg);
108
+ return;
109
+ }
110
+ console.error(msg);
111
+ process.exitCode = 1;
112
+ return;
113
+ }
114
+
115
+ if (opts.json) {
116
+ jsonOk(data);
117
+ return;
118
+ }
119
+
120
+ const record = JSON.parse(data.cap.record_json);
121
+ console.log(`${brand} explore cap`);
122
+ console.log(` ${data.cap.title} [${record.kind}]`);
123
+ console.log(` ${data.cap.description}`);
124
+ console.log();
125
+ console.log(` beacon: ${data.cap.beacon}`);
126
+ console.log(` author: @${data.cap.handle}`);
127
+ console.log(` ref: ${data.cap.ref}`);
128
+ console.log(` posted: ${timeAgo(data.cap.created_at)}`);
129
+ if (record.text) {
130
+ console.log();
131
+ console.log(` ${record.text}`);
132
+ }
133
+ console.log();
134
+ console.log(` vouches: ${data.cap.vouch_count}`);
135
+ console.log();
136
+ console.log(` vit vet ${data.cap.ref} - inspect before adopting`);
137
+ console.log(` vit remix ${data.cap.ref} - remix this cap`);
138
+ } catch (err) {
139
+ const msg = err instanceof Error ? err.message : String(err);
140
+ const finalMsg = msg.startsWith('explore API returned ')
141
+ ? msg
142
+ : unavailableMessage(baseUrl);
143
+ if (opts.json) {
144
+ jsonError(finalMsg);
145
+ return;
146
+ }
147
+ console.error(finalMsg);
148
+ process.exitCode = 1;
149
+ }
150
+ });
151
+
152
+ explore
153
+ .command('skill')
154
+ .argument('<name>', 'Skill name to look up')
155
+ .description('Show details for a single skill')
156
+ .option('--json', 'Output as JSON')
157
+ .option('--explore-url <url>', 'Explore API base URL')
158
+ .action(async (name, opts, command) => {
159
+ opts = mergeExploreOpts(opts, command);
160
+ const baseUrl = resolveUrl(opts);
161
+
162
+ try {
163
+ const url = new URL('/api/skill', baseUrl);
164
+ url.searchParams.set('name', name);
165
+
166
+ const res = await fetch(url);
167
+ if (!res.ok) throw new Error(`explore API returned ${res.status}`);
168
+ const data = await res.json();
169
+
170
+ if (!data.skill) {
171
+ const msg = `no skill found with name '${name}'`;
172
+ if (opts.json) {
173
+ jsonError(msg);
174
+ return;
175
+ }
176
+ console.error(msg);
177
+ process.exitCode = 1;
178
+ return;
179
+ }
180
+
181
+ if (opts.json) {
182
+ jsonOk(data);
183
+ return;
184
+ }
185
+
186
+ const record = JSON.parse(data.skill.record_json);
187
+ console.log(`${brand} explore skill`);
188
+ console.log(` /${data.skill.name} v${data.skill.version}`);
189
+ console.log(` ${data.skill.description}`);
190
+ console.log();
191
+ console.log(` author: @${data.skill.handle}`);
192
+ if (record.license) console.log(` license: ${record.license}`);
193
+ if (data.skill.tags) console.log(` tags: ${data.skill.tags}`);
194
+ console.log(` vouches: ${data.skill.vouch_count}`);
195
+ console.log();
196
+ console.log(` vit learn skill-${data.skill.name} - install this skill`);
197
+ } catch (err) {
198
+ const msg = err instanceof Error ? err.message : String(err);
199
+ const finalMsg = msg.startsWith('explore API returned ')
200
+ ? msg
201
+ : unavailableMessage(baseUrl);
202
+ if (opts.json) {
203
+ jsonError(finalMsg);
204
+ return;
205
+ }
206
+ console.error(finalMsg);
207
+ process.exitCode = 1;
208
+ }
209
+ });
210
+
211
+ explore
212
+ .command('caps')
213
+ .description('List recent caps from the explore index')
214
+ .option('--beacon <beacon>', 'Filter by beacon')
215
+ .option('--limit <n>', 'Limit number of caps')
216
+ .option('--cursor <id>', 'Pagination cursor')
217
+ .option('--json', 'Output as JSON')
218
+ .option('--explore-url <url>', 'Explore API base URL')
219
+ .action(async (opts, command) => {
220
+ opts = mergeExploreOpts(opts, command);
221
+ const baseUrl = resolveUrl(opts);
222
+
223
+ try {
224
+ let beacon = opts.beacon;
225
+ if (beacon === '.') {
226
+ const config = readProjectConfig();
227
+ const beacons = [config.beacon, config.secondaryBeacon].filter(Boolean);
228
+ if (beacons.length === 0) {
229
+ const msg = "no beacon set — run 'vit init' first";
230
+ if (opts.json) {
231
+ jsonError(msg);
232
+ return;
233
+ }
234
+ console.error(msg);
235
+ process.exitCode = 1;
236
+ return;
237
+ }
238
+ beacon = beacons.join(',');
239
+ }
240
+
241
+ const url = new URL('/api/caps', baseUrl);
242
+ if (beacon) url.searchParams.set('beacon', beacon);
243
+ if (opts.limit) url.searchParams.set('limit', opts.limit);
244
+ if (opts.cursor) url.searchParams.set('cursor', opts.cursor);
245
+
246
+ const res = await fetch(url);
247
+ if (!res.ok) throw new Error(`explore API returned ${res.status}`);
248
+ const data = await res.json();
249
+
250
+ if (opts.json) {
251
+ jsonOk({ caps: data.caps, cursor: data.cursor });
252
+ return;
253
+ }
254
+
255
+ console.log(`${brand} explore caps`);
256
+ if (!data.caps?.length) {
257
+ console.log('no caps found.');
258
+ return;
259
+ }
260
+
261
+ for (const cap of data.caps) {
262
+ console.log(` ${cap.title} (${cap.ref})`);
263
+ console.log(` @${cap.handle} ${cap.beacon}`);
264
+ console.log(` ${cap.description}`);
265
+ }
266
+ if (data.cursor) {
267
+ console.log(`\nnext: --cursor ${data.cursor}`);
268
+ }
269
+ } catch (err) {
270
+ const msg = err instanceof Error ? err.message : String(err);
271
+ const finalMsg = msg.startsWith('explore API returned ')
272
+ ? msg
273
+ : unavailableMessage(baseUrl);
274
+ if (opts.json) {
275
+ jsonError(finalMsg);
276
+ return;
277
+ }
278
+ console.error(finalMsg);
279
+ process.exitCode = 1;
280
+ }
281
+ });
282
+
283
+ explore
284
+ .command('skills')
285
+ .description('List published skills from the explore index')
286
+ .option('--tag <tag>', 'Filter by tag')
287
+ .option('--limit <n>', 'Limit number of skills')
288
+ .option('--cursor <id>', 'Pagination cursor')
289
+ .option('--json', 'Output as JSON')
290
+ .option('--explore-url <url>', 'Explore API base URL')
291
+ .action(async (opts, command) => {
292
+ opts = mergeExploreOpts(opts, command);
293
+ const baseUrl = resolveUrl(opts);
294
+
295
+ try {
296
+ const url = new URL('/api/skills', baseUrl);
297
+ if (opts.tag) url.searchParams.set('tag', opts.tag);
298
+ if (opts.limit) url.searchParams.set('limit', opts.limit);
299
+ if (opts.cursor) url.searchParams.set('cursor', opts.cursor);
300
+
301
+ const res = await fetch(url);
302
+ if (!res.ok) throw new Error(`explore API returned ${res.status}`);
303
+ const data = await res.json();
304
+
305
+ if (opts.json) {
306
+ jsonOk({ skills: data.skills, cursor: data.cursor });
307
+ return;
308
+ }
309
+
310
+ console.log(`${brand} explore skills`);
311
+ if (!data.skills?.length) {
312
+ console.log('no skills found.');
313
+ return;
314
+ }
315
+
316
+ for (const skill of data.skills) {
317
+ console.log(` ${skill.name} v${skill.version} (${skill.ref})`);
318
+ console.log(` @${skill.handle} ${skill.description}`);
319
+ }
320
+ if (data.cursor) {
321
+ console.log(`\nnext: --cursor ${data.cursor}`);
322
+ }
323
+ } catch (err) {
324
+ const msg = err instanceof Error ? err.message : String(err);
325
+ const finalMsg = msg.startsWith('explore API returned ')
326
+ ? msg
327
+ : unavailableMessage(baseUrl);
328
+ if (opts.json) {
329
+ jsonError(finalMsg);
330
+ return;
331
+ }
332
+ console.error(finalMsg);
333
+ process.exitCode = 1;
334
+ }
335
+ });
336
+
337
+ explore
338
+ .command('beacons')
339
+ .description('List active beacons from the explore index')
340
+ .option('--json', 'Output as JSON')
341
+ .option('--explore-url <url>', 'Explore API base URL')
342
+ .action(async (opts, command) => {
343
+ opts = mergeExploreOpts(opts, command);
344
+ const baseUrl = resolveUrl(opts);
345
+
346
+ try {
347
+ const url = new URL('/api/beacons', baseUrl);
348
+ const res = await fetch(url);
349
+ if (!res.ok) throw new Error(`explore API returned ${res.status}`);
350
+ const data = await res.json();
351
+
352
+ if (opts.json) {
353
+ jsonOk({ beacons: data.beacons });
354
+ return;
355
+ }
356
+
357
+ console.log(`${brand} explore beacons`);
358
+ if (!data.beacons?.length) {
359
+ console.log('no beacons found.');
360
+ return;
361
+ }
362
+
363
+ for (const beacon of data.beacons) {
364
+ console.log(` ${beacon.name}`);
365
+ console.log(` caps: ${beacon.cap_count} vouches: ${beacon.vouch_count} last active: ${beacon.last_activity}`);
366
+ }
367
+ } catch (err) {
368
+ const msg = err instanceof Error ? err.message : String(err);
369
+ const finalMsg = msg.startsWith('explore API returned ')
370
+ ? msg
371
+ : unavailableMessage(baseUrl);
372
+ if (opts.json) {
373
+ jsonError(finalMsg);
374
+ return;
375
+ }
376
+ console.error(finalMsg);
377
+ process.exitCode = 1;
378
+ }
379
+ });
380
+
381
+ explore
382
+ .command('vouches')
383
+ .description('List vouches for a cap from the explore index')
384
+ .option('--cap <uri>', 'Cap URI')
385
+ .option('--ref <ref>', 'Cap ref')
386
+ .option('--beacon <beacon>', 'Filter ref lookup by beacon')
387
+ .option('--json', 'Output as JSON')
388
+ .option('--explore-url <url>', 'Explore API base URL')
389
+ .action(async (opts, command) => {
390
+ opts = mergeExploreOpts(opts, command);
391
+ const baseUrl = resolveUrl(opts);
392
+
393
+ try {
394
+ if ((!opts.cap && !opts.ref) || (opts.cap && opts.ref)) {
395
+ const msg = 'provide --cap <uri> or --ref <ref>';
396
+ if (opts.json) {
397
+ jsonError(msg);
398
+ return;
399
+ }
400
+ console.error(msg);
401
+ process.exitCode = 1;
402
+ return;
403
+ }
404
+
405
+ let capUri = opts.cap;
406
+ if (opts.ref) {
407
+ const capsUrl = new URL('/api/caps', baseUrl);
408
+ if (opts.beacon) capsUrl.searchParams.set('beacon', opts.beacon);
409
+
410
+ const capsRes = await fetch(capsUrl);
411
+ if (!capsRes.ok) throw new Error(`explore API returned ${capsRes.status}`);
412
+ const capsData = await capsRes.json();
413
+ const match = capsData.caps?.find((cap) => cap.ref === opts.ref);
414
+
415
+ if (!match) {
416
+ const msg = `no cap found with ref '${opts.ref}'`;
417
+ if (opts.json) {
418
+ jsonError(msg);
419
+ return;
420
+ }
421
+ console.error(msg);
422
+ process.exitCode = 1;
423
+ return;
424
+ }
425
+
426
+ capUri = match.uri;
427
+ }
428
+
429
+ const url = new URL('/api/vouches', baseUrl);
430
+ url.searchParams.set('cap_uri', capUri);
431
+
432
+ const res = await fetch(url);
433
+ if (!res.ok) throw new Error(`explore API returned ${res.status}`);
434
+ const data = await res.json();
435
+
436
+ if (opts.json) {
437
+ jsonOk({ vouches: data.vouches, cap_uri: capUri });
438
+ return;
439
+ }
440
+
441
+ console.log(`${brand} explore vouches`);
442
+ if (!data.vouches?.length) {
443
+ console.log('no vouches found for this cap.');
444
+ return;
445
+ }
446
+
447
+ for (const vouch of data.vouches) {
448
+ const who = vouch.handle ? `@${vouch.handle}` : (vouch.did || 'unknown');
449
+ const createdAt = vouch.created_at || vouch.createdAt || 'unknown';
450
+ const ref = vouch.ref || vouch.cap_ref || vouch.cap_uri || '';
451
+ console.log(` ${who} ${createdAt}`);
452
+ if (ref) console.log(` ${ref}`);
453
+ }
454
+ } catch (err) {
455
+ const msg = err instanceof Error ? err.message : String(err);
456
+ const finalMsg = msg.startsWith('explore API returned ')
457
+ ? msg
458
+ : unavailableMessage(baseUrl);
459
+ if (opts.json) {
460
+ jsonError(finalMsg);
461
+ return;
462
+ }
463
+ console.error(finalMsg);
464
+ process.exitCode = 1;
465
+ }
466
+ });
467
+
468
+ explore
469
+ .command('stats', { isDefault: true })
470
+ .description('Show network-wide stats from the explore index')
471
+ .option('--json', 'Output as JSON')
472
+ .option('--explore-url <url>', 'Explore API base URL')
473
+ .action(async (opts, command) => {
474
+ opts = mergeExploreOpts(opts, command);
475
+ await fetchAndShowStats(opts);
476
+ });
477
+ }
@@ -0,0 +1,159 @@
1
+ // SPDX-License-Identifier: MIT
2
+ // Copyright (c) 2026 sol pbc
3
+
4
+ import { loadConfig } from '../lib/config.js';
5
+ import { CAP_COLLECTION, DEFAULT_JETSTREAM_URL } from '../lib/constants.js';
6
+ import { resolveRef } from '../lib/cap-ref.js';
7
+ import { brand } from '../lib/brand.js';
8
+
9
+ let ws = null;
10
+ let shuttingDown = false;
11
+ let backoff = 1000;
12
+
13
+ function buildUrl(baseUrl, collection, did, cursor) {
14
+ const url = new URL(baseUrl);
15
+ url.searchParams.set('wantedCollections', collection);
16
+ if (did) url.searchParams.set('wantedDids', did);
17
+ if (cursor) url.searchParams.set('cursor', cursor);
18
+ return url.toString();
19
+ }
20
+
21
+ function formatTime(timeUs) {
22
+ return new Date(timeUs / 1000).toLocaleTimeString();
23
+ }
24
+
25
+ function formatEvent(event) {
26
+ const time = formatTime(event.time_us);
27
+ const didShort = typeof event.did === 'string' ? event.did.slice(-12) : 'unknown';
28
+
29
+ if (event.kind === 'commit') {
30
+ const operation = event.commit?.operation?.toUpperCase?.() ?? 'UNKNOWN';
31
+ const collection = event.commit?.collection ?? 'unknown';
32
+ const rkey = event.commit?.rkey ?? 'unknown';
33
+
34
+ if (operation === 'DELETE') {
35
+ return `[${time}] ${operation} ${collection} from ${didShort} rkey=${rkey}`;
36
+ }
37
+
38
+ const message = event.commit?.record?.title || event.commit?.record?.text;
39
+ const ref = event.commit?.cid ? resolveRef(event.commit.record, event.commit.cid) : null;
40
+ if (typeof message === 'string') {
41
+ const refPart = ref ? ` (${ref})` : '';
42
+ return `[${time}] ${operation} ${collection} from ${didShort} rkey=${rkey}${refPart} — "${message}"`;
43
+ }
44
+
45
+ return `[${time}] ${operation} ${collection} from ${didShort} rkey=${rkey}`;
46
+ }
47
+
48
+ if (event.kind === 'identity') {
49
+ return `[${time}] IDENTITY ${didShort}`;
50
+ }
51
+
52
+ if (event.kind === 'account') {
53
+ return `[${time}] ACCOUNT ${didShort} status=${event.account?.status}`;
54
+ }
55
+
56
+ return `[${time}] ${event.kind} from ${didShort}`;
57
+ }
58
+
59
+ function connect(opts, cursor) {
60
+ const url = buildUrl(opts.jetstreamUrl, opts.collection, opts.did, cursor);
61
+ let lastCursor = cursor;
62
+
63
+ ws = new WebSocket(url);
64
+
65
+ ws.onopen = () => {
66
+ backoff = 1000;
67
+ console.log(`Connected to ${url}`);
68
+ };
69
+
70
+ ws.onmessage = (event) => {
71
+ let msg;
72
+ try {
73
+ msg = JSON.parse(event.data);
74
+ } catch {
75
+ console.log('Warning: failed to parse message as JSON; skipping');
76
+ return;
77
+ }
78
+
79
+ if (msg.time_us) {
80
+ lastCursor = String(msg.time_us);
81
+ }
82
+
83
+ if (opts.verbose) {
84
+ console.log(JSON.stringify(msg, null, 2));
85
+ return;
86
+ }
87
+
88
+ console.log(formatEvent(msg));
89
+ };
90
+
91
+ ws.onclose = () => {
92
+ if (shuttingDown) {
93
+ return;
94
+ }
95
+
96
+ const delay = backoff;
97
+ backoff = Math.min(backoff * 2, 30000);
98
+ console.log(`Connection closed, reconnecting in ${delay}ms...`);
99
+ setTimeout(() => connect(opts, lastCursor), delay);
100
+ };
101
+
102
+ ws.onerror = (err) => {
103
+ const message = err?.message ?? 'unknown error';
104
+ console.error(`WebSocket error: ${message}`);
105
+ };
106
+ }
107
+
108
+ export default function register(program) {
109
+ program
110
+ .command('firehose')
111
+ .description('Listen to Jetstream for cap events')
112
+ .option('-v, --verbose', 'Show full JSON for each event')
113
+ .option('--did <did>', 'Filter by DID (reads saved DID from config if not provided)')
114
+ .option('--global', 'Show cap events from all DIDs across the network')
115
+ .option('--collection <nsid>', 'Collection NSID to filter', CAP_COLLECTION)
116
+ .option('--jetstream <url>', 'Jetstream WebSocket URL (default: VIT_JETSTREAM_URL env or built-in)')
117
+ .action(async (opts) => {
118
+ try {
119
+ if (opts.global && opts.did) {
120
+ console.error('error: --global and --did are mutually exclusive');
121
+ process.exitCode = 1;
122
+ return;
123
+ }
124
+
125
+ if (opts.global) {
126
+ opts.did = undefined;
127
+ } else if (!opts.did) {
128
+ const config = loadConfig();
129
+ if (config.did) {
130
+ opts.did = config.did;
131
+ }
132
+ }
133
+
134
+ const jetstreamUrl = opts.jetstream || process.env.VIT_JETSTREAM_URL || DEFAULT_JETSTREAM_URL;
135
+ opts.jetstreamUrl = jetstreamUrl;
136
+
137
+ for (const sig of ['SIGINT', 'SIGTERM']) {
138
+ process.on(sig, () => {
139
+ shuttingDown = true;
140
+ console.log('\nShutting down...');
141
+ if (ws) ws.close();
142
+ process.exit(0);
143
+ });
144
+ }
145
+
146
+ const url = buildUrl(jetstreamUrl, opts.collection, opts.did, null);
147
+ console.log(`${brand} firehose`);
148
+ console.log(` Collection: ${opts.collection}`);
149
+ if (opts.did) console.log(` DID filter: ${opts.did}`);
150
+ console.log(` Endpoint: ${url}`);
151
+ console.log(' Ctrl+C to stop\n');
152
+
153
+ connect(opts, null);
154
+ } catch (err) {
155
+ console.error(err instanceof Error ? err.message : String(err));
156
+ process.exitCode = 1;
157
+ }
158
+ });
159
+ }