opencode-idea 0.0.6 → 0.0.8
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/CHANGELOG.md +12 -0
- package/README.md +3 -0
- package/package.json +1 -1
- package/src/ide-run-config-skill.js +8 -4
- package/src/idea-mcp.js +2 -2
- package/src/plugin.js +5 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.0.8
|
|
4
|
+
|
|
5
|
+
- **撤销 0.0.7 的「skill 注册尽力而为」**。skill 是本插件的核心功能,不是可选知识:定义被 schema 拒绝就说明我们写错了,必须**立即失败**。原来那个 catch 会把「功能残缺」伪装成「运行正常」—— 正是 0.0.6 丢掉 `/open-in-idea` 却没人察觉的那种失败模式。现在恢复为直接注册 (无 try/catch)。
|
|
6
|
+
- **补测试**:断言打包后的 skill 文档 (`src/ide-run-config-skill.md`) 真实存在,这样 `.md` 漏进 `package.json` 的 `files` 会在测试阶段暴露,而不是在 `setup` 时才炸。
|
|
7
|
+
- **文档**:README 限制节写明 skill 字段名以 schema 为准 (`Skill.Info` 要 `path`,官方文档里的 `location` 不存在),用错会禁用整个插件。
|
|
8
|
+
|
|
9
|
+
## 0.0.7
|
|
10
|
+
|
|
11
|
+
- **修复:0.0.6 因 skill schema 校验失败导致整个插件被禁用**。`idea-run-config` skill 的定义用了 `location` 字段,而 `Skill.Info` 要求的是 `path` (AbsolutePath);`ctx.skill.transform` 因此抛 `SchemaError(Missing key at ["path"])`。OpenCode 的策略是**任何 transform 失败都会禁用整个插件**,所以 0.0.6 里 `/open-in-idea` 命令和 IDE MCP 注册都没能生效 (日志:`disabled plugin after transform failure plugin.id=opencode-idea state=skill`)。现在改用 `path`,并在测试里钉死字段集合 (`content` / `description` / `id` / `name` / `path`)。
|
|
12
|
+
- **skill 注册改为尽力而为**:`runConfigSkill()` 或 `ctx.skill.transform` 抛错时只放弃 skill,不再中断 `setup` —— 可选知识不该拖垮命令与 MCP 接线。
|
|
13
|
+
- **新增回归测试**:skill transform 被拒时 `/open-in-idea` 仍然注册。
|
|
14
|
+
|
|
3
15
|
## 0.0.6
|
|
4
16
|
|
|
5
17
|
- **修复:工具报错不再注销 IDE MCP**。旧实现在 `tool.execute.after` 里把**任何** `idea_*` 报错都当成「端点已死」并注销整个注册 —— 业务错误 (例如路径不存在返回 `File not found`) 和一次传输抖动都会触发;注销后紧跟的 `ctx.mcp.reload()` 还会掐断同一批正在执行的其他调用。现在插件**不注册**该钩子:连接状态以 OpenCode 自己维护的工具快照为准 (`context` 钩子收到的 `event.tools` 里有没有 `idea_*`),只有 `/open-in-idea` 会 (重新) 连接。
|
package/README.md
CHANGED
|
@@ -228,6 +228,9 @@ export { default } from "/Users/yutao/Projects/opencode-idea/src/index.js";
|
|
|
228
228
|
- 仅支持 **OpenCode V2** 插件 API (`ctx.tool` / `ctx.mcp` / `ctx.shell` / `ctx.command` / `ctx.session` /
|
|
229
229
|
`ctx.location`)。
|
|
230
230
|
- IDE MCP 注册需要 IDE **2026.2+** 的 Streamable HTTP 端点 `/stream`;更早版本只有 `/sse`,OpenCode V2 无法连接。
|
|
231
|
+
- skill 定义的字段名**以 schema 为准**,不要照官方文档:`Skill.Info` 需要 `path` (AbsolutePath),文档里写的 `location`
|
|
232
|
+
不存在 —— 用错会让 `ctx.skill.transform` 抛 `SchemaError`,而**任何 transform 失败都会禁用整个插件**(0.0.6 就是这样丢了
|
|
233
|
+
`/open-in-idea`)。同理,`Skill.Info` 的完整字段是 `id` / `name` / `description?` / `autoinvoke?` / `path` / `content`。
|
|
231
234
|
- 环境变量依赖 `execute_terminal_command` + Brave Mode;拿不到时环境为空。
|
|
232
235
|
- 一批用不到的 IDEA MCP 工具被硬编码隐藏 (`src/plugin.js` 的 `HIDDEN_IDEA_TOOLS`,共 31 个):VCS (`idea_git_status` /
|
|
233
236
|
`idea_get_repositories`,版本控制走原生 `git`)、Router 派发工具 (`idea_execute_tool`,未启用 router-only 时冗余)、Debugger
|
package/package.json
CHANGED
|
@@ -41,17 +41,21 @@ export function readRunConfigSkillContent() {
|
|
|
41
41
|
/**
|
|
42
42
|
* Build the skill definition registered through `ctx.skill.transform`.
|
|
43
43
|
*
|
|
44
|
-
* `
|
|
45
|
-
* path
|
|
44
|
+
* The schema (`Skill.Info` in `@opencode/schema/skill`) requires the field to be
|
|
45
|
+
* named `path` and to hold an absolute path. Point it at the shipped `.md` — the
|
|
46
|
+
* real skill document — rather than inventing a virtual filename.
|
|
46
47
|
*
|
|
47
|
-
* @returns {{ id: string, name: string, description: string,
|
|
48
|
+
* @returns {{ id: string, name: string, description: string, path: string, content: string }}
|
|
48
49
|
*/
|
|
49
50
|
export function runConfigSkill() {
|
|
50
51
|
return {
|
|
51
52
|
id: RUN_CONFIG_SKILL_ID,
|
|
52
53
|
name: 'idea-run-config',
|
|
53
54
|
description: RUN_CONFIG_SKILL_DESCRIPTION,
|
|
54
|
-
|
|
55
|
+
// Field names are schema-critical: `Skill.Info` requires `path`
|
|
56
|
+
// (AbsolutePath). A wrong key fails validation and takes the whole plugin
|
|
57
|
+
// down, not just the skill.
|
|
58
|
+
path: fileURLToPath(SKILL_FILE),
|
|
55
59
|
content: readRunConfigSkillContent(),
|
|
56
60
|
};
|
|
57
61
|
}
|
package/src/idea-mcp.js
CHANGED
|
@@ -81,7 +81,7 @@ export async function probePort(port, options = {}) {
|
|
|
81
81
|
params: {
|
|
82
82
|
protocolVersion: PROTOCOL_VERSION,
|
|
83
83
|
capabilities: {},
|
|
84
|
-
clientInfo: { name: 'opencode-idea', version: '0.0.
|
|
84
|
+
clientInfo: { name: 'opencode-idea', version: '0.0.8' },
|
|
85
85
|
},
|
|
86
86
|
}),
|
|
87
87
|
signal: controller.signal,
|
|
@@ -151,7 +151,7 @@ export async function callTool(port, projectPath, name, args = {}, options = {})
|
|
|
151
151
|
params: {
|
|
152
152
|
protocolVersion: PROTOCOL_VERSION,
|
|
153
153
|
capabilities: {},
|
|
154
|
-
clientInfo: { name: 'opencode-idea', version: '0.0.
|
|
154
|
+
clientInfo: { name: 'opencode-idea', version: '0.0.8' },
|
|
155
155
|
},
|
|
156
156
|
});
|
|
157
157
|
const response = await post({
|
package/src/plugin.js
CHANGED
|
@@ -507,6 +507,11 @@ export default {
|
|
|
507
507
|
// The run-configuration skill is static knowledge — where `.run/*.run.xml`
|
|
508
508
|
// live, how to bootstrap a schema from a real example, and how to verify a
|
|
509
509
|
// write. JetBrains projects only, and independent of `/open-in-idea`.
|
|
510
|
+
//
|
|
511
|
+
// Deliberately NOT wrapped in a catch: this is a core feature of the plugin,
|
|
512
|
+
// so a rejected definition must fail loudly. Swallowing it would ship a
|
|
513
|
+
// silently incomplete plugin — which is exactly how 0.0.6 lost
|
|
514
|
+
// `/open-in-idea` without anyone noticing until the command was gone.
|
|
510
515
|
if (isIdeaProject && typeof ctx.skill?.transform === 'function') {
|
|
511
516
|
// Read the document before the transform: callbacks must stay synchronous.
|
|
512
517
|
const runConfigSkillDefinition = runConfigSkill();
|