oh-my-opencode 0.1.31 → 0.1.32

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. package/README.ko.md +13 -0
  2. package/README.md +24 -0
  3. package/dist/features/claude-code-agent-loader/index.d.ts +2 -0
  4. package/dist/features/claude-code-agent-loader/loader.d.ts +3 -0
  5. package/dist/features/claude-code-agent-loader/types.d.ts +14 -0
  6. package/dist/features/claude-code-command-loader/index.d.ts +2 -0
  7. package/dist/features/claude-code-command-loader/loader.d.ts +5 -0
  8. package/dist/features/claude-code-command-loader/types.d.ts +23 -0
  9. package/dist/features/claude-code-mcp-loader/env-expander.d.ts +2 -0
  10. package/dist/features/claude-code-mcp-loader/index.d.ts +10 -0
  11. package/dist/features/claude-code-mcp-loader/loader.d.ts +3 -0
  12. package/dist/features/claude-code-mcp-loader/transformer.d.ts +2 -0
  13. package/dist/features/claude-code-mcp-loader/types.d.ts +35 -0
  14. package/dist/features/claude-code-session-state/detector.d.ts +1 -0
  15. package/dist/features/claude-code-session-state/index.d.ts +3 -0
  16. package/dist/features/claude-code-session-state/state.d.ts +13 -0
  17. package/dist/features/claude-code-session-state/types.d.ts +7 -0
  18. package/dist/features/claude-code-skill-loader/index.d.ts +2 -0
  19. package/dist/features/claude-code-skill-loader/loader.d.ts +3 -0
  20. package/dist/features/claude-code-skill-loader/types.d.ts +13 -0
  21. package/dist/hooks/index.d.ts +1 -0
  22. package/dist/hooks/think-mode/detector.d.ts +5 -0
  23. package/dist/hooks/think-mode/index.d.ts +14 -0
  24. package/dist/hooks/think-mode/switcher.d.ts +4 -0
  25. package/dist/hooks/think-mode/types.d.ts +20 -0
  26. package/dist/index.js +1293 -125
  27. package/dist/shared/command-executor.d.ts +21 -0
  28. package/dist/shared/file-reference-resolver.d.ts +1 -0
  29. package/dist/shared/frontmatter.d.ts +5 -0
  30. package/dist/shared/index.d.ts +5 -0
  31. package/dist/shared/logger.d.ts +2 -0
  32. package/dist/shared/model-sanitizer.d.ts +11 -0
  33. package/dist/tools/index.d.ts +18 -0
  34. package/dist/tools/skill/index.d.ts +2 -0
  35. package/dist/tools/skill/tools.d.ts +9 -0
  36. package/dist/tools/skill/types.d.ts +24 -0
  37. package/dist/tools/slashcommand/index.d.ts +2 -0
  38. package/dist/tools/slashcommand/tools.d.ts +9 -0
  39. package/dist/tools/slashcommand/types.d.ts +16 -0
  40. package/package.json +2 -2
package/README.ko.md CHANGED
@@ -153,6 +153,10 @@ OpenCode 는 아주 확장가능하고 아주 커스터마이저블합니다.
153
153
  │ └── Button.tsx # 이 파일을 읽으면 위 3개 AGENTS.md 모두 주입
154
154
  ```
155
155
  `Button.tsx`를 읽으면 순서대로 주입됩니다: `project/AGENTS.md` → `src/AGENTS.md` → `components/AGENTS.md`. 각 디렉토리의 컨텍스트는 세션당 한 번만 주입됩니다. Claude Code의 CLAUDE.md 기능에서 영감을 받았습니다.
156
+ - **Think Mode**: 확장된 사고(Extended Thinking)가 필요한 상황을 자동으로 감지하고 모드를 전환합니다. 사용자가 깊은 사고를 요청하는 표현(예: "think deeply", "ultrathink")을 감지하면, 추론 능력을 극대화하도록 모델 설정을 동적으로 조정합니다.
157
+ - **Anthropic Auto Compact**: Anthropic 모델 사용 시 컨텍스트 한계에 도달하면 대화 기록을 자동으로 압축하여 효율적으로 관리합니다.
158
+ - **Empty Task Response Detector**: 서브 에이전트가 수행한 작업이 비어있거나 무의미한 응답을 반환하는 경우를 감지하여, 오류 없이 우아하게 처리합니다.
159
+ - **Grep Output Truncator**: Grep 검색 결과가 너무 길어 컨텍스트를 장악해버리는 것을 방지하기 위해, 과도한 출력을 자동으로 자릅니다.
156
160
 
157
161
  ### Agents
158
162
 
@@ -221,7 +225,16 @@ OpenCode 는 아주 확장가능하고 아주 커스터마이저블합니다.
221
225
  ```
