36 lines
1007 B
TypeScript
36 lines
1007 B
TypeScript
|
|
import type { CommandDefinition } from "../claude-code-command-loader"
|
||
|
|
import type { BuiltinCommandName, BuiltinCommands } from "./types"
|
||
|
|
import { INIT_DEEP_TEMPLATE } from "./templates/init-deep"
|
||
|
|
|
||
|
|
const BUILTIN_COMMAND_DEFINITIONS: Record<BuiltinCommandName, Omit<CommandDefinition, "name">> = {
|
||
|
|
"init-deep": {
|
||
|
|
description: "(builtin) Initialize hierarchical AGENTS.md knowledge base",
|
||
|
|
template: `<command-instruction>
|
||
|
|
${INIT_DEEP_TEMPLATE}
|
||
|
|
</command-instruction>
|
||
|
|
|
||
|
|
<user-request>
|
||
|
|
$ARGUMENTS
|
||
|
|
</user-request>`,
|
||
|
|
argumentHint: "[--create-new] [--max-depth=N]",
|
||
|
|
},
|
||
|
|
}
|
||
|
|
|
||
|
|
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
|
||
|
|
}
|