@tailor-platform/sdk 0.18.1 → 0.19.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.
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { PATScope, applyCommand, commonArgs, createCommand, deleteCommand, executionsCommand, fetchAll, fetchLatestToken, fetchUserInfo, generateCommand, getCommand, getCommand$1 as getCommand$2, initOAuth2Client, initOperatorClient, jsonArgs, listCommand as listCommand$1, listCommand$1 as listCommand$7, listCommand$2 as listCommand$8, listCommand$3 as listCommand, loadAccessToken, loadConfig, loadWorkspaceId, printData, readPackageJson, readPlatformConfig, removeCommand, resumeCommand, showCommand, startCommand, tokenCommand, withCommonArgs, writePlatformConfig } from "../resume-8Y9mmXHa.mjs";
2
+ import { PATScope, applyCommand, commonArgs, createCommand, deleteCommand, deploymentArgs, executionsCommand, fetchAll, fetchLatestToken, fetchUserInfo, generateCommand, getCommand, getCommand$1 as getCommand$2, initOAuth2Client, initOperatorClient, jsonArgs, listCommand as listCommand$1, listCommand$1 as listCommand$7, listCommand$2 as listCommand$8, listCommand$3 as listCommand, loadAccessToken, loadConfig, loadWorkspaceId, logger, printData, readPackageJson, readPlatformConfig, removeCommand, resumeCommand, showCommand, startCommand, tokenCommand, withCommonArgs, workspaceArgs, writePlatformConfig } from "../resume-DSfYKl2w.mjs";
3
3
  import "../job-CL8myeqs.mjs";
4
4
  import { register } from "node:module";
5
5
  import { defineCommand, runCommand, runMain } from "citty";
@@ -8,11 +8,9 @@ import * as fs from "fs";
8
8
  import pLimit from "p-limit";
9
9
  import * as crypto from "node:crypto";
10
10
  import ml from "multiline-ts";
11
- import consola, { consola as consola$1, createConsola } from "consola";
12
11
  import { generateCodeVerifier } from "@badgateway/oauth2-client";
13
12
  import { timestampDate } from "@bufbuild/protobuf/wkt";
14
13
  import { Code, ConnectError } from "@connectrpc/connect";
15
- import chalk from "chalk";
16
14
  import { spawnSync } from "node:child_process";
17
15
  import * as http from "node:http";
18
16
  import open from "open";
@@ -56,7 +54,7 @@ const initCommand = defineCommand({
56
54
  const version = packageJson$1.version && packageJson$1.version !== "0.0.0" ? packageJson$1.version : "latest";
57
55
  let packageManager = detectPackageManager();
58
56
  if (!packageManager) {
59
- consola$1.warn("⚠️ Could not detect package manager, defaulting to npm");
57
+ logger.warn("⚠️ Could not detect package manager, defaulting to npm");
60
58
  packageManager = "npm";
61
59
  }
62
60
  const initArgs = [
@@ -66,7 +64,7 @@ const initCommand = defineCommand({
66
64
  ...packageManager === "npm" ? ["--"] : [],
67
65
  ...args.template ? ["--template", args.template] : []
68
66
  ];
69
- consola$1.log(`Running: ${packageManager} ${initArgs.join(" ")}`);
67
+ logger.log(`Running: ${packageManager} ${initArgs.join(" ")}`);
70
68
  spawnSync(packageManager, initArgs, { stdio: "inherit" });
71
69
  })
72
70
  });
@@ -133,11 +131,11 @@ const startAuthServer = async () => {
133
131
  state,
134
132
  codeVerifier
135
133
  });
136
- consola$1.info(`Opening browser for login:\n\n${authorizeUri}\n`);
134
+ logger.info(`Opening browser for login:\n\n${authorizeUri}\n`);
137
135
  try {
138
136
  await open(authorizeUri);
139
137
  } catch {
140
- consola$1.warn("Failed to open browser automatically. Please open the URL above manually.");
138
+ logger.warn("Failed to open browser automatically. Please open the URL above manually.");
141
139
  }
