@debugbundle/cli 1.19.4 → 1.20.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 (2) hide show
  1. package/dist/main.cjs +52 -11
  2. package/package.json +1 -1
package/dist/main.cjs CHANGED
@@ -54373,6 +54373,25 @@ var PublicStatusOptionsSchema = external_exports.object({
54373
54373
  next_cursor: external_exports.string().guid().nullable()
54374
54374
  }).strict();
54375
54375
 
54376
+ // ../../packages/shared-types/src/alert-scope.ts
54377
+ var ALERT_SCOPE_SERVICE_LIMIT = 100;
54378
+ var ScopeServiceSchema = external_exports.object({
54379
+ service_definition_id: external_exports.string().guid(),
54380
+ name: external_exports.string().min(1)
54381
+ }).strict();
54382
+ var AlertScopeSchema = external_exports.object({
54383
+ origin_project_ids: external_exports.array(external_exports.string().guid()).min(1).max(1e3),
54384
+ covers_current_project: external_exports.boolean(),
54385
+ services: external_exports.array(ScopeServiceSchema).max(ALERT_SCOPE_SERVICE_LIMIT),
54386
+ service_count: external_exports.number().int().min(0),
54387
+ service_filter: ScopeServiceSchema.extend({
54388
+ service_id: external_exports.string().guid(),
54389
+ environment: external_exports.string().min(1)
54390
+ }).nullable()
54391
+ }).strict().refine((scope) => scope.service_count >= scope.services.length, {
54392
+ message: "scope_service_count_invalid"
54393
+ });
54394
+
54376
54395
  // ../../packages/shared-types/src/index.ts
54377
54396
  var SeveritySchema = external_exports.enum(["low", "medium", "high", "critical"]);
