@hesed/sentry 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.
Files changed (47) hide show
  1. package/README.md +453 -0
  2. package/bin/dev.cmd +3 -0
  3. package/bin/dev.js +5 -0
  4. package/bin/run.cmd +3 -0
  5. package/bin/run.js +5 -0
  6. package/dist/commands/sentry/auth/add.d.ts +14 -0
  7. package/dist/commands/sentry/auth/add.js +56 -0
  8. package/dist/commands/sentry/auth/test.d.ts +10 -0
  9. package/dist/commands/sentry/auth/test.js +32 -0
  10. package/dist/commands/sentry/auth/update.d.ts +14 -0
  11. package/dist/commands/sentry/auth/update.js +68 -0
  12. package/dist/commands/sentry/event/get.d.ts +13 -0
  13. package/dist/commands/sentry/event/get.js +31 -0
  14. package/dist/commands/sentry/event/source-maps.d.ts +15 -0
  15. package/dist/commands/sentry/event/source-maps.js +40 -0
  16. package/dist/commands/sentry/issue/event.d.ts +13 -0
  17. package/dist/commands/sentry/issue/event.js +34 -0
  18. package/dist/commands/sentry/issue/events.d.ts +18 -0
  19. package/dist/commands/sentry/issue/events.js +47 -0
  20. package/dist/commands/sentry/issue/get.d.ts +12 -0
  21. package/dist/commands/sentry/issue/get.js +28 -0
  22. package/dist/commands/sentry/issue/hashes.d.ts +13 -0
  23. package/dist/commands/sentry/issue/hashes.js +32 -0
  24. package/dist/commands/sentry/issue/tag-values.d.ts +15 -0
  25. package/dist/commands/sentry/issue/tag-values.js +36 -0
  26. package/dist/commands/sentry/issue/tag.d.ts +14 -0
  27. package/dist/commands/sentry/issue/tag.js +33 -0
  28. package/dist/commands/sentry/issue/update.d.ts +18 -0
  29. package/dist/commands/sentry/issue/update.js +54 -0
  30. package/dist/commands/sentry/org/issues.d.ts +19 -0
  31. package/dist/commands/sentry/org/issues.js +57 -0
  32. package/dist/commands/sentry/project/events.d.ts +17 -0
  33. package/dist/commands/sentry/project/events.js +44 -0
  34. package/dist/commands/sentry/project/issues.d.ts +16 -0
  35. package/dist/commands/sentry/project/issues.js +44 -0
  36. package/dist/config.d.ts +10 -0
  37. package/dist/config.js +18 -0
  38. package/dist/format.d.ts +4 -0
  39. package/dist/format.js +10 -0
  40. package/dist/index.d.ts +1 -0
  41. package/dist/index.js +1 -0
  42. package/dist/sentry/sentry-api.d.ts +127 -0
  43. package/dist/sentry/sentry-api.js +176 -0
  44. package/dist/sentry/sentry-client.d.ts +61 -0
  45. package/dist/sentry/sentry-client.js +66 -0
  46. package/oclif.manifest.json +937 -0
  47. package/package.json +105 -0
