fix: externalize @ast-grep/napi for cross-platform support, add installation docs
This commit is contained in:
92
AGENTS.md
Normal file
92
AGENTS.md
Normal file
@@ -0,0 +1,92 @@
|
|||||||
|
# PROJECT KNOWLEDGE BASE
|
||||||
|
|
||||||
|
**Generated:** 2025-12-05T01:16:20+09:00
|
||||||
|
**Commit:** 6c9a2ee
|
||||||
|
**Branch:** master
|
||||||
|
|
||||||
|
## OVERVIEW
|
||||||
|
|
||||||
|
OpenCode plugin distribution implementing Claude Code/AmpCode features. Provides multi-model agent orchestration, LSP tools, AST-Grep search, and safe-grep utilities.
|
||||||
|
|
||||||
|
## STRUCTURE
|
||||||
|
|
||||||
|
```
|
||||||
|
oh-my-opencode/
|
||||||
|
├── src/
|
||||||
|
│ ├── agents/ # AI agent definitions (oracle, librarian, explore, etc.)
|
||||||
|
│ ├── hooks/ # Plugin lifecycle hooks
|
||||||
|
│ ├── tools/ # LSP, AST-Grep, Safe-Grep tool implementations
|
||||||
|
│ │ ├── lsp/ # 11 LSP tools (hover, definition, references, etc.)
|
||||||
|
│ │ ├── ast-grep/ # AST-aware code search
|
||||||
|
│ │ └── safe-grep/ # Safe grep with limits
|
||||||
|
│ └── features/ # Terminal features
|
||||||
|
├── dist/ # Build output (bun + tsc declarations)
|
||||||
|
└── test-rule.yml # AST-Grep test rules
|
||||||
|
```
|
||||||
|
|
||||||
|
## WHERE TO LOOK
|
||||||
|
|
||||||
|
| Task | Location | Notes |
|
||||||
|
|------|----------|-------|
|
||||||
|
| Add new agent | `src/agents/` | Export from index.ts |
|
||||||
|
| Add new hook | `src/hooks/` | Export from index.ts |
|
||||||
|
| Add new tool | `src/tools/` | Follow lsp/ pattern: index, types, tools, utils |
|
||||||
|
| Modify LSP behavior | `src/tools/lsp/` | client.ts for connection logic |
|
||||||
|
| AST-Grep patterns | `src/tools/ast-grep/` | napi.ts for @ast-grep/napi |
|
||||||
|
| Terminal features | `src/features/terminal/` | title.ts |
|
||||||
|
|
||||||
|
## CONVENTIONS
|
||||||
|
|
||||||
|
- **Package manager**: Bun only (not npm/yarn)
|
||||||
|
- **Build**: Dual output - `bun build` + `tsc --emitDeclarationOnly`
|
||||||
|
- **Types**: bun-types (not @types/node)
|
||||||
|
- **Exports**: Barrel pattern - `export * from "./module"` in index.ts
|
||||||
|
- **Module structure**: index.ts, types.ts, constants.ts, utils.ts, tools.ts per tool
|
||||||
|
|
||||||
|
## ANTI-PATTERNS (THIS PROJECT)
|
||||||
|
|
||||||
|
- **Bash file operations**: Never use mkdir/touch/rm/cp/mv for file creation
|
||||||
|
- **npm/yarn**: Use bun exclusively
|
||||||
|
- **@types/node**: Use bun-types instead
|
||||||
|
- **Generic AI aesthetics**: No Space Grotesk, avoid typical AI-generated UI patterns
|
||||||
|
- **Rush completion**: Never mark tasks complete without verification
|
||||||
|
- **Interrupting work**: Complete tasks fully before stopping
|
||||||
|
|
||||||
|
## UNIQUE STYLES
|
||||||
|
|
||||||
|
- **Directory naming**: kebab-case (`ast-grep/`, `safe-grep/`)
|
||||||
|
- **Tool organization**: Each tool has cli.ts, constants.ts, index.ts, napi.ts/tools.ts, types.ts, utils.ts
|
||||||
|
- **Platform handling**: Union type `"darwin" | "linux" | "win32" | "unsupported"`
|
||||||
|
- **Error handling**: Consistent try/catch with async/await
|
||||||
|
- **Optional props**: Extensive use of `?` for optional interface properties
|
||||||
|
- **Flexible objects**: `Record<string, unknown>` for dynamic configs
|
||||||
|
|
||||||
|
## AGENT MODELS
|
||||||
|
|
||||||
|
| Agent | Model | Purpose |
|
||||||
|
|-------|-------|---------|
|
||||||
|
| oracle | GPT-5.1 | Code review, strategic planning |
|
||||||
|
| librarian | Claude Haiku | Documentation, example lookup |
|
||||||
|
| explore | Grok | File/codebase exploration |
|
||||||
|
| frontend-ui-ux-engineer | Gemini | UI generation |
|
||||||
|
| document-writer | Gemini | Documentation writing |
|
||||||
|
|
||||||
|
## COMMANDS
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Type check
|
||||||
|
bun run typecheck
|
||||||
|
|
||||||
|
# Build
|
||||||
|
bun run build
|
||||||
|
|
||||||
|
# Clean + Build
|
||||||
|
bun run rebuild
|
||||||
|
```
|
||||||
|
|
||||||
|
## NOTES
|
||||||
|
|
||||||
|
- **No tests**: Test framework not configured
|
||||||
|
- **No CI/CD**: GitHub workflows not present
|
||||||
|
- **Version requirement**: OpenCode >= 1.0.132 (earlier versions have config bugs)
|
||||||
|
- **Multi-language docs**: README.md, README.en.md, README.ko.md
|
||||||
15
README.en.md
15
README.en.md
@@ -3,6 +3,7 @@ English | [한국어](README.ko.md)
|
|||||||
## Contents
|
## Contents
|
||||||
|
|
||||||
- [Oh My OpenCode](#oh-my-opencode)
|
- [Oh My OpenCode](#oh-my-opencode)
|
||||||
|
- [Installation](#installation)
|
||||||
- [TL;DR](#tldr)
|
- [TL;DR](#tldr)
|
||||||
- [Why OpenCode \& Why Oh My OpenCode](#why-opencode--why-oh-my-opencode)
|
- [Why OpenCode \& Why Oh My OpenCode](#why-opencode--why-oh-my-opencode)
|
||||||
- [Features](#features)
|
- [Features](#features)
|
||||||
@@ -29,6 +30,18 @@ You don't write code just for a paycheck? You write because you genuinely love i
|
|||||||
|
|
||||||
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.
|
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.
|
||||||
|
|
||||||
|
## Installation
|
||||||
|
|
||||||
|
Add to `~/.config/opencode/opencode.json`:
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"plugin": [
|
||||||
|
"oh-my-opencode"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
## TL;DR
|
## TL;DR
|
||||||
|
|
||||||
- **Model Setup Required**
|
- **Model Setup Required**
|
||||||
@@ -135,6 +148,4 @@ As of now, I have no affiliation with any of the projects or models mentioned he
|
|||||||
|
|
||||||
- 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.
|
- 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.
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
I currently don't have access to my NPM account. I'll update this section as soon as I get it back.
|
|
||||||
|
|||||||
15
README.ko.md
15
README.ko.md
@@ -3,6 +3,7 @@
|
|||||||
## 목차
|
## 목차
|
||||||
|
|
||||||
- [Oh My OpenCode](#oh-my-opencode)
|
- [Oh My OpenCode](#oh-my-opencode)
|
||||||
|
- [설치](#설치)
|
||||||
- [세 줄 요약](#세-줄-요약)
|
- [세 줄 요약](#세-줄-요약)
|
||||||
- [Why OpenCode \& Why Oh My OpenCode](#why-opencode--why-oh-my-opencode)
|
- [Why OpenCode \& Why Oh My OpenCode](#why-opencode--why-oh-my-opencode)
|
||||||
- [기능](#기능)
|
- [기능](#기능)
|
||||||
@@ -31,6 +32,18 @@ OpenCode 가 낭만이 사라진것같은 오늘날의 시대에, 당신에게
|
|||||||
당신이 코딩을 좋아하고 컴퓨터를 좋아한다면, OpenCode 는 윈도우만 사용하다가 리눅스를 처음 접하게 된 그런 느낌일겁니다.
|
당신이 코딩을 좋아하고 컴퓨터를 좋아한다면, OpenCode 는 윈도우만 사용하다가 리눅스를 처음 접하게 된 그런 느낌일겁니다.
|
||||||
그렇지 않은 당신도 약간의 시간을 투자해서 당신의 실력과 생산성을 몇배로 부스트하세요.
|
그렇지 않은 당신도 약간의 시간을 투자해서 당신의 실력과 생산성을 몇배로 부스트하세요.
|
||||||
|
|
||||||
|
## 설치
|
||||||
|
|
||||||
|
`~/.config/opencode/opencode.json`에 추가:
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"plugin": [
|
||||||
|
"oh-my-opencode"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
## 세 줄 요약
|
## 세 줄 요약
|
||||||
|
|
||||||
- **모델 설정이 필요합니다**
|
- **모델 설정이 필요합니다**
|
||||||
@@ -135,6 +148,4 @@ OpenCode 를 사용하여 이 프로젝트의 99% 를 작성했습니다. 기능
|
|||||||
- [1.0.132](https://github.com/sst/opencode/releases/tag/v1.0.132) 혹은 이것보다 낮은 버전을 사용중이라면, OpenCode 의 버그로 인해 제대로 구성이 되지 않을 수 있습니다.
|
- [1.0.132](https://github.com/sst/opencode/releases/tag/v1.0.132) 혹은 이것보다 낮은 버전을 사용중이라면, OpenCode 의 버그로 인해 제대로 구성이 되지 않을 수 있습니다.
|
||||||
- [이를 고치는 PR 이 1.0.132 배포 이후에 병합되었으므로](https://github.com/sst/opencode/pull/5040) 이 변경사항이 포함된 최신 버전을 사용해주세요.
|
- [이를 고치는 PR 이 1.0.132 배포 이후에 병합되었으므로](https://github.com/sst/opencode/pull/5040) 이 변경사항이 포함된 최신 버전을 사용해주세요.
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
현재 NPM 계정에 접근할 수 없습니다. 계정이 복구되는 대로 이 내용을 업데이트하겠습니다.
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "oh-my-opencode",
|
"name": "oh-my-opencode",
|
||||||
"version": "0.0.0",
|
"version": "0.1.0",
|
||||||
"description": "OpenCode plugin - custom agents (oracle, librarian) and enhanced features",
|
"description": "OpenCode plugin - custom agents (oracle, librarian) and enhanced features",
|
||||||
"main": "dist/index.js",
|
"main": "dist/index.js",
|
||||||
"types": "dist/index.d.ts",
|
"types": "dist/index.d.ts",
|
||||||
@@ -15,7 +15,7 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "bun build src/index.ts --outdir dist --target bun --format esm && tsc --emitDeclarationOnly",
|
"build": "bun build src/index.ts --outdir dist --target bun --format esm --external @ast-grep/napi && tsc --emitDeclarationOnly",
|
||||||
"clean": "rm -rf dist",
|
"clean": "rm -rf dist",
|
||||||
"prepublishOnly": "bun run clean && bun run build",
|
"prepublishOnly": "bun run clean && bun run build",
|
||||||
"typecheck": "tsc --noEmit"
|
"typecheck": "tsc --noEmit"
|
||||||
|
|||||||
Reference in New Issue
Block a user