142
140
  });
143
141
  });
@@ -150,7 +148,7 @@ const loginCommand = defineCommand({
150
148
  args: commonArgs,
151
149
  run: withCommonArgs(async () => {
152
150
  await startAuthServer();
153
- consola$1.success("Successfully logged in to Tailor Platform.");
151
+ logger.success("Successfully logged in to Tailor Platform.");
154
152
  })
155
153
  });
156
154
 
@@ -166,7 +164,7 @@ const logoutCommand = defineCommand({
166
164
  const pfConfig = readPlatformConfig();
167
165
  const tokens = pfConfig.current_user ? pfConfig.users[pfConfig.current_user] : void 0;
168
166
  if (!tokens) {
169
- consola$1.warn("You are not logged in.");
167
+ logger.warn("You are not logged in.");
170
168
  return;
171
169
  }
172
170
  initOAuth2Client().revoke({
@@ -177,7 +175,7 @@ const logoutCommand = defineCommand({
177
175
  delete pfConfig.users[pfConfig.current_user];
178
176
  pfConfig.current_user = null;
179
177
  writePlatformConfig(pfConfig);
180
- consola$1.success("Successfully logged out from Tailor Platform.");
178
+ logger.success("Successfully logged out from Tailor Platform.");
181
179
  })
182
180
  });
183
181
 
@@ -255,7 +253,7 @@ const createCommand$3 = defineCommand({
255
253
  workspace_id: args["workspace-id"]
256
254
  };
257
255
  writePlatformConfig(config);
258
- if (!args.json) consola$1.success(`Profile "${args.name}" created successfully.`);
256
+ if (!args.json) logger.success(`Profile "${args.name}" created successfully.`);
259
257
  const profileInfo = {
260
258
  name: args.name,
261
259
  user: args.user,
@@ -285,7 +283,7 @@ const deleteCommand$3 = defineCommand({
285
283
  if (!config.profiles[args.name]) throw new Error(`Profile "${args.name}" not found.`);
286
284
  delete config.profiles[args.name];
287
285
  writePlatformConfig(config);
288
- consola$1.success(`Profile "${args.name}" deleted successfully.`);
286
+ logger.success(`Profile "${args.name}" deleted successfully.`);
289
287
  })
290
288
  });
291
289
 
@@ -304,7 +302,7 @@ const listCommand$6 = defineCommand({
304
302
  const config = readPlatformConfig();
305
303
  const profiles = Object.entries(config.profiles);
306
304
  if (profiles.length === 0) {
307
- consola$1.info(ml`
305
+ logger.info(ml`
308
306
  No profiles found.
309
307
  Please create a profile first using 'tailor-sdk profile create' command.
310
308
  `);
@@ -363,7 +361,7 @@ const updateCommand$1 = defineCommand({
363
361
  profile.user = newUser;
364
362
  profile.workspace_id = newWorkspaceId;
365
363
  writePlatformConfig(config);
366
- if (!args.json) consola$1.success(`Profile "${args.name}" updated successfully`);
364
+ if (!args.json) logger.success(`Profile "${args.name}" updated successfully`);
367
365
  const profileInfo = {
368
366
  name: args.name,
369
367
  user: newUser,
@@ -400,16 +398,7 @@ const createSecretCommand = defineCommand({
400
398
  },
401
399
  args: {
402
400
  ...commonArgs,
403
- "workspace-id": {
404
- type: "string",
405
- description: "Workspace ID",
406
- alias: "w"
407
- },
408
- profile: {
409
- type: "string",
410
- description: "Workspace profile",
411
- alias: "p"
412
- },
401
+ ...workspaceArgs,
413
402
  "vault-name": {
414
403
  type: "string",
415
404
  description: "Vault name",
@@ -450,7 +439,7 @@ const createSecretCommand = defineCommand({
450
439
  }
451
440
  throw error;
452
441
  }
453
- consola$1.success(`Secret: ${args.name} created in vault: ${args["vault-name"]}`);
442
+ logger.success(`Secret: ${args.name} created in vault: ${args["vault-name"]}`);
454
443
  })
455
444
  });
456
445
 
@@ -463,16 +452,7 @@ const deleteSecretCommand = defineCommand({
463
452
  },
464
453
  args: {
465
454
  ...commonArgs,
466
- "workspace-id": {
467
- type: "string",
468
- description: "Workspace ID",
469
- alias: "w"
470
- },
471
- profile: {
472
- type: "string",
473
- description: "Workspace profile",
474
- alias: "p"
475
- },
455
+ ...workspaceArgs,
476
456
  "vault-name": {
477
457
  type: "string",
478
458
  description: "Vault name",
@@ -501,8 +481,8 @@ const deleteSecretCommand = defineCommand({
501
481
  profile: args.profile
502
482
  });
503
483
  if (!args.yes) {
504
- if (await consola$1.prompt(`Enter the secret name to confirm deletion ("${args.name}"): `, { type: "text" }) !== args.name) {
505
- consola$1.info("Secret deletion cancelled.");
484
+ if (await logger.prompt(`Enter the secret name to confirm deletion ("${args.name}"): `, { type: "text" }) !== args.name) {
485
+ logger.info("Secret deletion cancelled.");
506
486
  return;
507
487
  }
508
488
  }
@@ -516,7 +496,7 @@ const deleteSecretCommand = defineCommand({
516
496
  if (error instanceof ConnectError && error.code === Code.NotFound) throw new Error(`Secret "${args.name}" not found in vault "${args["vault-name"]}".`);
517
497
  throw error;
518
498
  }
519
- consola$1.success(`Secret: ${args.name} deleted from vault: ${args["vault-name"]}`);
499
+ logger.success(`Secret: ${args.name} deleted from vault: ${args["vault-name"]}`);
520
500
  })
521
501
  });
522
502
 
@@ -556,16 +536,7 @@ const listSecretCommand = defineCommand({
556
536
  args: {
557
537
  ...commonArgs,
558
538
  ...jsonArgs,
559
- "workspace-id": {
560
- type: "string",
561
- description: "Workspace ID",
562
- alias: "w"
563
- },
564
- profile: {
565
- type: "string",
566
- description: "Workspace profile",
567
- alias: "p"
568
- },
539
+ ...workspaceArgs,
569
540
  "vault-name": {
570
541
  type: "string",
571
542
  description: "Vault name",
@@ -596,16 +567,7 @@ const updateSecretCommand = defineCommand({
596
567
  },
597
568
  args: {
598
569
  ...commonArgs,
599
- "workspace-id": {
600
- type: "string",
601
- description: "Workspace ID",
602
- alias: "w"
603
- },
604
- profile: {
605
- type: "string",
606
- description: "Workspace profile",
607
- alias: "p"
608
- },
570
+ ...workspaceArgs,
609
571
  "vault-name": {
610
572
  type: "string",
611
573
  description: "Vault name",
@@ -643,7 +605,7 @@ const updateSecretCommand = defineCommand({
643
605
  if (error instanceof ConnectError && error.code === Code.NotFound) throw new Error(`Secret "${args.name}" not found in vault "${args["vault-name"]}".`);
644
606
  throw error;
645
607
  }
646
- consola$1.success(`Secret: ${args.name} updated in vault: ${args["vault-name"]}`);
608
+ logger.success(`Secret: ${args.name} updated in vault: ${args["vault-name"]}`);
647
609
  })
648
610
  });
649
611
 
@@ -656,16 +618,7 @@ const createCommand$2 = defineCommand({
656
618
  },
657
619
  args: {
658
620
  ...commonArgs,
659
- "workspace-id": {
660
- type: "string",
661
- description: "Workspace ID",
662
- alias: "w"
663
- },
664
- profile: {
665
- type: "string",
666
- description: "Workspace profile",
667
- alias: "p"
668
- },
621
+ ...workspaceArgs,
669
622
  name: {
670
623
  type: "string",
671
624
  description: "Vault name",
@@ -691,7 +644,7 @@ const createCommand$2 = defineCommand({
691
644
  if (error instanceof ConnectError && error.code === Code.AlreadyExists) throw new Error(`Vault "${args.name}" already exists.`);
692
645
  throw error;
693
646
  }
694
- consola$1.success(`Vault: ${args.name} created`);
647
+ logger.success(`Vault: ${args.name} created`);
695
648
  })
696
649
  });
697
650
 
@@ -704,16 +657,7 @@ const deleteCommand$2 = defineCommand({
704
657
  },
705
658
  args: {
706
659
  ...commonArgs,
707
- "workspace-id": {
708
- type: "string",
709
- description: "Workspace ID",
710
- alias: "w"
711
- },
712
- profile: {
713
- type: "string",
714
- description: "Workspace profile",
715
- alias: "p"
716
- },
660
+ ...workspaceArgs,
717
661
  name: {
718
662
  type: "string",
719
663
  description: "Vault name",
@@ -737,8 +681,8 @@ const deleteCommand$2 = defineCommand({
737
681
  profile: args.profile
738
682
  });
739
683
  if (!args.yes) {
740
- if (await consola$1.prompt(`Enter the vault name to confirm deletion ("${args.name}"): `, { type: "text" }) !== args.name) {
741
- consola$1.info("Vault deletion cancelled.");
684
+ if (await logger.prompt(`Enter the vault name to confirm deletion ("${args.name}"): `, { type: "text" }) !== args.name) {
685
+ logger.info("Vault deletion cancelled.");
742
686
  return;
743
687
  }
744
688
  }
@@ -751,7 +695,7 @@ const deleteCommand$2 = defineCommand({
751
695
  if (error instanceof ConnectError && error.code === Code.NotFound) throw new Error(`Vault "${args.name}" not found.`);
752
696
  throw error;
753
697
  }
754
- consola$1.success(`Vault: ${args.name} deleted`);
698
+ logger.success(`Vault: ${args.name} deleted`);
755
699
  })
756
700
  });
757
701
 
@@ -790,16 +734,7 @@ const listCommand$5 = defineCommand({
790
734
  args: {
791
735
  ...commonArgs,
792
736
  ...jsonArgs,
793
- "workspace-id": {
794
- type: "string",
795
- description: "Workspace ID",
796
- alias: "w"
797
- },
798
- profile: {
799
- type: "string",
800
- description: "Workspace profile",
801
- alias: "p"
802
- }
737
+ ...workspaceArgs
803
738
  },
804
739
  run: withCommonArgs(async (args) => {
805
740
  const vaults = await vaultList({
@@ -847,7 +782,7 @@ const secretCommand = defineCommand({
847
782
  });
848
783
 
849
784
  //#endregion
850
- //#region src/cli/progress.ts
785
+ //#region src/cli/utils/progress.ts
851
786
  function createProgress(label, total) {
852
787
  let current = 0;
853
788
  const update = () => {
@@ -871,7 +806,6 @@ async function withTimeout(p, ms, message) {
871
806
 
872
807
  //#endregion
873
808
  //#region src/cli/staticwebsite/deploy.ts
874
- const noTimeLogger = createConsola({ formatOptions: { date: false } });
875
809
  const CHUNK_SIZE = 64 * 1024;
876
810
  const IGNORED_FILES = new Set([
877
811
  ".DS_Store",
@@ -902,7 +836,7 @@ async function deployStaticWebsite(client, workspaceId, name, distDir, showProgr
902
836
  async function uploadDirectory(client, workspaceId, deploymentId, rootDir, showProgress) {
903
837
  const files = await collectFiles(rootDir);
904
838
  if (files.length === 0) {
905
- consola.warn(`No files found under ${rootDir}`);
839
+ logger.warn(`No files found under ${rootDir}`);
906
840
  return [];
907
841
  }
908
842
  const limit = pLimit(5);
@@ -969,8 +903,8 @@ async function uploadSingleFile(client, workspaceId, deploymentId, rootDir, rela
969
903
  }
970
904
  function logSkippedFiles(skippedFiles) {
971
905
  if (skippedFiles.length === 0) return;
972
- noTimeLogger.log("⚠️WARNING: Deployment completed, but some files failed to upload. These files may have unsupported content types or other validation issues. Please review the list below:");
973
- for (const file of skippedFiles) noTimeLogger.log(` - ${file}`);
906
+ logger.warn("Deployment completed, but some files failed to upload. These files may have unsupported content types or other validation issues. Please review the list below:");
907
+ for (const file of skippedFiles) logger.log(` - ${file}`);
974
908
  }
975
909
  const deployCommand = defineCommand({
976
910
  meta: {
@@ -980,16 +914,7 @@ const deployCommand = defineCommand({
980
914
  args: {
981
915
  ...commonArgs,
982
916
  ...jsonArgs,
983
- "workspace-id": {
984
- type: "string",
985
- description: "Workspace ID",
986
- alias: "w"
987
- },
988
- profile: {
989
- type: "string",
990
- description: "Workspace profile",
991
- alias: "p"
992
- },
917
+ ...workspaceArgs,
993
918
  name: {
994
919
  type: "string",
995
920
  description: "Static website name",
@@ -1004,7 +929,7 @@ const deployCommand = defineCommand({
1004
929
  }
1005
930
  },
1006
931
  run: withCommonArgs(async (args) => {
1007
- consola.info(`Deploying static website "${args.name}" from directory: ${args.dir}`);
932
+ logger.info(`Deploying static website "${args.name}" from directory: ${args.dir}`);
1008
933
  const accessToken = await loadAccessToken({
1009
934
  useProfile: true,
1010
935
  profile: args.profile
@@ -1012,17 +937,20 @@ const deployCommand = defineCommand({
1012
937
  const client = await initOperatorClient(accessToken);
1013
938
  const name = args.name;
1014
939
  const dir = path.resolve(process.cwd(), args.dir);
1015
- const workspaceId = args["workspace-id"];
940
+ const workspaceId = loadWorkspaceId({
941
+ workspaceId: args["workspace-id"],
942
+ profile: args.profile
943
+ });
1016
944
  if (!fs.existsSync(dir) || !fs.statSync(dir).isDirectory()) throw new Error(`Directory not found or not a directory: ${dir}`);
1017
945
  const { url, skippedFiles } = await withTimeout(deployStaticWebsite(client, workspaceId, name, dir, !args.json), 10 * 6e4, "Deployment timed out after 10 minutes.");
1018
- if (args.json) console.log(JSON.stringify({
946
+ if (args.json) printData({
1019
947
  name,
1020
948
  workspaceId,
1021
949
  url,
1022
950
  skippedFiles
1023
- }));
951
+ }, true);
1024
952
  else {
1025
- consola.success(`Static website "${name}" deployed successfully. URL: ${url}`);
953
+ logger.success(`Static website "${name}" deployed successfully. URL: ${url}`);
1026
954
  logSkippedFiles(skippedFiles);
1027
955
  }
1028
956
  })
@@ -1038,20 +966,11 @@ const getCommand$1 = defineCommand({
1038
966
  args: {
1039
967
  ...commonArgs,
1040
968
  ...jsonArgs,
969
+ ...workspaceArgs,
1041
970
  name: {
1042
971
  type: "positional",
1043
972
  description: "Static website name",
1044
973
  required: true
1045
- },
1046
- "workspace-id": {
1047
- type: "string",
1048
- description: "Workspace ID",
1049
- alias: "w"
1050
- },
1051
- profile: {
1052
- type: "string",
1053
- description: "Workspace profile",
1054
- alias: "p"
1055
974
  }
1056
975
  },
1057
976
  run: withCommonArgs(async (args) => {
@@ -1120,16 +1039,7 @@ const listCommand$4 = defineCommand({
1120
1039
  args: {
1121
1040
  ...commonArgs,
1122
1041
  ...jsonArgs,
1123
- "workspace-id": {
1124
- type: "string",
1125
- description: "Workspace ID",
1126
- alias: "w"
1127
- },
1128
- profile: {
1129
- type: "string",
1130
- description: "Workspace profile",
1131
- alias: "p"
1132
- }
1042
+ ...workspaceArgs
1133
1043
  },
1134
1044
  run: withCommonArgs(async (args) => {
1135
1045
  const websites = await listStaticWebsites({
@@ -1177,14 +1087,14 @@ async function truncateSingleType(options, client) {
1177
1087
  namespaceName: options.namespaceName,
1178
1088
  tailordbTypeName: options.typeName
1179
1089
  });
1180
- consola$1.success(`Truncated type "${options.typeName}" in namespace "${options.namespaceName}"`);
1090
+ logger.success(`Truncated type "${options.typeName}" in namespace "${options.namespaceName}"`);
1181
1091
  }
1182
1092
  async function truncateNamespace(workspaceId, namespaceName, client) {
1183
1093
  await client.truncateTailorDBTypes({
1184
1094
  workspaceId,
1185
1095
  namespaceName
1186
1096
  });
1187
- consola$1.success(`Truncated all types in namespace "${namespaceName}"`);
1097
+ logger.success(`Truncated all types in namespace "${namespaceName}"`);
1188
1098
  }
1189
1099
  async function getAllNamespaces(configPath) {
1190
1100
  const { config } = await loadConfig(configPath);
@@ -1228,32 +1138,32 @@ async function truncate(options) {
1228
1138
  const namespaces = await getAllNamespaces(options?.configPath);
1229
1139
  if (hasAll) {
1230
1140
  if (namespaces.length === 0) {
1231
- consola$1.warn("No namespaces found in config file.");
1141
+ logger.warn("No namespaces found in config file.");
1232
1142
  return;
1233
1143
  }
1234
1144
  if (!options?.yes) {
1235
1145
  const namespaceList = namespaces.join(", ");
1236
- if (!await consola$1.prompt(`This will truncate ALL tables in the following namespaces: ${namespaceList}. Continue? (yes/no)`, {
1146
+ if (!await logger.prompt(`This will truncate ALL tables in the following namespaces: ${namespaceList}. Continue? (yes/no)`, {
1237
1147
  type: "confirm",
1238
1148
  initial: false
1239
1149
  })) {
1240
- consola$1.info("Truncate cancelled.");
1150
+ logger.info("Truncate cancelled.");
1241
1151
  return;
1242
1152
  }
1243
1153
  }
1244
1154
  for (const namespace of namespaces) await truncateNamespace(workspaceId, namespace, client);
1245
- consola$1.success("Truncated all tables in all namespaces");
1155
+ logger.success("Truncated all tables in all namespaces");
1246
1156
  return;
1247
1157
  }
1248
1158
  if (hasNamespace && options?.namespace) {
1249
1159
  const namespace = options.namespace;
1250
1160
  if (!namespaces.includes(namespace)) throw new Error(`Namespace "${namespace}" not found in config. Available namespaces: ${namespaces.join(", ")}`);
1251
1161
  if (!options.yes) {
1252
- if (!await consola$1.prompt(`This will truncate ALL tables in namespace "${namespace}". Continue? (yes/no)`, {
1162
+ if (!await logger.prompt(`This will truncate ALL tables in namespace "${namespace}". Continue? (yes/no)`, {
1253
1163
  type: "confirm",
1254
1164
  initial: false
1255
1165
  })) {
1256
- consola$1.info("Truncate cancelled.");
1166
+ logger.info("Truncate cancelled.");
1257
1167
  return;
1258
1168
  }
1259
1169
  }
@@ -1272,11 +1182,11 @@ async function truncate(options) {
1272
1182
  if (notFoundTypes.length > 0) throw new Error(`The following types were not found in any namespace: ${notFoundTypes.join(", ")}`);
1273
1183
  if (!options.yes) {
1274
1184
  const typeList = typeNames.join(", ");
1275
- if (!await consola$1.prompt(`This will truncate the following types: ${typeList}. Continue? (yes/no)`, {
1185
+ if (!await logger.prompt(`This will truncate the following types: ${typeList}. Continue? (yes/no)`, {
1276
1186
  type: "confirm",
1277
1187
  initial: false
1278
1188
  })) {
1279
- consola$1.info("Truncate cancelled.");
1189
+ logger.info("Truncate cancelled.");
1280
1190
  return;
1281
1191
  }
1282
1192
  }
@@ -1311,7 +1221,7 @@ const truncateCommand = defineCommand({
1311
1221
  },
1312
1222
  namespace: {
1313
1223
  type: "string",
1314
- description: "Namespace to use (if type names are specified, truncates only those types in this namespace)",
1224
+ description: "Truncate all tables in specified namespace",
1315
1225
  alias: "n"
1316
1226
  },
1317
1227
  yes: {
@@ -1320,22 +1230,7 @@ const truncateCommand = defineCommand({
1320
1230
  alias: "y",
1321
1231
  default: false
1322
1232
  },
1323
- "workspace-id": {
1324
- type: "string",
1325
- description: "Workspace ID",
1326
- alias: "w"
1327
- },
1328
- profile: {
1329
- type: "string",
1330
- description: "Workspace profile",
1331
- alias: "p"
1332
- },
1333
- config: {
1334
- type: "string",
1335
- description: "Path to tailor config file",
1336
- default: "tailor.config.ts",
1337
- alias: "c"
1338
- }
1233
+ ...deploymentArgs
1339
1234
  },
1340
1235
  run: withCommonArgs(async (args) => {
1341
1236
  const types = args._.length > 0 ? args._.map((arg) => String(arg)).filter(Boolean) : void 0;
@@ -1372,7 +1267,7 @@ const currentCommand = defineCommand({
1372
1267
  run: withCommonArgs(async () => {
1373
1268
  const config = readPlatformConfig();
1374
1269
  if (!config.current_user) {
1375
- consola$1.warn(ml`
1270
+ logger.warn(ml`
1376
1271
  Current user not set.
1377
1272
  Please login first using 'tailor-sdk login' command to register a user.
1378
1273
  `);
@@ -1382,7 +1277,7 @@ const currentCommand = defineCommand({
1382
1277
  Current user '${config.current_user}' not found in registered users.
1383
1278
  Please login again using 'tailor-sdk login' command to register the user.
1384
1279
  `);
1385
- console.log(config.current_user);
1280
+ logger.log(config.current_user);
1386
1281
  })
1387
1282
  });
1388
1283
 
@@ -1401,19 +1296,19 @@ const listCommand$2 = defineCommand({
1401
1296
  const config = readPlatformConfig();
1402
1297
  const users = Object.keys(config.users);
1403
1298
  if (users.length === 0) {
1404
- consola$1.info(ml`
1299
+ logger.info(ml`
1405
1300
  No users found.
1406
1301
  Please login first using 'tailor-sdk login' command to register a user.
1407
1302
  `);
1408
1303
  return;
1409
1304
  }
1410
1305
  if (args.json) {
1411
- console.log(JSON.stringify(users));
1306
+ printData(users, args.json);
1412
1307
  return;
1413
1308
  }
1414
1309
  users.forEach((user) => {
1415
- if (user === config.current_user) console.log(chalk.green.bold(`${user} (current)`));
1416
- else console.log(user);
1310
+ if (user === config.current_user) logger.success(`${user} (current)`, { mode: "plain" });
1311
+ else logger.log(user);
1417
1312
  });
1418
1313
  })
1419
1314
  });
@@ -1441,12 +1336,12 @@ function getScopeStringsFromWriteFlag(write) {
1441
1336
  }
1442
1337
  function printCreatedToken(name, token, write, action, json) {
1443
1338
  const scopes = getScopeStringsFromWriteFlag(write);
1444
- if (json) console.log(JSON.stringify({
1339
+ if (json) printData({
1445
1340
  name,
1446
1341
  scopes,
1447
1342
  token
1448
- }));
1449
- else console.log(ml`
1343
+ }, json);
1344
+ else logger.log(ml`
1450
1345
  Personal access token ${action} successfully.
1451
1346
 
1452
1347
  name: ${name}
@@ -1475,8 +1370,8 @@ const createCommand$1 = defineCommand({
1475
1370
  write: {
1476
1371
  type: "boolean",
1477
1372
  description: "Grant write permission (default: read-only)",
1478
- default: false,
1479
- alias: "w"
1373
+ alias: "W",
1374
+ default: false
1480
1375
  }
1481
1376
  },
1482
1377
  run: withCommonArgs(async (args) => {
@@ -1520,7 +1415,7 @@ const deleteCommand$1 = defineCommand({
1520
1415
  `);
1521
1416
  const token = await fetchLatestToken(config, config.current_user);
1522
1417
  await (await initOperatorClient(token)).deletePersonalAccessToken({ name: args.name });
1523
- consola$1.success(`Personal access token "${args.name}" deleted successfully.`);
1418
+ logger.success(`Personal access token "${args.name}" deleted successfully.`);
1524
1419
  })
1525
1420
  });
1526
1421
 
@@ -1548,7 +1443,7 @@ const listCommand$3 = defineCommand({
1548
1443
  return [personalAccessTokens, nextPageToken];
1549
1444
  });
1550
1445
  if (pats.length === 0) {
1551
- consola$1.info(ml`
1446
+ logger.info(ml`
1552
1447
  No personal access tokens found.
1553
1448
  Please create a token using 'tailor-sdk user pat create' command.
1554
1449
  `);
@@ -1556,14 +1451,14 @@ const listCommand$3 = defineCommand({
1556
1451
  }
1557
1452
  if (args.json) {
1558
1453
  const patInfos = pats.map(transformPersonalAccessToken);
1559
- console.log(JSON.stringify(patInfos));
1454
+ printData(patInfos, args.json);
1560
1455
  return;
1561
1456
  }
1562
1457
  const maxNameLength = Math.max(...pats.map((pat) => pat.name.length));
1563
1458
  pats.forEach((pat) => {
1564
1459
  const info = transformPersonalAccessToken(pat);
1565
1460
  const paddedName = info.name.padStart(maxNameLength);
1566
- console.log(`${paddedName}: ${info.scopes.join("/")}`);
1461
+ logger.log(`${paddedName}: ${info.scopes.join("/")}`);
1567
1462
  });
1568
1463
  })
1569
1464
  });
@@ -1586,8 +1481,8 @@ const updateCommand = defineCommand({
1586
1481
  write: {
1587
1482
  type: "boolean",
1588
1483
  description: "Grant write permission (if not specified, keeps read-only)",
1589
- default: false,
1590
- alias: "w"
1484
+ alias: "W",
1485
+ default: false
1591
1486
  }
1592
1487
  },
1593
1488
  run: withCommonArgs(async (args) => {
@@ -1650,7 +1545,7 @@ const useCommand = defineCommand({
1650
1545
  `);
1651
1546
  config.current_user = args.user;
1652
1547
  writePlatformConfig(config);
1653
- consola$1.success(`Current user set to "${args.user}" successfully.`);
1548
+ logger.success(`Current user set to "${args.user}" successfully.`);
1654
1549
  })
1655
1550
  });
1656
1551
 
@@ -1740,5 +1635,5 @@ const mainCommand = defineCommand({
1740
1635
  runMain(mainCommand);
1741
1636
 
1742
1637
  //#endregion
1743
- export { };
1638
+ export { mainCommand };
1744
1639
  //# sourceMappingURL=index.mjs.map