@debugbundle/cli 1.6.3 → 1.6.4

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 +73 -5
  2. package/package.json +1 -1
package/dist/main.cjs CHANGED
@@ -19375,11 +19375,19 @@ var STORAGE_BOOTSTRAP_STATEMENTS = [
19375
19375
  channel text NOT NULL,
19376
19376
  condition_type text NOT NULL,
19377
19377
  severity_min text,
19378
+ severity_lifecycle_scope text,
19378
19379
  cooldown_seconds integer NOT NULL DEFAULT 0,
19379
19380
  config jsonb NOT NULL DEFAULT '{}'::jsonb,
19380
19381
  is_enabled boolean NOT NULL DEFAULT true,
19381
19382
  created_at timestamptz NOT NULL DEFAULT now(),
19382
- updated_at timestamptz NOT NULL DEFAULT now()
19383
+ updated_at timestamptz NOT NULL DEFAULT now(),
19384
+ CONSTRAINT alert_rules_severity_lifecycle_scope_check CHECK (
19385
+ severity_lifecycle_scope IS NULL
19386
+ OR (
19387
+ condition_type = 'severity_threshold'
19388
+ AND severity_lifecycle_scope IN ('new_incident', 'incident_regressed', 'both')
19389
+ )
19390
+ )
19383
19391
  )
19384
19392
  `,
19385
19393
  `
@@ -20934,6 +20942,36 @@ var STORAGE_SCHEMA_MIGRATIONS = [
20934
20942
  )
