Add builtin-commands feature with init-deep command and disabled_commands config option
- New src/features/builtin-commands/ module with CommandDefinition loader - Implements init-deep command for hierarchical AGENTS.md knowledge base generation - Adds BuiltinCommandName and BuiltinCommandNameSchema to config - Integrates builtin commands loader into main plugin with proper config merging - Supports disabling specific builtin commands via disabled_commands config array 🤖 Generated with assistance of https://github.com/code-yeongyu/oh-my-opencode
This commit is contained in:
35
src/features/builtin-commands/commands.ts
Normal file
35
src/features/builtin-commands/commands.ts
Normal file
@@ -0,0 +1,35 @@
|
||||
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
|
||||
}
|
||||
Reference in New Issue
Block a user