Files
oh-my-opencode/src/tools/index.ts
T
YeonGyu-Kim 476f154ef5 fix: use ctx.directory instead of process.cwd() in tools for Desktop app support
Convert grep, glob, ast-grep, and session-manager tools from static exports to factory functions that receive PluginInput context. This allows them to use ctx.directory instead of process.cwd(), fixing issue #658 where tools search from wrong directory in OpenCode Desktop app.

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-02-07 19:04:31 +09:00

64 lines
1.8 KiB
TypeScript

import {
lsp_goto_definition,
lsp_find_references,
lsp_symbols,
lsp_diagnostics,
lsp_prepare_rename,
lsp_rename,
lspManager,
} from "./lsp"
export { lspManager }
export { createAstGrepTools } from "./ast-grep"
export { createGrepTools } from "./grep"
export { createGlobTools } from "./glob"
export { createSlashcommandTool, discoverCommandsSync } from "./slashcommand"
export { createSessionManagerTools } from "./session-manager"
export { sessionExists } from "./session-manager/storage"
export { interactive_bash, startBackgroundCheck as startTmuxCheck } from "./interactive-bash"
export { createSkillTool } from "./skill"
export { createSkillMcpTool } from "./skill-mcp"
import {
createBackgroundOutput,
createBackgroundCancel,
type BackgroundOutputManager,
type BackgroundCancelClient,
} from "./background-task"
import type { PluginInput, ToolDefinition } from "@opencode-ai/plugin"
import type { BackgroundManager } from "../features/background-agent"
type OpencodeClient = PluginInput["client"]
export { createCallOmoAgent } from "./call-omo-agent"
export { createLookAt } from "./look-at"
export { createDelegateTask } from "./delegate-task"
export {
createTaskCreateTool,
createTaskGetTool,
createTaskList,
createTaskUpdateTool,
} from "./task"
export function createBackgroundTools(manager: BackgroundManager, client: OpencodeClient): Record<string, ToolDefinition> {
const outputManager: BackgroundOutputManager = manager
const cancelClient: BackgroundCancelClient = client
return {
background_output: createBackgroundOutput(outputManager, client),
background_cancel: createBackgroundCancel(manager, cancelClient),
}
}
export const builtinTools: Record<string, ToolDefinition> = {
lsp_goto_definition,
lsp_find_references,
lsp_symbols,
lsp_diagnostics,
lsp_prepare_rename,
lsp_rename,
}