20935
20943
  `
20936
20944
  ]
20945
+ }),
20946
+ defineStorageSchemaMigration({
20947
+ id: "202606260001_add_alert_severity_lifecycle_scope",
20948
+ description: "Add lifecycle scope for severity-threshold alert rules so new incidents and regressions can notify independently.",
20949
+ statements: [
20950
+ "ALTER TABLE alert_rules ADD COLUMN IF NOT EXISTS severity_lifecycle_scope text",
20951
+ `
20952
+ UPDATE alert_rules
20953
+ SET severity_lifecycle_scope = 'both'
20954
+ WHERE condition_type = 'severity_threshold'
20955
+ AND severity_lifecycle_scope IS NULL
20956
+ `,
20957
+ `
20958
+ UPDATE alert_rules
20959
+ SET severity_lifecycle_scope = NULL
20960
+ WHERE condition_type <> 'severity_threshold'
20961
+ AND severity_lifecycle_scope IS NOT NULL
20962
+ `,
20963
+ "ALTER TABLE alert_rules DROP CONSTRAINT IF EXISTS alert_rules_severity_lifecycle_scope_check",
20964
+ `
20965
+ ALTER TABLE alert_rules
20966
+ ADD CONSTRAINT alert_rules_severity_lifecycle_scope_check CHECK (
20967
+ severity_lifecycle_scope IS NULL
20968
+ OR (
20969
+ condition_type = 'severity_threshold'
20970
+ AND severity_lifecycle_scope IN ('new_incident', 'incident_regressed', 'both')
20971
+ )
20972
+ )
20973
+ `
20974
+ ]
20937
20975
  })
20938
20976
  ];
20939
20977
 
@@ -22105,6 +22143,7 @@ var AlertConditionTypeSchema = external_exports.enum([
22105
22143
  "severity_threshold",
22106
22144
  "regression_after_deploy"
22107
22145
  ]);
22146
+ var AlertSeverityLifecycleScopeSchema = external_exports.enum(["new_incident", "incident_regressed", "both"]);
22108
22147
  var AlertSchema = external_exports.object({
22109
22148
  alert_id: external_exports.string(),
22110
22149
  project_id: external_exports.string(),
@@ -22113,6 +22152,7 @@ var AlertSchema = external_exports.object({
22113
22152
  channel: AlertChannelSchema,
22114
22153
  condition_type: AlertConditionTypeSchema,
22115
22154
  severity_min: external_exports.enum(["low", "medium", "high", "critical"]).nullable(),
22155
+ severity_lifecycle_scope: AlertSeverityLifecycleScopeSchema.nullable().optional().default(null),
22116
22156
  cooldown_seconds: external_exports.number().int().min(0),
22117
22157
  config: external_exports.record(external_exports.string(), external_exports.unknown()),
22118
22158
  is_enabled: external_exports.boolean(),
@@ -22200,6 +22240,9 @@ function createAlertApi(client) {
22200
22240
  if (input2.severityMin !== void 0) {
22201
22241
  body.severity_min = input2.severityMin;
22202
22242
  }
22243
+ if (input2.severityLifecycleScope !== void 0) {
22244
+ body.severity_lifecycle_scope = input2.severityLifecycleScope;
22245
+ }
22203
22246
  if (input2.cooldownSeconds !== void 0) {
22204
22247
  body.cooldown_seconds = input2.cooldownSeconds;
22205
22248
  }
@@ -22229,6 +22272,9 @@ function createAlertApi(client) {
22229
22272
  if (input2.severityMin !== void 0) {
22230
22273
  body.severity_min = input2.severityMin;
22231
22274
  }
22275
+ if (input2.severityLifecycleScope !== void 0) {
22276
+ body.severity_lifecycle_scope = input2.severityLifecycleScope;
22277
+ }
22232
22278
  if (input2.cooldownSeconds !== void 0) {
22233
22279
  body.cooldown_seconds = input2.cooldownSeconds;
22234
22280
  }
@@ -30726,8 +30772,8 @@ var CLI_USAGE_LINES = [
30726
30772
  " debugbundle token member create --label <label> [--auth-file <path>] [--json]",
30727
30773
  " debugbundle token member revoke <token-id> [--auth-file <path>] [--json]",
30728
30774
  " debugbundle alert list --project-id <id> [--limit <n>] [--auth-file <path>] [--json]",
30729
- " 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]",
30730
- " 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>] [--auth-file <path>] [--json]",
30775
+ " 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]",
30776
+ " debugbundle alert update <alert-id> --project-id <id> [--service-id <id|null>] [--channel <channel>] [--condition <condition>] [--severity-min <level|null>] [--severity-lifecycle-scope <new_incident|incident_regressed|both|null>] [--cooldown <seconds>] [--config-json <json|null>] [--is-enabled <true|false>] [--auth-file <path>] [--json]",
30731
30777
  " debugbundle alert delete <alert-id> --project-id <id> [--auth-file <path>] [--json]",
30732
30778
  " debugbundle slack list --project-id <id> [--auth-file <path>] [--json]",
30733
30779
  " debugbundle slack connect-url --project-id <id> [--return-to </projects/...>] [--auth-file <path>] [--json]",
@@ -35802,6 +35848,9 @@ async function createAlertCommand(input2, api) {
35802
35848
  if (input2.severityMin !== void 0) {
35803
35849
  requestInput.severityMin = input2.severityMin;
35804
35850
  }
35851
+ if (input2.severityLifecycleScope !== void 0) {
35852
+ requestInput.severityLifecycleScope = input2.severityLifecycleScope;
35853
+ }
35805
35854
  if (input2.cooldownSeconds !== void 0) {
35806
35855
  requestInput.cooldownSeconds = input2.cooldownSeconds;
35807
35856
  }
@@ -35835,6 +35884,9 @@ async function createAlertWithAuthCommand(input2, dependencies) {
35835
35884
  if (input2.severityMin !== void 0) {
35836
35885
  commandInput.severityMin = input2.severityMin;
35837
35886
  }
35887
+ if (input2.severityLifecycleScope !== void 0) {
35888
+ commandInput.severityLifecycleScope = input2.severityLifecycleScope;
35889
+ }
35838
35890
  if (input2.cooldownSeconds !== void 0) {
35839
35891
  commandInput.cooldownSeconds = input2.cooldownSeconds;
35840
35892
  }
@@ -35869,6 +35921,9 @@ async function updateAlertCommand(input2, api) {
35869
35921
  if (input2.severityMin !== void 0) {
35870
35922
  requestInput.severityMin = input2.severityMin;
35871
35923
  }
35924
+ if (input2.severityLifecycleScope !== void 0) {
35925
+ requestInput.severityLifecycleScope = input2.severityLifecycleScope;
35926
+ }
35872
35927
  if (input2.cooldownSeconds !== void 0) {
35873
35928
  requestInput.cooldownSeconds = input2.cooldownSeconds;
35874
35929
  }
@@ -35909,6 +35964,9 @@ async function updateAlertWithAuthCommand(input2, dependencies) {
35909
35964
  if (input2.severityMin !== void 0) {
35910
35965
  commandInput.severityMin = input2.severityMin;
35911
35966
  }
35967
+ if (input2.severityLifecycleScope !== void 0) {
35968
+ commandInput.severityLifecycleScope = input2.severityLifecycleScope;
35969
+ }
35912
35970
  if (input2.cooldownSeconds !== void 0) {
35913
35971
  commandInput.cooldownSeconds = input2.cooldownSeconds;
35914
35972
  }
@@ -36834,6 +36892,7 @@ async function handleAlertCommand(parsedArgv, dependencies) {
36834
36892
  "channel",
36835
36893
  "condition",
36836
36894
  "severity-min",
36895
+ "severity-lifecycle-scope",
36837
36896
  "cooldown",
36838
36897
  "config-json",
36839
36898
  "is-enabled"
@@ -36864,6 +36923,10 @@ async function handleAlertCommand(parsedArgv, dependencies) {
36864
36923
  if (severityMin !== void 0) {
36865
36924
  input2.severityMin = severityMin;
36866
36925
  }
36926
+ const severityLifecycleScope = readStringOption(parsedArgv, "severity-lifecycle-scope");
36927
+ if (severityLifecycleScope !== void 0) {
36928
+ input2.severityLifecycleScope = severityLifecycleScope;
36929
+ }
36867
36930
  const cooldownSeconds = readIntegerOption(parsedArgv, "cooldown");
36868
36931
  if (cooldownSeconds !== void 0) {
36869
36932
  input2.cooldownSeconds = cooldownSeconds;
@@ -36888,6 +36951,7 @@ async function handleAlertCommand(parsedArgv, dependencies) {
36888
36951
  "channel",
36889
36952
  "condition",
36890
36953
  "severity-min",
36954
+ "severity-lifecycle-scope",
36891
36955
  "cooldown",
36892
36956
  "config-json",
36893
36957
  "is-enabled"
@@ -36917,6 +36981,10 @@ async function handleAlertCommand(parsedArgv, dependencies) {
36917
36981
  if (severityMin !== void 0) {
36918
36982
  input2.severityMin = severityMin === "null" ? null : severityMin;
36919
36983
  }
36984
+ const severityLifecycleScope = readStringOption(parsedArgv, "severity-lifecycle-scope");
36985
+ if (severityLifecycleScope !== void 0) {
36986
+ input2.severityLifecycleScope = severityLifecycleScope === "null" ? null : severityLifecycleScope;
36987
+ }
36920
36988
  const cooldownSeconds = readIntegerOption(parsedArgv, "cooldown");
36921
36989
  if (cooldownSeconds !== void 0) {
36922
36990
  input2.cooldownSeconds = cooldownSeconds;
@@ -36929,7 +36997,7 @@ async function handleAlertCommand(parsedArgv, dependencies) {
36929
36997
  if (isEnabled !== void 0) {
36930
36998
  input2.isEnabled = isEnabled;
36931
36999
  }
36932
- if (input2.serviceId === void 0 && input2.channel === void 0 && input2.conditionType === void 0 && input2.severityMin === void 0 && input2.cooldownSeconds === void 0 && input2.config === void 0 && input2.isEnabled === void 0) {
37000
+ if (input2.serviceId === void 0 && input2.channel === void 0 && input2.conditionType === void 0 && input2.severityMin === void 0 && input2.severityLifecycleScope === void 0 && input2.cooldownSeconds === void 0 && input2.config === void 0 && input2.isEnabled === void 0) {
36933
37001
  throw new CliInputError("At least one alert field must be provided.");
36934
37002
  }
36935
37003
  return await (dependencies.updateAlertCommand ?? updateAlertWithAuthCommand)(input2);
@@ -37187,7 +37255,7 @@ async function handleCaptureRuleCommand2(parsedArgv, dependencies) {
37187
37255
  // package.json
37188
37256
  var package_default = {
37189
37257
  name: "@debugbundle/cli",
37190
- version: "1.6.3",
37258
+ version: "1.6.4",
37191
37259
  private: false,
37192
37260
  description: "Command-line interface for DebugBundle",
37193
37261
  license: "AGPL-3.0-only",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@debugbundle/cli",
3
- "version": "1.6.3",
3
+ "version": "1.6.4",
4
4
  "private": false,
5
5
  "description": "Command-line interface for DebugBundle",
6
6
  "license": "AGPL-3.0-only",