@debugbundle/cli 1.18.0 → 1.18.2

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 (3) hide show
  1. package/README.md +10 -0
  2. package/dist/main.cjs +34 -7
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -1,5 +1,15 @@
1
1
  # @debugbundle/cli
2
2
 
3
+ Connected `doctor` diagnostics check API health and saved member authentication with a one-incident probe restricted to `cloud_project_id`. Missing or blank connected project scope fails before any request. Incident contents are discarded and are not included in the report. Local-only diagnostics make no cloud request.
4
+
5
+ In a connected workspace, `debugbundle incidents` and `--source cloud` default
6
+ their cloud requests to the connection's `cloud_project_id`. `--project-id <id>`
7
+ overrides that default. All cloud pages retain the selected project; local
8
+ evidence keeps its existing selection. An unusable connected project returns
9
+ `invalid_local_connection_config` before a list request: pass the intended
10
+ `--project-id` or repair the connection. Account-wide reads remain supported
11
+ outside a connected workspace.
12
+
3
13
  Command-line interface for DebugBundle.
4
14
 
5
15
  Notification preferences support account and project scopes, personal email or shared
package/dist/main.cjs CHANGED
@@ -61852,7 +61852,8 @@ function parseLocalConnection(candidate) {
61852
61852
  throw createReadError(400, "invalid_local_connection_config");
61853
61853
  }
61854
61854
  return {
61855
- mode: candidate["mode"]
61855
+ mode: candidate["mode"],
61856
+ ...candidate["cloud_project_id"] === void 0 ? {} : { cloud_project_id: candidate["cloud_project_id"] }
61856
61857
  };
61857
61858
  }
61858
61859
  function parseLocalIncident(candidate) {
@@ -61987,6 +61988,19 @@ async function readLocalConnectionConfig(dependencies) {
61987
61988
  throw error62;
61988
61989
  }
61989
61990
  }
61991
+ var IncidentProjectIdSchema = external_exports.string().trim().min(1);
61992
+ async function resolveCloudIncidentProjectId(projectId, dependencies) {
61993
+ if (projectId !== void 0) {
61994
+ const parsed2 = IncidentProjectIdSchema.safeParse(projectId);
61995
+ if (!parsed2.success) throw createReadError(400, "invalid_project_id");
61996
+ return parsed2.data;
61997
+ }
61998
+ const connection = await readLocalConnectionConfig(dependencies);
61999
+ if (connection?.mode !== "connected") return void 0;
62000
+ const parsed = IncidentProjectIdSchema.safeParse(connection.cloud_project_id);
62001
+ if (!parsed.success) throw createReadError(400, "invalid_local_connection_config");
62002
+ return parsed.data;
62003
+ }
61990
62004
  async function readLocalState(dependencies) {
61991
62005
  const rootDirectory = getWorkspaceRoot(dependencies);
61992
62006
  try {
@@ -65096,6 +65110,14 @@ async function buildConnectedApiCheck(input3) {
65096
65110
  if (input3.connection === null || input3.connection.mode !== "connected") {
65097
65111
  return null;
65098
65112
  }
65113
+ const projectId = input3.connection.cloud_project_id?.trim();
65114
+ if (!projectId) {
65115
+ return {
65116
+ name: "connected-api",
65117
+ status: "error",
65118
+ message: `Invalid connected project scope in ${CONNECTION_FILE_PATH}; run debugbundle connect before verifying member-token auth.`
65119
+ };
65120
+ }
65099
65121
  const connectionBaseUrl = input3.connection.cloud_base_url === null ? null : normalizeBaseUrl3(input3.connection.cloud_base_url);
65100
65122
  const authBaseUrl = input3.authState === null ? null : normalizeBaseUrl3(input3.authState.base_url);
65101
65123
  const baseUrl = authBaseUrl ?? connectionBaseUrl;
@@ -65145,7 +65167,8 @@ async function buildConnectedApiCheck(input3) {
65145
65167
  }
65146
65168
  let incidentsResponse;
65147
65169
  try {
65148
- incidentsResponse = await input3.fetchImpl(`${baseUrl}/v1/incidents?limit=1`, {
65170
+ const query = new URLSearchParams({ limit: "1", project_id: projectId });
65171
+ incidentsResponse = await input3.fetchImpl(`${baseUrl}/v1/incidents?${query}`, {
65149
65172
  method: "GET",
65150
65173
  headers: {
65151
65174
  accept: "application/json",
@@ -70151,10 +70174,11 @@ async function mapCombinedIncidentListResult(input3, api, dependencies) {
70151
70174
  },
70152
70175
  dependencies
70153
70176
  );
70177
+ const cloudProjectId = await resolveCloudIncidentProjectId(input3.projectId, dependencies);
70154
70178
  const cloudIncidents = await listAllCloudIncidents(
70155
70179
  {
70156
70180
  bearerToken: input3.bearerToken,
70157
- ...input3.projectId === void 0 ? {} : { projectId: input3.projectId },
70181
+ ...cloudProjectId === void 0 ? {} : { projectId: cloudProjectId },
70158
70182
  ...input3.environment === void 0 ? {} : { environment: input3.environment },
70159
70183
  ...input3.service === void 0 ? {} : { service: input3.service },
70160
70184
  ...input3.status === void 0 ? {} : { status: input3.status },
@@ -70288,12 +70312,15 @@ async function listIncidentsWithAuthCommand(input3, dependencies) {
70288
70312
  return runAuthenticatedCliCommand(input3, {
70289
70313
  createApi: createAuthenticatedRetrievalApi,
70290
70314
  dependencies,
70291
- runCommand: (authState, api) => {
70315
+ runCommand: async (authState, api) => {
70292
70316
  const commandInput = {
70293
70317
  bearerToken: authState.bearer_token
70294
70318
  };
70295
- if (input3.projectId !== void 0) {
70296
- commandInput.projectId = input3.projectId;
70319
+ try {
70320
+ const projectId = await resolveCloudIncidentProjectId(input3.projectId, dependencies);
70321
+ if (projectId !== void 0) commandInput.projectId = projectId;
70322
+ } catch (error62) {
70323
+ return mapErrorToResult(error62);
70297
70324
  }
70298
70325
  if (input3.environment !== void 0) {
70299
70326
  commandInput.environment = input3.environment;
@@ -81188,7 +81215,7 @@ async function handleCaptureRuleCommand2(parsedArgv, dependencies) {
81188
81215
  // package.json
81189
81216
  var package_default = {
81190
81217
  name: "@debugbundle/cli",
81191
- version: "1.18.0",
81218
+ version: "1.18.2",
81192
81219
  private: false,
81193
81220
  description: "Command-line interface for DebugBundle",
81194
81221
  license: "Apache-2.0",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@debugbundle/cli",
3
- "version": "1.18.0",
3
+ "version": "1.18.2",
4
4
  "private": false,
5
5
  "description": "Command-line interface for DebugBundle",
6
6
  "license": "Apache-2.0",