@zapier/zapier-sdk-cli 0.52.1 → 0.52.2

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,11 @@
1
1
  # @zapier/zapier-sdk-cli
2
2
 
3
+ ## 0.52.2
4
+
5
+ ### Patch Changes
6
+
7
+ - 4460a5a: Added `--skip-prompts` flag to the `login` command. When passed, the command skips all interactive prompts: it uses `email@hostname` as the credential name where possible, and errors instead of prompting when re-authentication or migration is required. Useful in CI environments, piped output, or any setup where TTY detection is unreliable.
8
+
3
9
  ## 0.52.1
4
10
 
5
11
  ### Patch Changes
package/README.md CHANGED
@@ -178,15 +178,16 @@ Log in to Zapier to access your account
178
178
 
179
179
  **Options:**
180
180
 
181
- | Option | Type | Required | Default | Possible Values | Description |
182
- | ----------------- | --------- | -------- | ------- | --------------- | -------------------------------------------------------------- |
183
- | `--timeout` | `string` | ❌ | — | — | Login timeout in seconds (default: 300) |
184
- | `--use-approvals` | `boolean` | ❌ | — | — | Require approvals for actions performed with these credentials |
181
+ | Option | Type | Required | Default | Possible Values | Description |
182
+ | ----------------- | --------- | -------- | ------- | --------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
183
+ | `--timeout` | `string` | ❌ | — | — | Login timeout in seconds (default: 300) |
184
+ | `--use-approvals` | `boolean` | ❌ | — | — | Require approvals for actions performed with these credentials |
185
+ | `--skip-prompts` | `boolean` | ❌ | — | — | Skip interactive prompts. Uses defaults where possible; errors instead of prompting when input is required. Useful in CI, piped output, or environments where TTY detection is unreliable. |
185
186
 
186
187
  **Usage:**
187
188
 
188
189
  ```bash
189
- npx zapier-sdk login [--timeout] [--use-approvals]
190
+ npx zapier-sdk login [--timeout] [--use-approvals] [--skip-prompts]
190
191
  ```
191
192
 
192
193
  #### `logout`
package/dist/cli.cjs CHANGED
@@ -1572,7 +1572,7 @@ var SHARED_COMMAND_CLI_OPTIONS = [
1572
1572
 
1573
1573
  // package.json
1574
1574
  var package_default = {
1575
- version: "0.52.1"};
1575
+ version: "0.52.2"};
1576
1576
 
1577
1577
  // src/telemetry/builders.ts
1578
1578
  function createCliBaseEvent(context = {}) {
@@ -3884,6 +3884,9 @@ var LoginSchema = zod.z.object({
3884
3884
  timeout: zod.z.string().optional().describe("Login timeout in seconds (default: 300)"),
3885
3885
  useApprovals: zod.z.boolean().optional().describe(
3886
3886
  "Require approvals for actions performed with these credentials"
3887
+ ),
3888
+ skipPrompts: zod.z.boolean().optional().describe(
3889
+ "Skip interactive prompts. Uses defaults where possible; errors instead of prompting when input is required. Useful in CI, piped output, or environments where TTY detection is unreliable."
3887
3890
  )
3888
3891
  }).describe("Log in to Zapier to access your account");
3889
3892
 
@@ -3899,8 +3902,8 @@ function toPkceCredentials(credentials2) {
3899
3902
  }
3900
3903
  return void 0;
3901
3904
  }
