vibeview 0.29.0 → 0.31.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.
@@ -74,6 +74,25 @@ var AuthError = class extends Error {
74
74
  this.name = "AuthError";
75
75
  }
76
76
  };
77
+ var TokenScopeError = class extends AuthError {
78
+ constructor(message) {
79
+ super(message);
80
+ this.name = "TokenScopeError";
81
+ }
82
+ };
83
+ var SCOPE_REFUSAL_PREFIX = "This API token has the 'ci' scope";
84
+ function credentialError(status, text) {
85
+ const detail = extractDetail(text);
86
+ if (status === 401) {
87
+ return detail && /expired/i.test(detail) ? new AuthError(detail) : new AuthError();
88
+ }
89
+ if (status === 403 && detail?.startsWith(SCOPE_REFUSAL_PREFIX)) {
90
+ return new TokenScopeError(
91
+ `${detail} Set VIBEVIEW_API_TOKEN (or --token) to a full-access token for this command.`
92
+ );
93
+ }
94
+ return void 0;
95
+ }
77
96
  function errorExitCode(err, otherwise = 1) {
78
97
  return err instanceof AuthError ? 2 : otherwise;
79
98
  }
@@ -168,7 +187,8 @@ var ApiClient = class {
168
187
  });
169
188
  if (!resp.ok) {
170
189
  const text = await resp.text().catch(() => "");
171
- if (resp.status === 401) throw new AuthError();
190
+ const credErr = credentialError(resp.status, text);
191
+ if (credErr) throw credErr;
172
192
  if (resp.status === 404) throw new NotFoundError(`Not found: ${extractDetail(text) ?? path}`);
173
193
  throw new ApiStatusError(
174
194
  resp.status,
@@ -197,7 +217,9 @@ var ApiClient = class {
197
217
  device_category: options?.device ? void 0 : options?.deviceCategory,
198
218
  device_id: options?.device,
199
219
  build_id: options?.build,
200
- metadata: options?.metadata
220
+ metadata: options?.metadata,
221
+ platform: options?.platform,
222
+ app_id: options?.app
201
223
  });
202
224
  }
203
225
  async runTest(testId, options) {
@@ -210,7 +232,9 @@ var ApiClient = class {
210
232
  device_category: options?.device ? void 0 : options?.deviceCategory,
211
233
  device_id: options?.device,
212
234
  build_id: options?.build,
213
- metadata: options?.metadata
235
+ metadata: options?.metadata,
236
+ platform: options?.platform,
237
+ app_id: options?.app
214
238
  });
215
239
  }
216
240
  /** Cancel a still-queued CI run by its queue entry id. Idempotent best-effort. */
@@ -244,7 +268,8 @@ var ApiClient = class {
244
268
  });
245
269
  if (!resp.ok) {
246
270
  const text = await resp.text().catch(() => "");
247
- if (resp.status === 401) throw new AuthError();
271
+ const credErr = credentialError(resp.status, text);
272
+ if (credErr) throw credErr;
248
273
  if (resp.status === 404) throw new NotFoundError(`Not found: ${extractDetail(text) ?? path}`);
249
274
  throw new ApiStatusError(
250
275
  resp.status,
@@ -267,7 +292,8 @@ var ApiClient = class {
267
292
  });
268
293
  if (!resp.ok) {
269
294
  const text = await resp.text().catch(() => "");
270
- if (resp.status === 401) throw new AuthError();
295
+ const credErr = credentialError(resp.status, text);
296
+ if (credErr) throw credErr;
271
297
  if (resp.status === 404) throw new NotFoundError(`Not found: ${extractDetail(text) ?? path}`);
272
298
  throw new ApiStatusError(
273
299
  resp.status,
@@ -429,7 +455,8 @@ var ApiClient = class {
429
455
  const resp = await this.fetchOrExplain(url, { method: "GET", headers });
430
456
  if (!resp.ok) {
431
457
  const text = await resp.text().catch(() => "");
432
- if (resp.status === 401) throw new AuthError();
458
+ const credErr = credentialError(resp.status, text);
459
+ if (credErr) throw credErr;
433
460
  if (resp.status === 404)
434
461
  throw new NotFoundError(`Not found: ${extractDetail(text) ?? `/builds/${id}/artifact`}`);
435
462
  throw new ApiStatusError(