2026-01-14 01:08:15 +00:00
|
|
|
import type { Command } from "commander";
|
|
|
|
|
import { emitCliBanner } from "../banner.js";
|
|
|
|
|
|
2026-01-16 01:33:20 +00:00
|
|
|
function setProcessTitleForCommand(actionCommand: Command) {
|
|
|
|
|
let current: Command = actionCommand;
|
|
|
|
|
while (current.parent && current.parent.parent) {
|
|
|
|
|
current = current.parent;
|
|
|
|
|
}
|
|
|
|
|
const name = current.name();
|
|
|
|
|
if (!name || name === "clawdbot") return;
|
|
|
|
|
process.title = `clawdbot-${name}`;
|
|
|
|
|
}
|
|
|
|
|
|
2026-01-14 14:31:43 +00:00
|
|
|
export function registerPreActionHooks(program: Command, programVersion: string) {
|
2026-01-14 01:08:15 +00:00
|
|
|
program.hook("preAction", async (_thisCommand, actionCommand) => {
|
2026-01-16 01:33:20 +00:00
|
|
|
setProcessTitleForCommand(actionCommand);
|
2026-01-14 01:08:15 +00:00
|
|
|
emitCliBanner(programVersion);
|
|
|
|
|
});
|
|
|
|
|
}
|