mirror of
https://github.com/harivansh-afk/clanker-agent.git
synced 2026-04-17 14:01:21 +00:00
- Rename all package names from companion-* to clanker-* - Update npm scopes from @mariozechner to @harivansh-afk - Rename config directories .companion -> .clanker - Rename environment variables COMPANION_* -> CLANKER_* - Update all documentation, README files, and install scripts - Rename package directories (companion-channels, companion-grind, companion-teams) - Update GitHub URLs to harivansh-afk/clanker-agent - Preserve full git history from companion-cloud monorepo
57 lines
1.4 KiB
TypeScript
57 lines
1.4 KiB
TypeScript
/**
|
|
* TUI config selector for `clanker config` command
|
|
*/
|
|
|
|
import { ProcessTerminal, TUI } from "@mariozechner/clanker-tui";
|
|
import type { ResolvedPaths } from "../core/package-manager.js";
|
|
import type { SettingsManager } from "../core/settings-manager.js";
|
|
import { ConfigSelectorComponent } from "../modes/interactive/components/config-selector.js";
|
|
import {
|
|
initTheme,
|
|
stopThemeWatcher,
|
|
} from "../modes/interactive/theme/theme.js";
|
|
|
|
export interface ConfigSelectorOptions {
|
|
resolvedPaths: ResolvedPaths;
|
|
settingsManager: SettingsManager;
|
|
cwd: string;
|
|
agentDir: string;
|
|
}
|
|
|
|
/** Show TUI config selector and return when closed */
|
|
export async function selectConfig(
|
|
options: ConfigSelectorOptions,
|
|
): Promise<void> {
|
|
// Initialize theme before showing TUI
|
|
initTheme(options.settingsManager.getTheme(), true);
|
|
|
|
return new Promise((resolve) => {
|
|
const ui = new TUI(new ProcessTerminal());
|
|
let resolved = false;
|
|
|
|
const selector = new ConfigSelectorComponent(
|
|
options.resolvedPaths,
|
|
options.settingsManager,
|
|
options.cwd,
|
|
options.agentDir,
|
|
() => {
|
|
if (!resolved) {
|
|
resolved = true;
|
|
ui.stop();
|
|
stopThemeWatcher();
|
|
resolve();
|
|
}
|
|
},
|
|
() => {
|
|
ui.stop();
|
|
stopThemeWatcher();
|
|
process.exit(0);
|
|
},
|
|
() => ui.requestRender(),
|
|
);
|
|
|
|
ui.addChild(selector);
|
|
ui.setFocus(selector.getResourceList());
|
|
ui.start();
|
|
});
|
|
}
|