vercel 54.18.7 → 54.20.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. package/dist/chunks/add-IB7HE5S5.js +134 -0
  2. package/dist/chunks/{add-P6CBTAGK.js → add-TF5VZLCY.js} +3 -3
  3. package/dist/chunks/{chunk-AXFSALI3.js → chunk-4BEUS7AL.js} +293 -71
  4. package/dist/chunks/chunk-4QVAYRYH.js +71 -0
  5. package/dist/chunks/{chunk-RKLBPBRM.js → chunk-7PAKWBN4.js} +2 -2
  6. package/dist/chunks/chunk-AUECDTMX.js +128 -0
  7. package/dist/chunks/{chunk-E2ENQE2W.js → chunk-BUZRVER7.js} +1 -0
  8. package/dist/chunks/{chunk-L6QLQSJE.js → chunk-GDAO4PGA.js} +1 -1
  9. package/dist/chunks/chunk-I3HGCZ4E.js +72 -0
  10. package/dist/chunks/{chunk-DXL7EPOQ.js → chunk-JDO6BSKN.js} +2 -2
  11. package/dist/chunks/chunk-JHQOIGTY.js +363 -0
  12. package/dist/chunks/chunk-KXGWAWRV.js +148 -0
  13. package/dist/chunks/{chunk-XQQXV6ZZ.js → chunk-LFODAB54.js} +1 -0
  14. package/dist/chunks/chunk-RY3AVR6E.js +111 -0
  15. package/dist/chunks/{chunk-JREEV2EL.js → chunk-T63I6OUR.js} +1 -1
  16. package/dist/chunks/chunk-VGIMO3ZK.js +17 -0
  17. package/dist/chunks/{chunk-VTE7W5ZP.js → chunk-ZZIAWRCX.js} +0 -8
  18. package/dist/chunks/image-2DL7JEWW.js +73 -0
  19. package/dist/chunks/inspect-6IHZTLFA.js +167 -0
  20. package/dist/chunks/inspect-EGXHWKY3.js +163 -0
  21. package/dist/chunks/inspect-PL3PE5IJ.js +136 -0
  22. package/dist/chunks/{inspect-KYVZQL56.js → inspect-Z3QJOMNP.js} +2 -2
  23. package/dist/chunks/{list-MUFZTUZA.js → list-BB4T4KT5.js} +1 -1
  24. package/dist/chunks/{list-BYTNF7D7.js → list-KNRPDNQF.js} +2 -2
  25. package/dist/chunks/ls-EP4Q6VF4.js +214 -0
  26. package/dist/chunks/{ls-PDILBRUL.js → ls-FTQGK4R6.js} +3 -3
  27. package/dist/chunks/ls-IQKMDRUB.js +165 -0
  28. package/dist/chunks/ls-MUS72LBS.js +201 -0
  29. package/dist/chunks/{query-75PT24SH.js → query-C6FEOG5R.js} +1 -1
  30. package/dist/chunks/rm-EZFCCZFT.js +137 -0
  31. package/dist/chunks/{rm-BJSTNUIJ.js → rm-GWW57H2V.js} +3 -3
  32. package/dist/chunks/rm-NMSG2WG6.js +137 -0
  33. package/dist/chunks/{rule-inspect-WTU3MGMH.js → rule-inspect-XPZJO3Y4.js} +3 -3
  34. package/dist/chunks/{rules-6PXGKHFH.js → rules-C6SB24UO.js} +6 -6
  35. package/dist/chunks/tags-5PFVWGLK.js +67 -0
  36. package/dist/chunks/{update-TTPNV44H.js → update-BCLMLJM7.js} +3 -3
  37. package/dist/commands/build/index.js +5 -1
  38. package/dist/commands/deploy/index.js +5 -2
  39. package/dist/commands/env/index.js +8 -3
  40. package/dist/commands/link/index.js +4 -1
  41. package/dist/commands-bulk.js +3304 -1952
  42. package/dist/help.js +1 -1
  43. package/dist/index.js +28 -5
  44. package/dist/version.mjs +1 -1
  45. package/package.json +16 -16
