feat(cli) Custom Commands work in Non-Interactive/Headless Mode (#8305)

This commit is contained in:
James
2025-09-19 13:49:35 +00:00
committed by GitHub
parent 23467cdbdb
commit 2c4f61eca5
5 changed files with 417 additions and 26 deletions

View File

@@ -0,0 +1,29 @@
/**
* @license
* Copyright 2025 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
import type { CommandContext } from '../commands/types.js';
/**
* Creates a UI context object with no-op functions.
* Useful for non-interactive environments where UI operations
* are not applicable.
*/
export function createNonInteractiveUI(): CommandContext['ui'] {
return {
addItem: (_item, _timestamp) => 0,
clear: () => {},
setDebugMessage: (_message) => {},
loadHistory: (_newHistory) => {},
pendingItem: null,
setPendingItem: (_item) => {},
toggleCorgiMode: () => {},
toggleVimEnabled: async () => false,
setGeminiMdFileCount: (_count) => {},
reloadCommands: () => {},
extensionsUpdateState: new Map(),
setExtensionsUpdateState: (_updateState) => {},
};
}