222
226
 
223
227
  ### 기타 편의 기능
228
+
224
229
  - **Terminal Title**: 세션 상태에 따라 터미널 타이틀을 자동 업데이트합니다 (유휴 ○, 처리중 ◐, 도구 ⚡, 에러 ✖). tmux를 지원합니다.
230
+ - **Command Loader**: 다음 디렉토리들에서 마크다운 기반의 커스텀 명령어들을 로드합니다:
231
+ - User scope: `~/.claude/commands/`
232
+ - Project scope: `./.claude/commands/`
233
+ - OpenCode global: `~/.config/opencode/command/`
234
+ - OpenCode project: `./.opencode/command/`
235
+ - **Skill Loader**: 다음 디렉토리들에서 디렉토리 기반의 스킬들을 실행 가능한 명령어로 로드합니다:
236
+ - User scope: `~/.claude/skills/`
237
+ - Project scope: `./.claude/skills/`
225
238
 
226
239
  ## 설정
227
240
 
package/README.md CHANGED
@@ -149,6 +149,10 @@ I believe in the right tool for the job. For your wallet's sake, use CLIProxyAPI
149
149
  │ └── Button.tsx # Reading this injects ALL 3 AGENTS.md files
150
150
  ```
151
151
  When reading `Button.tsx`, the hook injects contexts in order: `project/AGENTS.md` → `src/AGENTS.md` → `components/AGENTS.md`. Each directory's context is injected only once per session. Inspired by Claude Code's CLAUDE.md feature.
152
+ - **Think Mode**: Automatic extended thinking detection and mode switching. Detects when user requests deep thinking (e.g., "think deeply", "ultrathink") and dynamically adjusts model settings for enhanced reasoning.
153
+ - **Anthropic Auto Compact**: Automatically compacts conversation history when approaching context limits for Anthropic models.
154
+ - **Empty Task Response Detector**: Detects when subagent tasks return empty or meaningless responses and handles gracefully.
155
+ - **Grep Output Truncator**: Prevents grep output from overwhelming the context by truncating excessively long results.
152
156
 
153
157
  ### Agents
154
158
  - **oracle** (`openai/gpt-5.1`): The architect. Expert in code reviews and strategy. Uses GPT-5.1 for its unmatched logic and reasoning capabilities. Inspired by AmpCode.
@@ -220,6 +224,26 @@ Don't need these? Disable them via `oh-my-opencode.json`:
220
224
  ### Other Features
221
225
 
222
226
  - **Terminal Title**: Auto-updates terminal title with session status (idle ○, processing ◐, tool ⚡, error ✖). Supports tmux.
227
+ - **Command Loader** (`src/features/claude-code-command-loader/`): Loads markdown-based commands from multiple directories:
228
+ - User scope: `~/.claude/commands/`
229
+ - Project scope: `./.claude/commands/`
230
+ - OpenCode global: `~/.config/opencode/command/`
231
+ - OpenCode project: `./.opencode/command/`
232
+ - **Skill Loader** (`src/features/claude-code-skill-loader/`): Loads directory-based skills as executable commands:
233
+ - User scope: `~/.claude/skills/`
234
+ - Project scope: `./.claude/skills/`
235
+ - **Agent Loader** (`src/features/claude-code-agent-loader/`): Loads agent definitions from markdown files with YAML frontmatter:
236
+ - User scope: `~/.claude/agents/`
237
+ - Project scope: `./.claude/agents/`
238
+ - Format: `*.md` files with frontmatter (name, description, tools)
239
+ - **Session State** (`src/features/claude-code-session-state/`): Centralized session tracking module used by event hooks and terminal title updates.
240
+ - **MCP Loader** (`src/features/claude-code-mcp-loader/`): Loads MCP server configurations from `.mcp.json` files:
241
+ - User scope: `~/.claude/.mcp.json`
242
+ - Project scope: `./.mcp.json`
243
+ - Local scope: `./.claude/.mcp.json`
244
+ - Supports environment variable expansion (`${VAR}` syntax)
245
+
246
+ > **Note on `claude-code-*` naming**: Features under `src/features/claude-code-*/` are migrated from Claude Code's configuration system. This naming convention clearly identifies which features originated from Claude Code, such as `claude-code-command-loader`, `claude-code-skill-loader`, `claude-code-agent-loader`, and `claude-code-mcp-loader`.
223
247
 
224
248
  ## Configuration
225
249
 
@@ -0,0 +1,2 @@
1
+ export * from "./types";
2
+ export * from "./loader";
@@ -0,0 +1,3 @@
1
+ import type { AgentConfig } from "@opencode-ai/sdk";
2
+ export declare function loadUserAgents(): Record<string, AgentConfig>;
3
+ export declare function loadProjectAgents(): Record<string, AgentConfig>;
@@ -0,0 +1,14 @@
1
+ import type { AgentConfig } from "@opencode-ai/sdk";
2
+ export type AgentScope = "user" | "project";
3
+ export interface AgentFrontmatter {
4
+ name?: string;
5
+ description?: string;
6
+ model?: string;
7
+ tools?: string;
8
+ }
9
+ export interface LoadedAgent {
10
+ name: string;
11
+ path: string;
12
+ config: AgentConfig;
13
+ scope: AgentScope;
14
+ }
@@ -0,0 +1,2 @@
1
+ export * from "./types";
2
+ export * from "./loader";
@@ -0,0 +1,5 @@
1
+ import type { CommandDefinition } from "./types";
2
+ export declare function loadUserCommands(): Record<string, CommandDefinition>;
3
+ export declare function loadProjectCommands(): Record<string, CommandDefinition>;
4
+ export declare function loadOpencodeGlobalCommands(): Record<string, CommandDefinition>;
5
+ export declare function loadOpencodeProjectCommands(): Record<string, CommandDefinition>;
@@ -0,0 +1,23 @@
1
+ export type CommandScope = "user" | "project" | "opencode" | "opencode-project";
2
+ export interface CommandDefinition {
3
+ name: string;
4
+ description?: string;
5
+ template: string;
6
+ agent?: string;
7
+ model?: string;
8
+ subtask?: boolean;
9
+ argumentHint?: string;
10
+ }
11
+ export interface CommandFrontmatter {
12
+ description?: string;
13
+ "argument-hint"?: string;
14
+ agent?: string;
15
+ model?: string;
16
+ subtask?: boolean;
17
+ }
18
+ export interface LoadedCommand {
19
+ name: string;
20
+ path: string;
21
+ definition: CommandDefinition;
22
+ scope: CommandScope;
23
+ }
@@ -0,0 +1,2 @@
1
+ export declare function expandEnvVars(value: string): string;
2
+ export declare function expandEnvVarsInObject<T>(obj: T): T;
@@ -0,0 +1,10 @@
1
+ /**
2
+ * MCP Configuration Loader
3
+ *
4
+ * Loads Claude Code .mcp.json format configurations from multiple scopes
5
+ * and transforms them to OpenCode SDK format
6
+ */
7
+ export * from "./types";
8
+ export * from "./loader";
9
+ export * from "./transformer";
10
+ export * from "./env-expander";
@@ -0,0 +1,3 @@
1
+ import type { LoadedMcpServer, McpLoadResult } from "./types";
2
+ export declare function loadMcpConfigs(): Promise<McpLoadResult>;
3
+ export declare function formatLoadedServersForToast(loadedServers: LoadedMcpServer[]): string;
@@ -0,0 +1,2 @@
1
+ import type { ClaudeCodeMcpServer, McpServerConfig } from "./types";
2
+ export declare function transformMcpServer(name: string, server: ClaudeCodeMcpServer): McpServerConfig;
@@ -0,0 +1,35 @@
1
+ export type McpScope = "user" | "project" | "local";
2
+ export interface ClaudeCodeMcpServer {
3
+ type?: "http" | "sse" | "stdio";
4
+ url?: string;
5
+ command?: string;
6
+ args?: string[];
7
+ env?: Record<string, string>;
8
+ headers?: Record<string, string>;
9
+ disabled?: boolean;
10
+ }
11
+ export interface ClaudeCodeMcpConfig {
12
+ mcpServers?: Record<string, ClaudeCodeMcpServer>;
13
+ }
14
+ export interface McpLocalConfig {
15
+ type: "local";
16
+ command: string[];
17
+ environment?: Record<string, string>;
18
+ enabled?: boolean;
19
+ }
20
+ export interface McpRemoteConfig {
21
+ type: "remote";
22
+ url: string;
23
+ headers?: Record<string, string>;
24
+ enabled?: boolean;
25
+ }
26
+ export type McpServerConfig = McpLocalConfig | McpRemoteConfig;
27
+ export interface LoadedMcpServer {
28
+ name: string;
29
+ scope: McpScope;
30
+ config: McpServerConfig;
31
+ }
32
+ export interface McpLoadResult {
33
+ servers: Record<string, McpServerConfig>;
34
+ loadedServers: LoadedMcpServer[];
35
+ }
@@ -0,0 +1 @@
1
+ export declare function detectInterrupt(error: unknown): boolean;
@@ -0,0 +1,3 @@
1
+ export * from "./types";
2
+ export * from "./state";
3
+ export * from "./detector";
@@ -0,0 +1,13 @@
1
+ import type { SessionErrorState, SessionInterruptState } from "./types";
2
+ export declare const sessionErrorState: Map<string, SessionErrorState>;
3
+ export declare const sessionInterruptState: Map<string, SessionInterruptState>;
4
+ export declare const subagentSessions: Set<string>;
5
+ export declare const sessionFirstMessageProcessed: Set<string>;
6
+ export declare let currentSessionID: string | undefined;
7
+ export declare let currentSessionTitle: string | undefined;
8
+ export declare let mainSessionID: string | undefined;
9
+ export declare function setCurrentSession(id: string | undefined, title: string | undefined): void;
10
+ export declare function setMainSession(id: string | undefined): void;
11
+ export declare function getCurrentSessionID(): string | undefined;
12
+ export declare function getCurrentSessionTitle(): string | undefined;
13
+ export declare function getMainSessionID(): string | undefined;
@@ -0,0 +1,7 @@
1
+ export interface SessionErrorState {
2
+ hasError: boolean;
3
+ errorMessage?: string;
4
+ }
5
+ export interface SessionInterruptState {
6
+ interrupted: boolean;
7
+ }
@@ -0,0 +1,2 @@
1
+ export * from "./types";
2
+ export * from "./loader";
@@ -0,0 +1,3 @@
1
+ import type { CommandDefinition } from "../claude-code-command-loader/types";
2
+ export declare function loadUserSkillsAsCommands(): Record<string, CommandDefinition>;
3
+ export declare function loadProjectSkillsAsCommands(): Record<string, CommandDefinition>;
@@ -0,0 +1,13 @@
1
+ import type { CommandDefinition } from "../claude-code-command-loader/types";
2
+ export type SkillScope = "user" | "project";
3
+ export interface SkillMetadata {
4
+ name: string;
5
+ description: string;
6
+ model?: string;
7
+ }
8
+ export interface LoadedSkillAsCommand {
9
+ name: string;
10
+ path: string;
11
+ definition: CommandDefinition;
12
+ scope: SkillScope;
13
+ }
@@ -7,3 +7,4 @@ export { createGrepOutputTruncatorHook } from "./grep-output-truncator";
7
7
  export { createDirectoryAgentsInjectorHook } from "./directory-agents-injector";
8
8
  export { createEmptyTaskResponseDetectorHook } from "./empty-task-response-detector";
9
9
  export { createAnthropicAutoCompactHook } from "./anthropic-auto-compact";
10
+ export { createThinkModeHook } from "./think-mode";
@@ -0,0 +1,5 @@
1
+ export declare function detectThinkKeyword(text: string): boolean;
2
+ export declare function extractPromptText(parts: Array<{
3
+ type: string;
4
+ text?: string;
5
+ }>): string;
@@ -0,0 +1,14 @@
1
+ import type { ThinkModeInput } from "./types";
2
+ export * from "./detector";
3
+ export * from "./switcher";
4
+ export * from "./types";
5
+ export declare function clearThinkModeState(sessionID: string): void;
6
+ export declare function createThinkModeHook(): {
7
+ "chat.params": (output: ThinkModeInput, sessionID: string) => Promise<void>;
8
+ event: ({ event }: {
9
+ event: {
10
+ type: string;
11
+ properties?: unknown;
12
+ };
13
+ }) => Promise<void>;
14
+ };
@@ -0,0 +1,4 @@
1
+ export declare const THINKING_CONFIGS: Record<string, Record<string, unknown>>;
2
+ export declare function getHighVariant(modelID: string): string | null;
3
+ export declare function isAlreadyHighVariant(modelID: string): boolean;
4
+ export declare function getThinkingConfig(providerID: string, modelID: string): Record<string, unknown> | null;
@@ -0,0 +1,20 @@
1
+ export interface ThinkModeState {
2
+ requested: boolean;
3
+ modelSwitched: boolean;
4
+ providerID?: string;
5
+ modelID?: string;
6
+ }
7
+ export interface ModelRef {
8
+ providerID: string;
9
+ modelID: string;
10
+ }
11
+ export interface MessageWithModel {
12
+ model?: ModelRef;
13
+ }
14
+ export interface ThinkModeInput {
15
+ parts: Array<{
16
+ type: string;
17
+ text?: string;
18
+ }>;
19
+ message: MessageWithModel;
20
+ }