3902
- async function confirmRevokeAndRelogin(activeCredentials) {
3903
- if (!process.stdin.isTTY || !process.stdout.isTTY) {
3905
+ async function confirmRevokeAndRelogin(activeCredentials, skipPrompts) {
3906
+ if (skipPrompts) {
3904
3907
  throw new ZapierCliValidationError(
3905
3908
  `Already logged in as "${activeCredentials.name}". Run \`logout\` first or use an interactive terminal to re-authenticate.`
3906
3909
  );
@@ -3921,8 +3924,8 @@ Log out and log in again?`,
3921
3924
  }
3922
3925
  return true;
3923
3926
  }
3924
- async function confirmJwtMigration() {
3925
- if (!process.stdin.isTTY || !process.stdout.isTTY) {
3927
+ async function confirmJwtMigration(skipPrompts) {
3928
+ if (skipPrompts) {
3926
3929
  throw new ZapierCliValidationError(
3927
3930
  "Legacy JWT login detected. Run `logout` first or use an interactive terminal to migrate to client credentials."
3928
3931
  );
@@ -3941,8 +3944,8 @@ async function confirmJwtMigration() {
3941
3944
  }
3942
3945
  return true;
3943
3946
  }
3944
- async function confirmLocalLoginReset() {
3945
- if (!process.stdin.isTTY || !process.stdout.isTTY) {
3947
+ async function confirmLocalLoginReset(skipPrompts) {
3948
+ if (skipPrompts) {
3946
3949
  throw new ZapierCliValidationError(
3947
3950
  "Login cleanup failed and cannot be reset without confirmation. Re-run with an interactive terminal."
3948
3951
  );
@@ -3968,9 +3971,9 @@ function parseTimeoutSeconds(timeout) {
3968
3971
  }
3969
3972
  return timeoutSeconds;
3970
3973
  }
3971
- async function promptCredentialsName(email, baseUrl2) {
3974
+ async function promptCredentialsName(email, skipPrompts, baseUrl2) {
3972
3975
  const fallback = `${email}@${os.hostname()}`;
3973
- if (!process.stdin.isTTY || !process.stdout.isTTY) {
3976
+ if (skipPrompts) {
3974
3977
  if (credentialsNameExists({ name: fallback, baseUrl: baseUrl2 })) {
3975
3978
  throw new ZapierCliValidationError(
3976
3979
  `Credentials named "${fallback}" already exist. Run \`logout\` first or use an interactive terminal to choose a different name.`
@@ -4032,6 +4035,7 @@ var loginPlugin = zapierSdk.definePlugin(
4032
4035
  supportsJsonOutput: false,
4033
4036
  handler: async ({ sdk: sdk2, options }) => {
4034
4037
  const timeoutSeconds = parseTimeoutSeconds(options.timeout);
4038
+ const skipPrompts = options.skipPrompts === true || !process.stdin.isTTY || !process.stdout.isTTY;
4035
4039
  const resolvedCredentials = await sdk2.context.resolveCredentials();
4036
4040
  const pkceCredentials = toPkceCredentials(resolvedCredentials);
4037
4041
  const credentialsBaseUrl2 = await resolveCredentialsBaseUrl({
@@ -4042,21 +4046,22 @@ var loginPlugin = zapierSdk.definePlugin(
4042
4046
  baseUrl: credentialsBaseUrl2
4043
4047
  });
4044
4048
  if (activeCredentials) {
4045
- if (!await confirmRevokeAndRelogin(activeCredentials)) return;
4049
+ if (!await confirmRevokeAndRelogin(activeCredentials, skipPrompts))
4050
+ return;
4046
4051
  try {
4047
4052
  await revokeCredentials({
4048
4053
  api: sdk2.context.api,
4049
4054
  credentials: activeCredentials
4050
4055
  });
4051
4056
  } catch {
4052
- if (!await confirmLocalLoginReset()) return;
4057
+ if (!await confirmLocalLoginReset(skipPrompts)) return;
4053
4058
  await deleteStoredClientCredentials({
4054
4059
  name: activeCredentials.name,
4055
4060
  baseUrl: activeCredentials.baseUrl
4056
4061
  });
4057
4062
  }
4058
4063
  } else if (hasLegacyJwtConfig()) {
4059
- if (!await confirmJwtMigration()) return;
4064
+ if (!await confirmJwtMigration(skipPrompts)) return;
4060
4065
  }
4061
4066
  const { accessToken } = await runOauthFlow({
4062
4067
  timeoutMs: timeoutSeconds * 1e3,
@@ -4074,6 +4079,7 @@ var loginPlugin = zapierSdk.definePlugin(
4074
4079
  );
4075
4080
  const credentialName = await promptCredentialsName(
4076
4081
  profile.email,
4082
+ skipPrompts,
4077
4083
  credentialsBaseUrl2
4078
4084
  );
4079
4085
  const useApprovals = options.useApprovals === true;
@@ -6650,7 +6656,7 @@ var watchTriggerInboxCliPlugin = zapierSdk.definePlugin(
6650
6656
  // package.json with { type: 'json' }
6651
6657
  var package_default2 = {
6652
6658
  name: "@zapier/zapier-sdk-cli",
6653
- version: "0.52.1"};
6659
+ version: "0.52.2"};
6654
6660
 
6655
6661
  // src/sdk.ts
6656
6662
  zapierSdk.injectCliLogin(login_exports);
package/dist/cli.mjs CHANGED
@@ -1530,7 +1530,7 @@ var SHARED_COMMAND_CLI_OPTIONS = [
1530
1530
 
1531
1531
  // package.json
1532
1532
  var package_default = {
1533
- version: "0.52.1"};
1533
+ version: "0.52.2"};
1534
1534
 
1535
1535
  // src/telemetry/builders.ts
1536
1536
  function createCliBaseEvent(context = {}) {
@@ -3842,6 +3842,9 @@ var LoginSchema = z.object({
3842
3842
  timeout: z.string().optional().describe("Login timeout in seconds (default: 300)"),
3843
3843
  useApprovals: z.boolean().optional().describe(
3844
3844
  "Require approvals for actions performed with these credentials"
3845
+ ),
3846
+ skipPrompts: z.boolean().optional().describe(
3847
+ "Skip interactive prompts. Uses defaults where possible; errors instead of prompting when input is required. Useful in CI, piped output, or environments where TTY detection is unreliable."
3845
3848
  )
3846
3849
  }).describe("Log in to Zapier to access your account");
3847
3850
 
@@ -3857,8 +3860,8 @@ function toPkceCredentials(credentials2) {
3857
3860
  }
3858
3861
  return void 0;
3859
3862
  }
3860
- async function confirmRevokeAndRelogin(activeCredentials) {
3861
- if (!process.stdin.isTTY || !process.stdout.isTTY) {
3863
+ async function confirmRevokeAndRelogin(activeCredentials, skipPrompts) {
3864
+ if (skipPrompts) {
3862
3865
  throw new ZapierCliValidationError(
3863
3866
  `Already logged in as "${activeCredentials.name}". Run \`logout\` first or use an interactive terminal to re-authenticate.`
3864
3867
  );
@@ -3879,8 +3882,8 @@ Log out and log in again?`,
3879
3882
  }
3880
3883
  return true;
3881
3884
  }
3882
- async function confirmJwtMigration() {
3883
- if (!process.stdin.isTTY || !process.stdout.isTTY) {
3885
+ async function confirmJwtMigration(skipPrompts) {
3886
+ if (skipPrompts) {
3884
3887
  throw new ZapierCliValidationError(
3885
3888
  "Legacy JWT login detected. Run `logout` first or use an interactive terminal to migrate to client credentials."
3886
3889
  );
@@ -3899,8 +3902,8 @@ async function confirmJwtMigration() {
3899
3902
  }
3900
3903
  return true;
3901
3904
  }
3902
- async function confirmLocalLoginReset() {
3903
- if (!process.stdin.isTTY || !process.stdout.isTTY) {
3905
+ async function confirmLocalLoginReset(skipPrompts) {
3906
+ if (skipPrompts) {
3904
3907
  throw new ZapierCliValidationError(
3905
3908
  "Login cleanup failed and cannot be reset without confirmation. Re-run with an interactive terminal."
3906
3909
  );
@@ -3926,9 +3929,9 @@ function parseTimeoutSeconds(timeout) {
3926
3929
  }
3927
3930
  return timeoutSeconds;
3928
3931
  }
3929
- async function promptCredentialsName(email, baseUrl2) {
3932
+ async function promptCredentialsName(email, skipPrompts, baseUrl2) {
3930
3933
  const fallback = `${email}@${hostname()}`;
3931
- if (!process.stdin.isTTY || !process.stdout.isTTY) {
3934
+ if (skipPrompts) {
3932
3935
  if (credentialsNameExists({ name: fallback, baseUrl: baseUrl2 })) {
3933
3936
  throw new ZapierCliValidationError(
3934
3937
  `Credentials named "${fallback}" already exist. Run \`logout\` first or use an interactive terminal to choose a different name.`
@@ -3990,6 +3993,7 @@ var loginPlugin = definePlugin(
3990
3993
  supportsJsonOutput: false,
3991
3994
  handler: async ({ sdk: sdk2, options }) => {
3992
3995
  const timeoutSeconds = parseTimeoutSeconds(options.timeout);
3996
+ const skipPrompts = options.skipPrompts === true || !process.stdin.isTTY || !process.stdout.isTTY;
3993
3997
  const resolvedCredentials = await sdk2.context.resolveCredentials();
3994
3998
  const pkceCredentials = toPkceCredentials(resolvedCredentials);
3995
3999
  const credentialsBaseUrl2 = await resolveCredentialsBaseUrl({
@@ -4000,21 +4004,22 @@ var loginPlugin = definePlugin(
4000
4004
  baseUrl: credentialsBaseUrl2
4001
4005
  });
4002
4006
  if (activeCredentials) {
4003
- if (!await confirmRevokeAndRelogin(activeCredentials)) return;
4007
+ if (!await confirmRevokeAndRelogin(activeCredentials, skipPrompts))
4008
+ return;
4004
4009
  try {
4005
4010
  await revokeCredentials({
4006
4011
  api: sdk2.context.api,
4007
4012
  credentials: activeCredentials
4008
4013
  });
4009
4014
  } catch {
4010
- if (!await confirmLocalLoginReset()) return;
4015
+ if (!await confirmLocalLoginReset(skipPrompts)) return;
4011
4016
  await deleteStoredClientCredentials({
4012
4017
  name: activeCredentials.name,
4013
4018
  baseUrl: activeCredentials.baseUrl
4014
4019
  });
4015
4020
  }
4016
4021
  } else if (hasLegacyJwtConfig()) {
4017
- if (!await confirmJwtMigration()) return;
4022
+ if (!await confirmJwtMigration(skipPrompts)) return;
4018
4023
  }
4019
4024
  const { accessToken } = await runOauthFlow({
4020
4025
  timeoutMs: timeoutSeconds * 1e3,
@@ -4032,6 +4037,7 @@ var loginPlugin = definePlugin(
4032
4037
  );
4033
4038
  const credentialName = await promptCredentialsName(
4034
4039
  profile.email,
4040
+ skipPrompts,
4035
4041
  credentialsBaseUrl2
4036
4042
  );
4037
4043
  const useApprovals = options.useApprovals === true;
@@ -6608,7 +6614,7 @@ var watchTriggerInboxCliPlugin = definePlugin(
6608
6614
  // package.json with { type: 'json' }
6609
6615
  var package_default2 = {
6610
6616
  name: "@zapier/zapier-sdk-cli",
6611
- version: "0.52.1"};
6617
+ version: "0.52.2"};
6612
6618
 
6613
6619
  // src/sdk.ts
6614
6620
  injectCliLogin(login_exports);
@@ -1261,6 +1261,9 @@ var LoginSchema = zod.z.object({
1261
1261
  timeout: zod.z.string().optional().describe("Login timeout in seconds (default: 300)"),
1262
1262
  useApprovals: zod.z.boolean().optional().describe(
1263
1263
  "Require approvals for actions performed with these credentials"
1264
+ ),
1265
+ skipPrompts: zod.z.boolean().optional().describe(
1266
+ "Skip interactive prompts. Uses defaults where possible; errors instead of prompting when input is required. Useful in CI, piped output, or environments where TTY detection is unreliable."
1264
1267
  )
1265
1268
  }).describe("Log in to Zapier to access your account");
1266
1269
 
@@ -1276,8 +1279,8 @@ function toPkceCredentials(credentials) {
1276
1279
  }
1277
1280
  return void 0;
1278
1281
  }
1279
- async function confirmRevokeAndRelogin(activeCredentials) {
1280
- if (!process.stdin.isTTY || !process.stdout.isTTY) {
1282
+ async function confirmRevokeAndRelogin(activeCredentials, skipPrompts) {
1283
+ if (skipPrompts) {
1281
1284
  throw new ZapierCliValidationError(
1282
1285
  `Already logged in as "${activeCredentials.name}". Run \`logout\` first or use an interactive terminal to re-authenticate.`
1283
1286
  );
@@ -1298,8 +1301,8 @@ Log out and log in again?`,
1298
1301
  }
1299
1302
  return true;
1300
1303
  }
1301
- async function confirmJwtMigration() {
1302
- if (!process.stdin.isTTY || !process.stdout.isTTY) {
1304
+ async function confirmJwtMigration(skipPrompts) {
1305
+ if (skipPrompts) {
1303
1306
  throw new ZapierCliValidationError(
1304
1307
  "Legacy JWT login detected. Run `logout` first or use an interactive terminal to migrate to client credentials."
1305
1308
  );
@@ -1318,8 +1321,8 @@ async function confirmJwtMigration() {
1318
1321
  }
1319
1322
  return true;
1320
1323
  }
1321
- async function confirmLocalLoginReset() {
1322
- if (!process.stdin.isTTY || !process.stdout.isTTY) {
1324
+ async function confirmLocalLoginReset(skipPrompts) {
1325
+ if (skipPrompts) {
1323
1326
  throw new ZapierCliValidationError(
1324
1327
  "Login cleanup failed and cannot be reset without confirmation. Re-run with an interactive terminal."
1325
1328
  );
@@ -1345,9 +1348,9 @@ function parseTimeoutSeconds(timeout) {
1345
1348
  }
1346
1349
  return timeoutSeconds;
1347
1350
  }
1348
- async function promptCredentialsName(email, baseUrl) {
1351
+ async function promptCredentialsName(email, skipPrompts, baseUrl) {
1349
1352
  const fallback = `${email}@${os.hostname()}`;
1350
- if (!process.stdin.isTTY || !process.stdout.isTTY) {
1353
+ if (skipPrompts) {
1351
1354
  if (credentialsNameExists({ name: fallback, baseUrl })) {
1352
1355
  throw new ZapierCliValidationError(
1353
1356
  `Credentials named "${fallback}" already exist. Run \`logout\` first or use an interactive terminal to choose a different name.`
@@ -1409,6 +1412,7 @@ var loginPlugin = zapierSdk.definePlugin(
1409
1412
  supportsJsonOutput: false,
1410
1413
  handler: async ({ sdk: sdk2, options }) => {
1411
1414
  const timeoutSeconds = parseTimeoutSeconds(options.timeout);
1415
+ const skipPrompts = options.skipPrompts === true || !process.stdin.isTTY || !process.stdout.isTTY;
1412
1416
  const resolvedCredentials = await sdk2.context.resolveCredentials();
1413
1417
  const pkceCredentials = toPkceCredentials(resolvedCredentials);
1414
1418
  const credentialsBaseUrl = await resolveCredentialsBaseUrl({
@@ -1419,21 +1423,22 @@ var loginPlugin = zapierSdk.definePlugin(
1419
1423
  baseUrl: credentialsBaseUrl
1420
1424
  });
1421
1425
  if (activeCredentials) {
1422
- if (!await confirmRevokeAndRelogin(activeCredentials)) return;
1426
+ if (!await confirmRevokeAndRelogin(activeCredentials, skipPrompts))
1427
+ return;
1423
1428
  try {
1424
1429
  await revokeCredentials({
1425
1430
  api: sdk2.context.api,
1426
1431
  credentials: activeCredentials
1427
1432
  });
1428
1433
  } catch {
1429
- if (!await confirmLocalLoginReset()) return;
1434
+ if (!await confirmLocalLoginReset(skipPrompts)) return;
1430
1435
  await deleteStoredClientCredentials({
1431
1436
  name: activeCredentials.name,
1432
1437
  baseUrl: activeCredentials.baseUrl
1433
1438
  });
1434
1439
  }
1435
1440
  } else if (hasLegacyJwtConfig()) {
1436
- if (!await confirmJwtMigration()) return;
1441
+ if (!await confirmJwtMigration(skipPrompts)) return;
1437
1442
  }
1438
1443
  const { accessToken } = await runOauthFlow({
1439
1444
  timeoutMs: timeoutSeconds * 1e3,
@@ -1451,6 +1456,7 @@ var loginPlugin = zapierSdk.definePlugin(
1451
1456
  );
1452
1457
  const credentialName = await promptCredentialsName(
1453
1458
  profile.email,
1459
+ skipPrompts,
1454
1460
  credentialsBaseUrl
1455
1461
  );
1456
1462
  const useApprovals = options.useApprovals === true;
@@ -4010,7 +4016,7 @@ var watchTriggerInboxCliPlugin = zapierSdk.definePlugin(
4010
4016
  // package.json with { type: 'json' }
4011
4017
  var package_default = {
4012
4018
  name: "@zapier/zapier-sdk-cli",
4013
- version: "0.52.1"};
4019
+ version: "0.52.2"};
4014
4020
 
4015
4021
  // src/experimental.ts
4016
4022
  experimental.injectCliLogin(login_exports);
@@ -1225,6 +1225,9 @@ var LoginSchema = z.object({
1225
1225
  timeout: z.string().optional().describe("Login timeout in seconds (default: 300)"),
1226
1226
  useApprovals: z.boolean().optional().describe(
1227
1227
  "Require approvals for actions performed with these credentials"
1228
+ ),
1229
+ skipPrompts: z.boolean().optional().describe(
1230
+ "Skip interactive prompts. Uses defaults where possible; errors instead of prompting when input is required. Useful in CI, piped output, or environments where TTY detection is unreliable."
1228
1231
  )
1229
1232
  }).describe("Log in to Zapier to access your account");
1230
1233
 
@@ -1240,8 +1243,8 @@ function toPkceCredentials(credentials) {
1240
1243
  }
1241
1244
  return void 0;
1242
1245
  }
1243
- async function confirmRevokeAndRelogin(activeCredentials) {
1244
- if (!process.stdin.isTTY || !process.stdout.isTTY) {
1246
+ async function confirmRevokeAndRelogin(activeCredentials, skipPrompts) {
1247
+ if (skipPrompts) {
1245
1248
  throw new ZapierCliValidationError(
1246
1249
  `Already logged in as "${activeCredentials.name}". Run \`logout\` first or use an interactive terminal to re-authenticate.`
1247
1250
  );
@@ -1262,8 +1265,8 @@ Log out and log in again?`,
1262
1265
  }
1263
1266
  return true;
1264
1267
  }
1265
- async function confirmJwtMigration() {
1266
- if (!process.stdin.isTTY || !process.stdout.isTTY) {
1268
+ async function confirmJwtMigration(skipPrompts) {
1269
+ if (skipPrompts) {
1267
1270
  throw new ZapierCliValidationError(
1268
1271
  "Legacy JWT login detected. Run `logout` first or use an interactive terminal to migrate to client credentials."
1269
1272
  );
@@ -1282,8 +1285,8 @@ async function confirmJwtMigration() {
1282
1285
  }
1283
1286
  return true;
1284
1287
  }
1285
- async function confirmLocalLoginReset() {
1286
- if (!process.stdin.isTTY || !process.stdout.isTTY) {
1288
+ async function confirmLocalLoginReset(skipPrompts) {
1289
+ if (skipPrompts) {
1287
1290
  throw new ZapierCliValidationError(
1288
1291
  "Login cleanup failed and cannot be reset without confirmation. Re-run with an interactive terminal."
1289
1292
  );
@@ -1309,9 +1312,9 @@ function parseTimeoutSeconds(timeout) {
1309
1312
  }
1310
1313
  return timeoutSeconds;
1311
1314
  }
1312
- async function promptCredentialsName(email, baseUrl) {
1315
+ async function promptCredentialsName(email, skipPrompts, baseUrl) {
1313
1316
  const fallback = `${email}@${hostname()}`;
1314
- if (!process.stdin.isTTY || !process.stdout.isTTY) {
1317
+ if (skipPrompts) {
1315
1318
  if (credentialsNameExists({ name: fallback, baseUrl })) {
1316
1319
  throw new ZapierCliValidationError(
1317
1320
  `Credentials named "${fallback}" already exist. Run \`logout\` first or use an interactive terminal to choose a different name.`
@@ -1373,6 +1376,7 @@ var loginPlugin = definePlugin(
1373
1376
  supportsJsonOutput: false,
1374
1377
  handler: async ({ sdk: sdk2, options }) => {
1375
1378
  const timeoutSeconds = parseTimeoutSeconds(options.timeout);
1379
+ const skipPrompts = options.skipPrompts === true || !process.stdin.isTTY || !process.stdout.isTTY;
1376
1380
  const resolvedCredentials = await sdk2.context.resolveCredentials();
1377
1381
  const pkceCredentials = toPkceCredentials(resolvedCredentials);
1378
1382
  const credentialsBaseUrl = await resolveCredentialsBaseUrl({
@@ -1383,21 +1387,22 @@ var loginPlugin = definePlugin(
1383
1387
  baseUrl: credentialsBaseUrl
1384
1388
  });
1385
1389
  if (activeCredentials) {
1386
- if (!await confirmRevokeAndRelogin(activeCredentials)) return;
1390
+ if (!await confirmRevokeAndRelogin(activeCredentials, skipPrompts))
1391
+ return;
1387
1392
  try {
1388
1393
  await revokeCredentials({
1389
1394
  api: sdk2.context.api,
1390
1395
  credentials: activeCredentials
1391
1396
  });
1392
1397
  } catch {
1393
- if (!await confirmLocalLoginReset()) return;
1398
+ if (!await confirmLocalLoginReset(skipPrompts)) return;
1394
1399
  await deleteStoredClientCredentials({
1395
1400
  name: activeCredentials.name,
1396
1401
  baseUrl: activeCredentials.baseUrl
1397
1402
  });
1398
1403
  }
1399
1404
  } else if (hasLegacyJwtConfig()) {
1400
- if (!await confirmJwtMigration()) return;
1405
+ if (!await confirmJwtMigration(skipPrompts)) return;
1401
1406
  }
1402
1407
  const { accessToken } = await runOauthFlow({
1403
1408
  timeoutMs: timeoutSeconds * 1e3,
@@ -1415,6 +1420,7 @@ var loginPlugin = definePlugin(
1415
1420
  );
1416
1421
  const credentialName = await promptCredentialsName(
1417
1422
  profile.email,
1423
+ skipPrompts,
1418
1424
  credentialsBaseUrl
1419
1425
  );
1420
1426
  const useApprovals = options.useApprovals === true;
@@ -3974,7 +3980,7 @@ var watchTriggerInboxCliPlugin = definePlugin(
3974
3980
  // package.json with { type: 'json' }
3975
3981
  var package_default = {
3976
3982
  name: "@zapier/zapier-sdk-cli",
3977
- version: "0.52.1"};
3983
+ version: "0.52.2"};
3978
3984
 
3979
3985
  // src/experimental.ts
3980
3986
  injectCliLogin(login_exports);
package/dist/index.cjs CHANGED
@@ -1260,6 +1260,9 @@ var LoginSchema = zod.z.object({
1260
1260
  timeout: zod.z.string().optional().describe("Login timeout in seconds (default: 300)"),
1261
1261
  useApprovals: zod.z.boolean().optional().describe(
1262
1262
  "Require approvals for actions performed with these credentials"
1263
+ ),
1264
+ skipPrompts: zod.z.boolean().optional().describe(
1265
+ "Skip interactive prompts. Uses defaults where possible; errors instead of prompting when input is required. Useful in CI, piped output, or environments where TTY detection is unreliable."
1263
1266
  )
1264
1267
  }).describe("Log in to Zapier to access your account");
1265
1268
 
@@ -1275,8 +1278,8 @@ function toPkceCredentials(credentials) {
1275
1278
  }
1276
1279
  return void 0;
1277
1280
  }
1278
- async function confirmRevokeAndRelogin(activeCredentials) {
1279
- if (!process.stdin.isTTY || !process.stdout.isTTY) {
1281
+ async function confirmRevokeAndRelogin(activeCredentials, skipPrompts) {
1282
+ if (skipPrompts) {
1280
1283
  throw new ZapierCliValidationError(
1281
1284
  `Already logged in as "${activeCredentials.name}". Run \`logout\` first or use an interactive terminal to re-authenticate.`
1282
1285
  );
@@ -1297,8 +1300,8 @@ Log out and log in again?`,
1297
1300
  }
1298
1301
  return true;
1299
1302
  }
1300
- async function confirmJwtMigration() {
1301
- if (!process.stdin.isTTY || !process.stdout.isTTY) {
1303
+ async function confirmJwtMigration(skipPrompts) {
1304
+ if (skipPrompts) {
1302
1305
  throw new ZapierCliValidationError(
1303
1306
  "Legacy JWT login detected. Run `logout` first or use an interactive terminal to migrate to client credentials."
1304
1307
  );
@@ -1317,8 +1320,8 @@ async function confirmJwtMigration() {
1317
1320
  }
1318
1321
  return true;
1319
1322
  }
1320
- async function confirmLocalLoginReset() {
1321
- if (!process.stdin.isTTY || !process.stdout.isTTY) {
1323
+ async function confirmLocalLoginReset(skipPrompts) {
1324
+ if (skipPrompts) {
1322
1325
  throw new ZapierCliValidationError(
1323
1326
  "Login cleanup failed and cannot be reset without confirmation. Re-run with an interactive terminal."
1324
1327
  );
@@ -1344,9 +1347,9 @@ function parseTimeoutSeconds(timeout) {
1344
1347
  }
1345
1348
  return timeoutSeconds;
1346
1349
  }
1347
- async function promptCredentialsName(email, baseUrl) {
1350
+ async function promptCredentialsName(email, skipPrompts, baseUrl) {
1348
1351
  const fallback = `${email}@${os.hostname()}`;
1349
- if (!process.stdin.isTTY || !process.stdout.isTTY) {
1352
+ if (skipPrompts) {
1350
1353
  if (credentialsNameExists({ name: fallback, baseUrl })) {
1351
1354
  throw new ZapierCliValidationError(
1352
1355
  `Credentials named "${fallback}" already exist. Run \`logout\` first or use an interactive terminal to choose a different name.`
@@ -1408,6 +1411,7 @@ var loginPlugin = zapierSdk.definePlugin(
1408
1411
  supportsJsonOutput: false,
1409
1412
  handler: async ({ sdk: sdk2, options }) => {
1410
1413
  const timeoutSeconds = parseTimeoutSeconds(options.timeout);
1414
+ const skipPrompts = options.skipPrompts === true || !process.stdin.isTTY || !process.stdout.isTTY;
1411
1415
  const resolvedCredentials = await sdk2.context.resolveCredentials();
1412
1416
  const pkceCredentials = toPkceCredentials(resolvedCredentials);
1413
1417
  const credentialsBaseUrl = await resolveCredentialsBaseUrl({
@@ -1418,21 +1422,22 @@ var loginPlugin = zapierSdk.definePlugin(
1418
1422
  baseUrl: credentialsBaseUrl
1419
1423
  });
1420
1424
  if (activeCredentials) {
1421
- if (!await confirmRevokeAndRelogin(activeCredentials)) return;
1425
+ if (!await confirmRevokeAndRelogin(activeCredentials, skipPrompts))
1426
+ return;
1422
1427
  try {
1423
1428
  await revokeCredentials({
1424
1429
  api: sdk2.context.api,
1425
1430
  credentials: activeCredentials
1426
1431
  });
1427
1432
  } catch {
1428
- if (!await confirmLocalLoginReset()) return;
1433
+ if (!await confirmLocalLoginReset(skipPrompts)) return;
1429
1434
  await deleteStoredClientCredentials({
1430
1435
  name: activeCredentials.name,
1431
1436
  baseUrl: activeCredentials.baseUrl
1432
1437
  });
1433
1438
  }
1434
1439
  } else if (hasLegacyJwtConfig()) {
1435
- if (!await confirmJwtMigration()) return;
1440
+ if (!await confirmJwtMigration(skipPrompts)) return;
1436
1441
  }
1437
1442
  const { accessToken } = await runOauthFlow({
1438
1443
  timeoutMs: timeoutSeconds * 1e3,
@@ -1450,6 +1455,7 @@ var loginPlugin = zapierSdk.definePlugin(
1450
1455
  );
1451
1456
  const credentialName = await promptCredentialsName(
1452
1457
  profile.email,
1458
+ skipPrompts,
1453
1459
  credentialsBaseUrl
1454
1460
  );
1455
1461
  const useApprovals = options.useApprovals === true;
@@ -4009,7 +4015,7 @@ zapierSdk.definePlugin(
4009
4015
  // package.json with { type: 'json' }
4010
4016
  var package_default = {
4011
4017
  name: "@zapier/zapier-sdk-cli",
4012
- version: "0.52.1"};
4018
+ version: "0.52.2"};
4013
4019
 
4014
4020
  // src/sdk.ts
4015
4021
  zapierSdk.injectCliLogin(login_exports);
@@ -4037,7 +4043,7 @@ function createZapierCliSdk(options = {}) {
4037
4043
 
4038
4044
  // package.json
4039
4045
  var package_default2 = {
4040
- version: "0.52.1"};
4046
+ version: "0.52.2"};
4041
4047
 
4042
4048
  // src/telemetry/builders.ts
4043
4049
  function createCliBaseEvent(context = {}) {