@wwkit/harness 1.0.33 → 1.0.34

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 (202) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +128 -128
  3. package/agents/scrum.md +206 -186
  4. package/agents/sprint.md +130 -121
  5. package/bin/index.js +291 -226
  6. package/commands/fix.md +87 -87
  7. package/commands/git-sync.md +217 -217
  8. package/commands/net-port.md +364 -364
  9. package/commands/pytest.md +10 -10
  10. package/commands/resume.md +104 -104
  11. package/commands/tl.md +11 -11
  12. package/commands/tsl.md +12 -0
  13. package/package.json +5 -4
  14. package/plugin.js +19 -19
  15. package/readme/development.md +39 -39
  16. package/readme/publish.md +41 -41
  17. package/readme/testing.md +44 -44
  18. package/scripts/postinstall.js +58 -58
  19. package/skills/better-skill/SKILL.md +192 -124
  20. package/skills/blame-skill/SKILL.md +148 -201
  21. package/skills/blame-skill/references/scoring-rules.md +190 -0
  22. package/skills/blame-sprint-agent/SKILL.md +167 -0
  23. package/skills/blame-sprint-agent/references/scoring-rules.md +113 -0
  24. package/skills/blame-sprint-skill/SKILL.md +154 -0
  25. package/skills/blame-sprint-skill/references/scoring-rules.md +101 -0
  26. package/skills/extract/SKILL.md +119 -119
  27. package/skills/extract/references/build-xpath.js +30 -30
  28. package/skills/extract/references/clean-html.js +90 -90
  29. package/skills/extract/references/detail.md +54 -54
  30. package/skills/extract/references/detail.schema.json5 +48 -48
  31. package/skills/extract/references/extract-detail.js +71 -71
  32. package/skills/extract/references/extract-regex.js +81 -81
  33. package/skills/extract/references/extract-sample.js +48 -48
  34. package/skills/extract/references/list-rule-gen.md +109 -109
  35. package/skills/extract/references/list.md +134 -134
  36. package/skills/extract/references/list.schema.json5 +33 -33
  37. package/skills/extract/references/navi.md +44 -44
  38. package/skills/extract/references/navi.schema.json5 +23 -23
  39. package/skills/extract/references/text.md +40 -40
  40. package/skills/extract/references/text.schema.json5 +21 -21
  41. package/skills/extract/references/to-text.js +20 -20
  42. package/skills/extract/references/validate-schema.js +39 -39
  43. package/skills/jstest/SKILL.md +561 -561
  44. package/skills/jstest/references/case-create.md +327 -327
  45. package/skills/jstest/references/case-fix.md +273 -273
  46. package/skills/jstest/references/config.md +148 -148
  47. package/skills/jstest/references/coverage-analyze.md +247 -247
  48. package/skills/jstest/references/env-ensure.md +210 -210
  49. package/skills/jstest/references/execute.md +168 -168
  50. package/skills/jstest/references/sample.md +166 -166
  51. package/skills/jstest/references/scoring-rules.md +75 -75
  52. package/skills/jstest/references/src/jstest-sample/Calculator.js +80 -80
  53. package/skills/jstest/references/src/jstest-sample/ConfigManager.js +72 -72
  54. package/skills/jstest/references/src/jstest-sample/FileProcessor.js +57 -57
  55. package/skills/jstest/references/src/jstest-sample/OrderService.js +98 -98
  56. package/skills/jstest/references/src/jstest-sample/TokenGenerator.js +60 -60
  57. package/skills/jstest/references/src/jstest-sample/UserService.js +56 -56
  58. package/skills/jstest/references/src/jstest-sample/index.js +6 -6
  59. package/skills/jstest/references/suitability-check.md +232 -232
  60. package/skills/jstest/references/test-standards.md +288 -288
  61. package/skills/lint/SKILL.md +440 -440
  62. package/skills/lint/references/ai-fix.md +137 -137
  63. package/skills/lint/references/config-setup.md +102 -102
  64. package/skills/lint/references/config.md +65 -65
  65. package/skills/lint/references/detect-language.js +65 -65
  66. package/skills/lint/references/env-ensure.md +88 -88
  67. package/skills/lint/references/language-detect.md +75 -75
  68. package/skills/lint/references/languages/js.md +110 -110
  69. package/skills/lint/references/languages/py.md +89 -89
  70. package/skills/lint/references/rules-analyze.md +125 -125
  71. package/skills/lint/references/suitability-check.md +81 -81
  72. package/skills/lint/references/tool-fix.md +90 -90
  73. package/skills/new-skill/SKILL.md +193 -227
  74. package/skills/pytest/SKILL.md +555 -555
  75. package/skills/pytest/references/case-create.md +324 -324
  76. package/skills/pytest/references/case-fix.md +271 -271
  77. package/skills/pytest/references/config.md +145 -145
  78. package/skills/pytest/references/coverage-analyze.md +223 -223
  79. package/skills/pytest/references/env-ensure.md +195 -195
  80. package/skills/pytest/references/execute.md +152 -152
  81. package/skills/pytest/references/sample.md +159 -159
  82. package/skills/pytest/references/scoring-rules.md +57 -57
  83. package/skills/pytest/references/src/pytest-sample/Calculator.py +67 -67
  84. package/skills/pytest/references/src/pytest-sample/ConfigManager.py +68 -68
  85. package/skills/pytest/references/src/pytest-sample/FileProcessor.py +53 -53
  86. package/skills/pytest/references/src/pytest-sample/OrderService.py +82 -82
  87. package/skills/pytest/references/src/pytest-sample/TokenGenerator.py +50 -50
  88. package/skills/pytest/references/src/pytest-sample/UserService.py +45 -45
  89. package/skills/pytest/references/suitability-check.md +220 -220
  90. package/skills/pytest/references/test-standards.md +244 -244
  91. package/skills/query/SKILL.md +71 -71
  92. package/skills/read-docs/SKILL.md +134 -134
  93. package/skills/read-docs/references/opencode/agents/cases.md +206 -206
  94. package/skills/read-docs/references/opencode/agents/design-pattern.md +47 -47
  95. package/skills/read-docs/references/opencode/agents/detail.md +191 -191
  96. package/skills/read-docs/references/opencode/agents/examples.md +100 -100
  97. package/skills/read-docs/references/opencode/agents/index.md +309 -309
  98. package/skills/read-docs/references/opencode/agents/parallel-dispatch.md +149 -149
  99. package/skills/read-docs/references/opencode/agents/subagent-internals.md +217 -217
  100. package/skills/read-docs/references/opencode/agents/workflow.md +161 -161
  101. package/skills/read-docs/references/opencode/cli/commands/acp.md +31 -31
  102. package/skills/read-docs/references/opencode/cli/commands/agent.md +16 -16
  103. package/skills/read-docs/references/opencode/cli/commands/attach.md +20 -20
  104. package/skills/read-docs/references/opencode/cli/commands/mcp.md +37 -37
  105. package/skills/read-docs/references/opencode/cli/commands/others.md +48 -48
  106. package/skills/read-docs/references/opencode/cli/commands/plugin.md +12 -12
  107. package/skills/read-docs/references/opencode/cli/commands/provider.md +43 -43
  108. package/skills/read-docs/references/opencode/cli/commands/run.md +81 -81
  109. package/skills/read-docs/references/opencode/cli/commands/serve.md +84 -84
  110. package/skills/read-docs/references/opencode/cli/commands/session.md +37 -37
  111. package/skills/read-docs/references/opencode/cli/commands/web.md +14 -14
  112. package/skills/read-docs/references/opencode/cli/env.md +38 -38
  113. package/skills/read-docs/references/opencode/cli/index.md +18 -18
  114. package/skills/read-docs/references/opencode/cli/tui.md +35 -35
  115. package/skills/read-docs/references/opencode/commands/examples.md +42 -42
  116. package/skills/read-docs/references/opencode/commands/index.md +185 -185
  117. package/skills/read-docs/references/opencode/config/provider.md +151 -151
  118. package/skills/read-docs/references/opencode/formatter/index.md +70 -70
  119. package/skills/read-docs/references/opencode/guide/config.md +419 -419
  120. package/skills/read-docs/references/opencode/guide/formatters.md +70 -70
  121. package/skills/read-docs/references/opencode/guide/index.md +37 -37
  122. package/skills/read-docs/references/opencode/guide/providers.md +31 -31
  123. package/skills/read-docs/references/opencode/guide/rules.md +63 -63
  124. package/skills/read-docs/references/opencode/plugins/examples.md +75 -75
  125. package/skills/read-docs/references/opencode/plugins/index.md +188 -188
  126. package/skills/read-docs/references/opencode/reference/index.md +118 -118
  127. package/skills/read-docs/references/opencode/rule/index.md +77 -77
  128. package/skills/read-docs/references/opencode/skills/detail.md +113 -113
  129. package/skills/read-docs/references/opencode/skills/examples.md +141 -141
  130. package/skills/read-docs/references/opencode/skills/index.md +126 -126
  131. package/skills/read-docs/references/opencode/skills/workflow.md +146 -146
  132. package/skills/read-docs/references/opencode/tests/agent.md +9 -9
  133. package/skills/read-docs/references/opencode/tests/config.md +59 -59
  134. package/skills/read-docs/references/opencode/tests/file.md +11 -11
  135. package/skills/read-docs/references/opencode/tests/serve.md +17 -17
  136. package/skills/read-docs/references/opencode/tests/session.md +30 -30
  137. package/skills/read-docs/references/opencode/tests/web.md +16 -16
  138. package/skills/read-docs/references/opencode/tools/arguments.md +305 -305
  139. package/skills/read-docs/references/opencode/tools/context.md +17 -17
  140. package/skills/read-docs/references/opencode/tools/custom.md +110 -110
  141. package/skills/read-docs/references/opencode/tools/detail.md +104 -104
  142. package/skills/read-docs/references/opencode/tools/examples.md +71 -71
  143. package/skills/read-docs/references/opencode/tools/index.md +56 -56
  144. package/skills/read-docs/references/opencode/tools/lsp.md +25 -25
  145. package/skills/read-docs/references/opencode/tools/mcp.md +132 -132
  146. package/skills/read-docs/references/opencode/train/README.md +134 -134
  147. package/skills/read-docs/references/opencode/train/agent-basic.md +771 -771
  148. package/skills/read-docs/references/opencode/train/command-basic.md +667 -667
  149. package/skills/read-docs/references/opencode/train/config-basic.md +508 -508
  150. package/skills/read-docs/references/opencode/train/index.md +163 -163
  151. package/skills/read-docs/references/opencode/train/practice.md +872 -872
  152. package/skills/read-docs/references/opencode/train/skill-basic.md +607 -607
  153. package/skills/read-docs/references/opencode/tui/commands/config.md +31 -31
  154. package/skills/read-docs/references/opencode/tui/commands/editor.md +46 -46
  155. package/skills/read-docs/references/opencode/tui/commands/index.md +124 -124
  156. package/skills/read-docs/references/opencode/tui/commands/init.md +4 -4
  157. package/skills/read-docs/references/opencode/tui/index.md +26 -26
  158. package/skills/read-docs/references/superpowers/bootstrap.md +107 -107
  159. package/skills/read-docs/references/superpowers/comparison.md +77 -77
  160. package/skills/read-docs/references/superpowers/context.md +71 -71
  161. package/skills/read-docs/references/superpowers/index.md +58 -58
  162. package/skills/read-docs/references/superpowers/parallel.md +49 -49
  163. package/skills/read-docs/references/superpowers/sdd.md +183 -183
  164. package/skills/read-docs/references/superpowers/skills.md +68 -68
  165. package/skills/read-docs/references/superpowers/workflow.md +83 -83
  166. package/skills/revise/SKILL.md +121 -121
  167. package/skills/revise/references/article.md +36 -36
  168. package/skills/revise/references/article.schema.json5 +40 -40
  169. package/skills/revise/references/gallery.md +34 -34
  170. package/skills/revise/references/gallery.schema.json5 +40 -40
  171. package/skills/revise/references/question.md +32 -32
  172. package/skills/revise/references/question.schema.json5 +31 -31
  173. package/skills/revise/references/status.md +31 -31
  174. package/skills/revise/references/status.schema.json5 +27 -27
  175. package/skills/revise/references/validate-schema.js +39 -39
  176. package/skills/step-extract/SKILL.md +205 -0
  177. package/skills/tsl/SKILL.md +393 -0
  178. package/skills/tsl/package.json +10 -0
  179. package/skills/tsl/references/global-review-rules.md +25 -0
  180. package/skills/tsl/references/prepare-prompt.md +150 -0
  181. package/skills/tsl/references/terminology-rules.md +93 -0
  182. package/skills/tsl/references/translation-guide.md +23 -0
  183. package/skills/tsl/references/translation-prompt.md +115 -0
  184. package/skills/tsl/references/translation-rules.md +48 -0
  185. package/skills/tsl/references/verification-rules.md +58 -0
  186. package/skills/tsl/scripts/check-boundaries.js +140 -0
  187. package/skills/tsl/scripts/chunk-text.js +144 -0
  188. package/skills/tsl/scripts/clean-text.js +121 -0
  189. package/skills/tsl/scripts/cleanup-glossary.js +160 -0
  190. package/skills/tsl/scripts/extract-pdf.js +94 -0
  191. package/skills/tsl/scripts/generate-review.js +179 -0
  192. package/skills/tsl/scripts/merge-result.js +164 -0
  193. package/skills/tsl/scripts/verify-chunk.js +170 -0
  194. package/skills/tsl-format/SKILL.md +298 -0
  195. package/skills/tsl-format/references/format-prompt.md +103 -0
  196. package/skills/tsl-format/references/format-rules.md +58 -0
  197. package/skills/tsl-format/scripts/chunk-bilingual.js +96 -0
  198. package/skills/tsl-format/scripts/merge-format.js +105 -0
  199. package/src/config.js +29 -29
  200. package/src/config.json5 +19 -19
  201. package/skills/new-skill/references/template.md +0 -53
  202. package/skills/new-skill/references/workflow-patterns.md +0 -104
