@xiaoqiong0v0/opencode-file-tool 1.0.3 → 1.0.5
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/README.md +17 -21
- package/dist/file-tool.js +2 -1
- package/package.json +5 -3
package/README.md
CHANGED
|
@@ -1,46 +1,42 @@
|
|
|
1
1
|
# opencode-file-tool
|
|
2
2
|
|
|
3
|
-
OpenCode
|
|
3
|
+
OpenCode 文件缓存与图片分析插件。自动缓存用户粘贴的图片,通过多模态模型分析,绕过主模型不支持视觉的限制。
|
|
4
4
|
|
|
5
5
|
## 安装
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
# 在 opencode 配置目录安装依赖
|
|
9
|
-
cd ~/.config/opencode
|
|
10
|
-
npm install @xiaoqiong0v0/opencode-file-tool @xiaoqiong0v0/opencode-plugin-logger
|
|
11
|
-
```
|
|
12
|
-
|
|
13
|
-
然后在 `opencode.json` 的 `plugin` 数组添加:
|
|
7
|
+
在 `opencode.json` 的 `plugin` 数组添加包名:
|
|
14
8
|
|
|
15
9
|
```json
|
|
16
10
|
"plugin": ["@xiaoqiong0v0/opencode-file-tool"]
|
|
17
11
|
```
|
|
18
12
|
|
|
19
|
-
重启 OpenCode
|
|
13
|
+
重启 OpenCode 后自动安装。首次使用 `file_tool set-provider <模型名>` 配置视觉模型。
|
|
20
14
|
|
|
21
15
|
## 功能
|
|
22
16
|
|
|
23
|
-
- **文件缓存** — 粘贴图片时自动缓存到 `~/.opencode/plugins-cache
|
|
24
|
-
- **图片分析** — 通过 `analyze_image file_id:N`
|
|
25
|
-
-
|
|
26
|
-
-
|
|
17
|
+
- **文件缓存** — 粘贴图片时自动缓存到 `~/.opencode/plugins-cache/`
|
|
18
|
+
- **图片分析** — 通过 `analyze_image file_id:N` 调用视觉模型分析
|
|
19
|
+
- **会话父子链** — 子 agent 会话可通过 parent 链回退读取祖先会话的缓存
|
|
20
|
+
- **多语言** — 支持中/英文提示
|
|
27
21
|
|
|
28
22
|
## 工具
|
|
29
23
|
|
|
30
24
|
| 工具 | 说明 |
|
|
31
25
|
|------|------|
|
|
32
|
-
| `file_tool list-provider` |
|
|
33
|
-
| `file_tool set-provider <model>` |
|
|
34
|
-
| `file_tool list-cache [all\|N\|main\|main N]` |
|
|
35
|
-
| `analyze_image file_id:N` |
|
|
26
|
+
| `file_tool list-provider` | 列出可用模型 |
|
|
27
|
+
| `file_tool set-provider <model>` | 切换视觉模型 |
|
|
28
|
+
| `file_tool list-cache [all\|N\|main\|main N]` | 查看缓存文件 |
|
|
29
|
+
| `analyze_image file_id:N` | 分析指定图片 |
|
|
36
30
|
|
|
37
|
-
##
|
|
31
|
+
## 命令
|
|
38
32
|
|
|
39
|
-
|
|
33
|
+
| 命令 | 说明 |
|
|
34
|
+
|------|------|
|
|
35
|
+
| `/file-tool` | 触发 file_tool 工具 |
|
|
40
36
|
|
|
41
|
-
##
|
|
37
|
+
## 配置
|
|
42
38
|
|
|
43
|
-
|
|
39
|
+
`~/.config/opencode/file-tool.jsonc` 在首次启动时自动生成。
|
|
44
40
|
|
|
45
41
|
## GitHub
|
|
46
42
|
|
package/dist/file-tool.js
CHANGED
|
@@ -6,7 +6,7 @@ import { join } from "node:path";
|
|
|
6
6
|
const CONFIG_DIR = process.env.HOME || process.env.USERPROFILE || "";
|
|
7
7
|
const CONFIG_PATH = join(CONFIG_DIR, ".config/opencode/file-tool.jsonc");
|
|
8
8
|
const OPENCODE_CONFIG = join(CONFIG_DIR, ".config/opencode/opencode.json");
|
|
9
|
-
const CACHE_DIR = join(CONFIG_DIR, ".opencode/plugins-cache");
|
|
9
|
+
const CACHE_DIR = join(CONFIG_DIR, ".opencode/plugins-cache", "file-tool");
|
|
10
10
|
const log = createLogger("file-tool");
|
|
11
11
|
let _cfg = null;
|
|
12
12
|
const FILE_TOOL_CFG_SAMPLE = `{
|
|
@@ -403,3 +403,4 @@ export const FileTool = async () => {
|
|
|
403
403
|
},
|
|
404
404
|
};
|
|
405
405
|
};
|
|
406
|
+
export { FileTool as default };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xiaoqiong0v0/opencode-file-tool",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.5",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "File cache & image analysis plugin for OpenCode. Auto-caches pasted images, analyzes via multimodal model.",
|
|
6
6
|
"files": [
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
".": "./dist/file-tool.js"
|
|
13
13
|
},
|
|
14
14
|
"scripts": {
|
|
15
|
-
"build": "tsc && node -e \"require('fs').copyFileSync('dist/file-tool.js', '.opencode/plugins/file-tool.js')\"",
|
|
15
|
+
"build": "tsc && node -e \"try{require('fs').copyFileSync('dist/file-tool.js', '.opencode/plugins/file-tool.js')}catch{}\"",
|
|
16
16
|
"prepublishOnly": "npm run build"
|
|
17
17
|
},
|
|
18
18
|
"repository": {
|
|
@@ -24,11 +24,13 @@
|
|
|
24
24
|
"url": "https://github.com/xiaoqiong0v0/opencode-file-tool/issues"
|
|
25
25
|
},
|
|
26
26
|
"license": "MIT",
|
|
27
|
+
"peerDependencies": {
|
|
28
|
+
"@opencode-ai/plugin": "*"
|
|
29
|
+
},
|
|
27
30
|
"dependencies": {
|
|
28
31
|
"@xiaoqiong0v0/opencode-plugin-logger": "^1.0.2"
|
|
29
32
|
},
|
|
30
33
|
"devDependencies": {
|
|
31
|
-
"@opencode-ai/plugin": "^1.18.4",
|
|
32
34
|
"@types/node": "^26.1.1",
|
|
33
35
|
"typescript": "^7.0.2"
|
|
34
36
|
}
|