@zapier/zapier-sdk-cli 0.31.2 → 0.32.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @zapier/zapier-sdk-cli
2
2
 
3
+ ## 0.32.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 4a874c6: Add Zod schema for base SDK options, autodoc generation for SDK factory options and CLI base command options
8
+
9
+ ### Patch Changes
10
+
11
+ - Updated dependencies [4a874c6]
12
+ - @zapier/zapier-sdk@0.31.0
13
+ - @zapier/zapier-sdk-mcp@0.9.6
14
+
3
15
  ## 0.31.2
4
16
 
5
17
  ### Patch Changes
package/README.md CHANGED
@@ -83,20 +83,20 @@ npx zapier-sdk fetch "https://gmail.googleapis.com/gmail/v1/users/me/labels" --c
83
83
 
84
84
  These options are available for all commands:
85
85
 
86
- | Option | Short | Description |
87
- | -------------------------------------- | ----- | -------------------------------------------------- |
88
- | `--version` | `-V` | Display version number |
89
- | `--help` | `-h` | Display help for command |
90
- | `--debug` | | Enable debug logging |
91
- | `--json` | | Output raw JSON instead of formatted results |
92
- | `--base-url <url>` | | Base URL for Zapier API endpoints |
93
- | `--credentials <token>` | | Authentication token |
94
- | `--credentials-client-id <id>` | | OAuth client ID for authentication |
95
- | `--credentials-client-secret <secret>` | | OAuth client secret for authentication |
96
- | `--credentials-base-url <url>` | | Base URL for authentication endpoints |
97
- | `--tracking-base-url <url>` | | Base URL for Zapier tracking endpoints |
98
- | `--max-network-retries <count>` | | Max retries for rate-limited requests (default: 3) |
99
- | `--max-network-retry-delay-ms <ms>` | | Max delay in ms to wait for retry (default: 60000) |
86
+ | Option | Short | Description |
87
+ | -------------------------------------- | ----- | --------------------------------------------------- |
88
+ | `--version` | `-V` | Display version number |
89
+ | `--help` | `-h` | Display help for command |
90
+ | `--credentials <token>` | | Authentication token. |
91
+ | `--credentials-client-id <id>` | | OAuth client ID for authentication. |
92
+ | `--credentials-client-secret <secret>` | | OAuth client secret for authentication. |
93
+ | `--credentials-base-url <url>` | | Override authentication base URL. |
94
+ | `--debug` | | Enable debug logging. |
95
+ | `--base-url <url>` | | Base URL for Zapier API endpoints. |
96
+ | `--tracking-base-url <url>` | | Base URL for Zapier tracking endpoints. |
97
+ | `--max-network-retries <count>` | | Max retries for rate-limited requests (default: 3). |
98
+ | `--max-network-retry-delay-ms <ms>` | | Max delay in ms to wait for retry (default: 60000). |
99
+ | `--json` | | Output raw JSON instead of formatted results |
100
100
 
101
101
  ## Available Commands
102
102
 
package/dist/cli.cjs CHANGED
@@ -876,6 +876,36 @@ function formatItemsGeneric(items, startingNumber = 0) {
876
876
  formatSingleItem(formatted, startingNumber + index);
877
877
  });
878
878
  }
879
+
880
+ // src/utils/cli-options.ts
881
+ var RESERVED_CLI_OPTIONS = [
882
+ {
883
+ name: "version" /* Version */,
884
+ flag: "--version",
885
+ short: "-V",
886
+ description: "Display version number"
887
+ },
888
+ {
889
+ name: "help" /* Help */,
890
+ flag: "--help",
891
+ short: "-h",
892
+ description: "Display help for command"
893
+ }
894
+ ];
895
+ function getReservedCliOption(name) {
896
+ const option = RESERVED_CLI_OPTIONS.find((opt) => opt.name === name);
897
+ if (!option) throw new Error(`Reserved CLI option not found: ${name}`);
898
+ return option;
899
+ }
900
+ var SHARED_COMMAND_CLI_OPTIONS = [
901
+ {
902
+ name: "json",
903
+ flag: "--json",
904
+ description: "Output raw JSON instead of formatted results"
905
+ }
906
+ ];
907
+
908
+ // src/utils/cli-generator.ts
879
909
  var CONFIRM_MESSAGES = {
880
910
  "create-secret": {
881
911
  messageBefore: "You are about to create a sensitive secret that will be displayed as plain text.\nOnce created, you cannot retrieve it again.",
@@ -1343,10 +1373,12 @@ function addCommand(program2, commandName, config2) {
1343
1373
  }
1344
1374
  }
1345
1375
  });
