@strapi/cloud-cli 0.0.0-next.ae38a9dcdeddea4b4c0978686fb024413e5c54f5 → 0.0.0-next.aff9d09e4edf4d38b8a0de5abf83d79bedb28313

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/index.js CHANGED
@@ -42,7 +42,6 @@ const ora = require("ora");
42
42
  const cliProgress = require("cli-progress");
43
43
  const pkgUp = require("pkg-up");
44
44
  const yup = require("yup");
45
- const _ = require("lodash");
46
45
  const EventSource = require("eventsource");
47
46
  const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
48
47
  function _interopNamespace(e) {
@@ -80,7 +79,6 @@ const ora__default = /* @__PURE__ */ _interopDefault(ora);
80
79
  const cliProgress__namespace = /* @__PURE__ */ _interopNamespace(cliProgress);
81
80
  const pkgUp__default = /* @__PURE__ */ _interopDefault(pkgUp);
82
81
  const yup__namespace = /* @__PURE__ */ _interopNamespace(yup);
83
- const ___default = /* @__PURE__ */ _interopDefault(_);
84
82
  const EventSource__default = /* @__PURE__ */ _interopDefault(EventSource);
85
83
  const apiConfig = {
86
84
  apiBaseUrl: utils.env("STRAPI_CLI_CLOUD_API", "https://cloud-cli-api.strapi.io"),
@@ -194,7 +192,7 @@ async function saveLocalConfig(data) {
194
192
  await fse__namespace.default.writeJson(configFilePath, data, { encoding: "utf8", spaces: 2, mode: 384 });
195
193
  }
196
194
  const name = "@strapi/cloud-cli";
197
- const version = "4.25.4";
195
+ const version = "4.25.8";
198
196
  const description = "Commands to interact with the Strapi Cloud";
199
197
  const keywords = [
200
198
  "strapi",
@@ -239,7 +237,7 @@ const scripts = {
239
237
  watch: "pack-up watch"
240
238
  };
241
239
  const dependencies = {
242
- "@strapi/utils": "4.25.4",
240
+ "@strapi/utils": "4.25.8",
243
241
  axios: "1.6.0",
244
242
  chalk: "4.1.2",
245
243
  "cli-progress": "3.12.0",
@@ -264,8 +262,8 @@ const devDependencies = {
264
262
  "@types/cli-progress": "3.11.5",
265
263
  "@types/eventsource": "1.1.15",
266
264
  "@types/lodash": "^4.14.191",
267
- "eslint-config-custom": "4.25.4",
268
- tsconfig: "4.25.4"
265
+ "eslint-config-custom": "4.25.8",
266
+ tsconfig: "4.25.8"
269
267
  };
270
268
  const engines = {
271
269
  node: ">=18.0.0 <=20.x.x",
@@ -375,6 +373,34 @@ async function cloudApiFactory({ logger }, token) {
375
373
  throw error;
376
374
  }
377
375
  },
376
+ async listLinkProjects() {
377
+ try {
378
+ const response = await axiosCloudAPI.get("/projects/linkable");
379
+ if (response.status !== 200) {
380
+ throw new Error("Error fetching cloud projects from the server.");
381
+ }
382
+ return response;
383
+ } catch (error) {
384
+ logger.debug(
385
+ "🥲 Oops! Couldn't retrieve your project's list from the server. Please try again."
386
+ );
387
+ throw error;
388
+ }
389
+ },
390
+ async getProject({ name: name2 }) {
391
+ try {
392
+ const response = await axiosCloudAPI.get(`/projects/${name2}`);
393
+ if (response.status !== 200) {
394
+ throw new Error("Error fetching project's details.");
395
+ }
396
+ return response;
397
+ } catch (error) {
398
+ logger.debug(
399
+ "🥲 Oops! There was a problem retrieving your project's details. Please try again."
400
+ );
401
+ throw error;
402
+ }
403
+ },
378
404
  track(event, payload = {}) {
379
405
  return axiosCloudAPI.post("/track", {
380
406
  event,
@@ -684,18 +710,13 @@ async function getProjectNameFromPackageJson(ctx) {
684
710
  return "my-strapi-project";
685
711
  }
686
712
  }
687
- function applyDefaultName(newDefaultName, questions, defaultValues) {
688
- const newDefaultValues = ___default.default.cloneDeep(defaultValues);
689
- newDefaultValues.name = newDefaultName;
690
- const newQuestions = questions.map((question) => {
691
- const questionCopy = ___default.default.cloneDeep(question);
692
- if (questionCopy.name === "name") {
693
- questionCopy.default = newDefaultName;
694
- }
695
- return questionCopy;
696
- });
697
- return { newQuestions, newDefaultValues };
698
- }
713
+ const trackEvent = async (ctx, cloudApiService, eventName, eventData) => {
714
+ try {
715
+ await cloudApiService.track(eventName, eventData);
716
+ } catch (e) {
717
+ ctx.logger.debug(`Failed to track ${eventName}`, e);
718
+ }
719
+ };
699
720
  const openModule$1 = import("open");
700
721
  async function promptLogin(ctx) {
701
722
  const response = await inquirer__default.default.prompt([
@@ -716,13 +737,6 @@ async function loginAction(ctx) {
716
737
  const tokenService = await tokenServiceFactory(ctx);
717
738
  const existingToken = await tokenService.retrieveToken();
718
739
  const cloudApiService = await cloudApiFactory(ctx, existingToken || void 0);
719
- const trackFailedLogin = async () => {
720
- try {
721
- await cloudApiService.track("didNotLogin", { loginMethod: "cli" });
722
- } catch (e) {
723
- logger.debug("Failed to track failed login", e);
724
- }
725
- };
726
740
  if (existingToken) {
727
741
  const isTokenValid = await tokenService.isTokenValid(existingToken);
728
742
  if (isTokenValid) {
@@ -754,11 +768,7 @@ async function loginAction(ctx) {
754
768
  logger.debug(e);
755
769
  return false;
756
770
  }
757
- try {
758
- await cloudApiService.track("willLoginAttempt", {});
759
- } catch (e) {
760
- logger.debug("Failed to track login attempt", e);
761
- }
771
+ await trackEvent(ctx, cloudApiService, "willLoginAttempt", {});
762
772
  logger.debug("🔐 Creating device authentication request...", {
763
773
  client_id: cliConfig2.clientId,
764
774
  scope: cliConfig2.scope,
@@ -838,13 +848,13 @@ async function loginAction(ctx) {
838
848
  "There seems to be a problem with your login information. Please try logging in again."
839
849
  );
840
850
  spinnerFail();
841
- await trackFailedLogin();
851
+ await trackEvent(ctx, cloudApiService, "didNotLogin", { loginMethod: "cli" });
842
852
  return false;
843
853
  }
844
854
  if (e.response?.data.error && !["authorization_pending", "slow_down"].includes(e.response.data.error)) {
845
855
  logger.debug(e);
846
856
  spinnerFail();
847
- await trackFailedLogin();
857
+ await trackEvent(ctx, cloudApiService, "didNotLogin", { loginMethod: "cli" });
848
858
  return false;
849
859
  }
850
860
  await new Promise((resolve) => {
@@ -858,15 +868,50 @@ async function loginAction(ctx) {
858
868
  "To access your dashboard, please copy and paste the following URL into your web browser:"
859
869
  );
860
870
  logger.log(chalk__default.default.underline(`${apiConfig.dashboardBaseUrl}/projects`));
861
- try {
862
- await cloudApiService.track("didLogin", { loginMethod: "cli" });
863
- } catch (e) {
864
- logger.debug("Failed to track login", e);
865
- }
871
+ await trackEvent(ctx, cloudApiService, "didLogin", { loginMethod: "cli" });
866
872
  };
867
873
  await authenticate();
868
874
  return isAuthenticated;
869
875
  }
876
+ function questionDefaultValuesMapper(questionsMap) {
877
+ return (questions) => {
878
+ return questions.map((question) => {
879
+ const questionName = question.name;
880
+ if (questionName in questionsMap) {
881
+ const questionDefault = questionsMap[questionName];
882
+ if (typeof questionDefault === "function") {
883
+ return {
884
+ ...question,
885
+ default: questionDefault(question)
886
+ };
887
+ }
888
+ return {
889
+ ...question,
890
+ default: questionDefault
891
+ };
892
+ }
893
+ return question;
894
+ });
895
+ };
896
+ }
897
+ function getDefaultsFromQuestions(questions) {
898
+ return questions.reduce((acc, question) => {
899
+ if (question.default && question.name) {
900
+ return { ...acc, [question.name]: question.default };
901
+ }
902
+ return acc;
903
+ }, {});
904
+ }
905
+ function getProjectNodeVersionDefault(question) {
906
+ const currentNodeVersion = process.versions.node.split(".")[0];
907
+ if (question.type === "list" && Array.isArray(question.choices)) {
908
+ const choice = question.choices.find((choice2) => choice2.value === currentNodeVersion);
909
+ if (choice) {
910
+ return choice.value;
911
+ }
912
+ }
913
+ return question.default;
914
+ }
870
915
  async function handleError(ctx, error) {
871
916
  const { logger } = ctx;
872
917
  logger.debug(error);
@@ -911,7 +956,7 @@ async function createProject$1(ctx, cloudApi, projectInput) {
911
956
  throw e;
912
957
  }
913
958
  }
914
- const action$3 = async (ctx) => {
959
+ const action$4 = async (ctx) => {
915
960
  const { logger } = ctx;
916
961
  const { getValidToken, eraseToken } = await tokenServiceFactory(ctx);
917
962
  const token = await getValidToken(ctx, promptLogin);
@@ -920,11 +965,16 @@ const action$3 = async (ctx) => {
920
965
  }
921
966
  const cloudApi = await cloudApiFactory(ctx, token);
922
967
  const { data: config } = await cloudApi.config();
923
- const { newQuestions: questions, newDefaultValues: defaultValues } = applyDefaultName(
924
- await getProjectNameFromPackageJson(ctx),
925
- config.projectCreation.questions,
926
- config.projectCreation.defaults
927
- );
968
+ const projectName = await getProjectNameFromPackageJson(ctx);
969
+ const defaultAnswersMapper = questionDefaultValuesMapper({
970
+ name: projectName,
971
+ nodeVersion: getProjectNodeVersionDefault
972
+ });
973
+ const questions = defaultAnswersMapper(config.projectCreation.questions);
974
+ const defaultValues = {
975
+ ...config.projectCreation.defaults,
976
+ ...getDefaultsFromQuestions(questions)
977
+ };
928
978
  const projectAnswersDefaulted = fp.defaults(defaultValues);
929
979
  const projectAnswers = await inquirer__default.default.prompt(questions);
930
980
  const projectInput = projectAnswersDefaulted(projectAnswers);
@@ -1026,6 +1076,7 @@ const buildLogsServiceFactory = ({ logger }) => {
1026
1076
  if (retries > MAX_RETRIES) {
1027
1077
  spinner.fail("We were unable to connect to the server to get build logs at this time.");
1028
1078
  es.close();
1079
+ clearExistingTimeout();
1029
1080
  reject(new Error("Max retries reached"));
1030
1081
  }
1031
1082
  };
@@ -1100,17 +1151,7 @@ async function upload(ctx, project, token, maxProjectFileSize) {
1100
1151
  return data.build_id;
1101
1152
  } catch (e) {
1102
1153
  progressBar.stop();
1103
- if (e instanceof axios.AxiosError && e.response?.data) {
1104
- if (e.response.status === 404) {
1105
- ctx.logger.error(
1106
- `The project does not exist. Remove the ${LOCAL_SAVE_FILENAME} file and try again.`
1107
- );
1108
- } else {
1109
- ctx.logger.error(e.response.data);
1110
- }
1111
- } else {
1112
- ctx.logger.error("An error occurred while deploying the project. Please try again later.");
1113
- }
1154
+ ctx.logger.error("An error occurred while deploying the project. Please try again later.");
1114
1155
  ctx.logger.debug(e);
1115
1156
  } finally {
1116
1157
  await fse__namespace.default.remove(tarFilePath);
@@ -1126,7 +1167,7 @@ async function getProject(ctx) {
1126
1167
  const { project } = await retrieve();
1127
1168
  if (!project) {
1128
1169
  try {
1129
- return await action$3(ctx);
1170
+ return await action$4(ctx);
1130
1171
  } catch (e) {
1131
1172
  ctx.logger.error("An error occurred while deploying the project. Please try again later.");
1132
1173
  ctx.logger.debug(e);
@@ -1135,7 +1176,19 @@ async function getProject(ctx) {
1135
1176
  }
1136
1177
  return project;
1137
1178
  }
1138
- const action$2 = async (ctx) => {
1179
+ async function getConfig({
1180
+ ctx,
1181
+ cloudApiService
1182
+ }) {
1183
+ try {
1184
+ const { data: cliConfig2 } = await cloudApiService.config();
1185
+ return cliConfig2;
1186
+ } catch (e) {
1187
+ ctx.logger.debug("Failed to get cli config", e);
1188
+ return null;
1189
+ }
1190
+ }
1191
+ const action$3 = async (ctx) => {
1139
1192
  const { getValidToken } = await tokenServiceFactory(ctx);
1140
1193
  const token = await getValidToken(ctx, promptLogin);
1141
1194
  if (!token) {
@@ -1145,15 +1198,51 @@ const action$2 = async (ctx) => {
1145
1198
  if (!project) {
1146
1199
  return;
1147
1200
  }
1148
- const cloudApiService = await cloudApiFactory(ctx);
1201
+ const cloudApiService = await cloudApiFactory(ctx, token);
1149
1202
  try {
1150
- await cloudApiService.track("willDeployWithCLI", { projectInternalName: project.name });
1203
+ const {
1204
+ data: { data: projectData, metadata }
1205
+ } = await cloudApiService.getProject({ name: project.name });
1206
+ const isProjectSuspended = projectData.suspendedAt;
1207
+ if (isProjectSuspended) {
1208
+ ctx.logger.log(
1209
+ "\n Oops! This project has been suspended. \n\n Please reactivate it from the dashboard to continue deploying: "
1210
+ );
1211
+ ctx.logger.log(chalk__default.default.underline(`${metadata.dashboardUrls.project}`));
1212
+ return;
1213
+ }
1151
1214
  } catch (e) {
1152
- ctx.logger.debug("Failed to track willDeploy", e);
1215
+ if (e instanceof axios.AxiosError && e.response?.data) {
1216
+ if (e.response.status === 404) {
1217
+ ctx.logger.warn(
1218
+ `The project associated with this folder does not exist in Strapi Cloud.
1219
+ Please link your local project to an existing Strapi Cloud project using the ${chalk__default.default.cyan(
1220
+ "link"
1221
+ )} command before deploying.`
1222
+ );
1223
+ } else {
1224
+ ctx.logger.error(e.response.data);
1225
+ }
1226
+ } else {
1227
+ ctx.logger.error(
1228
+ "An error occurred while retrieving the project's information. Please try again later."
1229
+ );
1230
+ }
1231
+ ctx.logger.debug(e);
1232
+ return;
1153
1233
  }
1234
+ await trackEvent(ctx, cloudApiService, "willDeployWithCLI", {
1235
+ projectInternalName: project.name
1236
+ });
1154
1237
  const notificationService = notificationServiceFactory(ctx);
1155
1238
  const buildLogsService = buildLogsServiceFactory(ctx);
1156
- const { data: cliConfig2 } = await cloudApiService.config();
1239
+ const cliConfig2 = await getConfig({ ctx, cloudApiService });
1240
+ if (!cliConfig2) {
1241
+ ctx.logger.error(
1242
+ "An error occurred while retrieving data from Strapi Cloud. Please check your network or try again later."
1243
+ );
1244
+ return;
1245
+ }
1157
1246
  let maxSize = parseInt(cliConfig2.maxProjectFileSize, 10);
1158
1247
  if (Number.isNaN(maxSize)) {
1159
1248
  ctx.logger.debug(
@@ -1175,10 +1264,11 @@ const action$2 = async (ctx) => {
1175
1264
  chalk__default.default.underline(`${apiConfig.dashboardBaseUrl}/projects/${project.name}/deployments`)
1176
1265
  );
1177
1266
  } catch (e) {
1267
+ ctx.logger.debug(e);
1178
1268
  if (e instanceof Error) {
1179
1269
  ctx.logger.error(e.message);
1180
1270
  } else {
1181
- throw e;
1271
+ ctx.logger.error("An error occurred while deploying the project. Please try again later.");
1182
1272
  }
1183
1273
  }
1184
1274
  };
@@ -1209,12 +1299,158 @@ const runAction = (name2, action2) => (...args) => {
1209
1299
  process.exit(1);
1210
1300
  });
1211
1301
  };
1212
- const command$4 = ({ command: command2, ctx }) => {
1213
- command2.command("cloud:deploy").alias("deploy").description("Deploy a Strapi Cloud project").option("-d, --debug", "Enable debugging mode with verbose logs").option("-s, --silent", "Don't log anything").action(() => runAction("deploy", action$2)(ctx));
1302
+ const command$5 = ({ command: command2, ctx }) => {
1303
+ command2.command("cloud:deploy").alias("deploy").description("Deploy a Strapi Cloud project").option("-d, --debug", "Enable debugging mode with verbose logs").option("-s, --silent", "Don't log anything").action(() => runAction("deploy", action$3)(ctx));
1214
1304
  };
1215
1305
  const deployProject = {
1216
1306
  name: "deploy-project",
1217
1307
  description: "Deploy a Strapi Cloud project",
1308
+ action: action$3,
1309
+ command: command$5
1310
+ };
1311
+ const QUIT_OPTION = "Quit";
1312
+ async function getExistingConfig(ctx) {
1313
+ try {
1314
+ return await retrieve();
1315
+ } catch (e) {
1316
+ ctx.logger.debug("Failed to get project config", e);
1317
+ ctx.logger.error("An error occurred while retrieving config data from your local project.");
1318
+ return null;
1319
+ }
1320
+ }
1321
+ async function promptForRelink(ctx, cloudApiService, existingConfig) {
1322
+ if (existingConfig && existingConfig.project) {
1323
+ const { shouldRelink } = await inquirer__default.default.prompt([
1324
+ {
1325
+ type: "confirm",
1326
+ name: "shouldRelink",
1327
+ message: `A project named ${chalk__default.default.cyan(
1328
+ existingConfig.project.displayName ? existingConfig.project.displayName : existingConfig.project.name
1329
+ )} is already linked to this local folder. Do you want to update the link?`,
1330
+ default: false
1331
+ }
1332
+ ]);
1333
+ if (!shouldRelink) {
1334
+ await trackEvent(ctx, cloudApiService, "didNotLinkProject", {
1335
+ currentProjectName: existingConfig.project?.name
1336
+ });
1337
+ return false;
1338
+ }
1339
+ }
1340
+ return true;
1341
+ }
1342
+ async function getProjectsList(ctx, cloudApiService, existingConfig) {
1343
+ const spinner = ctx.logger.spinner("Fetching your projects...\n").start();
1344
+ try {
1345
+ const {
1346
+ data: { data: projectList }
1347
+ } = await cloudApiService.listLinkProjects();
1348
+ spinner.succeed();
1349
+ if (!Array.isArray(projectList)) {
1350
+ ctx.logger.log("We couldn't find any projects available for linking in Strapi Cloud");
1351
+ return null;
1352
+ }
1353
+ const projects = projectList.filter(
1354
+ (project) => !(project.isMaintainer || project.name === existingConfig?.project?.name)
1355
+ ).map((project) => {
1356
+ return {
1357
+ name: project.displayName,
1358
+ value: { name: project.name, displayName: project.displayName }
1359
+ };
1360
+ });
1361
+ if (projects.length === 0) {
1362
+ ctx.logger.log("We couldn't find any projects available for linking in Strapi Cloud");
1363
+ return null;
1364
+ }
1365
+ return projects;
1366
+ } catch (e) {
1367
+ spinner.fail("An error occurred while fetching your projects from Strapi Cloud.");
1368
+ ctx.logger.debug("Failed to list projects", e);
1369
+ return null;
1370
+ }
1371
+ }
1372
+ async function getUserSelection(ctx, projects) {
1373
+ const { logger } = ctx;
1374
+ try {
1375
+ const answer = await inquirer__default.default.prompt([
1376
+ {
1377
+ type: "list",
1378
+ name: "linkProject",
1379
+ message: "Which project do you want to link?",
1380
+ choices: [...projects, { name: chalk__default.default.grey(`(${QUIT_OPTION})`), value: null }]
1381
+ }
1382
+ ]);
1383
+ if (!answer.linkProject) {
1384
+ return null;
1385
+ }
1386
+ return answer;
1387
+ } catch (e) {
1388
+ logger.debug("Failed to get user input", e);
1389
+ logger.error("An error occurred while trying to get your input.");
1390
+ return null;
1391
+ }
1392
+ }
1393
+ const action$2 = async (ctx) => {
1394
+ const { getValidToken } = await tokenServiceFactory(ctx);
1395
+ const token = await getValidToken(ctx, promptLogin);
1396
+ const { logger } = ctx;
1397
+ if (!token) {
1398
+ return;
1399
+ }
1400
+ const cloudApiService = await cloudApiFactory(ctx, token);
1401
+ const existingConfig = await getExistingConfig(ctx);
1402
+ const shouldRelink = await promptForRelink(ctx, cloudApiService, existingConfig);
1403
+ if (!shouldRelink) {
1404
+ return;
1405
+ }
1406
+ await trackEvent(ctx, cloudApiService, "willLinkProject", {});
1407
+ const projects = await getProjectsList(
1408
+ ctx,
1409
+ cloudApiService,
1410
+ existingConfig
1411
+ );
1412
+ if (!projects) {
1413
+ return;
1414
+ }
1415
+ const answer = await getUserSelection(ctx, projects);
1416
+ if (!answer) {
1417
+ return;
1418
+ }
1419
+ try {
1420
+ const { confirmAction } = await inquirer__default.default.prompt([
1421
+ {
1422
+ type: "confirm",
1423
+ name: "confirmAction",
1424
+ message: "Warning: Once linked, deploying from CLI will replace the existing project and its data. Confirm to proceed:",
1425
+ default: false
1426
+ }
1427
+ ]);
1428
+ if (!confirmAction) {
1429
+ await trackEvent(ctx, cloudApiService, "didNotLinkProject", {
1430
+ cancelledProjectName: answer.linkProject.name,
1431
+ currentProjectName: existingConfig ? existingConfig.project?.name : null
1432
+ });
1433
+ return;
1434
+ }
1435
+ await save({ project: answer.linkProject });
1436
+ logger.log(`Project ${chalk__default.default.cyan(answer.linkProject.displayName)} linked successfully.`);
1437
+ await trackEvent(ctx, cloudApiService, "didLinkProject", {
1438
+ projectInternalName: answer.linkProject
1439
+ });
1440
+ } catch (e) {
1441
+ logger.debug("Failed to link project", e);
1442
+ logger.error("An error occurred while linking the project.");
1443
+ await trackEvent(ctx, cloudApiService, "didNotLinkProject", {
1444
+ projectInternalName: answer.linkProject
1445
+ });
1446
+ }
1447
+ };
1448
+ const command$4 = ({ command: command2, ctx }) => {
1449
+ command2.command("cloud:link").alias("link").description("Link a local directory to a Strapi Cloud project").option("-d, --debug", "Enable debugging mode with verbose logs").option("-s, --silent", "Don't log anything").action(() => runAction("link", action$2)(ctx));
1450
+ };
1451
+ const link = {
1452
+ name: "link-project",
1453
+ description: "Link a local directory to a Strapi Cloud project",
1218
1454
  action: action$2,
1219
1455
  command: command$4
1220
1456
  };
@@ -1261,11 +1497,7 @@ const action$1 = async (ctx) => {
1261
1497
  logger.error("🥲 Oops! Something went wrong while logging you out. Please try again.");
1262
1498
  logger.debug(e);
1263
1499
  }
1264
- try {
1265
- await cloudApiService.track("didLogout", { loginMethod: "cli" });
1266
- } catch (e) {
1267
- logger.debug("Failed to track logout event", e);
1268
- }
1500
+ await trackEvent(ctx, cloudApiService, "didLogout", { loginMethod: "cli" });
1269
1501
  };
1270
1502
  const command$2 = ({ command: command2, ctx }) => {
1271
1503
  command2.command("cloud:logout").alias("logout").description("Strapi Cloud Logout").option("-d, --debug", "Enable debugging mode with verbose logs").option("-s, --silent", "Don't log anything").action(() => runAction("logout", action$1)(ctx));
@@ -1277,12 +1509,12 @@ const logout = {
1277
1509
  command: command$2
1278
1510
  };
1279
1511
  const command$1 = ({ command: command2, ctx }) => {
1280
- command2.command("cloud:create-project").description("Create a Strapi Cloud project").option("-d, --debug", "Enable debugging mode with verbose logs").option("-s, --silent", "Don't log anything").action(() => runAction("cloud:create-project", action$3)(ctx));
1512
+ command2.command("cloud:create-project").description("Create a Strapi Cloud project").option("-d, --debug", "Enable debugging mode with verbose logs").option("-s, --silent", "Don't log anything").action(() => runAction("cloud:create-project", action$4)(ctx));
1281
1513
  };
1282
1514
  const createProject = {
1283
1515
  name: "create-project",
1284
1516
  description: "Create a new project",
1285
- action: action$3,
1517
+ action: action$4,
1286
1518
  command: command$1
1287
1519
  };
1288
1520
  const action = async (ctx) => {
@@ -1306,7 +1538,7 @@ const action = async (ctx) => {
1306
1538
  }
1307
1539
  };
1308
1540
  const command = ({ command: command2, ctx }) => {
1309
- command2.command("cloud:projects").alias("projects").description("List Strapi Cloud projects").option("-d, --debug", "Enable debugging mode with verbose logs").option("-s, --silent", "Don't log anything").action(() => runAction("listProjects", action)(ctx));
1541
+ command2.command("cloud:projects").alias("projects").description("List Strapi Cloud projects").option("-d, --debug", "Enable debugging mode with verbose logs").option("-s, --silent", "Don't log anything").action(() => runAction("projects", action)(ctx));
1310
1542
  };
1311
1543
  const listProjects = {
1312
1544
  name: "list-projects",
@@ -1316,12 +1548,13 @@ const listProjects = {
1316
1548
  };
1317
1549
  const cli = {
1318
1550
  deployProject,
1551
+ link,
1319
1552
  login,
1320
1553
  logout,
1321
1554
  createProject,
1322
1555
  listProjects
1323
1556
  };
1324
- const cloudCommands = [deployProject, login, logout, listProjects];
1557
+ const cloudCommands = [deployProject, link, login, logout, listProjects];
1325
1558
  async function initCloudCLIConfig() {
1326
1559
  const localConfig = await getLocalConfig();
1327
1560
  if (!localConfig.deviceId) {