@strav/cli
Advanced tools
+2
-2
| { | ||
| "name": "@strav/cli", | ||
| "version": "1.0.0-alpha.42", | ||
| "version": "1.0.0-alpha.43", | ||
| "description": "Strav CLI layer — Command base, signature parser, ConsoleProvider, interactive prompts on top of @strav/kernel's ConsoleKernel", | ||
@@ -22,3 +22,3 @@ "type": "module", | ||
| "dependencies": { | ||
| "@strav/kernel": "1.0.0-alpha.42" | ||
| "@strav/kernel": "1.0.0-alpha.43" | ||
| }, | ||
@@ -25,0 +25,0 @@ "peerDependencies": { |
+15
-4
@@ -32,3 +32,5 @@ /** | ||
| parseArgv, | ||
| resolveProviders, | ||
| type ServiceProvider, | ||
| type ServiceProviderEntry, | ||
| } from '@strav/kernel' | ||
@@ -41,5 +43,10 @@ import type { CliCommandClass } from './command.ts' | ||
| argv: readonly string[] | ||
| /** Full default provider list — typically from `bootstrap/providers.ts`. */ | ||
| defaultProviders: readonly ServiceProvider[] | ||
| /** | ||
| * Full default provider list — typically from `bootstrap/providers.ts`. | ||
| * Accepts the same entry forms as `Application.useProviders`: instances, | ||
| * zero-arg constructors, and closures. Entries are resolved once, up front, | ||
| * so command collection and subset-boot can read provider metadata. | ||
| */ | ||
| defaultProviders: readonly ServiceProviderEntry[] | ||
| /** | ||
| * Explicit command list. Optional — when omitted, commands are collected | ||
@@ -57,3 +64,7 @@ * from every `ConsoleProvider` subclass in `defaultProviders`. | ||
| export async function runCli(options: RunCliOptions): Promise<number> { | ||
| const commands = options.commands ?? collectCommands(options.defaultProviders) | ||
| // Resolve provider entries (constructors / closures) to instances once, up | ||
| // front — `collectCommands` and `selectProviders` read instance metadata | ||
| // (`commands`, `name`, `dependencies`) that bare entries don't expose. | ||
| const defaultProviders = await resolveProviders(options.defaultProviders) | ||
| const commands = options.commands ?? collectCommands(defaultProviders) | ||
| assertUniqueCommands(commands) | ||
@@ -77,3 +88,3 @@ const byName = indexByName(commands) | ||
| const requested = (Class as { providers?: readonly string[] } | undefined)?.providers | ||
| providers = selectProviders(options.defaultProviders, requested, commandName) | ||
| providers = selectProviders(defaultProviders, requested, commandName) | ||
| } | ||
@@ -80,0 +91,0 @@ |
58248
1%1486
0.75%+ Added
- Removed
Updated