@@ -0,0 +1,165 @@
1
+ import { createRequire as __createRequire } from 'node:module';
2
+ import { fileURLToPath as __fileURLToPath } from 'node:url';
3
+ import { dirname as __dirname_ } from 'node:path';
4
+ const require = __createRequire(import.meta.url);
5
+ const __filename = __fileURLToPath(import.meta.url);
6
+ const __dirname = __dirname_(__filename);
7
+ import {
8
+ formatRelativeTime
9
+ } from "./chunk-I3HGCZ4E.js";
10
+ import {
11
+ repositoriesPath
12
+ } from "./chunk-4QVAYRYH.js";
13
+ import {
14
+ emitVcrArgParseError,
15
+ handleVcrApiError,
16
+ resolveVcrScope,
17
+ validateVcrJsonOutput
18
+ } from "./chunk-JHQOIGTY.js";
19
+ import {
20
+ outputError,
21
+ validateOptionalIntegerRange
22
+ } from "./chunk-BUZRVER7.js";
23
+ import "./chunk-XPKWKPWA.js";
24
+ import {
25
+ listSubcommand
26
+ } from "./chunk-KXGWAWRV.js";
27
+ import "./chunk-RY3AVR6E.js";
28
+ import "./chunk-AUECDTMX.js";
29
+ import {
30
+ AGENT_REASON
31
+ } from "./chunk-QH7WYDEP.js";
32
+ import "./chunk-P726GMBL.js";
33
+ import {
34
+ table
35
+ } from "./chunk-VKBYAWTL.js";
36
+ import "./chunk-RB7WQKNC.js";
37
+ import {
38
+ outputAgentError
39
+ } from "./chunk-IZOHLD5D.js";
40
+ import "./chunk-ECCWJHC6.js";
41
+ import {
42
+ getFlagsSpecification,
43
+ parseArguments,
44
+ printError
45
+ } from "./chunk-EJ6GQI6F.js";
46
+ import {
47
+ isAPIError
48
+ } from "./chunk-P6AK7SVK.js";
49
+ import "./chunk-P4QNYOFB.js";
50
+ import "./chunk-2RVK3DDN.js";
51
+ import {
52
+ output_manager_default
53
+ } from "./chunk-OX7KI3LF.js";
54
+ import "./chunk-GGP5R3FU.js";
55
+ import {
56
+ require_source
57
+ } from "./chunk-S7KYDPEM.js";
58
+ import {
59
+ __toESM
60
+ } from "./chunk-TZ2YI2VH.js";
61
+
62
+ // src/commands/vcr/ls.ts
63
+ var import_chalk = __toESM(require_source(), 1);
64
+ function printRepositories(list) {
65
+ if (list.repositories.length === 0) {
66
+ output_manager_default.log("No repositories found.");
67
+ return;
68
+ }
69
+ const headers = ["Name", "ID", "Created"].map((h) => import_chalk.default.cyan(h));
70
+ const rows = [
71
+ headers,
72
+ ...list.repositories.map((repo) => [
73
+ import_chalk.default.bold(repo.name),
74
+ import_chalk.default.dim(repo.id),
75
+ formatRelativeTime(repo.createdAt)
76
+ ])
77
+ ];
78
+ const tableOutput = table(rows, { hsep: 3 }).split("\n").map((line) => line.trimEnd()).join("\n").replace(/^/gm, " ");
79
+ output_manager_default.print(`
80
+ ${tableOutput}
81
+ `);
82
+ if (list.nextCursor) {
83
+ output_manager_default.log(
84
+ `More results available. Re-run with \`--cursor ${list.nextCursor}\`.`
85
+ );
86
+ }
87
+ }
88
+ async function ls(client, argv, telemetry) {
89
+ let parsedArgs;
90
+ try {
91
+ parsedArgs = parseArguments(
92
+ argv,
93
+ getFlagsSpecification(listSubcommand.options)
94
+ );
95
+ } catch (err) {
96
+ emitVcrArgParseError(client, err, "vcr ls --project <name-or-id>");
97
+ printError(err);
98
+ return 1;
99
+ }
100
+ const fr = validateVcrJsonOutput(client, parsedArgs.flags);
101
+ if (typeof fr === "number") {
102
+ return fr;
103
+ }
104
+ const project = parsedArgs.flags["--project"];
105
+ const cursor = parsedArgs.flags["--cursor"];
106
+ const limitFlag = parsedArgs.flags["--limit"];
107
+ telemetry.trackCliOptionProject(project);
108
+ telemetry.trackCliOptionLimit(limitFlag);
109
+ telemetry.trackCliOptionCursor(cursor);
110
+ telemetry.trackCliOptionFormat(parsedArgs.flags["--format"]);
111
+ const limitResult = validateOptionalIntegerRange(limitFlag, {
112
+ flag: "--limit",
113
+ min: 1,
114
+ max: 100
115
+ });
116
+ if (!limitResult.valid) {
117
+ outputAgentError(
118
+ client,
119
+ {
120
+ status: "error",
121
+ reason: AGENT_REASON.INVALID_ARGUMENTS,
122
+ message: limitResult.message
123
+ },
124
+ 1
125
+ );
126
+ return outputError(
127
+ client,
128
+ fr.jsonOutput,
129
+ limitResult.code,
130
+ limitResult.message
131
+ );
132
+ }
133
+ const scope = await resolveVcrScope(client, {
134
+ project,
135
+ jsonOutput: fr.jsonOutput
136
+ });
137
+ if (typeof scope === "number") {
138
+ return scope;
139
+ }
140
+ const path = repositoriesPath(scope, {
141
+ limit: limitResult.value,
142
+ cursor
143
+ });
144
+ output_manager_default.spinner("Fetching repositories...");
145
+ try {
146
+ const list = await client.fetch(path);
147
+ if (fr.jsonOutput) {
148
+ client.stdout.write(`${JSON.stringify(list, null, 2)}
149
+ `);
150
+ } else {
151
+ printRepositories(list);
152
+ }
153
+ return 0;
154
+ } catch (err) {
155
+ if (isAPIError(err)) {
156
+ return handleVcrApiError(client, err, fr.jsonOutput);
157
+ }
158
+ throw err;
159
+ } finally {
160
+ output_manager_default.stopSpinner();
161
+ }
162
+ }
163
+ export {
164
+ ls as default
165
+ };
@@ -0,0 +1,201 @@
1
+ import { createRequire as __createRequire } from 'node:module';
2
+ import { fileURLToPath as __fileURLToPath } from 'node:url';
3
+ import { dirname as __dirname_ } from 'node:path';
4
+ const require = __createRequire(import.meta.url);
5
+ const __filename = __fileURLToPath(import.meta.url);
6
+ const __dirname = __dirname_(__filename);
7
+ import {
8
+ formatBytes,
9
+ formatDigest,
10
+ formatImageStatus,
11
+ formatRelativeTime
12
+ } from "./chunk-I3HGCZ4E.js";
13
+ import {
14
+ repositoryImagesPath
15
+ } from "./chunk-4QVAYRYH.js";
16
+ import {
17
+ emitVcrArgParseError,
18
+ handleVcrApiError,
19
+ requireVcrRepository,
20
+ resolveVcrScope,
21
+ validateVcrJsonOutput
22
+ } from "./chunk-JHQOIGTY.js";
23
+ import {
24
+ outputError,
25
+ validateOptionalIntegerRange
26
+ } from "./chunk-BUZRVER7.js";
27
+ import "./chunk-XPKWKPWA.js";
28
+ import {
29
+ imageLsSubcommand
30
+ } from "./chunk-AUECDTMX.js";
31
+ import {
32
+ AGENT_REASON
33
+ } from "./chunk-QH7WYDEP.js";
34
+ import "./chunk-P726GMBL.js";
35
+ import {
36
+ table
37
+ } from "./chunk-VKBYAWTL.js";
38
+ import "./chunk-RB7WQKNC.js";
39
+ import {
40
+ outputAgentError
41
+ } from "./chunk-IZOHLD5D.js";
42
+ import "./chunk-ECCWJHC6.js";
43
+ import {
44
+ getFlagsSpecification,
45
+ parseArguments,
46
+ printError
47
+ } from "./chunk-EJ6GQI6F.js";
48
+ import {
49
+ isAPIError
50
+ } from "./chunk-P6AK7SVK.js";
51
+ import "./chunk-P4QNYOFB.js";
52
+ import "./chunk-2RVK3DDN.js";
53
+ import {
54
+ output_manager_default
55
+ } from "./chunk-OX7KI3LF.js";
56
+ import "./chunk-GGP5R3FU.js";
57
+ import {
58
+ require_source
59
+ } from "./chunk-S7KYDPEM.js";
60
+ import {
61
+ __toESM
62
+ } from "./chunk-TZ2YI2VH.js";
63
+
64
+ // src/commands/vcr/image/ls.ts
65
+ var import_chalk = __toESM(require_source(), 1);
66
+ function formatType(kind) {
67
+ return kind === "index" ? "Index" : "Image";
68
+ }
69
+ function printImages(list) {
70
+ if (list.images.length === 0) {
71
+ output_manager_default.log("No images found.");
72
+ return;
73
+ }
74
+ const headers = [
75
+ "Image ID",
76
+ "Digest",
77
+ "Tags",
78
+ "Type",
79
+ "Status",
80
+ "Arch",
81
+ "Size",
82
+ "Created"
83
+ ].map((h) => import_chalk.default.cyan(h));
84
+ const rows = [
85
+ headers,
86
+ ...list.images.map((image) => [
87
+ import_chalk.default.bold(image.id),
88
+ import_chalk.default.dim(formatDigest(image.manifestDigest)),
89
+ image.tags.length > 0 ? image.tags.join(", ") : import_chalk.default.dim("<none>"),
90
+ formatType(image.kind),
91
+ formatImageStatus(image.status),
92
+ image.arch ?? "-",
93
+ formatBytes(image.sizeInBytes),
94
+ formatRelativeTime(image.createdAt)
95
+ ])
96
+ ];
97
+ const tableOutput = table(rows, { hsep: 3 }).split("\n").map((line) => line.trimEnd()).join("\n").replace(/^/gm, " ");
98
+ output_manager_default.print(`
99
+ ${tableOutput}
100
+ `);
101
+ if (list.nextCursor) {
102
+ output_manager_default.log(
103
+ `More results available. Re-run with \`--cursor ${list.nextCursor}\`.`
104
+ );
105
+ }
106
+ }
107
+ async function ls(client, argv, telemetry) {
108
+ let parsedArgs;
109
+ try {
110
+ parsedArgs = parseArguments(
111
+ argv,
112
+ getFlagsSpecification(imageLsSubcommand.options)
113
+ );
114
+ } catch (err) {
115
+ emitVcrArgParseError(
116
+ client,
117
+ err,
118
+ "vcr image ls <repository> --project <name-or-id>"
119
+ );
120
+ printError(err);
121
+ return 1;
122
+ }
123
+ const fr = validateVcrJsonOutput(client, parsedArgs.flags);
124
+ if (typeof fr === "number") {
125
+ return fr;
126
+ }
127
+ const repository = parsedArgs.args[0];
128
+ const project = parsedArgs.flags["--project"];
129
+ const cursor = parsedArgs.flags["--cursor"];
130
+ const limitFlag = parsedArgs.flags["--limit"];
131
+ const untagged = parsedArgs.flags["--untagged"];
132
+ telemetry.trackCliOptionProject(project);
133
+ telemetry.trackCliOptionLimit(limitFlag);
134
+ telemetry.trackCliOptionCursor(cursor);
135
+ telemetry.trackCliFlagUntagged(untagged);
136
+ telemetry.trackCliOptionFormat(parsedArgs.flags["--format"]);
137
+ const missingRepository = requireVcrRepository(
138
+ client,
139
+ repository,
140
+ fr.jsonOutput,
141
+ "vcr image ls <repository>"
142
+ );
143
+ if (typeof missingRepository === "number") {
144
+ return missingRepository;
145
+ }
146
+ const limitResult = validateOptionalIntegerRange(limitFlag, {
147
+ flag: "--limit",
148
+ min: 1,
149
+ max: 100
150
+ });
151
+ if (!limitResult.valid) {
152
+ outputAgentError(
153
+ client,
154
+ {
155
+ status: "error",
156
+ reason: AGENT_REASON.INVALID_ARGUMENTS,
157
+ message: limitResult.message
158
+ },
159
+ 1
160
+ );
161
+ return outputError(
162
+ client,
163
+ fr.jsonOutput,
164
+ limitResult.code,
165
+ limitResult.message
166
+ );
167
+ }
168
+ const scope = await resolveVcrScope(client, {
169
+ project,
170
+ jsonOutput: fr.jsonOutput
171
+ });
172
+ if (typeof scope === "number") {
173
+ return scope;
174
+ }
175
+ const path = repositoryImagesPath(scope, repository, {
176
+ limit: limitResult.value,
177
+ cursor,
178
+ untagged
179
+ });
180
+ output_manager_default.spinner("Fetching images...");
181
+ try {
182
+ const list = await client.fetch(path);
183
+ if (fr.jsonOutput) {
184
+ client.stdout.write(`${JSON.stringify(list, null, 2)}
185
+ `);
186
+ } else {
187
+ printImages(list);
188
+ }
189
+ return 0;
190
+ } catch (err) {
191
+ if (isAPIError(err)) {
192
+ return handleVcrApiError(client, err, fr.jsonOutput);
193
+ }
194
+ throw err;
195
+ } finally {
196
+ output_manager_default.stopSpinner();
197
+ }
198
+ }
199
+ export {
200
+ ls as default
201
+ };
@@ -19,7 +19,7 @@ import {
19
19
  import {
20
20
  resolveTimeRange,
21
21
  validateAllProjectMutualExclusivity
22
- } from "./chunk-E2ENQE2W.js";
22
+ } from "./chunk-BUZRVER7.js";
23
23
  import {
24
24
  validateJsonOutput
25
25
  } from "./chunk-XPKWKPWA.js";
