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:
10
src/index.ts
10
src/index.ts
@@ -32,6 +32,7 @@ import {
|
||||
loadOpencodeGlobalCommands,
|
||||
loadOpencodeProjectCommands,
|
||||
} from "./features/claude-code-command-loader";
|
||||
import { loadBuiltinCommands } from "./features/builtin-commands";
|
||||
|
||||
import {
|
||||
loadUserAgents,
|
||||
@@ -169,6 +170,12 @@ function mergeConfigs(
|
||||
...(override.disabled_hooks ?? []),
|
||||
]),
|
||||
],
|
||||
disabled_commands: [
|
||||
...new Set([
|
||||
...(base.disabled_commands ?? []),
|
||||
...(override.disabled_commands ?? []),
|
||||
]),
|
||||
],
|
||||
claude_code: deepMerge(base.claude_code, override.claude_code),
|
||||
};
|
||||
}
|
||||
@@ -510,12 +517,14 @@ const OhMyOpenCodePlugin: Plugin = async (ctx) => {
|
||||
...pluginComponents.mcpServers,
|
||||
};
|
||||
|
||||
const builtinCommands = loadBuiltinCommands(pluginConfig.disabled_commands);
|
||||
const userCommands = (pluginConfig.claude_code?.commands ?? true) ? loadUserCommands() : {};
|
||||
const opencodeGlobalCommands = loadOpencodeGlobalCommands();
|
||||
const systemCommands = config.command ?? {};
|
||||
const projectCommands = (pluginConfig.claude_code?.commands ?? true) ? loadProjectCommands() : {};
|
||||
const opencodeProjectCommands = loadOpencodeProjectCommands();
|
||||
config.command = {
|
||||
...builtinCommands,
|
||||
...userCommands,
|
||||
...opencodeGlobalCommands,
|
||||
...systemCommands,
|
||||
@@ -632,6 +641,7 @@ export type {
|
||||
AgentOverrides,
|
||||
McpName,
|
||||
HookName,
|
||||
BuiltinCommandName,
|
||||
} from "./config";
|
||||
|
||||
// NOTE: Do NOT export functions from main index.ts!
|
||||
|
||||
Reference in New Issue
Block a user