@debugbundle/cli 0.1.8 → 0.1.9

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 +314 -31
  2. package/package.json +1 -1
package/dist/main.cjs CHANGED
@@ -15197,6 +15197,25 @@ function buildSkill() {
15197
15197
  "",
15198
15198
  "Use DebugBundle before starting a fresh bug investigation.",
15199
15199
  "",
15200
+ "## Investigation Quickstart",
15201
+ "",
15202
+ "When the user reports a bug, runtime failure, production incident, regression, broken deploy, or unknown error, start here before reading arbitrary source files.",
15203
+ "",
15204
+ "1. Run `debugbundle doctor --json` to learn whether the project is local-only or connected and whether the local scaffold is healthy.",
15205
+ "2. List actionable failures with `debugbundle incidents --source local --status open --json` for local data, or `debugbundle incidents --source cloud --status open --json` when the issue came from a hosted environment.",
15206
+ "3. Inspect the chosen incident with `debugbundle inspect <incident-id> --source <local|cloud> --json` and `debugbundle explain <incident-id> --source <local|cloud> --json`.",
15207
+ "4. Fetch evidence before editing code: `debugbundle bundle <incident-id> --source <local|cloud> --json` and `debugbundle reproduce <incident-id> --source <local|cloud> --json`.",
15208
+ "5. If local SDK or relay events have landed but no bundle exists yet, run `debugbundle process --preset <minimal|balanced|investigative> --json` and then list incidents again.",
15209
+ "",
15210
+ "Key local paths:",
15211
+ "- `.debugbundle/profile.json` \u2014 project map, service paths, and validation state",
15212
+ "- `.debugbundle/local/connection.json` \u2014 local-only vs connected mode and environment delivery policy",
15213
+ "- `.debugbundle/local/events/` \u2014 raw local SDK, relay, ingest, and watch event batches",
15214
+ "- `.debugbundle/local/state.json` \u2014 local incident index, lifecycle state, and bundle paths",
15215
+ "- `.debugbundle/bundles/local/` \u2014 locally generated bundle artifacts",
15216
+ "- `.debugbundle/bundles/local/reproductions/` \u2014 local reproduction artifacts",
15217
+ "- `.debugbundle/bundles/cloud/` \u2014 explicitly fetched cloud artifact cache",
15218
+ "",
15200
15219
  "## Core Workflow",
15201
15220
  "",
15202
15221
  "1. Check DebugBundle incidents first to avoid re-investigating a known failure.",
@@ -15247,23 +15266,35 @@ function buildCliReference() {
15247
15266
  "## Setup",
15248
15267
  "",
15249
15268
  "- `debugbundle setup [--non-interactive] [--json]`",
15250
- "- `debugbundle doctor [--json]`",
15269
+ "- `debugbundle doctor [--check-relay] [--json]`",
15251
15270
  "- `debugbundle validate [--fix] [--json]`",
15252
15271
  "- `debugbundle ingest <file> --format <format> [--json]`",
15253
15272
  "- `debugbundle watch --log <file> --format <format> [--json]`",
15254
15273
  "- `debugbundle watch --cloud --log <file> --format <format> [--json]`",
15255
15274
  "- `debugbundle process [--preset <minimal|balanced|investigative>] [--json]`",
15275
+ "- `debugbundle clean [--events] [--bundles] [--all] [--older-than <Nd>] [--json]`",
15256
15276
  "",
15257
15277
  "## Investigation",
15258
15278
  "",
15259
- "- `debugbundle incidents`",
15260
- "- `debugbundle inspect <incident-id>`",
15261
- "- `debugbundle bundle <incident-id>`",
15262
- "- `debugbundle reproduce <incident-id>`",
15263
- "- `debugbundle resolve <incident-id>`",
15264
- "- `debugbundle reopen <incident-id>`",
15279
+ "- `debugbundle incidents [--source <local|cloud>] [--project-id <id>] [--environment <name>] [--service <name>] [--status <status>] [--severity <severity>] [--cursor <cursor>] [--limit <n>] [--json]`",
15280
+ "- `debugbundle inspect <incident-id> [--source <local|cloud>] [--json]`",
15281
+ "- `debugbundle explain <incident-id> [--source <local|cloud>] [--json]`",
15282
+ "- `debugbundle bundle <incident-id> [--source <local|cloud>] [--json]`",
15283
+ "- `debugbundle reproduce <incident-id> [--source <local|cloud>] [--json]`",
15284
+ "- `debugbundle resolve <incident-id> [--source <local|cloud>] [--json]`",
15285
+ "- `debugbundle reopen <incident-id> [--source <local|cloud>] [--json]`",
15265
15286
  "- `debugbundle analyze --type improvement --local`",
15266
15287
  "",
15288
+ "## Operational Paths",
15289
+ "",
15290
+ "- `.debugbundle/profile.json` \u2014 committed project map and agent validation state",
15291
+ "- `.debugbundle/local/connection.json` \u2014 committed delivery policy and cloud connection metadata",
15292
+ "- `.debugbundle/local/events/` \u2014 gitignored raw local event batches",
15293
+ "- `.debugbundle/local/state.json` \u2014 gitignored local incident index and lifecycle state",
15294
+ "- `.debugbundle/bundles/local/` \u2014 gitignored local bundle artifacts",
15295
+ "- `.debugbundle/bundles/local/reproductions/` \u2014 gitignored local reproduction artifacts",
15296
+ "- `.debugbundle/bundles/cloud/` \u2014 gitignored cache for explicitly fetched cloud artifacts",
15297
+ "",
15267
15298
  "## Incident Hygiene",
15268
15299
  "",
15269
15300
  "Resolve incidents after a fix is verified or after an intentional smoke, dogfood, or verification incident has served its purpose.",
@@ -15295,6 +15326,17 @@ function buildMcpReference() {
15295
15326
  "",
15296
15327
  "Use the same incident-first workflow through MCP when an agent is operating in connected mode.",
15297
15328
  "",
15329
+ "## Investigation Tools",
15330
+ "",
15331
+ "- `doctor` \u2014 validate local profile, connection config, auth state, and setup health.",
15332
+ "- `list_incidents` \u2014 list local, cloud, or connected combined incidents; pass `source`, `status`, `environment`, `service`, `severity`, `cursor`, and `limit` when needed.",
15333
+ "- `get_incident` \u2014 fetch incident metadata by incident id.",
15334
+ "- `get_incident_context` \u2014 fetch deterministic explanation context for triage.",
15335
+ "- `get_bundle` \u2014 fetch the full debug bundle before proposing a fix.",
15336
+ "- `get_reproduction` \u2014 fetch reproduction guidance before editing code.",
15337
+ "- `resolve_incident` / `reopen_incident` \u2014 update lifecycle state after validation.",
15338
+ "- `analyze` \u2014 run local agent-oriented analysis from local bundles and skill schemas.",
15339
+ "",
15298
15340
  "- Prefer bundle retrieval tools before reading raw repository files.",
15299
15341
  "- Use MCP bundle access when the current issue originated in production.",
15300
15342
  "- Resolve fixed or intentionally generated incidents with `resolve_incident` so open incidents stay actionable.",
@@ -15318,8 +15360,12 @@ function buildBundleSchemaReference() {
15318
15360
  "Focus on:",
15319
15361
  "- `summary` for the failure synopsis and recommended action",
15320
15362
  "- `service` and `environment` for routing to the right code path",
15363
+ "- `context.error`, `context.request`, `context.response`, `context.logs`, `context.frontend`, `context.runtime`, `context.git`, `context.dependencies`, and `context.probe_data` for supporting evidence",
15364
+ "- `reproduction` for confidence, commands, and manual steps",
15321
15365
  "- `links.reproduction` for the generated reproduction artifact",
15322
15366
  "- `metadata.source` for whether the bundle came from local or cloud data",
15367
+ "",
15368
+ "Treat the bundle as the source of truth for the failure report. Use repository reads to confirm and patch the implicated code paths, not to rediscover incident context from scratch.",
15323
15369
  ""
15324
15370
  ].join("\n");
15325
15371
  }
@@ -15330,10 +15376,12 @@ function buildProfileEnrichmentReference() {
15330
15376
  "The setup profile is generated from static analysis and must be reviewed before agents rely on it for architecture decisions.",
15331
15377
  "",
15332
15378
  "Checklist:",
15333
- "- verify service kinds, frameworks, and runtime assumptions",
15334
- "- add critical paths and ownership notes",
15335
- "- confirm build, test, and lint workflows",
15336
- "- update `debugbundle.validation_status` to `agent-validated` when complete",
15379
+ "- verify `project.primary_languages`, `project.package_managers`, and `project.deployment_targets`",
15380
+ "- verify each service `kind`, `runtime`, `framework`, `paths`, `owns_routes`, and `depends_on` value against the repository",
15381
+ "- add critical paths for ingestion, processing, retrieval, SDK capture, auth, billing, and any project-specific high-risk workflows",
15382
+ "- confirm `repo.generated_paths` and `repo.do_not_edit_paths` match the local scaffold",
15383
+ "- confirm build, test, lint, and install workflows in `developer_workflows`",
15384
+ "- update `debugbundle.last_reviewed_at` and set `debugbundle.validation_status` to `agent-validated` when complete",
15337
15385
  ""
15338
15386
  ].join("\n");
15339
15387
  }
@@ -15415,6 +15463,22 @@ function buildSkillEvals() {
15415
15463
  "Resolve verified or intentionally generated incidents after the workflow is complete.",
15416
15464
  "Leave unresolved incidents open when the failure is still live or unverified."
15417
15465
  ]
15466
+ },
15467
+ {
15468
+ name: "artifact_path_discovery",
15469
+ prompt: "The user reports an unknown local runtime error. Confirm the skill tells the agent which DebugBundle paths and commands to inspect first.",
15470
+ expected_behavior: [
15471
+ "Run doctor and list local open incidents before broad source exploration.",
15472
+ "Use .debugbundle/local/state.json, .debugbundle/bundles/local/, and reproduction artifact paths as the local evidence map."
15473
+ ]
15474
+ },
15475
+ {
15476
+ name: "connected_incident_fetch",
15477
+ prompt: "The user says a production incident fired in the hosted DebugBundle project. Confirm the skill points the agent to the cloud retrieval path.",
15478
+ expected_behavior: [
15479
+ "List cloud open incidents or use MCP list_incidents with source cloud.",
15480
+ "Fetch inspect, context, bundle, and reproduction artifacts before editing code."
15481
+ ]
15418
15482
  }