@@ -0,0 +1,137 @@
1
+ import { createRequire as __createRequire } from 'node:module';
2
+ import { fileURLToPath as __fileURLToPath } from 'node:url';
3
+ import { dirname as __dirname_ } from 'node:path';
4
+ const require = __createRequire(import.meta.url);
5
+ const __filename = __fileURLToPath(import.meta.url);
6
+ const __dirname = __dirname_(__filename);
7
+ import {
8
+ imagePath
9
+ } from "./chunk-4QVAYRYH.js";
10
+ import {
11
+ emitVcrArgParseError,
12
+ handleVcrApiError,
13
+ requireVcrRepositoryAndImageId,
14
+ resolveVcrScope,
15
+ validateVcrJsonOutput
16
+ } from "./chunk-JHQOIGTY.js";
17
+ import "./chunk-BUZRVER7.js";
18
+ import "./chunk-XPKWKPWA.js";
19
+ import {
20
+ imageRmSubcommand
21
+ } from "./chunk-AUECDTMX.js";
22
+ import {
23
+ AGENT_REASON
24
+ } from "./chunk-QH7WYDEP.js";
25
+ import "./chunk-P726GMBL.js";
26
+ import "./chunk-RB7WQKNC.js";
27
+ import {
28
+ buildCommandWithYes,
29
+ outputAgentError
30
+ } from "./chunk-IZOHLD5D.js";
31
+ import "./chunk-ECCWJHC6.js";
32
+ import {
33
+ getFlagsSpecification,
34
+ parseArguments,
35
+ printError
36
+ } from "./chunk-EJ6GQI6F.js";
37
+ import {
38
+ isAPIError
39
+ } from "./chunk-P6AK7SVK.js";
40
+ import "./chunk-P4QNYOFB.js";
41
+ import "./chunk-2RVK3DDN.js";
42
+ import {
43
+ output_manager_default
44
+ } from "./chunk-OX7KI3LF.js";
45
+ import "./chunk-GGP5R3FU.js";
46
+ import "./chunk-S7KYDPEM.js";
47
+ import "./chunk-TZ2YI2VH.js";
48
+
49
+ // src/commands/vcr/image/rm.ts
50
+ async function rm(client, argv, telemetry) {
51
+ let parsedArgs;
52
+ try {
53
+ parsedArgs = parseArguments(
54
+ argv,
55
+ getFlagsSpecification(imageRmSubcommand.options)
56
+ );
57
+ } catch (err) {
58
+ emitVcrArgParseError(
59
+ client,
60
+ err,
61
+ "vcr image rm <repository> <imageId> --project <name-or-id>"
62
+ );
63
+ printError(err);
64
+ return 1;
65
+ }
66
+ const fr = validateVcrJsonOutput(client, parsedArgs.flags);
67
+ if (typeof fr === "number") {
68
+ return fr;
69
+ }
70
+ const repository = parsedArgs.args[0];
71
+ const imageId = parsedArgs.args[1];
72
+ const project = parsedArgs.flags["--project"];
73
+ const skipConfirmation = Boolean(parsedArgs.flags["--yes"]);
74
+ telemetry.trackCliOptionProject(project);
75
+ telemetry.trackCliFlagYes(parsedArgs.flags["--yes"]);
76
+ telemetry.trackCliOptionFormat(parsedArgs.flags["--format"]);
77
+ const missingArgs = requireVcrRepositoryAndImageId(
78
+ client,
79
+ repository,
80
+ imageId,
81
+ fr.jsonOutput,
82
+ "vcr image rm <repository> <imageId>"
83
+ );
84
+ if (typeof missingArgs === "number") {
85
+ return missingArgs;
86
+ }
87
+ const scope = await resolveVcrScope(client, {
88
+ project,
89
+ jsonOutput: fr.jsonOutput
90
+ });
91
+ if (typeof scope === "number") {
92
+ return scope;
93
+ }
94
+ if (!skipConfirmation) {
95
+ outputAgentError(
96
+ client,
97
+ {
98
+ status: "error",
99
+ reason: AGENT_REASON.CONFIRMATION_REQUIRED,
100
+ message: "Deleting an image is permanent. Re-run with --yes.",
101
+ next: [{ command: buildCommandWithYes(client.argv) }]
102
+ },
103
+ 1
104
+ );
105
+ if (!await client.input.confirm(
106
+ `Delete image ${imageId} from ${repository}? This cannot be undone.`,
107
+ false
108
+ )) {
109
+ output_manager_default.log("Canceled");
110
+ return 0;
111
+ }
112
+ }
113
+ const path = imagePath(scope, repository, imageId);
114
+ output_manager_default.spinner("Deleting image...");
115
+ try {
116
+ await client.fetch(path, { method: "DELETE" });
117
+ if (fr.jsonOutput) {
118
+ client.stdout.write(
119
+ `${JSON.stringify({ imageId, repository, deleted: true }, null, 2)}
120
+ `
121
+ );
122
+ } else {
123
+ output_manager_default.success(`Image ${imageId} deleted`);
124
+ }
125
+ return 0;
126
+ } catch (err) {
127
+ if (isAPIError(err)) {
128
+ return handleVcrApiError(client, err, fr.jsonOutput);
129
+ }
130
+ throw err;
131
+ } finally {
132
+ output_manager_default.stopSpinner();
133
+ }
134
+ }
135
+ export {
136
+ rm as default
137
+ };
@@ -9,9 +9,9 @@ import {
9
9
  handleRulesApiError,
10
10
  parseRulesFlagsAndScope,
11
11
  rulesItemPath
12
- } from "./chunk-RKLBPBRM.js";
13
- import "./chunk-L6QLQSJE.js";
14
- import "./chunk-E2ENQE2W.js";
12
+ } from "./chunk-7PAKWBN4.js";
13
+ import "./chunk-GDAO4PGA.js";
14
+ import "./chunk-BUZRVER7.js";
15
15
  import {
16
16
  validateJsonOutput
17
17
  } from "./chunk-XPKWKPWA.js";
