@debugbundle/cli 1.5.3 → 1.6.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 +238 -21
  2. package/package.json +1 -1
package/dist/main.cjs CHANGED
@@ -15312,6 +15312,8 @@ var CaptureRuleSuggestionSchema = external_exports.object({
15312
15312
  confidence: CaptureRuleSuggestionConfidenceSchema,
15313
15313
  reason: external_exports.string().min(1).max(500),
15314
15314
  requires_confirmation: external_exports.boolean(),
15315
+ created_rule_id: external_exports.string().min(1).max(120).nullable().default(null),
15316
+ created_rule_enabled: external_exports.boolean().nullable().default(null),
15315
15317
  rule: CaptureRuleCreateSchema
15316
15318
  });
15317
15319
  var CaptureRuleSuggestionsResponseSchema = external_exports.object({
@@ -15405,11 +15407,16 @@ var ServiceSchema = external_exports.object({
15405
15407
  environment: external_exports.string().min(1)
15406
15408
  });
15407
15409
  var CorrelationSchema = external_exports.object({
15408
- request_id: external_exports.string().nullable(),
15409
- trace_id: external_exports.string().nullable(),
15410
- session_id: external_exports.string().nullable(),
15411
- user_id_hash: external_exports.string().nullable()
15412
- }).strict();
15410
+ request_id: external_exports.string().nullable().optional(),
15411
+ trace_id: external_exports.string().nullable().optional(),
15412
+ session_id: external_exports.string().nullable().optional(),
15413
+ user_id_hash: external_exports.string().nullable().optional()
15414
+ }).strict().transform((value) => ({
15415
+ request_id: value.request_id ?? null,
15416
+ trace_id: value.trace_id ?? null,
15417
+ session_id: value.session_id ?? null,
15418
+ user_id_hash: value.user_id_hash ?? null
15419
+ }));
15413
15420
  var InlineProbeDataItemSchema = external_exports.object({
15414
15421
  label: external_exports.string().min(1),
15415
15422
  data: external_exports.record(external_exports.string(), external_exports.unknown()),
@@ -15589,7 +15596,8 @@ var EnvelopeBaseSchema = external_exports.object({
15589
15596
  sdk_version: external_exports.string().min(1),
15590
15597
  service: ServiceSchema,
15591
15598
  occurred_at: external_exports.string().datetime(),
15592
- correlation: CorrelationSchema.optional()
15599
+ correlation: CorrelationSchema.optional(),
15600
+ context: external_exports.record(external_exports.string(), external_exports.unknown()).optional()
15593
15601
  }).strict();
15594
15602
  var EventEnvelopeSchema = external_exports.discriminatedUnion("event_type", [
15595
15603
  EnvelopeBaseSchema.extend({ event_type: external_exports.literal("backend_exception"), payload: BackendExceptionPayloadSchema }),
@@ -15618,6 +15626,7 @@ function createEventEnvelope(input2) {
15618
15626
  session_id: null,
15619
15627
  user_id_hash: null
15620
15628
  },
15629
+ context: input2.context,
15621
15630
  payload: input2.payload
15622
15631
  };
15623
15632
  return EventEnvelopeSchema.parse(candidate);
@@ -17143,6 +17152,9 @@ function createRetrievalApi(client) {
17143
17152
  if (input2.firstSeenAfter !== void 0) {
17144
17153
  query.set("first_seen_after", input2.firstSeenAfter);
17145
17154
  }
17155
+ if (input2.attentionAfter !== void 0) {
17156
+ query.set("attention_after", input2.attentionAfter);
17157
+ }
17146
17158
  if (input2.cursor !== void 0) {
17147
17159
  query.set("cursor", input2.cursor);
17148
17160
  }
@@ -17899,6 +17911,167 @@ function redact(payload, options) {
17899
17911
 
17900
17912
  // ../../packages/event-normalizer/src/index.ts
17901
17913
  var FINGERPRINT_VERSION = "v1";
17914
+ var PAYLOAD_ALLOWED_KEYS = {
17915
+ backend_exception: /* @__PURE__ */ new Set(["name", "message", "stack", "handled", "request", "response", "runtime", "probe_data"]),
17916
+ request_event: /* @__PURE__ */ new Set([
17917
+ "method",
17918
+ "path",
17919
+ "query",
17920
+ "headers",
17921
+ "body",
17922
+ "response_status",
17923
+ "duration_ms",
17924
+ "route_template",
17925
+ "response_headers",
17926
+ "response_body"
17927
+ ]),
17928
+ log_event: /* @__PURE__ */ new Set(["level", "message", "attributes"]),
17929
+ frontend_breadcrumb: /* @__PURE__ */ new Set(["breadcrumb_type", "route", "data"]),
17930
+ frontend_exception: /* @__PURE__ */ new Set([
17931
+ "name",
17932
+ "message",
17933
+ "stack",
17934
+ "route",
17935
+ "browser",
17936
+ "breadcrumbs",
17937
+ "device",
17938
+ "browser_event",
17939
+ "rejection_reason",
17940
+ "dom_context",
17941
+ "probe_data"
17942
+ ]),
17943
+ deploy_metadata: /* @__PURE__ */ new Set(["commit_sha", "version", "branch", "environment", "deployed_at"]),
17944
+ error_suppressed: /* @__PURE__ */ new Set(["fingerprint", "suppressed_count", "window_seconds", "first_seen", "last_seen"]),
17945
+ probe_event: /* @__PURE__ */ new Set(["label", "data", "activation_id", "probe_label_pattern"])
17946
+ };
17947
+ function isRecord3(candidate) {
17948
+ return typeof candidate === "object" && candidate !== null && !Array.isArray(candidate);
17949
+ }
17950
+ function cloneRecord(candidate) {
17951
+ return { ...candidate };
17952
+ }
17953
+ function readString2(candidate) {
17954
+ if (typeof candidate === "string") {
17955
+ return candidate;
17956
+ }
17957
+ if (typeof candidate === "number" || typeof candidate === "boolean") {
17958
+ return String(candidate);
17959
+ }
17960
+ return null;
17961
+ }
17962
+ function readNonNegativeNumber(candidate, fallback) {
17963
+ if (typeof candidate === "number" && Number.isFinite(candidate) && candidate >= 0) {
17964
+ return candidate;
17965
+ }
17966
+ if (typeof candidate === "string" && candidate.trim().length > 0) {
17967
+ const parsed = Number(candidate);
17968
+ if (Number.isFinite(parsed) && parsed >= 0) {
17969
+ return parsed;
17970
+ }
17971
+ }
17972
+ return fallback;
17973
+ }
17974
+ function normalizeMap(candidate) {
17975
+ return isRecord3(candidate) ? cloneRecord(candidate) : {};
17976
+ }
17977
+ function mergeContext(baseContext, incomingContext) {
17978
+ if (!isRecord3(incomingContext)) {
17979
+ return baseContext;
17980
+ }
17981
+ return {
17982
+ ...baseContext,
17983
+ ...incomingContext
17984
+ };
17985
+ }
17986
+ function normalizeCorrelation(candidate) {
17987
+ if (!isRecord3(candidate)) {
17988
+ return void 0;
17989
+ }
17990
+ return {
17991
+ request_id: readString2(candidate["request_id"]),
17992
+ trace_id: readString2(candidate["trace_id"]),
17993
+ session_id: readString2(candidate["session_id"]),
17994
+ user_id_hash: readString2(candidate["user_id_hash"])
17995
+ };
17996
+ }
17997
+ function normalizeBackendExceptionPayload(payload) {
17998
+ const request = normalizeMap(payload["request"]);
17999
+ payload["request"] = {
18000
+ method: readString2(request["method"]) ?? "UNKNOWN",
18001
+ path: readString2(request["path"]) ?? "/",
18002
+ query: normalizeMap(request["query"]),
18003
+ headers: normalizeMap(request["headers"]),
18004
+ ..."body" in request ? { body: request["body"] ?? null } : {}
18005
+ };
18006
+ const response = normalizeMap(payload["response"]);
18007
+ payload["response"] = {
18008
+ status_code: readNonNegativeNumber(response["status_code"], 0),
18009
+ ..."headers" in response ? { headers: normalizeMap(response["headers"]) } : {},
18010
+ ..."body" in response ? { body: response["body"] } : {}
18011
+ };
18012
+ }
18013
+ function normalizeRequestEventPayload(payload) {
18014
+ payload["query"] = normalizeMap(payload["query"]);
18015
+ payload["headers"] = normalizeMap(payload["headers"]);
18016
+ payload["response_status"] = readNonNegativeNumber(payload["response_status"], 0);
18017
+ payload["duration_ms"] = readNonNegativeNumber(payload["duration_ms"], 0);
18018
+ }
18019
+ function normalizePayloadExtras(input2) {
18020
+ const allowedKeys = PAYLOAD_ALLOWED_KEYS[input2.eventType];
18021
+ if (allowedKeys === void 0) {
18022
+ return input2.context;
18023
+ }
18024
+ let context = input2.context;
18025
+ for (const key of Object.keys(input2.payload)) {
18026
+ if (allowedKeys.has(key)) {
18027
+ continue;
18028
+ }
18029
+ context = mergeContext(context, { [key]: input2.payload[key] });
18030
+ delete input2.payload[key];
18031
+ }
18032
+ return context;
18033
+ }
18034
+ function normalizeCompatibleEventCandidate(candidate) {
18035
+ if (!isRecord3(candidate)) {
18036
+ return candidate;
18037
+ }
18038
+ const event = cloneRecord(candidate);
18039
+ const eventType = typeof event["event_type"] === "string" ? event["event_type"] : "";
18040
+ let context = normalizeMap(event["context"]);
18041
+ if (typeof event["sdk_language"] === "string") {
18042
+ context = mergeContext(context, { sdk_language: event["sdk_language"] });
18043
+ delete event["sdk_language"];
18044
+ }
18045
+ const correlation = normalizeCorrelation(event["correlation"]);
18046
+ if (correlation !== void 0) {
18047
+ event["correlation"] = correlation;
18048
+ }
18049
+ if (isRecord3(event["payload"])) {
18050
+ const payload = cloneRecord(event["payload"]);
18051
+ context = mergeContext(context, payload["context"]);
18052
+ delete payload["context"];
18053
+ if (eventType === "backend_exception") {
18054
+ normalizeBackendExceptionPayload(payload);
18055
+ }
18056
+ if (eventType === "request_event") {
18057
+ const attributes = isRecord3(payload["attributes"]) ? payload["attributes"] : null;
18058
+ if (typeof payload["route_template"] !== "string" && typeof attributes?.["route_template"] === "string") {
18059
+ payload["route_template"] = attributes["route_template"];
18060
+ }
18061
+ context = mergeContext(context, attributes);
18062
+ delete payload["attributes"];
18063
+ normalizeRequestEventPayload(payload);
18064
+ }
18065
+ context = normalizePayloadExtras({ eventType, payload, context });
18066
+ event["payload"] = payload;
18067
+ }
18068
+ if (Object.keys(context).length > 0) {
18069
+ event["context"] = context;
18070
+ } else {
18071
+ delete event["context"];
18072
+ }
18073
+ return event;
18074
+ }
17902
18075
  function inferMatchedFields(event) {
17903
18076
  const matchedFields = ["environment", "normalized_message"];
17904
18077
  if (event.error_type !== null) {
@@ -18143,7 +18316,7 @@ function stableJson(value) {
18143
18316
  return `{${pairs.join(",")}}`;
18144
18317
  }
18145
18318
  function validateEvent(candidate) {
18146
- return EventEnvelopeSchema.safeParse(candidate);
18319
+ return EventEnvelopeSchema.safeParse(normalizeCompatibleEventCandidate(candidate));
18147
18320
  }
18148
18321
  function normalizeEvent(event) {
18149
18322
  const redactedPayload = redact(event.payload).redacted;
@@ -20805,9 +20978,13 @@ function parseLocalIncident(candidate) {
20805
20978
  throw createReadError(400, "invalid_local_state");
20806
20979
  }
20807
20980
  const resolvedAt = candidate["resolved_at"];
20981
+ const regressedAt = candidate["regressed_at"];
20808
20982
  if (resolvedAt !== void 0 && resolvedAt !== null && typeof resolvedAt !== "string") {
20809
20983
  throw createReadError(400, "invalid_local_state");
20810
20984
  }
20985
+ if (regressedAt !== void 0 && regressedAt !== null && typeof regressedAt !== "string") {
20986
+ throw createReadError(400, "invalid_local_state");
20987
+ }
20811
20988
  if (typeof candidate["occurrence_count"] !== "number" || typeof candidate["generation_number"] !== "number") {
20812
20989
  throw createReadError(400, "invalid_local_state");
20813
20990
  }
@@ -20842,6 +21019,7 @@ function parseLocalIncident(candidate) {
20842
21019
  severity: candidate["severity"],
20843
21020
  status: candidate["status"],
20844
21021
  ...resolvedAt === void 0 ? {} : { resolved_at: resolvedAt },
21022
+ ...regressedAt === void 0 ? {} : { regressed_at: regressedAt },
20845
21023
  first_seen_at: candidate["first_seen_at"],
20846
21024
  last_seen_at: candidate["last_seen_at"],
20847
21025
  occurrence_count: candidate["occurrence_count"],
@@ -20947,7 +21125,12 @@ async function listLocalIncidents(input2, dependencies) {
20947
21125
  return incident.status === "open";
20948
21126
  }
20949
21127
  return incident.status === input2.status;
20950
- }).filter((incident) => input2.severity === void 0 ? true : incident.severity === input2.severity).filter((incident) => input2.firstSeenAfter === void 0 ? true : incident.first_seen_at >= input2.firstSeenAfter).sort(sortIncidentsDescending);
21128
+ }).filter((incident) => input2.severity === void 0 ? true : incident.severity === input2.severity).filter((incident) => input2.firstSeenAfter === void 0 ? true : incident.first_seen_at >= input2.firstSeenAfter).filter((incident) => {
21129
+ if (input2.attentionAfter === void 0) {
21130
+ return true;
21131
+ }
21132
+ return incident.first_seen_at >= input2.attentionAfter || incident.regressed_at != null && incident.regressed_at >= input2.attentionAfter;
21133
+ }).sort(sortIncidentsDescending);
20951
21134
  const startIndex = input2.cursor === void 0 ? 0 : incidents.findIndex((incident) => buildCursor(incident) === input2.cursor) + 1;
20952
21135
  const pagedIncidents = input2.limit === void 0 ? incidents.slice(startIndex) : incidents.slice(startIndex, startIndex + input2.limit);
20953
21136
  const hasMore = input2.limit !== void 0 && startIndex + input2.limit < incidents.length;
@@ -25138,6 +25321,26 @@ function selectPrimarySignalEnvelope(envelopes, sourceEventId) {
25138
25321
  (envelope) => envelope.event_type === "backend_exception" || envelope.event_type === "frontend_exception" || envelope.event_type === "request_event"
25139
25322
  ) ?? null;
25140
25323
  }
25324
+ function deriveBundleSdk(envelopes, sourceEventId) {
25325
+ const sourceEnvelope = envelopes.find((envelope) => envelope.event_id === sourceEventId);
25326
+ if (sourceEnvelope !== void 0) {
25327
+ return {
25328
+ name: sourceEnvelope.sdk_name,
25329
+ version: sourceEnvelope.sdk_version
25330
+ };
25331
+ }
25332
+ const latestCapturedEnvelope = selectLatestEnvelope(envelopes, (envelope) => envelope.event_type !== "probe_event");
25333
+ if (latestCapturedEnvelope !== null) {
25334
+ return {
25335
+ name: latestCapturedEnvelope.sdk_name,
25336
+ version: latestCapturedEnvelope.sdk_version
25337
+ };
25338
+ }
25339
+ return {
25340
+ name: "unknown",
25341
+ version: "unknown"
25342
+ };
25343
+ }
25141
25344
  function mapSignalType(eventType) {
25142
25345
  if (eventType === "request_event") {
25143
25346
  return "request_failure";
@@ -25755,6 +25958,7 @@ function buildBundle(input2) {
25755
25958
  const firstSeenAt = new Date(input2.incident.first_seen_at).toISOString();
25756
25959
  const lastSeenAt = new Date(input2.incident.last_seen_at).toISOString();
25757
25960
  const capturedAt = primarySignalEnvelope !== null ? toIsoTimestamp(primarySignalEnvelope.occurred_at) : toIsoTimestamp(input2.bundleMetadata.source_occurred_at);
25961
+ const bundleSdk = deriveBundleSdk(sourceEnvelopes, input2.bundleMetadata.source_event_id);
25758
25962
  const serviceRuntime = input2.incident.service_runtime ?? selectLatestEnvelope(sourceEnvelopes, (envelope) => envelope.event_type !== "probe_event")?.service.runtime ?? null;
25759
25963
  const serviceFramework = input2.incident.service_framework ?? selectLatestEnvelope(sourceEnvelopes, (envelope) => envelope.event_type !== "probe_event")?.service.framework ?? null;
25760
25964
  const customerVisible = frontendContext !== null;
@@ -25773,10 +25977,7 @@ function buildBundle(input2) {
25773
25977
  bundle_id: `bnd_${input2.incident.incident_id}`,
25774
25978
  bundle_type: "failure",
25775
25979
  captured_at: capturedAt,
25776
- sdk: {
25777
- name: "debugbundle-worker",
25778
- version: "0.1.0"
25779
- },
25980
+ sdk: bundleSdk,
25780
25981
  project: {
25781
25982
  id: input2.incident.project_id,
25782
25983
  slug: input2.incident.project_id,
@@ -26913,7 +27114,7 @@ var ProfileSchema2 = external_exports.object({
26913
27114
  framework: external_exports.string().min(1)
26914
27115
  }))
26915
27116
  });
26916
- function isRecord3(value) {
27117
+ function isRecord4(value) {
26917
27118
  return typeof value === "object" && value !== null;
26918
27119
  }
26919
27120
  function slugify2(value) {
@@ -27003,7 +27204,7 @@ async function ingestCommand(input2, dependencies = {}) {
27003
27204
  })
27004
27205
  };
27005
27206
  } catch (error) {
27006
- const message = isRecord3(error) && typeof error["message"] === "string" ? error["message"] : "Failed to ingest log file.";
27207
+ const message = isRecord4(error) && typeof error["message"] === "string" ? error["message"] : "Failed to ingest log file.";
27007
27208
  return {
27008
27209
  exitCode: 1,
27009
27210
  output: message
@@ -28553,6 +28754,7 @@ async function listAllCloudIncidents(input2, api) {
28553
28754
  ...input2.status === void 0 ? {} : { status: input2.status },
28554
28755
  ...input2.severity === void 0 ? {} : { severity: input2.severity },
28555
28756
  ...input2.firstSeenAfter === void 0 ? {} : { firstSeenAfter: input2.firstSeenAfter },
28757
+ ...input2.attentionAfter === void 0 ? {} : { attentionAfter: input2.attentionAfter },
28556
28758
  ...cursor === void 0 ? {} : { cursor }
28557
28759
  });
28558
28760
  incidents.push(
@@ -28574,7 +28776,8 @@ async function mapCombinedIncidentListResult(input2, api, dependencies) {
28574
28776
  ...input2.service === void 0 ? {} : { service: input2.service },
28575
28777
  ...input2.status === void 0 ? {} : { status: input2.status },
28576
28778
  ...input2.severity === void 0 ? {} : { severity: input2.severity },
28577
- ...input2.firstSeenAfter === void 0 ? {} : { firstSeenAfter: input2.firstSeenAfter }
28779
+ ...input2.firstSeenAfter === void 0 ? {} : { firstSeenAfter: input2.firstSeenAfter },
28780
+ ...input2.attentionAfter === void 0 ? {} : { attentionAfter: input2.attentionAfter }
28578
28781
  },
28579
28782
  dependencies
28580
28783
  );
@@ -28586,7 +28789,8 @@ async function mapCombinedIncidentListResult(input2, api, dependencies) {
28586
28789
  ...input2.service === void 0 ? {} : { service: input2.service },
28587
28790
  ...input2.status === void 0 ? {} : { status: input2.status },
28588
28791
  ...input2.severity === void 0 ? {} : { severity: input2.severity },
28589
- ...input2.firstSeenAfter === void 0 ? {} : { firstSeenAfter: input2.firstSeenAfter }
28792
+ ...input2.firstSeenAfter === void 0 ? {} : { firstSeenAfter: input2.firstSeenAfter },
28793
+ ...input2.attentionAfter === void 0 ? {} : { attentionAfter: input2.attentionAfter }
28590
28794
  },
28591
28795
  api
28592
28796
  );
@@ -28635,6 +28839,9 @@ async function listIncidentsCommand(input2, api) {
28635
28839
  if (input2.firstSeenAfter !== void 0) {
28636
28840
  requestInput.firstSeenAfter = input2.firstSeenAfter;
28637
28841
  }
28842
+ if (input2.attentionAfter !== void 0) {
28843
+ requestInput.attentionAfter = input2.attentionAfter;
28844
+ }
28638
28845
  if (input2.cursor !== void 0) {
28639
28846
  requestInput.cursor = input2.cursor;
28640
28847
  }
@@ -28668,6 +28875,7 @@ async function listIncidentsWithAuthCommand(input2, dependencies) {
28668
28875
  ...statusFilter === void 0 ? {} : { status: statusFilter },
28669
28876
  ...input2.severity === void 0 ? {} : { severity: input2.severity },
28670
28877
  ...input2.firstSeenAfter === void 0 ? {} : { firstSeenAfter: input2.firstSeenAfter },
28878
+ ...input2.attentionAfter === void 0 ? {} : { attentionAfter: input2.attentionAfter },
28671
28879
  ...input2.cursor === void 0 ? {} : { cursor: input2.cursor },
28672
28880
  ...input2.limit === void 0 ? {} : { limit: input2.limit }
28673
28881
  },
@@ -28693,6 +28901,7 @@ async function listIncidentsWithAuthCommand(input2, dependencies) {
28693
28901
  ...statusFilter === void 0 ? {} : { status: statusFilter },
28694
28902
  ...input2.severity === void 0 ? {} : { severity: input2.severity },
28695
28903
  ...input2.firstSeenAfter === void 0 ? {} : { firstSeenAfter: input2.firstSeenAfter },
28904
+ ...input2.attentionAfter === void 0 ? {} : { attentionAfter: input2.attentionAfter },
28696
28905
  ...input2.cursor === void 0 ? {} : { cursor: input2.cursor },
28697
28906
  ...input2.limit === void 0 ? {} : { limit: input2.limit },
28698
28907
  ...input2.json === void 0 ? {} : { json: input2.json }
@@ -28731,6 +28940,9 @@ async function listIncidentsWithAuthCommand(input2, dependencies) {
28731
28940
  if (input2.firstSeenAfter !== void 0) {
28732
28941
  commandInput.firstSeenAfter = input2.firstSeenAfter;
28733
28942
  }
28943
+ if (input2.attentionAfter !== void 0) {
28944
+ commandInput.attentionAfter = input2.attentionAfter;
28945
+ }
28734
28946
  if (input2.cursor !== void 0) {
28735
28947
  commandInput.cursor = input2.cursor;
28736
28948
  }
@@ -30455,7 +30667,7 @@ var CLI_USAGE_LINES = [
30455
30667
  " debugbundle login --github-device [--label <label>] [--base-url <url>] [--auth-file <path>] [--json]",
30456
30668
  " debugbundle profile validate [--json]",
30457
30669
  " debugbundle whoami [--auth-file <path>] [--json]",
30458
- " debugbundle incidents [--source <local|cloud>] [--project-id <id>] [--environment <name>] [--service <name>] [--status <active|open|resolved|regressed|all>] [--severity <severity>] [--first-seen-after <ISO8601>] [--cursor <cursor>] [--limit <n>] [--auth-file <path>] [--json]",
30670
+ " debugbundle incidents [--source <local|cloud>] [--project-id <id>] [--environment <name>] [--service <name>] [--status <active|open|resolved|regressed|all>] [--severity <severity>] [--first-seen-after <ISO8601>] [--attention-after <ISO8601>] [--cursor <cursor>] [--limit <n>] [--auth-file <path>] [--json]",
30459
30671
  " debugbundle inspect <incident-id> [--source <local|cloud>] [--auth-file <path>] [--json]",
30460
30672
  " debugbundle explain <incident-id> [--source <local|cloud>] [--auth-file <path>] [--json]",
30461
30673
  " debugbundle resolve <incident-id> [incident-id ...] [--source <local|cloud>] [--auth-file <path>] [--json]",
@@ -34496,7 +34708,7 @@ function createCaptureRuleApi(httpClient) {
34496
34708
  bearerToken: input2.bearerToken,
34497
34709
  body: input2.create
34498
34710
  });
34499
- if (response.status !== 201) {
34711
+ if (response.status !== 200 && response.status !== 201) {
34500
34712
  throw toApiError5(response.status, response.body, "Failed to create capture rule from suggestion.");
34501
34713
  }
34502
34714
  const parsed = CaptureRuleResponseSchema.safeParse(response.body);
@@ -34633,6 +34845,7 @@ function formatSuggestionResponse(response) {
34633
34845
  suggestion.reason,
34634
34846
  `matcher: ${formatMatcherFromValue(suggestion.rule.matcher)}`,
34635
34847
  `requires_confirmation: ${String(suggestion.requires_confirmation)}`,
34848
+ suggestion.created_rule_id == null ? "existing_rule: none" : `existing_rule: ${suggestion.created_rule_id} (${suggestion.created_rule_enabled === false ? "disabled" : "enabled"})`,
34636
34849
  `apply: debugbundle capture-rule create-from-suggestion <incident-id> --suggestion-id ${suggestion.suggestion_id}`
34637
34850
  ].join("\n")
34638
34851
  ).join("\n\n");
@@ -34725,7 +34938,7 @@ async function createCaptureRuleFromIncidentSuggestionCommand(input2, api) {
34725
34938
  });
34726
34939
  return {
34727
34940
  exitCode: 0,
34728
- output: input2.json ? JSON.stringify(response) : `Capture rule created.
34941
+ output: input2.json ? JSON.stringify(response) : `Capture rule applied.
34729
34942
  ${formatRule(response.rule)}`
34730
34943
  };
34731
34944
  } catch (error) {
@@ -36950,7 +37163,7 @@ async function handleCaptureRuleCommand2(parsedArgv, dependencies) {
36950
37163
  // package.json
36951
37164
  var package_default = {
36952
37165
  name: "@debugbundle/cli",
36953
- version: "1.5.3",
37166
+ version: "1.6.0",
36954
37167
  private: false,
36955
37168
  description: "Command-line interface for DebugBundle",
36956
37169
  license: "AGPL-3.0-only",
@@ -37241,7 +37454,7 @@ ${formatUsage()}`
37241
37454
  return await (dependencies.whoamiCommand ?? whoamiCommand)(appendCommonAuthOptions(parsedArgv, {}));
37242
37455
  }
37243
37456
  if (command === "incidents") {
37244
- expectNoUnknownOptions(parsedArgv, ["auth-file", "json", "source", "project-id", "environment", "service", "status", "severity", "first-seen-after", "cursor", "limit"]);
37457
+ expectNoUnknownOptions(parsedArgv, ["auth-file", "json", "source", "project-id", "environment", "service", "status", "severity", "first-seen-after", "attention-after", "cursor", "limit"]);
37245
37458
  ensureNoExtraPositionals(parsedArgv, 1);
37246
37459
  const input2 = appendCommonAuthOptions(parsedArgv, {});
37247
37460
  const source = readRetrievalSource(parsedArgv);
@@ -37272,6 +37485,10 @@ ${formatUsage()}`
37272
37485
  if (firstSeenAfter !== void 0) {
37273
37486
  input2.firstSeenAfter = firstSeenAfter;
37274
37487
  }
37488
+ const attentionAfter = readStringOption(parsedArgv, "attention-after");
37489
+ if (attentionAfter !== void 0) {
37490
+ input2.attentionAfter = attentionAfter;
37491
+ }
37275
37492
  const cursor = readStringOption(parsedArgv, "cursor");
37276
37493
  if (cursor !== void 0) {
37277
37494
  input2.cursor = cursor;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@debugbundle/cli",
3
- "version": "1.5.3",
3
+ "version": "1.6.0",
4
4
  "private": false,
5
5
  "description": "Command-line interface for DebugBundle",
6
6
  "license": "AGPL-3.0-only",