diff --git a/dist/commands/auth.js b/dist/commands/auth.js index f372aa6..2fe1881 100644 --- a/dist/commands/auth.js +++ b/dist/commands/auth.js @@ -95,16 +95,20 @@ function authCommand() { .option('--full-access', 'Grant full access') .option('--expires ', 'Expiry date YYYY-MM-DD (default 2099-12-31)', '2099-12-31') .action((0, ctx_1.run)(async (ctx, _args, o) => { + // commander stores --kebab-case flags camelCased (--base-ids -> + // opts.baseIds, --full-access -> opts.fullAccess); accept both. const opts = o; const scopes = opts.scopes.split(',').map((s) => s.trim()).filter(Boolean); - const baseIds = opts['base-ids'] - ? opts['base-ids'].split(',').map((s) => s.trim()) + const rawBaseIds = opts['base-ids'] ?? opts.baseIds; + const baseIds = rawBaseIds + ? rawBaseIds.split(',').map((s) => s.trim()) : undefined; + const fullAccess = Boolean(opts['full-access'] ?? opts.fullAccess); const created = (await ctx.client.createAccessToken({ name: opts.name, scopes, baseIds, - hasFullAccess: !!opts['full-access'], + hasFullAccess: fullAccess, expiredTime: opts.expires, })); if (ctx.json) diff --git a/dist/commands/workflow.js b/dist/commands/workflow.js index 2ec46a9..6fe9a7e 100644 --- a/dist/commands/workflow.js +++ b/dist/commands/workflow.js @@ -463,8 +463,11 @@ function actionCommand() { else { // Granular update: merge only the flags the user actually passed. config = { ...config }; - if (opts.code !== undefined || opts['code-file'] !== undefined) { - config.code = opts['code-file'] ? readFile(opts['code-file']) : opts.code; + // commander stores --kebab-case flags camelCased (--code-file -> + // opts.codeFile); accept both forms like buildActionConfig's pick(). + const codeFile = opts['code-file'] ?? opts.codeFile; + if (opts.code !== undefined || codeFile !== undefined) { + config.code = codeFile ? readFile(codeFile) : opts.code; } if (opts.timeout !== undefined) config.timeout = Number(opts.timeout); diff --git a/src/commands/auth.ts b/src/commands/auth.ts index cb74cc2..8819739 100644 --- a/src/commands/auth.ts +++ b/src/commands/auth.ts @@ -107,16 +107,28 @@ export function authCommand(): Command { .option('--expires ', 'Expiry date YYYY-MM-DD (default 2099-12-31)', '2099-12-31') .action( run(async (ctx, _args, o) => { - const opts = o as { name: string; scopes: string; 'base-ids'?: string; 'full-access'?: boolean; expires: string }; + // commander stores --kebab-case flags camelCased (--base-ids -> + // opts.baseIds, --full-access -> opts.fullAccess); accept both. + const opts = o as { + name: string; + scopes: string; + 'base-ids'?: string; + baseIds?: string; + 'full-access'?: boolean; + fullAccess?: boolean; + expires: string; + }; const scopes = opts.scopes.split(',').map((s) => s.trim()).filter(Boolean); - const baseIds = opts['base-ids'] - ? opts['base-ids'].split(',').map((s) => s.trim()) + const rawBaseIds = opts['base-ids'] ?? opts.baseIds; + const baseIds = rawBaseIds + ? rawBaseIds.split(',').map((s) => s.trim()) : undefined; + const fullAccess = Boolean(opts['full-access'] ?? opts.fullAccess); const created = (await ctx.client.createAccessToken({ name: opts.name, scopes, baseIds, - hasFullAccess: !!opts['full-access'], + hasFullAccess: fullAccess, expiredTime: opts.expires, })) as { id: string; token: string }; if (ctx.json) printJson(created); diff --git a/src/commands/workflow.ts b/src/commands/workflow.ts index f62e20e..28d83d6 100644 --- a/src/commands/workflow.ts +++ b/src/commands/workflow.ts @@ -523,8 +523,11 @@ export function actionCommand(): Command { else { // Granular update: merge only the flags the user actually passed. config = { ...config }; - if (opts.code !== undefined || opts['code-file'] !== undefined) { - config.code = opts['code-file'] ? readFile(opts['code-file']) : opts.code; + // commander stores --kebab-case flags camelCased (--code-file -> + // opts.codeFile); accept both forms like buildActionConfig's pick(). + const codeFile = opts['code-file'] ?? opts.codeFile; + if (opts.code !== undefined || codeFile !== undefined) { + config.code = codeFile ? readFile(codeFile) : opts.code; } if (opts.timeout !== undefined) config.timeout = Number(opts.timeout); if (opts.dependencies !== undefined) {