@wwkit/harness 1.0.8 → 1.0.10
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/agents/extract.md +2 -14
- package/agents/lint.md +367 -0
- package/agents/pyit.md +361 -0
- package/agents/pyut.md +347 -0
- package/agents/query.md +2 -14
- package/agents/revise.md +2 -14
- package/agents/work.md +151 -0
- package/commands/git-sync.md +218 -0
- package/commands/net-port.md +364 -0
- package/commands/pyit.md +6 -0
- package/commands/pyut.md +6 -0
- package/commands/resume.md +104 -0
- package/package.json +2 -2
- package/skills/better-skill/SKILL.md +124 -0
- package/skills/blame-skill/SKILL.md +201 -0
- package/skills/lint-ai-fix/SKILL.md +141 -0
- package/skills/lint-config-setup/SKILL.md +106 -0
- package/skills/lint-config-setup/references/languages/js.md +110 -0
- package/skills/lint-config-setup/references/languages/py.md +89 -0
- package/skills/lint-env-ensure/SKILL.md +92 -0
- package/skills/lint-env-ensure/references/config.md +65 -0
- package/skills/lint-language-detect/SKILL.md +79 -0
- package/skills/lint-language-detect/references/detect-language.js +65 -0
- package/skills/lint-rules-analyze/SKILL.md +129 -0
- package/skills/lint-suitability-check/SKILL.md +84 -0
- package/skills/lint-tool-fix/SKILL.md +94 -0
- package/skills/new-skill/SKILL.md +227 -0
- package/skills/new-skill/references/template.md +53 -0
- package/skills/new-skill/references/workflow-patterns.md +104 -0
- package/skills/pytest-case-create/SKILL.md +327 -0
- package/skills/pytest-case-create/references/test-standards.md +244 -0
- package/skills/pytest-case-fix/SKILL.md +274 -0
- package/skills/pytest-coverage-analyze/SKILL.md +226 -0
- package/skills/pytest-coverage-analyze/references/scoring-rules.md +57 -0
- package/skills/pytest-env-ensure/SKILL.md +198 -0
- package/skills/pytest-env-ensure/references/config.md +145 -0
- package/skills/pytest-execute/SKILL.md +155 -0
- package/skills/pytest-sample/SKILL.md +164 -0
- package/skills/pytest-sample/references/src/pytest-sample/Calculator.py +67 -0
- package/skills/pytest-sample/references/src/pytest-sample/ConfigManager.py +68 -0
- package/skills/pytest-sample/references/src/pytest-sample/FileProcessor.py +53 -0
- package/skills/pytest-sample/references/src/pytest-sample/OrderService.py +82 -0
- package/skills/pytest-sample/references/src/pytest-sample/TokenGenerator.py +50 -0
- package/skills/pytest-sample/references/src/pytest-sample/UserService.py +45 -0
- package/skills/pytest-sample/references/src/pytest-sample/__init__.py +0 -0
- package/skills/pytest-suitability-check/SKILL.md +224 -0
- package/skills/read-docs/SKILL.md +134 -0
- package/skills/read-docs/references/opencode/agents/cases.md +206 -0
- package/skills/read-docs/references/opencode/agents/design-pattern.md +47 -0
- package/skills/read-docs/references/opencode/agents/detail.md +191 -0
- package/skills/read-docs/references/opencode/agents/examples.md +100 -0
- package/skills/read-docs/references/opencode/agents/index.md +307 -0
- package/skills/read-docs/references/opencode/agents/workflow.md +161 -0
- package/skills/read-docs/references/opencode/cli/commands/acp.md +32 -0
- package/skills/read-docs/references/opencode/cli/commands/agent.md +16 -0
- package/skills/read-docs/references/opencode/cli/commands/attach.md +20 -0
- package/skills/read-docs/references/opencode/cli/commands/mcp.md +37 -0
- package/skills/read-docs/references/opencode/cli/commands/others.md +49 -0
- package/skills/read-docs/references/opencode/cli/commands/plugin.md +13 -0
- package/skills/read-docs/references/opencode/cli/commands/provider.md +44 -0
- package/skills/read-docs/references/opencode/cli/commands/run.md +81 -0
- package/skills/read-docs/references/opencode/cli/commands/serve.md +84 -0
- package/skills/read-docs/references/opencode/cli/commands/session.md +38 -0
- package/skills/read-docs/references/opencode/cli/commands/web.md +15 -0
- package/skills/read-docs/references/opencode/cli/env.md +39 -0
- package/skills/read-docs/references/opencode/cli/index.md +19 -0
- package/skills/read-docs/references/opencode/cli/tui.md +35 -0
- package/skills/read-docs/references/opencode/commands/examples.md +42 -0
- package/skills/read-docs/references/opencode/commands/index.md +185 -0
- package/skills/read-docs/references/opencode/config/provider.md +152 -0
- package/skills/read-docs/references/opencode/formatter/index.md +71 -0
- package/skills/read-docs/references/opencode/guide/config.md +419 -0
- package/skills/read-docs/references/opencode/guide/formatters.md +70 -0
- package/skills/read-docs/references/opencode/guide/index.md +37 -0
- package/skills/read-docs/references/opencode/guide/providers.md +31 -0
- package/skills/read-docs/references/opencode/guide/rules.md +63 -0
- package/skills/read-docs/references/opencode/plugins/examples.md +75 -0
- package/skills/read-docs/references/opencode/plugins/index.md +188 -0
- package/skills/read-docs/references/opencode/reference/index.md +119 -0
- package/skills/read-docs/references/opencode/rule/index.md +78 -0
- package/skills/read-docs/references/opencode/skills/detail.md +113 -0
- package/skills/read-docs/references/opencode/skills/examples.md +141 -0
- package/skills/read-docs/references/opencode/skills/index.md +126 -0
- package/skills/read-docs/references/opencode/skills/workflow.md +146 -0
- package/skills/read-docs/references/opencode/tests/agent.md +10 -0
- package/skills/read-docs/references/opencode/tests/config.md +60 -0
- package/skills/read-docs/references/opencode/tests/file.md +12 -0
- package/skills/read-docs/references/opencode/tests/serve.md +18 -0
- package/skills/read-docs/references/opencode/tests/session.md +31 -0
- package/skills/read-docs/references/opencode/tests/web.md +17 -0
- package/skills/read-docs/references/opencode/tools/arguments.md +305 -0
- package/skills/read-docs/references/opencode/tools/context.md +18 -0
- package/skills/read-docs/references/opencode/tools/custom.md +111 -0
- package/skills/read-docs/references/opencode/tools/detail.md +104 -0
- package/skills/read-docs/references/opencode/tools/examples.md +71 -0
- package/skills/read-docs/references/opencode/tools/index.md +56 -0
- package/skills/read-docs/references/opencode/tools/lsp.md +26 -0
- package/skills/read-docs/references/opencode/tools/mcp.md +132 -0
- package/skills/read-docs/references/opencode/train/README.md +135 -0
- package/skills/read-docs/references/opencode/train/agent-basic.md +772 -0
- package/skills/read-docs/references/opencode/train/command-basic.md +668 -0
- package/skills/read-docs/references/opencode/train/config-basic.md +509 -0
- package/skills/read-docs/references/opencode/train/index.md +164 -0
- package/skills/read-docs/references/opencode/train/practice.md +873 -0
- package/skills/read-docs/references/opencode/train/skill-basic.md +608 -0
- package/skills/read-docs/references/opencode/tui/commands/config.md +32 -0
- package/skills/read-docs/references/opencode/tui/commands/editor.md +47 -0
- package/skills/read-docs/references/opencode/tui/commands/index.md +125 -0
- package/skills/read-docs/references/opencode/tui/commands/init.md +5 -0
- package/skills/read-docs/references/opencode/tui/index.md +26 -0
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
# 技能(Skills)
|
|
2
|
+
|
|
3
|
+
技能是通过 `SKILL.md` 定义的可复用行为,让 OpenCode 从仓库或主目录中发现和加载可复用的指令。
|
|
4
|
+
|
|
5
|
+
技能通过 `skill` 工具按需加载——Agent 看到可用技能列表,需要时加载完整内容。
|
|
6
|
+
|
|
7
|
+
## 放置技能文件
|
|
8
|
+
|
|
9
|
+
每个技能一个文件夹,内含 `SKILL.md`。OpenCode 搜索以下位置:
|
|
10
|
+
|
|
11
|
+
- 项目配置:`.opencode/skills/<name>/SKILL.md`
|
|
12
|
+
- 全局配置:`~/.config/opencode/skills/<name>/SKILL.md`
|
|
13
|
+
|
|
14
|
+
## 发现机制
|
|
15
|
+
|
|
16
|
+
对于项目本地路径,OpenCode 从当前工作目录向上遍历直到 Git 工作树根目录,加载 `.opencode/skills/*/SKILL.md`。
|
|
17
|
+
|
|
18
|
+
全局定义从 `~/.config/opencode/skills/*/SKILL.md` 加载。
|
|
19
|
+
|
|
20
|
+
## Frontmatter 规范
|
|
21
|
+
|
|
22
|
+
每个 `SKILL.md` 必须以 YAML frontmatter 开头,仅识别以下字段:
|
|
23
|
+
|
|
24
|
+
| 字段 | 必需 | 说明 |
|
|
25
|
+
|------|------|------|
|
|
26
|
+
| name | 是 | 正则 `^[a-z0-9]+(-[a-z0-9]+)*$` |
|
|
27
|
+
| description | 是 | 1-1024 字符,需足够具体以便 Agent 正确选择 |
|
|
28
|
+
| license | 否 | 许可证 |
|
|
29
|
+
| compatibility | 否 | 兼容性 |
|
|
30
|
+
| metadata | 否 | 字符串到字符串的映射 |
|
|
31
|
+
|
|
32
|
+
## 示例
|
|
33
|
+
|
|
34
|
+
```md
|
|
35
|
+
---
|
|
36
|
+
name: git-release
|
|
37
|
+
description: Create consistent releases and changelogs
|
|
38
|
+
license: MIT
|
|
39
|
+
compatibility: opencode
|
|
40
|
+
metadata:
|
|
41
|
+
audience: maintainers
|
|
42
|
+
workflow: github
|
|
43
|
+
---
|
|
44
|
+
|
|
45
|
+
## What I do
|
|
46
|
+
|
|
47
|
+
- Draft release notes from merged PRs
|
|
48
|
+
- Propose a version bump
|
|
49
|
+
- Provide a copy-pasteable `gh release create` command
|
|
50
|
+
|
|
51
|
+
## When to use me
|
|
52
|
+
|
|
53
|
+
Use this when you are preparing a tagged release.
|
|
54
|
+
Ask clarifying questions if the target versioning scheme is unclear.
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
## 工具描述
|
|
58
|
+
|
|
59
|
+
OpenCode 在 `skill` 工具描述中列出可用技能:
|
|
60
|
+
|
|
61
|
+
```xml
|
|
62
|
+
<available_skills>
|
|
63
|
+
<skill>
|
|
64
|
+
<name>git-release</name>
|
|
65
|
+
<description>Create consistent releases and changelogs</description>
|
|
66
|
+
</skill>
|
|
67
|
+
</available_skills>
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
Agent 通过调用工具加载技能:
|
|
71
|
+
|
|
72
|
+
```
|
|
73
|
+
skill({ name: "git-release" })
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
## 权限配置
|
|
77
|
+
|
|
78
|
+
在 `opencode.json` 中使用模式匹配控制技能访问:
|
|
79
|
+
|
|
80
|
+
| 值 | 说明 |
|
|
81
|
+
|----|------|
|
|
82
|
+
| `allow` | 立即加载技能 |
|
|
83
|
+
| `deny` | 对 Agent 隐藏,拒绝访问 |
|
|
84
|
+
| `ask` | 加载前需用户审批 |
|
|
85
|
+
|
|
86
|
+
```jsonc
|
|
87
|
+
{
|
|
88
|
+
"permission": {
|
|
89
|
+
"skill": {
|
|
90
|
+
"*": "allow",
|
|
91
|
+
"pr-review": "allow",
|
|
92
|
+
"internal-*": "deny",
|
|
93
|
+
"experimental-*": "ask"
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
## 按 Agent 覆盖权限
|
|
100
|
+
|
|
101
|
+
为特定 Agent 设置不同的权限:
|
|
102
|
+
|
|
103
|
+
```md
|
|
104
|
+
---
|
|
105
|
+
permission:
|
|
106
|
+
skill:
|
|
107
|
+
"documents-*": "allow"
|
|
108
|
+
---
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
## 禁用技能工具
|
|
112
|
+
|
|
113
|
+
完全禁用技能功能:
|
|
114
|
+
|
|
115
|
+
```md
|
|
116
|
+
---
|
|
117
|
+
tools:
|
|
118
|
+
skill: false
|
|
119
|
+
---
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
## 更多内容
|
|
123
|
+
|
|
124
|
+
- [技能详解](/skills/detail) — 渐进式加载、Description 编写、创建步骤
|
|
125
|
+
- [技能工作流](/skills/workflow) — 5 种工作流模式
|
|
126
|
+
- [技能示例](/skills/examples) — 从简单到复杂的示例
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
# 技能工作流
|
|
2
|
+
|
|
3
|
+
## 模式 1:顺序工作流编排
|
|
4
|
+
|
|
5
|
+
适用场景:需要按固定顺序执行的多步骤流程。
|
|
6
|
+
|
|
7
|
+
```md
|
|
8
|
+
---
|
|
9
|
+
name: customer-onboarding
|
|
10
|
+
description: 端到端客户入职工作流。处理账户创建、支付设置、订阅管理。
|
|
11
|
+
当用户说"入职新客户"、"设置订阅"、"创建账户"时使用。
|
|
12
|
+
---
|
|
13
|
+
# 客户入职工作流
|
|
14
|
+
## 步骤 1:创建账户
|
|
15
|
+
调用 MCP 工具:`create_customer`
|
|
16
|
+
参数:name, email, company
|
|
17
|
+
## 步骤 2:设置支付
|
|
18
|
+
调用 MCP 工具:`setup_payment_method`
|
|
19
|
+
等待:支付方式验证
|
|
20
|
+
## 步骤 3:创建订阅
|
|
21
|
+
调用 MCP 工具:`create_subscription`
|
|
22
|
+
参数:plan_id, customer_id(来自步骤 1)
|
|
23
|
+
## 步骤 4:发送欢迎邮件
|
|
24
|
+
调用 MCP 工具:`send_email`
|
|
25
|
+
模板:welcome_email_template
|
|
26
|
+
## 失败回滚
|
|
27
|
+
如果任何步骤失败:
|
|
28
|
+
1. 记录失败原因
|
|
29
|
+
2. 回滚已创建的资源
|
|
30
|
+
3. 通知管理员
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## 模式 2:多 MCP 协调
|
|
34
|
+
|
|
35
|
+
适用场景:工作流跨多个服务。
|
|
36
|
+
|
|
37
|
+
```md
|
|
38
|
+
---
|
|
39
|
+
name: design-to-dev
|
|
40
|
+
description: 从设计文件生成开发任务。当用户提到"设计交接"、"Figma 转任务"时使用。
|
|
41
|
+
---
|
|
42
|
+
# 设计到开发交接
|
|
43
|
+
## 阶段 1:设计导出 (Figma MCP)
|
|
44
|
+
1. 从 Figma 导出设计资源
|
|
45
|
+
2. 生成设计规格文档
|
|
46
|
+
3. 创建资源清单
|
|
47
|
+
## 阶段 2:资源存储 (Drive MCP)
|
|
48
|
+
1. 在 Drive 创建项目文件夹
|
|
49
|
+
2. 上传所有资源
|
|
50
|
+
3. 生成分享链接
|
|
51
|
+
## 阶段 3:任务创建 (Linear MCP)
|
|
52
|
+
1. 创建开发任务
|
|
53
|
+
2. 附加资源链接到任务
|
|
54
|
+
3. 分配给工程团队
|
|
55
|
+
## 阶段 4:通知 (Slack MCP)
|
|
56
|
+
1. 在 #engineering 发布交接摘要
|
|
57
|
+
2. 包含资源链接和任务引用
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
## 模式 3:迭代优化
|
|
61
|
+
|
|
62
|
+
适用场景:输出质量需要多次改进。
|
|
63
|
+
|
|
64
|
+
```md
|
|
65
|
+
---
|
|
66
|
+
name: report-generator
|
|
67
|
+
description: 生成高质量报告,自动迭代优化直到达标。
|
|
68
|
+
---
|
|
69
|
+
# 迭代报告生成
|
|
70
|
+
## 初始草稿
|
|
71
|
+
1. 通过 MCP 获取数据
|
|
72
|
+
2. 生成初版报告
|
|
73
|
+
3. 保存到临时文件
|
|
74
|
+
## 质量检查
|
|
75
|
+
运行验证脚本:`scripts/check_report.py`
|
|
76
|
+
检查项:
|
|
77
|
+
- 缺失章节
|
|
78
|
+
- 格式不一致
|
|
79
|
+
- 数据验证错误
|
|
80
|
+
## 优化循环
|
|
81
|
+
WHILE 质量未达标:
|
|
82
|
+
1. 修复已识别的问题
|
|
83
|
+
2. 重新生成受影响的章节
|
|
84
|
+
3. 再次验证
|
|
85
|
+
## 最终定稿
|
|
86
|
+
1. 应用最终格式
|
|
87
|
+
2. 生成摘要
|
|
88
|
+
3. 保存最终版本
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
## 模式 4:上下文感知工具选择
|
|
92
|
+
|
|
93
|
+
适用场景:同一目标,根据上下文选择不同工具。
|
|
94
|
+
|
|
95
|
+
```md
|
|
96
|
+
---
|
|
97
|
+
name: smart-storage
|
|
98
|
+
description: 根据文件类型和用途自动选择最佳存储位置。
|
|
99
|
+
---
|
|
100
|
+
# 智能文件存储
|
|
101
|
+
## 决策树
|
|
102
|
+
1. 检查文件类型和大小
|
|
103
|
+
2. 确定最佳存储位置:
|
|
104
|
+
- 大文件 (>10MB) → 云存储 MCP
|
|
105
|
+
- 协作文档 → Notion/Docs MCP
|
|
106
|
+
- 代码文件 → GitHub MCP
|
|
107
|
+
- 临时文件 → 本地存储
|
|
108
|
+
## 执行存储
|
|
109
|
+
根据决策:
|
|
110
|
+
- 调用对应的 MCP 工具
|
|
111
|
+
- 应用服务特定的元数据
|
|
112
|
+
- 生成访问链接
|
|
113
|
+
## 用户反馈
|
|
114
|
+
解释为什么选择了那个存储位置
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
## 模式 5:领域智能
|
|
118
|
+
|
|
119
|
+
适用场景:技能提供超越工具访问的专业知识。
|
|
120
|
+
|
|
121
|
+
```md
|
|
122
|
+
---
|
|
123
|
+
name: payment-compliance
|
|
124
|
+
description: 带合规检查的支付处理。当处理跨境支付、大额交易时使用。
|
|
125
|
+
---
|
|
126
|
+
# 合规支付处理
|
|
127
|
+
## 处理前(合规检查)
|
|
128
|
+
1. 通过 MCP 获取交易详情
|
|
129
|
+
2. 应用合规规则:
|
|
130
|
+
- 检查制裁名单
|
|
131
|
+
- 验证管辖区允许
|
|
132
|
+
- 评估风险等级
|
|
133
|
+
3. 记录合规决策
|
|
134
|
+
## 处理
|
|
135
|
+
IF 合规通过:
|
|
136
|
+
- 调用支付处理 MCP 工具
|
|
137
|
+
- 应用适当的欺诈检查
|
|
138
|
+
- 处理交易
|
|
139
|
+
ELSE:
|
|
140
|
+
- 标记为人工审核
|
|
141
|
+
- 创建合规案例
|
|
142
|
+
## 审计追踪
|
|
143
|
+
- 记录所有合规检查
|
|
144
|
+
- 记录处理决策
|
|
145
|
+
- 生成审计报告
|
|
146
|
+
```
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
# env config
|
|
2
|
+
|
|
3
|
+
## Step1: show current settings
|
|
4
|
+
By default, using `~/.config/opencode`
|
|
5
|
+
```
|
|
6
|
+
echo $OPENCODE_CONFIG
|
|
7
|
+
echo $OPENCODE_CONFIG_DIR
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
## Step2: Create a test command
|
|
11
|
+
Create a command
|
|
12
|
+
- project dir: `D:\jsapp\wego_oc`
|
|
13
|
+
- config dir: `.opencode\commands\foo.md`
|
|
14
|
+
|
|
15
|
+
## Step3.1: config once
|
|
16
|
+
In other dir run:
|
|
17
|
+
|
|
18
|
+
```
|
|
19
|
+
// Use TUI
|
|
20
|
+
$env:OPENCODE_CONFIG_DIR="D:\jsapp\wego_oc\opencode"; opencode
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
```
|
|
24
|
+
// Use run
|
|
25
|
+
$env:OPENCODE_CONFIG_DIR="D:/jsapp/wego_oc/opencode"; opencode run --command foo
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## Step3.2: config
|
|
29
|
+
Manage env var in Windows
|
|
30
|
+
```
|
|
31
|
+
// set
|
|
32
|
+
[System.Environment]::SetEnvironmentVariable('OPENCODE_CONFIG_DIR', "D:/jsapp/wego_oc/opencode", 'User')
|
|
33
|
+
|
|
34
|
+
// check
|
|
35
|
+
[System.Environment]::GetEnvironmentVariable('OPENCODE_CONFIG_DIR', 'User')
|
|
36
|
+
|
|
37
|
+
// delete
|
|
38
|
+
[System.Environment]::SetEnvironmentVariable('OPENCODE_CONFIG_DIR', $null, 'User')
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
Windows使用新增环境变量
|
|
42
|
+
- 新开terminal
|
|
43
|
+
- 设置到当前terminal
|
|
44
|
+
```
|
|
45
|
+
$env:OPENCODE_CONFIG_DIR = [System.Environment]::GetEnvironmentVariable('OPENCODE_CONFIG_DIR', 'User')
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
Use opencode
|
|
49
|
+
```
|
|
50
|
+
// TUI
|
|
51
|
+
opencode
|
|
52
|
+
|
|
53
|
+
// run
|
|
54
|
+
opencode run --command foo
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
## once setting in a serve
|
|
58
|
+
```
|
|
59
|
+
$env:OPENCODE_CONFIG_DIR="D:\jsapp\wego_oc\opencode"; opencode serve --port 5200
|
|
60
|
+
```
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# file
|
|
2
|
+
## Step1: create a file
|
|
3
|
+
```
|
|
4
|
+
C:\Users\l30026940\Downloads\README.md
|
|
5
|
+
```
|
|
6
|
+
|
|
7
|
+
## Step2: use this file conent
|
|
8
|
+
必须用`--`把额外信息与`--file`参数分隔,file参数支持连续的多个文件地址
|
|
9
|
+
```
|
|
10
|
+
// only support by run
|
|
11
|
+
opencode run --agent create --file "C:\Users\l30026940\Downloads\README.md" -- "总结为200字以内的摘要,并写入readme-summary.md"
|
|
12
|
+
```
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# serve
|
|
2
|
+
|
|
3
|
+
## Step1: start a standalone server
|
|
4
|
+
```
|
|
5
|
+
opencode serve --port 5200
|
|
6
|
+
```
|
|
7
|
+
|
|
8
|
+
output:
|
|
9
|
+
```
|
|
10
|
+
Warning: OPENCODE_SERVER_PASSWORD is not set; server is unsecured.
|
|
11
|
+
opencode server listening on http://127.0.0.1:5200
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## Step2: attach to this server
|
|
15
|
+
In another terminal:
|
|
16
|
+
```
|
|
17
|
+
opencode attach http://127.0.0.1:5200
|
|
18
|
+
```
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# session相关功能测试
|
|
2
|
+
|
|
3
|
+
## export and import
|
|
4
|
+
|
|
5
|
+
### Step1: show the sesion id
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
opencode session list -n 5
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
output:
|
|
12
|
+
```
|
|
13
|
+
ses_0cadb81d5ffernOJ0n2SD1FZ6S New session - 2026-07-06T01:56:51.883Z 15:14
|
|
14
|
+
ses_0cadd1cf2ffe2bVpcckQ9ZsQp6 New session - 2026-07-06T01:55:06.637Z 09:55 · 2026/7/6
|
|
15
|
+
...
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
### Step2: export the latest session
|
|
19
|
+
```
|
|
20
|
+
opencode export ses_0cadb81d5ffernOJ0n2SD1FZ6S > ses_0cadb81d5ffernOJ0n2SD1FZ6S.json
|
|
21
|
+
```
|
|
22
|
+
output:
|
|
23
|
+
```
|
|
24
|
+
Exporting session: ses_0cadb81d5ffernOJ0n2SD1FZ6S
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
### Step3: import by json
|
|
28
|
+
Open a new terminal and cwd to the same root dir
|
|
29
|
+
```
|
|
30
|
+
opencode import ses_0cadb81d5ffernOJ0n2SD1FZ6S.json
|
|
31
|
+
```
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# web服务验证
|
|
2
|
+
|
|
3
|
+
## Step1: 启动Web服务
|
|
4
|
+
```
|
|
5
|
+
opencode web --port 5200
|
|
6
|
+
opencode web --port 5200 --hostname localhost --cors http://localhost:5200
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
output:
|
|
10
|
+
```
|
|
11
|
+
Web interface: http://127.0.0.1:5200/
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## Step2: 浏览器访问
|
|
15
|
+
```
|
|
16
|
+
http://127.0.0.1:5200/
|
|
17
|
+
```
|