15419
15483
  ]
15420
15484
  },
@@ -15845,6 +15909,7 @@ var ImprovementSchema = external_exports.object({
15845
15909
  summary: external_exports.string(),
15846
15910
  occurrence_count: external_exports.number().int(),
15847
15911
  evidence: external_exports.record(external_exports.unknown()),
15912
+ related_incident_ids: external_exports.array(external_exports.string()),
15848
15913
  first_detected_at: external_exports.string(),
15849
15914
  last_detected_at: external_exports.string(),
15850
15915
  resolved_at: external_exports.string().nullable(),
@@ -17076,6 +17141,164 @@ var STORAGE_SCHEMA_MIGRATIONS = [
17076
17141
  )
17077
17142
  `
17078
17143
  ]
17144
+ }),
17145
+ defineStorageSchemaMigration({
17146
+ id: "202605180004_add_operational_email_deliveries",
17147
+ description: "Add durable operational email delivery queue with retries and dedupe.",
17148
+ statements: [
17149
+ `
17150
+ CREATE TABLE IF NOT EXISTS operational_email_deliveries (
17151
+ id uuid PRIMARY KEY,
17152
+ organization_id uuid NOT NULL REFERENCES organizations(id) ON DELETE CASCADE,
17153
+ project_id uuid NOT NULL REFERENCES projects(id) ON DELETE CASCADE,
17154
+ kind text NOT NULL,
17155
+ dedupe_key text NOT NULL,
17156
+ payload jsonb NOT NULL DEFAULT '{}'::jsonb,
17157
+ status text NOT NULL DEFAULT 'pending',
17158
+ attempt_count integer NOT NULL DEFAULT 0,
17159
+ next_attempt_at timestamptz,
17160
+ last_error text,
17161
+ delivered_at timestamptz,
17162
+ created_at timestamptz NOT NULL DEFAULT now(),
17163
+ updated_at timestamptz NOT NULL DEFAULT now(),
17164
+ UNIQUE (organization_id, kind, dedupe_key)
17165
+ )
17166
+ `,
17167
+ `
17168
+ ALTER TABLE operational_email_deliveries
17169
+ DROP CONSTRAINT IF EXISTS operational_email_deliveries_kind_check
17170
+ `,
17171
+ `
17172
+ ALTER TABLE operational_email_deliveries
17173
+ ADD CONSTRAINT operational_email_deliveries_kind_check
17174
+ CHECK (kind IN ('webhook_auto_disabled', 'allowance_warning_80', 'allowance_limit_reached', 'retention_rotation_notice'))
17175
+ `,
17176
+ `
17177
+ ALTER TABLE operational_email_deliveries
17178
+ DROP CONSTRAINT IF EXISTS operational_email_deliveries_status_check
17179
+ `,
17180
+ `
17181
+ ALTER TABLE operational_email_deliveries
17182
+ ADD CONSTRAINT operational_email_deliveries_status_check
17183
+ CHECK (status IN ('pending', 'retrying', 'delivered', 'failed'))
17184
+ `,
17185
+ `
17186
+ CREATE INDEX IF NOT EXISTS operational_email_deliveries_status_next_attempt_idx
17187
+ ON operational_email_deliveries (status, next_attempt_at, created_at)
17188
+ `
17189
+ ]
17190
+ }),
17191
+ defineStorageSchemaMigration({
17192
+ id: "202605180005_add_github_improvement_dispatch_targets",
17193
+ description: "Allow GitHub dispatch deliveries to target either incidents or hosted improvements.",
17194
+ statements: [
17195
+ "ALTER TABLE github_dispatch_deliveries ALTER COLUMN incident_id DROP NOT NULL",
17196
+ "ALTER TABLE github_dispatch_deliveries RENAME COLUMN incident_fingerprint TO target_fingerprint",
17197
+ "ALTER TABLE github_dispatch_deliveries ADD COLUMN IF NOT EXISTS improvement_opportunity_id uuid REFERENCES improvement_opportunities(id) ON DELETE CASCADE",
17198
+ "DROP INDEX IF EXISTS github_dispatch_deliveries_rule_dedupe_key_idx",
17199
+ `
17200
+ CREATE UNIQUE INDEX IF NOT EXISTS github_dispatch_deliveries_rule_dedupe_key_idx
17201
+ ON github_dispatch_deliveries (rule_id, target_fingerprint, dedupe_key)
17202
+ `,
17203
+ "ALTER TABLE github_dispatch_deliveries DROP CONSTRAINT IF EXISTS github_dispatch_deliveries_check",
17204
+ `
17205
+ ALTER TABLE github_dispatch_deliveries
17206
+ ADD CONSTRAINT github_dispatch_deliveries_check CHECK (
17207
+ (incident_id IS NOT NULL AND improvement_opportunity_id IS NULL)
17208
+ OR (incident_id IS NULL AND improvement_opportunity_id IS NOT NULL)
17209
+ )
17210
+ `
17211
+ ]
17212
+ }),
17213
+ defineStorageSchemaMigration({
17214
+ id: "202605180006_add_missing_bundle_and_creator_columns",
17215
+ description: "Backfill creator ownership columns and incident bundle tracking columns that existed only in bootstrap schema.",
17216
+ statements: [
17217
+ "ALTER TABLE incidents ADD COLUMN IF NOT EXISTS bundle_generation_number integer NOT NULL DEFAULT 0",
17218
+ "ALTER TABLE incidents ADD COLUMN IF NOT EXISTS bundle_created_at timestamptz",
17219
+ "ALTER TABLE incidents ADD COLUMN IF NOT EXISTS bundle_updated_at timestamptz",
17220
+ "ALTER TABLE incidents ADD COLUMN IF NOT EXISTS bundle_source_event_id uuid",
17221
+ "ALTER TABLE incidents ADD COLUMN IF NOT EXISTS bundle_source_occurred_at timestamptz",
17222
+ "ALTER TABLE incidents ADD COLUMN IF NOT EXISTS bundle_trigger text",
17223
+ "ALTER TABLE incidents ADD COLUMN IF NOT EXISTS bundle_failure_reason text",
17224
+ "ALTER TABLE alert_rules ADD COLUMN IF NOT EXISTS created_by_user_id uuid",
17225
+ `
17226
+ UPDATE alert_rules ar
17227
+ SET created_by_user_id = p.owner_user_id
17228
+ FROM projects p
17229
+ WHERE ar.project_id = p.id
17230
+ AND ar.created_by_user_id IS NULL
17231
+ `,
17232
+ "ALTER TABLE alert_rules DROP CONSTRAINT IF EXISTS alert_rules_created_by_user_id_fkey",
17233
+ `
17234
+ ALTER TABLE alert_rules
17235
+ ADD CONSTRAINT alert_rules_created_by_user_id_fkey
17236
+ FOREIGN KEY (created_by_user_id) REFERENCES users(id) ON DELETE CASCADE
17237
+ `,
17238
+ "ALTER TABLE alert_rules ALTER COLUMN created_by_user_id SET NOT NULL",
17239
+ "ALTER TABLE agent_webhooks ADD COLUMN IF NOT EXISTS created_by_user_id uuid",
17240
+ `
17241
+ UPDATE agent_webhooks aw
17242
+ SET created_by_user_id = p.owner_user_id
17243
+ FROM projects p
17244
+ WHERE aw.project_id = p.id
17245
+ AND aw.created_by_user_id IS NULL
17246
+ `,
17247
+ "ALTER TABLE agent_webhooks DROP CONSTRAINT IF EXISTS agent_webhooks_created_by_user_id_fkey",
17248
+ `
17249
+ ALTER TABLE agent_webhooks
17250
+ ADD CONSTRAINT agent_webhooks_created_by_user_id_fkey
17251
+ FOREIGN KEY (created_by_user_id) REFERENCES users(id) ON DELETE CASCADE
17252
+ `,
17253
+ "ALTER TABLE agent_webhooks ALTER COLUMN created_by_user_id SET NOT NULL",
17254
+ "ALTER TABLE github_dispatch_rules ADD COLUMN IF NOT EXISTS created_by_user_id uuid",
17255
+ `
17256
+ UPDATE github_dispatch_rules gdr
17257
+ SET created_by_user_id = p.owner_user_id
17258
+ FROM projects p
17259
+ WHERE gdr.project_id = p.id
17260
+ AND gdr.created_by_user_id IS NULL
17261
+ `,
17262
+ "ALTER TABLE github_dispatch_rules DROP CONSTRAINT IF EXISTS github_dispatch_rules_created_by_user_id_fkey",
17263
+ `
17264
+ ALTER TABLE github_dispatch_rules
17265
+ ADD CONSTRAINT github_dispatch_rules_created_by_user_id_fkey
17266
+ FOREIGN KEY (created_by_user_id) REFERENCES users(id) ON DELETE CASCADE
17267
+ `,
17268
+ "ALTER TABLE github_dispatch_rules ALTER COLUMN created_by_user_id SET NOT NULL"
17269
+ ]
17270
+ }),
17271
+ defineStorageSchemaMigration({
17272
+ id: "202605200001_limit_weekly_report_email_channel_per_project",
17273
+ description: "Keep weekly email reports singular per project.",
17274
+ statements: [
17275
+ `
17276
+ DELETE FROM weekly_report_channels
17277
+ WHERE id IN (
17278
+ SELECT id
17279
+ FROM (
17280
+ SELECT
17281
+ id,
17282
+ row_number() OVER (PARTITION BY project_id ORDER BY created_at ASC, id ASC) AS row_number
17283
+ FROM weekly_report_channels
17284
+ WHERE channel = 'email'
17285
+ ) ranked
17286
+ WHERE ranked.row_number > 1
17287
+ )
17288
+ `,
17289
+ `
17290
+ CREATE UNIQUE INDEX IF NOT EXISTS weekly_report_channels_project_email_unique_idx
17291
+ ON weekly_report_channels (project_id)
17292
+ WHERE channel = 'email'
17293
+ `
17294
+ ]
17295
+ }),
17296
+ defineStorageSchemaMigration({
17297
+ id: "202605220001_add_project_token_allowed_origins",
17298
+ description: "Add optional browser-origin allowlists to project ingestion tokens.",
17299
+ statements: [
17300
+ "ALTER TABLE project_tokens ADD COLUMN IF NOT EXISTS allowed_origins jsonb NOT NULL DEFAULT '[]'::jsonb"
17301
+ ]
17079
17302
  })
17080
17303
  ];
17081
17304
 
@@ -17983,6 +18206,7 @@ var ProjectTokenSchema = external_exports.object({
17983
18206
  token_id: external_exports.string(),
17984
18207
  project_id: external_exports.string(),
17985
18208
  label: external_exports.string(),
18209
+ allowed_origins: external_exports.array(external_exports.string()).default([]),
17986
18210
  created_at: external_exports.string(),
17987
18211
  last_used_at: external_exports.string().nullable(),
17988
18212
  revoked_at: external_exports.string().nullable(),
@@ -18067,7 +18291,8 @@ function createTokenManagementApi(client) {
18067
18291
  path: `/v1/projects/${input.projectId}/tokens`,
18068
18292
  bearerToken: input.bearerToken,
18069
18293
  body: {
18070
- label: input.label
18294
+ label: input.label,
18295
+ ...input.allowedOrigins === void 0 ? {} : { allowed_origins: input.allowedOrigins }
18071
18296
  }
18072
18297
  })
18073
18298
  );
@@ -18969,8 +19194,9 @@ var GitHubDispatchDeliverySchema = external_exports.object({
18969
19194
  delivery_id: external_exports.string(),
18970
19195
  rule_id: external_exports.string(),
18971
19196
  rule_name: external_exports.string(),
18972
- incident_id: external_exports.string(),
18973
- incident_title: external_exports.string(),
19197
+ incident_id: external_exports.string().nullable(),
19198
+ improvement_id: external_exports.string().nullable(),
19199
+ target_title: external_exports.string(),
18974
19200
  status: external_exports.enum(["pending", "retrying", "delivered", "failed", "skipped"]),
18975
19201
  attempt_count: external_exports.number().int(),
18976
19202
  last_attempt_at: external_exports.string().nullable(),
@@ -25689,7 +25915,7 @@ var CLI_USAGE_LINES = [
25689
25915
  " debugbundle project update <project-id> [--name <name>] [--slug <slug>] [--environment-default <env>] [--auth-file <path>] [--json]",
25690
25916
  " debugbundle project delete <project-id> [--auth-file <path>] [--json]",
25691
25917
  " debugbundle token project list <project-id> [--limit <n>] [--auth-file <path>] [--json]",
25692
- " debugbundle token project create <project-id> --label <label> [--auth-file <path>] [--json]",
25918
+ " debugbundle token project create <project-id> --label <label> [--allowed-origin <origin> ...] [--auth-file <path>] [--json]",
25693
25919
  " debugbundle token project revoke <project-id> <token-id> [--auth-file <path>] [--json]",
25694
25920
  " debugbundle token member list [--limit <n>] [--auth-file <path>] [--json]",
25695
25921
  " debugbundle token member create --label <label> [--auth-file <path>] [--json]",
@@ -25711,6 +25937,7 @@ var CLI_USAGE_LINES = [
25711
25937
  " debugbundle webhook retry <webhook-id> <delivery-id> --project-id <id> [--auth-file <path>] [--json]",
25712
25938
  " debugbundle weekly-report list --project-id <id> [--limit <n>] [--auth-file <path>] [--json]",
25713
25939
  " debugbundle weekly-report create --project-id <id> --channel <email|slack> --day-of-week <day> --hour-of-day <0-23> --timezone <iana> --config-json <json> [--is-enabled <true|false>] [--auth-file <path>] [--json]",
25940
+ ' email --config-json uses {"to":["owner@example.com"]} with up to 3 recipients',
25714
25941
  " debugbundle weekly-report update <channel-id> [--day-of-week <day>] [--hour-of-day <0-23>] [--timezone <iana>] [--config-json <json>] [--is-enabled <true|false>] [--auth-file <path>] [--json]",
25715
25942
  " debugbundle weekly-report delete <channel-id> [--auth-file <path>] [--json]",
25716
25943
  " debugbundle capture-policy get --project <id> [--auth-file <path>] [--json]",
@@ -25743,53 +25970,62 @@ var import_node_path16 = require("node:path");
25743
25970
  var SUGGESTED_ACTIONS2 = [
25744
25971
  "Run debugbundle setup if .debugbundle/profile.json is missing.",
25745
25972
  "Run debugbundle profile validate for field-level profile errors.",
25746
- "Run debugbundle validate --fix to recreate missing local DebugBundle stubs when safe."
25973
+ "Run debugbundle validate --fix to recreate missing or stale local DebugBundle stubs when safe."
25747
25974
  ];
25748
25975
  var FIXABLE_FILES = [
25749
25976
  {
25750
25977
  name: "connection-config",
25751
25978
  filePath: CONNECTION_FILE_PATH,
25752
- buildContent: buildConnectionConfig
25979
+ buildContent: buildConnectionConfig,
25980
+ checkContent: false
25753
25981
  },
25754
25982
  {
25755
25983
  name: "agent-skill",
25756
25984
  filePath: SKILL_FILE_PATH,
25757
- buildContent: buildSkill
25985
+ buildContent: buildSkill,
25986
+ checkContent: true
25758
25987
  },
25759
25988
  {
25760
25989
  name: "cli-reference",
25761
25990
  filePath: CLI_REFERENCE_FILE_PATH,
25762
- buildContent: buildCliReference
25991
+ buildContent: buildCliReference,
25992
+ checkContent: true
25763
25993
  },
25764
25994
  {
25765
25995
  name: "mcp-reference",
25766
25996
  filePath: MCP_REFERENCE_FILE_PATH,
25767
- buildContent: buildMcpReference
25997
+ buildContent: buildMcpReference,
25998
+ checkContent: true
25768
25999
  },
25769
26000
  {
25770
26001
  name: "bundle-schema-reference",
25771
26002
  filePath: BUNDLE_SCHEMA_REFERENCE_FILE_PATH,
25772
- buildContent: buildBundleSchemaReference
26003
+ buildContent: buildBundleSchemaReference,
26004
+ checkContent: true
25773
26005
  },
25774
26006
  {
25775
26007
  name: "profile-enrichment-reference",
25776
26008
  filePath: PROFILE_ENRICHMENT_REFERENCE_FILE_PATH,
25777
- buildContent: buildProfileEnrichmentReference
26009
+ buildContent: buildProfileEnrichmentReference,
26010
+ checkContent: true
25778
26011
  },
25779
26012
  {
25780
26013
  name: "improvement-analysis-recipe",
25781
26014
  filePath: IMPROVEMENT_ANALYSIS_RECIPE_FILE_PATH,
25782
- buildContent: buildImprovementAnalysisRecipe
26015
+ buildContent: buildImprovementAnalysisRecipe,
26016
+ checkContent: true
25783
26017
  },
25784
26018
  {
25785
26019
  name: "performance-analysis-recipe",
25786
26020
  filePath: PERFORMANCE_ANALYSIS_RECIPE_FILE_PATH,
25787
- buildContent: buildPerformanceAnalysisRecipe
26021
+ buildContent: buildPerformanceAnalysisRecipe,
26022
+ checkContent: true
25788
26023
  },
25789
26024
  {
25790
26025
  name: "skill-evals",
25791
26026
  filePath: EVALS_FILE_PATH,
25792
- buildContent: buildSkillEvals
26027
+ buildContent: buildSkillEvals,
26028
+ checkContent: true
25793
26029
  }
25794
26030
  ];
25795
26031
  async function pathExists6(path, stat) {
@@ -25903,6 +26139,28 @@ async function validateCommand(input, dependencies = {}) {
25903
26139
  for (const fixableFile of FIXABLE_FILES) {
25904
26140
  const absoluteFilePath = (0, import_node_path16.join)(rootDirectory, fixableFile.filePath);
25905
26141
  if (await pathExists6(absoluteFilePath, stat)) {
26142
+ if (fixableFile.checkContent) {
26143
+ const currentContents = await readFile(absoluteFilePath);
26144
+ const expectedContents = fixableFile.buildContent();
26145
+ if (currentContents !== expectedContents) {
26146
+ if (input.fix === true) {
26147
+ await writeFile(absoluteFilePath, expectedContents);
26148
+ checks.push({
26149
+ name: fixableFile.name,
26150
+ status: "ok",
26151
+ message: `Updated stale ${fixableFile.filePath}`
26152
+ });
26153
+ continue;
26154
+ }
26155
+ autoFixAvailable = true;
26156
+ checks.push({
26157
+ name: fixableFile.name,
26158
+ status: "warning",
26159
+ message: `Stale ${fixableFile.filePath}; run debugbundle validate --fix to refresh it.`
26160
+ });
26161
+ continue;
26162
+ }
26163
+ }
25906
26164
  checks.push({
25907
26165
  name: fixableFile.name,
25908
26166
  status: "ok",
@@ -26627,6 +26885,7 @@ function formatImprovementDetail(improvement) {
26627
26885
  `Confidence: ${improvement.confidence}`,
26628
26886
  `Occurrences: ${improvement.occurrence_count}`,
26629
26887
  `Last detected: ${improvement.last_detected_at}`,
26888
+ ...improvement.related_incident_ids === void 0 || improvement.related_incident_ids.length === 0 ? [] : [`Related incidents: ${improvement.related_incident_ids.join(", ")}`],
26630
26889
  ...improvement.resolved_at === null ? [] : [`Resolved at: ${improvement.resolved_at}`],
26631
26890
  `Summary: ${improvement.summary}`
26632
26891
  ].join("\n");
@@ -27195,6 +27454,20 @@ function formatTokenTable(tokens) {
27195
27454
  }
27196
27455
  return tokens.map((token) => `${token.token_id} | ${token.label} | ${token.revoked_at === null ? "active" : "revoked"}`).join("\n");
27197
27456
  }
27457
+ function formatAllowedOrigins(allowedOrigins) {
27458
+ if (allowedOrigins === void 0 || allowedOrigins.length === 0) {
27459
+ return "none";
27460
+ }
27461
+ return allowedOrigins.join(", ");
27462
+ }
27463
+ function formatProjectTokenTable(tokens) {
27464
+ if (tokens.length === 0) {
27465
+ return "No tokens found.";
27466
+ }
27467
+ return tokens.map(
27468
+ (token) => `${token.token_id} | ${token.label} | ${token.revoked_at === null ? "active" : "revoked"} | origins: ${formatAllowedOrigins(token.allowed_origins)}`
27469
+ ).join("\n");
27470
+ }
27198
27471
  async function listProjectTokensCommand(input, api) {
27199
27472
  try {
27200
27473
  const requestInput = {
@@ -27210,7 +27483,7 @@ async function listProjectTokensCommand(input, api) {
27210
27483
  }
27211
27484
  return {
27212
27485
  exitCode: 0,
27213
- output: formatTokenTable(tokens)
27486
+ output: formatProjectTokenTable(tokens)
27214
27487
  };
27215
27488
  } catch (error) {
27216
27489
  return { exitCode: mapErrorToExitCode9(error), output: error instanceof Error ? error.message : String(error) };
@@ -27239,17 +27512,22 @@ async function listProjectTokensWithAuthCommand(input, dependencies) {
27239
27512
  }
27240
27513
  async function createProjectTokenCommand(input, api) {
27241
27514
  try {
27242
- const token = await api.createProjectToken({
27515
+ const requestInput = {
27243
27516
  bearerToken: input.bearerToken,
27244
27517
  projectId: input.projectId,
27245
27518
  label: input.label
27246
- });
27519
+ };
27520
+ if (input.allowedOrigins !== void 0) {
27521
+ requestInput.allowedOrigins = input.allowedOrigins;
27522
+ }
27523
+ const token = await api.createProjectToken(requestInput);
27247
27524
  if (input.json) {
27248
27525
  return { exitCode: 0, output: JSON.stringify({ token }) };
27249
27526
  }
27250
27527
  return {
27251
27528
  exitCode: 0,
27252
27529
  output: `Project token created: ${token.token_id}
27530
+ Allowed origins: ${formatAllowedOrigins(token.allowed_origins)}
27253
27531
  Plaintext: ${token.plaintext ?? "<none>"}`
27254
27532
  };
27255
27533
  } catch (error) {
@@ -27266,6 +27544,9 @@ async function createProjectTokenWithAuthCommand(input, dependencies) {
27266
27544
  projectId: input.projectId,
27267
27545
  label: input.label
27268
27546
  };
27547
+ if (input.allowedOrigins !== void 0) {
27548
+ commandInput.allowedOrigins = input.allowedOrigins;
27549
+ }
27269
27550
  if (input.json !== void 0) {
27270
27551
  commandInput.json = input.json;
27271
27552
  }
@@ -28771,7 +29052,7 @@ function formatGitHubDeliveryTable(deliveries) {
28771
29052
  return "No GitHub deliveries found.";
28772
29053
  }
28773
29054
  return deliveries.map(
28774
- (delivery) => `${delivery.rule_name} | ${delivery.status} | ${delivery.incident_title} | attempts: ${delivery.attempt_count}`
29055
+ (delivery) => `${delivery.rule_name} | ${delivery.status} | ${delivery.target_title} | attempts: ${delivery.attempt_count}`
28775
29056
  ).join("\n");
28776
29057
  }
28777
29058
  async function getGitHubStatusCommand(input, api) {
@@ -29622,16 +29903,18 @@ async function handleTokenCommand(parsedArgv, dependencies) {
29622
29903
  return await (dependencies.listProjectTokensCommand ?? listProjectTokensWithAuthCommand)(input);
29623
29904
  }
29624
29905
  if (action === "create") {
29625
- expectNoUnknownOptions(parsedArgv, ["auth-file", "json", "label"]);
29906
+ expectNoUnknownOptions(parsedArgv, ["auth-file", "json", "label", "allowed-origin"]);
29626
29907
  ensureNoExtraPositionals(parsedArgv, 4);
29627
29908
  const label = readStringOption(parsedArgv, "label");
29628
29909
  if (label === void 0) {
29629
29910
  throw new CliInputError("Missing required option --label.");
29630
29911
  }
29912
+ const allowedOrigins = readStringListOption(parsedArgv, "allowed-origin");
29631
29913
  return await (dependencies.createProjectTokenCommand ?? createProjectTokenWithAuthCommand)(
29632
29914
  appendCommonAuthOptions(parsedArgv, {
29633
29915
  projectId: requirePositional(parsedArgv, 3, "project-id"),
29634
- label
29916
+ label,
29917
+ ...allowedOrigins === void 0 ? {} : { allowedOrigins }
29635
29918
  })
29636
29919
  );
29637
29920
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@debugbundle/cli",
3
- "version": "0.1.8",
3
+ "version": "0.1.9",
4
4
  "private": false,
5
5
  "description": "Command-line interface for DebugBundle",
6
6
  "license": "AGPL-3.0-only",