@debugbundle/cli 0.1.7 → 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 +1093 -163
- 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
|
}
|
|
@@ -16750,6 +16911,171 @@ var STORAGE_SCHEMA_MIGRATIONS = [
|
|
|
16750
16911
|
"ALTER TABLE users ADD COLUMN IF NOT EXISTS avatar_content_type text",
|
|
16751
16912
|
"ALTER TABLE users ADD COLUMN IF NOT EXISTS avatar_updated_at timestamptz"
|
|
16752
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
|
+
]
|
|
16753
17079
|
})
|
|
16754
17080
|
];
|
|
16755
17081
|
|
|
@@ -17508,6 +17834,7 @@ var ProjectRecordSchema = external_exports.object({
|
|
|
17508
17834
|
owner_user_id: external_exports.string(),
|
|
17509
17835
|
owner_email: external_exports.string().email(),
|
|
17510
17836
|
relationship: external_exports.enum(["owned", "shared"]),
|
|
17837
|
+
sharing_state: external_exports.enum(["private", "shared_by_you", "shared_with_you"]),
|
|
17511
17838
|
effective_role: external_exports.enum(["owner", "admin", "member"]),
|
|
17512
17839
|
name: external_exports.string(),
|
|
17513
17840
|
slug: external_exports.string(),
|
|
@@ -17529,6 +17856,7 @@ var DeletedProjectRecordSchema = external_exports.object({
|
|
|
17529
17856
|
owner_user_id: external_exports.string(),
|
|
17530
17857
|
owner_email: external_exports.string().email(),
|
|
17531
17858
|
relationship: external_exports.enum(["owned", "shared"]),
|
|
17859
|
+
sharing_state: external_exports.enum(["private", "shared_by_you", "shared_with_you"]),
|
|
17532
17860
|
effective_role: external_exports.enum(["owner", "admin", "member"]),
|
|
17533
17861
|
name: external_exports.string(),
|
|
17534
17862
|
slug: external_exports.string(),
|
|
@@ -17862,6 +18190,7 @@ var AlertConditionTypeSchema = external_exports.enum([
|
|
|
17862
18190
|
var AlertSchema = external_exports.object({
|
|
17863
18191
|
alert_id: external_exports.string(),
|
|
17864
18192
|
project_id: external_exports.string(),
|
|
18193
|
+
created_by_user_id: external_exports.string(),
|
|
17865
18194
|
service_id: external_exports.string().nullable(),
|
|
17866
18195
|
channel: AlertChannelSchema,
|
|
17867
18196
|
condition_type: AlertConditionTypeSchema,
|
|
@@ -17987,7 +18316,7 @@ function createAlertApi(client) {
|
|
|
17987
18316
|
return expectAlert(
|
|
17988
18317
|
client.request({
|
|
17989
18318
|
method: "PATCH",
|
|
17990
|
-
path: `/v1/alerts/${input.alertId}`,
|
|
18319
|
+
path: `/v1/alerts/${input.alertId}${buildQuery({ project_id: input.projectId })}`,
|
|
17991
18320
|
bearerToken: input.bearerToken,
|
|
17992
18321
|
body
|
|
17993
18322
|
})
|
|
@@ -17996,7 +18325,7 @@ function createAlertApi(client) {
|
|
|
17996
18325
|
async deleteAlert(input) {
|
|
17997
18326
|
const response = await client.request({
|
|
17998
18327
|
method: "DELETE",
|
|
17999
|
-
path: `/v1/alerts/${input.alertId}`,
|
|
18328
|
+
path: `/v1/alerts/${input.alertId}${buildQuery({ project_id: input.projectId })}`,
|
|
18000
18329
|
bearerToken: input.bearerToken
|
|
18001
18330
|
});
|
|
18002
18331
|
if (response.status < 200 || response.status >= 300) {
|
|
@@ -18079,6 +18408,7 @@ var WebhookFiltersSchema = external_exports.object({
|
|
|
18079
18408
|
var WebhookSchema = external_exports.object({
|
|
18080
18409
|
webhook_id: external_exports.string(),
|
|
18081
18410
|
project_id: external_exports.string(),
|
|
18411
|
+
created_by_user_id: external_exports.string(),
|
|
18082
18412
|
url: external_exports.string(),
|
|
18083
18413
|
events: external_exports.array(WebhookEventTypeSchema),
|
|
18084
18414
|
filters: WebhookFiltersSchema,
|
|
@@ -18249,7 +18579,7 @@ function createWebhookApi(client) {
|
|
|
18249
18579
|
return expectWebhook(
|
|
18250
18580
|
client.request({
|
|
18251
18581
|
method: "GET",
|
|
18252
|
-
path: `/v1/webhooks/${input.webhookId}`,
|
|
18582
|
+
path: `/v1/webhooks/${input.webhookId}${buildQuery2({ project_id: input.projectId })}`,
|
|
18253
18583
|
bearerToken: input.bearerToken
|
|
18254
18584
|
})
|
|
18255
18585
|
);
|
|
@@ -18271,7 +18601,7 @@ function createWebhookApi(client) {
|
|
|
18271
18601
|
return expectWebhook(
|
|
18272
18602
|
client.request({
|
|
18273
18603
|
method: "PATCH",
|
|
18274
|
-
path: `/v1/webhooks/${input.webhookId}`,
|
|
18604
|
+
path: `/v1/webhooks/${input.webhookId}${buildQuery2({ project_id: input.projectId })}`,
|
|
18275
18605
|
bearerToken: input.bearerToken,
|
|
18276
18606
|
body
|
|
18277
18607
|
})
|
|
@@ -18280,7 +18610,7 @@ function createWebhookApi(client) {
|
|
|
18280
18610
|
async deleteWebhook(input) {
|
|
18281
18611
|
const response = await client.request({
|
|
18282
18612
|
method: "DELETE",
|
|
18283
|
-
path: `/v1/webhooks/${input.webhookId}`,
|
|
18613
|
+
path: `/v1/webhooks/${input.webhookId}${buildQuery2({ project_id: input.projectId })}`,
|
|
18284
18614
|
bearerToken: input.bearerToken
|
|
18285
18615
|
});
|
|
18286
18616
|
if (response.status < 200 || response.status >= 300) {
|
|
@@ -18298,7 +18628,7 @@ function createWebhookApi(client) {
|
|
|
18298
18628
|
return expectWebhookTestDelivery(
|
|
18299
18629
|
client.request({
|
|
18300
18630
|
method: "POST",
|
|
18301
|
-
path: `/v1/webhooks/${input.webhookId}/test`,
|
|
18631
|
+
path: `/v1/webhooks/${input.webhookId}/test${buildQuery2({ project_id: input.projectId })}`,
|
|
18302
18632
|
bearerToken: input.bearerToken,
|
|
18303
18633
|
body
|
|
18304
18634
|
})
|
|
@@ -18308,7 +18638,7 @@ function createWebhookApi(client) {
|
|
|
18308
18638
|
return expectWebhookDeliveries(
|
|
18309
18639
|
client.request({
|
|
18310
18640
|
method: "GET",
|
|
18311
|
-
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 })}`,
|
|
18312
18642
|
bearerToken: input.bearerToken
|
|
18313
18643
|
})
|
|
18314
18644
|
);
|
|
@@ -18317,7 +18647,7 @@ function createWebhookApi(client) {
|
|
|
18317
18647
|
return expectRetryDelivery(
|
|
18318
18648
|
client.request({
|
|
18319
18649
|
method: "POST",
|
|
18320
|
-
path: `/v1/webhooks/${input.webhookId}/deliveries/${input.deliveryId}/retry`,
|
|
18650
|
+
path: `/v1/webhooks/${input.webhookId}/deliveries/${input.deliveryId}/retry${buildQuery2({ project_id: input.projectId })}`,
|
|
18321
18651
|
bearerToken: input.bearerToken,
|
|
18322
18652
|
body: {}
|
|
18323
18653
|
})
|
|
@@ -18507,7 +18837,8 @@ var BillingSummarySchema = external_exports.object({
|
|
|
18507
18837
|
monthly_raw_ingested_events: BillingUsageMetricSchema,
|
|
18508
18838
|
retained_bundle_cap: BillingUsageMetricSchema,
|
|
18509
18839
|
monthly_remote_activations: BillingUsageMetricSchema,
|
|
18510
|
-
monthly_alert_deliveries: BillingUsageMetricSchema
|
|
18840
|
+
monthly_alert_deliveries: BillingUsageMetricSchema,
|
|
18841
|
+
monthly_webhook_deliveries: BillingUsageMetricSchema
|
|
18511
18842
|
}).strict()
|
|
18512
18843
|
}).strict();
|
|
18513
18844
|
var BillingSummaryResponseSchema = external_exports.object({
|
|
@@ -18621,6 +18952,7 @@ var ProjectGitHubRepoSchema = external_exports.object({
|
|
|
18621
18952
|
var GitHubDispatchRuleSchema = external_exports.object({
|
|
18622
18953
|
rule_id: external_exports.string(),
|
|
18623
18954
|
project_id: external_exports.string(),
|
|
18955
|
+
created_by_user_id: external_exports.string(),
|
|
18624
18956
|
name: external_exports.string(),
|
|
18625
18957
|
enabled: external_exports.boolean(),
|
|
18626
18958
|
event_types: external_exports.array(external_exports.string().min(1)),
|
|
@@ -18639,7 +18971,7 @@ var GitHubDispatchDeliverySchema = external_exports.object({
|
|
|
18639
18971
|
rule_name: external_exports.string(),
|
|
18640
18972
|
incident_id: external_exports.string(),
|
|
18641
18973
|
incident_title: external_exports.string(),
|
|
18642
|
-
status: external_exports.enum(["pending", "retrying", "delivered", "failed"]),
|
|
18974
|
+
status: external_exports.enum(["pending", "retrying", "delivered", "failed", "skipped"]),
|
|
18643
18975
|
attempt_count: external_exports.number().int(),
|
|
18644
18976
|
last_attempt_at: external_exports.string().nullable(),
|
|
18645
18977
|
last_error: external_exports.string().nullable(),
|
|
@@ -18776,19 +19108,21 @@ async function expectNoContent(responsePromise) {
|
|
|
18776
19108
|
function createGitHubManagementApi(client) {
|
|
18777
19109
|
return {
|
|
18778
19110
|
async getInstallation(input) {
|
|
19111
|
+
const query = input.projectId === void 0 ? "" : `?project_id=${encodeURIComponent(input.projectId)}`;
|
|
18779
19112
|
return expectInstallation(
|
|
18780
19113
|
client.request({
|
|
18781
19114
|
method: "GET",
|
|
18782
|
-
path:
|
|
19115
|
+
path: `/v1/github/installation${query}`,
|
|
18783
19116
|
bearerToken: input.bearerToken
|
|
18784
19117
|
})
|
|
18785
19118
|
);
|
|
18786
19119
|
},
|
|
18787
19120
|
async listRepositories(input) {
|
|
19121
|
+
const query = input.projectId === void 0 ? "" : `?project_id=${encodeURIComponent(input.projectId)}`;
|
|
18788
19122
|
return expectRepositories(
|
|
18789
19123
|
client.request({
|
|
18790
19124
|
method: "GET",
|
|
18791
|
-
path:
|
|
19125
|
+
path: `/v1/github/repositories${query}`,
|
|
18792
19126
|
bearerToken: input.bearerToken
|
|
18793
19127
|
})
|
|
18794
19128
|
);
|
|
@@ -25341,7 +25675,7 @@ var CLI_USAGE_LINES = [
|
|
|
25341
25675
|
" debugbundle billing capacity schedule-reduction --target-additional-capacity-units <n> [--auth-file <path>] [--json]",
|
|
25342
25676
|
" debugbundle billing capacity cancel-reduction [--auth-file <path>] [--json]",
|
|
25343
25677
|
" debugbundle github status [--project-id <id>] [--auth-file <path>] [--json]",
|
|
25344
|
-
" debugbundle github repos [--auth-file <path>] [--json]",
|
|
25678
|
+
" debugbundle github repos [--project-id <id>] [--auth-file <path>] [--json]",
|
|
25345
25679
|
" debugbundle github repo set <owner/repo> --project-id <id> [--auth-file <path>] [--json]",
|
|
25346
25680
|
" debugbundle github repo remove --project-id <id> [--auth-file <path>] [--json]",
|
|
25347
25681
|
" debugbundle github rules --project-id <id> [--auth-file <path>] [--json]",
|
|
@@ -25362,25 +25696,33 @@ var CLI_USAGE_LINES = [
|
|
|
25362
25696
|
" debugbundle token member revoke <token-id> [--auth-file <path>] [--json]",
|
|
25363
25697
|
" debugbundle alert list --project-id <id> [--limit <n>] [--auth-file <path>] [--json]",
|
|
25364
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]",
|
|
25365
|
-
" 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]",
|
|
25366
|
-
" 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]",
|
|
25367
25701
|
" debugbundle slack list --project-id <id> [--auth-file <path>] [--json]",
|
|
25368
25702
|
" debugbundle slack connect-url --project-id <id> [--return-to </projects/...>] [--auth-file <path>] [--json]",
|
|
25369
25703
|
" debugbundle slack test <destination-id> --project-id <id> [--auth-file <path>] [--json]",
|
|
25370
25704
|
" debugbundle slack delete <destination-id> --project-id <id> [--auth-file <path>] [--json]",
|
|
25371
25705
|
" debugbundle webhook list --project-id <id> [--limit <n>] [--auth-file <path>] [--json]",
|
|
25372
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]",
|
|
25373
|
-
" 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]",
|
|
25374
|
-
" debugbundle webhook delete <webhook-id> [--auth-file <path>] [--json]",
|
|
25375
|
-
" debugbundle webhook test <webhook-id> [--event <verification.passed|verification.failed>] [--auth-file <path>] [--json]",
|
|
25376
|
-
" debugbundle webhook deliveries <webhook-id> [--limit <n>] [--auth-file <path>] [--json]",
|
|
25377
|
-
" 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]",
|
|
25378
25712
|
" debugbundle weekly-report list --project-id <id> [--limit <n>] [--auth-file <path>] [--json]",
|
|
25379
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]",
|
|
25380
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]",
|
|
25381
25715
|
" debugbundle weekly-report delete <channel-id> [--auth-file <path>] [--json]",
|
|
25382
25716
|
" debugbundle capture-policy get --project <id> [--auth-file <path>] [--json]",
|
|
25383
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]",
|
|
25384
25726
|
" debugbundle probe activate <project-id> --label-pattern <pattern> [--service <name>] [--environment <name>] [--ttl-seconds <n>] [--trigger-ttl-seconds <n>] [--auth-file <path>] [--json]",
|
|
25385
25727
|
" debugbundle probe list <project-id> [--auth-file <path>] [--json]",
|
|
25386
25728
|
" debugbundle probe deactivate <project-id> <activation-id> [--auth-file <path>] [--json]",
|
|
@@ -25948,6 +26290,7 @@ async function updateAlertCommand(input, api) {
|
|
|
25948
26290
|
try {
|
|
25949
26291
|
const requestInput = {
|
|
25950
26292
|
bearerToken: input.bearerToken,
|
|
26293
|
+
projectId: input.projectId,
|
|
25951
26294
|
alertId: input.alertId
|
|
25952
26295
|
};
|
|
25953
26296
|
if (input.serviceId !== void 0) {
|
|
@@ -25984,6 +26327,7 @@ async function updateAlertWithAuthCommand(input, dependencies) {
|
|
|
25984
26327
|
runCommand: (authState, api) => {
|
|
25985
26328
|
const commandInput = {
|
|
25986
26329
|
bearerToken: authState.bearer_token,
|
|
26330
|
+
projectId: input.projectId,
|
|
25987
26331
|
alertId: input.alertId
|
|
25988
26332
|
};
|
|
25989
26333
|
if (input.serviceId !== void 0) {
|
|
@@ -26017,6 +26361,7 @@ async function deleteAlertCommand(input, api) {
|
|
|
26017
26361
|
try {
|
|
26018
26362
|
const alert = await api.deleteAlert({
|
|
26019
26363
|
bearerToken: input.bearerToken,
|
|
26364
|
+
projectId: input.projectId,
|
|
26020
26365
|
alertId: input.alertId
|
|
26021
26366
|
});
|
|
26022
26367
|
return {
|
|
@@ -26034,6 +26379,7 @@ async function deleteAlertWithAuthCommand(input, dependencies) {
|
|
|
26034
26379
|
runCommand: (authState, api) => {
|
|
26035
26380
|
const commandInput = {
|
|
26036
26381
|
bearerToken: authState.bearer_token,
|
|
26382
|
+
projectId: input.projectId,
|
|
26037
26383
|
alertId: input.alertId
|
|
26038
26384
|
};
|
|
26039
26385
|
if (input.json !== void 0) {
|
|
@@ -26246,9 +26592,9 @@ async function setCapturePolicyWithAuthCommand(input, dependencies) {
|
|
|
26246
26592
|
});
|
|
26247
26593
|
}
|
|
26248
26594
|
|
|
26249
|
-
// src/
|
|
26595
|
+
// src/improvement-commands.ts
|
|
26250
26596
|
function mapErrorToExitCode6(error) {
|
|
26251
|
-
if (!(error instanceof
|
|
26597
|
+
if (!(error instanceof RetrievalApiError)) {
|
|
26252
26598
|
return 1;
|
|
26253
26599
|
}
|
|
26254
26600
|
if (error.status === 401) {
|
|
@@ -26260,107 +26606,504 @@ function mapErrorToExitCode6(error) {
|
|
|
26260
26606
|
if (error.status === 400) {
|
|
26261
26607
|
return 4;
|
|
26262
26608
|
}
|
|
26263
|
-
if (error.status === 409) {
|
|
26264
|
-
return 5;
|
|
26265
|
-
}
|
|
26266
26609
|
return 1;
|
|
26267
26610
|
}
|
|
26268
|
-
function
|
|
26269
|
-
|
|
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");
|
|
26270
26616
|
}
|
|
26271
|
-
|
|
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) {
|
|
26272
26638
|
try {
|
|
26273
|
-
const
|
|
26274
|
-
bearerToken: input.bearerToken
|
|
26275
|
-
};
|
|
26276
|
-
if (input.limit !== void 0) {
|
|
26277
|
-
requestInput.limit = input.limit;
|
|
26278
|
-
}
|
|
26279
|
-
const projects = await api.listProjects(requestInput);
|
|
26639
|
+
const response = await api.listImprovements(input);
|
|
26280
26640
|
return {
|
|
26281
26641
|
exitCode: 0,
|
|
26282
|
-
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}`}`
|
|
26283
26646
|
};
|
|
26284
26647
|
} catch (error) {
|
|
26285
|
-
return {
|
|
26648
|
+
return {
|
|
26649
|
+
exitCode: mapErrorToExitCode6(error),
|
|
26650
|
+
output: error instanceof Error ? error.message : String(error)
|
|
26651
|
+
};
|
|
26286
26652
|
}
|
|
26287
26653
|
}
|
|
26288
|
-
async function
|
|
26654
|
+
async function getImprovementCommand(input, api) {
|
|
26289
26655
|
try {
|
|
26290
|
-
const
|
|
26291
|
-
|
|
26292
|
-
|
|
26293
|
-
|
|
26656
|
+
const improvement = await api.getImprovement(input);
|
|
26657
|
+
return {
|
|
26658
|
+
exitCode: 0,
|
|
26659
|
+
output: input.json ? JSON.stringify(improvement) : formatImprovementDetail(improvement)
|
|
26294
26660
|
};
|
|
26295
|
-
|
|
26296
|
-
|
|
26297
|
-
|
|
26298
|
-
|
|
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);
|
|
26299
26671
|
return {
|
|
26300
26672
|
exitCode: 0,
|
|
26301
|
-
output: input.json ? JSON.stringify(
|
|
26673
|
+
output: input.json ? JSON.stringify(improvement) : `Improvement resolved.
|
|
26674
|
+
${formatImprovementDetail(improvement)}`
|
|
26302
26675
|
};
|
|
26303
26676
|
} catch (error) {
|
|
26304
|
-
return {
|
|
26677
|
+
return {
|
|
26678
|
+
exitCode: mapErrorToExitCode6(error),
|
|
26679
|
+
output: error instanceof Error ? error.message : String(error)
|
|
26680
|
+
};
|
|
26305
26681
|
}
|
|
26306
26682
|
}
|
|
26307
|
-
async function
|
|
26683
|
+
async function reopenImprovementCommand(input, api) {
|
|
26308
26684
|
try {
|
|
26309
|
-
const
|
|
26310
|
-
|
|
26311
|
-
|
|
26685
|
+
const improvement = await api.reopenImprovement(input);
|
|
26686
|
+
return {
|
|
26687
|
+
exitCode: 0,
|
|
26688
|
+
output: input.json ? JSON.stringify(improvement) : `Improvement reopened.
|
|
26689
|
+
${formatImprovementDetail(improvement)}`
|
|
26312
26690
|
};
|
|
26313
|
-
|
|
26314
|
-
|
|
26315
|
-
|
|
26316
|
-
|
|
26317
|
-
|
|
26318
|
-
|
|
26319
|
-
|
|
26320
|
-
|
|
26321
|
-
|
|
26322
|
-
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);
|
|
26323
26701
|
return {
|
|
26324
26702
|
exitCode: 0,
|
|
26325
|
-
output: input.json ? JSON.stringify(
|
|
26703
|
+
output: input.json ? JSON.stringify(improvement) : `Improvement snoozed.
|
|
26704
|
+
${formatImprovementDetail(improvement)}`
|
|
26326
26705
|
};
|
|
26327
26706
|
} catch (error) {
|
|
26328
|
-
return {
|
|
26707
|
+
return {
|
|
26708
|
+
exitCode: mapErrorToExitCode6(error),
|
|
26709
|
+
output: error instanceof Error ? error.message : String(error)
|
|
26710
|
+
};
|
|
26329
26711
|
}
|
|
26330
26712
|
}
|
|
26331
|
-
async function
|
|
26713
|
+
async function getImprovementBundleCommand(input, api) {
|
|
26332
26714
|
try {
|
|
26333
|
-
const
|
|
26334
|
-
bearerToken: input.bearerToken,
|
|
26335
|
-
projectId: input.projectId
|
|
26336
|
-
});
|
|
26715
|
+
const bundle = await api.getImprovementBundle(input);
|
|
26337
26716
|
return {
|
|
26338
26717
|
exitCode: 0,
|
|
26339
|
-
output: input.json ? JSON.stringify(
|
|
26718
|
+
output: input.json ? JSON.stringify(bundle) : formatObjectOutput2(bundle)
|
|
26340
26719
|
};
|
|
26341
26720
|
} catch (error) {
|
|
26342
|
-
return {
|
|
26721
|
+
return {
|
|
26722
|
+
exitCode: mapErrorToExitCode6(error),
|
|
26723
|
+
output: error instanceof Error ? error.message : String(error)
|
|
26724
|
+
};
|
|
26343
26725
|
}
|
|
26344
26726
|
}
|
|
26345
|
-
async function
|
|
26727
|
+
async function listImprovementsWithAuthCommand(input, dependencies) {
|
|
26346
26728
|
return runAuthenticatedCliCommand(input, {
|
|
26347
|
-
createApi:
|
|
26729
|
+
createApi: createAuthenticatedRetrievalApi,
|
|
26348
26730
|
dependencies,
|
|
26349
|
-
runCommand: (authState, api) =>
|
|
26350
|
-
|
|
26351
|
-
bearerToken: authState.bearer_token
|
|
26352
|
-
|
|
26353
|
-
|
|
26354
|
-
|
|
26355
|
-
|
|
26356
|
-
|
|
26357
|
-
|
|
26358
|
-
|
|
26359
|
-
|
|
26360
|
-
|
|
26361
|
-
}
|
|
26362
|
-
|
|
26363
|
-
|
|
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;
|
|
27101
|
+
}
|
|
27102
|
+
return listProjectsCommand(commandInput, {
|
|
27103
|
+
listProjects: (requestInput) => api.listProjects(requestInput)
|
|
27104
|
+
});
|
|
27105
|
+
}
|
|
27106
|
+
});
|
|
26364
27107
|
}
|
|
26365
27108
|
async function createProjectWithAuthCommand(input, dependencies) {
|
|
26366
27109
|
return runAuthenticatedCliCommand(input, {
|
|
@@ -26431,7 +27174,7 @@ async function deleteProjectWithAuthCommand(input, dependencies) {
|
|
|
26431
27174
|
}
|
|
26432
27175
|
|
|
26433
27176
|
// src/token-commands.ts
|
|
26434
|
-
function
|
|
27177
|
+
function mapErrorToExitCode9(error) {
|
|
26435
27178
|
if (!(error instanceof TokenManagementApiError)) {
|
|
26436
27179
|
return 1;
|
|
26437
27180
|
}
|
|
@@ -26470,7 +27213,7 @@ async function listProjectTokensCommand(input, api) {
|
|
|
26470
27213
|
output: formatTokenTable(tokens)
|
|
26471
27214
|
};
|
|
26472
27215
|
} catch (error) {
|
|
26473
|
-
return { exitCode:
|
|
27216
|
+
return { exitCode: mapErrorToExitCode9(error), output: error instanceof Error ? error.message : String(error) };
|
|
26474
27217
|
}
|
|
26475
27218
|
}
|
|
26476
27219
|
async function listProjectTokensWithAuthCommand(input, dependencies) {
|
|
@@ -26510,7 +27253,7 @@ async function createProjectTokenCommand(input, api) {
|
|
|
26510
27253
|
Plaintext: ${token.plaintext ?? "<none>"}`
|
|
26511
27254
|
};
|
|
26512
27255
|
} catch (error) {
|
|
26513
|
-
return { exitCode:
|
|
27256
|
+
return { exitCode: mapErrorToExitCode9(error), output: error instanceof Error ? error.message : String(error) };
|
|
26514
27257
|
}
|
|
26515
27258
|
}
|
|
26516
27259
|
async function createProjectTokenWithAuthCommand(input, dependencies) {
|
|
@@ -26547,7 +27290,7 @@ async function revokeProjectTokenCommand(input, api) {
|
|
|
26547
27290
|
output: `Project token revoked: ${token.token_id}`
|
|
26548
27291
|
};
|
|
26549
27292
|
} catch (error) {
|
|
26550
|
-
return { exitCode:
|
|
27293
|
+
return { exitCode: mapErrorToExitCode9(error), output: error instanceof Error ? error.message : String(error) };
|
|
26551
27294
|
}
|
|
26552
27295
|
}
|
|
26553
27296
|
async function revokeProjectTokenWithAuthCommand(input, dependencies) {
|
|
@@ -26586,7 +27329,7 @@ async function listMemberTokensCommand(input, api) {
|
|
|
26586
27329
|
output: formatTokenTable(tokens)
|
|
26587
27330
|
};
|
|
26588
27331
|
} catch (error) {
|
|
26589
|
-
return { exitCode:
|
|
27332
|
+
return { exitCode: mapErrorToExitCode9(error), output: error instanceof Error ? error.message : String(error) };
|
|
26590
27333
|
}
|
|
26591
27334
|
}
|
|
26592
27335
|
async function listMemberTokensWithAuthCommand(input, dependencies) {
|
|
@@ -26624,7 +27367,7 @@ async function createMemberTokenCommand(input, api) {
|
|
|
26624
27367
|
Plaintext: ${token.plaintext ?? "<none>"}`
|
|
26625
27368
|
};
|
|
26626
27369
|
} catch (error) {
|
|
26627
|
-
return { exitCode:
|
|
27370
|
+
return { exitCode: mapErrorToExitCode9(error), output: error instanceof Error ? error.message : String(error) };
|
|
26628
27371
|
}
|
|
26629
27372
|
}
|
|
26630
27373
|
async function createMemberTokenWithAuthCommand(input, dependencies) {
|
|
@@ -26659,7 +27402,7 @@ async function revokeMemberTokenCommand(input, api) {
|
|
|
26659
27402
|
output: `Member token revoked: ${token.token_id}`
|
|
26660
27403
|
};
|
|
26661
27404
|
} catch (error) {
|
|
26662
|
-
return { exitCode:
|
|
27405
|
+
return { exitCode: mapErrorToExitCode9(error), output: error instanceof Error ? error.message : String(error) };
|
|
26663
27406
|
}
|
|
26664
27407
|
}
|
|
26665
27408
|
async function revokeMemberTokenWithAuthCommand(input, dependencies) {
|
|
@@ -26682,7 +27425,7 @@ async function revokeMemberTokenWithAuthCommand(input, dependencies) {
|
|
|
26682
27425
|
}
|
|
26683
27426
|
|
|
26684
27427
|
// src/webhook-commands.ts
|
|
26685
|
-
function
|
|
27428
|
+
function mapErrorToExitCode10(error) {
|
|
26686
27429
|
if (!(error instanceof WebhookApiError)) {
|
|
26687
27430
|
return 1;
|
|
26688
27431
|
}
|
|
@@ -26727,7 +27470,7 @@ async function listWebhooksCommand(input, api) {
|
|
|
26727
27470
|
output: input.json ? JSON.stringify({ webhooks }) : formatWebhookTable(webhooks)
|
|
26728
27471
|
};
|
|
26729
27472
|
} catch (error) {
|
|
26730
|
-
return { exitCode:
|
|
27473
|
+
return { exitCode: mapErrorToExitCode10(error), output: error instanceof Error ? error.message : String(error) };
|
|
26731
27474
|
}
|
|
26732
27475
|
}
|
|
26733
27476
|
async function listWebhooksWithAuthCommand(input, dependencies) {
|
|
@@ -26775,7 +27518,7 @@ async function createWebhookCommand(input, api) {
|
|
|
26775
27518
|
Signing secret: ${webhook.signing_secret}`
|
|
26776
27519
|
};
|
|
26777
27520
|
} catch (error) {
|
|
26778
|
-
return { exitCode:
|
|
27521
|
+
return { exitCode: mapErrorToExitCode10(error), output: error instanceof Error ? error.message : String(error) };
|
|
26779
27522
|
}
|
|
26780
27523
|
}
|
|
26781
27524
|
async function createWebhookWithAuthCommand(input, dependencies) {
|
|
@@ -26808,6 +27551,7 @@ async function updateWebhookCommand(input, api) {
|
|
|
26808
27551
|
try {
|
|
26809
27552
|
const requestInput = {
|
|
26810
27553
|
bearerToken: input.bearerToken,
|
|
27554
|
+
projectId: input.projectId,
|
|
26811
27555
|
webhookId: input.webhookId
|
|
26812
27556
|
};
|
|
26813
27557
|
if (input.url !== void 0) {
|
|
@@ -26828,7 +27572,7 @@ async function updateWebhookCommand(input, api) {
|
|
|
26828
27572
|
output: input.json ? JSON.stringify({ webhook }) : `Webhook updated: ${webhook.webhook_id}`
|
|
26829
27573
|
};
|
|
26830
27574
|
} catch (error) {
|
|
26831
|
-
return { exitCode:
|
|
27575
|
+
return { exitCode: mapErrorToExitCode10(error), output: error instanceof Error ? error.message : String(error) };
|
|
26832
27576
|
}
|
|
26833
27577
|
}
|
|
26834
27578
|
async function updateWebhookWithAuthCommand(input, dependencies) {
|
|
@@ -26838,6 +27582,7 @@ async function updateWebhookWithAuthCommand(input, dependencies) {
|
|
|
26838
27582
|
runCommand: (authState, api) => {
|
|
26839
27583
|
const commandInput = {
|
|
26840
27584
|
bearerToken: authState.bearer_token,
|
|
27585
|
+
projectId: input.projectId,
|
|
26841
27586
|
webhookId: input.webhookId
|
|
26842
27587
|
};
|
|
26843
27588
|
if (input.url !== void 0) {
|
|
@@ -26865,6 +27610,7 @@ async function deleteWebhookCommand(input, api) {
|
|
|
26865
27610
|
try {
|
|
26866
27611
|
const webhook = await api.deleteWebhook({
|
|
26867
27612
|
bearerToken: input.bearerToken,
|
|
27613
|
+
projectId: input.projectId,
|
|
26868
27614
|
webhookId: input.webhookId
|
|
26869
27615
|
});
|
|
26870
27616
|
return {
|
|
@@ -26872,7 +27618,7 @@ async function deleteWebhookCommand(input, api) {
|
|
|
26872
27618
|
output: input.json ? JSON.stringify({ webhook }) : `Webhook deleted: ${webhook.webhook_id}`
|
|
26873
27619
|
};
|
|
26874
27620
|
} catch (error) {
|
|
26875
|
-
return { exitCode:
|
|
27621
|
+
return { exitCode: mapErrorToExitCode10(error), output: error instanceof Error ? error.message : String(error) };
|
|
26876
27622
|
}
|
|
26877
27623
|
}
|
|
26878
27624
|
async function deleteWebhookWithAuthCommand(input, dependencies) {
|
|
@@ -26882,6 +27628,7 @@ async function deleteWebhookWithAuthCommand(input, dependencies) {
|
|
|
26882
27628
|
runCommand: (authState, api) => {
|
|
26883
27629
|
const commandInput = {
|
|
26884
27630
|
bearerToken: authState.bearer_token,
|
|
27631
|
+
projectId: input.projectId,
|
|
26885
27632
|
webhookId: input.webhookId
|
|
26886
27633
|
};
|
|
26887
27634
|
if (input.json !== void 0) {
|
|
@@ -26897,6 +27644,7 @@ async function testWebhookCommand(input, api) {
|
|
|
26897
27644
|
try {
|
|
26898
27645
|
const requestInput = {
|
|
26899
27646
|
bearerToken: input.bearerToken,
|
|
27647
|
+
projectId: input.projectId,
|
|
26900
27648
|
webhookId: input.webhookId
|
|
26901
27649
|
};
|
|
26902
27650
|
if (input.eventType !== void 0) {
|
|
@@ -26908,7 +27656,7 @@ async function testWebhookCommand(input, api) {
|
|
|
26908
27656
|
output: input.json ? JSON.stringify({ delivery }) : `Webhook test queued: ${delivery.delivery_id} | ${delivery.event_type} | attempts=${delivery.attempt_count}`
|
|
26909
27657
|
};
|
|
26910
27658
|
} catch (error) {
|
|
26911
|
-
return { exitCode:
|
|
27659
|
+
return { exitCode: mapErrorToExitCode10(error), output: error instanceof Error ? error.message : String(error) };
|
|
26912
27660
|
}
|
|
26913
27661
|
}
|
|
26914
27662
|
async function testWebhookWithAuthCommand(input, dependencies) {
|
|
@@ -26918,6 +27666,7 @@ async function testWebhookWithAuthCommand(input, dependencies) {
|
|
|
26918
27666
|
runCommand: (authState, api) => {
|
|
26919
27667
|
const commandInput = {
|
|
26920
27668
|
bearerToken: authState.bearer_token,
|
|
27669
|
+
projectId: input.projectId,
|
|
26921
27670
|
webhookId: input.webhookId
|
|
26922
27671
|
};
|
|
26923
27672
|
if (input.eventType !== void 0) {
|
|
@@ -26936,6 +27685,7 @@ async function listWebhookDeliveriesCommand(input, api) {
|
|
|
26936
27685
|
try {
|
|
26937
27686
|
const requestInput = {
|
|
26938
27687
|
bearerToken: input.bearerToken,
|
|
27688
|
+
projectId: input.projectId,
|
|
26939
27689
|
webhookId: input.webhookId
|
|
26940
27690
|
};
|
|
26941
27691
|
if (input.limit !== void 0) {
|
|
@@ -26947,7 +27697,7 @@ async function listWebhookDeliveriesCommand(input, api) {
|
|
|
26947
27697
|
output: input.json ? JSON.stringify({ deliveries }) : formatWebhookDeliveriesTable(deliveries)
|
|
26948
27698
|
};
|
|
26949
27699
|
} catch (error) {
|
|
26950
|
-
return { exitCode:
|
|
27700
|
+
return { exitCode: mapErrorToExitCode10(error), output: error instanceof Error ? error.message : String(error) };
|
|
26951
27701
|
}
|
|
26952
27702
|
}
|
|
26953
27703
|
async function listWebhookDeliveriesWithAuthCommand(input, dependencies) {
|
|
@@ -26957,6 +27707,7 @@ async function listWebhookDeliveriesWithAuthCommand(input, dependencies) {
|
|
|
26957
27707
|
runCommand: (authState, api) => {
|
|
26958
27708
|
const commandInput = {
|
|
26959
27709
|
bearerToken: authState.bearer_token,
|
|
27710
|
+
projectId: input.projectId,
|
|
26960
27711
|
webhookId: input.webhookId
|
|
26961
27712
|
};
|
|
26962
27713
|
if (input.limit !== void 0) {
|
|
@@ -26975,6 +27726,7 @@ async function retryWebhookDeliveryCommand(input, api) {
|
|
|
26975
27726
|
try {
|
|
26976
27727
|
const result = await api.retryWebhookDelivery({
|
|
26977
27728
|
bearerToken: input.bearerToken,
|
|
27729
|
+
projectId: input.projectId,
|
|
26978
27730
|
webhookId: input.webhookId,
|
|
26979
27731
|
deliveryId: input.deliveryId
|
|
26980
27732
|
});
|
|
@@ -26983,7 +27735,7 @@ async function retryWebhookDeliveryCommand(input, api) {
|
|
|
26983
27735
|
output: input.json ? JSON.stringify(result) : `Delivery retried: ${result.delivery_id} | ${result.event_type}`
|
|
26984
27736
|
};
|
|
26985
27737
|
} catch (error) {
|
|
26986
|
-
return { exitCode:
|
|
27738
|
+
return { exitCode: mapErrorToExitCode10(error), output: error instanceof Error ? error.message : String(error) };
|
|
26987
27739
|
}
|
|
26988
27740
|
}
|
|
26989
27741
|
async function retryWebhookDeliveryWithAuthCommand(input, dependencies) {
|
|
@@ -26993,6 +27745,7 @@ async function retryWebhookDeliveryWithAuthCommand(input, dependencies) {
|
|
|
26993
27745
|
runCommand: (authState, api) => {
|
|
26994
27746
|
const commandInput = {
|
|
26995
27747
|
bearerToken: authState.bearer_token,
|
|
27748
|
+
projectId: input.projectId,
|
|
26996
27749
|
webhookId: input.webhookId,
|
|
26997
27750
|
deliveryId: input.deliveryId
|
|
26998
27751
|
};
|
|
@@ -27007,7 +27760,7 @@ async function retryWebhookDeliveryWithAuthCommand(input, dependencies) {
|
|
|
27007
27760
|
}
|
|
27008
27761
|
|
|
27009
27762
|
// src/weekly-report-commands.ts
|
|
27010
|
-
function
|
|
27763
|
+
function mapErrorToExitCode11(error) {
|
|
27011
27764
|
if (!(error instanceof WeeklyReportApiError)) {
|
|
27012
27765
|
return 1;
|
|
27013
27766
|
}
|
|
@@ -27042,7 +27795,7 @@ async function listWeeklyReportChannelsCommand(input, api) {
|
|
|
27042
27795
|
output: input.json ? JSON.stringify({ channels }) : formatWeeklyReportChannelTable(channels)
|
|
27043
27796
|
};
|
|
27044
27797
|
} catch (error) {
|
|
27045
|
-
return { exitCode:
|
|
27798
|
+
return { exitCode: mapErrorToExitCode11(error), output: error instanceof Error ? error.message : String(error) };
|
|
27046
27799
|
}
|
|
27047
27800
|
}
|
|
27048
27801
|
async function listWeeklyReportChannelsWithAuthCommand(input, dependencies) {
|
|
@@ -27075,7 +27828,7 @@ async function createWeeklyReportChannelCommand(input, api) {
|
|
|
27075
27828
|
output: input.json ? JSON.stringify({ channel }) : `Weekly report channel created: ${channel.channel_id}`
|
|
27076
27829
|
};
|
|
27077
27830
|
} catch (error) {
|
|
27078
|
-
return { exitCode:
|
|
27831
|
+
return { exitCode: mapErrorToExitCode11(error), output: error instanceof Error ? error.message : String(error) };
|
|
27079
27832
|
}
|
|
27080
27833
|
}
|
|
27081
27834
|
async function createWeeklyReportChannelWithAuthCommand(input, dependencies) {
|
|
@@ -27110,7 +27863,7 @@ async function updateWeeklyReportChannelCommand(input, api) {
|
|
|
27110
27863
|
output: input.json ? JSON.stringify({ channel }) : `Weekly report channel updated: ${channel.channel_id}`
|
|
27111
27864
|
};
|
|
27112
27865
|
} catch (error) {
|
|
27113
|
-
return { exitCode:
|
|
27866
|
+
return { exitCode: mapErrorToExitCode11(error), output: error instanceof Error ? error.message : String(error) };
|
|
27114
27867
|
}
|
|
27115
27868
|
}
|
|
27116
27869
|
async function updateWeeklyReportChannelWithAuthCommand(input, dependencies) {
|
|
@@ -27141,7 +27894,7 @@ async function deleteWeeklyReportChannelCommand(input, api) {
|
|
|
27141
27894
|
output: input.json ? JSON.stringify({ channel: deleted }) : `Weekly report channel deleted: ${deleted.channel_id}`
|
|
27142
27895
|
};
|
|
27143
27896
|
} catch (error) {
|
|
27144
|
-
return { exitCode:
|
|
27897
|
+
return { exitCode: mapErrorToExitCode11(error), output: error instanceof Error ? error.message : String(error) };
|
|
27145
27898
|
}
|
|
27146
27899
|
}
|
|
27147
27900
|
async function deleteWeeklyReportChannelWithAuthCommand(input, dependencies) {
|
|
@@ -27160,7 +27913,7 @@ async function deleteWeeklyReportChannelWithAuthCommand(input, dependencies) {
|
|
|
27160
27913
|
}
|
|
27161
27914
|
|
|
27162
27915
|
// src/slack-commands.ts
|
|
27163
|
-
function
|
|
27916
|
+
function mapErrorToExitCode12(error) {
|
|
27164
27917
|
if (!(error instanceof SlackApiError)) {
|
|
27165
27918
|
return 1;
|
|
27166
27919
|
}
|
|
@@ -27196,7 +27949,7 @@ async function listSlackDestinationsCommand(input, api) {
|
|
|
27196
27949
|
output: input.json ? JSON.stringify({ destinations }) : formatSlackDestinationTable(destinations)
|
|
27197
27950
|
};
|
|
27198
27951
|
} catch (error) {
|
|
27199
|
-
return { exitCode:
|
|
27952
|
+
return { exitCode: mapErrorToExitCode12(error), output: error instanceof Error ? error.message : String(error) };
|
|
27200
27953
|
}
|
|
27201
27954
|
}
|
|
27202
27955
|
async function listSlackDestinationsWithAuthCommand(input, dependencies) {
|
|
@@ -27225,7 +27978,7 @@ async function getSlackConnectUrlCommand(input, api) {
|
|
|
27225
27978
|
output: input.json ? JSON.stringify({ install_url: installUrl }) : installUrl
|
|
27226
27979
|
};
|
|
27227
27980
|
} catch (error) {
|
|
27228
|
-
return { exitCode:
|
|
27981
|
+
return { exitCode: mapErrorToExitCode12(error), output: error instanceof Error ? error.message : String(error) };
|
|
27229
27982
|
}
|
|
27230
27983
|
}
|
|
27231
27984
|
async function getSlackConnectUrlWithAuthCommand(input, dependencies) {
|
|
@@ -27255,7 +28008,7 @@ async function testSlackDestinationCommand(input, api) {
|
|
|
27255
28008
|
output: input.json ? JSON.stringify({ delivery }) : `Slack test message delivered for destination: ${input.destinationId}`
|
|
27256
28009
|
};
|
|
27257
28010
|
} catch (error) {
|
|
27258
|
-
return { exitCode:
|
|
28011
|
+
return { exitCode: mapErrorToExitCode12(error), output: error instanceof Error ? error.message : String(error) };
|
|
27259
28012
|
}
|
|
27260
28013
|
}
|
|
27261
28014
|
async function testSlackDestinationWithAuthCommand(input, dependencies) {
|
|
@@ -27285,7 +28038,7 @@ async function deleteSlackDestinationCommand(input, api) {
|
|
|
27285
28038
|
output: input.json ? JSON.stringify({ destination: deleted }) : `Slack destination deleted: ${deleted.slack_destination_id}`
|
|
27286
28039
|
};
|
|
27287
28040
|
} catch (error) {
|
|
27288
|
-
return { exitCode:
|
|
28041
|
+
return { exitCode: mapErrorToExitCode12(error), output: error instanceof Error ? error.message : String(error) };
|
|
27289
28042
|
}
|
|
27290
28043
|
}
|
|
27291
28044
|
async function deleteSlackDestinationWithAuthCommand(input, dependencies) {
|
|
@@ -27305,7 +28058,7 @@ async function deleteSlackDestinationWithAuthCommand(input, dependencies) {
|
|
|
27305
28058
|
}
|
|
27306
28059
|
|
|
27307
28060
|
// src/billing-commands.ts
|
|
27308
|
-
function
|
|
28061
|
+
function mapErrorToExitCode13(error) {
|
|
27309
28062
|
if (!(error instanceof BillingApiError)) {
|
|
27310
28063
|
return 1;
|
|
27311
28064
|
}
|
|
@@ -27336,7 +28089,8 @@ function formatBillingSummary(billing) {
|
|
|
27336
28089
|
formatMetric("Raw ingested events", billing.allowances.monthly_raw_ingested_events),
|
|
27337
28090
|
formatMetric("Retained bundles", billing.allowances.retained_bundle_cap),
|
|
27338
28091
|
formatMetric("Remote activations", billing.allowances.monthly_remote_activations),
|
|
27339
|
-
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)
|
|
27340
28094
|
];
|
|
27341
28095
|
if (billing.capacity_units.pending_reduction !== null) {
|
|
27342
28096
|
lines.push(
|
|
@@ -27353,7 +28107,7 @@ async function getBillingSummaryCommand(input, api) {
|
|
|
27353
28107
|
output: input.json ? JSON.stringify({ billing }) : formatBillingSummary(billing)
|
|
27354
28108
|
};
|
|
27355
28109
|
} catch (error) {
|
|
27356
|
-
return { exitCode:
|
|
28110
|
+
return { exitCode: mapErrorToExitCode13(error), output: error instanceof Error ? error.message : String(error) };
|
|
27357
28111
|
}
|
|
27358
28112
|
}
|
|
27359
28113
|
async function increaseBillingCapacityCommand(input, api) {
|
|
@@ -27368,7 +28122,7 @@ async function increaseBillingCapacityCommand(input, api) {
|
|
|
27368
28122
|
${formatBillingSummary(billing)}`
|
|
27369
28123
|
};
|
|
27370
28124
|
} catch (error) {
|
|
27371
|
-
return { exitCode:
|
|
28125
|
+
return { exitCode: mapErrorToExitCode13(error), output: error instanceof Error ? error.message : String(error) };
|
|
27372
28126
|
}
|
|
27373
28127
|
}
|
|
27374
28128
|
async function scheduleBillingCapacityReductionCommand(input, api) {
|
|
@@ -27383,7 +28137,7 @@ async function scheduleBillingCapacityReductionCommand(input, api) {
|
|
|
27383
28137
|
${formatBillingSummary(billing)}`
|
|
27384
28138
|
};
|
|
27385
28139
|
} catch (error) {
|
|
27386
|
-
return { exitCode:
|
|
28140
|
+
return { exitCode: mapErrorToExitCode13(error), output: error instanceof Error ? error.message : String(error) };
|
|
27387
28141
|
}
|
|
27388
28142
|
}
|
|
27389
28143
|
async function cancelBillingCapacityReductionCommand(input, api) {
|
|
@@ -27395,7 +28149,7 @@ async function cancelBillingCapacityReductionCommand(input, api) {
|
|
|
27395
28149
|
${formatBillingSummary(billing)}`
|
|
27396
28150
|
};
|
|
27397
28151
|
} catch (error) {
|
|
27398
|
-
return { exitCode:
|
|
28152
|
+
return { exitCode: mapErrorToExitCode13(error), output: error instanceof Error ? error.message : String(error) };
|
|
27399
28153
|
}
|
|
27400
28154
|
}
|
|
27401
28155
|
async function getBillingSummaryWithAuthCommand(input, dependencies) {
|
|
@@ -27466,7 +28220,7 @@ var MemberApiError = class extends Error {
|
|
|
27466
28220
|
this.code = code;
|
|
27467
28221
|
}
|
|
27468
28222
|
};
|
|
27469
|
-
function
|
|
28223
|
+
function toApiError3(status, body) {
|
|
27470
28224
|
if (typeof body === "object" && body !== null && "error" in body && typeof body.error === "string") {
|
|
27471
28225
|
return new MemberApiError(status, body.error);
|
|
27472
28226
|
}
|
|
@@ -27481,7 +28235,7 @@ function createMemberApi(httpClient) {
|
|
|
27481
28235
|
bearerToken: input.bearerToken
|
|
27482
28236
|
});
|
|
27483
28237
|
if (response.status !== 200) {
|
|
27484
|
-
throw
|
|
28238
|
+
throw toApiError3(response.status, response.body);
|
|
27485
28239
|
}
|
|
27486
28240
|
return response.body;
|
|
27487
28241
|
},
|
|
@@ -27492,7 +28246,7 @@ function createMemberApi(httpClient) {
|
|
|
27492
28246
|
bearerToken: input.bearerToken
|
|
27493
28247
|
});
|
|
27494
28248
|
if (response.status !== 200) {
|
|
27495
|
-
throw
|
|
28249
|
+
throw toApiError3(response.status, response.body);
|
|
27496
28250
|
}
|
|
27497
28251
|
return response.body;
|
|
27498
28252
|
},
|
|
@@ -27504,7 +28258,7 @@ function createMemberApi(httpClient) {
|
|
|
27504
28258
|
body: { email: input.email, role: input.role }
|
|
27505
28259
|
});
|
|
27506
28260
|
if (response.status !== 201) {
|
|
27507
|
-
throw
|
|
28261
|
+
throw toApiError3(response.status, response.body);
|
|
27508
28262
|
}
|
|
27509
28263
|
return response.body;
|
|
27510
28264
|
},
|
|
@@ -27515,7 +28269,7 @@ function createMemberApi(httpClient) {
|
|
|
27515
28269
|
bearerToken: input.bearerToken
|
|
27516
28270
|
});
|
|
27517
28271
|
if (response.status !== 200) {
|
|
27518
|
-
throw
|
|
28272
|
+
throw toApiError3(response.status, response.body);
|
|
27519
28273
|
}
|
|
27520
28274
|
return response.body;
|
|
27521
28275
|
},
|
|
@@ -27527,7 +28281,7 @@ function createMemberApi(httpClient) {
|
|
|
27527
28281
|
body: { role: input.role }
|
|
27528
28282
|
});
|
|
27529
28283
|
if (response.status !== 200) {
|
|
27530
|
-
throw
|
|
28284
|
+
throw toApiError3(response.status, response.body);
|
|
27531
28285
|
}
|
|
27532
28286
|
return response.body;
|
|
27533
28287
|
},
|
|
@@ -27538,7 +28292,7 @@ function createMemberApi(httpClient) {
|
|
|
27538
28292
|
bearerToken: input.bearerToken
|
|
27539
28293
|
});
|
|
27540
28294
|
if (response.status !== 200) {
|
|
27541
|
-
throw
|
|
28295
|
+
throw toApiError3(response.status, response.body);
|
|
27542
28296
|
}
|
|
27543
28297
|
return response.body;
|
|
27544
28298
|
}
|
|
@@ -27556,7 +28310,7 @@ function formatInvitesTable(invites) {
|
|
|
27556
28310
|
}
|
|
27557
28311
|
return invites.map((i) => `${i.invite_id} | ${i.email} | ${i.role} | expires=${i.expires_at}`).join("\n");
|
|
27558
28312
|
}
|
|
27559
|
-
function
|
|
28313
|
+
function mapErrorToExitCode14(error) {
|
|
27560
28314
|
if (!(error instanceof MemberApiError)) {
|
|
27561
28315
|
return 1;
|
|
27562
28316
|
}
|
|
@@ -27583,7 +28337,7 @@ async function listMembersCommand(input, api) {
|
|
|
27583
28337
|
};
|
|
27584
28338
|
} catch (error) {
|
|
27585
28339
|
return {
|
|
27586
|
-
exitCode:
|
|
28340
|
+
exitCode: mapErrorToExitCode14(error),
|
|
27587
28341
|
output: error instanceof MemberApiError ? error.code : String(error)
|
|
27588
28342
|
};
|
|
27589
28343
|
}
|
|
@@ -27597,7 +28351,7 @@ async function listInvitesCommand(input, api) {
|
|
|
27597
28351
|
};
|
|
27598
28352
|
} catch (error) {
|
|
27599
28353
|
return {
|
|
27600
|
-
exitCode:
|
|
28354
|
+
exitCode: mapErrorToExitCode14(error),
|
|
27601
28355
|
output: error instanceof MemberApiError ? error.code : String(error)
|
|
27602
28356
|
};
|
|
27603
28357
|
}
|
|
@@ -27616,7 +28370,7 @@ async function inviteMemberCommand(input, api) {
|
|
|
27616
28370
|
};
|
|
27617
28371
|
} catch (error) {
|
|
27618
28372
|
return {
|
|
27619
|
-
exitCode:
|
|
28373
|
+
exitCode: mapErrorToExitCode14(error),
|
|
27620
28374
|
output: error instanceof MemberApiError ? error.code : String(error)
|
|
27621
28375
|
};
|
|
27622
28376
|
}
|
|
@@ -27630,7 +28384,7 @@ async function cancelInviteCommand(input, api) {
|
|
|
27630
28384
|
};
|
|
27631
28385
|
} catch (error) {
|
|
27632
28386
|
return {
|
|
27633
|
-
exitCode:
|
|
28387
|
+
exitCode: mapErrorToExitCode14(error),
|
|
27634
28388
|
output: error instanceof MemberApiError ? error.code : String(error)
|
|
27635
28389
|
};
|
|
27636
28390
|
}
|
|
@@ -27649,7 +28403,7 @@ async function updateMemberRoleCommand(input, api) {
|
|
|
27649
28403
|
};
|
|
27650
28404
|
} catch (error) {
|
|
27651
28405
|
return {
|
|
27652
|
-
exitCode:
|
|
28406
|
+
exitCode: mapErrorToExitCode14(error),
|
|
27653
28407
|
output: error instanceof MemberApiError ? error.code : String(error)
|
|
27654
28408
|
};
|
|
27655
28409
|
}
|
|
@@ -27663,7 +28417,7 @@ async function removeMemberCommand(input, api) {
|
|
|
27663
28417
|
};
|
|
27664
28418
|
} catch (error) {
|
|
27665
28419
|
return {
|
|
27666
|
-
exitCode:
|
|
28420
|
+
exitCode: mapErrorToExitCode14(error),
|
|
27667
28421
|
output: error instanceof MemberApiError ? error.code : String(error)
|
|
27668
28422
|
};
|
|
27669
28423
|
}
|
|
@@ -27774,7 +28528,7 @@ var ProbeApiError = class extends Error {
|
|
|
27774
28528
|
this.code = code;
|
|
27775
28529
|
}
|
|
27776
28530
|
};
|
|
27777
|
-
function
|
|
28531
|
+
function toApiError4(status, body) {
|
|
27778
28532
|
if (typeof body === "object" && body !== null && "error" in body && typeof body.error === "string") {
|
|
27779
28533
|
return new ProbeApiError(status, body.error);
|
|
27780
28534
|
}
|
|
@@ -27805,7 +28559,7 @@ function createProbeApi(httpClient) {
|
|
|
27805
28559
|
body
|
|
27806
28560
|
});
|
|
27807
28561
|
if (response.status !== 201) {
|
|
27808
|
-
throw
|
|
28562
|
+
throw toApiError4(response.status, response.body);
|
|
27809
28563
|
}
|
|
27810
28564
|
return response.body;
|
|
27811
28565
|
},
|
|
@@ -27816,7 +28570,7 @@ function createProbeApi(httpClient) {
|
|
|
27816
28570
|
bearerToken: input.bearerToken
|
|
27817
28571
|
});
|
|
27818
28572
|
if (response.status !== 200) {
|
|
27819
|
-
throw
|
|
28573
|
+
throw toApiError4(response.status, response.body);
|
|
27820
28574
|
}
|
|
27821
28575
|
return response.body;
|
|
27822
28576
|
},
|
|
@@ -27828,13 +28582,13 @@ function createProbeApi(httpClient) {
|
|
|
27828
28582
|
body: { activation_id: input.activationId }
|
|
27829
28583
|
});
|
|
27830
28584
|
if (response.status !== 200) {
|
|
27831
|
-
throw
|
|
28585
|
+
throw toApiError4(response.status, response.body);
|
|
27832
28586
|
}
|
|
27833
28587
|
return response.body;
|
|
27834
28588
|
}
|
|
27835
28589
|
};
|
|
27836
28590
|
}
|
|
27837
|
-
function
|
|
28591
|
+
function mapErrorToExitCode15(error) {
|
|
27838
28592
|
if (!(error instanceof ProbeApiError)) {
|
|
27839
28593
|
return 1;
|
|
27840
28594
|
}
|
|
@@ -27887,7 +28641,7 @@ async function activateProbeCommand(input, api) {
|
|
|
27887
28641
|
Trigger token: ${result.trigger_token}`
|
|
27888
28642
|
};
|
|
27889
28643
|
} catch (error) {
|
|
27890
|
-
return { exitCode:
|
|
28644
|
+
return { exitCode: mapErrorToExitCode15(error), output: error instanceof Error ? error.message : String(error) };
|
|
27891
28645
|
}
|
|
27892
28646
|
}
|
|
27893
28647
|
async function listActiveProbesCommand(input, api) {
|
|
@@ -27907,7 +28661,7 @@ async function listActiveProbesCommand(input, api) {
|
|
|
27907
28661
|
output: result.activations.map((a) => `${a.activation_id} ${a.label_pattern} (${a.service}/${a.environment}) expires ${a.expires_at}`).join("\n")
|
|
27908
28662
|
};
|
|
27909
28663
|
} catch (error) {
|
|
27910
|
-
return { exitCode:
|
|
28664
|
+
return { exitCode: mapErrorToExitCode15(error), output: error instanceof Error ? error.message : String(error) };
|
|
27911
28665
|
}
|
|
27912
28666
|
}
|
|
27913
28667
|
async function deactivateProbeCommand(input, api) {
|
|
@@ -27925,7 +28679,7 @@ async function deactivateProbeCommand(input, api) {
|
|
|
27925
28679
|
output: result.deactivated ? "Probe deactivated." : "Probe was already inactive."
|
|
27926
28680
|
};
|
|
27927
28681
|
} catch (error) {
|
|
27928
|
-
return { exitCode:
|
|
28682
|
+
return { exitCode: mapErrorToExitCode15(error), output: error instanceof Error ? error.message : String(error) };
|
|
27929
28683
|
}
|
|
27930
28684
|
}
|
|
27931
28685
|
async function createAuthenticatedProbeApi(input, dependencies) {
|
|
@@ -27975,7 +28729,7 @@ async function deactivateProbeWithAuthCommand(input, dependencies) {
|
|
|
27975
28729
|
}
|
|
27976
28730
|
|
|
27977
28731
|
// src/github-commands.ts
|
|
27978
|
-
function
|
|
28732
|
+
function mapErrorToExitCode16(error) {
|
|
27979
28733
|
if (!(error instanceof GitHubManagementApiError)) {
|
|
27980
28734
|
return 1;
|
|
27981
28735
|
}
|
|
@@ -28022,7 +28776,10 @@ function formatGitHubDeliveryTable(deliveries) {
|
|
|
28022
28776
|
}
|
|
28023
28777
|
async function getGitHubStatusCommand(input, api) {
|
|
28024
28778
|
try {
|
|
28025
|
-
const installation = await api.getInstallation({
|
|
28779
|
+
const installation = await api.getInstallation({
|
|
28780
|
+
bearerToken: input.bearerToken,
|
|
28781
|
+
...input.projectId === void 0 ? {} : { projectId: input.projectId }
|
|
28782
|
+
});
|
|
28026
28783
|
const repo = input.projectId === void 0 || api.getProjectRepo === void 0 ? null : await api.getProjectRepo({ bearerToken: input.bearerToken, projectId: input.projectId });
|
|
28027
28784
|
if (input.json) {
|
|
28028
28785
|
return {
|
|
@@ -28036,18 +28793,21 @@ async function getGitHubStatusCommand(input, api) {
|
|
|
28036
28793
|
${formatProjectRepo(repo)}`
|
|
28037
28794
|
};
|
|
28038
28795
|
} catch (error) {
|
|
28039
|
-
return { exitCode:
|
|
28796
|
+
return { exitCode: mapErrorToExitCode16(error), output: error instanceof Error ? error.message : String(error) };
|
|
28040
28797
|
}
|
|
28041
28798
|
}
|
|
28042
28799
|
async function listGitHubRepositoriesCommand(input, api) {
|
|
28043
28800
|
try {
|
|
28044
|
-
const repositories = await api.listRepositories({
|
|
28801
|
+
const repositories = await api.listRepositories({
|
|
28802
|
+
bearerToken: input.bearerToken,
|
|
28803
|
+
...input.projectId === void 0 ? {} : { projectId: input.projectId }
|
|
28804
|
+
});
|
|
28045
28805
|
return {
|
|
28046
28806
|
exitCode: 0,
|
|
28047
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")
|
|
28048
28808
|
};
|
|
28049
28809
|
} catch (error) {
|
|
28050
|
-
return { exitCode:
|
|
28810
|
+
return { exitCode: mapErrorToExitCode16(error), output: error instanceof Error ? error.message : String(error) };
|
|
28051
28811
|
}
|
|
28052
28812
|
}
|
|
28053
28813
|
async function setProjectGitHubRepoCommand(input, api) {
|
|
@@ -28070,7 +28830,7 @@ async function setProjectGitHubRepoCommand(input, api) {
|
|
|
28070
28830
|
output: input.json ? JSON.stringify({ repo: assignedRepo }) : `Project repo set: ${formatProjectRepo(assignedRepo)}`
|
|
28071
28831
|
};
|
|
28072
28832
|
} catch (error) {
|
|
28073
|
-
return { exitCode:
|
|
28833
|
+
return { exitCode: mapErrorToExitCode16(error), output: error instanceof Error ? error.message : String(error) };
|
|
28074
28834
|
}
|
|
28075
28835
|
}
|
|
28076
28836
|
async function removeProjectGitHubRepoCommand(input, api) {
|
|
@@ -28081,7 +28841,7 @@ async function removeProjectGitHubRepoCommand(input, api) {
|
|
|
28081
28841
|
output: input.json ? JSON.stringify({ removed: true, project_id: input.projectId }) : `Project repo removed: ${input.projectId}`
|
|
28082
28842
|
};
|
|
28083
28843
|
} catch (error) {
|
|
28084
|
-
return { exitCode:
|
|
28844
|
+
return { exitCode: mapErrorToExitCode16(error), output: error instanceof Error ? error.message : String(error) };
|
|
28085
28845
|
}
|
|
28086
28846
|
}
|
|
28087
28847
|
async function listProjectGitHubRulesCommand(input, api) {
|
|
@@ -28095,7 +28855,7 @@ async function listProjectGitHubRulesCommand(input, api) {
|
|
|
28095
28855
|
output: input.json ? JSON.stringify({ rules }) : formatGitHubRuleTable(rules)
|
|
28096
28856
|
};
|
|
28097
28857
|
} catch (error) {
|
|
28098
|
-
return { exitCode:
|
|
28858
|
+
return { exitCode: mapErrorToExitCode16(error), output: error instanceof Error ? error.message : String(error) };
|
|
28099
28859
|
}
|
|
28100
28860
|
}
|
|
28101
28861
|
async function listProjectGitHubDeliveriesCommand(input, api) {
|
|
@@ -28111,7 +28871,7 @@ async function listProjectGitHubDeliveriesCommand(input, api) {
|
|
|
28111
28871
|
output: input.json ? JSON.stringify({ deliveries }) : formatGitHubDeliveryTable(deliveries)
|
|
28112
28872
|
};
|
|
28113
28873
|
} catch (error) {
|
|
28114
|
-
return { exitCode:
|
|
28874
|
+
return { exitCode: mapErrorToExitCode16(error), output: error instanceof Error ? error.message : String(error) };
|
|
28115
28875
|
}
|
|
28116
28876
|
}
|
|
28117
28877
|
async function retryProjectGitHubDeliveryCommand(input, api) {
|
|
@@ -28126,7 +28886,7 @@ async function retryProjectGitHubDeliveryCommand(input, api) {
|
|
|
28126
28886
|
output: input.json ? JSON.stringify({ delivery }) : `GitHub delivery retried: ${delivery.delivery_id} | ${delivery.status}`
|
|
28127
28887
|
};
|
|
28128
28888
|
} catch (error) {
|
|
28129
|
-
return { exitCode:
|
|
28889
|
+
return { exitCode: mapErrorToExitCode16(error), output: error instanceof Error ? error.message : String(error) };
|
|
28130
28890
|
}
|
|
28131
28891
|
}
|
|
28132
28892
|
async function createProjectGitHubRuleCommand(input, api) {
|
|
@@ -28149,7 +28909,7 @@ async function createProjectGitHubRuleCommand(input, api) {
|
|
|
28149
28909
|
output: input.json ? JSON.stringify({ rule }) : `GitHub rule created: ${rule.rule_id}`
|
|
28150
28910
|
};
|
|
28151
28911
|
} catch (error) {
|
|
28152
|
-
return { exitCode:
|
|
28912
|
+
return { exitCode: mapErrorToExitCode16(error), output: error instanceof Error ? error.message : String(error) };
|
|
28153
28913
|
}
|
|
28154
28914
|
}
|
|
28155
28915
|
async function updateProjectGitHubRuleCommand(input, api) {
|
|
@@ -28173,7 +28933,7 @@ async function updateProjectGitHubRuleCommand(input, api) {
|
|
|
28173
28933
|
output: input.json ? JSON.stringify({ rule }) : `GitHub rule updated: ${rule.rule_id}`
|
|
28174
28934
|
};
|
|
28175
28935
|
} catch (error) {
|
|
28176
|
-
return { exitCode:
|
|
28936
|
+
return { exitCode: mapErrorToExitCode16(error), output: error instanceof Error ? error.message : String(error) };
|
|
28177
28937
|
}
|
|
28178
28938
|
}
|
|
28179
28939
|
async function deleteProjectGitHubRuleCommand(input, api) {
|
|
@@ -28188,7 +28948,7 @@ async function deleteProjectGitHubRuleCommand(input, api) {
|
|
|
28188
28948
|
output: input.json ? JSON.stringify({ deleted: true, project_id: input.projectId, rule_id: input.ruleId }) : `GitHub rule deleted: ${input.ruleId}`
|
|
28189
28949
|
};
|
|
28190
28950
|
} catch (error) {
|
|
28191
|
-
return { exitCode:
|
|
28951
|
+
return { exitCode: mapErrorToExitCode16(error), output: error instanceof Error ? error.message : String(error) };
|
|
28192
28952
|
}
|
|
28193
28953
|
}
|
|
28194
28954
|
async function getGitHubStatusWithAuthCommand(input, dependencies) {
|
|
@@ -28373,11 +29133,14 @@ async function handleGithubCommand(parsedArgv, dependencies) {
|
|
|
28373
29133
|
return await (dependencies.getGitHubStatusCommand ?? getGitHubStatusWithAuthCommand)(input);
|
|
28374
29134
|
}
|
|
28375
29135
|
if (action === "repos") {
|
|
28376
|
-
expectNoUnknownOptions(parsedArgv, ["auth-file", "json"]);
|
|
29136
|
+
expectNoUnknownOptions(parsedArgv, ["auth-file", "json", "project-id"]);
|
|
28377
29137
|
ensureNoExtraPositionals(parsedArgv, 2);
|
|
28378
|
-
|
|
28379
|
-
|
|
28380
|
-
)
|
|
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);
|
|
28381
29144
|
}
|
|
28382
29145
|
if (action !== "repo") {
|
|
28383
29146
|
if (action === "deliveries") {
|
|
@@ -28537,6 +29300,133 @@ async function handleGithubCommand(parsedArgv, dependencies) {
|
|
|
28537
29300
|
}
|
|
28538
29301
|
throw new CliInputError("Unknown github repo command.");
|
|
28539
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
|
+
}
|
|
28540
29430
|
async function handleBillingCommand(parsedArgv, dependencies) {
|
|
28541
29431
|
const action = requirePositional(parsedArgv, 1, "action");
|
|
28542
29432
|
if (action === "get") {
|
|
@@ -29035,6 +29925,7 @@ async function handleWebhookCommand(parsedArgv, dependencies) {
|
|
|
29035
29925
|
expectNoUnknownOptions(parsedArgv, [
|
|
29036
29926
|
"auth-file",
|
|
29037
29927
|
"json",
|
|
29928
|
+
"project-id",
|
|
29038
29929
|
"url",
|
|
29039
29930
|
"event",
|
|
29040
29931
|
"environment",
|
|
@@ -29045,7 +29936,12 @@ async function handleWebhookCommand(parsedArgv, dependencies) {
|
|
|
29045
29936
|
"is-enabled"
|
|
29046
29937
|
]);
|
|
29047
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
|
+
}
|
|
29048
29943
|
const input = appendCommonAuthOptions(parsedArgv, {
|
|
29944
|
+
projectId,
|
|
29049
29945
|
webhookId: requirePositional(parsedArgv, 2, "webhook-id")
|
|
29050
29946
|
});
|
|
29051
29947
|
const url = readStringOption(parsedArgv, "url");
|
|
@@ -29090,18 +29986,28 @@ async function handleWebhookCommand(parsedArgv, dependencies) {
|
|
|
29090
29986
|
return await (dependencies.updateWebhookCommand ?? updateWebhookWithAuthCommand)(input);
|
|
29091
29987
|
}
|
|
29092
29988
|
if (action === "delete") {
|
|
29093
|
-
expectNoUnknownOptions(parsedArgv, ["auth-file", "json"]);
|
|
29989
|
+
expectNoUnknownOptions(parsedArgv, ["auth-file", "json", "project-id"]);
|
|
29094
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
|
+
}
|
|
29095
29995
|
return await (dependencies.deleteWebhookCommand ?? deleteWebhookWithAuthCommand)(
|
|
29096
29996
|
appendCommonAuthOptions(parsedArgv, {
|
|
29997
|
+
projectId,
|
|
29097
29998
|
webhookId: requirePositional(parsedArgv, 2, "webhook-id")
|
|
29098
29999
|
})
|
|
29099
30000
|
);
|
|
29100
30001
|
}
|
|
29101
30002
|
if (action === "test") {
|
|
29102
|
-
expectNoUnknownOptions(parsedArgv, ["auth-file", "json", "event"]);
|
|
30003
|
+
expectNoUnknownOptions(parsedArgv, ["auth-file", "json", "project-id", "event"]);
|
|
29103
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
|
+
}
|
|
29104
30009
|
const input = appendCommonAuthOptions(parsedArgv, {
|
|
30010
|
+
projectId,
|
|
29105
30011
|
webhookId: requirePositional(parsedArgv, 2, "webhook-id")
|
|
29106
30012
|
});
|
|
29107
30013
|
const eventType = readStringOption(parsedArgv, "event");
|
|
@@ -29114,9 +30020,14 @@ async function handleWebhookCommand(parsedArgv, dependencies) {
|
|
|
29114
30020
|
return await (dependencies.testWebhookCommand ?? testWebhookWithAuthCommand)(input);
|
|
29115
30021
|
}
|
|
29116
30022
|
if (action === "deliveries") {
|
|
29117
|
-
expectNoUnknownOptions(parsedArgv, ["auth-file", "json", "limit"]);
|
|
30023
|
+
expectNoUnknownOptions(parsedArgv, ["auth-file", "json", "project-id", "limit"]);
|
|
29118
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
|
+
}
|
|
29119
30029
|
const input = appendCommonAuthOptions(parsedArgv, {
|
|
30030
|
+
projectId,
|
|
29120
30031
|
webhookId: requirePositional(parsedArgv, 2, "webhook-id")
|
|
29121
30032
|
});
|
|
29122
30033
|
const limit = readLimitOption(parsedArgv);
|
|
@@ -29126,9 +30037,14 @@ async function handleWebhookCommand(parsedArgv, dependencies) {
|
|
|
29126
30037
|
return await (dependencies.listWebhookDeliveriesCommand ?? listWebhookDeliveriesWithAuthCommand)(input);
|
|
29127
30038
|
}
|
|
29128
30039
|
if (action === "retry") {
|
|
29129
|
-
expectNoUnknownOptions(parsedArgv, ["auth-file", "json"]);
|
|
30040
|
+
expectNoUnknownOptions(parsedArgv, ["auth-file", "json", "project-id"]);
|
|
29130
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
|
+
}
|
|
29131
30046
|
const input = appendCommonAuthOptions(parsedArgv, {
|
|
30047
|
+
projectId,
|
|
29132
30048
|
webhookId: requirePositional(parsedArgv, 2, "webhook-id"),
|
|
29133
30049
|
deliveryId: requirePositional(parsedArgv, 3, "delivery-id")
|
|
29134
30050
|
});
|
|
@@ -29207,6 +30123,7 @@ async function handleAlertCommand(parsedArgv, dependencies) {
|
|
|
29207
30123
|
expectNoUnknownOptions(parsedArgv, [
|
|
29208
30124
|
"auth-file",
|
|
29209
30125
|
"json",
|
|
30126
|
+
"project-id",
|
|
29210
30127
|
"service-id",
|
|
29211
30128
|
"channel",
|
|
29212
30129
|
"condition",
|
|
@@ -29215,7 +30132,12 @@ async function handleAlertCommand(parsedArgv, dependencies) {
|
|
|
29215
30132
|
"is-enabled"
|
|
29216
30133
|
]);
|
|
29217
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
|
+
}
|
|
29218
30139
|
const input = appendCommonAuthOptions(parsedArgv, {
|
|
30140
|
+
projectId,
|
|
29219
30141
|
alertId: requirePositional(parsedArgv, 2, "alert-id")
|
|
29220
30142
|
});
|
|
29221
30143
|
const serviceId = readStringOption(parsedArgv, "service-id");
|
|
@@ -29248,10 +30170,15 @@ async function handleAlertCommand(parsedArgv, dependencies) {
|
|
|
29248
30170
|
return await (dependencies.updateAlertCommand ?? updateAlertWithAuthCommand)(input);
|
|
29249
30171
|
}
|
|
29250
30172
|
if (action === "delete") {
|
|
29251
|
-
expectNoUnknownOptions(parsedArgv, ["auth-file", "json"]);
|
|
30173
|
+
expectNoUnknownOptions(parsedArgv, ["auth-file", "json", "project-id"]);
|
|
29252
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
|
+
}
|
|
29253
30179
|
return await (dependencies.deleteAlertCommand ?? deleteAlertWithAuthCommand)(
|
|
29254
30180
|
appendCommonAuthOptions(parsedArgv, {
|
|
30181
|
+
projectId,
|
|
29255
30182
|
alertId: requirePositional(parsedArgv, 2, "alert-id")
|
|
29256
30183
|
})
|
|
29257
30184
|
);
|
|
@@ -29859,6 +30786,9 @@ ${formatUsage()}`
|
|
|
29859
30786
|
if (command === "capture-policy") {
|
|
29860
30787
|
return await handleCapturePolicyCommand(parsedArgv, dependencies);
|
|
29861
30788
|
}
|
|
30789
|
+
if (command === "improvements") {
|
|
30790
|
+
return await handleImprovementsCommand(parsedArgv, dependencies);
|
|
30791
|
+
}
|
|
29862
30792
|
if (command === "probe") {
|
|
29863
30793
|
return await handleProbeCommand(parsedArgv, dependencies);
|
|
29864
30794
|
}
|