54378
54397
  var BundleSdkSchema = external_exports.object({
@@ -55475,7 +55494,8 @@ var AlertSchema = external_exports.object({
55475
55494
  signing_secret: external_exports.string().optional(),
55476
55495
  is_enabled: external_exports.boolean(),
55477
55496
  created_at: external_exports.string(),
55478
- updated_at: external_exports.string()
55497
+ updated_at: external_exports.string(),
55498
+ scope: AlertScopeSchema.nullable().optional()
55479
55499
  }).strict();
55480
55500
  var AlertListResponseSchema = external_exports.object({
55481
55501
  alerts: external_exports.array(AlertSchema.omit({ signing_secret: true }).strict())
@@ -55528,6 +55548,10 @@ function parseApiError3(status, body) {
55528
55548
  }
55529
55549
  throw new AlertApiError(status, parsed.data.error);
55530
55550
  }
55551
+ function shouldRetryWithoutAlertScope(status, body) {
55552
+ const error62 = ApiErrorResponseSchema3.safeParse(body);
55553
+ return status === 400 && error62.success && error62.data.error === "invalid_query";
55554
+ }
55531
55555
  function buildQuery(input3) {
55532
55556
  const params = new URLSearchParams();
55533
55557
  for (const [key, value] of Object.entries(input3)) {
@@ -55563,13 +55587,20 @@ async function expectAlert(responsePromise) {
55563
55587
  function createAlertApi(client) {
55564
55588
  return {
55565
55589
  async listAlerts(input3) {
55566
- return expectAlertList(
55567
- client.request({
55590
+ const query = { project_id: input3.projectId, limit: input3.limit };
55591
+ let response = await client.request({
55592
+ method: "GET",
55593
+ path: `/v1/alerts${buildQuery({ ...query, ...input3.includeScope === true ? { include_scope: "true" } : {} })}`,
55594
+ bearerToken: input3.bearerToken
55595
+ });
55596
+ if (input3.includeScope === true && shouldRetryWithoutAlertScope(response.status, response.body)) {
55597
+ response = await client.request({
55568
55598
  method: "GET",
55569
- path: `/v1/alerts${buildQuery({ project_id: input3.projectId, limit: input3.limit })}`,
55599
+ path: `/v1/alerts${buildQuery(query)}`,
55570
55600
  bearerToken: input3.bearerToken
55571
- })
55572
- );
55601
+ });
55602
+ }
55603
+ return expectAlertList(Promise.resolve(response));
55573
55604
  },
55574
55605
  async listAlertGroups(input3) {
55575
55606
  const response = await client.request({
@@ -58529,7 +58560,7 @@ function buildSkill() {
58529
58560
  "",
58530
58561
  "When notification or automation delivery is the reported failure, inspect configuration and delivery records before changing incident logic.",
58531
58562
  "",
58532
- "- Alerts route incident notifications to configured channels. Start with `debugbundle alert list --project-id <id> --json` and confirm condition, severity, service, cooldown, channel, and enabled state.",
58563
+ "- Alerts route incident notifications to configured channels. Start with `debugbundle alert list --project-id <id> --include-scope true --json` and confirm saved scope, selected service/environment, condition, severity, cooldown, channel, and enabled state.",
58533
58564
  "- Webhooks deliver signed lifecycle events to external systems. Start with `debugbundle webhook list --project-id <id> --json`, then inspect `debugbundle webhook deliveries <webhook-id> --project-id <id> --json` before retrying or testing.",
58534
58565
  "- Webhook tests and retries are side-effecting delivery actions. Use them only when validating a destination or replaying an explicit failed delivery.",
58535
58566
  "",
@@ -58649,7 +58680,7 @@ function buildCliReference() {
58649
58680
  "",
58650
58681
  "## Notifications",
58651
58682
  "",
58652
- "- `debugbundle alert list --project-id <id> [--limit <n>] [--auth-file <path>] [--json]`",
58683
+ "- `debugbundle alert list --project-id <id> [--limit <n>] [--include-scope <true|false>] [--auth-file <path>] [--json]`",
58653
58684
  "- `debugbundle alert groups --project-id <id> [--limit <n>] [--cursor <cursor>] [--auth-file <path>] [--json]` lists safe alert delivery and email digest groups; `debugbundle alert group <direct|email_digest> <group-id> --project-id <id> [--cursor <cursor>] --json` pages their incident IDs.",
58654
58685
  "- `debugbundle alert create --project-id <id> --channel <channel> --condition <condition> [--service-id <id>] [--severity-min <level>] [--cooldown <seconds>] --config-json <json> [--is-enabled <true|false>] [--auth-file <path>] [--json]`",
58655
58686
  "- `debugbundle alert update <alert-id> --project-id <id> [--service-id <id|null>] [--channel <channel>] [--condition <condition>] [--severity-min <level|null>] [--cooldown <seconds>] [--config-json <json|null>] [--is-enabled <true|false>] [--project-scope current_project] [--auth-file <path>] [--json]`",
@@ -73283,7 +73314,7 @@ var CLI_USAGE_LINES = [
73283
73314
  " debugbundle token member list [--limit <n>] [--auth-file <path>] [--json]",
73284
73315
  " debugbundle token member create --label <label> [--auth-file <path>] [--json]",
73285
73316
  " debugbundle token member revoke <token-id> [--auth-file <path>] [--json]",
73286
- " debugbundle alert list --project-id <id> [--limit <n>] [--auth-file <path>] [--json]",
73317
+ " debugbundle alert list --project-id <id> [--limit <n>] [--include-scope <true|false>] [--auth-file <path>] [--json]",
73287
73318
  " debugbundle alert groups --project-id <id> [--limit <n>] [--cursor <cursor>] [--auth-file <path>] [--json]",
73288
73319
  " debugbundle alert group <direct|email_digest> <group-id> --project-id <id> [--limit <n>] [--cursor <cursor>] [--auth-file <path>] [--json]",
73289
73320
  " debugbundle alert create --project-id <id> --channel <channel> --condition <condition> [--service-id <id>] [--severity-min <level>] [--severity-lifecycle-scope <new_incident|incident_regressed|both>] [--cooldown <seconds>] --config-json <json> [--is-enabled <true|false>] [--auth-file <path>] [--json]",
@@ -80868,6 +80899,7 @@ async function listAlertsCommand(input3, api) {
80868
80899
  if (input3.limit !== void 0) {
80869
80900
  requestInput.limit = input3.limit;
80870
80901
  }
80902
+ if (input3.includeScope !== void 0) requestInput.includeScope = input3.includeScope;
80871
80903
  const alerts = await api.listAlerts(requestInput);
80872
80904
  return {
80873
80905
  exitCode: 0,
@@ -80892,6 +80924,7 @@ async function listAlertsWithAuthCommand(input3, dependencies) {
80892
80924
  if (input3.limit !== void 0) {
80893
80925
  commandInput.limit = input3.limit;
80894
80926
  }
80927
+ if (input3.includeScope !== void 0) commandInput.includeScope = input3.includeScope;
80895
80928
  if (input3.json !== void 0) {
80896
80929
  commandInput.json = input3.json;
80897
80930
  }
@@ -82104,7 +82137,13 @@ async function handleAlertCommand(parsedArgv, dependencies) {
82104
82137
  );
82105
82138
  }
82106
82139
  if (action === "list") {
82107
- expectNoUnknownOptions(parsedArgv, ["auth-file", "json", "project-id", "limit"]);
82140
+ expectNoUnknownOptions(parsedArgv, [
82141
+ "auth-file",
82142
+ "json",
82143
+ "project-id",
82144
+ "limit",
82145
+ "include-scope"
82146
+ ]);
82108
82147
  ensureNoExtraPositionals(parsedArgv, 2);
82109
82148
  const projectId = readStringOption(parsedArgv, "project-id");
82110
82149
  if (projectId === void 0) {
@@ -82117,6 +82156,8 @@ async function handleAlertCommand(parsedArgv, dependencies) {
82117
82156
  if (limit !== void 0) {
82118
82157
  input3.limit = limit;
82119
82158
  }
82159
+ const includeScope = readBooleanStringOption(parsedArgv, "include-scope");
82160
+ if (includeScope !== void 0) input3.includeScope = includeScope;
82120
82161
  return await (dependencies.listAlertsCommand ?? listAlertsWithAuthCommand)(input3);
82121
82162
  }
82122
82163
  if (action === "create") {
@@ -82518,7 +82559,7 @@ async function handleCaptureRuleCommand2(parsedArgv, dependencies) {
82518
82559
  // package.json
82519
82560
  var package_default = {
82520
82561
  name: "@debugbundle/cli",
82521
- version: "1.19.4",
82562
+ version: "1.20.0",
82522
82563
  private: false,
82523
82564
  description: "Command-line interface for DebugBundle",
82524
82565
  license: "Apache-2.0",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@debugbundle/cli",
3
- "version": "1.19.4",
3
+ "version": "1.20.0",
4
4
  "private": false,
5
5
  "description": "Command-line interface for DebugBundle",
6
6
  "license": "Apache-2.0",