@debugbundle/cli 1.5.4 → 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 +28 -7
  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({
@@ -25319,6 +25321,26 @@ function selectPrimarySignalEnvelope(envelopes, sourceEventId) {
25319
25321
  (envelope) => envelope.event_type === "backend_exception" || envelope.event_type === "frontend_exception" || envelope.event_type === "request_event"
25320
25322
  ) ?? null;
25321
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
+ }
25322
25344
  function mapSignalType(eventType) {
25323
25345
  if (eventType === "request_event") {
25324
25346
  return "request_failure";
@@ -25936,6 +25958,7 @@ function buildBundle(input2) {
25936
25958
  const firstSeenAt = new Date(input2.incident.first_seen_at).toISOString();
25937
25959
  const lastSeenAt = new Date(input2.incident.last_seen_at).toISOString();
25938
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);
25939
25962
  const serviceRuntime = input2.incident.service_runtime ?? selectLatestEnvelope(sourceEnvelopes, (envelope) => envelope.event_type !== "probe_event")?.service.runtime ?? null;
25940
25963
  const serviceFramework = input2.incident.service_framework ?? selectLatestEnvelope(sourceEnvelopes, (envelope) => envelope.event_type !== "probe_event")?.service.framework ?? null;
25941
25964
  const customerVisible = frontendContext !== null;
@@ -25954,10 +25977,7 @@ function buildBundle(input2) {
25954
25977
  bundle_id: `bnd_${input2.incident.incident_id}`,
25955
25978
  bundle_type: "failure",
25956
25979
  captured_at: capturedAt,
25957
- sdk: {
25958
- name: "debugbundle-worker",
25959
- version: "0.1.0"
25960
- },
25980
+ sdk: bundleSdk,
25961
25981
  project: {
25962
25982
  id: input2.incident.project_id,
25963
25983
  slug: input2.incident.project_id,
@@ -34688,7 +34708,7 @@ function createCaptureRuleApi(httpClient) {
34688
34708
  bearerToken: input2.bearerToken,
34689
34709
  body: input2.create
34690
34710
  });
34691
- if (response.status !== 201) {
34711
+ if (response.status !== 200 && response.status !== 201) {
34692
34712
  throw toApiError5(response.status, response.body, "Failed to create capture rule from suggestion.");
34693
34713
  }
34694
34714
  const parsed = CaptureRuleResponseSchema.safeParse(response.body);
@@ -34825,6 +34845,7 @@ function formatSuggestionResponse(response) {
34825
34845
  suggestion.reason,
34826
34846
  `matcher: ${formatMatcherFromValue(suggestion.rule.matcher)}`,
34827
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"})`,
34828
34849
  `apply: debugbundle capture-rule create-from-suggestion <incident-id> --suggestion-id ${suggestion.suggestion_id}`
34829
34850
  ].join("\n")
34830
34851
  ).join("\n\n");
@@ -34917,7 +34938,7 @@ async function createCaptureRuleFromIncidentSuggestionCommand(input2, api) {
34917
34938
  });
34918
34939
  return {
34919
34940
  exitCode: 0,
34920
- output: input2.json ? JSON.stringify(response) : `Capture rule created.
34941
+ output: input2.json ? JSON.stringify(response) : `Capture rule applied.
34921
34942
  ${formatRule(response.rule)}`
34922
34943
  };
34923
34944
  } catch (error) {
@@ -37142,7 +37163,7 @@ async function handleCaptureRuleCommand2(parsedArgv, dependencies) {
37142
37163
  // package.json
37143
37164
  var package_default = {
37144
37165
  name: "@debugbundle/cli",
37145
- version: "1.5.4",
37166
+ version: "1.6.0",
37146
37167
  private: false,
37147
37168
  description: "Command-line interface for DebugBundle",
37148
37169
  license: "AGPL-3.0-only",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@debugbundle/cli",
3
- "version": "1.5.4",
3
+ "version": "1.6.0",
4
4
  "private": false,
5
5
  "description": "Command-line interface for DebugBundle",
6
6
  "license": "AGPL-3.0-only",