oh-my-opencode 0.1.0 → 0.1.2
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.
- package/README.en.md +57 -6
- package/README.ko.md +19 -2
- package/dist/agents/index.d.ts +2 -0
- package/dist/agents/types.d.ts +4 -0
- package/dist/agents/utils.d.ts +3 -0
- package/dist/config/index.d.ts +2 -0
- package/dist/config/schema.d.ts +181 -0
- package/dist/hooks/comment-checker/constants.d.ts +7 -0
- package/dist/hooks/comment-checker/detector.d.ts +3 -0
- package/dist/hooks/comment-checker/filters/bdd.d.ts +2 -0
- package/dist/hooks/comment-checker/filters/directive.d.ts +2 -0
- package/dist/hooks/comment-checker/filters/docstring.d.ts +2 -0
- package/dist/hooks/comment-checker/filters/index.d.ts +7 -0
- package/dist/hooks/comment-checker/filters/shebang.d.ts +2 -0
- package/dist/hooks/comment-checker/index.d.ts +23 -0
- package/dist/hooks/comment-checker/output/formatter.d.ts +2 -0
- package/dist/hooks/comment-checker/output/index.d.ts +2 -0
- package/dist/hooks/comment-checker/output/xml-builder.d.ts +2 -0
- package/dist/hooks/comment-checker/types.d.ts +30 -0
- package/dist/hooks/index.d.ts +2 -0
- package/dist/hooks/session-recovery.d.ts +27 -0
- package/dist/index.d.ts +2 -0
- package/dist/mcp/context7.d.ts +5 -0
- package/dist/mcp/index.d.ts +11 -0
- package/dist/mcp/websearch-exa.d.ts +5 -0
- package/dist/tools/ast-grep/constants.d.ts +1 -1
- package/dist/tools/ast-grep/index.d.ts +26 -26
- package/dist/tools/ast-grep/tools.d.ts +34 -34
- package/dist/tools/index.d.ts +28 -28
- package/dist/tools/lsp/tools.d.ts +2 -2
- package/package.json +14 -5
- package/dist/ast-grep-napi.darwin-arm64-qa3xn4vh.node +0 -0
- package/dist/index.js +0 -15726
package/README.en.md
CHANGED
|
@@ -3,6 +3,9 @@ English | [한국어](README.ko.md)
|
|
|
3
3
|
## Contents
|
|
4
4
|
|
|
5
5
|
- [Oh My OpenCode](#oh-my-opencode)
|
|
6
|
+
- [Installation](#installation)
|
|
7
|
+
- [Configuration](#configuration)
|
|
8
|
+
- [Disable specific MCPs](#disable-specific-mcps)
|
|
6
9
|
- [TL;DR](#tldr)
|
|
7
10
|
- [Why OpenCode \& Why Oh My OpenCode](#why-opencode--why-oh-my-opencode)
|
|
8
11
|
- [Features](#features)
|
|
@@ -12,6 +15,7 @@ English | [한국어](README.ko.md)
|
|
|
12
15
|
- [Built-in LSP Tools](#built-in-lsp-tools)
|
|
13
16
|
- [Built-in AST-Grep Tools](#built-in-ast-grep-tools)
|
|
14
17
|
- [Safe Grep](#safe-grep)
|
|
18
|
+
- [Built-in MCPs](#built-in-mcps)
|
|
15
19
|
- [Other Features](#other-features)
|
|
16
20
|
- [Author's Note](#authors-note)
|
|
17
21
|
- [Warnings](#warnings)
|
|
@@ -29,6 +33,51 @@ You don't write code just for a paycheck? You write because you genuinely love i
|
|
|
29
33
|
|
|
30
34
|
To you, OpenCode will feel like the paradigm shift from Windows to Linux. Not you? It's still worth the investment. Give it 10 minutes. Your work and life will improve. I promise.
|
|
31
35
|
|
|
36
|
+
## Installation
|
|
37
|
+
|
|
38
|
+
Add to `~/.config/opencode/opencode.json`:
|
|
39
|
+
|
|
40
|
+
```json
|
|
41
|
+
{
|
|
42
|
+
"plugin": [
|
|
43
|
+
"oh-my-opencode"
|
|
44
|
+
]
|
|
45
|
+
}
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
## Configuration
|
|
49
|
+
|
|
50
|
+
You can configure Oh My OpenCode by creating a `oh-my-opencode.json` (or `.oh-my-opencode.json`) file in your project root.
|
|
51
|
+
|
|
52
|
+
### JSON Schema Support
|
|
53
|
+
|
|
54
|
+
For autocompletion and validation in VS Code (or other editors), add the `$schema` property to your configuration file.
|
|
55
|
+
|
|
56
|
+
**Using Remote Schema (Recommended):**
|
|
57
|
+
```json
|
|
58
|
+
{
|
|
59
|
+
"$schema": "https://raw.githubusercontent.com/code-yeongyu/oh-my-opencode/master/dist/oh-my-opencode.schema.json",
|
|
60
|
+
"disabled_mcps": ["context7"]
|
|
61
|
+
}
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
**Using Local Schema:**
|
|
65
|
+
```json
|
|
66
|
+
{
|
|
67
|
+
"$schema": "./node_modules/oh-my-opencode/dist/oh-my-opencode.schema.json"
|
|
68
|
+
}
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
### Disable specific MCPs
|
|
72
|
+
|
|
73
|
+
If you want to disable specific built-in MCPs, you can use the `disabled_mcps` option.
|
|
74
|
+
|
|
75
|
+
```json
|
|
76
|
+
{
|
|
77
|
+
"disabled_mcps": ["context7", "websearch_exa"]
|
|
78
|
+
}
|
|
79
|
+
```
|
|
80
|
+
|
|
32
81
|
## TL;DR
|
|
33
82
|
|
|
34
83
|
- **Model Setup Required**
|
|
@@ -65,6 +114,8 @@ I believe in the right tool for the job. For your wallet's sake, use CLIProxyAPI
|
|
|
65
114
|
- **Todo Continuation Enforcer**: Forces the agent to complete all tasks before exiting. Eliminates the common LLM issue of "giving up halfway".
|
|
66
115
|
- **Context Window Monitor**: Implements [Context Window Anxiety Management](https://agentic-patterns.com/patterns/context-window-anxiety-management/). When context usage exceeds 70%, it reminds the agent that resources are sufficient, preventing rushed or low-quality output.
|
|
67
116
|
- **Session Notification**: Sends a native OS notification when the job is done (macOS, Linux, Windows).
|
|
117
|
+
- **Session Recovery**: Automatically recovers from API errors by injecting missing tool results and correcting thinking block violations, ensuring session stability.
|
|
118
|
+
- **Comment Checker**: Detects and reports unnecessary comments after code modifications. Smartly ignores valid patterns (BDD, directives, docstrings, shebangs) to keep the codebase clean from AI-generated artifacts.
|
|
68
119
|
|
|
69
120
|
### Agents
|
|
70
121
|
- **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.
|
|
@@ -103,6 +154,11 @@ I believe in the right tool for the job. For your wallet's sake, use CLIProxyAPI
|
|
|
103
154
|
- `safe_grep` enforces strict limits.
|
|
104
155
|
- **Note**: Default `grep` is disabled to prevent Agent confusion. `safe_grep` delivers full `grep` functionality with safety assurance.
|
|
105
156
|
|
|
157
|
+
#### Built-in MCPs
|
|
158
|
+
|
|
159
|
+
- **websearch_exa**: Exa AI web search. Performs real-time web searches and can scrape content from specific URLs. Returns LLM-optimized context from relevant websites.
|
|
160
|
+
- **context7**: Library documentation lookup. Fetches up-to-date documentation for any library to assist with accurate coding.
|
|
161
|
+
|
|
106
162
|
### Other Features
|
|
107
163
|
|
|
108
164
|
- **Terminal Title**: Auto-updates terminal title with session status (idle ○, processing ◐, tool ⚡, error ✖). Supports tmux.
|
|
@@ -128,13 +184,8 @@ If this sounds arrogant and you have a superior solution, send a PR. You are wel
|
|
|
128
184
|
|
|
129
185
|
As of now, I have no affiliation with any of the projects or models mentioned here. This plugin is purely based on personal experimentation and preference.
|
|
130
186
|
|
|
187
|
+
I constructed 99% of this project using OpenCode. I focused on functional verification. This documentation has been personally reviewed and comprehensively rewritten, so you can rely on it with confidence.
|
|
131
188
|
## Warnings
|
|
132
189
|
|
|
133
190
|
- If you are on [1.0.132](https://github.com/sst/opencode/releases/tag/v1.0.132) or lower, OpenCode has a bug that might break config.
|
|
134
191
|
- [The fix](https://github.com/sst/opencode/pull/5040) was merged after 1.0.132, so use a newer version.
|
|
135
|
-
|
|
136
|
-
- I constructed 99% of this project using OpenCode. I focused on functional verification. This documentation has been personally reviewed and comprehensively rewritten, so you can rely on it with confidence.
|
|
137
|
-
|
|
138
|
-
---
|
|
139
|
-
|
|
140
|
-
I currently don't have access to my NPM account. I'll update this section as soon as I get it back.
|
package/README.ko.md
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
## 목차
|
|
4
4
|
|
|
5
5
|
- [Oh My OpenCode](#oh-my-opencode)
|
|
6
|
+
- [설치](#설치)
|
|
6
7
|
- [세 줄 요약](#세-줄-요약)
|
|
7
8
|
- [Why OpenCode \& Why Oh My OpenCode](#why-opencode--why-oh-my-opencode)
|
|
8
9
|
- [기능](#기능)
|
|
@@ -12,6 +13,7 @@
|
|
|
12
13
|
- [내장 LSP Tools](#내장-lsp-tools)
|
|
13
14
|
- [내장 AST-Grep Tools](#내장-ast-grep-tools)
|
|
14
15
|
- [Safe Grep](#safe-grep)
|
|
16
|
+
- [내장 MCPs](#내장-mcps)
|
|
15
17
|
- [기타 편의 기능](#기타-편의-기능)
|
|
16
18
|
- [작성자의 노트](#작성자의-노트)
|
|
17
19
|
- [주의](#주의)
|
|
@@ -31,6 +33,18 @@ OpenCode 가 낭만이 사라진것같은 오늘날의 시대에, 당신에게
|
|
|
31
33
|
당신이 코딩을 좋아하고 컴퓨터를 좋아한다면, OpenCode 는 윈도우만 사용하다가 리눅스를 처음 접하게 된 그런 느낌일겁니다.
|
|
32
34
|
그렇지 않은 당신도 약간의 시간을 투자해서 당신의 실력과 생산성을 몇배로 부스트하세요.
|
|
33
35
|
|
|
36
|
+
## 설치
|
|
37
|
+
|
|
38
|
+
`~/.config/opencode/opencode.json`에 추가:
|
|
39
|
+
|
|
40
|
+
```json
|
|
41
|
+
{
|
|
42
|
+
"plugin": [
|
|
43
|
+
"oh-my-opencode"
|
|
44
|
+
]
|
|
45
|
+
}
|
|
46
|
+
```
|
|
47
|
+
|
|
34
48
|
## 세 줄 요약
|
|
35
49
|
|
|
36
50
|
- **모델 설정이 필요합니다**
|
|
@@ -69,6 +83,7 @@ OpenCode 는 아주 확장가능하고 아주 커스터마이저블합니다.
|
|
|
69
83
|
- **Context Window Monitor**: [컨텍스트 윈도우 불안 관리](https://agentic-patterns.com/patterns/context-window-anxiety-management/) 패턴을 구현합니다.
|
|
70
84
|
- 사용량이 70%를 넘으면 에이전트에게 아직 토큰이 충분하다고 상기시켜, 급하게 불완전한 작업을 하는 것을 완화합니다.
|
|
71
85
|
- **Session Notification**: 에이전트가 작업을 마치면 OS 네이티브 알림을 보냅니다 (macOS, Linux, Windows).
|
|
86
|
+
- **Comment Checker**: 코드 수정 후 불필요한 주석을 감지하여 보고합니다. BDD 패턴, 지시어, 독스트링 등 유효한 주석은 똑똑하게 제외하고, AI가 남긴 흔적을 제거하여 코드를 깨끗하게 유지합니다.
|
|
72
87
|
|
|
73
88
|
### Agents
|
|
74
89
|
|
|
@@ -106,6 +121,10 @@ OpenCode 는 아주 확장가능하고 아주 커스터마이저블합니다.
|
|
|
106
121
|
- safe_grep 은 timeout 과 더 엄격한 출력 제한을 적용합니다.
|
|
107
122
|
- **주의**: 기본 grep 도구는 Agent 를 햇갈리게 하지 않기 위해 비활성화됩니다. 그러나 SafeGrep 은 Grep 이 제공하는 모든 기능을 제공합니다.
|
|
108
123
|
|
|
124
|
+
#### 내장 MCPs
|
|
125
|
+
|
|
126
|
+
- **websearch_exa**: Exa AI 웹 검색. 실시간 웹 검색과 콘텐츠 스크래핑을 수행합니다. 관련 웹사이트에서 LLM에 최적화된 컨텍스트를 반환합니다.
|
|
127
|
+
|
|
109
128
|
### 기타 편의 기능
|
|
110
129
|
- **Terminal Title**: 세션 상태에 따라 터미널 타이틀을 자동 업데이트합니다 (유휴 ○, 처리중 ◐, 도구 ⚡, 에러 ✖). tmux를 지원합니다.
|
|
111
130
|
|
|
@@ -135,6 +154,4 @@ OpenCode 를 사용하여 이 프로젝트의 99% 를 작성했습니다. 기능
|
|
|
135
154
|
- [1.0.132](https://github.com/sst/opencode/releases/tag/v1.0.132) 혹은 이것보다 낮은 버전을 사용중이라면, OpenCode 의 버그로 인해 제대로 구성이 되지 않을 수 있습니다.
|
|
136
155
|
- [이를 고치는 PR 이 1.0.132 배포 이후에 병합되었으므로](https://github.com/sst/opencode/pull/5040) 이 변경사항이 포함된 최신 버전을 사용해주세요.
|
|
137
156
|
|
|
138
|
-
---
|
|
139
157
|
|
|
140
|
-
현재 NPM 계정에 접근할 수 없습니다. 계정이 복구되는 대로 이 내용을 업데이트하겠습니다.
|
package/dist/agents/index.d.ts
CHANGED
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { AgentConfig } from "@opencode-ai/sdk";
|
|
2
|
+
export type AgentName = "oracle" | "librarian" | "explore" | "frontend-ui-ux-engineer" | "document-writer";
|
|
3
|
+
export type AgentOverrideConfig = Partial<AgentConfig>;
|
|
4
|
+
export type AgentOverrides = Partial<Record<AgentName, AgentOverrideConfig>>;
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const AgentNameSchema: z.ZodEnum<{
|
|
3
|
+
oracle: "oracle";
|
|
4
|
+
librarian: "librarian";
|
|
5
|
+
explore: "explore";
|
|
6
|
+
"frontend-ui-ux-engineer": "frontend-ui-ux-engineer";
|
|
7
|
+
"document-writer": "document-writer";
|
|
8
|
+
}>;
|
|
9
|
+
export declare const McpNameSchema: z.ZodEnum<{
|
|
10
|
+
websearch_exa: "websearch_exa";
|
|
11
|
+
context7: "context7";
|
|
12
|
+
}>;
|
|
13
|
+
export declare const AgentOverrideConfigSchema: z.ZodObject<{
|
|
14
|
+
model: z.ZodOptional<z.ZodString>;
|
|
15
|
+
temperature: z.ZodOptional<z.ZodNumber>;
|
|
16
|
+
top_p: z.ZodOptional<z.ZodNumber>;
|
|
17
|
+
prompt: z.ZodOptional<z.ZodString>;
|
|
18
|
+
tools: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodBoolean>>;
|
|
19
|
+
disable: z.ZodOptional<z.ZodBoolean>;
|
|
20
|
+
description: z.ZodOptional<z.ZodString>;
|
|
21
|
+
mode: z.ZodOptional<z.ZodEnum<{
|
|
22
|
+
subagent: "subagent";
|
|
23
|
+
primary: "primary";
|
|
24
|
+
all: "all";
|
|
25
|
+
}>>;
|
|
26
|
+
color: z.ZodOptional<z.ZodString>;
|
|
27
|
+
permission: z.ZodOptional<z.ZodObject<{
|
|
28
|
+
edit: z.ZodOptional<z.ZodEnum<{
|
|
29
|
+
ask: "ask";
|
|
30
|
+
allow: "allow";
|
|
31
|
+
deny: "deny";
|
|
32
|
+
}>>;
|
|
33
|
+
bash: z.ZodOptional<z.ZodUnion<readonly [z.ZodEnum<{
|
|
34
|
+
ask: "ask";
|
|
35
|
+
allow: "allow";
|
|
36
|
+
deny: "deny";
|
|
37
|
+
}>, z.ZodRecord<z.ZodString, z.ZodEnum<{
|
|
38
|
+
ask: "ask";
|
|
39
|
+
allow: "allow";
|
|
40
|
+
deny: "deny";
|
|
41
|
+
}>>]>>;
|
|
42
|
+
webfetch: z.ZodOptional<z.ZodEnum<{
|
|
43
|
+
ask: "ask";
|
|
44
|
+
allow: "allow";
|
|
45
|
+
deny: "deny";
|
|
46
|
+
}>>;
|
|
47
|
+
doom_loop: z.ZodOptional<z.ZodEnum<{
|
|
48
|
+
ask: "ask";
|
|
49
|
+
allow: "allow";
|
|
50
|
+
deny: "deny";
|
|
51
|
+
}>>;
|
|
52
|
+
external_directory: z.ZodOptional<z.ZodEnum<{
|
|
53
|
+
ask: "ask";
|
|
54
|
+
allow: "allow";
|
|
55
|
+
deny: "deny";
|
|
56
|
+
}>>;
|
|
57
|
+
}, z.core.$strip>>;
|
|
58
|
+
}, z.core.$strip>;
|
|
59
|
+
export declare const AgentOverridesSchema: z.ZodRecord<z.ZodEnum<{
|
|
60
|
+
oracle: "oracle";
|
|
61
|
+
librarian: "librarian";
|
|
62
|
+
explore: "explore";
|
|
63
|
+
"frontend-ui-ux-engineer": "frontend-ui-ux-engineer";
|
|
64
|
+
"document-writer": "document-writer";
|
|
65
|
+
}>, z.ZodObject<{
|
|
66
|
+
model: z.ZodOptional<z.ZodString>;
|
|
67
|
+
temperature: z.ZodOptional<z.ZodNumber>;
|
|
68
|
+
top_p: z.ZodOptional<z.ZodNumber>;
|
|
69
|
+
prompt: z.ZodOptional<z.ZodString>;
|
|
70
|
+
tools: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodBoolean>>;
|
|
71
|
+
disable: z.ZodOptional<z.ZodBoolean>;
|
|
72
|
+
description: z.ZodOptional<z.ZodString>;
|
|
73
|
+
mode: z.ZodOptional<z.ZodEnum<{
|
|
74
|
+
subagent: "subagent";
|
|
75
|
+
primary: "primary";
|
|
76
|
+
all: "all";
|
|
77
|
+
}>>;
|
|
78
|
+
color: z.ZodOptional<z.ZodString>;
|
|
79
|
+
permission: z.ZodOptional<z.ZodObject<{
|
|
80
|
+
edit: z.ZodOptional<z.ZodEnum<{
|
|
81
|
+
ask: "ask";
|
|
82
|
+
allow: "allow";
|
|
83
|
+
deny: "deny";
|
|
84
|
+
}>>;
|
|
85
|
+
bash: z.ZodOptional<z.ZodUnion<readonly [z.ZodEnum<{
|
|
86
|
+
ask: "ask";
|
|
87
|
+
allow: "allow";
|
|
88
|
+
deny: "deny";
|
|
89
|
+
}>, z.ZodRecord<z.ZodString, z.ZodEnum<{
|
|
90
|
+
ask: "ask";
|
|
91
|
+
allow: "allow";
|
|
92
|
+
deny: "deny";
|
|
93
|
+
}>>]>>;
|
|
94
|
+
webfetch: z.ZodOptional<z.ZodEnum<{
|
|
95
|
+
ask: "ask";
|
|
96
|
+
allow: "allow";
|
|
97
|
+
deny: "deny";
|
|
98
|
+
}>>;
|
|
99
|
+
doom_loop: z.ZodOptional<z.ZodEnum<{
|
|
100
|
+
ask: "ask";
|
|
101
|
+
allow: "allow";
|
|
102
|
+
deny: "deny";
|
|
103
|
+
}>>;
|
|
104
|
+
external_directory: z.ZodOptional<z.ZodEnum<{
|
|
105
|
+
ask: "ask";
|
|
106
|
+
allow: "allow";
|
|
107
|
+
deny: "deny";
|
|
108
|
+
}>>;
|
|
109
|
+
}, z.core.$strip>>;
|
|
110
|
+
}, z.core.$strip>>;
|
|
111
|
+
export declare const OhMyOpenCodeConfigSchema: z.ZodObject<{
|
|
112
|
+
$schema: z.ZodOptional<z.ZodString>;
|
|
113
|
+
disabled_mcps: z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
114
|
+
websearch_exa: "websearch_exa";
|
|
115
|
+
context7: "context7";
|
|
116
|
+
}>>>;
|
|
117
|
+
disabled_agents: z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
118
|
+
oracle: "oracle";
|
|
119
|
+
librarian: "librarian";
|
|
120
|
+
explore: "explore";
|
|
121
|
+
"frontend-ui-ux-engineer": "frontend-ui-ux-engineer";
|
|
122
|
+
"document-writer": "document-writer";
|
|
123
|
+
}>>>;
|
|
124
|
+
agents: z.ZodOptional<z.ZodRecord<z.ZodEnum<{
|
|
125
|
+
oracle: "oracle";
|
|
126
|
+
librarian: "librarian";
|
|
127
|
+
explore: "explore";
|
|
128
|
+
"frontend-ui-ux-engineer": "frontend-ui-ux-engineer";
|
|
129
|
+
"document-writer": "document-writer";
|
|
130
|
+
}>, z.ZodObject<{
|
|
131
|
+
model: z.ZodOptional<z.ZodString>;
|
|
132
|
+
temperature: z.ZodOptional<z.ZodNumber>;
|
|
133
|
+
top_p: z.ZodOptional<z.ZodNumber>;
|
|
134
|
+
prompt: z.ZodOptional<z.ZodString>;
|
|
135
|
+
tools: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodBoolean>>;
|
|
136
|
+
disable: z.ZodOptional<z.ZodBoolean>;
|
|
137
|
+
description: z.ZodOptional<z.ZodString>;
|
|
138
|
+
mode: z.ZodOptional<z.ZodEnum<{
|
|
139
|
+
subagent: "subagent";
|
|
140
|
+
primary: "primary";
|
|
141
|
+
all: "all";
|
|
142
|
+
}>>;
|
|
143
|
+
color: z.ZodOptional<z.ZodString>;
|
|
144
|
+
permission: z.ZodOptional<z.ZodObject<{
|
|
145
|
+
edit: z.ZodOptional<z.ZodEnum<{
|
|
146
|
+
ask: "ask";
|
|
147
|
+
allow: "allow";
|
|
148
|
+
deny: "deny";
|
|
149
|
+
}>>;
|
|
150
|
+
bash: z.ZodOptional<z.ZodUnion<readonly [z.ZodEnum<{
|
|
151
|
+
ask: "ask";
|
|
152
|
+
allow: "allow";
|
|
153
|
+
deny: "deny";
|
|
154
|
+
}>, z.ZodRecord<z.ZodString, z.ZodEnum<{
|
|
155
|
+
ask: "ask";
|
|
156
|
+
allow: "allow";
|
|
157
|
+
deny: "deny";
|
|
158
|
+
}>>]>>;
|
|
159
|
+
webfetch: z.ZodOptional<z.ZodEnum<{
|
|
160
|
+
ask: "ask";
|
|
161
|
+
allow: "allow";
|
|
162
|
+
deny: "deny";
|
|
163
|
+
}>>;
|
|
164
|
+
doom_loop: z.ZodOptional<z.ZodEnum<{
|
|
165
|
+
ask: "ask";
|
|
166
|
+
allow: "allow";
|
|
167
|
+
deny: "deny";
|
|
168
|
+
}>>;
|
|
169
|
+
external_directory: z.ZodOptional<z.ZodEnum<{
|
|
170
|
+
ask: "ask";
|
|
171
|
+
allow: "allow";
|
|
172
|
+
deny: "deny";
|
|
173
|
+
}>>;
|
|
174
|
+
}, z.core.$strip>>;
|
|
175
|
+
}, z.core.$strip>>>;
|
|
176
|
+
}, z.core.$strip>;
|
|
177
|
+
export type OhMyOpenCodeConfig = z.infer<typeof OhMyOpenCodeConfigSchema>;
|
|
178
|
+
export type AgentOverrideConfig = z.infer<typeof AgentOverrideConfigSchema>;
|
|
179
|
+
export type AgentOverrides = z.infer<typeof AgentOverridesSchema>;
|
|
180
|
+
export type McpName = z.infer<typeof McpNameSchema>;
|
|
181
|
+
export type AgentName = z.infer<typeof AgentNameSchema>;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare const EXTENSION_TO_LANGUAGE: Record<string, string>;
|
|
2
|
+
export declare const QUERY_TEMPLATES: Record<string, string>;
|
|
3
|
+
export declare const DOCSTRING_QUERIES: Record<string, string>;
|
|
4
|
+
export declare const BDD_KEYWORDS: Set<string>;
|
|
5
|
+
export declare const TYPE_CHECKER_PREFIXES: string[];
|
|
6
|
+
export declare const HOOK_MESSAGE_HEADER = "COMMENT/DOCSTRING DETECTED - IMMEDIATE ACTION REQUIRED\n\nYour recent changes contain comments or docstrings, which triggered this hook.\nYou need to take immediate action. You must follow the conditions below.\n(Listed in priority order - you must always act according to this priority order)\n\nCRITICAL WARNING: This hook message MUST NEVER be ignored, even if you receive it multiple times.\nYou MUST provide corresponding explanation or action for EACH occurrence of this message.\nIgnoring this message or failing to respond appropriately is strictly prohibited.\n\nPRIORITY-BASED ACTION GUIDELINES:\n\n1. This is a comment/docstring that already existed before\n\t-> Explain to the user that this is an existing comment/docstring and proceed (justify it)\n\n2. This is a newly written comment: but it's in given, when, then format\n\t-> Tell the user it's a BDD comment and proceed (justify it)\n\t-> Note: This applies to comments only, not docstrings\n\n3. This is a newly written comment/docstring: but it's a necessary comment/docstring\n\t-> Tell the user why this comment/docstring is absolutely necessary and proceed (justify it)\n\t-> Examples of necessary comments: complex algorithms, security-related, performance optimization, regex, mathematical formulas\n\t-> Examples of necessary docstrings: public API documentation, complex module/class interfaces\n\t-> IMPORTANT: Most docstrings are unnecessary if the code is self-explanatory. Only keep truly essential ones.\n\n4. This is a newly written comment/docstring: but it's an unnecessary comment/docstring\n\t-> Apologize to the user and remove the comment/docstring.\n\t-> Make the code itself clearer so it can be understood without comments/docstrings.\n\t-> For verbose docstrings: refactor code to be self-documenting instead of adding lengthy explanations.\n\nMANDATORY REQUIREMENT: You must acknowledge this hook message and take one of the above actions.\nReview in the above priority order and take the corresponding action EVERY TIME this appears.\n\nDetected comments/docstrings:\n";
|
|
7
|
+
export declare function getLanguageByExtension(filePath: string): string | null;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { CommentInfo } from "../types";
|
|
2
|
+
import { filterBddComments } from "./bdd";
|
|
3
|
+
import { filterDirectiveComments } from "./directive";
|
|
4
|
+
import { filterDocstringComments } from "./docstring";
|
|
5
|
+
import { filterShebangComments } from "./shebang";
|
|
6
|
+
export { filterBddComments, filterDirectiveComments, filterDocstringComments, filterShebangComments };
|
|
7
|
+
export declare function applyFilters(comments: CommentInfo[]): CommentInfo[];
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export declare function createCommentCheckerHooks(): {
|
|
2
|
+
"tool.execute.before": (input: {
|
|
3
|
+
tool: string;
|
|
4
|
+
sessionID: string;
|
|
5
|
+
callID: string;
|
|
6
|
+
}, output: {
|
|
7
|
+
args: Record<string, unknown>;
|
|
8
|
+
}) => Promise<void>;
|
|
9
|
+
"tool.execute.after": (input: {
|
|
10
|
+
tool: string;
|
|
11
|
+
sessionID: string;
|
|
12
|
+
callID: string;
|
|
13
|
+
}, output: {
|
|
14
|
+
title: string;
|
|
15
|
+
output: string;
|
|
16
|
+
metadata: unknown;
|
|
17
|
+
}) => Promise<void>;
|
|
18
|
+
};
|
|
19
|
+
export * from "./types";
|
|
20
|
+
export * from "./constants";
|
|
21
|
+
export * from "./detector";
|
|
22
|
+
export * from "./filters";
|
|
23
|
+
export * from "./output";
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export type CommentType = "line" | "block" | "docstring";
|
|
2
|
+
export interface CommentInfo {
|
|
3
|
+
text: string;
|
|
4
|
+
lineNumber: number;
|
|
5
|
+
filePath: string;
|
|
6
|
+
commentType: CommentType;
|
|
7
|
+
isDocstring: boolean;
|
|
8
|
+
metadata?: Record<string, string>;
|
|
9
|
+
}
|
|
10
|
+
export interface LanguageConfig {
|
|
11
|
+
extensions: string[];
|
|
12
|
+
commentQuery: string;
|
|
13
|
+
docstringQuery?: string;
|
|
14
|
+
}
|
|
15
|
+
export interface PendingCall {
|
|
16
|
+
filePath: string;
|
|
17
|
+
content?: string;
|
|
18
|
+
tool: "write" | "edit" | "multiedit";
|
|
19
|
+
sessionID: string;
|
|
20
|
+
timestamp: number;
|
|
21
|
+
}
|
|
22
|
+
export interface FileComments {
|
|
23
|
+
filePath: string;
|
|
24
|
+
comments: CommentInfo[];
|
|
25
|
+
}
|
|
26
|
+
export interface FilterResult {
|
|
27
|
+
shouldSkip: boolean;
|
|
28
|
+
reason?: string;
|
|
29
|
+
}
|
|
30
|
+
export type CommentFilter = (comment: CommentInfo) => FilterResult;
|
package/dist/hooks/index.d.ts
CHANGED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Session Recovery - Message State Error Recovery
|
|
3
|
+
*
|
|
4
|
+
* Handles THREE specific scenarios:
|
|
5
|
+
* 1. tool_use block exists without tool_result
|
|
6
|
+
* - Recovery: inject tool_result with "cancelled" content
|
|
7
|
+
*
|
|
8
|
+
* 2. Thinking block order violation (first block must be thinking)
|
|
9
|
+
* - Recovery: prepend empty thinking block
|
|
10
|
+
*
|
|
11
|
+
* 3. Thinking disabled but message contains thinking blocks
|
|
12
|
+
* - Recovery: strip thinking/redacted_thinking blocks
|
|
13
|
+
*/
|
|
14
|
+
import type { PluginInput } from "@opencode-ai/plugin";
|
|
15
|
+
interface MessageInfo {
|
|
16
|
+
id?: string;
|
|
17
|
+
role?: string;
|
|
18
|
+
sessionID?: string;
|
|
19
|
+
parentID?: string;
|
|
20
|
+
error?: unknown;
|
|
21
|
+
}
|
|
22
|
+
export declare function createSessionRecoveryHook(ctx: PluginInput): {
|
|
23
|
+
handleSessionRecovery: (info: MessageInfo) => Promise<boolean>;
|
|
24
|
+
isRecoverableError: (error: unknown) => boolean;
|
|
25
|
+
setOnAbortCallback: (callback: (sessionID: string) => void) => void;
|
|
26
|
+
};
|
|
27
|
+
export {};
|
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
1
|
import type { Plugin } from "@opencode-ai/plugin";
|
|
2
2
|
declare const OhMyOpenCodePlugin: Plugin;
|
|
3
3
|
export default OhMyOpenCodePlugin;
|
|
4
|
+
export { OhMyOpenCodeConfigSchema } from "./config";
|
|
5
|
+
export type { OhMyOpenCodeConfig, AgentName, AgentOverrideConfig, AgentOverrides, McpName, } from "./config";
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export type McpName = "websearch_exa" | "context7";
|
|
2
|
+
export declare function createBuiltinMcps(disabledMcps?: McpName[]): Record<string, {
|
|
3
|
+
type: "remote";
|
|
4
|
+
url: string;
|
|
5
|
+
enabled: boolean;
|
|
6
|
+
}>;
|
|
7
|
+
export declare const builtinMcps: Record<McpName, {
|
|
8
|
+
type: "remote";
|
|
9
|
+
url: string;
|
|
10
|
+
enabled: boolean;
|
|
11
|
+
}>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare const SG_CLI_PATH
|
|
1
|
+
export declare const SG_CLI_PATH: string;
|
|
2
2
|
export declare const CLI_LANGUAGES: readonly ["bash", "c", "cpp", "csharp", "css", "elixir", "go", "haskell", "html", "java", "javascript", "json", "kotlin", "lua", "nix", "php", "python", "ruby", "rust", "scala", "solidity", "swift", "typescript", "tsx", "yaml"];
|
|
3
3
|
export declare const NAPI_LANGUAGES: readonly ["html", "javascript", "tsx", "css", "typescript"];
|
|
4
4
|
export declare const LANG_EXTENSIONS: Record<string, string[]>;
|