@code-yeongyu/senpi
Version:
Coding agent CLI with read, bash, edit, write tools and session management
28 lines • 1.44 kB
JavaScript
import { APP_NAME } from "../../../../config.js";
import { buildHelpMarkdown } from "../../../../modes/interactive/help-content.js";
import { HELP_OVERLAY_OPTIONS, HelpPanel } from "./panel.js";
const NON_TUI_HELP = `Interactive /help is available in TUI mode; run ${APP_NAME} --help for CLI usage.`;
export default function helpExtension(pi) {
pi.registerCommand("keybindings", {
description: "Open your keybindings.json in $EDITOR and reload it live",
handler: async (_args, ctx) => {
if (ctx.mode !== "tui") {
ctx.ui.notify(`Interactive /keybindings opens your config in $EDITOR and reloads it; run ${APP_NAME} in TUI mode to use it.`, "info");
return;
}
// In TUI mode interactive-mode's text dispatch handles /keybindings first.
},
});
pi.registerCommand("help", {
description: "Show usage, keybindings, and all commands",
handler: async (_args, ctx) => {
if (ctx.mode !== "tui") {
ctx.ui.notify(NON_TUI_HELP, "info");
return;
}
const markdown = buildHelpMarkdown({ extensionCommands: pi.getCommands() });
await ctx.ui.custom((tui, theme, keybindings, done) => new HelpPanel({ markdown, tui, theme, keybindings, done }), { overlay: true, overlayOptions: HELP_OVERLAY_OPTIONS });
},
});
}
//# sourceMappingURL=index.js.map