1346
- const hasJsonParam = config2.parameters.some((p) => p.name === "json");
1347
- if (!hasJsonParam) {
1348
- command.option("--json", "Output raw JSON instead of formatted results");
1349
- }
1376
+ const paramNames = new Set(config2.parameters.map((p) => p.name));
1377
+ SHARED_COMMAND_CLI_OPTIONS.forEach((opt) => {
1378
+ if (!paramNames.has(opt.name)) {
1379
+ command.option(opt.flag, opt.description);
1380
+ }
1381
+ });
1350
1382
  command.action(config2.handler);
1351
1383
  }
1352
1384
  function convertCliArgsToSdkParams(parameters, positionalArgs, options) {
@@ -1804,7 +1836,7 @@ var LoginSchema = zod.z.object({
1804
1836
 
1805
1837
  // package.json
1806
1838
  var package_default = {
1807
- version: "0.31.2"};
1839
+ version: "0.32.0"};
1808
1840
 
1809
1841
  // src/telemetry/builders.ts
1810
1842
  function createCliBaseEvent(context = {}) {
@@ -3583,7 +3615,7 @@ function createZapierCliSdk(options = {}) {
3583
3615
  // package.json with { type: 'json' }
3584
3616
  var package_default2 = {
3585
3617
  name: "@zapier/zapier-sdk-cli",
3586
- version: "0.31.2"};
3618
+ version: "0.32.0"};
3587
3619
  function detectPackageManager(cwd = process.cwd()) {
3588
3620
  const ua = process.env.npm_config_user_agent;
3589
3621
  if (ua) {
@@ -3786,7 +3818,13 @@ async function checkAndNotifyUpdates({
3786
3818
 
3787
3819
  // src/cli.ts
3788
3820
  var program = new commander.Command();
3789
- program.name("zapier-sdk").description("CLI for Zapier SDK").version(package_default2.version, void 0, "Display version number").option("--debug", "Enable debug logging").option("--base-url <url>", "Base URL for Zapier API endpoints").option("--credentials <token>", "Authentication token").option("--credentials-client-id <id>", "OAuth client ID for authentication").option(
3821
+ var versionOption = getReservedCliOption("version" /* Version */);
3822
+ var helpOption = getReservedCliOption("help" /* Help */);
3823
+ program.name("zapier-sdk").description("CLI for Zapier SDK").version(
3824
+ package_default2.version,
3825
+ `${versionOption.short}, ${versionOption.flag}`,
3826
+ versionOption.description
3827
+ ).option("--debug", "Enable debug logging").option("--base-url <url>", "Base URL for Zapier API endpoints").option("--credentials <token>", "Authentication token").option("--credentials-client-id <id>", "OAuth client ID for authentication").option(
3790
3828
  "--credentials-client-secret <secret>",
3791
3829
  "OAuth client secret for authentication"
3792
3830
  ).option(
@@ -3798,7 +3836,10 @@ program.name("zapier-sdk").description("CLI for Zapier SDK").version(package_def
3798
3836
  ).option(
3799
3837
  "--max-network-retry-delay-ms <ms>",
3800
3838
  "Max delay in ms to wait for rate limit retry (default: 60000)"
3801
- ).helpOption("-h, --help", "Display help for command");
3839
+ ).helpOption(
3840
+ `${helpOption.short}, ${helpOption.flag}`,
3841
+ helpOption.description
3842
+ );
3802
3843
  var isDebugMode = process.env.DEBUG === "true" || process.argv.includes("--debug");
3803
3844
  function getFlagValue(flagName) {
3804
3845
  const index = process.argv.indexOf(flagName);
package/dist/cli.mjs CHANGED
@@ -840,6 +840,36 @@ function formatItemsGeneric(items, startingNumber = 0) {
840
840
  formatSingleItem(formatted, startingNumber + index);
841
841
  });
842
842
  }
843
+
844
+ // src/utils/cli-options.ts
845
+ var RESERVED_CLI_OPTIONS = [
846
+ {
847
+ name: "version" /* Version */,
848
+ flag: "--version",
849
+ short: "-V",
850
+ description: "Display version number"
851
+ },
852
+ {
853
+ name: "help" /* Help */,
854
+ flag: "--help",
855
+ short: "-h",
856
+ description: "Display help for command"
857
+ }
858
+ ];
859
+ function getReservedCliOption(name) {
860
+ const option = RESERVED_CLI_OPTIONS.find((opt) => opt.name === name);
861
+ if (!option) throw new Error(`Reserved CLI option not found: ${name}`);
862
+ return option;
863
+ }
864
+ var SHARED_COMMAND_CLI_OPTIONS = [
865
+ {
866
+ name: "json",
867
+ flag: "--json",
868
+ description: "Output raw JSON instead of formatted results"
869
+ }
870
+ ];
871
+
872
+ // src/utils/cli-generator.ts
843
873
  var CONFIRM_MESSAGES = {
844
874
  "create-secret": {
845
875
  messageBefore: "You are about to create a sensitive secret that will be displayed as plain text.\nOnce created, you cannot retrieve it again.",
@@ -1307,10 +1337,12 @@ function addCommand(program2, commandName, config2) {
1307
1337
  }
1308
1338
  }
1309
1339
  });
1310
- const hasJsonParam = config2.parameters.some((p) => p.name === "json");
1311
- if (!hasJsonParam) {
1312
- command.option("--json", "Output raw JSON instead of formatted results");
1313
- }
1340
+ const paramNames = new Set(config2.parameters.map((p) => p.name));
1341
+ SHARED_COMMAND_CLI_OPTIONS.forEach((opt) => {
1342
+ if (!paramNames.has(opt.name)) {
1343
+ command.option(opt.flag, opt.description);
1344
+ }
1345
+ });
1314
1346
  command.action(config2.handler);
1315
1347
  }
1316
1348
  function convertCliArgsToSdkParams(parameters, positionalArgs, options) {
@@ -1768,7 +1800,7 @@ var LoginSchema = z.object({
1768
1800
 
1769
1801
  // package.json
1770
1802
  var package_default = {
1771
- version: "0.31.2"};
1803
+ version: "0.32.0"};
1772
1804
 
1773
1805
  // src/telemetry/builders.ts
1774
1806
  function createCliBaseEvent(context = {}) {
@@ -3547,7 +3579,7 @@ function createZapierCliSdk(options = {}) {
3547
3579
  // package.json with { type: 'json' }
3548
3580
  var package_default2 = {
3549
3581
  name: "@zapier/zapier-sdk-cli",
3550
- version: "0.31.2"};
3582
+ version: "0.32.0"};
3551
3583
  function detectPackageManager(cwd = process.cwd()) {
3552
3584
  const ua = process.env.npm_config_user_agent;
3553
3585
  if (ua) {
@@ -3750,7 +3782,13 @@ async function checkAndNotifyUpdates({
3750
3782
 
3751
3783
  // src/cli.ts
3752
3784
  var program = new Command();
3753
- program.name("zapier-sdk").description("CLI for Zapier SDK").version(package_default2.version, void 0, "Display version number").option("--debug", "Enable debug logging").option("--base-url <url>", "Base URL for Zapier API endpoints").option("--credentials <token>", "Authentication token").option("--credentials-client-id <id>", "OAuth client ID for authentication").option(
3785
+ var versionOption = getReservedCliOption("version" /* Version */);
3786
+ var helpOption = getReservedCliOption("help" /* Help */);
3787
+ program.name("zapier-sdk").description("CLI for Zapier SDK").version(
3788
+ package_default2.version,
3789
+ `${versionOption.short}, ${versionOption.flag}`,
3790
+ versionOption.description
3791
+ ).option("--debug", "Enable debug logging").option("--base-url <url>", "Base URL for Zapier API endpoints").option("--credentials <token>", "Authentication token").option("--credentials-client-id <id>", "OAuth client ID for authentication").option(
3754
3792
  "--credentials-client-secret <secret>",
3755
3793
  "OAuth client secret for authentication"
3756
3794
  ).option(
@@ -3762,7 +3800,10 @@ program.name("zapier-sdk").description("CLI for Zapier SDK").version(package_def
3762
3800
  ).option(
3763
3801
  "--max-network-retry-delay-ms <ms>",
3764
3802
  "Max delay in ms to wait for rate limit retry (default: 60000)"
3765
- ).helpOption("-h, --help", "Display help for command");
3803
+ ).helpOption(
3804
+ `${helpOption.short}, ${helpOption.flag}`,
3805
+ helpOption.description
3806
+ );
3766
3807
  var isDebugMode = process.env.DEBUG === "true" || process.argv.includes("--debug");
3767
3808
  function getFlagValue(flagName) {
3768
3809
  const index = process.argv.indexOf(flagName);
package/dist/index.cjs CHANGED
@@ -302,7 +302,7 @@ var LoginSchema = zod.z.object({
302
302
 
303
303
  // package.json
304
304
  var package_default = {
305
- version: "0.31.2"};
305
+ version: "0.32.0"};
306
306
 
307
307
  // src/telemetry/builders.ts
308
308
  function createCliBaseEvent(context = {}) {
@@ -2078,5 +2078,42 @@ function createZapierCliSdk(options = {}) {
2078
2078
  }).addPlugin(generateAppTypesPlugin).addPlugin(buildManifestPlugin).addPlugin(bundleCodePlugin).addPlugin(getLoginConfigPathPlugin).addPlugin(addPlugin).addPlugin(feedbackPlugin).addPlugin(curlPlugin).addPlugin(mcpPlugin).addPlugin(loginPlugin).addPlugin(logoutPlugin).addPlugin(cliOverridesPlugin).addPlugin(zapierSdk.registryPlugin);
2079
2079
  }
2080
2080
 
2081
+ // src/utils/cli-options.ts
2082
+ var ReservedCliParameter = /* @__PURE__ */ ((ReservedCliParameter2) => {
2083
+ ReservedCliParameter2["Version"] = "version";
2084
+ ReservedCliParameter2["Help"] = "help";
2085
+ return ReservedCliParameter2;
2086
+ })(ReservedCliParameter || {});
2087
+ var RESERVED_CLI_OPTIONS = [
2088
+ {
2089
+ name: "version" /* Version */,
2090
+ flag: "--version",
2091
+ short: "-V",
2092
+ description: "Display version number"
2093
+ },
2094
+ {
2095
+ name: "help" /* Help */,
2096
+ flag: "--help",
2097
+ short: "-h",
2098
+ description: "Display help for command"
2099
+ }
2100
+ ];
2101
+ function getReservedCliOption(name) {
2102
+ const option = RESERVED_CLI_OPTIONS.find((opt) => opt.name === name);
2103
+ if (!option) throw new Error(`Reserved CLI option not found: ${name}`);
2104
+ return option;
2105
+ }
2106
+ var SHARED_COMMAND_CLI_OPTIONS = [
2107
+ {
2108
+ name: "json",
2109
+ flag: "--json",
2110
+ description: "Output raw JSON instead of formatted results"
2111
+ }
2112
+ ];
2113
+
2114
+ exports.RESERVED_CLI_OPTIONS = RESERVED_CLI_OPTIONS;
2115
+ exports.ReservedCliParameter = ReservedCliParameter;
2116
+ exports.SHARED_COMMAND_CLI_OPTIONS = SHARED_COMMAND_CLI_OPTIONS;
2081
2117
  exports.buildCliCommandExecutedEvent = buildCliCommandExecutedEvent;
2082
2118
  exports.createZapierCliSdk = createZapierCliSdk;
2119
+ exports.getReservedCliOption = getReservedCliOption;
package/dist/index.d.mts CHANGED
@@ -231,4 +231,20 @@ declare function buildCliCommandExecutedEvent({ data, context, cliVersion, }: {
231
231
  cliVersion?: string;
232
232
  }): CliCommandExecutedEvent;
233
233
 
234
- export { type CliCommandExecutedEvent, type CliCommandExecutedEventData, type CliEventContext, type ZapierCliSdkOptions, buildCliCommandExecutedEvent, createZapierCliSdk };
234
+ interface CliOption {
235
+ name: string;
236
+ flag: string;
237
+ short?: string;
238
+ description: string;
239
+ }
240
+ declare enum ReservedCliParameter {
241
+ Version = "version",
242
+ Help = "help"
243
+ }
244
+ /** CLI options at the framework level, not defined by any SDK command. */
245
+ declare const RESERVED_CLI_OPTIONS: readonly Readonly<CliOption>[];
246
+ declare function getReservedCliOption(name: ReservedCliParameter): Readonly<CliOption>;
247
+ /** CLI options automatically added to every SDK-generated command. */
248
+ declare const SHARED_COMMAND_CLI_OPTIONS: readonly Readonly<CliOption>[];
249
+
250
+ export { type CliCommandExecutedEvent, type CliCommandExecutedEventData, type CliEventContext, RESERVED_CLI_OPTIONS, ReservedCliParameter, SHARED_COMMAND_CLI_OPTIONS, type ZapierCliSdkOptions, buildCliCommandExecutedEvent, createZapierCliSdk, getReservedCliOption };
package/dist/index.d.ts CHANGED
@@ -231,4 +231,20 @@ declare function buildCliCommandExecutedEvent({ data, context, cliVersion, }: {
231
231
  cliVersion?: string;
232
232
  }): CliCommandExecutedEvent;
233
233
 
234
- export { type CliCommandExecutedEvent, type CliCommandExecutedEventData, type CliEventContext, type ZapierCliSdkOptions, buildCliCommandExecutedEvent, createZapierCliSdk };
234
+ interface CliOption {
235
+ name: string;
236
+ flag: string;
237
+ short?: string;
238
+ description: string;
239
+ }
240
+ declare enum ReservedCliParameter {
241
+ Version = "version",
242
+ Help = "help"
243
+ }
244
+ /** CLI options at the framework level, not defined by any SDK command. */
245
+ declare const RESERVED_CLI_OPTIONS: readonly Readonly<CliOption>[];
246
+ declare function getReservedCliOption(name: ReservedCliParameter): Readonly<CliOption>;
247
+ /** CLI options automatically added to every SDK-generated command. */
248
+ declare const SHARED_COMMAND_CLI_OPTIONS: readonly Readonly<CliOption>[];
249
+
250
+ export { type CliCommandExecutedEvent, type CliCommandExecutedEventData, type CliEventContext, RESERVED_CLI_OPTIONS, ReservedCliParameter, SHARED_COMMAND_CLI_OPTIONS, type ZapierCliSdkOptions, buildCliCommandExecutedEvent, createZapierCliSdk, getReservedCliOption };
package/dist/index.mjs CHANGED
@@ -272,7 +272,7 @@ var LoginSchema = z.object({
272
272
 
273
273
  // package.json
274
274
  var package_default = {
275
- version: "0.31.2"};
275
+ version: "0.32.0"};
276
276
 
277
277
  // src/telemetry/builders.ts
278
278
  function createCliBaseEvent(context = {}) {
@@ -2048,4 +2048,37 @@ function createZapierCliSdk(options = {}) {
2048
2048
  }).addPlugin(generateAppTypesPlugin).addPlugin(buildManifestPlugin).addPlugin(bundleCodePlugin).addPlugin(getLoginConfigPathPlugin).addPlugin(addPlugin).addPlugin(feedbackPlugin).addPlugin(curlPlugin).addPlugin(mcpPlugin).addPlugin(loginPlugin).addPlugin(logoutPlugin).addPlugin(cliOverridesPlugin).addPlugin(registryPlugin);
2049
2049
  }
2050
2050
 
2051
- export { buildCliCommandExecutedEvent, createZapierCliSdk };
2051
+ // src/utils/cli-options.ts
2052
+ var ReservedCliParameter = /* @__PURE__ */ ((ReservedCliParameter2) => {
2053
+ ReservedCliParameter2["Version"] = "version";
2054
+ ReservedCliParameter2["Help"] = "help";
2055
+ return ReservedCliParameter2;
2056
+ })(ReservedCliParameter || {});
2057
+ var RESERVED_CLI_OPTIONS = [
2058
+ {
2059
+ name: "version" /* Version */,
2060
+ flag: "--version",
2061
+ short: "-V",
2062
+ description: "Display version number"
2063
+ },
2064
+ {
2065
+ name: "help" /* Help */,
2066
+ flag: "--help",
2067
+ short: "-h",
2068
+ description: "Display help for command"
2069
+ }
2070
+ ];
2071
+ function getReservedCliOption(name) {
2072
+ const option = RESERVED_CLI_OPTIONS.find((opt) => opt.name === name);
2073
+ if (!option) throw new Error(`Reserved CLI option not found: ${name}`);
2074
+ return option;
2075
+ }
2076
+ var SHARED_COMMAND_CLI_OPTIONS = [
2077
+ {
2078
+ name: "json",
2079
+ flag: "--json",
2080
+ description: "Output raw JSON instead of formatted results"
2081
+ }
2082
+ ];
2083
+
2084
+ export { RESERVED_CLI_OPTIONS, ReservedCliParameter, SHARED_COMMAND_CLI_OPTIONS, buildCliCommandExecutedEvent, createZapierCliSdk, getReservedCliOption };
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zapier/zapier-sdk-cli",
3
- "version": "0.31.2",
3
+ "version": "0.32.0",
4
4
  "description": "Command line interface for Zapier SDK",
5
5
  "main": "dist/index.cjs",
6
6
  "module": "dist/index.mjs",
package/dist/src/cli.js CHANGED
@@ -5,11 +5,14 @@ import { createZapierCliSdk } from "./sdk";
5
5
  import packageJson from "../package.json" with { type: "json" };
6
6
  import { ZapierCliError } from "./utils/errors";
7
7
  import { checkAndNotifyUpdates } from "./utils/version-checker";
8
+ import { ReservedCliParameter, getReservedCliOption, } from "./utils/cli-options";
8
9
  const program = new Command();
10
+ const versionOption = getReservedCliOption(ReservedCliParameter.Version);
11
+ const helpOption = getReservedCliOption(ReservedCliParameter.Help);
9
12
  program
10
13
  .name("zapier-sdk")
11
14
  .description("CLI for Zapier SDK")
12
- .version(packageJson.version, undefined, "Display version number")
15
+ .version(packageJson.version, `${versionOption.short}, ${versionOption.flag}`, versionOption.description)
13
16
  .option("--debug", "Enable debug logging")
14
17
  .option("--base-url <url>", "Base URL for Zapier API endpoints")
15
18
  .option("--credentials <token>", "Authentication token")
@@ -19,7 +22,7 @@ program
19
22
  .option("--tracking-base-url <url>", "Base URL for Zapier tracking endpoints")
20
23
  .option("--max-network-retries <count>", "Max retries for rate-limited requests (default: 3)")
21
24
  .option("--max-network-retry-delay-ms <ms>", "Max delay in ms to wait for rate limit retry (default: 60000)")
22
- .helpOption("-h, --help", "Display help for command");
25
+ .helpOption(`${helpOption.short}, ${helpOption.flag}`, helpOption.description);
23
26
  // Check for debug flag early (support both flag and env var)
24
27
  const isDebugMode = process.env.DEBUG === "true" || process.argv.includes("--debug");
25
28
  // Helper to get flag value from argv
@@ -2,3 +2,4 @@ export { createZapierCliSdk, type ZapierCliSdkOptions } from "./sdk";
2
2
  export type { CliEventContext, CliCommandExecutedEventData, } from "./telemetry/builders";
3
3
  export { buildCliCommandExecutedEvent } from "./telemetry/builders";
4
4
  export type { CliCommandExecutedEvent } from "./telemetry/events";
5
+ export { RESERVED_CLI_OPTIONS, SHARED_COMMAND_CLI_OPTIONS, ReservedCliParameter, getReservedCliOption, } from "./utils/cli-options";
package/dist/src/index.js CHANGED
@@ -2,3 +2,4 @@
2
2
  export { createZapierCliSdk } from "./sdk";
3
3
  export { buildCliCommandExecutedEvent } from "./telemetry/builders";
4
4
  // All CLI functionality is now schema-driven via generateCLICommands
5
+ export { RESERVED_CLI_OPTIONS, SHARED_COMMAND_CLI_OPTIONS, ReservedCliParameter, getReservedCliOption, } from "./utils/cli-options";
@@ -5,6 +5,7 @@ import { formatItemsFromSchema, formatJsonOutput } from "./schema-formatter";
5
5
  import chalk from "chalk";
6
6
  import inquirer from "inquirer";
7
7
  import { ZapierCliError, ZapierCliExitError } from "./errors";
8
+ import { SHARED_COMMAND_CLI_OPTIONS } from "./cli-options";
8
9
  const CONFIRM_MESSAGES = {
9
10
  "create-secret": {
10
11
  messageBefore: "You are about to create a sensitive secret that will be displayed as plain text.\n" +
@@ -507,11 +508,13 @@ function addCommand(program, commandName, config) {
507
508
  }
508
509
  }
509
510
  });
510
- // Add formatting options for all commands (skip if schema already defines json)
511
- const hasJsonParam = config.parameters.some((p) => p.name === "json");
512
- if (!hasJsonParam) {
513
- command.option("--json", "Output raw JSON instead of formatted results");
514
- }
511
+ // Add shared command options (if not already included)
512
+ const paramNames = new Set(config.parameters.map((p) => p.name));
513
+ SHARED_COMMAND_CLI_OPTIONS.forEach((opt) => {
514
+ if (!paramNames.has(opt.name)) {
515
+ command.option(opt.flag, opt.description);
516
+ }
517
+ });
515
518
  command.action(config.handler);
516
519
  }
517
520
  // ============================================================================
@@ -0,0 +1,16 @@
1
+ interface CliOption {
2
+ name: string;
3
+ flag: string;
4
+ short?: string;
5
+ description: string;
6
+ }
7
+ export declare enum ReservedCliParameter {
8
+ Version = "version",
9
+ Help = "help"
10
+ }
11
+ /** CLI options at the framework level, not defined by any SDK command. */
12
+ export declare const RESERVED_CLI_OPTIONS: readonly Readonly<CliOption>[];
13
+ export declare function getReservedCliOption(name: ReservedCliParameter): Readonly<CliOption>;
14
+ /** CLI options automatically added to every SDK-generated command. */
15
+ export declare const SHARED_COMMAND_CLI_OPTIONS: readonly Readonly<CliOption>[];
16
+ export {};
@@ -0,0 +1,34 @@
1
+ export var ReservedCliParameter;
2
+ (function (ReservedCliParameter) {
3
+ ReservedCliParameter["Version"] = "version";
4
+ ReservedCliParameter["Help"] = "help";
5
+ })(ReservedCliParameter || (ReservedCliParameter = {}));
6
+ /** CLI options at the framework level, not defined by any SDK command. */
7
+ export const RESERVED_CLI_OPTIONS = [
8
+ {
9
+ name: ReservedCliParameter.Version,
10
+ flag: "--version",
11
+ short: "-V",
12
+ description: "Display version number",
13
+ },
14
+ {
15
+ name: ReservedCliParameter.Help,
16
+ flag: "--help",
17
+ short: "-h",
18
+ description: "Display help for command",
19
+ },
20
+ ];
21
+ export function getReservedCliOption(name) {
22
+ const option = RESERVED_CLI_OPTIONS.find((opt) => opt.name === name);
23
+ if (!option)
24
+ throw new Error(`Reserved CLI option not found: ${name}`);
25
+ return option;
26
+ }
27
+ /** CLI options automatically added to every SDK-generated command. */
28
+ export const SHARED_COMMAND_CLI_OPTIONS = [
29
+ {
30
+ name: "json",
31
+ flag: "--json",
32
+ description: "Output raw JSON instead of formatted results",
33
+ },
34
+ ];