package/README.md ADDED
@@ -0,0 +1,453 @@
1
+ # sentry
2
+
3
+ CLI for Sentry error tracking API interaction
4
+
5
+ [![Version](https://img.shields.io/npm/v/@hesed/sentry.svg)](https://npmjs.org/package/@hesed/sentry)
6
+ [![Downloads/week](https://img.shields.io/npm/dw/@hesed/sentry.svg)](https://npmjs.org/package/@hesed/sentry)
7
+
8
+ # Install
9
+
10
+ ```bash
11
+ sdkck plugins install @hesed/sentry
12
+ ```
13
+
14
+ <!-- toc -->
15
+ * [sentry](#sentry)
16
+ * [Install](#install)
17
+ * [Usage](#usage)
18
+ * [Commands](#commands)
19
+ <!-- tocstop -->
20
+
21
+ # Usage
22
+
23
+ <!-- usage -->
24
+ ```sh-session
25
+ $ npm install -g @hesed/sentry
26
+ $ sentry COMMAND
27
+ running command...
28
+ $ sentry (--version)
29
+ @hesed/sentry/0.1.0 darwin-arm64 node-v22.14.0
30
+ $ sentry --help [COMMAND]
31
+ USAGE
32
+ $ sentry COMMAND
33
+ ...
34
+ ```
35
+ <!-- usagestop -->
36
+
37
+ # Commands
38
+
39
+ <!-- commands -->
40
+ * [`sentry sentry auth add`](#sentry-sentry-auth-add)
41
+ * [`sentry sentry auth test`](#sentry-sentry-auth-test)
42
+ * [`sentry sentry auth update`](#sentry-sentry-auth-update)
43
+ * [`sentry sentry event get PROJECTSLUG EVENTID`](#sentry-sentry-event-get-projectslug-eventid)
44
+ * [`sentry sentry event source-maps PROJECTSLUG EVENTID`](#sentry-sentry-event-source-maps-projectslug-eventid)
45
+ * [`sentry sentry issue event ISSUEID EVENTID`](#sentry-sentry-issue-event-issueid-eventid)
46
+ * [`sentry sentry issue events ISSUEID`](#sentry-sentry-issue-events-issueid)
47
+ * [`sentry sentry issue get ISSUEID`](#sentry-sentry-issue-get-issueid)
48
+ * [`sentry sentry issue hashes ISSUEID`](#sentry-sentry-issue-hashes-issueid)
49
+ * [`sentry sentry issue tag ISSUEID TAGKEY`](#sentry-sentry-issue-tag-issueid-tagkey)
50
+ * [`sentry sentry issue tag-values ISSUEID TAGKEY`](#sentry-sentry-issue-tag-values-issueid-tagkey)
51
+ * [`sentry sentry issue update ISSUEID`](#sentry-sentry-issue-update-issueid)
52
+ * [`sentry sentry org issues`](#sentry-sentry-org-issues)
53
+ * [`sentry sentry project events PROJECTSLUG`](#sentry-sentry-project-events-projectslug)
54
+ * [`sentry sentry project issues PROJECTSLUG`](#sentry-sentry-project-issues-projectslug)
55
+
56
+ ## `sentry sentry auth add`
57
+
58
+ Add Sentry authentication
59
+
60
+ ```
61
+ USAGE
62
+ $ sentry sentry auth add [--json] [-o <value>] [-t <value>] [-u <value>]
63
+
64
+ FLAGS
65
+ -o, --organization=<value> Sentry organization slug:
66
+ -t, --token=<value> Auth Token:
67
+ -u, --url=<value> [default: https://sentry.io/api/0] Sentry base URL:
68
+
69
+ GLOBAL FLAGS
70
+ --json Format output as json.
71
+
72
+ DESCRIPTION
73
+ Add Sentry authentication
74
+
75
+ EXAMPLES
76
+ $ sentry sentry auth add
77
+ ```
78
+
79
+ _See code: [src/commands/sentry/auth/add.ts](https://github.com/hesedcasa/sentry/blob/v0.1.0/src/commands/sentry/auth/add.ts)_
80
+
81
+ ## `sentry sentry auth test`
82
+
83
+ Test authentication and connection
84
+
85
+ ```
86
+ USAGE
87
+ $ sentry sentry auth test [--json]
88
+
89
+ GLOBAL FLAGS
90
+ --json Format output as json.
91
+
92
+ DESCRIPTION
93
+ Test authentication and connection
94
+
95
+ EXAMPLES
96
+ $ sentry sentry auth test
97
+ ```
98
+
99
+ _See code: [src/commands/sentry/auth/test.ts](https://github.com/hesedcasa/sentry/blob/v0.1.0/src/commands/sentry/auth/test.ts)_
100
+
101
+ ## `sentry sentry auth update`
102
+
103
+ Update existing authentication
104
+
105
+ ```
106
+ USAGE
107
+ $ sentry sentry auth update [--json] [-o <value>] [-t <value>] [-u <value>]
108
+
109
+ FLAGS
110
+ -o, --organization=<value> Sentry organization slug
111
+ -t, --token=<value> Auth Token
112
+ -u, --url=<value> Sentry base URL
113
+
114
+ GLOBAL FLAGS
115
+ --json Format output as json.
116
+
117
+ DESCRIPTION
118
+ Update existing authentication
119
+
120
+ EXAMPLES
121
+ $ sentry sentry auth update
122
+ ```
123
+
124
+ _See code: [src/commands/sentry/auth/update.ts](https://github.com/hesedcasa/sentry/blob/v0.1.0/src/commands/sentry/auth/update.ts)_
125
+
126
+ ## `sentry sentry event get PROJECTSLUG EVENTID`
127
+
128
+ Retrieve a Sentry event for a project
129
+
130
+ ```
131
+ USAGE
132
+ $ sentry sentry event get PROJECTSLUG EVENTID [--toon]
133
+
134
+ ARGUMENTS
135
+ PROJECTSLUG Project slug
136
+ EVENTID Event ID
137
+
138
+ FLAGS
139
+ --toon Format output as toon
140
+
141
+ DESCRIPTION
142
+ Retrieve a Sentry event for a project
143
+
144
+ EXAMPLES
145
+ $ sentry sentry event get my-project abc123def456
146
+ ```
147
+
148
+ _See code: [src/commands/sentry/event/get.ts](https://github.com/hesedcasa/sentry/blob/v0.1.0/src/commands/sentry/event/get.ts)_
149
+
150
+ ## `sentry sentry event source-maps PROJECTSLUG EVENTID`
151
+
152
+ Debug source maps for a Sentry event
153
+
154
+ ```
155
+ USAGE
156
+ $ sentry sentry event source-maps PROJECTSLUG EVENTID [--exception-idx <value>] [--frame-idx <value>] [--toon]
157
+
158
+ ARGUMENTS
159
+ PROJECTSLUG Project slug
160
+ EVENTID Event ID
161
+
162
+ FLAGS
163
+ --exception-idx=<value> Exception index
164
+ --frame-idx=<value> Frame index
165
+ --toon Format output as toon
166
+
167
+ DESCRIPTION
168
+ Debug source maps for a Sentry event
169
+
170
+ EXAMPLES
171
+ $ sentry sentry event source-maps my-project abc123def456
172
+ ```
173
+
174
+ _See code: [src/commands/sentry/event/source-maps.ts](https://github.com/hesedcasa/sentry/blob/v0.1.0/src/commands/sentry/event/source-maps.ts)_
175
+
176
+ ## `sentry sentry issue event ISSUEID EVENTID`
177
+
178
+ Retrieve a specific event from a Sentry issue
179
+
180
+ ```
181
+ USAGE
182
+ $ sentry sentry issue event ISSUEID EVENTID [--toon]
183
+
184
+ ARGUMENTS
185
+ ISSUEID Issue ID
186
+ EVENTID Event ID (latest, oldest, recommended, or event ID)
187
+
188
+ FLAGS
189
+ --toon Format output as toon
190
+
191
+ DESCRIPTION
192
+ Retrieve a specific event from a Sentry issue
193
+
194
+ EXAMPLES
195
+ $ sentry sentry issue event 123456789 latest
196
+
197
+ $ sentry sentry issue event 123456789 abc123def456
198
+ ```
199
+
200
+ _See code: [src/commands/sentry/issue/event.ts](https://github.com/hesedcasa/sentry/blob/v0.1.0/src/commands/sentry/issue/event.ts)_
201
+
202
+ ## `sentry sentry issue events ISSUEID`
203
+
204
+ List a Sentry issue's events
205
+
206
+ ```
207
+ USAGE
208
+ $ sentry sentry issue events ISSUEID [--cursor <value>] [--end <value>] [--environment <value>...] [--full] [--start
209
+ <value>] [--stats-period <value>] [--toon]
210
+
211
+ ARGUMENTS
212
+ ISSUEID Issue ID
213
+
214
+ FLAGS
215
+ --cursor=<value> Pagination cursor
216
+ --end=<value> End date (ISO-8601)
217
+ --environment=<value>... Filter by environment
218
+ --full Include full event body
219
+ --start=<value> Start date (ISO-8601)
220
+ --stats-period=<value> Time period (e.g. 24h, 7d)
221
+ --toon Format output as toon
222
+
223
+ DESCRIPTION
224
+ List a Sentry issue's events
225
+
226
+ EXAMPLES
227
+ $ sentry sentry issue events 123456789
228
+ ```
229
+
230
+ _See code: [src/commands/sentry/issue/events.ts](https://github.com/hesedcasa/sentry/blob/v0.1.0/src/commands/sentry/issue/events.ts)_
231
+
232
+ ## `sentry sentry issue get ISSUEID`
233
+
234
+ Retrieve a Sentry issue
235
+
236
+ ```
237
+ USAGE
238
+ $ sentry sentry issue get ISSUEID [--toon]
239
+
240
+ ARGUMENTS
241
+ ISSUEID Issue ID
242
+
243
+ FLAGS
244
+ --toon Format output as toon
245
+
246
+ DESCRIPTION
247
+ Retrieve a Sentry issue
248
+
249
+ EXAMPLES
250
+ $ sentry sentry issue get 123456789
251
+ ```
252
+
253
+ _See code: [src/commands/sentry/issue/get.ts](https://github.com/hesedcasa/sentry/blob/v0.1.0/src/commands/sentry/issue/get.ts)_
254
+
255
+ ## `sentry sentry issue hashes ISSUEID`
256
+
257
+ List a Sentry issue's hashes
258
+
259
+ ```
260
+ USAGE
261
+ $ sentry sentry issue hashes ISSUEID [--cursor <value>] [--toon]
262
+
263
+ ARGUMENTS
264
+ ISSUEID Issue ID
265
+
266
+ FLAGS
267
+ --cursor=<value> Pagination cursor
268
+ --toon Format output as toon
269
+
270
+ DESCRIPTION
271
+ List a Sentry issue's hashes
272
+
273
+ EXAMPLES
274
+ $ sentry sentry issue hashes 123456789
275
+ ```
276
+
277
+ _See code: [src/commands/sentry/issue/hashes.ts](https://github.com/hesedcasa/sentry/blob/v0.1.0/src/commands/sentry/issue/hashes.ts)_
278
+
279
+ ## `sentry sentry issue tag ISSUEID TAGKEY`
280
+
281
+ Retrieve tag details for a Sentry issue
282
+
283
+ ```
284
+ USAGE
285
+ $ sentry sentry issue tag ISSUEID TAGKEY [--environment <value>...] [--toon]
286
+
287
+ ARGUMENTS
288
+ ISSUEID Issue ID
289
+ TAGKEY Tag key (e.g. browser, url, user)
290
+
291
+ FLAGS
292
+ --environment=<value>... Filter by environment
293
+ --toon Format output as toon
294
+
295
+ DESCRIPTION
296
+ Retrieve tag details for a Sentry issue
297
+
298
+ EXAMPLES
299
+ $ sentry sentry issue tag 123456789 browser
300
+ ```
301
+
302
+ _See code: [src/commands/sentry/issue/tag.ts](https://github.com/hesedcasa/sentry/blob/v0.1.0/src/commands/sentry/issue/tag.ts)_
303
+
304
+ ## `sentry sentry issue tag-values ISSUEID TAGKEY`
305
+
306
+ List a tag's values for a Sentry issue
307
+
308
+ ```
309
+ USAGE
310
+ $ sentry sentry issue tag-values ISSUEID TAGKEY [--cursor <value>] [--environment <value>...] [--toon]
311
+
312
+ ARGUMENTS
313
+ ISSUEID Issue ID
314
+ TAGKEY Tag key (e.g. browser, url, user)
315
+
316
+ FLAGS
317
+ --cursor=<value> Pagination cursor
318
+ --environment=<value>... Filter by environment
319
+ --toon Format output as toon
320
+
321
+ DESCRIPTION
322
+ List a tag's values for a Sentry issue
323
+
324
+ EXAMPLES
325
+ $ sentry sentry issue tag-values 123456789 browser
326
+ ```
327
+
328
+ _See code: [src/commands/sentry/issue/tag-values.ts](https://github.com/hesedcasa/sentry/blob/v0.1.0/src/commands/sentry/issue/tag-values.ts)_
329
+
330
+ ## `sentry sentry issue update ISSUEID`
331
+
332
+ Update a Sentry issue
333
+
334
+ ```
335
+ USAGE
336
+ $ sentry sentry issue update ISSUEID [--assigned-to <value>] [--has-seen] [--is-bookmarked] [--is-public]
337
+ [--is-subscribed] [--status resolved|resolvedInNextRelease|unresolved|ignored] [--toon]
338
+
339
+ ARGUMENTS
340
+ ISSUEID Issue ID
341
+
342
+ FLAGS
343
+ --assigned-to=<value> Assign to user (actor ID or username)
344
+ --[no-]has-seen Mark issue as seen/unseen
345
+ --[no-]is-bookmarked Bookmark or unbookmark issue
346
+ --[no-]is-public Make issue public or private
347
+ --[no-]is-subscribed Subscribe or unsubscribe from issue
348
+ --status=<option> Issue status (resolved, resolvedInNextRelease, unresolved, ignored)
349
+ <options: resolved|resolvedInNextRelease|unresolved|ignored>
350
+ --toon Format output as toon
351
+
352
+ DESCRIPTION
353
+ Update a Sentry issue
354
+
355
+ EXAMPLES
356
+ $ sentry sentry issue update 123456789 --status resolved
357
+
358
+ $ sentry sentry issue update 123456789 --assigned-to user@example.com
359
+ ```
360
+
361
+ _See code: [src/commands/sentry/issue/update.ts](https://github.com/hesedcasa/sentry/blob/v0.1.0/src/commands/sentry/issue/update.ts)_
362
+
363
+ ## `sentry sentry org issues`
364
+
365
+ List a Sentry organization's issues
366
+
367
+ ```
368
+ USAGE
369
+ $ sentry sentry org issues [--cursor <value>] [--end <value>] [--environment <value>...] [--limit <value>] [--project
370
+ <value>...] [--query <value>] [--sort <value>] [--start <value>] [--stats-period <value>] [--toon]
371
+
372
+ FLAGS
373
+ --cursor=<value> Pagination cursor
374
+ --end=<value> End date (ISO-8601)
375
+ --environment=<value>... Filter by environment
376
+ --limit=<value> Maximum number of results
377
+ --project=<value>... Filter by project ID
378
+ --query=<value> Search query (e.g. "is:unresolved")
379
+ --sort=<value> Sort order
380
+ --start=<value> Start date (ISO-8601)
381
+ --stats-period=<value> Time period (e.g. 24h, 7d)
382
+ --toon Format output as toon
383
+
384
+ DESCRIPTION
385
+ List a Sentry organization's issues
386
+
387
+ EXAMPLES
388
+ $ sentry sentry org issues
389
+
390
+ $ sentry sentry org issues --query "is:unresolved" --limit 50
391
+ ```
392
+
393
+ _See code: [src/commands/sentry/org/issues.ts](https://github.com/hesedcasa/sentry/blob/v0.1.0/src/commands/sentry/org/issues.ts)_
394
+
395
+ ## `sentry sentry project events PROJECTSLUG`
396
+
397
+ List a Sentry project's error events
398
+
399
+ ```
400
+ USAGE
401
+ $ sentry sentry project events PROJECTSLUG [--cursor <value>] [--end <value>] [--full] [--start <value>] [--stats-period
402
+ <value>] [--toon]
403
+
404
+ ARGUMENTS
405
+ PROJECTSLUG Project slug
406
+
407
+ FLAGS
408
+ --cursor=<value> Pagination cursor
409
+ --end=<value> End date (ISO-8601)
410
+ --full Include full event body
411
+ --start=<value> Start date (ISO-8601)
412
+ --stats-period=<value> Time period (e.g. 24h, 7d)
413
+ --toon Format output as toon
414
+
415
+ DESCRIPTION
416
+ List a Sentry project's error events
417
+
418
+ EXAMPLES
419
+ $ sentry sentry project events my-project
420
+ ```
421
+
422
+ _See code: [src/commands/sentry/project/events.ts](https://github.com/hesedcasa/sentry/blob/v0.1.0/src/commands/sentry/project/events.ts)_
423
+
424
+ ## `sentry sentry project issues PROJECTSLUG`
425
+
426
+ List a Sentry project's issues
427
+
428
+ ```
429
+ USAGE
430
+ $ sentry sentry project issues PROJECTSLUG [--cursor <value>] [--query <value>] [--short-id-lookup] [--stats-period
431
+ <value>] [--toon]
432
+
433
+ ARGUMENTS
434
+ PROJECTSLUG Project slug
435
+
436
+ FLAGS
437
+ --cursor=<value> Pagination cursor
438
+ --query=<value> Search query (e.g. "is:unresolved")
439
+ --short-id-lookup Enable short ID lookup
440
+ --stats-period=<value> Time period (e.g. 24h, 7d)
441
+ --toon Format output as toon
442
+
443
+ DESCRIPTION
444
+ List a Sentry project's issues
445
+
446
+ EXAMPLES
447
+ $ sentry sentry project issues my-project
448
+
449
+ $ sentry sentry project issues my-project --query "is:unresolved"
450
+ ```
451
+
452
+ _See code: [src/commands/sentry/project/issues.ts](https://github.com/hesedcasa/sentry/blob/v0.1.0/src/commands/sentry/project/issues.ts)_
453
+ <!-- commandsstop -->
package/bin/dev.cmd ADDED
@@ -0,0 +1,3 @@
1
+ @echo off
2
+
3
+ node --loader ts-node/esm --no-warnings=ExperimentalWarning "%~dp0\dev" %*
package/bin/dev.js ADDED
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env -S node --loader ts-node/esm --disable-warning=ExperimentalWarning
2
+
3
+ import {execute} from '@oclif/core'
4
+
5
+ await execute({development: true, dir: import.meta.url})
package/bin/run.cmd ADDED
@@ -0,0 +1,3 @@
1
+ @echo off
2
+
3
+ node "%~dp0\run" %*
package/bin/run.js ADDED
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env node
2
+
3
+ import {execute} from '@oclif/core'
4
+
5
+ await execute({dir: import.meta.url})
@@ -0,0 +1,14 @@
1
+ import { Command } from '@oclif/core';
2
+ import { type ApiResult } from '../../../sentry/sentry-api.js';
3
+ export default class AuthAdd extends Command {
4
+ static args: {};
5
+ static description: string;
6
+ static enableJsonFlag: boolean;
7
+ static examples: string[];
8
+ static flags: {
9
+ organization: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
10
+ token: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
11
+ url: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
12
+ };
13
+ run(): Promise<ApiResult>;
14
+ }
@@ -0,0 +1,56 @@
1
+ import { input } from '@inquirer/prompts';
2
+ import { Command, Flags } from '@oclif/core';
3
+ import { action } from '@oclif/core/ux';
4
+ import { default as fs } from 'fs-extra';
5
+ import { default as path } from 'node:path';
6
+ import { clearClients, testConnection } from '../../../sentry/sentry-client.js';
7
+ export default class AuthAdd extends Command {
8
+ static args = {};
9
+ static description = 'Add Sentry authentication';
10
+ static enableJsonFlag = true;
11
+ static examples = ['<%= config.bin %> <%= command.id %>'];
12
+ static flags = {
13
+ organization: Flags.string({ char: 'o', description: 'Sentry organization slug:', required: !process.stdout.isTTY }),
14
+ token: Flags.string({ char: 't', description: 'Auth Token:', required: !process.stdout.isTTY }),
15
+ url: Flags.string({
16
+ char: 'u',
17
+ default: 'https://sentry.io/api/0',
18
+ description: 'Sentry base URL:',
19
+ required: false,
20
+ }),
21
+ };
22
+ async run() {
23
+ const { flags } = await this.parse(AuthAdd);
24
+ const authToken = flags.token ?? (await input({ message: 'Auth Token:', required: true }));
25
+ const organization = flags.organization ?? (await input({ message: 'Organization slug:', required: true }));
26
+ const host = flags.url ?? (await input({ default: 'https://sentry.io/api/0', message: 'Sentry base URL:', required: true }));
27
+ const configPath = path.join(this.config.configDir, 'sentry-config.json');
28
+ const auth = {
29
+ auth: {
30
+ authToken,
31
+ host,
32
+ organization,
33
+ },
34
+ };
35
+ const exists = await fs.pathExists(configPath);
36
+ if (!exists) {
37
+ await fs.createFile(configPath);
38
+ }
39
+ await fs.writeJSON(configPath, auth, {
40
+ mode: 0o600, // owner read/write only
41
+ });
42
+ action.start('Authenticating');
43
+ const config = await fs.readJSON(configPath);
44
+ const result = await testConnection(config.auth);
45
+ clearClients();
46
+ if (result.success) {
47
+ action.stop('✓ successful');
48
+ this.log('Authentication added successfully');
49
+ }
50
+ else {
51
+ action.stop('✗ failed');
52
+ this.error('Authentication is invalid. Please check your token, organization, and URL.');
53
+ }
54
+ return result;
55
+ }
56
+ }
@@ -0,0 +1,10 @@
1
+ import { Command } from '@oclif/core';
2
+ import { type ApiResult } from '../../../sentry/sentry-api.js';
3
+ export default class AuthTest extends Command {
4
+ static args: {};
5
+ static description: string;
6
+ static enableJsonFlag: boolean;
7
+ static examples: string[];
8
+ static flags: {};
9
+ run(): Promise<ApiResult>;
10
+ }
@@ -0,0 +1,32 @@
1
+ import { Command } from '@oclif/core';
2
+ import { action } from '@oclif/core/ux';
3
+ import { readConfig } from '../../../config.js';
4
+ import { clearClients, testConnection } from '../../../sentry/sentry-client.js';
5
+ export default class AuthTest extends Command {
6
+ static args = {};
7
+ static description = 'Test authentication and connection';
8
+ static enableJsonFlag = true;
9
+ static examples = ['<%= config.bin %> <%= command.id %>'];
10
+ static flags = {};
11
+ async run() {
12
+ const config = await readConfig(this.config.configDir, this.log.bind(this));
13
+ if (!config) {
14
+ return {
15
+ error: 'Missing authentication config',
16
+ success: false,
17
+ };
18
+ }
19
+ action.start('Authenticating connection');
20
+ const result = await testConnection(config.auth);
21
+ clearClients();
22
+ if (result.success) {
23
+ action.stop('✓ successful');
24
+ this.log('Successful connection to Sentry');
25
+ }
26
+ else {
27
+ action.stop('✗ failed');
28
+ this.error('Failed to connect to Sentry.');
29
+ }
30
+ return result;
31
+ }
32
+ }
@@ -0,0 +1,14 @@
1
+ import { Command } from '@oclif/core';
2
+ import { type ApiResult } from '../../../sentry/sentry-api.js';
3
+ export default class AuthUpdate extends Command {
4
+ static args: {};
5
+ static description: string;
6
+ static enableJsonFlag: boolean;
7
+ static examples: string[];
8
+ static flags: {
9
+ organization: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
10
+ token: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
11
+ url: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
12
+ };
13
+ run(): Promise<ApiResult | void>;
14
+ }
@@ -0,0 +1,68 @@
1
+ import { confirm, input } from '@inquirer/prompts';
2
+ import { Command, Flags } from '@oclif/core';
3
+ import { action } from '@oclif/core/ux';
4
+ import { default as fs } from 'fs-extra';
5
+ import { default as path } from 'node:path';
6
+ import { clearClients, testConnection } from '../../../sentry/sentry-client.js';
7
+ export default class AuthUpdate extends Command {
8
+ static args = {};
9
+ static description = 'Update existing authentication';
10
+ static enableJsonFlag = true;
11
+ static examples = ['<%= config.bin %> <%= command.id %>'];
12
+ static flags = {
13
+ organization: Flags.string({ char: 'o', description: 'Sentry organization slug', required: !process.stdout.isTTY }),
14
+ token: Flags.string({ char: 't', description: 'Auth Token', required: !process.stdout.isTTY }),
15
+ url: Flags.string({ char: 'u', description: 'Sentry base URL', required: !process.stdout.isTTY }),
16
+ };
17
+ async run() {
18
+ const { flags } = await this.parse(AuthUpdate);
19
+ const configPath = path.join(this.config.configDir, 'sentry-config.json');
20
+ let config;
21
+ try {
22
+ config = await fs.readJSON(configPath);
23
+ }
24
+ catch (error) {
25
+ const msg = error instanceof Error ? error.message : String(error);
26
+ if (msg.toLowerCase().includes('no such file or directory')) {
27
+ this.log('Run auth:add instead');
28
+ }
29
+ else {
30
+ this.log(msg);
31
+ }
32
+ return;
33
+ }
34
+ const authToken = flags.token ??
35
+ (await input({ default: config.auth.authToken, message: 'Auth Token:', prefill: 'tab', required: true }));
36
+ const organization = flags.organization ??
37
+ (await input({ default: config.auth.organization, message: 'Organization slug:', prefill: 'tab', required: true }));
38
+ const host = flags.url ??
39
+ (await input({ default: config.auth.host, message: 'Sentry base URL:', prefill: 'tab', required: true }));
40
+ const answer = await confirm({ message: 'Override existing config?' });
41
+ if (!answer) {
42
+ return;
43
+ }
44
+ const auth = {
45
+ auth: {
46
+ authToken,
47
+ host,
48
+ organization,
49
+ },
50
+ };
51
+ await fs.writeJSON(configPath, auth, {
52
+ mode: 0o600, // owner read/write only
53
+ });
54
+ action.start('Authenticating');
55
+ config = await fs.readJSON(configPath);
56
+ const result = await testConnection(config.auth);
57
+ clearClients();
58
+ if (result.success) {
59
+ action.stop('✓ successful');
60
+ this.log('Authentication updated successfully');
61
+ }
62
+ else {
63
+ action.stop('✗ failed');
64
+ this.error('Authentication is invalid. Please check your token, organization, and URL.');
65
+ }
66
+ return result;
67
+ }
68
+ }
@@ -0,0 +1,13 @@
1
+ import { Command } from '@oclif/core';
2
+ export default class EventGet extends Command {
3
+ static args: {
4
+ projectSlug: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
5
+ eventId: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
6
+ };
7
+ static description: string;
8
+ static examples: string[];
9
+ static flags: {
10
+ toon: import("@oclif/core/interfaces").BooleanFlag<boolean>;
11
+ };
12
+ run(): Promise<void>;
13
+ }