@agentuity/cli 0.0.12 → 0.0.13

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/src/types.ts CHANGED
@@ -150,6 +150,7 @@ export type CommandContext<
150
150
  // Helper to create subcommands with proper type inference
151
151
  export function createSubcommand<
152
152
  TRequiresAuth extends boolean,
153
+ TOptionalAuth extends boolean | string,
153
154
  TArgsSchema extends z.ZodType | undefined,
154
155
  TOptionsSchema extends z.ZodType | undefined,
155
156
  >(definition: {
@@ -158,6 +159,7 @@ export function createSubcommand<
158
159
  aliases?: string[];
159
160
  toplevel?: boolean;
160
161
  requiresAuth?: TRequiresAuth;
162
+ optionalAuth?: TOptionalAuth;
161
163
  schema?: TArgsSchema extends z.ZodType
162
164
  ? TOptionsSchema extends z.ZodType
163
165
  ? { args: TArgsSchema; options: TOptionsSchema }
@@ -166,7 +168,15 @@ export function createSubcommand<
166
168
  ? { options: TOptionsSchema }
167
169
  : never;
168
170
  handler(
169
- ctx: CommandContext<TRequiresAuth extends true ? true : false, TArgsSchema, TOptionsSchema>
171
+ ctx: CommandContext<
172
+ TRequiresAuth extends true
173
+ ? true
174
+ : TOptionalAuth extends true | string
175
+ ? true | false
176
+ : false,
177
+ TArgsSchema,
178
+ TOptionsSchema
179
+ >
170
180
  ): void | Promise<void>;
171
181
  }): SubcommandDefinition {
172
182
  return definition as unknown as SubcommandDefinition;
@@ -175,6 +185,7 @@ export function createSubcommand<
175
185
  // Helper to create commands with proper type inference
176
186
  export function createCommand<
177
187
  TRequiresAuth extends boolean,
188
+ TOptionalAuth extends boolean | string,
178
189
  TArgsSchema extends z.ZodType | undefined,
179
190
  TOptionsSchema extends z.ZodType | undefined,
180
191
  >(definition: {
@@ -183,6 +194,7 @@ export function createCommand<
183
194
  aliases?: string[];
184
195
  hidden?: boolean;
185
196
  requiresAuth?: TRequiresAuth;
197
+ optionalAuth?: TOptionalAuth;
186
198
  schema?: TArgsSchema extends z.ZodType
187
199
  ? TOptionsSchema extends z.ZodType
188
200
  ? { args: TArgsSchema; options: TOptionsSchema }
@@ -191,7 +203,15 @@ export function createCommand<
191
203
  ? { options: TOptionsSchema }
192
204
  : never;
193
205
  handler?(
194
- ctx: CommandContext<TRequiresAuth extends true ? true : false, TArgsSchema, TOptionsSchema>
206
+ ctx: CommandContext<
207
+ TRequiresAuth extends true
208
+ ? true
209
+ : TOptionalAuth extends true | string
210
+ ? true | false
211
+ : false,
212
+ TArgsSchema,
213
+ TOptionsSchema
214
+ >
195
215
  ): void | Promise<void>;
196
216
  subcommands?: SubcommandDefinition[];
197
217
  }): CommandDefinition {
@@ -206,6 +226,7 @@ export type SubcommandDefinition =
206
226
  aliases?: string[];
207
227
  toplevel?: boolean;
208
228
  requiresAuth: true;
229
+ optionalAuth?: false | string;
209
230
  schema?: CommandSchemas;
210
231
  handler(ctx: CommandContext): void | Promise<void>;
211
232
  }
@@ -215,6 +236,17 @@ export type SubcommandDefinition =
215
236
  aliases?: string[];
216
237
  toplevel?: boolean;
217
238
  requiresAuth?: false;
239
+ optionalAuth: true | string;
240
+ schema?: CommandSchemas;
241
+ handler(ctx: CommandContext): void | Promise<void>;
242
+ }
243
+ | {
244
+ name: string;
245
+ description: string;
246
+ aliases?: string[];
247
+ toplevel?: boolean;
248
+ requiresAuth?: false;
249
+ optionalAuth?: false;
218
250
  schema?: CommandSchemas;
219
251
  handler(ctx: CommandContext): void | Promise<void>;
220
252
  };
@@ -227,6 +259,18 @@ export type CommandDefinition =
227
259
  aliases?: string[];
228
260
  hidden?: boolean;
229
261
  requiresAuth: true;
262
+ optionalAuth?: false | string;
263
+ schema?: CommandSchemas;
264
+ handler?(ctx: CommandContext): void | Promise<void>;
265
+ subcommands?: SubcommandDefinition[];
266
+ }
267
+ | {
268
+ name: string;
269
+ description: string;
270
+ aliases?: string[];
271
+ hidden?: boolean;
272
+ requiresAuth?: false;
273
+ optionalAuth: true | string;
230
274
  schema?: CommandSchemas;
231
275
  handler?(ctx: CommandContext): void | Promise<void>;
232
276
  subcommands?: SubcommandDefinition[];
@@ -237,6 +281,7 @@ export type CommandDefinition =
237
281
  aliases?: string[];
238
282
  hidden?: boolean;
239
283
  requiresAuth?: false;
284
+ optionalAuth?: false;
240
285
  schema?: CommandSchemas;
241
286
  handler?(ctx: CommandContext): void | Promise<void>;
242
287
  subcommands?: SubcommandDefinition[];