resolve
Generated reference page for the resolve function export.
- Import:
@kjanat/dreamcli - Export kind: function
- Declared in:
src/core/resolve/index.ts - Source link:
packages/dreamcli/src/core/resolve/index.ts:60
Signatures
ts
function resolve(schema: CommandSchema, parsed: ParseResult, options?: ResolveOptions): Promise<ResolveResult>;| Parameter | Type | Description |
|---|---|---|
schema | CommandSchema | The command schema defining flags and args |
parsed | ParseResult | Raw parsed values from the parser |
options | ResolveOptions | undefined | External state for the resolution chain |
Members
Members
resolve
Resolve parsed values against a command schema.
Low-level API: most applications should rely on cli().run(), .execute(), or runCommand(), which already call resolve at the right time. Reach for this function when testing precedence rules directly or building custom execution flows around CommandSchema.
Resolution order:
- CLI parsed value (from ParseResult)
- Env variable (from ResolveOptions.env, if flag declares
envVar) - Config value (from ResolveOptions.config, if flag declares
configPath) - Prompt (from ResolveOptions.prompter, if flag declares
prompt) - Default value (from schema)
After resolution, validates that all required flags and args have a value. Collects all validation errors before throwing, so the user sees every missing field at once.
ts
(schema: CommandSchema, parsed: ParseResult, options?: ResolveOptions): Promise<ResolveResult>;Examples
ts
const parsed = parse(deploy.schema, ['production']);
const resolved = await resolve(deploy.schema, parsed, {
env: { DEPLOY_REGION: 'eu' },
});