@@ -1,44 +1,44 @@
1
- # auth
2
- Command to manage credentials and login for providers.
3
- ```
4
- opencode auth [command]
5
- ```
6
-
7
- ## login
8
-
9
- OpenCode is powered by the provider list at Models.dev, so you can use opencode auth login to configure API keys for any provider you’d like to use. This is stored in ~/.local/share/opencode/auth.json.
10
-
11
- ```
12
- opencode auth login
13
- ```
14
-
15
- When OpenCode starts up it loads the providers from the credentials file. And if there are any keys defined in your environments or a .env file in your project.
16
-
17
- Flags
18
- - `--provider` `-p` : Provider ID or name to log in to
19
- - `--method` `-m` : Login method label to use, skipping method selection
20
-
21
- ## list
22
- Lists all the authenticated providers as stored in the credentials file.
23
- ```
24
- opencode auth list
25
- opencode auth ls
26
- ```
27
-
28
- ## logout
29
- Logs you out of a provider by clearing it from the credentials file.
30
- ```
31
- opencode auth logout
32
- ```
33
-
34
- # models
35
- List all available models from configured providers in the format provider/model.
36
- ```
37
- opencode models [provider]
38
-
39
- opencode models anthropic
40
- ```
41
-
42
- ## Flags
43
- - `--refresh` : Refresh the models cache form models.dev
1
+ # auth
2
+ Command to manage credentials and login for providers.
3
+ ```
4
+ opencode auth [command]
5
+ ```
6
+
7
+ ## login
8
+
9
+ OpenCode is powered by the provider list at Models.dev, so you can use opencode auth login to configure API keys for any provider you’d like to use. This is stored in ~/.local/share/opencode/auth.json.
10
+
11
+ ```
12
+ opencode auth login
13
+ ```
14
+
15
+ When OpenCode starts up it loads the providers from the credentials file. And if there are any keys defined in your environments or a .env file in your project.
16
+
17
+ Flags
18
+ - `--provider` `-p` : Provider ID or name to log in to
19
+ - `--method` `-m` : Login method label to use, skipping method selection
20
+
21
+ ## list
22
+ Lists all the authenticated providers as stored in the credentials file.
23
+ ```
24
+ opencode auth list
25
+ opencode auth ls
26
+ ```
27
+
28
+ ## logout
29
+ Logs you out of a provider by clearing it from the credentials file.
30
+ ```
31
+ opencode auth logout
32
+ ```
33
+
34
+ # models
35
+ List all available models from configured providers in the format provider/model.
36
+ ```
37
+ opencode models [provider]
38
+
39
+ opencode models anthropic
40
+ ```
41
+
42
+ ## Flags
43
+ - `--refresh` : Refresh the models cache form models.dev
44
44
  - `--verbose` : Use more verbose model output (includes metadata like costs)
