@tailor-platform/sdk 1.55.0 → 1.55.1

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/CHANGELOG.md CHANGED
@@ -1,5 +1,23 @@
1
1
  # @tailor-platform/sdk
2
2
 
3
+ ## 1.55.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [#1333](https://github.com/tailor-platform/sdk/pull/1333) [`46a0f78`](https://github.com/tailor-platform/sdk/commit/46a0f78481f4718a470a2cb5a15298db8015f452) Thanks [@toiroakr](https://github.com/toiroakr)! - Fix `tailor-sdk api` injecting a duplicate `workspaceId` when `--body` supplies the field in snake_case. The auto-injection guard only checked the camelCase key, so a body such as `{"workspace_id": "..."}` slipped past it and the SDK appended a second `workspaceId`, which the server rejected with a duplicate-field error. Body keys are now converged to each field's canonical (camelCase) name before injection, so snake_case and JSON aliases are recognized.
8
+
9
+ - [#1325](https://github.com/tailor-platform/sdk/pull/1325) [`8bd51e6`](https://github.com/tailor-platform/sdk/commit/8bd51e64143a2877dcdc821a57b8b6b82cf61363) Thanks [@dqn](https://github.com/dqn)! - Fix `--json` output for CLI commands that returned human-readable text or empty stdout instead of parseable JSON.
10
+
11
+ - [#1276](https://github.com/tailor-platform/sdk/pull/1276) [`f1536d6`](https://github.com/tailor-platform/sdk/commit/f1536d64d182c9456692165397a74ad8c0257d30) Thanks [@renovate](https://github.com/apps/renovate)! - fix(deps): update oxc
12
+
13
+ - [#1312](https://github.com/tailor-platform/sdk/pull/1312) [`00c9b07`](https://github.com/tailor-platform/sdk/commit/00c9b07fdec9b6fa59026f6d4451d43f04114c55) Thanks [@renovate](https://github.com/apps/renovate)! - fix(deps): update @inquirer to v8.5.2
14
+
15
+ - [#1316](https://github.com/tailor-platform/sdk/pull/1316) [`b7f0389`](https://github.com/tailor-platform/sdk/commit/b7f0389270573ba5cf6accca31acdea027974c8d) Thanks [@renovate](https://github.com/apps/renovate)! - fix(deps): update dependency tsx to v4.22.4
16
+
17
+ - [#1318](https://github.com/tailor-platform/sdk/pull/1318) [`c48aeb6`](https://github.com/tailor-platform/sdk/commit/c48aeb6e72a644b056a48e57d39799cae386461e) Thanks [@renovate](https://github.com/apps/renovate)! - fix(deps): update dependency type-fest to v5.7.0
18
+
19
+ - [#1328](https://github.com/tailor-platform/sdk/pull/1328) [`8473a4d`](https://github.com/tailor-platform/sdk/commit/8473a4d284cea998759584c151e12c6cb9b7bc67) Thanks [@renovate](https://github.com/apps/renovate)! - fix(deps): update dependency graphql to v16.14.1
20
+
3
21
  ## 1.55.0
4
22
 
5
23
  ### Minor Changes
@@ -2,7 +2,7 @@
2
2
 
3
3
  import { G as PATScope, R as AuthInvokerSchema, c as fetchUserInfo, d as initOperatorClient, h as userAgent, i as fetchAll, j as FunctionExecution_Type, n as closeConnectionPool, o as fetchPaged, s as fetchPlatformMachineUserToken, u as initOAuth2Client } from "../client-DLPEPJ_s.mjs";
4
4
  import { n as logger, r as styles } from "../logger-DpJyJvNz.mjs";
5
- import { $ as listCommand$10, An as workspaceArgs, At as startCommand, B as logBetaWarning, C as listCommand$13, Cn as configArg, Dn as pagedLogArgs, Dt as jobsCommand, E as resumeCommand, En as isVerbose, F as writeDbTypesFile, Gt as parseMigrationLabelNumber, H as removeCommand$1, Ht as executeScript, I as getConfiguredEditorCommand, K as treeCommand, L as openInConfiguredEditor, Lt as functionExecutionStatusToString, Mt as getCommand$6, N as generateCommand$1, O as listCommand$12, On as paginationArgs, P as generateMigrationScript, Pt as executionsCommand, Rt as formatKeyValueTable, Sn as commonArgs, St as triggerCommand, T as healthCommand, Tn as deploymentArgs, U as updateCommand$3, Vt as deploy, Y as getCommand$5, Yt as INITIAL_SCHEMA_NUMBER, Z as updateCommand$2, _n as prompt, at as createCommand$3, b as createCommand$4, bn as assertWritable, c as listCommand$14, cn as reconstructSnapshotFromMigrations, f as restoreCommand, ft as tokenCommand, g as getCommand$7, gt as listCommand$7, hn as trnPrefix, ht as generate, i as updateCommand$4, in as getMigrationFiles, j as truncateCommand, kn as toPageDirection, ln as formatMigrationNumber, lt as getCommand$3, m as listCommand$15, mn as sdkNameLabelKey, o as removeCommand, on as isValidMigrationNumber, pn as getNamespacesWithMigrations, pt as listCommand$8, q as listCommand$11, r as queryCommand, rn as getMigrationFilePath, rt as deleteCommand$3, sn as loadDiff, st as listCommand$9, t as isNativeTypeScriptRuntime, tt as getCommand$4, u as inviteCommand, v as deleteCommand$4, vn as apiCommand, vt as getCommand$2, wn as confirmationArgs, wt as listCommand$6, xn as defineAppCommand, xt as webhookCommand, z as showCommand, zt as getCommand$1 } from "../runtime-BZsl7Mh9.mjs";
5
+ import { $ as listCommand$10, An as workspaceArgs, At as startCommand, B as logBetaWarning, C as listCommand$13, Cn as configArg, Dn as pagedLogArgs, Dt as jobsCommand, E as resumeCommand, En as isVerbose, F as writeDbTypesFile, Gt as parseMigrationLabelNumber, H as removeCommand$1, Ht as executeScript, I as getConfiguredEditorCommand, K as treeCommand, L as openInConfiguredEditor, Lt as functionExecutionStatusToString, Mt as getCommand$6, N as generateCommand$1, O as listCommand$12, On as paginationArgs, P as generateMigrationScript, Pt as executionsCommand, Rt as formatKeyValueTable, Sn as commonArgs, St as triggerCommand, T as healthCommand, Tn as deploymentArgs, U as updateCommand$3, Vt as deploy, Y as getCommand$5, Yt as INITIAL_SCHEMA_NUMBER, Z as updateCommand$2, _n as prompt, at as createCommand$3, b as createCommand$4, bn as assertWritable, c as listCommand$14, cn as reconstructSnapshotFromMigrations, f as restoreCommand, ft as tokenCommand, g as getCommand$7, gt as listCommand$7, hn as trnPrefix, ht as generate, i as updateCommand$4, in as getMigrationFiles, j as truncateCommand, kn as toPageDirection, ln as formatMigrationNumber, lt as getCommand$3, m as listCommand$15, mn as sdkNameLabelKey, o as removeCommand, on as isValidMigrationNumber, pn as getNamespacesWithMigrations, pt as listCommand$8, q as listCommand$11, r as queryCommand, rn as getMigrationFilePath, rt as deleteCommand$3, sn as loadDiff, st as listCommand$9, t as isNativeTypeScriptRuntime, tt as getCommand$4, u as inviteCommand, v as deleteCommand$4, vn as apiCommand, vt as getCommand$2, wn as confirmationArgs, wt as listCommand$6, xn as defineAppCommand, xt as webhookCommand, z as showCommand, zt as getCommand$1 } from "../runtime-CgGeIoxi.mjs";
6
6
  import { C as loadAccessToken, D as resolveTokens, E as readPlatformConfig, O as saveUserTokens, S as fetchLatestToken, T as loadWorkspaceId, a as WorkflowJobSchema, b as loadConfig, i as resolveInlineSourcemap, k as writePlatformConfig, l as ExecutorSchema, o as ResolverSchema, u as INVOKER_EXPR, v as getDistDir, x as deleteUserTokens } from "../application-DzUlASfA.mjs";
7
7
  import { t as multiline } from "../multiline-Cf9ODpr1.mjs";
8
8
  import { t as readPackageJson } from "../package-json-DcQApfPQ.mjs";
@@ -273,14 +273,22 @@ function orderAndLimitCrashReports(entries, options) {
273
273
  const ordered = options.order === "asc" ? sorted : sorted.reverse();
274
274
  return options.limit && options.limit > 0 ? ordered.slice(0, options.limit) : ordered;
275
275
  }
276
+ function formatCrashReportFiles(files, localDir) {
277
+ return files.map((file) => ({
278
+ file,
279
+ path: path.join(localDir, file)
280
+ }));
281
+ }
276
282
  const listCommand$5 = defineAppCommand({
277
283
  name: "list",
278
284
  description: "List local crash report files.",
279
285
  args: z.object({ ...paginationArgs() }).strict(),
280
286
  run: async (args) => {
281
287
  const config = parseCrashReportConfig();
288
+ const jsonOutput = logger.jsonMode;
282
289
  if (!config.localDir) {
283
290
  logger.info("Crash report directory not available.");
291
+ if (jsonOutput) logger.out([]);
284
292
  return;
285
293
  }
286
294
  let entries;
@@ -288,6 +296,7 @@ const listCommand$5 = defineAppCommand({
288
296
  entries = fs$1.readdirSync(config.localDir);
289
297
  } catch {
290
298
  logger.info("No crash reports found.");
299
+ if (jsonOutput) logger.out([]);
291
300
  return;
292
301
  }
293
302
  const files = orderAndLimitCrashReports(entries, {
@@ -296,6 +305,11 @@ const listCommand$5 = defineAppCommand({
296
305
  });
297
306
  if (files.length === 0) {
298
307
  logger.info("No crash reports found.");
308
+ if (jsonOutput) logger.out([]);
309
+ return;
310
+ }
311
+ if (jsonOutput) {
312
+ logger.out(formatCrashReportFiles(files, config.localDir));
299
313
  return;
300
314
  }
301
315
  logger.info(`${files.length} crash report(s) in ${config.localDir}:`);
@@ -1337,6 +1351,7 @@ When a \`.js\` file is provided, detection and bundling are skipped and the file
1337
1351
  }
1338
1352
  ],
1339
1353
  run: async (args) => {
1354
+ const jsonOutput = logger.jsonMode;
1340
1355
  const filePath = path.resolve(args.file);
1341
1356
  if (!fs$1.existsSync(filePath)) throw new Error(`File not found: ${filePath}`);
1342
1357
  const { config } = await loadConfig(args.config);
@@ -1406,7 +1421,7 @@ When a \`.js\` file is provided, detection and bundling are skipped and the file
1406
1421
  arg: args.arg,
1407
1422
  invoker: authInvoker
1408
1423
  });
1409
- if (args.json) logger.out({
1424
+ if (jsonOutput) logger.out({
1410
1425
  success: result.success,
1411
1426
  scriptName,
1412
1427
  functionType,
@@ -1808,15 +1823,28 @@ const openCommand = defineAppCommand({
1808
1823
  const applicationName = config.name;
1809
1824
  const consolePath = `/workspaces/${workspaceId}/applications/${encodeURIComponent(applicationName)}/overview`;
1810
1825
  const consoleUrl = new URL(consolePath, consoleBaseUrl).toString();
1826
+ const jsonOutput = logger.jsonMode;
1811
1827
  logger.info("Opening Tailor Platform Console...");
1828
+ let opened = true;
1812
1829
  try {
1813
1830
  await open(consoleUrl);
1831
+ } catch {
1832
+ opened = false;
1833
+ }
1834
+ if (jsonOutput) {
1835
+ logger.out({
1836
+ consoleUrl,
1837
+ workspaceId,
1838
+ applicationName,
1839
+ opened
1840
+ });
1841
+ return;
1842
+ }
1843
+ if (opened) {
1814
1844
  logger.out(`Console URL: ${consoleUrl}`);
1815
1845
  logger.out(`Workspace ID: ${workspaceId}`);
1816
1846
  logger.out(`Application Name: ${applicationName}`);
1817
- } catch {
1818
- logger.warn(`Failed to open browser automatically. Please open this URL manually:\n${consoleUrl}`);
1819
- }
1847
+ } else logger.warn(`Failed to open browser automatically. Please open this URL manually:\n${consoleUrl}`);
1820
1848
  }
1821
1849
  });
1822
1850
 
@@ -1925,12 +1953,14 @@ const listCommand$4 = defineAppCommand({
1925
1953
  args: z.object({}).strict(),
1926
1954
  run: async () => {
1927
1955
  const config = await readPlatformConfig();
1956
+ const jsonOutput = logger.jsonMode;
1928
1957
  const profiles = Object.entries(config.profiles);
1929
1958
  if (profiles.length === 0) {
1930
1959
  logger.info(multiline`
1931
1960
  No profiles found.
1932
1961
  Please create a profile first using 'tailor-sdk profile create' command.
1933
1962
  `);
1963
+ if (jsonOutput) logger.out([]);
1934
1964
  return;
1935
1965
  }
1936
1966
  const profileInfos = profiles.map(([name, profile]) => ({
@@ -2477,7 +2507,7 @@ const secretCommand = defineCommand({
2477
2507
 
2478
2508
  //#endregion
2479
2509
  //#region src/cli/commands/setup/github/deploy.workflow.yml
2480
- var deploy_workflow_default = "name: Tailor Platform\n\non:\n pull_request:\n branches:\n - main\n push:\n branches:\n - main\n workflow_dispatch:\n\nconcurrency:\n group: tailor-__WORKSPACE_NAME__-${{ github.head_ref || github.ref }}\n cancel-in-progress: ${{ github.event_name == 'pull_request' }}\n\njobs:\n # __PLAN_JOB_START__\n plan:\n if: github.event_name == 'pull_request'\n runs-on: ubuntu-latest\n permissions:\n contents: read\n pull-requests: write\n steps:\n - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2\n with:\n fetch-depth: 0\n # __SETUP_STEPS__\n - uses: tailor-platform/actions/plan@e63ed98630a23fa21ee0636abf0f7fb75fcdce40 # v1.1.0\n with:\n workspace-id: ${{ vars.TAILOR_PLATFORM_WORKSPACE_ID }}\n # __WORKING_DIRECTORY__\n platform-client-id: ${{ secrets.PLATFORM_MACHINE_USER_CLIENT_ID }}\n platform-client-secret: ${{ secrets.PLATFORM_MACHINE_USER_CLIENT_SECRET }}\n github-token: ${{ secrets.GITHUB_TOKEN }}\n # __PLAN_JOB_END__\n deploy:\n if: github.event_name != 'pull_request'\n runs-on: ubuntu-latest\n permissions:\n contents: read\n steps:\n - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2\n # __SETUP_STEPS__\n - uses: tailor-platform/actions/deploy@e63ed98630a23fa21ee0636abf0f7fb75fcdce40 # v1.1.0\n with:\n workspace-name: __WORKSPACE_NAME__\n workspace-region: __WORKSPACE_REGION__\n organization-id: __ORGANIZATION_ID__\n folder-id: __FOLDER_ID__\n # __WORKING_DIRECTORY__\n platform-client-id: ${{ secrets.PLATFORM_MACHINE_USER_CLIENT_ID }}\n platform-client-secret: ${{ secrets.PLATFORM_MACHINE_USER_CLIENT_SECRET }}\n";
2510
+ var deploy_workflow_default = "name: Tailor Platform\n\non:\n pull_request:\n branches:\n - main\n push:\n branches:\n - main\n workflow_dispatch:\n\nconcurrency:\n group: tailor-__WORKSPACE_NAME__-${{ github.head_ref || github.ref }}\n cancel-in-progress: ${{ github.event_name == 'pull_request' }}\n\njobs:\n # __PLAN_JOB_START__\n plan:\n if: github.event_name == 'pull_request'\n runs-on: ubuntu-latest\n permissions:\n contents: read\n pull-requests: write\n steps:\n - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3\n with:\n fetch-depth: 0\n # __SETUP_STEPS__\n - uses: tailor-platform/actions/plan@e63ed98630a23fa21ee0636abf0f7fb75fcdce40 # v1.1.0\n with:\n workspace-id: ${{ vars.TAILOR_PLATFORM_WORKSPACE_ID }}\n # __WORKING_DIRECTORY__\n platform-client-id: ${{ secrets.PLATFORM_MACHINE_USER_CLIENT_ID }}\n platform-client-secret: ${{ secrets.PLATFORM_MACHINE_USER_CLIENT_SECRET }}\n github-token: ${{ secrets.GITHUB_TOKEN }}\n # __PLAN_JOB_END__\n deploy:\n if: github.event_name != 'pull_request'\n runs-on: ubuntu-latest\n permissions:\n contents: read\n steps:\n - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3\n # __SETUP_STEPS__\n - uses: tailor-platform/actions/deploy@e63ed98630a23fa21ee0636abf0f7fb75fcdce40 # v1.1.0\n with:\n workspace-name: __WORKSPACE_NAME__\n workspace-region: __WORKSPACE_REGION__\n organization-id: __ORGANIZATION_ID__\n folder-id: __FOLDER_ID__\n # __WORKING_DIRECTORY__\n platform-client-id: ${{ secrets.PLATFORM_MACHINE_USER_CLIENT_ID }}\n platform-client-secret: ${{ secrets.PLATFORM_MACHINE_USER_CLIENT_SECRET }}\n";
2481
2511
 
2482
2512
  //#endregion
2483
2513
  //#region src/cli/commands/setup/github/setup-bun.yml
@@ -3038,13 +3068,14 @@ const listCommand$2 = defineAppCommand({
3038
3068
  ...paginationArgs()
3039
3069
  }).strict(),
3040
3070
  run: async (args) => {
3071
+ const jsonOutput = logger.jsonMode;
3041
3072
  const websites = await listStaticWebsites({
3042
3073
  workspaceId: args["workspace-id"],
3043
3074
  profile: args.profile,
3044
3075
  order: args.order,
3045
3076
  limit: args.limit
3046
3077
  });
3047
- const formatted = args.json ? websites : websites.map(({ allowedIpAddresses, ...rest }) => {
3078
+ const formatted = jsonOutput ? websites : websites.map(({ allowedIpAddresses, ...rest }) => {
3048
3079
  if (allowedIpAddresses.length === 0) return {
3049
3080
  ...rest,
3050
3081
  allowedIpAddresses: "No allowed IP addresses"
@@ -3761,12 +3792,7 @@ const setCommand = defineAppCommand({
3761
3792
 
3762
3793
  //#endregion
3763
3794
  //#region src/cli/commands/tailordb/migrate/status.ts
3764
- /**
3765
- * Show migration status for TailorDB namespaces
3766
- * @param {StatusOptions} options - Command options
3767
- */
3768
- async function status(options) {
3769
- logBetaWarning("tailordb migration");
3795
+ async function collectMigrationStatuses(options) {
3770
3796
  const { config } = await loadConfig(options.configPath);
3771
3797
  const namespacesWithMigrations = getNamespacesWithMigrations(config, path.dirname(config.path));
3772
3798
  if (namespacesWithMigrations.length === 0) throw new Error("No TailorDB services with migrations configuration found");
@@ -3780,6 +3806,7 @@ async function status(options) {
3780
3806
  workspaceId: options.workspaceId,
3781
3807
  profile: options.profile
3782
3808
  });
3809
+ const statuses = [];
3783
3810
  for (const { namespace, migrationsDir } of targetNamespaces) {
3784
3811
  const trn = `${trnPrefix(workspaceId)}:tailordb:${namespace}`;
3785
3812
  let currentMigration;
@@ -3790,25 +3817,53 @@ async function status(options) {
3790
3817
  } catch {
3791
3818
  currentMigration = 0;
3792
3819
  }
3793
- const pendingNumbers = getMigrationFiles(migrationsDir).map((f) => f.number).filter((n, i, arr) => arr.indexOf(n) === i).sort((a, b) => a - b).filter((n) => n > currentMigration);
3820
+ const pendingMigrations = getMigrationFiles(migrationsDir).map((f) => f.number).filter((n, i, arr) => arr.indexOf(n) === i).sort((a, b) => a - b).filter((n) => n > currentMigration).map((num) => {
3821
+ const diffPath = getMigrationFilePath(migrationsDir, num, "diff");
3822
+ let description;
3823
+ if (fs$1.existsSync(diffPath)) try {
3824
+ description = loadDiff(diffPath).description;
3825
+ } catch {}
3826
+ return {
3827
+ number: num,
3828
+ label: formatMigrationNumber(num),
3829
+ ...description ? { description } : {}
3830
+ };
3831
+ });
3832
+ statuses.push({
3833
+ namespace,
3834
+ currentMigration,
3835
+ currentMigrationLabel: formatMigrationNumber(currentMigration),
3836
+ pendingMigrations
3837
+ });
3838
+ }
3839
+ return statuses;
3840
+ }
3841
+ function printMigrationStatuses(statuses) {
3842
+ for (const statusInfo of statuses) {
3794
3843
  logger.newline();
3795
- logger.info(`Namespace: ${styles.bold(namespace)}`);
3796
- logger.log(` Current migration: ${styles.bold(formatMigrationNumber(currentMigration))}`);
3797
- if (pendingNumbers.length > 0) {
3844
+ logger.info(`Namespace: ${styles.bold(statusInfo.namespace)}`);
3845
+ logger.log(` Current migration: ${styles.bold(statusInfo.currentMigrationLabel)}`);
3846
+ if (statusInfo.pendingMigrations.length > 0) {
3798
3847
  logger.log(" Pending migrations:");
3799
- for (const num of pendingNumbers) {
3800
- const diffPath = getMigrationFilePath(migrationsDir, num, "diff");
3801
- let description;
3802
- if (fs$1.existsSync(diffPath)) try {
3803
- description = loadDiff(diffPath).description;
3804
- } catch {}
3805
- if (description) logger.log(` - ${formatMigrationNumber(num)}: ${description}`);
3806
- else logger.log(` - ${formatMigrationNumber(num)}`);
3807
- }
3848
+ for (const pending of statusInfo.pendingMigrations) if (pending.description) logger.log(` - ${pending.label}: ${pending.description}`);
3849
+ else logger.log(` - ${pending.label}`);
3808
3850
  } else logger.log(" Pending migrations: (none)");
3809
3851
  }
3810
3852
  logger.newline();
3811
3853
  }
3854
+ /**
3855
+ * Show migration status for TailorDB namespaces
3856
+ * @param {StatusOptions} options - Command options
3857
+ */
3858
+ async function status(options) {
3859
+ logBetaWarning("tailordb migration");
3860
+ const statuses = await collectMigrationStatuses(options);
3861
+ if (options.json) {
3862
+ logger.out(statuses);
3863
+ return;
3864
+ }
3865
+ printMigrationStatuses(statuses);
3866
+ }
3812
3867
  const statusCommand = defineAppCommand({
3813
3868
  name: "status",
3814
3869
  description: "Show the current migration status for TailorDB namespaces, including applied and pending migrations.",
@@ -3824,7 +3879,8 @@ const statusCommand = defineAppCommand({
3824
3879
  configPath: args.config,
3825
3880
  namespace: args.namespace,
3826
3881
  workspaceId: args["workspace-id"],
3827
- profile: args.profile
3882
+ profile: args.profile,
3883
+ json: logger.jsonMode
3828
3884
  });
3829
3885
  }
3830
3886
  });
@@ -3899,6 +3955,7 @@ const currentCommand = defineAppCommand({
3899
3955
  args: z.object({}).strict(),
3900
3956
  run: async () => {
3901
3957
  const config = await readPlatformConfig();
3958
+ const jsonOutput = logger.jsonMode;
3902
3959
  if (!config.current_user) throw new Error(multiline`
3903
3960
  Current user not set.
3904
3961
  Please login first using 'tailor-sdk login' command to register a user.
@@ -3907,7 +3964,11 @@ const currentCommand = defineAppCommand({
3907
3964
  Current user '${config.current_user}' not found in registered users.
3908
3965
  Please login again using 'tailor-sdk login' command to register the user.
3909
3966
  `);
3910
- logger.log(config.current_user);
3967
+ if (jsonOutput) {
3968
+ logger.out({ user: config.current_user });
3969
+ return;
3970
+ }
3971
+ logger.out(config.current_user);
3911
3972
  }
3912
3973
  });
3913
3974
 
@@ -3917,17 +3978,19 @@ const listCommand$1 = defineAppCommand({
3917
3978
  name: "list",
3918
3979
  description: "List all users.",
3919
3980
  args: z.object({}).strict(),
3920
- run: async (args) => {
3981
+ run: async () => {
3921
3982
  const config = await readPlatformConfig();
3983
+ const jsonOutput = logger.jsonMode;
3922
3984
  const users = Object.keys(config.users);
3923
3985
  if (users.length === 0) {
3924
3986
  logger.info(multiline`
3925
3987
  No users found.
3926
3988
  Please login first using 'tailor-sdk login' command to register a user.
3927
3989
  `);
3990
+ if (jsonOutput) logger.out([]);
3928
3991
  return;
3929
3992
  }
3930
- if (args.json) {
3993
+ if (jsonOutput) {
3931
3994
  logger.out(users);
3932
3995
  return;
3933
3996
  }
@@ -4055,6 +4118,7 @@ const listCommand = defineAppCommand({
4055
4118
  description: "List all personal access tokens.",
4056
4119
  args: z.object({ ...paginationArgs() }).strict(),
4057
4120
  run: async (args) => {
4121
+ const jsonOutput = logger.jsonMode;
4058
4122
  const config = await readPlatformConfig();
4059
4123
  if (!config.current_user) throw new Error(multiline`
4060
4124
  No user logged in.
@@ -4070,19 +4134,18 @@ const listCommand = defineAppCommand({
4070
4134
  });
4071
4135
  return [personalAccessTokens, nextPageToken];
4072
4136
  }, { limit: args.limit });
4073
- if (pats.length === 0 && !args.json) {
4137
+ if (pats.length === 0) {
4074
4138
  logger.info(multiline`
4075
4139
  No personal access tokens found.
4076
4140
  Please create a token using 'tailor-sdk user pat create' command.
4077
4141
  `);
4078
- return;
4142
+ if (!jsonOutput) return;
4079
4143
  }
4080
4144
  const patInfos = pats.map(transformPersonalAccessToken);
4081
- if (args.json) {
4145
+ if (jsonOutput) {
4082
4146
  logger.out(patInfos);
4083
4147
  return;
4084
4148
  }
4085
- if (pats.length === 0) return;
4086
4149
  const maxNameLength = Math.max(...pats.map((pat) => pat.name.length));
4087
4150
  pats.forEach((pat) => {
4088
4151
  const info = transformPersonalAccessToken(pat);