@wwkit/harness 1.0.47 → 1.0.49

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 (77) hide show
  1. package/package.json +4 -5
  2. package/skills/query/SKILL.md +0 -72
  3. package/skills/read-docs/SKILL.md +0 -134
  4. package/skills/read-docs/references/opencode/agents/cases.md +0 -206
  5. package/skills/read-docs/references/opencode/agents/design-pattern.md +0 -47
  6. package/skills/read-docs/references/opencode/agents/detail.md +0 -191
  7. package/skills/read-docs/references/opencode/agents/examples.md +0 -100
  8. package/skills/read-docs/references/opencode/agents/index.md +0 -309
  9. package/skills/read-docs/references/opencode/agents/parallel-dispatch.md +0 -149
  10. package/skills/read-docs/references/opencode/agents/subagent-internals.md +0 -217
  11. package/skills/read-docs/references/opencode/agents/workflow.md +0 -161
  12. package/skills/read-docs/references/opencode/cli/commands/acp.md +0 -32
  13. package/skills/read-docs/references/opencode/cli/commands/agent.md +0 -16
  14. package/skills/read-docs/references/opencode/cli/commands/attach.md +0 -20
  15. package/skills/read-docs/references/opencode/cli/commands/mcp.md +0 -37
  16. package/skills/read-docs/references/opencode/cli/commands/others.md +0 -49
  17. package/skills/read-docs/references/opencode/cli/commands/plugin.md +0 -13
  18. package/skills/read-docs/references/opencode/cli/commands/provider.md +0 -44
  19. package/skills/read-docs/references/opencode/cli/commands/run.md +0 -81
  20. package/skills/read-docs/references/opencode/cli/commands/serve.md +0 -84
  21. package/skills/read-docs/references/opencode/cli/commands/session.md +0 -38
  22. package/skills/read-docs/references/opencode/cli/commands/web.md +0 -15
  23. package/skills/read-docs/references/opencode/cli/env.md +0 -39
  24. package/skills/read-docs/references/opencode/cli/index.md +0 -19
  25. package/skills/read-docs/references/opencode/cli/tui.md +0 -35
  26. package/skills/read-docs/references/opencode/commands/examples.md +0 -42
  27. package/skills/read-docs/references/opencode/commands/index.md +0 -185
  28. package/skills/read-docs/references/opencode/config/provider.md +0 -152
  29. package/skills/read-docs/references/opencode/formatter/index.md +0 -71
  30. package/skills/read-docs/references/opencode/guide/config.md +0 -419
  31. package/skills/read-docs/references/opencode/guide/formatters.md +0 -70
  32. package/skills/read-docs/references/opencode/guide/index.md +0 -37
  33. package/skills/read-docs/references/opencode/guide/providers.md +0 -31
  34. package/skills/read-docs/references/opencode/guide/rules.md +0 -63
  35. package/skills/read-docs/references/opencode/plugins/examples.md +0 -75
  36. package/skills/read-docs/references/opencode/plugins/index.md +0 -188
  37. package/skills/read-docs/references/opencode/reference/index.md +0 -119
  38. package/skills/read-docs/references/opencode/rule/index.md +0 -78
  39. package/skills/read-docs/references/opencode/skills/detail.md +0 -113
  40. package/skills/read-docs/references/opencode/skills/examples.md +0 -141
  41. package/skills/read-docs/references/opencode/skills/index.md +0 -126
  42. package/skills/read-docs/references/opencode/skills/workflow.md +0 -146
  43. package/skills/read-docs/references/opencode/tests/agent.md +0 -10
  44. package/skills/read-docs/references/opencode/tests/config.md +0 -60
  45. package/skills/read-docs/references/opencode/tests/file.md +0 -12
  46. package/skills/read-docs/references/opencode/tests/serve.md +0 -18
  47. package/skills/read-docs/references/opencode/tests/session.md +0 -31
  48. package/skills/read-docs/references/opencode/tests/web.md +0 -17
  49. package/skills/read-docs/references/opencode/tools/arguments.md +0 -305
  50. package/skills/read-docs/references/opencode/tools/context.md +0 -18
  51. package/skills/read-docs/references/opencode/tools/custom.md +0 -111
  52. package/skills/read-docs/references/opencode/tools/detail.md +0 -104
  53. package/skills/read-docs/references/opencode/tools/examples.md +0 -71
  54. package/skills/read-docs/references/opencode/tools/index.md +0 -56
  55. package/skills/read-docs/references/opencode/tools/lsp.md +0 -26
  56. package/skills/read-docs/references/opencode/tools/mcp.md +0 -132
  57. package/skills/read-docs/references/opencode/train/README.md +0 -135
  58. package/skills/read-docs/references/opencode/train/agent-basic.md +0 -772
  59. package/skills/read-docs/references/opencode/train/command-basic.md +0 -668
  60. package/skills/read-docs/references/opencode/train/config-basic.md +0 -509
  61. package/skills/read-docs/references/opencode/train/index.md +0 -164
  62. package/skills/read-docs/references/opencode/train/practice.md +0 -873
  63. package/skills/read-docs/references/opencode/train/skill-basic.md +0 -608
  64. package/skills/read-docs/references/opencode/tui/commands/config.md +0 -32
  65. package/skills/read-docs/references/opencode/tui/commands/editor.md +0 -47
  66. package/skills/read-docs/references/opencode/tui/commands/index.md +0 -125
  67. package/skills/read-docs/references/opencode/tui/commands/init.md +0 -5
  68. package/skills/read-docs/references/opencode/tui/index.md +0 -26
  69. package/skills/read-docs/references/superpowers/bootstrap.md +0 -107
  70. package/skills/read-docs/references/superpowers/comparison.md +0 -77
  71. package/skills/read-docs/references/superpowers/context.md +0 -71
  72. package/skills/read-docs/references/superpowers/index.md +0 -58
  73. package/skills/read-docs/references/superpowers/parallel.md +0 -49
  74. package/skills/read-docs/references/superpowers/sdd.md +0 -183
  75. package/skills/read-docs/references/superpowers/skills.md +0 -68
  76. package/skills/read-docs/references/superpowers/workflow.md +0 -83
  77. package/skills/step-extract/SKILL.md +0 -205
