import { FlagSchema } from "../schema/flag.mjs"; import { CommandSchema } from "../schema/command.mjs"; import "../schema/index.mjs"; //#region src/core/cli/propagate.d.ts /** * Collect propagated flags from a command path. * * The command path is an ordered array of {@linkcode CommandSchema} from the root * ancestor to the target command that will actually execute. Each ancestor's * flags marked `propagate: true` are accumulated. If a descendant (including * the target) defines a flag with the same name — regardless of whether the * descendant's flag has `propagate: true` — it shadows the ancestor's flag. * * The target command's own flags are **not** included in the result. This * function returns only the *inherited* propagated flags that should be merged * into the target command's flag set before resolution. * * @param commandPath - Ordered schemas from root ancestor to target (inclusive). * Must contain at least one element (the target itself). When the path has * only one element, no ancestors exist and the result is empty. * * @returns A record of propagated flag schemas keyed by flag name. Empty when * the path has no ancestors or no ancestor flags have `propagate: true`. * * @example * ```ts * // Given: root (--verbose [propagate]) → db → migrate * // Where migrate does NOT define --verbose * const inherited = collectPropagatedFlags([rootSchema, dbSchema, migrateSchema]); * // inherited = { verbose: } * * // If db also defines --verbose (shadowing root): * const inherited2 = collectPropagatedFlags([rootSchema, dbSchemaWithVerbose, migrateSchema]); * // inherited2 = { verbose: } * ``` */ declare function collectPropagatedFlags(commandPath: readonly CommandSchema[]): Readonly>; //#endregion export { collectPropagatedFlags };