@@ -1,81 +1,81 @@
1
- # run
2
- Run opencode in `non-interactive` mode by passing a prompt directly.
3
- ```
4
- opencode run [message..]
5
- ```
6
-
7
- ## run --attach
8
- You can also attach to a running `opencode serve` instance to avoid MCP server cold boot times on every run:
9
- ```
10
- opencode serve --port 4096
11
- opencode run --attach http://localhost:4096 "Explain async/await in JavaScript"
12
- ```
13
-
14
- 冷启动与attach:
15
- - `opencode run`每次执行都要:启动进程 → 加载 MCP Server → 初始化模型 → 执行 → 退出。MCP Server 启动可能需要数秒,频繁执行时浪费时间。
16
-
17
- 解决方案:
18
- - 终端1:启动常驻服务器(一次性冷启动)
19
- ```
20
- opencode serve --port 4096
21
- ```
22
- - 终端n:多任务复用同一个服务器(跳过冷启动)
23
- ```
24
- opencode run --attach http://localhost:4096 "Explain async/await"
25
- opencode run --attach http://localhost:4096 "Fix the bug in main.ts"
26
- ```
27
-
28
- ## Flags
29
- ### Model and Perm
30
- - `--model` `-m` : Model to use in the form of `provider/model`
31
- - `--auto` : Auto-approve permissions that are not explicitly denied
32
-
33
- ### Invoke
34
- - `--command` : The command to run, use message for args
35
- - `--agent` : Agent to use
36
-
37
- ### Attach
38
- - `--attach` : Attach to a running opencode server (e.g., `http://localhost:4096`)
39
- - `--port` : Port for the local server (defaults to random port)
40
- - `--password` `-p` : Basic auth password (defaults to `OPENCODE_SERVER_PASSWORD`)
41
- - `--username` `-u` : Basic auth username (defaults to `OPENCODE_SERVER_USERNAME` or `opencode`)
42
-
43
- ### IO
44
- - `--dir` : Directory to run in, or path on the remote server when attaching
45
- - `--file` `-f` : File(s) to attach to message
46
- - `--format` : Format: default (formatted) or json (raw JSON events)
47
-
48
- ### Session
49
- - `--continue` `-c` : Continue the last session
50
- - `--session` `-s` : Session ID to continue
51
- - `--fork` : Fork the session when continuing (use with --continue or --session)
52
- - `--share` : Share the session
53
- - `--title` : Title for the session (uses truncated prompt if no value provided)
54
-
55
- ### Thinking
56
- - `--variant` : Model variant (provider-specific reasoning effort)
57
- - `--thinking` : Show thinking blocks
58
-
59
- ## Fork
60
- - 原会话不变
61
- - sessions列表新增一个会话
62
- - 复制快照后独立发展
63
-
64
- ## File
65
- 文件内容会作为用户消息的一部分发送给模型。适合指令较长或需要复用的场景。
66
- ```
67
- // 不需要额外 message
68
- opencode run -f instructions.md
69
-
70
- // 或文件内容 + 简短补充
71
- opencode run -f instructions.md -- "注意优先处理错误处理部分"
72
-
73
- // multi files
74
- opencode run -f instructions.md instructions.md -- "注意优先处理错误处理部分"
75
- ```
76
-
77
- ## Variant
78
- 控制模型推理努力程度,类似OpenAI的reasoning effort参数
79
- - `low` : 低推理,快速响应
80
- - `medium` : 中等推理(默认)
81
- - `high` : 高推理(深度思考,适合复杂任务)
1
+ # run
2
+ Run opencode in `non-interactive` mode by passing a prompt directly.
3
+ ```
4
+ opencode run [message..]
5
+ ```
6
+
7
+ ## run --attach
8
+ You can also attach to a running `opencode serve` instance to avoid MCP server cold boot times on every run:
9
+ ```
10
+ opencode serve --port 4096
11
+ opencode run --attach http://localhost:4096 "Explain async/await in JavaScript"
12
+ ```
13
+
14
+ 冷启动与attach:
15
+ - `opencode run`每次执行都要:启动进程 → 加载 MCP Server → 初始化模型 → 执行 → 退出。MCP Server 启动可能需要数秒,频繁执行时浪费时间。
16
+
17
+ 解决方案:
18
+ - 终端1:启动常驻服务器(一次性冷启动)
19
+ ```
20
+ opencode serve --port 4096
21
+ ```
22
+ - 终端n:多任务复用同一个服务器(跳过冷启动)
23
+ ```
24
+ opencode run --attach http://localhost:4096 "Explain async/await"
25
+ opencode run --attach http://localhost:4096 "Fix the bug in main.ts"
26
+ ```
27
+
28
+ ## Flags
29
+ ### Model and Perm
30
+ - `--model` `-m` : Model to use in the form of `provider/model`
31
+ - `--auto` : Auto-approve permissions that are not explicitly denied
32
+
33
+ ### Invoke
34
+ - `--command` : The command to run, use message for args
35
+ - `--agent` : Agent to use
36
+
37
+ ### Attach
38
+ - `--attach` : Attach to a running opencode server (e.g., `http://localhost:4096`)
39
+ - `--port` : Port for the local server (defaults to random port)
40
+ - `--password` `-p` : Basic auth password (defaults to `OPENCODE_SERVER_PASSWORD`)
41
+ - `--username` `-u` : Basic auth username (defaults to `OPENCODE_SERVER_USERNAME` or `opencode`)
42
+
43
+ ### IO
44
+ - `--dir` : Directory to run in, or path on the remote server when attaching
45
+ - `--file` `-f` : File(s) to attach to message
46
+ - `--format` : Format: default (formatted) or json (raw JSON events)
47
+
48
+ ### Session
49
+ - `--continue` `-c` : Continue the last session
50
+ - `--session` `-s` : Session ID to continue
51
+ - `--fork` : Fork the session when continuing (use with --continue or --session)
52
+ - `--share` : Share the session
53
+ - `--title` : Title for the session (uses truncated prompt if no value provided)
54
+
55
+ ### Thinking
56
+ - `--variant` : Model variant (provider-specific reasoning effort)
57
+ - `--thinking` : Show thinking blocks
58
+
59
+ ## Fork
60
+ - 原会话不变
61
+ - sessions列表新增一个会话
62
+ - 复制快照后独立发展
63
+
64
+ ## File
65
+ 文件内容会作为用户消息的一部分发送给模型。适合指令较长或需要复用的场景。
66
+ ```
67
+ // 不需要额外 message
68
+ opencode run -f instructions.md
69
+
70
+ // 或文件内容 + 简短补充
71
+ opencode run -f instructions.md -- "注意优先处理错误处理部分"
72
+
73
+ // multi files
74
+ opencode run -f instructions.md instructions.md -- "注意优先处理错误处理部分"
75
+ ```
76
+
77
+ ## Variant
78
+ 控制模型推理努力程度,类似OpenAI的reasoning effort参数
79
+ - `low` : 低推理,快速响应
80
+ - `medium` : 中等推理(默认)
81
+ - `high` : 高推理(深度思考,适合复杂任务)
@@ -1,84 +1,84 @@
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
+ # 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 +1,38 @@
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
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
38
  ```
@@ -1,15 +1,15 @@
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`
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
15
  - `--cors`
@@ -1,39 +1,39 @@
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
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
39
  - `OPENCODE_DISABLE_MOUSE` : `boolean` Disable mouse capture in the TUI
@@ -1,19 +1,19 @@
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
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
19
  - `--pure` : Run without external plugins