diff --git a/core/src/cli/command-line.ts b/core/src/cli/command-line.ts index 0dcd9cac90..c1e8072693 100644 --- a/core/src/cli/command-line.ts +++ b/core/src/cli/command-line.ts @@ -40,6 +40,7 @@ import { bindActiveContext, withSessionContext } from "../util/open-telemetry/co import { wrapActiveSpan } from "../util/open-telemetry/spans.js" import { DEFAULT_BROWSER_DIVIDER_WIDTH } from "../constants.js" import { styles } from "../logger/styles.js" +import type { GardenCli } from "./cli.js" const defaultMessageDuration = 3000 const commandLinePrefix = styles.warning("🌼 > ") @@ -153,11 +154,14 @@ export class CommandLine extends TypedEventEmitter { private globalConfigStore: GlobalConfigStore private readonly log: Log private readonly globalOpts: Partial> + // TODO: Make this required (doing this will unfortunately involve fixing hundreds of unit tests) + private readonly cli: GardenCli | undefined constructor({ cwd, manager, log, + cli, globalOpts, serveCommand, extraCommands, @@ -166,6 +170,7 @@ export class CommandLine extends TypedEventEmitter { cwd: string manager: GardenInstanceManager log: Log + cli: GardenCli | undefined globalOpts: Partial> serveCommand: ServeCommand extraCommands: Command[] @@ -178,6 +183,7 @@ export class CommandLine extends TypedEventEmitter { this.cwd = cwd this.manager = manager this.log = log + this.cli = cli this.globalOpts = globalOpts this.extraCommands = extraCommands this.serveCommand = serveCommand @@ -778,6 +784,7 @@ ${styles.accent.underline("Keys:")} .run({ ...prepareParams, garden, + cli: this.cli, sessionId, parentSessionId: this.manager.sessionId, }) diff --git a/core/src/commands/dev.tsx b/core/src/commands/dev.tsx index a5461539f7..74a50de33a 100644 --- a/core/src/commands/dev.tsx +++ b/core/src/commands/dev.tsx @@ -190,7 +190,7 @@ Use ${styles.bold("up/down")} arrow keys to scroll through your command history. } private async initCommandHandler(params: ActionParams) { - const { garden, log, opts } = params + const { garden, log, opts, cli } = params // override the session for this manager to ensure we inherit from // the initial garden dummy instance @@ -209,6 +209,7 @@ Use ${styles.bold("up/down")} arrow keys to scroll through your command history. extraCommands: [new HelpCommand(), new QuitCommand(quit), new QuietCommand(), new QuiteCommand()], globalOpts: pick(opts, Object.keys(globalOptions)), history: await garden.localConfigStore.get("devCommandHistory"), + cli, serveCommand: this, }) this.commandLine = cl