@@ -0,0 +1,137 @@
1
+ import { createRequire as __createRequire } from 'node:module';
2
+ import { fileURLToPath as __fileURLToPath } from 'node:url';
3
+ import { dirname as __dirname_ } from 'node:path';
4
+ const require = __createRequire(import.meta.url);
5
+ const __filename = __fileURLToPath(import.meta.url);
6
+ const __dirname = __dirname_(__filename);
7
+ import {
8
+ repositoryPath
9
+ } from "./chunk-4QVAYRYH.js";
10
+ import {
11
+ emitVcrArgParseError,
12
+ handleVcrApiError,
13
+ requireVcrRepository,
14
+ resolveVcrScope,
15
+ validateVcrJsonOutput
16
+ } from "./chunk-JHQOIGTY.js";
17
+ import "./chunk-BUZRVER7.js";
18
+ import "./chunk-XPKWKPWA.js";
19
+ import {
20
+ removeSubcommand
21
+ } from "./chunk-KXGWAWRV.js";
22
+ import "./chunk-RY3AVR6E.js";
23
+ import "./chunk-AUECDTMX.js";
24
+ import {
25
+ AGENT_REASON
26
+ } from "./chunk-QH7WYDEP.js";
27
+ import "./chunk-P726GMBL.js";
28
+ import "./chunk-RB7WQKNC.js";
29
+ import {
30
+ buildCommandWithYes,
31
+ outputAgentError
32
+ } from "./chunk-IZOHLD5D.js";
33
+ import "./chunk-ECCWJHC6.js";
34
+ import {
35
+ getFlagsSpecification,
36
+ parseArguments,
37
+ printError
38
+ } from "./chunk-EJ6GQI6F.js";
39
+ import {
40
+ isAPIError
41
+ } from "./chunk-P6AK7SVK.js";
42
+ import "./chunk-P4QNYOFB.js";
43
+ import "./chunk-2RVK3DDN.js";
44
+ import {
45
+ output_manager_default
46
+ } from "./chunk-OX7KI3LF.js";
47
+ import "./chunk-GGP5R3FU.js";
48
+ import "./chunk-S7KYDPEM.js";
49
+ import "./chunk-TZ2YI2VH.js";
50
+
51
+ // src/commands/vcr/rm.ts
52
+ async function rm(client, argv, telemetry) {
53
+ let parsedArgs;
54
+ try {
55
+ parsedArgs = parseArguments(
56
+ argv,
57
+ getFlagsSpecification(removeSubcommand.options)
58
+ );
59
+ } catch (err) {
60
+ emitVcrArgParseError(
61
+ client,
62
+ err,
63
+ "vcr rm <repository> --project <name-or-id>"
64
+ );
65
+ printError(err);
66
+ return 1;
67
+ }
68
+ const fr = validateVcrJsonOutput(client, parsedArgs.flags);
69
+ if (typeof fr === "number") {
70
+ return fr;
71
+ }
72
+ const repository = parsedArgs.args[0];
73
+ const project = parsedArgs.flags["--project"];
74
+ const skipConfirmation = Boolean(parsedArgs.flags["--yes"]);
75
+ telemetry.trackCliOptionProject(project);
76
+ telemetry.trackCliFlagYes(parsedArgs.flags["--yes"]);
77
+ telemetry.trackCliOptionFormat(parsedArgs.flags["--format"]);
78
+ const missingRepository = requireVcrRepository(
79
+ client,
80
+ repository,
81
+ fr.jsonOutput,
82
+ "vcr rm <repository>"
83
+ );
84
+ if (typeof missingRepository === "number") {
85
+ return missingRepository;
86
+ }
87
+ const scope = await resolveVcrScope(client, {
88
+ project,
89
+ jsonOutput: fr.jsonOutput
90
+ });
91
+ if (typeof scope === "number") {
92
+ return scope;
93
+ }
94
+ if (!skipConfirmation) {
95
+ outputAgentError(
96
+ client,
97
+ {
98
+ status: "error",
99
+ reason: AGENT_REASON.CONFIRMATION_REQUIRED,
100
+ message: "Deleting a repository deletes it and all of its images. Re-run with --yes.",
101
+ next: [{ command: buildCommandWithYes(client.argv) }]
102
+ },
103
+ 1
104
+ );
105
+ if (!await client.input.confirm(
106
+ `Delete repository ${repository} and all of its images? This cannot be undone.`,
107
+ false
108
+ )) {
109
+ output_manager_default.log("Canceled");
110
+ return 0;
111
+ }
112
+ }
113
+ const path = repositoryPath(scope, repository);
114
+ output_manager_default.spinner("Deleting repository...");
115
+ try {
116
+ await client.fetch(path, { method: "DELETE" });
117
+ if (fr.jsonOutput) {
118
+ client.stdout.write(
119
+ `${JSON.stringify({ repository, deleted: true }, null, 2)}
120
+ `
121
+ );
122
+ } else {
123
+ output_manager_default.success(`Repository ${repository} deleted`);
124
+ }
125
+ return 0;
126
+ } catch (err) {
127
+ if (isAPIError(err)) {
128
+ return handleVcrApiError(client, err, fr.jsonOutput);
129
+ }
130
+ throw err;
131
+ } finally {
132
+ output_manager_default.stopSpinner();
133
+ }
134
+ }
135
+ export {
136
+ rm as default
137
+ };
@@ -9,9 +9,9 @@ import {
9
9
  handleRulesApiError,
10
10
  parseRulesFlagsAndScope,
11
11
  rulesItemPath
12
- } from "./chunk-RKLBPBRM.js";
13
- import "./chunk-L6QLQSJE.js";
14
- import "./chunk-E2ENQE2W.js";
12
+ } from "./chunk-7PAKWBN4.js";
13
+ import "./chunk-GDAO4PGA.js";
14
+ import "./chunk-BUZRVER7.js";
15
15
  import {
16
16
  validateJsonOutput
17
17
  } from "./chunk-XPKWKPWA.js";
