@@ -252,6 +252,9 @@ export function create(
252252 const mountedRootDef = toRootDefinition . get ( nameOrCli )
253253 if ( mountedRootDef ) {
254254 commands . set ( nameOrCli . name , mountedRootDef )
255+ const rootAliases = toRootAliases . get ( nameOrCli )
256+ if ( rootAliases )
257+ for ( const a of rootAliases ) commands . set ( a , { _alias : true , target : nameOrCli . name } )
255258 return cli
256259 }
257260 const sub = nameOrCli as Cli
@@ -308,6 +311,7 @@ export function create(
308311 }
309312
310313 if ( rootDef ) toRootDefinition . set ( cli as unknown as Root , rootDef )
314+ if ( rootDef && def . aliases ) toRootAliases . set ( cli as unknown as Root , def . aliases )
311315 if ( def . options ) toRootOptions . set ( cli , def . options )
312316 if ( def . config !== undefined ) toConfigEnabled . set ( cli , true )
313317 if ( def . outputPolicy ) toOutputPolicy . set ( cli , def . outputPolicy )
@@ -2414,6 +2418,9 @@ export const toConfigEnabled = new WeakMap<Cli, boolean>()
24142418/** @internal Maps CLI instances to their output policy. */
24152419const toOutputPolicy = new WeakMap < Cli , OutputPolicy > ( )
24162420
2421+ /** @internal Maps root CLI instances to their command aliases. */
2422+ const toRootAliases = new WeakMap < Root , string [ ] > ( )
2423+
24172424/** @internal Sentinel symbol for `ok()` and `error()` return values. */
24182425const sentinel = Symbol . for ( 'incur.sentinel' )
24192426
0 commit comments