@zapier/zapier-sdk-cli 0.1.0 → 0.1.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.
@@ -87,6 +87,7 @@ function analyzeZodField(name, schema) {
87
87
  default: defaultValue,
88
88
  choices,
89
89
  hasResolver: (0, zapier_sdk_1.hasResolver)(name),
90
+ isPositional: (0, zapier_sdk_1.isPositional)(schema),
90
91
  };
91
92
  }
92
93
  // ============================================================================
@@ -218,6 +219,10 @@ function addCommand(program, commandName, config) {
218
219
  // Required parameters without resolvers become required positional arguments
219
220
  command.argument(`<${kebabName}>`, param.description || `${kebabName} parameter`);
220
221
  }
222
+ else if (param.isPositional) {
223
+ // Optional parameters marked as positional become optional positional arguments
224
+ command.argument(`[${kebabName}]`, param.description || `${kebabName} parameter`);
225
+ }
221
226
  else {
222
227
  // Optional parameters become flags (whether they have resolvers or not)
223
228
  const flags = [`--${kebabName}`];
@@ -239,10 +244,11 @@ function addCommand(program, commandName, config) {
239
244
  // ============================================================================
240
245
  function convertCliArgsToSdkParams(parameters, positionalArgs, options) {
241
246
  const sdkParams = {};
242
- // Handle positional arguments (required parameters only, whether they have resolvers or not)
247
+ // Handle positional arguments (required parameters or optional positional parameters)
243
248
  let argIndex = 0;
244
249
  parameters.forEach((param) => {
245
- if (param.required && argIndex < positionalArgs.length) {
250
+ if ((param.required || param.isPositional) &&
251
+ argIndex < positionalArgs.length) {
246
252
  // Use the original camelCase parameter name for the SDK
247
253
  sdkParams[param.name] = convertValue(positionalArgs[argIndex], param.type);
248
254
  argIndex++;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zapier/zapier-sdk-cli",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "Command line interface for Zapier SDK",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -25,7 +25,7 @@
25
25
  "inquirer": "^12.6.3",
26
26
  "ora": "^8.2.0",
27
27
  "zod": "^3.25.67",
28
- "@zapier/zapier-sdk": "0.1.0"
28
+ "@zapier/zapier-sdk": "0.1.1"
29
29
  },
30
30
  "devDependencies": {
31
31
  "@types/inquirer": "^9.0.8",
@@ -1,6 +1,6 @@
1
1
  import { Command } from "commander";
2
2
  import { z } from "zod";
3
- import { ZapierSdk, hasResolver } from "@zapier/zapier-sdk";
3
+ import { ZapierSdk, hasResolver, isPositional } from "@zapier/zapier-sdk";
4
4
  import { SchemaParameterResolver } from "./parameter-resolver";
5
5
  import { createPager } from "./pager";
6
6
  import { formatItemsFromSchema } from "./schema-formatter";
@@ -46,6 +46,7 @@ interface CliParameter {
46
46
  default?: any;
47
47
  choices?: string[];
48
48
  hasResolver?: boolean;
49
+ isPositional?: boolean;
49
50
  }
50
51
 
51
52
  // ============================================================================
@@ -118,6 +119,7 @@ function analyzeZodField(
118
119
  default: defaultValue,
119
120
  choices,
120
121
  hasResolver: hasResolver(name),
122
+ isPositional: isPositional(schema),
121
123
  };
122
124
  }
123
125
 
@@ -309,6 +311,12 @@ function addCommand(
309
311
  `<${kebabName}>`,
310
312
  param.description || `${kebabName} parameter`,
311
313
  );
314
+ } else if (param.isPositional) {
315
+ // Optional parameters marked as positional become optional positional arguments
316
+ command.argument(
317
+ `[${kebabName}]`,
318
+ param.description || `${kebabName} parameter`,
319
+ );
312
320
  } else {
313
321
  // Optional parameters become flags (whether they have resolvers or not)
314
322
  const flags = [`--${kebabName}`];
@@ -339,10 +347,13 @@ function convertCliArgsToSdkParams(
339
347
  ): Record<string, any> {
340
348
  const sdkParams: Record<string, any> = {};
341
349
 
342
- // Handle positional arguments (required parameters only, whether they have resolvers or not)
350
+ // Handle positional arguments (required parameters or optional positional parameters)
343
351
  let argIndex = 0;
344
352
  parameters.forEach((param) => {
345
- if (param.required && argIndex < positionalArgs.length) {
353
+ if (
354
+ (param.required || param.isPositional) &&
355
+ argIndex < positionalArgs.length
356
+ ) {
346
357
  // Use the original camelCase parameter name for the SDK
347
358
  sdkParams[param.name] = convertValue(
348
359
  positionalArgs[argIndex],