@oclif/core 4.5.5 → 4.5.6-autocomplete.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.
@@ -7,7 +7,7 @@ export type { HelpOptions } from './help';
7
7
  export type { Hook, Hooks } from './hooks';
8
8
  export type { Logger } from './logger';
9
9
  export type { Manifest } from './manifest';
10
- export type { Arg, ArgDefinition, ArgInput, BooleanFlag, CustomOptions, Deprecation, Flag, FlagDefinition, FlagInput, Input, OptionFlag, OutputArgs, OutputFlags, ParserOutput, } from './parser';
10
+ export type { Arg, ArgDefinition, ArgInput, BooleanFlag, Completion, CompletionContext, CustomOptions, Deprecation, Flag, FlagDefinition, FlagInput, Input, OptionFlag, OutputArgs, OutputFlags, ParserOutput, } from './parser';
11
11
  export type { LinkedPlugin, OclifConfiguration, PJSON, S3, S3Templates, UserPJSON, UserPlugin } from './pjson';
12
12
  export type { Options, Plugin, PluginOptions } from './plugin';
13
13
  export type { S3Manifest } from './s3-manifest';
@@ -1,5 +1,6 @@
1
1
  import { Command } from '../command';
2
2
  import { AlphabetLowercase, AlphabetUppercase } from './alphabet';
3
+ import { Config } from './config';
3
4
  export type FlagOutput = {
4
5
  [name: string]: any;
5
6
  };
@@ -223,6 +224,21 @@ export type OptionFlagProps = FlagProps & {
223
224
  * Should only be used on one flag at a time.
224
225
  */
225
226
  allowStdin?: boolean | 'only';
227
+ /**
228
+ * Optional dynamic completion configuration.
229
+ * Provides intelligent autocomplete suggestions for flag values based on context.
230
+ * Requires autocomplete plugin to be installed.
231
+ *
232
+ * @example
233
+ * ```typescript
234
+ * completion: {
235
+ * options: async (ctx) => {
236
+ * return ['option1', 'option2', 'option3']
237
+ * }
238
+ * }
239
+ * ```
240
+ */
241
+ completion?: Completion;
226
242
  };
227
243
  export type FlagParserContext = Command & {
228
244
  token: FlagToken;
@@ -447,6 +463,58 @@ export type ParserInput = {
447
463
  context: ParserContext | undefined;
448
464
  '--'?: boolean | undefined;
449
465
  };
466
+ /**
467
+ * Context provided to flag completion functions
468
+ */
469
+ export type CompletionContext = {
470
+ /**
471
+ * Parsed arguments from the current command line
472
+ */
473
+ args?: {
474
+ [name: string]: string;
475
+ };
476
+ /**
477
+ * Array of raw arguments
478
+ */
479
+ argv?: string[];
480
+ /**
481
+ * oclif configuration object
482
+ */
483
+ config: Config;
484
+ /**
485
+ * Parsed flags from the current command line
486
+ */
487
+ flags?: {
488
+ [name: string]: string;
489
+ };
490
+ };
491
+ /**
492
+ * Completion configuration for a flag
493
+ */
494
+ export type Completion = {
495
+ /**
496
+ * Function that returns completion options based on context
497
+ *
498
+ * @param ctx - Context containing parsed args, flags, and config
499
+ * @returns Promise resolving to array of completion strings
500
+ *
501
+ * @example
502
+ * ```typescript
503
+ * static flags = {
504
+ * 'target-org': Flags.string({
505
+ * description: 'Target org',
506
+ * completion: {
507
+ * options: async (ctx) => {
508
+ * const orgs = await getAuthenticatedOrgs()
509
+ * return orgs.map(o => o.alias)
510
+ * }
511
+ * }
512
+ * })
513
+ * }
514
+ * ```
515
+ */
516
+ options(ctx: CompletionContext): Promise<string[]>;
517
+ };
450
518
  export type ParserContext = Command & {
451
519
  token?: FlagToken | ArgToken | undefined;
452
520
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@oclif/core",
3
3
  "description": "base library for oclif CLIs",
4
- "version": "4.5.5",
4
+ "version": "4.5.6-autocomplete.0",
5
5
  "author": "Salesforce",
6
6
  "bugs": "https://github.com/oclif/core/issues",
7
7
  "dependencies": {