@@ -32,7 +32,7 @@ var RULES_CONFIG = {
32
32
  };
33
33
  async function rules(client, argv) {
34
34
  if (argv.length === 0) {
35
- const lsFn = (await import("./ls-PDILBRUL.js")).default;
35
+ const lsFn = (await import("./ls-FTQGK4R6.js")).default;
36
36
  return lsFn(client, []);
37
37
  }
38
38
  const { subcommand, args, subcommandOriginal } = getSubcommand(
@@ -65,15 +65,15 @@ async function rules(client, argv) {
65
65
  }
66
66
  switch (subcommand) {
67
67
  case "ls":
68
- return (await import("./ls-PDILBRUL.js")).default(client, args);
68
+ return (await import("./ls-FTQGK4R6.js")).default(client, args);
69
69
  case "add":
70
- return (await import("./add-P6CBTAGK.js")).default(client, args);
70
+ return (await import("./add-TF5VZLCY.js")).default(client, args);
71
71
  case "inspect":
72
- return (await import("./rule-inspect-WTU3MGMH.js")).default(client, args);
72
+ return (await import("./rule-inspect-XPZJO3Y4.js")).default(client, args);
73
73
  case "rm":
74
- return (await import("./rm-BJSTNUIJ.js")).default(client, args);
74
+ return (await import("./rm-GWW57H2V.js")).default(client, args);
75
75
  case "update":
76
- return (await import("./update-TTPNV44H.js")).default(client, args);
76
+ return (await import("./update-BCLMLJM7.js")).default(client, args);
77
77
  default:
78
78
  output_manager_default.error(`Unhandled rules subcommand: ${String(subcommandOriginal)}`);
79
79
  return 1;