@@ -1,84 +0,0 @@
1
- # serve
2
- Start a headless OpenCode server for API access without the TUI interface.
3
- ```
4
- opencode serve [--port <number>] [--hostname <string>] [--cors <origin>]
5
-
6
- opencode serve --cors http://localhost:5173 --cors https://app.example.com
7
- ```
8
-
9
- ## Flags
10
- - `--port` : Port to listen on, default `4096`
11
- - `--hostname` : Hostname to listen on, default `127.0.0.1`
12
- - `--mdns` : Enable mDNS discovery, default `false`
13
- - `--mdns-domain` : Custom mDNS domain name, default `opencode.local`
14
- - `--cors` : Additional browser origin to allow CORS, defualt `[]`
15
- - can be passed multiple time
16
-
17
- ## Authentication
18
- Set `OPENCODE_SERVER_PASSWORD` to protect the server with HTTP basic auth.
19
- - The username defaults to `opencode`, or set `OPENCODE_SERVER_USERNAME` to override it.
20
- - This applies to both `opencode serve` and `opencode web`.
21
-
22
- ```
23
- OPENCODE_SERVER_PASSWORD=your-password opencode serve
24
- ```
25
-
26
- ## How it works
27
- When you run opencode it starts a TUI and a server. You can run opencode serve to start a standalone server.
28
-
29
- #### Connect to an existing server
30
- When you start the TUI it randomly assigns a port and hostname. You can instead pass in the `--hostname` and `--port` flags. Then use this to connect to its server.
31
-
32
- ## Spec
33
- The server publishes an OpenAPI 3.1 spec that can be viewed at:
34
- ```
35
- http://<hostname>:<port>/doc
36
- ```
37
-
38
- For example, http://localhost:4096/doc. Use the spec to generate clients or inspect request and response types. Or view it in a Swagger explorer.
39
-
40
- ## APIs
41
- The opencode server exposes the following APIs.
42
-
43
- ### Global
44
- - `/global/health` : Get server health and version, `{healthy:true,version:string}`
45
- - `/global/event` : Get global events (SSE stream)
46
-
47
- ### Project
48
- - `/project` : list all projects, `Project[]`
49
- - `/project/current` : Get the current project, `Project`
50
-
51
- ### Path & VCS
52
- - `/path` : Get the current path, `Path`
53
- - `/vcs` : Get VCS info for the current project, `VcsInfo`
54
-
55
- ### Instance
56
- - `/instance/dispose` : Dispose the current instance, `boolean`
57
-
58
- ## Config
59
-
60
- ## Provider
61
-
62
- ## Sessions
63
-
64
- ## Messages
65
-
66
- ## Commands
67
-
68
- ## Files
69
-
70
- ## Tools
71
-
72
- ## LSP
73
-
74
- ## Agents
75
-
76
- ## Logging
77
-
78
- ## TUI
79
-
80
- ## Auth
81
-
82
- ## Evetns
83
-
84
- ## Docs
@@ -1,38 +0,0 @@
1
- # session
2
- Manage sessions
3
- ```
4
- // list all sessions
5
- opencode session list
6
-
7
- // delete an session
8
- opencode session delete <sessionID>
9
- ```
10
-
11
- ## Flags:
12
- - `--max-count` `-n` : limit to N most recent sessions
13
- - `--format` : Output format : table or json
14
-
15
- # export
16
- Export session data as JSON
17
- ```
18
- opencode export [sessionID]
19
-
20
- # write to a file
21
- opencode export ses_0cadb81d5ffernOJ0n2SD1FZ6S > ses_0cadb81d5ffernOJ0n2SD1FZ6S.json
22
- ```
23
- If you don’t provide a session ID, you’ll be prompted to select from available sessions.
24
-
25
- ## Flags
26
- - `--sanitize` : Redact sensitive transcript/file data
27
-
28
- # import
29
- Import session data from a JSON file or share URL.
30
- ```
31
- opencode import <file>
32
-
33
- // local file
34
- opencode import session.json
35
-
36
- // share url
37
- opencode import https://opncd.ai/s/abc123
38
- ```
@@ -1,15 +0,0 @@
1
- # web
2
- Start a headless OpenCode server with a web interface.
3
- ```
4
- opencode web
5
- ```
6
- This starts an HTTP server and opens a web browser to access OpenCode through a web interface.
7
-
8
- Set `OPENCODE_SERVER_PASSWORD` to enable HTTP basic auth (username defaults to `opencode`).
9
-
10
- ## Flags
11
- - `--port` : Port to listen on
12
- - `--hostname` : Hostname to listen on
13
- - `--mdns`
14
- - `--mdns-domain`
15
- - `--cors`
@@ -1,39 +0,0 @@
1
- # Environment variables
2
- OpenCode can be configured using environment variables.
3
-
4
- ## path
5
- - `OPENCODE_GIT_BASH_PATH` : `string` Path to git bash executable on Windows
6
- - `OPENCODE_TUI_CONFIG` : `string` Path to TUI config file
7
- - `OPENCODE_CONFIG` : `string` Path to config file
8
- - `OPENCODE_CONFIG_DIR` : `string` Path to config directory
9
- - `OPENCODE_MODELS_URL` : `string` Custom URL for fetching models configuration
10
-
11
- 设置`OPENCODE_CONFIG`的会与全局`~/.config/opencode`合并。
12
-
13
- ## config
14
- - `OPENCODE_CONFIG_CONTENT` : `string` Inline json config content
15
- - `OPENCODE_PERMISSION` : `string` Inline json permission config
16
-
17
- ## session
18
- - `OPENCODE_AUTO_SHARE` : `boolean` Automatically share sessions
19
-
20
- ## server
21
- - `OPENCODE_SERVER_PASSWORD` : `string` Enable basic auth for serve/web
22
- - `OPENCODE_SERVER_USERNAME` : `string` Override basic auth username (default opencode)
23
-
24
- ## enable
25
- - `OPENCODE_ENABLE_EXPERIMENTAL_MODELS` : `boolean` Enable experimental models
26
- - `OPENCODE_ENABLE_EXA` : `boolean` Enable Exa web search tools
27
-
28
- ## disable
29
- - `OPENCODE_DISABLE_AUTOUPDATE` : `boolean` Disable automatic udpate checks
30
- - `OPENCODE_DISABLE_PRUNE` : `boolean` Disable pruning of old data
31
- - `OPENCODE_DISABLE_TERMINAL_TITLE` : `boolean` Disable automatic terminal title updates
32
- - `OPENCODE_DISABLE_DEFAULT_PLUGINS` : `boolean` Disable default plugins
33
- - `OPENCODE_DISABLE_LSP_DOWNLOAD` : `boolean` Disable automatic LSP server downloads
34
- - `OPENCODE_DISABLE_AUTOCOMPACT` : `boolean` Disable automatic context compaction
35
- - `OPENCODE_DISABLE_CLAUDE_CODE` : `boolean` Disable reading from `.claude` (prompt + skills)
36
- - `OPENCODE_DISABLE_CLAUDE_CODE_PROMPT` : `boolean` Disable reading `~/.claude/CLAUDE.md`
37
- - `OPENCODE_DISABLE_CLAUDE_CODE_SKILLS` : `boolean` Disable loading `.claude/skills`
38
- - `OPENCODE_DISABLE_MODELS_FETCH` : `boolean` Disable fetching models from remote sources
39
- - `OPENCODE_DISABLE_MOUSE` : `boolean` Disable mouse capture in the TUI
@@ -1,19 +0,0 @@
1
- # CLI
2
- OpenCode CLI options and commands.
3
-
4
- The OpenCode CLI by default starts the TUI when run without any arguments.
5
- ```
6
- opencode
7
- ```
8
-
9
- But it also accepts commands as documented on this page. This allows you to interact with OpenCode programmatically.
10
- ```
11
- opencode run "Explain how closures work in JavaScript"
12
- ```
13
-
14
- ## Global Flags
15
- - `--help` `-h` : Display help
16
- - `--version` `-v` : Print version number
17
- - `--print-logs` : Print logs to stderr
18
- - `--log-level` : Log Level, DEBUG,INFO,WARN,ERROR
19
- - `--pure` : Run without external plugins
@@ -1,35 +0,0 @@
1
- # TUI
2
- The OpenCode CLI by default starts the TUI when run without any arguments.
3
- ```
4
- opencode
5
- ```
6
-
7
- ## Flags
8
- - `--continue` `-c` : Continue the last session
9
- - `--session` `-s` : Session ID to continue
10
- - `--model` `-m` : Model to use in the form of `provider/model`
11
- - `--agent` : Agent to use
12
- - `--auto` : Auto-approve permissions that are not explicitly denied
13
-
14
- ### --auto
15
- 结合 opencode.json 中的 permission 配置理解:
16
- ```json
17
- {
18
- "permission": {
19
- "skill": { "*": "allow" }, // 技能调用:全部允许
20
- "agent": { "*": "allow" }, // Agent 调用:全部允许
21
- "command": { "*": "deny" } // 命令执行:拒绝
22
- }
23
- }
24
- ```
25
- - permission 中设为 "allow" 的 → 始终自动批准
26
- - permission 中设为 "deny" 的 → 始终拒绝
27
- - 未在 permission 中配置的 → 默认需手动确认,但 --auto 会将其自动批准
28
- 简单说:--auto = 免确认模式,适合自动化流水线或信任当前操作环境的场景。
29
-
30
- ### web服务配置
31
- - `--hostname 0.0.0.0` : Hostname to listen on,默认`localhost`仅本机可访问
32
- - `--port 8081` : Port to listen on, 默认`3000`
33
- - `--mdns` : 启动 mDNS 局域网,默认关闭
34
- - `--mdns-domain opencode.local` : 自定义mDNS域名
35
- - `--cors http://myapp.com` : 允许跨域浏览器来源,,默认仅本机
@@ -1,42 +0,0 @@
1
- # 命令示例
2
-
3
- ## review — 代码审查
4
-
5
- 位置:`.opencode/command/review.md`,执行:`/review src/main.ts`
6
-
7
- ```md
8
- ---
9
- description: 审查指定文件的代码质量
10
- agent: plan
11
- ---
12
- @$1
13
- 请审查这个文件的代码质量,重点关注:
14
- 1. 代码规范和命名
15
- 2. 潜在 Bug
16
- 3. 性能问题
17
- 4. 可维护性
18
- ```
19
-
20
- ## commit — 生成提交消息
21
-
22
- ```md
23
- ---
24
- description: 根据变更生成 Commit 消息
25
- ---
26
- 根据以下变更生成 commit 消息:
27
- !`git diff --staged`
28
- 要求:
29
- - 遵循 Conventional Commits 规范
30
- - 简洁明了,说明"为什么"而非"做了什么"
31
- ```
32
-
33
- ## translate — 翻译为中文
34
-
35
- ```md
36
- ---
37
- description: 翻译为中文
38
- subtask: true
39
- ---
40
- 请将以下内容翻译为中文:
41
- $ARGUMENTS
42
- ```
@@ -1,185 +0,0 @@
1
- # 命令(Commands)
2
-
3
- 自定义命令让你在 TUI 中执行预设的提示词:
4
-
5
- ```
6
- /my-command
7
- ```
8
-
9
- 可以通过 OpenCode 配置或在 `commands/` 目录创建 Markdown 文件添加自定义命令。
10
-
11
- ## 创建命令文件
12
-
13
- 在 `commands/` 目录创建 Markdown 文件:
14
-
15
- - 全局:`~/.config/opencode/commands/`
16
- - 项目级:`.opencode/commands/`
17
-
18
- ```md
19
- ---
20
- description: Run tests with coverage
21
- agent: build
22
- model: anthropic/claude-3-5-sonnet-20241022
23
- ---
24
-
25
- Run the full test suite with coverage report and show any failures.
26
- Focus on the failing tests and suggest fixes.
27
- ```
28
-
29
- Frontmatter 定义命令属性,正文内容成为模板。
30
-
31
- 使用命令:
32
-
33
- ```
34
- /test
35
- ```
36
-
37
- ## 提示词配置
38
-
39
- ### 参数传递
40
-
41
- 使用 `$ARGUMENTS` 占位符传递参数:
42
-
43
- ```md
44
- ---
45
- description: Create a new component
46
- ---
47
-
48
- Create a new React component named $ARGUMENTS with TypeScript support.
49
- Include proper typing and basic structure.
50
- ```
51
-
52
- 运行:
53
-
54
- ```
55
- /component Button
56
- ```
57
-
58
- 使用位置参数:
59
-
60
- - `$1`:第一个参数
61
- - `$2`:第二个参数
62
- - 以此类推
63
-
64
- ```md
65
- ---
66
- description: Create a new file with content
67
- ---
68
-
69
- Create a file named $1 in the directory $2
70
- with the following content: $3
71
- ```
72
-
73
- 运行:
74
-
75
- ```
76
- /create-file config.json src "{ \"key\": \"value\" }"
77
- ```
78
-
79
- ### Shell 输出
80
-
81
- 使用 `` !`command` `` 注入 bash 命令输出:
82
-
83
- ```md
84
- ---
85
- description: Analyze test coverage
86
- ---
87
-
88
- Here are the current test results:
89
- !`npm test`
90
-
91
- Based on these results, suggest improvements to increase coverage.
92
- ```
93
-
94
- ### 文件引用
95
-
96
- 使用 `@` 引用文件:
97
-
98
- ```md
99
- ---
100
- description: Review component
101
- ---
102
-
103
- Review the component in @src/components/Button.tsx.
104
- Check for performance issues and suggest improvements.
105
- ```
106
-
107
- ## 配置选项
108
-
109
- ### Template(必需)
110
-
111
- 定义命令执行时发送给 LLM 的提示词:
112
-
113
- ```json
114
- {
115
- "command": {
116
- "test": {
117
- "template": "Run the full test suite with coverage report and show any failures.\nFocus on the failing tests and suggest fixes."
118
- }
119
- }
120
- }
121
- ```
122
-
123
- ### Description
124
-
125
- 命令的简要描述,在 TUI 中输入命令时显示:
126
-
127
- ```jsonc
128
- {
129
- "command": {
130
- "test": {
131
- "description": "Run tests with coverage"
132
- }
133
- }
134
- }
135
- ```
136
-
137
- ### Agent
138
-
139
- 指定执行此命令的 Agent(可选,默认为当前 Agent):
140
-
141
- ```jsonc
142
- {
143
- "command": {
144
- "review": {
145
- "agent": "plan"
146
- }
147
- }
148
- }
149
- ```
150
-
151
- ### Subtask
152
-
153
- 强制命令触发子代理调用:
154
-
155
- ```jsonc
156
- {
157
- "command": {
158
- "analyze": {
159
- "subtask": true
160
- }
161
- }
162
- }
163
- ```
164
-
165
- ### Model
166
-
167
- 覆盖命令的默认模型:
168
-
169
- ```jsonc
170
- {
171
- "command": {
172
- "analyze": {
173
- "model": "anthropic/claude-3-5-sonnet-20241022"
174
- }
175
- }
176
- }
177
- ```
178
-
179
- ## 内置命令
180
-
181
- OpenCode 包含以下内置命令:`/init`、`/undo`、`/redo`、`/share`、`/help`。
182
-
183
- ## 更多内容
184
-
185
- - [命令示例](/commands/examples) — 实用命令示例
@@ -1,152 +0,0 @@
1
- # Providers
2
- To add a provider you need to:
3
- - Add the API keys for the provider using the `/connect` command.
4
- - Configure the provider in your OpenCode config.
5
-
6
- ## Credentials
7
- When you add a provider’s API keys with the `/connect` command, they are stored in `~/.local/share/opencode/auth.json`.
8
-
9
- ## Config
10
- You can customize the providers through the provider section in your OpenCode config.
11
-
12
- ### Base URL
13
- You can customize the base URL for any provider by setting the baseURL option.
14
- - This is useful when using proxy services or custom endpoints.
15
-
16
- ```json
17
- {
18
- "$schema": "https://opencode.ai/config.json",
19
- "provider": {
20
- "anthropic": {
21
- "options": {
22
- "baseURL": "https://api.anthropic.com/v1"
23
- }
24
- }
25
- }
26
- }
27
- ```
28
-
29
- ### Hiding models
30
- Both options take an array of model IDs — the same IDs shown in the `/models` picker.
31
- - `blacklist` removes the listed models from the picker.
32
- - `whitelist` keeps only the listed models and hides the rest.
33
-
34
- You can combine them: whitelist narrows the set, then blacklist removes entries from it.
35
- ```json
36
- {
37
- "$schema": "https://opencode.ai/config.json",
38
- "provider": {
39
- "anthropic": {
40
- "blacklist": ["claude-opus-4-20250514"],
41
- "whitelist": ["claude-sonnet-4-20250514"]
42
- }
43
- }
44
- }
45
- ```
46
-
47
- ## OpenCode Zen
48
- OpenCode Zen is a list of models provided by the OpenCode team that have been tested and verified to work well with OpenCode.
49
-
50
-
51
- Run the /connect command in the TUI, select OpenCode Zen, and head to opencode.ai/auth.
52
- ```
53
- /connect
54
- ```
55
-
56
- Run /models in the TUI to see the list of models we recommend.
57
- ```
58
- /models
59
- ```
60
-
61
- ## OpenCode Go
62
- OpenCode Go is a low cost subscription plan that provides reliable access to popular open coding models provided by the OpenCode team that have been tested and verified to work well with OpenCode.
63
-
64
-
65
- ## Custom provider
66
- To add any OpenAI-compatible provider that’s not listed in the /connect command.
67
-
68
- Create or update your opencode.json file in your project directory:
69
- ```json
70
- {
71
- "$schema": "https://opencode.ai/config.json",
72
- "provider": {
73
- "myprovider": {
74
- "npm": "@ai-sdk/openai-compatible",
75
- "name": "My AI ProviderDisplay Name",
76
- "options": {
77
- "baseURL": "https://api.myprovider.com/v1"
78
- },
79
- "models": {
80
- "my-model-name": {
81
- "name": "My Model Display Name"
82
- }
83
- }
84
- }
85
- }
86
- }
87
- ```
88
-
89
- Configuration options:
90
- - npm: AI SDK package to use:
91
- - `@ai-sdk/openai-compatible` for OpenAI-compatible providers (for `/v1/chat/completions`).
92
- - `@ai-sdk/openai` for `/v1/responses`
93
- - name: Display name in UI.
94
- - models: Available models.
95
- - options.baseURL: API endpoint URL.
96
- - options.apiKey: Optionally set the API key, if not using auth.
97
- - support `env` variable syntax
98
- - options.headers: Optionally set custom headers.
99
- - limit.context: Maximum input tokens the model accepts.
100
- - limit.output: Maximum tokens the model can generate.
101
-
102
- ### Demo 1:
103
- ```json
104
- {
105
- "$schema": "https://opencode.ai/config.json",
106
- "provider": {
107
- "llmproxy": {
108
- "npm": "@ai-sdk/openai-compatible",
109
- "name": "llmproxy",
110
- "options": {
111
- "baseURL": "http://127.0.0.1:31943/v1",
112
- "apiKey": "sk-123",
113
- "headers":{}
114
- },
115
- "models": {
116
- "MiniMax-M2.7": {
117
- "name": "MiniMax-M2.7"
118
- },
119
- }
120
- }
121
- },
122
- }
123
- ```
124
-
125
- ### Demo 2:
126
- ```json
127
- {
128
- "$schema": "https://opencode.ai/config.json",
129
- "provider": {
130
- "myprovider": {
131
- "npm": "@ai-sdk/openai-compatible",
132
- "name": "My AI ProviderDisplay Name",
133
- "options": {
134
- "baseURL": "https://api.myprovider.com/v1",
135
- "apiKey": "{env:ANTHROPIC_API_KEY}",
136
- "headers": {
137
- "Authorization": "Bearer custom-token"
138
- }
139
- },
140
- "models": {
141
- "my-model-name": {
142
- "name": "My Model Display Name",
143
- "limit": {
144
- "context": 200000,
145
- "output": 65536
146
- }
147
- }
148
- }
149
- }
150
- }
151
- }
152
- ```
@@ -1,71 +0,0 @@
1
- # Formatters
2
- OpenCode can format files after they are written or edited using language-specific formatters.
3
-
4
- > Formatters are disabled by default; enable them in your config before OpenCode will run them.
5
-
6
- ## Built-in
7
- OpenCode comes with several built-in formatters for popular languages and frameworks.
8
- - `prettier` : .js, .jsx, .ts, .tsx, .html, .css, .md, .json, .yaml
9
- - `uv` : .py, .pyi
10
- - `shfmt` : .sh, .bash
11
- - `pint` : .php
12
-
13
- ## How it works
14
- When OpenCode writes or edits a file and formatters are enabled, it:
15
-
16
- 1. Checks the file extension against all enabled formatters.
17
- 2. Runs the appropriate formatter command on the file.
18
- 3. Applies the formatting changes.
19
-
20
- This process happens in the background for enabled formatters.
21
-
22
- ## Configure
23
- You can enable and customize formatters through the formatter section in your OpenCode config.
24
-
25
- To enable all built-in formatters, set formatter to true.
26
- ```
27
- {
28
- "$schema": "https://opencode.ai/config.json",
29
- "formatter": true
30
- }
31
- ```
32
-
33
- Each formatter configuration supports the following:
34
- - `disabled` : `boolean` Set this to true to disable the formatter
35
- - `command` : `string[]` The command to run for formatting.
36
- - Required for custom formatters;
37
- - optional for built-ins.
38
- - `environment` : `object` Environment variables to set when running the formatter
39
- - `extensions` : `string[]` File extensions this formatter should handle
40
-
41
- ```json
42
- {
43
- "$schema": "https://opencode.ai/config.json",
44
- "formatter": {
45
- "prettier": {
46
- "disabled": true
47
- }
48
- }
49
- }
50
- ```
51
-
52
- ## Custom formatters
53
- The `$FILE` placeholder in the command will be replaced with the path to the file being formatted.
54
- ```json
55
- {
56
- "$schema": "https://opencode.ai/config.json",
57
- "formatter": {
58
- "prettier": {
59
- "command": ["npx", "prettier", "--write", "$FILE"],
60
- "environment": {
61
- "NODE_ENV": "development"
62
- },
63
- "extensions": [".js", ".ts", ".jsx", ".tsx"]
64
- },
65
- "custom-markdown-formatter": {
66
- "command": ["deno", "fmt", "$FILE"],
67
- "extensions": [".md"]
68
- }
69
- }
70
- }
71
- ```