import type { CommandDefinition } from "../claude-code-command-loader" import type { BuiltinCommandName, BuiltinCommands } from "./types" import { INIT_DEEP_TEMPLATE } from "./templates/init-deep" import { RALPH_LOOP_TEMPLATE, CANCEL_RALPH_TEMPLATE } from "./templates/ralph-loop" const BUILTIN_COMMAND_DEFINITIONS: Record> = { "init-deep": { description: "(builtin) Initialize hierarchical AGENTS.md knowledge base", template: ` ${INIT_DEEP_TEMPLATE} $ARGUMENTS `, argumentHint: "[--create-new] [--max-depth=N]", }, "ralph-loop": { description: "(builtin) Start self-referential development loop until completion", template: ` ${RALPH_LOOP_TEMPLATE} $ARGUMENTS `, argumentHint: '"task description" [--completion-promise=TEXT] [--max-iterations=N]', }, "cancel-ralph": { description: "(builtin) Cancel active Ralph Loop", template: ` ${CANCEL_RALPH_TEMPLATE} `, }, } export function loadBuiltinCommands( disabledCommands?: BuiltinCommandName[] ): BuiltinCommands { const disabled = new Set(disabledCommands ?? []) const commands: BuiltinCommands = {} for (const [name, definition] of Object.entries(BUILTIN_COMMAND_DEFINITIONS)) { if (!disabled.has(name as BuiltinCommandName)) { commands[name] = { name, ...definition, } } } return commands }