@debugbundle/cli 0.1.6 → 0.1.8
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.
- package/dist/main.cjs +1239 -244
- package/package.json +1 -1
package/dist/main.cjs
CHANGED
|
@@ -14507,6 +14507,7 @@ var CapturePolicyOverridesSchema = external_exports.object({
|
|
|
14507
14507
|
immediate_client_error_statuses: ImmediateClientErrorStatusesSchema.nullable()
|
|
14508
14508
|
});
|
|
14509
14509
|
var CapturePolicyResponseSchema = external_exports.object({
|
|
14510
|
+
access_mode: external_exports.enum(["manage", "preview"]),
|
|
14510
14511
|
policy: ResolvedCapturePolicySchema,
|
|
14511
14512
|
overrides: CapturePolicyOverridesSchema
|
|
14512
14513
|
});
|
|
@@ -14604,6 +14605,29 @@ function getRequestAnomalyThreshold(input) {
|
|
|
14604
14605
|
return null;
|
|
14605
14606
|
}
|
|
14606
14607
|
|
|
14608
|
+
// ../../packages/shared-types/src/improvement-settings.ts
|
|
14609
|
+
var ImprovementBundleSensitivityValues = [
|
|
14610
|
+
"high_confidence",
|
|
14611
|
+
"balanced",
|
|
14612
|
+
"verbose"
|
|
14613
|
+
];
|
|
14614
|
+
var ImprovementBundleSensitivitySchema = external_exports.enum(ImprovementBundleSensitivityValues);
|
|
14615
|
+
var ImprovementSettingsSchema = external_exports.object({
|
|
14616
|
+
automated_improvement_bundles_enabled: external_exports.boolean(),
|
|
14617
|
+
improvement_bundle_sensitivity: ImprovementBundleSensitivitySchema
|
|
14618
|
+
});
|
|
14619
|
+
var ImprovementSettingsResponseSchema = external_exports.object({
|
|
14620
|
+
access_mode: external_exports.enum(["manage", "preview"]),
|
|
14621
|
+
cloud_automation_available: external_exports.boolean(),
|
|
14622
|
+
settings: ImprovementSettingsSchema
|
|
14623
|
+
});
|
|
14624
|
+
var ImprovementSettingsUpdateSchema = external_exports.object({
|
|
14625
|
+
automated_improvement_bundles_enabled: external_exports.boolean().optional(),
|
|
14626
|
+
improvement_bundle_sensitivity: ImprovementBundleSensitivitySchema.optional()
|
|
14627
|
+
}).refine((input) => Object.keys(input).length > 0, {
|
|
14628
|
+
message: "At least one improvement settings field must be provided."
|
|
14629
|
+
});
|
|
14630
|
+
|
|
14607
14631
|
// ../../packages/shared-types/src/index.ts
|
|
14608
14632
|
function createUuidV4() {
|
|
14609
14633
|
const cryptoSource = globalThis.crypto;
|
|
@@ -15802,6 +15826,34 @@ var IncidentSchema = external_exports.object({
|
|
|
15802
15826
|
matched_fields: external_exports.array(external_exports.string()),
|
|
15803
15827
|
incident_reason: IncidentReasonSchema.optional()
|
|
15804
15828
|
}).strict();
|
|
15829
|
+
var ImprovementSchema = external_exports.object({
|
|
15830
|
+
improvement_id: external_exports.string(),
|
|
15831
|
+
project_id: external_exports.string(),
|
|
15832
|
+
project_name: external_exports.string(),
|
|
15833
|
+
project_slug: external_exports.string(),
|
|
15834
|
+
service_id: external_exports.string().nullable(),
|
|
15835
|
+
service_name: external_exports.string(),
|
|
15836
|
+
service_runtime: external_exports.string().nullable(),
|
|
15837
|
+
service_framework: external_exports.string().nullable(),
|
|
15838
|
+
environment: external_exports.string(),
|
|
15839
|
+
kind: external_exports.enum(["warning_hotspot", "slow_request", "request_failure_pattern", "recurring_incident", "post_deploy_regression"]),
|
|
15840
|
+
status: external_exports.enum(["open", "resolved", "snoozed"]),
|
|
15841
|
+
severity: external_exports.enum(["low", "medium", "high", "critical"]),
|
|
15842
|
+
confidence: external_exports.number(),
|
|
15843
|
+
fingerprint: external_exports.string(),
|
|
15844
|
+
title: external_exports.string(),
|
|
15845
|
+
summary: external_exports.string(),
|
|
15846
|
+
occurrence_count: external_exports.number().int(),
|
|
15847
|
+
evidence: external_exports.record(external_exports.unknown()),
|
|
15848
|
+
first_detected_at: external_exports.string(),
|
|
15849
|
+
last_detected_at: external_exports.string(),
|
|
15850
|
+
resolved_at: external_exports.string().nullable(),
|
|
15851
|
+
snoozed_until: external_exports.string().nullable(),
|
|
15852
|
+
bundle_generation_number: external_exports.number().int(),
|
|
15853
|
+
bundle_created_at: external_exports.string().nullable(),
|
|
15854
|
+
bundle_updated_at: external_exports.string().nullable(),
|
|
15855
|
+
bundle_failure_reason: external_exports.string().nullable()
|
|
15856
|
+
}).strict();
|
|
15805
15857
|
var ServiceSchema3 = external_exports.object({
|
|
15806
15858
|
service_id: external_exports.string(),
|
|
15807
15859
|
project_id: external_exports.string(),
|
|
@@ -15824,6 +15876,9 @@ var IncidentsResponseSchema = external_exports.object({
|
|
|
15824
15876
|
var IncidentResponseSchema = external_exports.object({
|
|
15825
15877
|
incident: IncidentSchema
|
|
15826
15878
|
}).strict();
|
|
15879
|
+
var ImprovementResponseSchema = external_exports.object({
|
|
15880
|
+
improvement: ImprovementSchema
|
|
15881
|
+
}).strict();
|
|
15827
15882
|
var IncidentContextArtifactSchema = external_exports.object({
|
|
15828
15883
|
status: external_exports.enum(["ready", "pending", "failed"]),
|
|
15829
15884
|
body: external_exports.unknown().optional(),
|
|
@@ -15894,6 +15949,10 @@ var IncidentContextSchema = external_exports.object({
|
|
|
15894
15949
|
var ServicesResponseSchema = external_exports.object({
|
|
15895
15950
|
services: external_exports.array(ServiceSchema3)
|
|
15896
15951
|
}).strict();
|
|
15952
|
+
var ImprovementsResponseSchema = external_exports.object({
|
|
15953
|
+
improvements: external_exports.array(ImprovementSchema),
|
|
15954
|
+
next_cursor: external_exports.string().nullable().optional()
|
|
15955
|
+
}).strict();
|
|
15897
15956
|
var LogsResponseSchema = external_exports.object({
|
|
15898
15957
|
logs: external_exports.array(LogSchema),
|
|
15899
15958
|
next_cursor: external_exports.string().nullable().optional()
|
|
@@ -16092,6 +16151,108 @@ function createRetrievalApi(client) {
|
|
|
16092
16151
|
bearerToken: input.bearerToken
|
|
16093
16152
|
})
|
|
16094
16153
|
);
|
|
16154
|
+
},
|
|
16155
|
+
async listImprovements(input) {
|
|
16156
|
+
const query = new URLSearchParams();
|
|
16157
|
+
if (input.projectId !== void 0) {
|
|
16158
|
+
query.set("project_id", input.projectId);
|
|
16159
|
+
}
|
|
16160
|
+
if (input.environment !== void 0) {
|
|
16161
|
+
query.set("environment", input.environment);
|
|
16162
|
+
}
|
|
16163
|
+
if (input.service !== void 0) {
|
|
16164
|
+
query.set("service", input.service);
|
|
16165
|
+
}
|
|
16166
|
+
if (input.status !== void 0) {
|
|
16167
|
+
query.set("status", input.status);
|
|
16168
|
+
}
|
|
16169
|
+
if (input.severity !== void 0) {
|
|
16170
|
+
query.set("severity", input.severity);
|
|
16171
|
+
}
|
|
16172
|
+
if (input.kind !== void 0) {
|
|
16173
|
+
query.set("kind", input.kind);
|
|
16174
|
+
}
|
|
16175
|
+
if (input.cursor !== void 0) {
|
|
16176
|
+
query.set("cursor", input.cursor);
|
|
16177
|
+
}
|
|
16178
|
+
if (input.limit !== void 0) {
|
|
16179
|
+
query.set("limit", String(input.limit));
|
|
16180
|
+
}
|
|
16181
|
+
const path = query.size > 0 ? `/v1/improvements?${query.toString()}` : "/v1/improvements";
|
|
16182
|
+
const parsed = await expectParsed(
|
|
16183
|
+
client.request({
|
|
16184
|
+
method: "GET",
|
|
16185
|
+
path,
|
|
16186
|
+
bearerToken: input.bearerToken
|
|
16187
|
+
}),
|
|
16188
|
+
ImprovementsResponseSchema
|
|
16189
|
+
);
|
|
16190
|
+
return {
|
|
16191
|
+
improvements: parsed.improvements,
|
|
16192
|
+
next_cursor: parsed.next_cursor ?? null
|
|
16193
|
+
};
|
|
16194
|
+
},
|
|
16195
|
+
async getImprovement(input) {
|
|
16196
|
+
const parsed = await expectParsed(
|
|
16197
|
+
client.request({
|
|
16198
|
+
method: "GET",
|
|
16199
|
+
path: `/v1/improvements/${input.improvementId}`,
|
|
16200
|
+
bearerToken: input.bearerToken
|
|
16201
|
+
}),
|
|
16202
|
+
ImprovementResponseSchema
|
|
16203
|
+
);
|
|
16204
|
+
return parsed.improvement;
|
|
16205
|
+
},
|
|
16206
|
+
async resolveImprovement(input) {
|
|
16207
|
+
const parsed = await expectParsed(
|
|
16208
|
+
client.request({
|
|
16209
|
+
method: "POST",
|
|
16210
|
+
path: `/v1/improvements/${input.improvementId}/resolve`,
|
|
16211
|
+
bearerToken: input.bearerToken
|
|
16212
|
+
}),
|
|
16213
|
+
ImprovementResponseSchema
|
|
16214
|
+
);
|
|
16215
|
+
return parsed.improvement;
|
|
16216
|
+
},
|
|
16217
|
+
async reopenImprovement(input) {
|
|
16218
|
+
const parsed = await expectParsed(
|
|
16219
|
+
client.request({
|
|
16220
|
+
method: "POST",
|
|
16221
|
+
path: `/v1/improvements/${input.improvementId}/reopen`,
|
|
16222
|
+
bearerToken: input.bearerToken
|
|
16223
|
+
}),
|
|
16224
|
+
ImprovementResponseSchema
|
|
16225
|
+
);
|
|
16226
|
+
return parsed.improvement;
|
|
16227
|
+
},
|
|
16228
|
+
async snoozeImprovement(input) {
|
|
16229
|
+
const parsed = await expectParsed(
|
|
16230
|
+
client.request({
|
|
16231
|
+
method: "POST",
|
|
16232
|
+
path: `/v1/improvements/${input.improvementId}/snooze`,
|
|
16233
|
+
bearerToken: input.bearerToken,
|
|
16234
|
+
body: { snoozed_until: input.snoozedUntil }
|
|
16235
|
+
}),
|
|
16236
|
+
ImprovementResponseSchema
|
|
16237
|
+
);
|
|
16238
|
+
return parsed.improvement;
|
|
16239
|
+
},
|
|
16240
|
+
async getImprovementBundle(input) {
|
|
16241
|
+
return await expectParsed(
|
|
16242
|
+
client.request({
|
|
16243
|
+
method: "GET",
|
|
16244
|
+
path: `/v1/projects/${input.projectId}/improvements/${input.improvementId}/bundle`,
|
|
16245
|
+
bearerToken: input.bearerToken
|
|
16246
|
+
}),
|
|
16247
|
+
external_exports.union([
|
|
16248
|
+
PendingStatusSchema,
|
|
16249
|
+
BundleSchema,
|
|
16250
|
+
external_exports.object({
|
|
16251
|
+
status: external_exports.literal("failed"),
|
|
16252
|
+
reason: external_exports.string()
|
|
16253
|
+
}).strict()
|
|
16254
|
+
])
|
|
16255
|
+
);
|
|
16095
16256
|
}
|
|
16096
16257
|
};
|
|
16097
16258
|
}
|
|
@@ -16740,6 +16901,181 @@ var STORAGE_SCHEMA_MIGRATIONS = [
|
|
|
16740
16901
|
statements: [
|
|
16741
16902
|
"ALTER TABLE capture_policies ADD COLUMN IF NOT EXISTS immediate_client_error_statuses jsonb"
|
|
16742
16903
|
]
|
|
16904
|
+
}),
|
|
16905
|
+
defineStorageSchemaMigration({
|
|
16906
|
+
id: "202605150001_add_user_avatar_columns",
|
|
16907
|
+
description: "Add cached user avatar metadata for GitHub and Gravatar profile images.",
|
|
16908
|
+
statements: [
|
|
16909
|
+
"ALTER TABLE users ADD COLUMN IF NOT EXISTS avatar_source text",
|
|
16910
|
+
"ALTER TABLE users ADD COLUMN IF NOT EXISTS avatar_object_key text",
|
|
16911
|
+
"ALTER TABLE users ADD COLUMN IF NOT EXISTS avatar_content_type text",
|
|
16912
|
+
"ALTER TABLE users ADD COLUMN IF NOT EXISTS avatar_updated_at timestamptz"
|
|
16913
|
+
]
|
|
16914
|
+
}),
|
|
16915
|
+
defineStorageSchemaMigration({
|
|
16916
|
+
id: "202605170001_add_alert_email_digest_queue",
|
|
16917
|
+
description: "Add queued email alert digests and digest items for fixed-window alert batching.",
|
|
16918
|
+
statements: [
|
|
16919
|
+
`
|
|
16920
|
+
CREATE TABLE IF NOT EXISTS alert_email_digests (
|
|
16921
|
+
id uuid PRIMARY KEY,
|
|
16922
|
+
project_id uuid NOT NULL REFERENCES projects(id) ON DELETE CASCADE,
|
|
16923
|
+
recipient text NOT NULL,
|
|
16924
|
+
status text NOT NULL,
|
|
16925
|
+
next_attempt_at timestamptz,
|
|
16926
|
+
claimed_at timestamptz,
|
|
16927
|
+
last_error text,
|
|
16928
|
+
delivered_at timestamptz,
|
|
16929
|
+
created_at timestamptz NOT NULL DEFAULT now(),
|
|
16930
|
+
updated_at timestamptz NOT NULL DEFAULT now()
|
|
16931
|
+
)
|
|
16932
|
+
`,
|
|
16933
|
+
`
|
|
16934
|
+
CREATE UNIQUE INDEX IF NOT EXISTS alert_email_digests_project_recipient_pending_idx
|
|
16935
|
+
ON alert_email_digests (project_id, recipient)
|
|
16936
|
+
WHERE status = 'pending' AND claimed_at IS NULL
|
|
16937
|
+
`,
|
|
16938
|
+
`
|
|
16939
|
+
CREATE INDEX IF NOT EXISTS alert_email_digests_status_next_attempt_idx
|
|
16940
|
+
ON alert_email_digests (status, next_attempt_at)
|
|
16941
|
+
`,
|
|
16942
|
+
`
|
|
16943
|
+
CREATE TABLE IF NOT EXISTS alert_email_digest_items (
|
|
16944
|
+
id uuid PRIMARY KEY,
|
|
16945
|
+
digest_id uuid NOT NULL REFERENCES alert_email_digests(id) ON DELETE CASCADE,
|
|
16946
|
+
alert_id uuid NOT NULL REFERENCES alert_rules(id) ON DELETE CASCADE,
|
|
16947
|
+
project_id uuid NOT NULL REFERENCES projects(id) ON DELETE CASCADE,
|
|
16948
|
+
incident_id uuid NOT NULL REFERENCES incidents(id) ON DELETE CASCADE,
|
|
16949
|
+
condition_type text NOT NULL,
|
|
16950
|
+
dedupe_key text NOT NULL,
|
|
16951
|
+
payload jsonb NOT NULL,
|
|
16952
|
+
created_at timestamptz NOT NULL DEFAULT now(),
|
|
16953
|
+
UNIQUE (alert_id, incident_id, dedupe_key)
|
|
16954
|
+
)
|
|
16955
|
+
`,
|
|
16956
|
+
`
|
|
16957
|
+
CREATE INDEX IF NOT EXISTS alert_email_digest_items_digest_created_idx
|
|
16958
|
+
ON alert_email_digest_items (digest_id, created_at ASC)
|
|
16959
|
+
`
|
|
16960
|
+
]
|
|
16961
|
+
}),
|
|
16962
|
+
defineStorageSchemaMigration({
|
|
16963
|
+
id: "202605180001_add_skipped_github_dispatch_status",
|
|
16964
|
+
description: "Allow GitHub dispatch delivery history to record rate-limited skips without retrying them.",
|
|
16965
|
+
statements: [
|
|
16966
|
+
"ALTER TABLE github_dispatch_deliveries DROP CONSTRAINT IF EXISTS github_dispatch_deliveries_status_check",
|
|
16967
|
+
"ALTER TABLE github_dispatch_deliveries ADD CONSTRAINT github_dispatch_deliveries_status_check CHECK (status IN ('pending', 'retrying', 'delivered', 'failed', 'skipped'))"
|
|
16968
|
+
]
|
|
16969
|
+
}),
|
|
16970
|
+
defineStorageSchemaMigration({
|
|
16971
|
+
id: "202605180002_add_project_improvement_settings",
|
|
16972
|
+
description: "Add project-level automated improvement settings columns.",
|
|
16973
|
+
statements: [
|
|
16974
|
+
"ALTER TABLE projects ADD COLUMN IF NOT EXISTS automated_improvement_bundles_enabled boolean NOT NULL DEFAULT true",
|
|
16975
|
+
"ALTER TABLE projects ADD COLUMN IF NOT EXISTS improvement_bundle_sensitivity text NOT NULL DEFAULT 'balanced'",
|
|
16976
|
+
`
|
|
16977
|
+
ALTER TABLE projects
|
|
16978
|
+
DROP CONSTRAINT IF EXISTS projects_improvement_bundle_sensitivity_check
|
|
16979
|
+
`,
|
|
16980
|
+
`
|
|
16981
|
+
ALTER TABLE projects
|
|
16982
|
+
ADD CONSTRAINT projects_improvement_bundle_sensitivity_check
|
|
16983
|
+
CHECK (improvement_bundle_sensitivity IN ('high_confidence', 'balanced', 'verbose'))
|
|
16984
|
+
`
|
|
16985
|
+
]
|
|
16986
|
+
}),
|
|
16987
|
+
defineStorageSchemaMigration({
|
|
16988
|
+
id: "202605180003_add_improvement_opportunities_and_bundle_generation_shape",
|
|
16989
|
+
description: "Add hosted improvement opportunity storage and allow bundle generations to reference improvements directly.",
|
|
16990
|
+
statements: [
|
|
16991
|
+
`
|
|
16992
|
+
CREATE TABLE IF NOT EXISTS improvement_opportunities (
|
|
16993
|
+
id uuid PRIMARY KEY,
|
|
16994
|
+
project_id uuid NOT NULL REFERENCES projects(id) ON DELETE CASCADE,
|
|
16995
|
+
service_id uuid REFERENCES services(id) ON DELETE SET NULL,
|
|
16996
|
+
service_name text NOT NULL,
|
|
16997
|
+
environment text NOT NULL DEFAULT 'production',
|
|
16998
|
+
kind text NOT NULL,
|
|
16999
|
+
status text NOT NULL DEFAULT 'open',
|
|
17000
|
+
severity text NOT NULL,
|
|
17001
|
+
confidence numeric NOT NULL,
|
|
17002
|
+
fingerprint text NOT NULL,
|
|
17003
|
+
title text NOT NULL,
|
|
17004
|
+
summary text NOT NULL,
|
|
17005
|
+
occurrence_count integer NOT NULL DEFAULT 1,
|
|
17006
|
+
evidence jsonb NOT NULL,
|
|
17007
|
+
first_detected_at timestamptz NOT NULL,
|
|
17008
|
+
last_detected_at timestamptz NOT NULL,
|
|
17009
|
+
last_source_event_id uuid,
|
|
17010
|
+
related_incident_ids uuid[] NOT NULL DEFAULT '{}',
|
|
17011
|
+
bundle_generation_number integer NOT NULL DEFAULT 0,
|
|
17012
|
+
bundle_created_at timestamptz,
|
|
17013
|
+
bundle_updated_at timestamptz,
|
|
17014
|
+
bundle_source_event_id uuid,
|
|
17015
|
+
bundle_failure_reason text,
|
|
17016
|
+
resolved_at timestamptz,
|
|
17017
|
+
resolved_by_user_id uuid REFERENCES users(id) ON DELETE SET NULL,
|
|
17018
|
+
snoozed_until timestamptz,
|
|
17019
|
+
created_at timestamptz NOT NULL DEFAULT now(),
|
|
17020
|
+
updated_at timestamptz NOT NULL DEFAULT now(),
|
|
17021
|
+
UNIQUE (project_id, fingerprint)
|
|
17022
|
+
)
|
|
17023
|
+
`,
|
|
17024
|
+
`
|
|
17025
|
+
CREATE INDEX IF NOT EXISTS improvement_opportunities_project_status_detected_idx
|
|
17026
|
+
ON improvement_opportunities (project_id, status, last_detected_at DESC)
|
|
17027
|
+
`,
|
|
17028
|
+
`
|
|
17029
|
+
CREATE INDEX IF NOT EXISTS improvement_opportunities_project_kind_detected_idx
|
|
17030
|
+
ON improvement_opportunities (project_id, kind, last_detected_at DESC)
|
|
17031
|
+
`,
|
|
17032
|
+
`
|
|
17033
|
+
CREATE INDEX IF NOT EXISTS improvement_opportunities_project_service_env_idx
|
|
17034
|
+
ON improvement_opportunities (project_id, service_id, environment)
|
|
17035
|
+
`,
|
|
17036
|
+
`
|
|
17037
|
+
CREATE TABLE IF NOT EXISTS improvement_opportunity_events (
|
|
17038
|
+
improvement_opportunity_id uuid NOT NULL REFERENCES improvement_opportunities(id) ON DELETE CASCADE,
|
|
17039
|
+
event_id uuid NOT NULL,
|
|
17040
|
+
event_type text NOT NULL,
|
|
17041
|
+
occurred_at timestamptz NOT NULL,
|
|
17042
|
+
PRIMARY KEY (improvement_opportunity_id, event_id)
|
|
17043
|
+
)
|
|
17044
|
+
`,
|
|
17045
|
+
`
|
|
17046
|
+
CREATE INDEX IF NOT EXISTS improvement_opportunity_events_detected_idx
|
|
17047
|
+
ON improvement_opportunity_events (improvement_opportunity_id, occurred_at DESC, event_id DESC)
|
|
17048
|
+
`,
|
|
17049
|
+
"ALTER TABLE bundle_generations ALTER COLUMN incident_id DROP NOT NULL",
|
|
17050
|
+
"ALTER TABLE bundle_generations ADD COLUMN IF NOT EXISTS improvement_opportunity_id uuid REFERENCES improvement_opportunities(id) ON DELETE CASCADE",
|
|
17051
|
+
"ALTER TABLE bundle_generations DROP CONSTRAINT IF EXISTS bundle_generations_incident_id_source_event_id_key",
|
|
17052
|
+
"DROP INDEX IF EXISTS bundle_generations_incident_source_idx",
|
|
17053
|
+
"DROP INDEX IF EXISTS bundle_generations_improvement_source_idx",
|
|
17054
|
+
`
|
|
17055
|
+
CREATE UNIQUE INDEX IF NOT EXISTS bundle_generations_incident_source_idx
|
|
17056
|
+
ON bundle_generations (incident_id, source_event_id)
|
|
17057
|
+
WHERE incident_id IS NOT NULL
|
|
17058
|
+
`,
|
|
17059
|
+
`
|
|
17060
|
+
CREATE UNIQUE INDEX IF NOT EXISTS bundle_generations_improvement_source_idx
|
|
17061
|
+
ON bundle_generations (improvement_opportunity_id, source_event_id)
|
|
17062
|
+
WHERE improvement_opportunity_id IS NOT NULL
|
|
17063
|
+
`,
|
|
17064
|
+
"DROP INDEX IF EXISTS bundle_generations_improvement_generation_idx",
|
|
17065
|
+
`
|
|
17066
|
+
CREATE INDEX IF NOT EXISTS bundle_generations_improvement_generation_idx
|
|
17067
|
+
ON bundle_generations (improvement_opportunity_id, generation_number DESC)
|
|
17068
|
+
WHERE improvement_opportunity_id IS NOT NULL
|
|
17069
|
+
`,
|
|
17070
|
+
"ALTER TABLE bundle_generations DROP CONSTRAINT IF EXISTS bundle_generations_owner_check",
|
|
17071
|
+
`
|
|
17072
|
+
ALTER TABLE bundle_generations
|
|
17073
|
+
ADD CONSTRAINT bundle_generations_owner_check CHECK (
|
|
17074
|
+
(incident_id IS NOT NULL AND improvement_opportunity_id IS NULL AND bundle_type = 'failure')
|
|
17075
|
+
OR (incident_id IS NULL AND improvement_opportunity_id IS NOT NULL AND bundle_type = 'improvement')
|
|
17076
|
+
)
|
|
17077
|
+
`
|
|
17078
|
+
]
|
|
16743
17079
|
})
|
|
16744
17080
|
];
|
|
16745
17081
|
|
|
@@ -17495,6 +17831,11 @@ var ProjectMetricsSchema = external_exports.object({
|
|
|
17495
17831
|
var ProjectRecordSchema = external_exports.object({
|
|
17496
17832
|
project_id: external_exports.string(),
|
|
17497
17833
|
organization_id: external_exports.string(),
|
|
17834
|
+
owner_user_id: external_exports.string(),
|
|
17835
|
+
owner_email: external_exports.string().email(),
|
|
17836
|
+
relationship: external_exports.enum(["owned", "shared"]),
|
|
17837
|
+
sharing_state: external_exports.enum(["private", "shared_by_you", "shared_with_you"]),
|
|
17838
|
+
effective_role: external_exports.enum(["owner", "admin", "member"]),
|
|
17498
17839
|
name: external_exports.string(),
|
|
17499
17840
|
slug: external_exports.string(),
|
|
17500
17841
|
environment_default: external_exports.string(),
|
|
@@ -17512,6 +17853,11 @@ var ProjectCreateResponseSchema = external_exports.object({
|
|
|
17512
17853
|
var DeletedProjectRecordSchema = external_exports.object({
|
|
17513
17854
|
project_id: external_exports.string(),
|
|
17514
17855
|
organization_id: external_exports.string(),
|
|
17856
|
+
owner_user_id: external_exports.string(),
|
|
17857
|
+
owner_email: external_exports.string().email(),
|
|
17858
|
+
relationship: external_exports.enum(["owned", "shared"]),
|
|
17859
|
+
sharing_state: external_exports.enum(["private", "shared_by_you", "shared_with_you"]),
|
|
17860
|
+
effective_role: external_exports.enum(["owner", "admin", "member"]),
|
|
17515
17861
|
name: external_exports.string(),
|
|
17516
17862
|
slug: external_exports.string(),
|
|
17517
17863
|
environment_default: external_exports.string(),
|
|
@@ -17844,6 +18190,7 @@ var AlertConditionTypeSchema = external_exports.enum([
|
|
|
17844
18190
|
var AlertSchema = external_exports.object({
|
|
17845
18191
|
alert_id: external_exports.string(),
|
|
17846
18192
|
project_id: external_exports.string(),
|
|
18193
|
+
created_by_user_id: external_exports.string(),
|
|
17847
18194
|
service_id: external_exports.string().nullable(),
|
|
17848
18195
|
channel: AlertChannelSchema,
|
|
17849
18196
|
condition_type: AlertConditionTypeSchema,
|
|
@@ -17969,7 +18316,7 @@ function createAlertApi(client) {
|
|
|
17969
18316
|
return expectAlert(
|
|
17970
18317
|
client.request({
|
|
17971
18318
|
method: "PATCH",
|
|
17972
|
-
path: `/v1/alerts/${input.alertId}`,
|
|
18319
|
+
path: `/v1/alerts/${input.alertId}${buildQuery({ project_id: input.projectId })}`,
|
|
17973
18320
|
bearerToken: input.bearerToken,
|
|
17974
18321
|
body
|
|
17975
18322
|
})
|
|
@@ -17978,7 +18325,7 @@ function createAlertApi(client) {
|
|
|
17978
18325
|
async deleteAlert(input) {
|
|
17979
18326
|
const response = await client.request({
|
|
17980
18327
|
method: "DELETE",
|
|
17981
|
-
path: `/v1/alerts/${input.alertId}`,
|
|
18328
|
+
path: `/v1/alerts/${input.alertId}${buildQuery({ project_id: input.projectId })}`,
|
|
17982
18329
|
bearerToken: input.bearerToken
|
|
17983
18330
|
});
|
|
17984
18331
|
if (response.status < 200 || response.status >= 300) {
|
|
@@ -18061,6 +18408,7 @@ var WebhookFiltersSchema = external_exports.object({
|
|
|
18061
18408
|
var WebhookSchema = external_exports.object({
|
|
18062
18409
|
webhook_id: external_exports.string(),
|
|
18063
18410
|
project_id: external_exports.string(),
|
|
18411
|
+
created_by_user_id: external_exports.string(),
|
|
18064
18412
|
url: external_exports.string(),
|
|
18065
18413
|
events: external_exports.array(WebhookEventTypeSchema),
|
|
18066
18414
|
filters: WebhookFiltersSchema,
|
|
@@ -18231,7 +18579,7 @@ function createWebhookApi(client) {
|
|
|
18231
18579
|
return expectWebhook(
|
|
18232
18580
|
client.request({
|
|
18233
18581
|
method: "GET",
|
|
18234
|
-
path: `/v1/webhooks/${input.webhookId}`,
|
|
18582
|
+
path: `/v1/webhooks/${input.webhookId}${buildQuery2({ project_id: input.projectId })}`,
|
|
18235
18583
|
bearerToken: input.bearerToken
|
|
18236
18584
|
})
|
|
18237
18585
|
);
|
|
@@ -18253,7 +18601,7 @@ function createWebhookApi(client) {
|
|
|
18253
18601
|
return expectWebhook(
|
|
18254
18602
|
client.request({
|
|
18255
18603
|
method: "PATCH",
|
|
18256
|
-
path: `/v1/webhooks/${input.webhookId}`,
|
|
18604
|
+
path: `/v1/webhooks/${input.webhookId}${buildQuery2({ project_id: input.projectId })}`,
|
|
18257
18605
|
bearerToken: input.bearerToken,
|
|
18258
18606
|
body
|
|
18259
18607
|
})
|
|
@@ -18262,7 +18610,7 @@ function createWebhookApi(client) {
|
|
|
18262
18610
|
async deleteWebhook(input) {
|
|
18263
18611
|
const response = await client.request({
|
|
18264
18612
|
method: "DELETE",
|
|
18265
|
-
path: `/v1/webhooks/${input.webhookId}`,
|
|
18613
|
+
path: `/v1/webhooks/${input.webhookId}${buildQuery2({ project_id: input.projectId })}`,
|
|
18266
18614
|
bearerToken: input.bearerToken
|
|
18267
18615
|
});
|
|
18268
18616
|
if (response.status < 200 || response.status >= 300) {
|
|
@@ -18280,7 +18628,7 @@ function createWebhookApi(client) {
|
|
|
18280
18628
|
return expectWebhookTestDelivery(
|
|
18281
18629
|
client.request({
|
|
18282
18630
|
method: "POST",
|
|
18283
|
-
path: `/v1/webhooks/${input.webhookId}/test`,
|
|
18631
|
+
path: `/v1/webhooks/${input.webhookId}/test${buildQuery2({ project_id: input.projectId })}`,
|
|
18284
18632
|
bearerToken: input.bearerToken,
|
|
18285
18633
|
body
|
|
18286
18634
|
})
|
|
@@ -18290,7 +18638,7 @@ function createWebhookApi(client) {
|
|
|
18290
18638
|
return expectWebhookDeliveries(
|
|
18291
18639
|
client.request({
|
|
18292
18640
|
method: "GET",
|
|
18293
|
-
path: `/v1/webhooks/${input.webhookId}/deliveries${buildQuery2({ limit: input.limit })}`,
|
|
18641
|
+
path: `/v1/webhooks/${input.webhookId}/deliveries${buildQuery2({ project_id: input.projectId, limit: input.limit })}`,
|
|
18294
18642
|
bearerToken: input.bearerToken
|
|
18295
18643
|
})
|
|
18296
18644
|
);
|
|
@@ -18299,7 +18647,7 @@ function createWebhookApi(client) {
|
|
|
18299
18647
|
return expectRetryDelivery(
|
|
18300
18648
|
client.request({
|
|
18301
18649
|
method: "POST",
|
|
18302
|
-
path: `/v1/webhooks/${input.webhookId}/deliveries/${input.deliveryId}/retry`,
|
|
18650
|
+
path: `/v1/webhooks/${input.webhookId}/deliveries/${input.deliveryId}/retry${buildQuery2({ project_id: input.projectId })}`,
|
|
18303
18651
|
bearerToken: input.bearerToken,
|
|
18304
18652
|
body: {}
|
|
18305
18653
|
})
|
|
@@ -18489,9 +18837,9 @@ var BillingSummarySchema = external_exports.object({
|
|
|
18489
18837
|
monthly_raw_ingested_events: BillingUsageMetricSchema,
|
|
18490
18838
|
retained_bundle_cap: BillingUsageMetricSchema,
|
|
18491
18839
|
monthly_remote_activations: BillingUsageMetricSchema,
|
|
18492
|
-
monthly_alert_deliveries: BillingUsageMetricSchema
|
|
18493
|
-
|
|
18494
|
-
|
|
18840
|
+
monthly_alert_deliveries: BillingUsageMetricSchema,
|
|
18841
|
+
monthly_webhook_deliveries: BillingUsageMetricSchema
|
|
18842
|
+
}).strict()
|
|
18495
18843
|
}).strict();
|
|
18496
18844
|
var BillingSummaryResponseSchema = external_exports.object({
|
|
18497
18845
|
billing: BillingSummarySchema
|
|
@@ -18604,6 +18952,7 @@ var ProjectGitHubRepoSchema = external_exports.object({
|
|
|
18604
18952
|
var GitHubDispatchRuleSchema = external_exports.object({
|
|
18605
18953
|
rule_id: external_exports.string(),
|
|
18606
18954
|
project_id: external_exports.string(),
|
|
18955
|
+
created_by_user_id: external_exports.string(),
|
|
18607
18956
|
name: external_exports.string(),
|
|
18608
18957
|
enabled: external_exports.boolean(),
|
|
18609
18958
|
event_types: external_exports.array(external_exports.string().min(1)),
|
|
@@ -18622,7 +18971,7 @@ var GitHubDispatchDeliverySchema = external_exports.object({
|
|
|
18622
18971
|
rule_name: external_exports.string(),
|
|
18623
18972
|
incident_id: external_exports.string(),
|
|
18624
18973
|
incident_title: external_exports.string(),
|
|
18625
|
-
status: external_exports.enum(["pending", "retrying", "delivered", "failed"]),
|
|
18974
|
+
status: external_exports.enum(["pending", "retrying", "delivered", "failed", "skipped"]),
|
|
18626
18975
|
attempt_count: external_exports.number().int(),
|
|
18627
18976
|
last_attempt_at: external_exports.string().nullable(),
|
|
18628
18977
|
last_error: external_exports.string().nullable(),
|
|
@@ -18759,19 +19108,21 @@ async function expectNoContent(responsePromise) {
|
|
|
18759
19108
|
function createGitHubManagementApi(client) {
|
|
18760
19109
|
return {
|
|
18761
19110
|
async getInstallation(input) {
|
|
19111
|
+
const query = input.projectId === void 0 ? "" : `?project_id=${encodeURIComponent(input.projectId)}`;
|
|
18762
19112
|
return expectInstallation(
|
|
18763
19113
|
client.request({
|
|
18764
19114
|
method: "GET",
|
|
18765
|
-
path:
|
|
19115
|
+
path: `/v1/github/installation${query}`,
|
|
18766
19116
|
bearerToken: input.bearerToken
|
|
18767
19117
|
})
|
|
18768
19118
|
);
|
|
18769
19119
|
},
|
|
18770
19120
|
async listRepositories(input) {
|
|
19121
|
+
const query = input.projectId === void 0 ? "" : `?project_id=${encodeURIComponent(input.projectId)}`;
|
|
18771
19122
|
return expectRepositories(
|
|
18772
19123
|
client.request({
|
|
18773
19124
|
method: "GET",
|
|
18774
|
-
path:
|
|
19125
|
+
path: `/v1/github/repositories${query}`,
|
|
18775
19126
|
bearerToken: input.bearerToken
|
|
18776
19127
|
})
|
|
18777
19128
|
);
|
|
@@ -25324,7 +25675,7 @@ var CLI_USAGE_LINES = [
|
|
|
25324
25675
|
" debugbundle billing capacity schedule-reduction --target-additional-capacity-units <n> [--auth-file <path>] [--json]",
|
|
25325
25676
|
" debugbundle billing capacity cancel-reduction [--auth-file <path>] [--json]",
|
|
25326
25677
|
" debugbundle github status [--project-id <id>] [--auth-file <path>] [--json]",
|
|
25327
|
-
" debugbundle github repos [--auth-file <path>] [--json]",
|
|
25678
|
+
" debugbundle github repos [--project-id <id>] [--auth-file <path>] [--json]",
|
|
25328
25679
|
" debugbundle github repo set <owner/repo> --project-id <id> [--auth-file <path>] [--json]",
|
|
25329
25680
|
" debugbundle github repo remove --project-id <id> [--auth-file <path>] [--json]",
|
|
25330
25681
|
" debugbundle github rules --project-id <id> [--auth-file <path>] [--json]",
|
|
@@ -25345,34 +25696,42 @@ var CLI_USAGE_LINES = [
|
|
|
25345
25696
|
" debugbundle token member revoke <token-id> [--auth-file <path>] [--json]",
|
|
25346
25697
|
" debugbundle alert list --project-id <id> [--limit <n>] [--auth-file <path>] [--json]",
|
|
25347
25698
|
" debugbundle alert create --project-id <id> --channel <channel> --condition <condition> [--service-id <id>] [--severity-min <level>] --config-json <json> [--is-enabled <true|false>] [--auth-file <path>] [--json]",
|
|
25348
|
-
" debugbundle alert update <alert-id> [--service-id <id|null>] [--channel <channel>] [--condition <condition>] [--severity-min <level|null>] [--config-json <json|null>] [--is-enabled <true|false>] [--auth-file <path>] [--json]",
|
|
25349
|
-
" debugbundle alert delete <alert-id> [--auth-file <path>] [--json]",
|
|
25699
|
+
" debugbundle alert update <alert-id> --project-id <id> [--service-id <id|null>] [--channel <channel>] [--condition <condition>] [--severity-min <level|null>] [--config-json <json|null>] [--is-enabled <true|false>] [--auth-file <path>] [--json]",
|
|
25700
|
+
" debugbundle alert delete <alert-id> --project-id <id> [--auth-file <path>] [--json]",
|
|
25350
25701
|
" debugbundle slack list --project-id <id> [--auth-file <path>] [--json]",
|
|
25351
25702
|
" debugbundle slack connect-url --project-id <id> [--return-to </projects/...>] [--auth-file <path>] [--json]",
|
|
25352
25703
|
" debugbundle slack test <destination-id> --project-id <id> [--auth-file <path>] [--json]",
|
|
25353
25704
|
" debugbundle slack delete <destination-id> --project-id <id> [--auth-file <path>] [--json]",
|
|
25354
25705
|
" debugbundle webhook list --project-id <id> [--limit <n>] [--auth-file <path>] [--json]",
|
|
25355
25706
|
" debugbundle webhook create --project-id <id> --url <url> --event <event[,event]> [--environment <env[,env]>] [--service <svc[,svc]>] [--severity-min <level>] [--bundle-type <type[,type]>] [--verification <true|false>] [--is-enabled <true|false>] [--auth-file <path>] [--json]",
|
|
25356
|
-
" debugbundle webhook update <webhook-id> [--url <url>] [--event <event[,event]>] [--environment <env[,env]>] [--service <svc[,svc]>] [--severity-min <level>] [--bundle-type <type[,type]>] [--verification <true|false>] [--is-enabled <true|false>] [--auth-file <path>] [--json]",
|
|
25357
|
-
" debugbundle webhook delete <webhook-id> [--auth-file <path>] [--json]",
|
|
25358
|
-
" debugbundle webhook test <webhook-id> [--event <verification.passed|verification.failed>] [--auth-file <path>] [--json]",
|
|
25359
|
-
" debugbundle webhook deliveries <webhook-id> [--limit <n>] [--auth-file <path>] [--json]",
|
|
25360
|
-
" debugbundle webhook retry <webhook-id> <delivery-id> [--auth-file <path>] [--json]",
|
|
25707
|
+
" debugbundle webhook update <webhook-id> --project-id <id> [--url <url>] [--event <event[,event]>] [--environment <env[,env]>] [--service <svc[,svc]>] [--severity-min <level>] [--bundle-type <type[,type]>] [--verification <true|false>] [--is-enabled <true|false>] [--auth-file <path>] [--json]",
|
|
25708
|
+
" debugbundle webhook delete <webhook-id> --project-id <id> [--auth-file <path>] [--json]",
|
|
25709
|
+
" debugbundle webhook test <webhook-id> --project-id <id> [--event <verification.passed|verification.failed>] [--auth-file <path>] [--json]",
|
|
25710
|
+
" debugbundle webhook deliveries <webhook-id> --project-id <id> [--limit <n>] [--auth-file <path>] [--json]",
|
|
25711
|
+
" debugbundle webhook retry <webhook-id> <delivery-id> --project-id <id> [--auth-file <path>] [--json]",
|
|
25361
25712
|
" debugbundle weekly-report list --project-id <id> [--limit <n>] [--auth-file <path>] [--json]",
|
|
25362
25713
|
" 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]",
|
|
25363
25714
|
" 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]",
|
|
25364
25715
|
" debugbundle weekly-report delete <channel-id> [--auth-file <path>] [--json]",
|
|
25365
25716
|
" debugbundle capture-policy get --project <id> [--auth-file <path>] [--json]",
|
|
25366
25717
|
" debugbundle capture-policy set --project <id> [--preset <minimal|balanced|investigative>] [--override <key=value>] [--client-error-incidents <preset-default|none|recommended|custom>] [--client-error-statuses <400,401,...>] [--auth-file <path>] [--json]",
|
|
25718
|
+
" debugbundle improvements list [--project-id <id>] [--environment <name>] [--service <name>] [--status <status>] [--severity <level>] [--kind <kind>] [--cursor <cursor>] [--limit <n>] [--auth-file <path>] [--json]",
|
|
25719
|
+
" debugbundle improvements get <improvement-id> [--auth-file <path>] [--json]",
|
|
25720
|
+
" debugbundle improvements bundle <improvement-id> --project-id <id> [--auth-file <path>] [--json]",
|
|
25721
|
+
" debugbundle improvements resolve <improvement-id> [--auth-file <path>] [--json]",
|
|
25722
|
+
" debugbundle improvements reopen <improvement-id> [--auth-file <path>] [--json]",
|
|
25723
|
+
" debugbundle improvements snooze <improvement-id> --until <ISO8601> [--auth-file <path>] [--json]",
|
|
25724
|
+
" debugbundle improvements settings get --project <id> [--auth-file <path>] [--json]",
|
|
25725
|
+
" debugbundle improvements settings set --project <id> [--enabled <true|false>] [--sensitivity <high_confidence|balanced|verbose>] [--auth-file <path>] [--json]",
|
|
25367
25726
|
" debugbundle probe activate <project-id> --label-pattern <pattern> [--service <name>] [--environment <name>] [--ttl-seconds <n>] [--trigger-ttl-seconds <n>] [--auth-file <path>] [--json]",
|
|
25368
25727
|
" debugbundle probe list <project-id> [--auth-file <path>] [--json]",
|
|
25369
25728
|
" debugbundle probe deactivate <project-id> <activation-id> [--auth-file <path>] [--json]",
|
|
25370
|
-
" debugbundle
|
|
25371
|
-
" debugbundle
|
|
25372
|
-
" debugbundle
|
|
25373
|
-
" debugbundle
|
|
25374
|
-
" debugbundle
|
|
25375
|
-
" debugbundle
|
|
25729
|
+
" debugbundle project members list --project-id <id> [--auth-file <path>] [--json]",
|
|
25730
|
+
" debugbundle project members invites --project-id <id> [--auth-file <path>] [--json]",
|
|
25731
|
+
" debugbundle project members invite --project-id <id> --email <email> --role <admin|member> [--auth-file <path>] [--json]",
|
|
25732
|
+
" debugbundle project members cancel-invite <invite-id> --project-id <id> [--auth-file <path>] [--json]",
|
|
25733
|
+
" debugbundle project members update-role <user-id> --project-id <id> --role <admin|member> [--auth-file <path>] [--json]",
|
|
25734
|
+
" debugbundle project members remove <user-id> --project-id <id> [--auth-file <path>] [--json]"
|
|
25376
25735
|
];
|
|
25377
25736
|
function formatUsage() {
|
|
25378
25737
|
return CLI_USAGE_LINES.join("\n");
|
|
@@ -25931,6 +26290,7 @@ async function updateAlertCommand(input, api) {
|
|
|
25931
26290
|
try {
|
|
25932
26291
|
const requestInput = {
|
|
25933
26292
|
bearerToken: input.bearerToken,
|
|
26293
|
+
projectId: input.projectId,
|
|
25934
26294
|
alertId: input.alertId
|
|
25935
26295
|
};
|
|
25936
26296
|
if (input.serviceId !== void 0) {
|
|
@@ -25967,6 +26327,7 @@ async function updateAlertWithAuthCommand(input, dependencies) {
|
|
|
25967
26327
|
runCommand: (authState, api) => {
|
|
25968
26328
|
const commandInput = {
|
|
25969
26329
|
bearerToken: authState.bearer_token,
|
|
26330
|
+
projectId: input.projectId,
|
|
25970
26331
|
alertId: input.alertId
|
|
25971
26332
|
};
|
|
25972
26333
|
if (input.serviceId !== void 0) {
|
|
@@ -26000,6 +26361,7 @@ async function deleteAlertCommand(input, api) {
|
|
|
26000
26361
|
try {
|
|
26001
26362
|
const alert = await api.deleteAlert({
|
|
26002
26363
|
bearerToken: input.bearerToken,
|
|
26364
|
+
projectId: input.projectId,
|
|
26003
26365
|
alertId: input.alertId
|
|
26004
26366
|
});
|
|
26005
26367
|
return {
|
|
@@ -26017,6 +26379,7 @@ async function deleteAlertWithAuthCommand(input, dependencies) {
|
|
|
26017
26379
|
runCommand: (authState, api) => {
|
|
26018
26380
|
const commandInput = {
|
|
26019
26381
|
bearerToken: authState.bearer_token,
|
|
26382
|
+
projectId: input.projectId,
|
|
26020
26383
|
alertId: input.alertId
|
|
26021
26384
|
};
|
|
26022
26385
|
if (input.json !== void 0) {
|
|
@@ -26229,9 +26592,9 @@ async function setCapturePolicyWithAuthCommand(input, dependencies) {
|
|
|
26229
26592
|
});
|
|
26230
26593
|
}
|
|
26231
26594
|
|
|
26232
|
-
// src/
|
|
26595
|
+
// src/improvement-commands.ts
|
|
26233
26596
|
function mapErrorToExitCode6(error) {
|
|
26234
|
-
if (!(error instanceof
|
|
26597
|
+
if (!(error instanceof RetrievalApiError)) {
|
|
26235
26598
|
return 1;
|
|
26236
26599
|
}
|
|
26237
26600
|
if (error.status === 401) {
|
|
@@ -26243,101 +26606,498 @@ function mapErrorToExitCode6(error) {
|
|
|
26243
26606
|
if (error.status === 400) {
|
|
26244
26607
|
return 4;
|
|
26245
26608
|
}
|
|
26246
|
-
if (error.status === 409) {
|
|
26247
|
-
return 5;
|
|
26248
|
-
}
|
|
26249
26609
|
return 1;
|
|
26250
26610
|
}
|
|
26251
|
-
function
|
|
26252
|
-
|
|
26611
|
+
function formatImprovementTable(improvements) {
|
|
26612
|
+
if (improvements.length === 0) {
|
|
26613
|
+
return "No improvements found.";
|
|
26614
|
+
}
|
|
26615
|
+
return improvements.map((improvement) => `${improvement.improvement_id} | ${improvement.severity} | ${improvement.status} | ${improvement.title}`).join("\n");
|
|
26253
26616
|
}
|
|
26254
|
-
|
|
26617
|
+
function formatImprovementDetail(improvement) {
|
|
26618
|
+
return [
|
|
26619
|
+
`Improvement: ${improvement.improvement_id}`,
|
|
26620
|
+
`Project: ${improvement.project_name}`,
|
|
26621
|
+
`Title: ${improvement.title}`,
|
|
26622
|
+
`Kind: ${improvement.kind}`,
|
|
26623
|
+
`Severity: ${improvement.severity}`,
|
|
26624
|
+
`Status: ${improvement.status}`,
|
|
26625
|
+
`Environment: ${improvement.environment}`,
|
|
26626
|
+
`Service: ${improvement.service_name}`,
|
|
26627
|
+
`Confidence: ${improvement.confidence}`,
|
|
26628
|
+
`Occurrences: ${improvement.occurrence_count}`,
|
|
26629
|
+
`Last detected: ${improvement.last_detected_at}`,
|
|
26630
|
+
...improvement.resolved_at === null ? [] : [`Resolved at: ${improvement.resolved_at}`],
|
|
26631
|
+
`Summary: ${improvement.summary}`
|
|
26632
|
+
].join("\n");
|
|
26633
|
+
}
|
|
26634
|
+
function formatObjectOutput2(payload) {
|
|
26635
|
+
return JSON.stringify(payload, null, 2);
|
|
26636
|
+
}
|
|
26637
|
+
async function listImprovementsCommand(input, api) {
|
|
26255
26638
|
try {
|
|
26256
|
-
const
|
|
26257
|
-
bearerToken: input.bearerToken
|
|
26258
|
-
};
|
|
26259
|
-
if (input.limit !== void 0) {
|
|
26260
|
-
requestInput.limit = input.limit;
|
|
26261
|
-
}
|
|
26262
|
-
const projects = await api.listProjects(requestInput);
|
|
26639
|
+
const response = await api.listImprovements(input);
|
|
26263
26640
|
return {
|
|
26264
26641
|
exitCode: 0,
|
|
26265
|
-
output: input.json ? JSON.stringify(
|
|
26642
|
+
output: input.json ? JSON.stringify(response) : `${formatImprovementTable(
|
|
26643
|
+
response.improvements
|
|
26644
|
+
)}${response.next_cursor === null ? "" : `
|
|
26645
|
+
next_cursor: ${response.next_cursor}`}`
|
|
26266
26646
|
};
|
|
26267
26647
|
} catch (error) {
|
|
26268
|
-
return {
|
|
26648
|
+
return {
|
|
26649
|
+
exitCode: mapErrorToExitCode6(error),
|
|
26650
|
+
output: error instanceof Error ? error.message : String(error)
|
|
26651
|
+
};
|
|
26269
26652
|
}
|
|
26270
26653
|
}
|
|
26271
|
-
async function
|
|
26654
|
+
async function getImprovementCommand(input, api) {
|
|
26272
26655
|
try {
|
|
26273
|
-
const
|
|
26274
|
-
|
|
26275
|
-
|
|
26276
|
-
|
|
26656
|
+
const improvement = await api.getImprovement(input);
|
|
26657
|
+
return {
|
|
26658
|
+
exitCode: 0,
|
|
26659
|
+
output: input.json ? JSON.stringify(improvement) : formatImprovementDetail(improvement)
|
|
26277
26660
|
};
|
|
26278
|
-
|
|
26279
|
-
|
|
26280
|
-
|
|
26281
|
-
|
|
26661
|
+
} catch (error) {
|
|
26662
|
+
return {
|
|
26663
|
+
exitCode: mapErrorToExitCode6(error),
|
|
26664
|
+
output: error instanceof Error ? error.message : String(error)
|
|
26665
|
+
};
|
|
26666
|
+
}
|
|
26667
|
+
}
|
|
26668
|
+
async function resolveImprovementCommand(input, api) {
|
|
26669
|
+
try {
|
|
26670
|
+
const improvement = await api.resolveImprovement(input);
|
|
26282
26671
|
return {
|
|
26283
26672
|
exitCode: 0,
|
|
26284
|
-
output: input.json ? JSON.stringify(
|
|
26673
|
+
output: input.json ? JSON.stringify(improvement) : `Improvement resolved.
|
|
26674
|
+
${formatImprovementDetail(improvement)}`
|
|
26285
26675
|
};
|
|
26286
26676
|
} catch (error) {
|
|
26287
|
-
return {
|
|
26677
|
+
return {
|
|
26678
|
+
exitCode: mapErrorToExitCode6(error),
|
|
26679
|
+
output: error instanceof Error ? error.message : String(error)
|
|
26680
|
+
};
|
|
26288
26681
|
}
|
|
26289
26682
|
}
|
|
26290
|
-
async function
|
|
26683
|
+
async function reopenImprovementCommand(input, api) {
|
|
26291
26684
|
try {
|
|
26292
|
-
const
|
|
26293
|
-
|
|
26294
|
-
|
|
26685
|
+
const improvement = await api.reopenImprovement(input);
|
|
26686
|
+
return {
|
|
26687
|
+
exitCode: 0,
|
|
26688
|
+
output: input.json ? JSON.stringify(improvement) : `Improvement reopened.
|
|
26689
|
+
${formatImprovementDetail(improvement)}`
|
|
26295
26690
|
};
|
|
26296
|
-
|
|
26297
|
-
|
|
26298
|
-
|
|
26299
|
-
|
|
26300
|
-
|
|
26301
|
-
|
|
26302
|
-
|
|
26303
|
-
|
|
26304
|
-
|
|
26305
|
-
const
|
|
26691
|
+
} catch (error) {
|
|
26692
|
+
return {
|
|
26693
|
+
exitCode: mapErrorToExitCode6(error),
|
|
26694
|
+
output: error instanceof Error ? error.message : String(error)
|
|
26695
|
+
};
|
|
26696
|
+
}
|
|
26697
|
+
}
|
|
26698
|
+
async function snoozeImprovementCommand(input, api) {
|
|
26699
|
+
try {
|
|
26700
|
+
const improvement = await api.snoozeImprovement(input);
|
|
26306
26701
|
return {
|
|
26307
26702
|
exitCode: 0,
|
|
26308
|
-
output: input.json ? JSON.stringify(
|
|
26703
|
+
output: input.json ? JSON.stringify(improvement) : `Improvement snoozed.
|
|
26704
|
+
${formatImprovementDetail(improvement)}`
|
|
26309
26705
|
};
|
|
26310
26706
|
} catch (error) {
|
|
26311
|
-
return {
|
|
26707
|
+
return {
|
|
26708
|
+
exitCode: mapErrorToExitCode6(error),
|
|
26709
|
+
output: error instanceof Error ? error.message : String(error)
|
|
26710
|
+
};
|
|
26312
26711
|
}
|
|
26313
26712
|
}
|
|
26314
|
-
async function
|
|
26713
|
+
async function getImprovementBundleCommand(input, api) {
|
|
26315
26714
|
try {
|
|
26316
|
-
const
|
|
26317
|
-
bearerToken: input.bearerToken,
|
|
26318
|
-
projectId: input.projectId
|
|
26319
|
-
});
|
|
26715
|
+
const bundle = await api.getImprovementBundle(input);
|
|
26320
26716
|
return {
|
|
26321
26717
|
exitCode: 0,
|
|
26322
|
-
output: input.json ? JSON.stringify(
|
|
26718
|
+
output: input.json ? JSON.stringify(bundle) : formatObjectOutput2(bundle)
|
|
26323
26719
|
};
|
|
26324
26720
|
} catch (error) {
|
|
26325
|
-
return {
|
|
26721
|
+
return {
|
|
26722
|
+
exitCode: mapErrorToExitCode6(error),
|
|
26723
|
+
output: error instanceof Error ? error.message : String(error)
|
|
26724
|
+
};
|
|
26326
26725
|
}
|
|
26327
26726
|
}
|
|
26328
|
-
async function
|
|
26727
|
+
async function listImprovementsWithAuthCommand(input, dependencies) {
|
|
26329
26728
|
return runAuthenticatedCliCommand(input, {
|
|
26330
|
-
createApi:
|
|
26729
|
+
createApi: createAuthenticatedRetrievalApi,
|
|
26331
26730
|
dependencies,
|
|
26332
|
-
runCommand: (authState, api) =>
|
|
26333
|
-
|
|
26334
|
-
bearerToken: authState.bearer_token
|
|
26335
|
-
|
|
26336
|
-
|
|
26337
|
-
|
|
26338
|
-
|
|
26339
|
-
|
|
26340
|
-
|
|
26731
|
+
runCommand: (authState, api) => listImprovementsCommand(
|
|
26732
|
+
{
|
|
26733
|
+
bearerToken: authState.bearer_token,
|
|
26734
|
+
...input.projectId === void 0 ? {} : { projectId: input.projectId },
|
|
26735
|
+
...input.environment === void 0 ? {} : { environment: input.environment },
|
|
26736
|
+
...input.service === void 0 ? {} : { service: input.service },
|
|
26737
|
+
...input.status === void 0 ? {} : { status: input.status },
|
|
26738
|
+
...input.severity === void 0 ? {} : { severity: input.severity },
|
|
26739
|
+
...input.kind === void 0 ? {} : { kind: input.kind },
|
|
26740
|
+
...input.cursor === void 0 ? {} : { cursor: input.cursor },
|
|
26741
|
+
...input.limit === void 0 ? {} : { limit: input.limit },
|
|
26742
|
+
...input.json === void 0 ? {} : { json: input.json }
|
|
26743
|
+
},
|
|
26744
|
+
api
|
|
26745
|
+
)
|
|
26746
|
+
});
|
|
26747
|
+
}
|
|
26748
|
+
async function getImprovementWithAuthCommand(input, dependencies) {
|
|
26749
|
+
return runAuthenticatedCliCommand(input, {
|
|
26750
|
+
createApi: createAuthenticatedRetrievalApi,
|
|
26751
|
+
dependencies,
|
|
26752
|
+
runCommand: (authState, api) => getImprovementCommand(
|
|
26753
|
+
{
|
|
26754
|
+
bearerToken: authState.bearer_token,
|
|
26755
|
+
improvementId: input.improvementId,
|
|
26756
|
+
...input.json === void 0 ? {} : { json: input.json }
|
|
26757
|
+
},
|
|
26758
|
+
api
|
|
26759
|
+
)
|
|
26760
|
+
});
|
|
26761
|
+
}
|
|
26762
|
+
async function resolveImprovementWithAuthCommand(input, dependencies) {
|
|
26763
|
+
return runAuthenticatedCliCommand(input, {
|
|
26764
|
+
createApi: createAuthenticatedRetrievalApi,
|
|
26765
|
+
dependencies,
|
|
26766
|
+
runCommand: (authState, api) => resolveImprovementCommand(
|
|
26767
|
+
{
|
|
26768
|
+
bearerToken: authState.bearer_token,
|
|
26769
|
+
improvementId: input.improvementId,
|
|
26770
|
+
...input.json === void 0 ? {} : { json: input.json }
|
|
26771
|
+
},
|
|
26772
|
+
api
|
|
26773
|
+
)
|
|
26774
|
+
});
|
|
26775
|
+
}
|
|
26776
|
+
async function reopenImprovementWithAuthCommand(input, dependencies) {
|
|
26777
|
+
return runAuthenticatedCliCommand(input, {
|
|
26778
|
+
createApi: createAuthenticatedRetrievalApi,
|
|
26779
|
+
dependencies,
|
|
26780
|
+
runCommand: (authState, api) => reopenImprovementCommand(
|
|
26781
|
+
{
|
|
26782
|
+
bearerToken: authState.bearer_token,
|
|
26783
|
+
improvementId: input.improvementId,
|
|
26784
|
+
...input.json === void 0 ? {} : { json: input.json }
|
|
26785
|
+
},
|
|
26786
|
+
api
|
|
26787
|
+
)
|
|
26788
|
+
});
|
|
26789
|
+
}
|
|
26790
|
+
async function snoozeImprovementWithAuthCommand(input, dependencies) {
|
|
26791
|
+
return runAuthenticatedCliCommand(input, {
|
|
26792
|
+
createApi: createAuthenticatedRetrievalApi,
|
|
26793
|
+
dependencies,
|
|
26794
|
+
runCommand: (authState, api) => snoozeImprovementCommand(
|
|
26795
|
+
{
|
|
26796
|
+
bearerToken: authState.bearer_token,
|
|
26797
|
+
improvementId: input.improvementId,
|
|
26798
|
+
snoozedUntil: input.snoozedUntil,
|
|
26799
|
+
...input.json === void 0 ? {} : { json: input.json }
|
|
26800
|
+
},
|
|
26801
|
+
api
|
|
26802
|
+
)
|
|
26803
|
+
});
|
|
26804
|
+
}
|
|
26805
|
+
async function getImprovementBundleWithAuthCommand(input, dependencies) {
|
|
26806
|
+
return runAuthenticatedCliCommand(input, {
|
|
26807
|
+
createApi: createAuthenticatedRetrievalApi,
|
|
26808
|
+
dependencies,
|
|
26809
|
+
runCommand: (authState, api) => getImprovementBundleCommand(
|
|
26810
|
+
{
|
|
26811
|
+
bearerToken: authState.bearer_token,
|
|
26812
|
+
projectId: input.projectId,
|
|
26813
|
+
improvementId: input.improvementId,
|
|
26814
|
+
...input.json === void 0 ? {} : { json: input.json }
|
|
26815
|
+
},
|
|
26816
|
+
api
|
|
26817
|
+
)
|
|
26818
|
+
});
|
|
26819
|
+
}
|
|
26820
|
+
|
|
26821
|
+
// src/improvement-settings-commands.ts
|
|
26822
|
+
var ImprovementSettingsApiError = class extends Error {
|
|
26823
|
+
status;
|
|
26824
|
+
constructor(status, message) {
|
|
26825
|
+
super(message);
|
|
26826
|
+
this.name = "ImprovementSettingsApiError";
|
|
26827
|
+
this.status = status;
|
|
26828
|
+
}
|
|
26829
|
+
};
|
|
26830
|
+
function toApiError2(status, body, fallback) {
|
|
26831
|
+
if (typeof body === "object" && body !== null && "error" in body && typeof body.error === "string") {
|
|
26832
|
+
return new ImprovementSettingsApiError(status, body.error);
|
|
26833
|
+
}
|
|
26834
|
+
return new ImprovementSettingsApiError(status, fallback);
|
|
26835
|
+
}
|
|
26836
|
+
function createImprovementSettingsApi(httpClient) {
|
|
26837
|
+
return {
|
|
26838
|
+
async getImprovementSettings(input) {
|
|
26839
|
+
const response = await httpClient.request({
|
|
26840
|
+
method: "GET",
|
|
26841
|
+
path: `/v1/projects/${encodeURIComponent(input.projectId)}/improvement-settings`,
|
|
26842
|
+
bearerToken: input.bearerToken
|
|
26843
|
+
});
|
|
26844
|
+
if (response.status !== 200) {
|
|
26845
|
+
throw toApiError2(response.status, response.body, "Failed to get improvement settings.");
|
|
26846
|
+
}
|
|
26847
|
+
const parsed = ImprovementSettingsResponseSchema.safeParse(response.body);
|
|
26848
|
+
if (!parsed.success) {
|
|
26849
|
+
throw new ImprovementSettingsApiError(500, "Invalid improvement settings response.");
|
|
26850
|
+
}
|
|
26851
|
+
return parsed.data;
|
|
26852
|
+
},
|
|
26853
|
+
async updateImprovementSettings(input) {
|
|
26854
|
+
const response = await httpClient.request({
|
|
26855
|
+
method: "PATCH",
|
|
26856
|
+
path: `/v1/projects/${encodeURIComponent(input.projectId)}/improvement-settings`,
|
|
26857
|
+
bearerToken: input.bearerToken,
|
|
26858
|
+
body: input.update
|
|
26859
|
+
});
|
|
26860
|
+
if (response.status !== 200) {
|
|
26861
|
+
throw toApiError2(response.status, response.body, "Failed to update improvement settings.");
|
|
26862
|
+
}
|
|
26863
|
+
const parsed = ImprovementSettingsResponseSchema.safeParse(response.body);
|
|
26864
|
+
if (!parsed.success) {
|
|
26865
|
+
throw new ImprovementSettingsApiError(500, "Invalid improvement settings response.");
|
|
26866
|
+
}
|
|
26867
|
+
return parsed.data;
|
|
26868
|
+
}
|
|
26869
|
+
};
|
|
26870
|
+
}
|
|
26871
|
+
function mapErrorToExitCode7(error) {
|
|
26872
|
+
if (!(error instanceof ImprovementSettingsApiError)) {
|
|
26873
|
+
return 1;
|
|
26874
|
+
}
|
|
26875
|
+
if (error.status === 401) {
|
|
26876
|
+
return 2;
|
|
26877
|
+
}
|
|
26878
|
+
if (error.status === 404) {
|
|
26879
|
+
return 3;
|
|
26880
|
+
}
|
|
26881
|
+
if (error.status === 400) {
|
|
26882
|
+
return 4;
|
|
26883
|
+
}
|
|
26884
|
+
return 1;
|
|
26885
|
+
}
|
|
26886
|
+
function formatSettings(response) {
|
|
26887
|
+
return [
|
|
26888
|
+
`access_mode: ${response.access_mode}`,
|
|
26889
|
+
`cloud_automation_available: ${response.cloud_automation_available}`,
|
|
26890
|
+
`automated_improvement_bundles_enabled: ${response.settings.automated_improvement_bundles_enabled}`,
|
|
26891
|
+
`improvement_bundle_sensitivity: ${response.settings.improvement_bundle_sensitivity}`
|
|
26892
|
+
].join("\n");
|
|
26893
|
+
}
|
|
26894
|
+
async function getImprovementSettingsCommand(input, api) {
|
|
26895
|
+
try {
|
|
26896
|
+
const response = await api.getImprovementSettings({
|
|
26897
|
+
bearerToken: input.bearerToken,
|
|
26898
|
+
projectId: input.projectId
|
|
26899
|
+
});
|
|
26900
|
+
return {
|
|
26901
|
+
exitCode: 0,
|
|
26902
|
+
output: input.json ? JSON.stringify(response) : formatSettings(response)
|
|
26903
|
+
};
|
|
26904
|
+
} catch (error) {
|
|
26905
|
+
return {
|
|
26906
|
+
exitCode: mapErrorToExitCode7(error),
|
|
26907
|
+
output: error instanceof Error ? error.message : String(error)
|
|
26908
|
+
};
|
|
26909
|
+
}
|
|
26910
|
+
}
|
|
26911
|
+
async function setImprovementSettingsCommand(input, api) {
|
|
26912
|
+
try {
|
|
26913
|
+
const parsedUpdate = ImprovementSettingsUpdateSchema.safeParse(input.update);
|
|
26914
|
+
if (!parsedUpdate.success) {
|
|
26915
|
+
return {
|
|
26916
|
+
exitCode: 4,
|
|
26917
|
+
output: "Invalid improvement settings update."
|
|
26918
|
+
};
|
|
26919
|
+
}
|
|
26920
|
+
const response = await api.updateImprovementSettings({
|
|
26921
|
+
bearerToken: input.bearerToken,
|
|
26922
|
+
projectId: input.projectId,
|
|
26923
|
+
update: parsedUpdate.data
|
|
26924
|
+
});
|
|
26925
|
+
return {
|
|
26926
|
+
exitCode: 0,
|
|
26927
|
+
output: input.json ? JSON.stringify(response) : `Improvement settings updated.
|
|
26928
|
+
${formatSettings(response)}`
|
|
26929
|
+
};
|
|
26930
|
+
} catch (error) {
|
|
26931
|
+
return {
|
|
26932
|
+
exitCode: mapErrorToExitCode7(error),
|
|
26933
|
+
output: error instanceof Error ? error.message : String(error)
|
|
26934
|
+
};
|
|
26935
|
+
}
|
|
26936
|
+
}
|
|
26937
|
+
async function createAuthenticatedImprovementSettingsApi(input, dependencies) {
|
|
26938
|
+
const readAuthState = dependencies?.readAuthState ?? readCliAuthState;
|
|
26939
|
+
const authStateInput = {};
|
|
26940
|
+
if (input.authFilePath !== void 0) {
|
|
26941
|
+
authStateInput.authFilePath = input.authFilePath;
|
|
26942
|
+
}
|
|
26943
|
+
const authState = await readAuthState(authStateInput);
|
|
26944
|
+
const createHttpClient = dependencies?.createHttpClient ?? ((clientInput) => {
|
|
26945
|
+
const httpClientDependencies = {};
|
|
26946
|
+
if (dependencies?.fetchImpl !== void 0) {
|
|
26947
|
+
httpClientDependencies.fetchImpl = dependencies.fetchImpl;
|
|
26948
|
+
}
|
|
26949
|
+
return createCliHttpClient(clientInput, httpClientDependencies);
|
|
26950
|
+
});
|
|
26951
|
+
const httpClient = createHttpClient({ baseUrl: authState.base_url });
|
|
26952
|
+
const createApi = dependencies?.createApi ?? createImprovementSettingsApi;
|
|
26953
|
+
return {
|
|
26954
|
+
authState,
|
|
26955
|
+
api: createApi(httpClient)
|
|
26956
|
+
};
|
|
26957
|
+
}
|
|
26958
|
+
async function getImprovementSettingsWithAuthCommand(input, dependencies) {
|
|
26959
|
+
return runAuthenticatedCliCommand(input, {
|
|
26960
|
+
createApi: createAuthenticatedImprovementSettingsApi,
|
|
26961
|
+
dependencies,
|
|
26962
|
+
runCommand: (authState, api) => {
|
|
26963
|
+
const commandInput = {
|
|
26964
|
+
bearerToken: authState.bearer_token,
|
|
26965
|
+
projectId: input.projectId
|
|
26966
|
+
};
|
|
26967
|
+
if (input.json !== void 0) {
|
|
26968
|
+
commandInput.json = input.json;
|
|
26969
|
+
}
|
|
26970
|
+
return getImprovementSettingsCommand(commandInput, api);
|
|
26971
|
+
}
|
|
26972
|
+
});
|
|
26973
|
+
}
|
|
26974
|
+
async function setImprovementSettingsWithAuthCommand(input, dependencies) {
|
|
26975
|
+
return runAuthenticatedCliCommand(input, {
|
|
26976
|
+
createApi: createAuthenticatedImprovementSettingsApi,
|
|
26977
|
+
dependencies,
|
|
26978
|
+
runCommand: (authState, api) => {
|
|
26979
|
+
const commandInput = {
|
|
26980
|
+
bearerToken: authState.bearer_token,
|
|
26981
|
+
projectId: input.projectId,
|
|
26982
|
+
update: input.update
|
|
26983
|
+
};
|
|
26984
|
+
if (input.json !== void 0) {
|
|
26985
|
+
commandInput.json = input.json;
|
|
26986
|
+
}
|
|
26987
|
+
return setImprovementSettingsCommand(commandInput, api);
|
|
26988
|
+
}
|
|
26989
|
+
});
|
|
26990
|
+
}
|
|
26991
|
+
|
|
26992
|
+
// src/project-commands.ts
|
|
26993
|
+
function mapErrorToExitCode8(error) {
|
|
26994
|
+
if (!(error instanceof ProjectManagementApiError)) {
|
|
26995
|
+
return 1;
|
|
26996
|
+
}
|
|
26997
|
+
if (error.status === 401) {
|
|
26998
|
+
return 2;
|
|
26999
|
+
}
|
|
27000
|
+
if (error.status === 404) {
|
|
27001
|
+
return 3;
|
|
27002
|
+
}
|
|
27003
|
+
if (error.status === 400) {
|
|
27004
|
+
return 4;
|
|
27005
|
+
}
|
|
27006
|
+
if (error.status === 409) {
|
|
27007
|
+
return 5;
|
|
27008
|
+
}
|
|
27009
|
+
return 1;
|
|
27010
|
+
}
|
|
27011
|
+
function formatProject(project) {
|
|
27012
|
+
return `${project.project_id} ${project.name} (${project.slug})`;
|
|
27013
|
+
}
|
|
27014
|
+
async function listProjectsCommand(input, api) {
|
|
27015
|
+
try {
|
|
27016
|
+
const requestInput = {
|
|
27017
|
+
bearerToken: input.bearerToken
|
|
27018
|
+
};
|
|
27019
|
+
if (input.limit !== void 0) {
|
|
27020
|
+
requestInput.limit = input.limit;
|
|
27021
|
+
}
|
|
27022
|
+
const projects = await api.listProjects(requestInput);
|
|
27023
|
+
return {
|
|
27024
|
+
exitCode: 0,
|
|
27025
|
+
output: input.json ? JSON.stringify({ projects }) : projects.length === 0 ? "No projects found." : projects.map(formatProject).join("\n")
|
|
27026
|
+
};
|
|
27027
|
+
} catch (error) {
|
|
27028
|
+
return { exitCode: mapErrorToExitCode8(error), output: error instanceof Error ? error.message : String(error) };
|
|
27029
|
+
}
|
|
27030
|
+
}
|
|
27031
|
+
async function createProjectCommand(input, api) {
|
|
27032
|
+
try {
|
|
27033
|
+
const requestInput = {
|
|
27034
|
+
bearerToken: input.bearerToken,
|
|
27035
|
+
name: input.name,
|
|
27036
|
+
slug: input.slug
|
|
27037
|
+
};
|
|
27038
|
+
if (input.environmentDefault !== void 0) {
|
|
27039
|
+
requestInput.environmentDefault = input.environmentDefault;
|
|
27040
|
+
}
|
|
27041
|
+
const project = await api.createProject(requestInput);
|
|
27042
|
+
return {
|
|
27043
|
+
exitCode: 0,
|
|
27044
|
+
output: input.json ? JSON.stringify({ project }) : `Project created: ${formatProject(project)}`
|
|
27045
|
+
};
|
|
27046
|
+
} catch (error) {
|
|
27047
|
+
return { exitCode: mapErrorToExitCode8(error), output: error instanceof Error ? error.message : String(error) };
|
|
27048
|
+
}
|
|
27049
|
+
}
|
|
27050
|
+
async function updateProjectCommand(input, api) {
|
|
27051
|
+
try {
|
|
27052
|
+
const requestInput = {
|
|
27053
|
+
bearerToken: input.bearerToken,
|
|
27054
|
+
projectId: input.projectId
|
|
27055
|
+
};
|
|
27056
|
+
if (input.name !== void 0) {
|
|
27057
|
+
requestInput.name = input.name;
|
|
27058
|
+
}
|
|
27059
|
+
if (input.slug !== void 0) {
|
|
27060
|
+
requestInput.slug = input.slug;
|
|
27061
|
+
}
|
|
27062
|
+
if (input.environmentDefault !== void 0) {
|
|
27063
|
+
requestInput.environmentDefault = input.environmentDefault;
|
|
27064
|
+
}
|
|
27065
|
+
const project = await api.updateProject(requestInput);
|
|
27066
|
+
return {
|
|
27067
|
+
exitCode: 0,
|
|
27068
|
+
output: input.json ? JSON.stringify({ project }) : `Project updated: ${formatProject(project)}`
|
|
27069
|
+
};
|
|
27070
|
+
} catch (error) {
|
|
27071
|
+
return { exitCode: mapErrorToExitCode8(error), output: error instanceof Error ? error.message : String(error) };
|
|
27072
|
+
}
|
|
27073
|
+
}
|
|
27074
|
+
async function deleteProjectCommand(input, api) {
|
|
27075
|
+
try {
|
|
27076
|
+
const project = await api.deleteProject({
|
|
27077
|
+
bearerToken: input.bearerToken,
|
|
27078
|
+
projectId: input.projectId
|
|
27079
|
+
});
|
|
27080
|
+
return {
|
|
27081
|
+
exitCode: 0,
|
|
27082
|
+
output: input.json ? JSON.stringify({ project }) : `Project deleted: ${project.project_id} (${project.name})`
|
|
27083
|
+
};
|
|
27084
|
+
} catch (error) {
|
|
27085
|
+
return { exitCode: mapErrorToExitCode8(error), output: error instanceof Error ? error.message : String(error) };
|
|
27086
|
+
}
|
|
27087
|
+
}
|
|
27088
|
+
async function listProjectsWithAuthCommand(input, dependencies) {
|
|
27089
|
+
return runAuthenticatedCliCommand(input, {
|
|
27090
|
+
createApi: createAuthenticatedProjectManagementApi,
|
|
27091
|
+
dependencies,
|
|
27092
|
+
runCommand: (authState, api) => {
|
|
27093
|
+
const commandInput = {
|
|
27094
|
+
bearerToken: authState.bearer_token
|
|
27095
|
+
};
|
|
27096
|
+
if (input.limit !== void 0) {
|
|
27097
|
+
commandInput.limit = input.limit;
|
|
27098
|
+
}
|
|
27099
|
+
if (input.json !== void 0) {
|
|
27100
|
+
commandInput.json = input.json;
|
|
26341
27101
|
}
|
|
26342
27102
|
return listProjectsCommand(commandInput, {
|
|
26343
27103
|
listProjects: (requestInput) => api.listProjects(requestInput)
|
|
@@ -26414,7 +27174,7 @@ async function deleteProjectWithAuthCommand(input, dependencies) {
|
|
|
26414
27174
|
}
|
|
26415
27175
|
|
|
26416
27176
|
// src/token-commands.ts
|
|
26417
|
-
function
|
|
27177
|
+
function mapErrorToExitCode9(error) {
|
|
26418
27178
|
if (!(error instanceof TokenManagementApiError)) {
|
|
26419
27179
|
return 1;
|
|
26420
27180
|
}
|
|
@@ -26453,7 +27213,7 @@ async function listProjectTokensCommand(input, api) {
|
|
|
26453
27213
|
output: formatTokenTable(tokens)
|
|
26454
27214
|
};
|
|
26455
27215
|
} catch (error) {
|
|
26456
|
-
return { exitCode:
|
|
27216
|
+
return { exitCode: mapErrorToExitCode9(error), output: error instanceof Error ? error.message : String(error) };
|
|
26457
27217
|
}
|
|
26458
27218
|
}
|
|
26459
27219
|
async function listProjectTokensWithAuthCommand(input, dependencies) {
|
|
@@ -26493,7 +27253,7 @@ async function createProjectTokenCommand(input, api) {
|
|
|
26493
27253
|
Plaintext: ${token.plaintext ?? "<none>"}`
|
|
26494
27254
|
};
|
|
26495
27255
|
} catch (error) {
|
|
26496
|
-
return { exitCode:
|
|
27256
|
+
return { exitCode: mapErrorToExitCode9(error), output: error instanceof Error ? error.message : String(error) };
|
|
26497
27257
|
}
|
|
26498
27258
|
}
|
|
26499
27259
|
async function createProjectTokenWithAuthCommand(input, dependencies) {
|
|
@@ -26530,7 +27290,7 @@ async function revokeProjectTokenCommand(input, api) {
|
|
|
26530
27290
|
output: `Project token revoked: ${token.token_id}`
|
|
26531
27291
|
};
|
|
26532
27292
|
} catch (error) {
|
|
26533
|
-
return { exitCode:
|
|
27293
|
+
return { exitCode: mapErrorToExitCode9(error), output: error instanceof Error ? error.message : String(error) };
|
|
26534
27294
|
}
|
|
26535
27295
|
}
|
|
26536
27296
|
async function revokeProjectTokenWithAuthCommand(input, dependencies) {
|
|
@@ -26569,7 +27329,7 @@ async function listMemberTokensCommand(input, api) {
|
|
|
26569
27329
|
output: formatTokenTable(tokens)
|
|
26570
27330
|
};
|
|
26571
27331
|
} catch (error) {
|
|
26572
|
-
return { exitCode:
|
|
27332
|
+
return { exitCode: mapErrorToExitCode9(error), output: error instanceof Error ? error.message : String(error) };
|
|
26573
27333
|
}
|
|
26574
27334
|
}
|
|
26575
27335
|
async function listMemberTokensWithAuthCommand(input, dependencies) {
|
|
@@ -26607,7 +27367,7 @@ async function createMemberTokenCommand(input, api) {
|
|
|
26607
27367
|
Plaintext: ${token.plaintext ?? "<none>"}`
|
|
26608
27368
|
};
|
|
26609
27369
|
} catch (error) {
|
|
26610
|
-
return { exitCode:
|
|
27370
|
+
return { exitCode: mapErrorToExitCode9(error), output: error instanceof Error ? error.message : String(error) };
|
|
26611
27371
|
}
|
|
26612
27372
|
}
|
|
26613
27373
|
async function createMemberTokenWithAuthCommand(input, dependencies) {
|
|
@@ -26642,7 +27402,7 @@ async function revokeMemberTokenCommand(input, api) {
|
|
|
26642
27402
|
output: `Member token revoked: ${token.token_id}`
|
|
26643
27403
|
};
|
|
26644
27404
|
} catch (error) {
|
|
26645
|
-
return { exitCode:
|
|
27405
|
+
return { exitCode: mapErrorToExitCode9(error), output: error instanceof Error ? error.message : String(error) };
|
|
26646
27406
|
}
|
|
26647
27407
|
}
|
|
26648
27408
|
async function revokeMemberTokenWithAuthCommand(input, dependencies) {
|
|
@@ -26665,7 +27425,7 @@ async function revokeMemberTokenWithAuthCommand(input, dependencies) {
|
|
|
26665
27425
|
}
|
|
26666
27426
|
|
|
26667
27427
|
// src/webhook-commands.ts
|
|
26668
|
-
function
|
|
27428
|
+
function mapErrorToExitCode10(error) {
|
|
26669
27429
|
if (!(error instanceof WebhookApiError)) {
|
|
26670
27430
|
return 1;
|
|
26671
27431
|
}
|
|
@@ -26710,7 +27470,7 @@ async function listWebhooksCommand(input, api) {
|
|
|
26710
27470
|
output: input.json ? JSON.stringify({ webhooks }) : formatWebhookTable(webhooks)
|
|
26711
27471
|
};
|
|
26712
27472
|
} catch (error) {
|
|
26713
|
-
return { exitCode:
|
|
27473
|
+
return { exitCode: mapErrorToExitCode10(error), output: error instanceof Error ? error.message : String(error) };
|
|
26714
27474
|
}
|
|
26715
27475
|
}
|
|
26716
27476
|
async function listWebhooksWithAuthCommand(input, dependencies) {
|
|
@@ -26758,7 +27518,7 @@ async function createWebhookCommand(input, api) {
|
|
|
26758
27518
|
Signing secret: ${webhook.signing_secret}`
|
|
26759
27519
|
};
|
|
26760
27520
|
} catch (error) {
|
|
26761
|
-
return { exitCode:
|
|
27521
|
+
return { exitCode: mapErrorToExitCode10(error), output: error instanceof Error ? error.message : String(error) };
|
|
26762
27522
|
}
|
|
26763
27523
|
}
|
|
26764
27524
|
async function createWebhookWithAuthCommand(input, dependencies) {
|
|
@@ -26791,6 +27551,7 @@ async function updateWebhookCommand(input, api) {
|
|
|
26791
27551
|
try {
|
|
26792
27552
|
const requestInput = {
|
|
26793
27553
|
bearerToken: input.bearerToken,
|
|
27554
|
+
projectId: input.projectId,
|
|
26794
27555
|
webhookId: input.webhookId
|
|
26795
27556
|
};
|
|
26796
27557
|
if (input.url !== void 0) {
|
|
@@ -26811,7 +27572,7 @@ async function updateWebhookCommand(input, api) {
|
|
|
26811
27572
|
output: input.json ? JSON.stringify({ webhook }) : `Webhook updated: ${webhook.webhook_id}`
|
|
26812
27573
|
};
|
|
26813
27574
|
} catch (error) {
|
|
26814
|
-
return { exitCode:
|
|
27575
|
+
return { exitCode: mapErrorToExitCode10(error), output: error instanceof Error ? error.message : String(error) };
|
|
26815
27576
|
}
|
|
26816
27577
|
}
|
|
26817
27578
|
async function updateWebhookWithAuthCommand(input, dependencies) {
|
|
@@ -26821,6 +27582,7 @@ async function updateWebhookWithAuthCommand(input, dependencies) {
|
|
|
26821
27582
|
runCommand: (authState, api) => {
|
|
26822
27583
|
const commandInput = {
|
|
26823
27584
|
bearerToken: authState.bearer_token,
|
|
27585
|
+
projectId: input.projectId,
|
|
26824
27586
|
webhookId: input.webhookId
|
|
26825
27587
|
};
|
|
26826
27588
|
if (input.url !== void 0) {
|
|
@@ -26848,6 +27610,7 @@ async function deleteWebhookCommand(input, api) {
|
|
|
26848
27610
|
try {
|
|
26849
27611
|
const webhook = await api.deleteWebhook({
|
|
26850
27612
|
bearerToken: input.bearerToken,
|
|
27613
|
+
projectId: input.projectId,
|
|
26851
27614
|
webhookId: input.webhookId
|
|
26852
27615
|
});
|
|
26853
27616
|
return {
|
|
@@ -26855,7 +27618,7 @@ async function deleteWebhookCommand(input, api) {
|
|
|
26855
27618
|
output: input.json ? JSON.stringify({ webhook }) : `Webhook deleted: ${webhook.webhook_id}`
|
|
26856
27619
|
};
|
|
26857
27620
|
} catch (error) {
|
|
26858
|
-
return { exitCode:
|
|
27621
|
+
return { exitCode: mapErrorToExitCode10(error), output: error instanceof Error ? error.message : String(error) };
|
|
26859
27622
|
}
|
|
26860
27623
|
}
|
|
26861
27624
|
async function deleteWebhookWithAuthCommand(input, dependencies) {
|
|
@@ -26865,6 +27628,7 @@ async function deleteWebhookWithAuthCommand(input, dependencies) {
|
|
|
26865
27628
|
runCommand: (authState, api) => {
|
|
26866
27629
|
const commandInput = {
|
|
26867
27630
|
bearerToken: authState.bearer_token,
|
|
27631
|
+
projectId: input.projectId,
|
|
26868
27632
|
webhookId: input.webhookId
|
|
26869
27633
|
};
|
|
26870
27634
|
if (input.json !== void 0) {
|
|
@@ -26880,6 +27644,7 @@ async function testWebhookCommand(input, api) {
|
|
|
26880
27644
|
try {
|
|
26881
27645
|
const requestInput = {
|
|
26882
27646
|
bearerToken: input.bearerToken,
|
|
27647
|
+
projectId: input.projectId,
|
|
26883
27648
|
webhookId: input.webhookId
|
|
26884
27649
|
};
|
|
26885
27650
|
if (input.eventType !== void 0) {
|
|
@@ -26891,7 +27656,7 @@ async function testWebhookCommand(input, api) {
|
|
|
26891
27656
|
output: input.json ? JSON.stringify({ delivery }) : `Webhook test queued: ${delivery.delivery_id} | ${delivery.event_type} | attempts=${delivery.attempt_count}`
|
|
26892
27657
|
};
|
|
26893
27658
|
} catch (error) {
|
|
26894
|
-
return { exitCode:
|
|
27659
|
+
return { exitCode: mapErrorToExitCode10(error), output: error instanceof Error ? error.message : String(error) };
|
|
26895
27660
|
}
|
|
26896
27661
|
}
|
|
26897
27662
|
async function testWebhookWithAuthCommand(input, dependencies) {
|
|
@@ -26901,6 +27666,7 @@ async function testWebhookWithAuthCommand(input, dependencies) {
|
|
|
26901
27666
|
runCommand: (authState, api) => {
|
|
26902
27667
|
const commandInput = {
|
|
26903
27668
|
bearerToken: authState.bearer_token,
|
|
27669
|
+
projectId: input.projectId,
|
|
26904
27670
|
webhookId: input.webhookId
|
|
26905
27671
|
};
|
|
26906
27672
|
if (input.eventType !== void 0) {
|
|
@@ -26919,6 +27685,7 @@ async function listWebhookDeliveriesCommand(input, api) {
|
|
|
26919
27685
|
try {
|
|
26920
27686
|
const requestInput = {
|
|
26921
27687
|
bearerToken: input.bearerToken,
|
|
27688
|
+
projectId: input.projectId,
|
|
26922
27689
|
webhookId: input.webhookId
|
|
26923
27690
|
};
|
|
26924
27691
|
if (input.limit !== void 0) {
|
|
@@ -26930,7 +27697,7 @@ async function listWebhookDeliveriesCommand(input, api) {
|
|
|
26930
27697
|
output: input.json ? JSON.stringify({ deliveries }) : formatWebhookDeliveriesTable(deliveries)
|
|
26931
27698
|
};
|
|
26932
27699
|
} catch (error) {
|
|
26933
|
-
return { exitCode:
|
|
27700
|
+
return { exitCode: mapErrorToExitCode10(error), output: error instanceof Error ? error.message : String(error) };
|
|
26934
27701
|
}
|
|
26935
27702
|
}
|
|
26936
27703
|
async function listWebhookDeliveriesWithAuthCommand(input, dependencies) {
|
|
@@ -26940,6 +27707,7 @@ async function listWebhookDeliveriesWithAuthCommand(input, dependencies) {
|
|
|
26940
27707
|
runCommand: (authState, api) => {
|
|
26941
27708
|
const commandInput = {
|
|
26942
27709
|
bearerToken: authState.bearer_token,
|
|
27710
|
+
projectId: input.projectId,
|
|
26943
27711
|
webhookId: input.webhookId
|
|
26944
27712
|
};
|
|
26945
27713
|
if (input.limit !== void 0) {
|
|
@@ -26958,6 +27726,7 @@ async function retryWebhookDeliveryCommand(input, api) {
|
|
|
26958
27726
|
try {
|
|
26959
27727
|
const result = await api.retryWebhookDelivery({
|
|
26960
27728
|
bearerToken: input.bearerToken,
|
|
27729
|
+
projectId: input.projectId,
|
|
26961
27730
|
webhookId: input.webhookId,
|
|
26962
27731
|
deliveryId: input.deliveryId
|
|
26963
27732
|
});
|
|
@@ -26966,7 +27735,7 @@ async function retryWebhookDeliveryCommand(input, api) {
|
|
|
26966
27735
|
output: input.json ? JSON.stringify(result) : `Delivery retried: ${result.delivery_id} | ${result.event_type}`
|
|
26967
27736
|
};
|
|
26968
27737
|
} catch (error) {
|
|
26969
|
-
return { exitCode:
|
|
27738
|
+
return { exitCode: mapErrorToExitCode10(error), output: error instanceof Error ? error.message : String(error) };
|
|
26970
27739
|
}
|
|
26971
27740
|
}
|
|
26972
27741
|
async function retryWebhookDeliveryWithAuthCommand(input, dependencies) {
|
|
@@ -26976,6 +27745,7 @@ async function retryWebhookDeliveryWithAuthCommand(input, dependencies) {
|
|
|
26976
27745
|
runCommand: (authState, api) => {
|
|
26977
27746
|
const commandInput = {
|
|
26978
27747
|
bearerToken: authState.bearer_token,
|
|
27748
|
+
projectId: input.projectId,
|
|
26979
27749
|
webhookId: input.webhookId,
|
|
26980
27750
|
deliveryId: input.deliveryId
|
|
26981
27751
|
};
|
|
@@ -26990,7 +27760,7 @@ async function retryWebhookDeliveryWithAuthCommand(input, dependencies) {
|
|
|
26990
27760
|
}
|
|
26991
27761
|
|
|
26992
27762
|
// src/weekly-report-commands.ts
|
|
26993
|
-
function
|
|
27763
|
+
function mapErrorToExitCode11(error) {
|
|
26994
27764
|
if (!(error instanceof WeeklyReportApiError)) {
|
|
26995
27765
|
return 1;
|
|
26996
27766
|
}
|
|
@@ -27025,7 +27795,7 @@ async function listWeeklyReportChannelsCommand(input, api) {
|
|
|
27025
27795
|
output: input.json ? JSON.stringify({ channels }) : formatWeeklyReportChannelTable(channels)
|
|
27026
27796
|
};
|
|
27027
27797
|
} catch (error) {
|
|
27028
|
-
return { exitCode:
|
|
27798
|
+
return { exitCode: mapErrorToExitCode11(error), output: error instanceof Error ? error.message : String(error) };
|
|
27029
27799
|
}
|
|
27030
27800
|
}
|
|
27031
27801
|
async function listWeeklyReportChannelsWithAuthCommand(input, dependencies) {
|
|
@@ -27058,7 +27828,7 @@ async function createWeeklyReportChannelCommand(input, api) {
|
|
|
27058
27828
|
output: input.json ? JSON.stringify({ channel }) : `Weekly report channel created: ${channel.channel_id}`
|
|
27059
27829
|
};
|
|
27060
27830
|
} catch (error) {
|
|
27061
|
-
return { exitCode:
|
|
27831
|
+
return { exitCode: mapErrorToExitCode11(error), output: error instanceof Error ? error.message : String(error) };
|
|
27062
27832
|
}
|
|
27063
27833
|
}
|
|
27064
27834
|
async function createWeeklyReportChannelWithAuthCommand(input, dependencies) {
|
|
@@ -27093,7 +27863,7 @@ async function updateWeeklyReportChannelCommand(input, api) {
|
|
|
27093
27863
|
output: input.json ? JSON.stringify({ channel }) : `Weekly report channel updated: ${channel.channel_id}`
|
|
27094
27864
|
};
|
|
27095
27865
|
} catch (error) {
|
|
27096
|
-
return { exitCode:
|
|
27866
|
+
return { exitCode: mapErrorToExitCode11(error), output: error instanceof Error ? error.message : String(error) };
|
|
27097
27867
|
}
|
|
27098
27868
|
}
|
|
27099
27869
|
async function updateWeeklyReportChannelWithAuthCommand(input, dependencies) {
|
|
@@ -27124,7 +27894,7 @@ async function deleteWeeklyReportChannelCommand(input, api) {
|
|
|
27124
27894
|
output: input.json ? JSON.stringify({ channel: deleted }) : `Weekly report channel deleted: ${deleted.channel_id}`
|
|
27125
27895
|
};
|
|
27126
27896
|
} catch (error) {
|
|
27127
|
-
return { exitCode:
|
|
27897
|
+
return { exitCode: mapErrorToExitCode11(error), output: error instanceof Error ? error.message : String(error) };
|
|
27128
27898
|
}
|
|
27129
27899
|
}
|
|
27130
27900
|
async function deleteWeeklyReportChannelWithAuthCommand(input, dependencies) {
|
|
@@ -27143,7 +27913,7 @@ async function deleteWeeklyReportChannelWithAuthCommand(input, dependencies) {
|
|
|
27143
27913
|
}
|
|
27144
27914
|
|
|
27145
27915
|
// src/slack-commands.ts
|
|
27146
|
-
function
|
|
27916
|
+
function mapErrorToExitCode12(error) {
|
|
27147
27917
|
if (!(error instanceof SlackApiError)) {
|
|
27148
27918
|
return 1;
|
|
27149
27919
|
}
|
|
@@ -27179,7 +27949,7 @@ async function listSlackDestinationsCommand(input, api) {
|
|
|
27179
27949
|
output: input.json ? JSON.stringify({ destinations }) : formatSlackDestinationTable(destinations)
|
|
27180
27950
|
};
|
|
27181
27951
|
} catch (error) {
|
|
27182
|
-
return { exitCode:
|
|
27952
|
+
return { exitCode: mapErrorToExitCode12(error), output: error instanceof Error ? error.message : String(error) };
|
|
27183
27953
|
}
|
|
27184
27954
|
}
|
|
27185
27955
|
async function listSlackDestinationsWithAuthCommand(input, dependencies) {
|
|
@@ -27208,7 +27978,7 @@ async function getSlackConnectUrlCommand(input, api) {
|
|
|
27208
27978
|
output: input.json ? JSON.stringify({ install_url: installUrl }) : installUrl
|
|
27209
27979
|
};
|
|
27210
27980
|
} catch (error) {
|
|
27211
|
-
return { exitCode:
|
|
27981
|
+
return { exitCode: mapErrorToExitCode12(error), output: error instanceof Error ? error.message : String(error) };
|
|
27212
27982
|
}
|
|
27213
27983
|
}
|
|
27214
27984
|
async function getSlackConnectUrlWithAuthCommand(input, dependencies) {
|
|
@@ -27238,7 +28008,7 @@ async function testSlackDestinationCommand(input, api) {
|
|
|
27238
28008
|
output: input.json ? JSON.stringify({ delivery }) : `Slack test message delivered for destination: ${input.destinationId}`
|
|
27239
28009
|
};
|
|
27240
28010
|
} catch (error) {
|
|
27241
|
-
return { exitCode:
|
|
28011
|
+
return { exitCode: mapErrorToExitCode12(error), output: error instanceof Error ? error.message : String(error) };
|
|
27242
28012
|
}
|
|
27243
28013
|
}
|
|
27244
28014
|
async function testSlackDestinationWithAuthCommand(input, dependencies) {
|
|
@@ -27268,7 +28038,7 @@ async function deleteSlackDestinationCommand(input, api) {
|
|
|
27268
28038
|
output: input.json ? JSON.stringify({ destination: deleted }) : `Slack destination deleted: ${deleted.slack_destination_id}`
|
|
27269
28039
|
};
|
|
27270
28040
|
} catch (error) {
|
|
27271
|
-
return { exitCode:
|
|
28041
|
+
return { exitCode: mapErrorToExitCode12(error), output: error instanceof Error ? error.message : String(error) };
|
|
27272
28042
|
}
|
|
27273
28043
|
}
|
|
27274
28044
|
async function deleteSlackDestinationWithAuthCommand(input, dependencies) {
|
|
@@ -27288,7 +28058,7 @@ async function deleteSlackDestinationWithAuthCommand(input, dependencies) {
|
|
|
27288
28058
|
}
|
|
27289
28059
|
|
|
27290
28060
|
// src/billing-commands.ts
|
|
27291
|
-
function
|
|
28061
|
+
function mapErrorToExitCode13(error) {
|
|
27292
28062
|
if (!(error instanceof BillingApiError)) {
|
|
27293
28063
|
return 1;
|
|
27294
28064
|
}
|
|
@@ -27319,7 +28089,8 @@ function formatBillingSummary(billing) {
|
|
|
27319
28089
|
formatMetric("Raw ingested events", billing.allowances.monthly_raw_ingested_events),
|
|
27320
28090
|
formatMetric("Retained bundles", billing.allowances.retained_bundle_cap),
|
|
27321
28091
|
formatMetric("Remote activations", billing.allowances.monthly_remote_activations),
|
|
27322
|
-
formatMetric("Alert deliveries", billing.allowances.monthly_alert_deliveries)
|
|
28092
|
+
formatMetric("Alert deliveries", billing.allowances.monthly_alert_deliveries),
|
|
28093
|
+
formatMetric("Webhook deliveries", billing.allowances.monthly_webhook_deliveries)
|
|
27323
28094
|
];
|
|
27324
28095
|
if (billing.capacity_units.pending_reduction !== null) {
|
|
27325
28096
|
lines.push(
|
|
@@ -27336,7 +28107,7 @@ async function getBillingSummaryCommand(input, api) {
|
|
|
27336
28107
|
output: input.json ? JSON.stringify({ billing }) : formatBillingSummary(billing)
|
|
27337
28108
|
};
|
|
27338
28109
|
} catch (error) {
|
|
27339
|
-
return { exitCode:
|
|
28110
|
+
return { exitCode: mapErrorToExitCode13(error), output: error instanceof Error ? error.message : String(error) };
|
|
27340
28111
|
}
|
|
27341
28112
|
}
|
|
27342
28113
|
async function increaseBillingCapacityCommand(input, api) {
|
|
@@ -27351,7 +28122,7 @@ async function increaseBillingCapacityCommand(input, api) {
|
|
|
27351
28122
|
${formatBillingSummary(billing)}`
|
|
27352
28123
|
};
|
|
27353
28124
|
} catch (error) {
|
|
27354
|
-
return { exitCode:
|
|
28125
|
+
return { exitCode: mapErrorToExitCode13(error), output: error instanceof Error ? error.message : String(error) };
|
|
27355
28126
|
}
|
|
27356
28127
|
}
|
|
27357
28128
|
async function scheduleBillingCapacityReductionCommand(input, api) {
|
|
@@ -27366,7 +28137,7 @@ async function scheduleBillingCapacityReductionCommand(input, api) {
|
|
|
27366
28137
|
${formatBillingSummary(billing)}`
|
|
27367
28138
|
};
|
|
27368
28139
|
} catch (error) {
|
|
27369
|
-
return { exitCode:
|
|
28140
|
+
return { exitCode: mapErrorToExitCode13(error), output: error instanceof Error ? error.message : String(error) };
|
|
27370
28141
|
}
|
|
27371
28142
|
}
|
|
27372
28143
|
async function cancelBillingCapacityReductionCommand(input, api) {
|
|
@@ -27378,7 +28149,7 @@ async function cancelBillingCapacityReductionCommand(input, api) {
|
|
|
27378
28149
|
${formatBillingSummary(billing)}`
|
|
27379
28150
|
};
|
|
27380
28151
|
} catch (error) {
|
|
27381
|
-
return { exitCode:
|
|
28152
|
+
return { exitCode: mapErrorToExitCode13(error), output: error instanceof Error ? error.message : String(error) };
|
|
27382
28153
|
}
|
|
27383
28154
|
}
|
|
27384
28155
|
async function getBillingSummaryWithAuthCommand(input, dependencies) {
|
|
@@ -27449,7 +28220,7 @@ var MemberApiError = class extends Error {
|
|
|
27449
28220
|
this.code = code;
|
|
27450
28221
|
}
|
|
27451
28222
|
};
|
|
27452
|
-
function
|
|
28223
|
+
function toApiError3(status, body) {
|
|
27453
28224
|
if (typeof body === "object" && body !== null && "error" in body && typeof body.error === "string") {
|
|
27454
28225
|
return new MemberApiError(status, body.error);
|
|
27455
28226
|
}
|
|
@@ -27460,68 +28231,68 @@ function createMemberApi(httpClient) {
|
|
|
27460
28231
|
async listMembers(input) {
|
|
27461
28232
|
const response = await httpClient.request({
|
|
27462
28233
|
method: "GET",
|
|
27463
|
-
path:
|
|
28234
|
+
path: `/v1/projects/${input.projectId}/members`,
|
|
27464
28235
|
bearerToken: input.bearerToken
|
|
27465
28236
|
});
|
|
27466
28237
|
if (response.status !== 200) {
|
|
27467
|
-
throw
|
|
28238
|
+
throw toApiError3(response.status, response.body);
|
|
27468
28239
|
}
|
|
27469
28240
|
return response.body;
|
|
27470
28241
|
},
|
|
27471
28242
|
async listInvites(input) {
|
|
27472
28243
|
const response = await httpClient.request({
|
|
27473
28244
|
method: "GET",
|
|
27474
|
-
path:
|
|
28245
|
+
path: `/v1/projects/${input.projectId}/invites`,
|
|
27475
28246
|
bearerToken: input.bearerToken
|
|
27476
28247
|
});
|
|
27477
28248
|
if (response.status !== 200) {
|
|
27478
|
-
throw
|
|
28249
|
+
throw toApiError3(response.status, response.body);
|
|
27479
28250
|
}
|
|
27480
28251
|
return response.body;
|
|
27481
28252
|
},
|
|
27482
28253
|
async inviteMember(input) {
|
|
27483
28254
|
const response = await httpClient.request({
|
|
27484
28255
|
method: "POST",
|
|
27485
|
-
path:
|
|
28256
|
+
path: `/v1/projects/${input.projectId}/invite`,
|
|
27486
28257
|
bearerToken: input.bearerToken,
|
|
27487
28258
|
body: { email: input.email, role: input.role }
|
|
27488
28259
|
});
|
|
27489
28260
|
if (response.status !== 201) {
|
|
27490
|
-
throw
|
|
28261
|
+
throw toApiError3(response.status, response.body);
|
|
27491
28262
|
}
|
|
27492
28263
|
return response.body;
|
|
27493
28264
|
},
|
|
27494
28265
|
async cancelInvite(input) {
|
|
27495
28266
|
const response = await httpClient.request({
|
|
27496
28267
|
method: "DELETE",
|
|
27497
|
-
path: `/v1/
|
|
28268
|
+
path: `/v1/projects/${input.projectId}/invites/${input.inviteId}`,
|
|
27498
28269
|
bearerToken: input.bearerToken
|
|
27499
28270
|
});
|
|
27500
28271
|
if (response.status !== 200) {
|
|
27501
|
-
throw
|
|
28272
|
+
throw toApiError3(response.status, response.body);
|
|
27502
28273
|
}
|
|
27503
28274
|
return response.body;
|
|
27504
28275
|
},
|
|
27505
28276
|
async updateMemberRole(input) {
|
|
27506
28277
|
const response = await httpClient.request({
|
|
27507
28278
|
method: "PATCH",
|
|
27508
|
-
path: `/v1/
|
|
28279
|
+
path: `/v1/projects/${input.projectId}/members/${input.userId}`,
|
|
27509
28280
|
bearerToken: input.bearerToken,
|
|
27510
28281
|
body: { role: input.role }
|
|
27511
28282
|
});
|
|
27512
28283
|
if (response.status !== 200) {
|
|
27513
|
-
throw
|
|
28284
|
+
throw toApiError3(response.status, response.body);
|
|
27514
28285
|
}
|
|
27515
28286
|
return response.body;
|
|
27516
28287
|
},
|
|
27517
28288
|
async removeMember(input) {
|
|
27518
28289
|
const response = await httpClient.request({
|
|
27519
28290
|
method: "DELETE",
|
|
27520
|
-
path: `/v1/
|
|
28291
|
+
path: `/v1/projects/${input.projectId}/members/${input.userId}`,
|
|
27521
28292
|
bearerToken: input.bearerToken
|
|
27522
28293
|
});
|
|
27523
28294
|
if (response.status !== 200) {
|
|
27524
|
-
throw
|
|
28295
|
+
throw toApiError3(response.status, response.body);
|
|
27525
28296
|
}
|
|
27526
28297
|
return response.body;
|
|
27527
28298
|
}
|
|
@@ -27531,7 +28302,7 @@ function formatMembersTable(members) {
|
|
|
27531
28302
|
if (members.length === 0) {
|
|
27532
28303
|
return "No members found.";
|
|
27533
28304
|
}
|
|
27534
|
-
return members.map((m) => `${m.user_id} | ${m.email} | ${m.role} | joined=${m.
|
|
28305
|
+
return members.map((m) => `${m.user_id} | ${m.email} | ${m.role} | type=${m.membership_type ?? "collaborator"} | joined=${m.created_at}`).join("\n");
|
|
27535
28306
|
}
|
|
27536
28307
|
function formatInvitesTable(invites) {
|
|
27537
28308
|
if (invites.length === 0) {
|
|
@@ -27539,7 +28310,7 @@ function formatInvitesTable(invites) {
|
|
|
27539
28310
|
}
|
|
27540
28311
|
return invites.map((i) => `${i.invite_id} | ${i.email} | ${i.role} | expires=${i.expires_at}`).join("\n");
|
|
27541
28312
|
}
|
|
27542
|
-
function
|
|
28313
|
+
function mapErrorToExitCode14(error) {
|
|
27543
28314
|
if (!(error instanceof MemberApiError)) {
|
|
27544
28315
|
return 1;
|
|
27545
28316
|
}
|
|
@@ -27559,84 +28330,94 @@ function mapErrorToExitCode12(error) {
|
|
|
27559
28330
|
}
|
|
27560
28331
|
async function listMembersCommand(input, api) {
|
|
27561
28332
|
try {
|
|
27562
|
-
const result = await api.listMembers({ bearerToken: input.bearerToken });
|
|
28333
|
+
const result = await api.listMembers({ bearerToken: input.bearerToken, projectId: input.projectId });
|
|
27563
28334
|
return {
|
|
27564
28335
|
exitCode: 0,
|
|
27565
28336
|
output: input.json ? JSON.stringify(result) : formatMembersTable(result.members)
|
|
27566
28337
|
};
|
|
27567
28338
|
} catch (error) {
|
|
27568
28339
|
return {
|
|
27569
|
-
exitCode:
|
|
28340
|
+
exitCode: mapErrorToExitCode14(error),
|
|
27570
28341
|
output: error instanceof MemberApiError ? error.code : String(error)
|
|
27571
28342
|
};
|
|
27572
28343
|
}
|
|
27573
28344
|
}
|
|
27574
28345
|
async function listInvitesCommand(input, api) {
|
|
27575
28346
|
try {
|
|
27576
|
-
const result = await api.listInvites({ bearerToken: input.bearerToken });
|
|
28347
|
+
const result = await api.listInvites({ bearerToken: input.bearerToken, projectId: input.projectId });
|
|
27577
28348
|
return {
|
|
27578
28349
|
exitCode: 0,
|
|
27579
28350
|
output: input.json ? JSON.stringify(result) : formatInvitesTable(result.invites)
|
|
27580
28351
|
};
|
|
27581
28352
|
} catch (error) {
|
|
27582
28353
|
return {
|
|
27583
|
-
exitCode:
|
|
28354
|
+
exitCode: mapErrorToExitCode14(error),
|
|
27584
28355
|
output: error instanceof MemberApiError ? error.code : String(error)
|
|
27585
28356
|
};
|
|
27586
28357
|
}
|
|
27587
28358
|
}
|
|
27588
28359
|
async function inviteMemberCommand(input, api) {
|
|
27589
28360
|
try {
|
|
27590
|
-
const result = await api.inviteMember({
|
|
28361
|
+
const result = await api.inviteMember({
|
|
28362
|
+
bearerToken: input.bearerToken,
|
|
28363
|
+
projectId: input.projectId,
|
|
28364
|
+
email: input.email,
|
|
28365
|
+
role: input.role
|
|
28366
|
+
});
|
|
27591
28367
|
return {
|
|
27592
28368
|
exitCode: 0,
|
|
27593
28369
|
output: input.json ? JSON.stringify(result) : `Invite sent: ${result.invite.invite_id} \u2192 ${result.invite.email} (${result.invite.role})`
|
|
27594
28370
|
};
|
|
27595
28371
|
} catch (error) {
|
|
27596
28372
|
return {
|
|
27597
|
-
exitCode:
|
|
28373
|
+
exitCode: mapErrorToExitCode14(error),
|
|
27598
28374
|
output: error instanceof MemberApiError ? error.code : String(error)
|
|
27599
28375
|
};
|
|
27600
28376
|
}
|
|
27601
28377
|
}
|
|
27602
28378
|
async function cancelInviteCommand(input, api) {
|
|
27603
28379
|
try {
|
|
27604
|
-
const result = await api.cancelInvite({ bearerToken: input.bearerToken, inviteId: input.inviteId });
|
|
28380
|
+
const result = await api.cancelInvite({ bearerToken: input.bearerToken, projectId: input.projectId, inviteId: input.inviteId });
|
|
27605
28381
|
return {
|
|
27606
28382
|
exitCode: 0,
|
|
27607
28383
|
output: input.json ? JSON.stringify(result) : `Invite cancelled: ${result.invite.invite_id}`
|
|
27608
28384
|
};
|
|
27609
28385
|
} catch (error) {
|
|
27610
28386
|
return {
|
|
27611
|
-
exitCode:
|
|
28387
|
+
exitCode: mapErrorToExitCode14(error),
|
|
27612
28388
|
output: error instanceof MemberApiError ? error.code : String(error)
|
|
27613
28389
|
};
|
|
27614
28390
|
}
|
|
27615
28391
|
}
|
|
27616
28392
|
async function updateMemberRoleCommand(input, api) {
|
|
27617
28393
|
try {
|
|
27618
|
-
const result = await api.updateMemberRole({
|
|
28394
|
+
const result = await api.updateMemberRole({
|
|
28395
|
+
bearerToken: input.bearerToken,
|
|
28396
|
+
projectId: input.projectId,
|
|
28397
|
+
userId: input.userId,
|
|
28398
|
+
role: input.role
|
|
28399
|
+
});
|
|
27619
28400
|
return {
|
|
27620
28401
|
exitCode: 0,
|
|
27621
28402
|
output: input.json ? JSON.stringify(result) : `Role updated: ${result.member.user_id} \u2192 ${result.member.role}`
|
|
27622
28403
|
};
|
|
27623
28404
|
} catch (error) {
|
|
27624
28405
|
return {
|
|
27625
|
-
exitCode:
|
|
28406
|
+
exitCode: mapErrorToExitCode14(error),
|
|
27626
28407
|
output: error instanceof MemberApiError ? error.code : String(error)
|
|
27627
28408
|
};
|
|
27628
28409
|
}
|
|
27629
28410
|
}
|
|
27630
28411
|
async function removeMemberCommand(input, api) {
|
|
27631
28412
|
try {
|
|
27632
|
-
const result = await api.removeMember({ bearerToken: input.bearerToken, userId: input.userId });
|
|
28413
|
+
const result = await api.removeMember({ bearerToken: input.bearerToken, projectId: input.projectId, userId: input.userId });
|
|
27633
28414
|
return {
|
|
27634
28415
|
exitCode: 0,
|
|
27635
28416
|
output: input.json ? JSON.stringify(result) : `Member removed: ${result.member.user_id}`
|
|
27636
28417
|
};
|
|
27637
28418
|
} catch (error) {
|
|
27638
28419
|
return {
|
|
27639
|
-
exitCode:
|
|
28420
|
+
exitCode: mapErrorToExitCode14(error),
|
|
27640
28421
|
output: error instanceof MemberApiError ? error.code : String(error)
|
|
27641
28422
|
};
|
|
27642
28423
|
}
|
|
@@ -27658,7 +28439,7 @@ async function listMembersWithAuthCommand(input, dependencies) {
|
|
|
27658
28439
|
createApi: createAuthenticatedMemberApi,
|
|
27659
28440
|
dependencies,
|
|
27660
28441
|
runCommand: (authState, api) => listMembersCommand(
|
|
27661
|
-
{ bearerToken: authState.bearer_token, ...input.json === void 0 ? {} : { json: input.json } },
|
|
28442
|
+
{ bearerToken: authState.bearer_token, projectId: input.projectId, ...input.json === void 0 ? {} : { json: input.json } },
|
|
27662
28443
|
api
|
|
27663
28444
|
)
|
|
27664
28445
|
});
|
|
@@ -27668,7 +28449,7 @@ async function listInvitesWithAuthCommand(input, dependencies) {
|
|
|
27668
28449
|
createApi: createAuthenticatedMemberApi,
|
|
27669
28450
|
dependencies,
|
|
27670
28451
|
runCommand: (authState, api) => listInvitesCommand(
|
|
27671
|
-
{ bearerToken: authState.bearer_token, ...input.json === void 0 ? {} : { json: input.json } },
|
|
28452
|
+
{ bearerToken: authState.bearer_token, projectId: input.projectId, ...input.json === void 0 ? {} : { json: input.json } },
|
|
27672
28453
|
api
|
|
27673
28454
|
)
|
|
27674
28455
|
});
|
|
@@ -27678,7 +28459,13 @@ async function inviteMemberWithAuthCommand(input, dependencies) {
|
|
|
27678
28459
|
createApi: createAuthenticatedMemberApi,
|
|
27679
28460
|
dependencies,
|
|
27680
28461
|
runCommand: (authState, api) => inviteMemberCommand(
|
|
27681
|
-
{
|
|
28462
|
+
{
|
|
28463
|
+
bearerToken: authState.bearer_token,
|
|
28464
|
+
projectId: input.projectId,
|
|
28465
|
+
email: input.email,
|
|
28466
|
+
role: input.role,
|
|
28467
|
+
...input.json === void 0 ? {} : { json: input.json }
|
|
28468
|
+
},
|
|
27682
28469
|
api
|
|
27683
28470
|
)
|
|
27684
28471
|
});
|
|
@@ -27688,7 +28475,12 @@ async function cancelInviteWithAuthCommand(input, dependencies) {
|
|
|
27688
28475
|
createApi: createAuthenticatedMemberApi,
|
|
27689
28476
|
dependencies,
|
|
27690
28477
|
runCommand: (authState, api) => cancelInviteCommand(
|
|
27691
|
-
{
|
|
28478
|
+
{
|
|
28479
|
+
bearerToken: authState.bearer_token,
|
|
28480
|
+
projectId: input.projectId,
|
|
28481
|
+
inviteId: input.inviteId,
|
|
28482
|
+
...input.json === void 0 ? {} : { json: input.json }
|
|
28483
|
+
},
|
|
27692
28484
|
api
|
|
27693
28485
|
)
|
|
27694
28486
|
});
|
|
@@ -27698,7 +28490,13 @@ async function updateMemberRoleWithAuthCommand(input, dependencies) {
|
|
|
27698
28490
|
createApi: createAuthenticatedMemberApi,
|
|
27699
28491
|
dependencies,
|
|
27700
28492
|
runCommand: (authState, api) => updateMemberRoleCommand(
|
|
27701
|
-
{
|
|
28493
|
+
{
|
|
28494
|
+
bearerToken: authState.bearer_token,
|
|
28495
|
+
projectId: input.projectId,
|
|
28496
|
+
userId: input.userId,
|
|
28497
|
+
role: input.role,
|
|
28498
|
+
...input.json === void 0 ? {} : { json: input.json }
|
|
28499
|
+
},
|
|
27702
28500
|
api
|
|
27703
28501
|
)
|
|
27704
28502
|
});
|
|
@@ -27708,7 +28506,12 @@ async function removeMemberWithAuthCommand(input, dependencies) {
|
|
|
27708
28506
|
createApi: createAuthenticatedMemberApi,
|
|
27709
28507
|
dependencies,
|
|
27710
28508
|
runCommand: (authState, api) => removeMemberCommand(
|
|
27711
|
-
{
|
|
28509
|
+
{
|
|
28510
|
+
bearerToken: authState.bearer_token,
|
|
28511
|
+
projectId: input.projectId,
|
|
28512
|
+
userId: input.userId,
|
|
28513
|
+
...input.json === void 0 ? {} : { json: input.json }
|
|
28514
|
+
},
|
|
27712
28515
|
api
|
|
27713
28516
|
)
|
|
27714
28517
|
});
|
|
@@ -27725,7 +28528,7 @@ var ProbeApiError = class extends Error {
|
|
|
27725
28528
|
this.code = code;
|
|
27726
28529
|
}
|
|
27727
28530
|
};
|
|
27728
|
-
function
|
|
28531
|
+
function toApiError4(status, body) {
|
|
27729
28532
|
if (typeof body === "object" && body !== null && "error" in body && typeof body.error === "string") {
|
|
27730
28533
|
return new ProbeApiError(status, body.error);
|
|
27731
28534
|
}
|
|
@@ -27756,7 +28559,7 @@ function createProbeApi(httpClient) {
|
|
|
27756
28559
|
body
|
|
27757
28560
|
});
|
|
27758
28561
|
if (response.status !== 201) {
|
|
27759
|
-
throw
|
|
28562
|
+
throw toApiError4(response.status, response.body);
|
|
27760
28563
|
}
|
|
27761
28564
|
return response.body;
|
|
27762
28565
|
},
|
|
@@ -27767,7 +28570,7 @@ function createProbeApi(httpClient) {
|
|
|
27767
28570
|
bearerToken: input.bearerToken
|
|
27768
28571
|
});
|
|
27769
28572
|
if (response.status !== 200) {
|
|
27770
|
-
throw
|
|
28573
|
+
throw toApiError4(response.status, response.body);
|
|
27771
28574
|
}
|
|
27772
28575
|
return response.body;
|
|
27773
28576
|
},
|
|
@@ -27779,13 +28582,13 @@ function createProbeApi(httpClient) {
|
|
|
27779
28582
|
body: { activation_id: input.activationId }
|
|
27780
28583
|
});
|
|
27781
28584
|
if (response.status !== 200) {
|
|
27782
|
-
throw
|
|
28585
|
+
throw toApiError4(response.status, response.body);
|
|
27783
28586
|
}
|
|
27784
28587
|
return response.body;
|
|
27785
28588
|
}
|
|
27786
28589
|
};
|
|
27787
28590
|
}
|
|
27788
|
-
function
|
|
28591
|
+
function mapErrorToExitCode15(error) {
|
|
27789
28592
|
if (!(error instanceof ProbeApiError)) {
|
|
27790
28593
|
return 1;
|
|
27791
28594
|
}
|
|
@@ -27838,7 +28641,7 @@ async function activateProbeCommand(input, api) {
|
|
|
27838
28641
|
Trigger token: ${result.trigger_token}`
|
|
27839
28642
|
};
|
|
27840
28643
|
} catch (error) {
|
|
27841
|
-
return { exitCode:
|
|
28644
|
+
return { exitCode: mapErrorToExitCode15(error), output: error instanceof Error ? error.message : String(error) };
|
|
27842
28645
|
}
|
|
27843
28646
|
}
|
|
27844
28647
|
async function listActiveProbesCommand(input, api) {
|
|
@@ -27858,7 +28661,7 @@ async function listActiveProbesCommand(input, api) {
|
|
|
27858
28661
|
output: result.activations.map((a) => `${a.activation_id} ${a.label_pattern} (${a.service}/${a.environment}) expires ${a.expires_at}`).join("\n")
|
|
27859
28662
|
};
|
|
27860
28663
|
} catch (error) {
|
|
27861
|
-
return { exitCode:
|
|
28664
|
+
return { exitCode: mapErrorToExitCode15(error), output: error instanceof Error ? error.message : String(error) };
|
|
27862
28665
|
}
|
|
27863
28666
|
}
|
|
27864
28667
|
async function deactivateProbeCommand(input, api) {
|
|
@@ -27876,7 +28679,7 @@ async function deactivateProbeCommand(input, api) {
|
|
|
27876
28679
|
output: result.deactivated ? "Probe deactivated." : "Probe was already inactive."
|
|
27877
28680
|
};
|
|
27878
28681
|
} catch (error) {
|
|
27879
|
-
return { exitCode:
|
|
28682
|
+
return { exitCode: mapErrorToExitCode15(error), output: error instanceof Error ? error.message : String(error) };
|
|
27880
28683
|
}
|
|
27881
28684
|
}
|
|
27882
28685
|
async function createAuthenticatedProbeApi(input, dependencies) {
|
|
@@ -27926,7 +28729,7 @@ async function deactivateProbeWithAuthCommand(input, dependencies) {
|
|
|
27926
28729
|
}
|
|
27927
28730
|
|
|
27928
28731
|
// src/github-commands.ts
|
|
27929
|
-
function
|
|
28732
|
+
function mapErrorToExitCode16(error) {
|
|
27930
28733
|
if (!(error instanceof GitHubManagementApiError)) {
|
|
27931
28734
|
return 1;
|
|
27932
28735
|
}
|
|
@@ -27973,7 +28776,10 @@ function formatGitHubDeliveryTable(deliveries) {
|
|
|
27973
28776
|
}
|
|
27974
28777
|
async function getGitHubStatusCommand(input, api) {
|
|
27975
28778
|
try {
|
|
27976
|
-
const installation = await api.getInstallation({
|
|
28779
|
+
const installation = await api.getInstallation({
|
|
28780
|
+
bearerToken: input.bearerToken,
|
|
28781
|
+
...input.projectId === void 0 ? {} : { projectId: input.projectId }
|
|
28782
|
+
});
|
|
27977
28783
|
const repo = input.projectId === void 0 || api.getProjectRepo === void 0 ? null : await api.getProjectRepo({ bearerToken: input.bearerToken, projectId: input.projectId });
|
|
27978
28784
|
if (input.json) {
|
|
27979
28785
|
return {
|
|
@@ -27987,18 +28793,21 @@ async function getGitHubStatusCommand(input, api) {
|
|
|
27987
28793
|
${formatProjectRepo(repo)}`
|
|
27988
28794
|
};
|
|
27989
28795
|
} catch (error) {
|
|
27990
|
-
return { exitCode:
|
|
28796
|
+
return { exitCode: mapErrorToExitCode16(error), output: error instanceof Error ? error.message : String(error) };
|
|
27991
28797
|
}
|
|
27992
28798
|
}
|
|
27993
28799
|
async function listGitHubRepositoriesCommand(input, api) {
|
|
27994
28800
|
try {
|
|
27995
|
-
const repositories = await api.listRepositories({
|
|
28801
|
+
const repositories = await api.listRepositories({
|
|
28802
|
+
bearerToken: input.bearerToken,
|
|
28803
|
+
...input.projectId === void 0 ? {} : { projectId: input.projectId }
|
|
28804
|
+
});
|
|
27996
28805
|
return {
|
|
27997
28806
|
exitCode: 0,
|
|
27998
28807
|
output: input.json ? JSON.stringify({ repositories }) : repositories.length === 0 ? "No GitHub repositories found." : repositories.map((repository) => `${repository.full_name} (${repository.default_branch})`).join("\n")
|
|
27999
28808
|
};
|
|
28000
28809
|
} catch (error) {
|
|
28001
|
-
return { exitCode:
|
|
28810
|
+
return { exitCode: mapErrorToExitCode16(error), output: error instanceof Error ? error.message : String(error) };
|
|
28002
28811
|
}
|
|
28003
28812
|
}
|
|
28004
28813
|
async function setProjectGitHubRepoCommand(input, api) {
|
|
@@ -28021,7 +28830,7 @@ async function setProjectGitHubRepoCommand(input, api) {
|
|
|
28021
28830
|
output: input.json ? JSON.stringify({ repo: assignedRepo }) : `Project repo set: ${formatProjectRepo(assignedRepo)}`
|
|
28022
28831
|
};
|
|
28023
28832
|
} catch (error) {
|
|
28024
|
-
return { exitCode:
|
|
28833
|
+
return { exitCode: mapErrorToExitCode16(error), output: error instanceof Error ? error.message : String(error) };
|
|
28025
28834
|
}
|
|
28026
28835
|
}
|
|
28027
28836
|
async function removeProjectGitHubRepoCommand(input, api) {
|
|
@@ -28032,7 +28841,7 @@ async function removeProjectGitHubRepoCommand(input, api) {
|
|
|
28032
28841
|
output: input.json ? JSON.stringify({ removed: true, project_id: input.projectId }) : `Project repo removed: ${input.projectId}`
|
|
28033
28842
|
};
|
|
28034
28843
|
} catch (error) {
|
|
28035
|
-
return { exitCode:
|
|
28844
|
+
return { exitCode: mapErrorToExitCode16(error), output: error instanceof Error ? error.message : String(error) };
|
|
28036
28845
|
}
|
|
28037
28846
|
}
|
|
28038
28847
|
async function listProjectGitHubRulesCommand(input, api) {
|
|
@@ -28046,7 +28855,7 @@ async function listProjectGitHubRulesCommand(input, api) {
|
|
|
28046
28855
|
output: input.json ? JSON.stringify({ rules }) : formatGitHubRuleTable(rules)
|
|
28047
28856
|
};
|
|
28048
28857
|
} catch (error) {
|
|
28049
|
-
return { exitCode:
|
|
28858
|
+
return { exitCode: mapErrorToExitCode16(error), output: error instanceof Error ? error.message : String(error) };
|
|
28050
28859
|
}
|
|
28051
28860
|
}
|
|
28052
28861
|
async function listProjectGitHubDeliveriesCommand(input, api) {
|
|
@@ -28062,7 +28871,7 @@ async function listProjectGitHubDeliveriesCommand(input, api) {
|
|
|
28062
28871
|
output: input.json ? JSON.stringify({ deliveries }) : formatGitHubDeliveryTable(deliveries)
|
|
28063
28872
|
};
|
|
28064
28873
|
} catch (error) {
|
|
28065
|
-
return { exitCode:
|
|
28874
|
+
return { exitCode: mapErrorToExitCode16(error), output: error instanceof Error ? error.message : String(error) };
|
|
28066
28875
|
}
|
|
28067
28876
|
}
|
|
28068
28877
|
async function retryProjectGitHubDeliveryCommand(input, api) {
|
|
@@ -28077,7 +28886,7 @@ async function retryProjectGitHubDeliveryCommand(input, api) {
|
|
|
28077
28886
|
output: input.json ? JSON.stringify({ delivery }) : `GitHub delivery retried: ${delivery.delivery_id} | ${delivery.status}`
|
|
28078
28887
|
};
|
|
28079
28888
|
} catch (error) {
|
|
28080
|
-
return { exitCode:
|
|
28889
|
+
return { exitCode: mapErrorToExitCode16(error), output: error instanceof Error ? error.message : String(error) };
|
|
28081
28890
|
}
|
|
28082
28891
|
}
|
|
28083
28892
|
async function createProjectGitHubRuleCommand(input, api) {
|
|
@@ -28100,7 +28909,7 @@ async function createProjectGitHubRuleCommand(input, api) {
|
|
|
28100
28909
|
output: input.json ? JSON.stringify({ rule }) : `GitHub rule created: ${rule.rule_id}`
|
|
28101
28910
|
};
|
|
28102
28911
|
} catch (error) {
|
|
28103
|
-
return { exitCode:
|
|
28912
|
+
return { exitCode: mapErrorToExitCode16(error), output: error instanceof Error ? error.message : String(error) };
|
|
28104
28913
|
}
|
|
28105
28914
|
}
|
|
28106
28915
|
async function updateProjectGitHubRuleCommand(input, api) {
|
|
@@ -28124,7 +28933,7 @@ async function updateProjectGitHubRuleCommand(input, api) {
|
|
|
28124
28933
|
output: input.json ? JSON.stringify({ rule }) : `GitHub rule updated: ${rule.rule_id}`
|
|
28125
28934
|
};
|
|
28126
28935
|
} catch (error) {
|
|
28127
|
-
return { exitCode:
|
|
28936
|
+
return { exitCode: mapErrorToExitCode16(error), output: error instanceof Error ? error.message : String(error) };
|
|
28128
28937
|
}
|
|
28129
28938
|
}
|
|
28130
28939
|
async function deleteProjectGitHubRuleCommand(input, api) {
|
|
@@ -28139,7 +28948,7 @@ async function deleteProjectGitHubRuleCommand(input, api) {
|
|
|
28139
28948
|
output: input.json ? JSON.stringify({ deleted: true, project_id: input.projectId, rule_id: input.ruleId }) : `GitHub rule deleted: ${input.ruleId}`
|
|
28140
28949
|
};
|
|
28141
28950
|
} catch (error) {
|
|
28142
|
-
return { exitCode:
|
|
28951
|
+
return { exitCode: mapErrorToExitCode16(error), output: error instanceof Error ? error.message : String(error) };
|
|
28143
28952
|
}
|
|
28144
28953
|
}
|
|
28145
28954
|
async function getGitHubStatusWithAuthCommand(input, dependencies) {
|
|
@@ -28324,11 +29133,14 @@ async function handleGithubCommand(parsedArgv, dependencies) {
|
|
|
28324
29133
|
return await (dependencies.getGitHubStatusCommand ?? getGitHubStatusWithAuthCommand)(input);
|
|
28325
29134
|
}
|
|
28326
29135
|
if (action === "repos") {
|
|
28327
|
-
expectNoUnknownOptions(parsedArgv, ["auth-file", "json"]);
|
|
29136
|
+
expectNoUnknownOptions(parsedArgv, ["auth-file", "json", "project-id"]);
|
|
28328
29137
|
ensureNoExtraPositionals(parsedArgv, 2);
|
|
28329
|
-
|
|
28330
|
-
|
|
28331
|
-
)
|
|
29138
|
+
const input = appendCommonAuthOptions(parsedArgv, {});
|
|
29139
|
+
const projectId = readStringOption(parsedArgv, "project-id");
|
|
29140
|
+
if (projectId !== void 0) {
|
|
29141
|
+
input.projectId = projectId;
|
|
29142
|
+
}
|
|
29143
|
+
return await (dependencies.listGitHubRepositoriesCommand ?? listGitHubRepositoriesWithAuthCommand)(input);
|
|
28332
29144
|
}
|
|
28333
29145
|
if (action !== "repo") {
|
|
28334
29146
|
if (action === "deliveries") {
|
|
@@ -28488,6 +29300,133 @@ async function handleGithubCommand(parsedArgv, dependencies) {
|
|
|
28488
29300
|
}
|
|
28489
29301
|
throw new CliInputError("Unknown github repo command.");
|
|
28490
29302
|
}
|
|
29303
|
+
async function handleImprovementsCommand(parsedArgv, dependencies) {
|
|
29304
|
+
const action = requirePositional(parsedArgv, 1, "action");
|
|
29305
|
+
if (action === "list") {
|
|
29306
|
+
expectNoUnknownOptions(parsedArgv, ["project-id", "environment", "service", "status", "severity", "kind", "cursor", "limit", "auth-file", "json"]);
|
|
29307
|
+
ensureNoExtraPositionals(parsedArgv, 2);
|
|
29308
|
+
const input = appendCommonAuthOptions(parsedArgv, {});
|
|
29309
|
+
const projectId = readStringOption(parsedArgv, "project-id");
|
|
29310
|
+
if (projectId !== void 0) input.projectId = projectId;
|
|
29311
|
+
const environment = readStringOption(parsedArgv, "environment");
|
|
29312
|
+
if (environment !== void 0) input.environment = environment;
|
|
29313
|
+
const service = readStringOption(parsedArgv, "service");
|
|
29314
|
+
if (service !== void 0) input.service = service;
|
|
29315
|
+
const status = readStringOption(parsedArgv, "status");
|
|
29316
|
+
if (status !== void 0) input.status = status;
|
|
29317
|
+
const severity = readStringOption(parsedArgv, "severity");
|
|
29318
|
+
if (severity !== void 0) input.severity = severity;
|
|
29319
|
+
const kind = readStringOption(parsedArgv, "kind");
|
|
29320
|
+
if (kind !== void 0) input.kind = kind;
|
|
29321
|
+
const cursor = readStringOption(parsedArgv, "cursor");
|
|
29322
|
+
if (cursor !== void 0) input.cursor = cursor;
|
|
29323
|
+
const limit = readLimitOption(parsedArgv);
|
|
29324
|
+
if (limit !== void 0) input.limit = limit;
|
|
29325
|
+
return await (dependencies.listImprovementsCommand ?? listImprovementsWithAuthCommand)(input);
|
|
29326
|
+
}
|
|
29327
|
+
if (action === "get") {
|
|
29328
|
+
expectNoUnknownOptions(parsedArgv, ["auth-file", "json"]);
|
|
29329
|
+
ensureNoExtraPositionals(parsedArgv, 3);
|
|
29330
|
+
return await (dependencies.getImprovementCommand ?? getImprovementWithAuthCommand)(
|
|
29331
|
+
appendCommonAuthOptions(parsedArgv, {
|
|
29332
|
+
improvementId: requirePositional(parsedArgv, 2, "improvement-id")
|
|
29333
|
+
})
|
|
29334
|
+
);
|
|
29335
|
+
}
|
|
29336
|
+
if (action === "bundle") {
|
|
29337
|
+
expectNoUnknownOptions(parsedArgv, ["project-id", "auth-file", "json"]);
|
|
29338
|
+
ensureNoExtraPositionals(parsedArgv, 3);
|
|
29339
|
+
const projectId = readStringOption(parsedArgv, "project-id");
|
|
29340
|
+
if (projectId === void 0) {
|
|
29341
|
+
throw new CliInputError("Missing required option --project-id.");
|
|
29342
|
+
}
|
|
29343
|
+
return await (dependencies.getImprovementBundleCommand ?? getImprovementBundleWithAuthCommand)(
|
|
29344
|
+
appendCommonAuthOptions(parsedArgv, {
|
|
29345
|
+
projectId,
|
|
29346
|
+
improvementId: requirePositional(parsedArgv, 2, "improvement-id")
|
|
29347
|
+
})
|
|
29348
|
+
);
|
|
29349
|
+
}
|
|
29350
|
+
if (action === "resolve") {
|
|
29351
|
+
expectNoUnknownOptions(parsedArgv, ["auth-file", "json"]);
|
|
29352
|
+
ensureNoExtraPositionals(parsedArgv, 3);
|
|
29353
|
+
return await (dependencies.resolveImprovementCommand ?? resolveImprovementWithAuthCommand)(
|
|
29354
|
+
appendCommonAuthOptions(parsedArgv, {
|
|
29355
|
+
improvementId: requirePositional(parsedArgv, 2, "improvement-id")
|
|
29356
|
+
})
|
|
29357
|
+
);
|
|
29358
|
+
}
|
|
29359
|
+
if (action === "reopen") {
|
|
29360
|
+
expectNoUnknownOptions(parsedArgv, ["auth-file", "json"]);
|
|
29361
|
+
ensureNoExtraPositionals(parsedArgv, 3);
|
|
29362
|
+
return await (dependencies.reopenImprovementCommand ?? reopenImprovementWithAuthCommand)(
|
|
29363
|
+
appendCommonAuthOptions(parsedArgv, {
|
|
29364
|
+
improvementId: requirePositional(parsedArgv, 2, "improvement-id")
|
|
29365
|
+
})
|
|
29366
|
+
);
|
|
29367
|
+
}
|
|
29368
|
+
if (action === "snooze") {
|
|
29369
|
+
expectNoUnknownOptions(parsedArgv, ["until", "auth-file", "json"]);
|
|
29370
|
+
ensureNoExtraPositionals(parsedArgv, 3);
|
|
29371
|
+
const snoozedUntil = readStringOption(parsedArgv, "until");
|
|
29372
|
+
if (snoozedUntil === void 0) {
|
|
29373
|
+
throw new CliInputError("Missing required option --until.");
|
|
29374
|
+
}
|
|
29375
|
+
return await (dependencies.snoozeImprovementCommand ?? snoozeImprovementWithAuthCommand)(
|
|
29376
|
+
appendCommonAuthOptions(parsedArgv, {
|
|
29377
|
+
improvementId: requirePositional(parsedArgv, 2, "improvement-id"),
|
|
29378
|
+
snoozedUntil
|
|
29379
|
+
})
|
|
29380
|
+
);
|
|
29381
|
+
}
|
|
29382
|
+
if (action !== "settings") {
|
|
29383
|
+
throw new CliInputError("Unknown improvements command.");
|
|
29384
|
+
}
|
|
29385
|
+
const settingsAction = requirePositional(parsedArgv, 2, "settings action");
|
|
29386
|
+
if (settingsAction === "get") {
|
|
29387
|
+
expectNoUnknownOptions(parsedArgv, ["project", "auth-file", "json"]);
|
|
29388
|
+
ensureNoExtraPositionals(parsedArgv, 3);
|
|
29389
|
+
const projectId = readStringOption(parsedArgv, "project");
|
|
29390
|
+
if (projectId === void 0) {
|
|
29391
|
+
throw new CliInputError("Missing required option --project.");
|
|
29392
|
+
}
|
|
29393
|
+
return await (dependencies.getImprovementSettingsCommand ?? getImprovementSettingsWithAuthCommand)(
|
|
29394
|
+
appendCommonAuthOptions(parsedArgv, {
|
|
29395
|
+
projectId
|
|
29396
|
+
})
|
|
29397
|
+
);
|
|
29398
|
+
}
|
|
29399
|
+
if (settingsAction === "set") {
|
|
29400
|
+
expectNoUnknownOptions(parsedArgv, ["project", "enabled", "sensitivity", "auth-file", "json"]);
|
|
29401
|
+
ensureNoExtraPositionals(parsedArgv, 3);
|
|
29402
|
+
const projectId = readStringOption(parsedArgv, "project");
|
|
29403
|
+
if (projectId === void 0) {
|
|
29404
|
+
throw new CliInputError("Missing required option --project.");
|
|
29405
|
+
}
|
|
29406
|
+
const update = {};
|
|
29407
|
+
const enabled = readBooleanStringOption(parsedArgv, "enabled");
|
|
29408
|
+
if (enabled !== void 0) {
|
|
29409
|
+
update.automated_improvement_bundles_enabled = enabled;
|
|
29410
|
+
}
|
|
29411
|
+
const sensitivity = readStringOption(parsedArgv, "sensitivity");
|
|
29412
|
+
if (sensitivity !== void 0) {
|
|
29413
|
+
if (sensitivity !== "high_confidence" && sensitivity !== "balanced" && sensitivity !== "verbose") {
|
|
29414
|
+
throw new CliInputError("Invalid value for --sensitivity.");
|
|
29415
|
+
}
|
|
29416
|
+
update.improvement_bundle_sensitivity = sensitivity;
|
|
29417
|
+
}
|
|
29418
|
+
if (Object.keys(update).length === 0) {
|
|
29419
|
+
throw new CliInputError("At least one improvement settings field must be provided.");
|
|
29420
|
+
}
|
|
29421
|
+
return await (dependencies.setImprovementSettingsCommand ?? setImprovementSettingsWithAuthCommand)(
|
|
29422
|
+
appendCommonAuthOptions(parsedArgv, {
|
|
29423
|
+
projectId,
|
|
29424
|
+
update
|
|
29425
|
+
})
|
|
29426
|
+
);
|
|
29427
|
+
}
|
|
29428
|
+
throw new CliInputError("Unknown improvements settings command.");
|
|
29429
|
+
}
|
|
28491
29430
|
async function handleBillingCommand(parsedArgv, dependencies) {
|
|
28492
29431
|
const action = requirePositional(parsedArgv, 1, "action");
|
|
28493
29432
|
if (action === "get") {
|
|
@@ -28532,6 +29471,78 @@ async function handleBillingCommand(parsedArgv, dependencies) {
|
|
|
28532
29471
|
}
|
|
28533
29472
|
async function handleProjectCommand(parsedArgv, dependencies) {
|
|
28534
29473
|
const action = requirePositional(parsedArgv, 1, "action");
|
|
29474
|
+
if (action === "members") {
|
|
29475
|
+
const membersAction = requirePositional(parsedArgv, 2, "members-action");
|
|
29476
|
+
const projectId = readStringOption(parsedArgv, "project-id");
|
|
29477
|
+
if (projectId === void 0) {
|
|
29478
|
+
throw new CliInputError("Missing required option --project-id.");
|
|
29479
|
+
}
|
|
29480
|
+
if (membersAction === "list") {
|
|
29481
|
+
expectNoUnknownOptions(parsedArgv, ["auth-file", "json", "project-id"]);
|
|
29482
|
+
ensureNoExtraPositionals(parsedArgv, 3);
|
|
29483
|
+
return await (dependencies.listMembersCommand ?? listMembersWithAuthCommand)(
|
|
29484
|
+
appendCommonAuthOptions(parsedArgv, { projectId })
|
|
29485
|
+
);
|
|
29486
|
+
}
|
|
29487
|
+
if (membersAction === "invites") {
|
|
29488
|
+
expectNoUnknownOptions(parsedArgv, ["auth-file", "json", "project-id"]);
|
|
29489
|
+
ensureNoExtraPositionals(parsedArgv, 3);
|
|
29490
|
+
return await (dependencies.listInvitesCommand ?? listInvitesWithAuthCommand)(
|
|
29491
|
+
appendCommonAuthOptions(parsedArgv, { projectId })
|
|
29492
|
+
);
|
|
29493
|
+
}
|
|
29494
|
+
if (membersAction === "invite") {
|
|
29495
|
+
expectNoUnknownOptions(parsedArgv, ["auth-file", "json", "project-id", "email", "role"]);
|
|
29496
|
+
ensureNoExtraPositionals(parsedArgv, 3);
|
|
29497
|
+
const email = readStringOption(parsedArgv, "email");
|
|
29498
|
+
if (email === void 0) {
|
|
29499
|
+
throw new CliInputError("Missing required option --email.");
|
|
29500
|
+
}
|
|
29501
|
+
const role = readStringOption(parsedArgv, "role");
|
|
29502
|
+
if (role === void 0) {
|
|
29503
|
+
throw new CliInputError("Missing required option --role.");
|
|
29504
|
+
}
|
|
29505
|
+
return await (dependencies.inviteMemberCommand ?? inviteMemberWithAuthCommand)(
|
|
29506
|
+
appendCommonAuthOptions(parsedArgv, { projectId, email, role })
|
|
29507
|
+
);
|
|
29508
|
+
}
|
|
29509
|
+
if (membersAction === "cancel-invite") {
|
|
29510
|
+
expectNoUnknownOptions(parsedArgv, ["auth-file", "json", "project-id"]);
|
|
29511
|
+
ensureNoExtraPositionals(parsedArgv, 4);
|
|
29512
|
+
return await (dependencies.cancelInviteCommand ?? cancelInviteWithAuthCommand)(
|
|
29513
|
+
appendCommonAuthOptions(parsedArgv, {
|
|
29514
|
+
projectId,
|
|
29515
|
+
inviteId: requirePositional(parsedArgv, 3, "invite-id")
|
|
29516
|
+
})
|
|
29517
|
+
);
|
|
29518
|
+
}
|
|
29519
|
+
if (membersAction === "update-role") {
|
|
29520
|
+
expectNoUnknownOptions(parsedArgv, ["auth-file", "json", "project-id", "role"]);
|
|
29521
|
+
ensureNoExtraPositionals(parsedArgv, 4);
|
|
29522
|
+
const role = readStringOption(parsedArgv, "role");
|
|
29523
|
+
if (role === void 0) {
|
|
29524
|
+
throw new CliInputError("Missing required option --role.");
|
|
29525
|
+
}
|
|
29526
|
+
return await (dependencies.updateMemberRoleCommand ?? updateMemberRoleWithAuthCommand)(
|
|
29527
|
+
appendCommonAuthOptions(parsedArgv, {
|
|
29528
|
+
projectId,
|
|
29529
|
+
userId: requirePositional(parsedArgv, 3, "user-id"),
|
|
29530
|
+
role
|
|
29531
|
+
})
|
|
29532
|
+
);
|
|
29533
|
+
}
|
|
29534
|
+
if (membersAction === "remove") {
|
|
29535
|
+
expectNoUnknownOptions(parsedArgv, ["auth-file", "json", "project-id"]);
|
|
29536
|
+
ensureNoExtraPositionals(parsedArgv, 4);
|
|
29537
|
+
return await (dependencies.removeMemberCommand ?? removeMemberWithAuthCommand)(
|
|
29538
|
+
appendCommonAuthOptions(parsedArgv, {
|
|
29539
|
+
projectId,
|
|
29540
|
+
userId: requirePositional(parsedArgv, 3, "user-id")
|
|
29541
|
+
})
|
|
29542
|
+
);
|
|
29543
|
+
}
|
|
29544
|
+
throw new CliInputError("Unknown project members command.");
|
|
29545
|
+
}
|
|
28535
29546
|
if (action === "list") {
|
|
28536
29547
|
expectNoUnknownOptions(parsedArgv, ["auth-file", "json", "limit"]);
|
|
28537
29548
|
ensureNoExtraPositionals(parsedArgv, 2);
|
|
@@ -28825,66 +29836,10 @@ async function handleProbeCommand(parsedArgv, dependencies) {
|
|
|
28825
29836
|
}
|
|
28826
29837
|
throw new CliInputError("Unknown probe command.");
|
|
28827
29838
|
}
|
|
28828
|
-
|
|
28829
|
-
|
|
28830
|
-
|
|
28831
|
-
|
|
28832
|
-
ensureNoExtraPositionals(parsedArgv, 2);
|
|
28833
|
-
return await (dependencies.listMembersCommand ?? listMembersWithAuthCommand)(appendCommonAuthOptions(parsedArgv, {}));
|
|
28834
|
-
}
|
|
28835
|
-
if (action === "invites") {
|
|
28836
|
-
expectNoUnknownOptions(parsedArgv, ["auth-file", "json"]);
|
|
28837
|
-
ensureNoExtraPositionals(parsedArgv, 2);
|
|
28838
|
-
return await (dependencies.listInvitesCommand ?? listInvitesWithAuthCommand)(appendCommonAuthOptions(parsedArgv, {}));
|
|
28839
|
-
}
|
|
28840
|
-
if (action === "invite") {
|
|
28841
|
-
expectNoUnknownOptions(parsedArgv, ["auth-file", "json", "email", "role"]);
|
|
28842
|
-
ensureNoExtraPositionals(parsedArgv, 2);
|
|
28843
|
-
const email = readStringOption(parsedArgv, "email");
|
|
28844
|
-
if (email === void 0) {
|
|
28845
|
-
throw new CliInputError("Missing required option --email.");
|
|
28846
|
-
}
|
|
28847
|
-
const role = readStringOption(parsedArgv, "role");
|
|
28848
|
-
if (role === void 0) {
|
|
28849
|
-
throw new CliInputError("Missing required option --role.");
|
|
28850
|
-
}
|
|
28851
|
-
return await (dependencies.inviteMemberCommand ?? inviteMemberWithAuthCommand)(
|
|
28852
|
-
appendCommonAuthOptions(parsedArgv, { email, role })
|
|
28853
|
-
);
|
|
28854
|
-
}
|
|
28855
|
-
if (action === "cancel-invite") {
|
|
28856
|
-
expectNoUnknownOptions(parsedArgv, ["auth-file", "json"]);
|
|
28857
|
-
ensureNoExtraPositionals(parsedArgv, 3);
|
|
28858
|
-
return await (dependencies.cancelInviteCommand ?? cancelInviteWithAuthCommand)(
|
|
28859
|
-
appendCommonAuthOptions(parsedArgv, {
|
|
28860
|
-
inviteId: requirePositional(parsedArgv, 2, "invite-id")
|
|
28861
|
-
})
|
|
28862
|
-
);
|
|
28863
|
-
}
|
|
28864
|
-
if (action === "update-role") {
|
|
28865
|
-
expectNoUnknownOptions(parsedArgv, ["auth-file", "json", "role"]);
|
|
28866
|
-
ensureNoExtraPositionals(parsedArgv, 3);
|
|
28867
|
-
const role = readStringOption(parsedArgv, "role");
|
|
28868
|
-
if (role === void 0) {
|
|
28869
|
-
throw new CliInputError("Missing required option --role.");
|
|
28870
|
-
}
|
|
28871
|
-
return await (dependencies.updateMemberRoleCommand ?? updateMemberRoleWithAuthCommand)(
|
|
28872
|
-
appendCommonAuthOptions(parsedArgv, {
|
|
28873
|
-
userId: requirePositional(parsedArgv, 2, "user-id"),
|
|
28874
|
-
role
|
|
28875
|
-
})
|
|
28876
|
-
);
|
|
28877
|
-
}
|
|
28878
|
-
if (action === "remove") {
|
|
28879
|
-
expectNoUnknownOptions(parsedArgv, ["auth-file", "json"]);
|
|
28880
|
-
ensureNoExtraPositionals(parsedArgv, 3);
|
|
28881
|
-
return await (dependencies.removeMemberCommand ?? removeMemberWithAuthCommand)(
|
|
28882
|
-
appendCommonAuthOptions(parsedArgv, {
|
|
28883
|
-
userId: requirePositional(parsedArgv, 2, "user-id")
|
|
28884
|
-
})
|
|
28885
|
-
);
|
|
28886
|
-
}
|
|
28887
|
-
throw new CliInputError("Unknown member command.");
|
|
29839
|
+
function handleMemberCommand(parsedArgv, dependencies) {
|
|
29840
|
+
void parsedArgv;
|
|
29841
|
+
void dependencies;
|
|
29842
|
+
throw new CliInputError("Use `debugbundle project members ... --project-id <id>` for project collaboration commands.");
|
|
28888
29843
|
}
|
|
28889
29844
|
async function handleWebhookCommand(parsedArgv, dependencies) {
|
|
28890
29845
|
const action = requirePositional(parsedArgv, 1, "action");
|
|
@@ -28970,6 +29925,7 @@ async function handleWebhookCommand(parsedArgv, dependencies) {
|
|
|
28970
29925
|
expectNoUnknownOptions(parsedArgv, [
|
|
28971
29926
|
"auth-file",
|
|
28972
29927
|
"json",
|
|
29928
|
+
"project-id",
|
|
28973
29929
|
"url",
|
|
28974
29930
|
"event",
|
|
28975
29931
|
"environment",
|
|
@@ -28980,7 +29936,12 @@ async function handleWebhookCommand(parsedArgv, dependencies) {
|
|
|
28980
29936
|
"is-enabled"
|
|
28981
29937
|
]);
|
|
28982
29938
|
ensureNoExtraPositionals(parsedArgv, 3);
|
|
29939
|
+
const projectId = readStringOption(parsedArgv, "project-id");
|
|
29940
|
+
if (projectId === void 0) {
|
|
29941
|
+
throw new CliInputError("Missing required option --project-id.");
|
|
29942
|
+
}
|
|
28983
29943
|
const input = appendCommonAuthOptions(parsedArgv, {
|
|
29944
|
+
projectId,
|
|
28984
29945
|
webhookId: requirePositional(parsedArgv, 2, "webhook-id")
|
|
28985
29946
|
});
|
|
28986
29947
|
const url = readStringOption(parsedArgv, "url");
|
|
@@ -29025,18 +29986,28 @@ async function handleWebhookCommand(parsedArgv, dependencies) {
|
|
|
29025
29986
|
return await (dependencies.updateWebhookCommand ?? updateWebhookWithAuthCommand)(input);
|
|
29026
29987
|
}
|
|
29027
29988
|
if (action === "delete") {
|
|
29028
|
-
expectNoUnknownOptions(parsedArgv, ["auth-file", "json"]);
|
|
29989
|
+
expectNoUnknownOptions(parsedArgv, ["auth-file", "json", "project-id"]);
|
|
29029
29990
|
ensureNoExtraPositionals(parsedArgv, 3);
|
|
29991
|
+
const projectId = readStringOption(parsedArgv, "project-id");
|
|
29992
|
+
if (projectId === void 0) {
|
|
29993
|
+
throw new CliInputError("Missing required option --project-id.");
|
|
29994
|
+
}
|
|
29030
29995
|
return await (dependencies.deleteWebhookCommand ?? deleteWebhookWithAuthCommand)(
|
|
29031
29996
|
appendCommonAuthOptions(parsedArgv, {
|
|
29997
|
+
projectId,
|
|
29032
29998
|
webhookId: requirePositional(parsedArgv, 2, "webhook-id")
|
|
29033
29999
|
})
|
|
29034
30000
|
);
|
|
29035
30001
|
}
|
|
29036
30002
|
if (action === "test") {
|
|
29037
|
-
expectNoUnknownOptions(parsedArgv, ["auth-file", "json", "event"]);
|
|
30003
|
+
expectNoUnknownOptions(parsedArgv, ["auth-file", "json", "project-id", "event"]);
|
|
29038
30004
|
ensureNoExtraPositionals(parsedArgv, 3);
|
|
30005
|
+
const projectId = readStringOption(parsedArgv, "project-id");
|
|
30006
|
+
if (projectId === void 0) {
|
|
30007
|
+
throw new CliInputError("Missing required option --project-id.");
|
|
30008
|
+
}
|
|
29039
30009
|
const input = appendCommonAuthOptions(parsedArgv, {
|
|
30010
|
+
projectId,
|
|
29040
30011
|
webhookId: requirePositional(parsedArgv, 2, "webhook-id")
|
|
29041
30012
|
});
|
|
29042
30013
|
const eventType = readStringOption(parsedArgv, "event");
|
|
@@ -29049,9 +30020,14 @@ async function handleWebhookCommand(parsedArgv, dependencies) {
|
|
|
29049
30020
|
return await (dependencies.testWebhookCommand ?? testWebhookWithAuthCommand)(input);
|
|
29050
30021
|
}
|
|
29051
30022
|
if (action === "deliveries") {
|
|
29052
|
-
expectNoUnknownOptions(parsedArgv, ["auth-file", "json", "limit"]);
|
|
30023
|
+
expectNoUnknownOptions(parsedArgv, ["auth-file", "json", "project-id", "limit"]);
|
|
29053
30024
|
ensureNoExtraPositionals(parsedArgv, 3);
|
|
30025
|
+
const projectId = readStringOption(parsedArgv, "project-id");
|
|
30026
|
+
if (projectId === void 0) {
|
|
30027
|
+
throw new CliInputError("Missing required option --project-id.");
|
|
30028
|
+
}
|
|
29054
30029
|
const input = appendCommonAuthOptions(parsedArgv, {
|
|
30030
|
+
projectId,
|
|
29055
30031
|
webhookId: requirePositional(parsedArgv, 2, "webhook-id")
|
|
29056
30032
|
});
|
|
29057
30033
|
const limit = readLimitOption(parsedArgv);
|
|
@@ -29061,9 +30037,14 @@ async function handleWebhookCommand(parsedArgv, dependencies) {
|
|
|
29061
30037
|
return await (dependencies.listWebhookDeliveriesCommand ?? listWebhookDeliveriesWithAuthCommand)(input);
|
|
29062
30038
|
}
|
|
29063
30039
|
if (action === "retry") {
|
|
29064
|
-
expectNoUnknownOptions(parsedArgv, ["auth-file", "json"]);
|
|
30040
|
+
expectNoUnknownOptions(parsedArgv, ["auth-file", "json", "project-id"]);
|
|
29065
30041
|
ensureNoExtraPositionals(parsedArgv, 4);
|
|
30042
|
+
const projectId = readStringOption(parsedArgv, "project-id");
|
|
30043
|
+
if (projectId === void 0) {
|
|
30044
|
+
throw new CliInputError("Missing required option --project-id.");
|
|
30045
|
+
}
|
|
29066
30046
|
const input = appendCommonAuthOptions(parsedArgv, {
|
|
30047
|
+
projectId,
|
|
29067
30048
|
webhookId: requirePositional(parsedArgv, 2, "webhook-id"),
|
|
29068
30049
|
deliveryId: requirePositional(parsedArgv, 3, "delivery-id")
|
|
29069
30050
|
});
|
|
@@ -29142,6 +30123,7 @@ async function handleAlertCommand(parsedArgv, dependencies) {
|
|
|
29142
30123
|
expectNoUnknownOptions(parsedArgv, [
|
|
29143
30124
|
"auth-file",
|
|
29144
30125
|
"json",
|
|
30126
|
+
"project-id",
|
|
29145
30127
|
"service-id",
|
|
29146
30128
|
"channel",
|
|
29147
30129
|
"condition",
|
|
@@ -29150,7 +30132,12 @@ async function handleAlertCommand(parsedArgv, dependencies) {
|
|
|
29150
30132
|
"is-enabled"
|
|
29151
30133
|
]);
|
|
29152
30134
|
ensureNoExtraPositionals(parsedArgv, 3);
|
|
30135
|
+
const projectId = readStringOption(parsedArgv, "project-id");
|
|
30136
|
+
if (projectId === void 0) {
|
|
30137
|
+
throw new CliInputError("Missing required option --project-id.");
|
|
30138
|
+
}
|
|
29153
30139
|
const input = appendCommonAuthOptions(parsedArgv, {
|
|
30140
|
+
projectId,
|
|
29154
30141
|
alertId: requirePositional(parsedArgv, 2, "alert-id")
|
|
29155
30142
|
});
|
|
29156
30143
|
const serviceId = readStringOption(parsedArgv, "service-id");
|
|
@@ -29183,10 +30170,15 @@ async function handleAlertCommand(parsedArgv, dependencies) {
|
|
|
29183
30170
|
return await (dependencies.updateAlertCommand ?? updateAlertWithAuthCommand)(input);
|
|
29184
30171
|
}
|
|
29185
30172
|
if (action === "delete") {
|
|
29186
|
-
expectNoUnknownOptions(parsedArgv, ["auth-file", "json"]);
|
|
30173
|
+
expectNoUnknownOptions(parsedArgv, ["auth-file", "json", "project-id"]);
|
|
29187
30174
|
ensureNoExtraPositionals(parsedArgv, 3);
|
|
30175
|
+
const projectId = readStringOption(parsedArgv, "project-id");
|
|
30176
|
+
if (projectId === void 0) {
|
|
30177
|
+
throw new CliInputError("Missing required option --project-id.");
|
|
30178
|
+
}
|
|
29188
30179
|
return await (dependencies.deleteAlertCommand ?? deleteAlertWithAuthCommand)(
|
|
29189
30180
|
appendCommonAuthOptions(parsedArgv, {
|
|
30181
|
+
projectId,
|
|
29190
30182
|
alertId: requirePositional(parsedArgv, 2, "alert-id")
|
|
29191
30183
|
})
|
|
29192
30184
|
);
|
|
@@ -29794,6 +30786,9 @@ ${formatUsage()}`
|
|
|
29794
30786
|
if (command === "capture-policy") {
|
|
29795
30787
|
return await handleCapturePolicyCommand(parsedArgv, dependencies);
|
|
29796
30788
|
}
|
|
30789
|
+
if (command === "improvements") {
|
|
30790
|
+
return await handleImprovementsCommand(parsedArgv, dependencies);
|
|
30791
|
+
}
|
|
29797
30792
|
if (command === "probe") {
|
|
29798
30793
|
return await handleProbeCommand(parsedArgv, dependencies);
|
|
29799
30794
|
}
|