opencode-gbk-tools 0.1.14 → 0.1.16
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 +16 -4
- package/dist/cli/index.js +11 -2
- package/dist/opencode-tools/gbk_edit.js +419 -13
- package/dist/opencode-tools/gbk_read.js +123 -114
- package/dist/opencode-tools/gbk_search.js +52 -56
- package/dist/opencode-tools/gbk_write.js +19 -8
- package/dist/opencode-tools/text_edit.js +1 -0
- package/dist/opencode-tools/text_read.js +1 -0
- package/dist/opencode-tools/text_write.js +1 -0
- package/dist/plugin/index.js +540 -174
- package/dist/plugins/opencode-gbk-tools.js +18818 -2
- package/dist/release-manifest.json +2 -50
- package/package.json +1 -1
- package/dist/agents/gbk-engine.md +0 -39
|
@@ -1,60 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"manifestVersion": 1,
|
|
3
3
|
"packageName": "opencode-gbk-tools",
|
|
4
|
-
"packageVersion": "0.1.
|
|
4
|
+
"packageVersion": "0.1.16",
|
|
5
5
|
"artifacts": [
|
|
6
|
-
{
|
|
7
|
-
"relativePath": "tools/gbk_edit.js",
|
|
8
|
-
"kind": "tool",
|
|
9
|
-
"expectedHash": "efddd71d4e651881cb24ff411003711715809dbcb5c039a38c4d9e1db940ef81",
|
|
10
|
-
"hashAlgorithm": "sha256"
|
|
11
|
-
},
|
|
12
|
-
{
|
|
13
|
-
"relativePath": "tools/gbk_read.js",
|
|
14
|
-
"kind": "tool",
|
|
15
|
-
"expectedHash": "5cb2dfd454f36695605e9d07f73dd9984edc80cdf7994cd66d56d637b098bd4b",
|
|
16
|
-
"hashAlgorithm": "sha256"
|
|
17
|
-
},
|
|
18
|
-
{
|
|
19
|
-
"relativePath": "tools/gbk_search.js",
|
|
20
|
-
"kind": "tool",
|
|
21
|
-
"expectedHash": "4166ccf37155dc282ee0de623f36b85eda61461a61fd07755091f5386c912477",
|
|
22
|
-
"hashAlgorithm": "sha256"
|
|
23
|
-
},
|
|
24
|
-
{
|
|
25
|
-
"relativePath": "tools/gbk_write.js",
|
|
26
|
-
"kind": "tool",
|
|
27
|
-
"expectedHash": "2313f96bb17a4ee40b1599918049b7f4166b4cd0116a23c8826d1e4bf9f8d749",
|
|
28
|
-
"hashAlgorithm": "sha256"
|
|
29
|
-
},
|
|
30
|
-
{
|
|
31
|
-
"relativePath": "tools/text_edit.js",
|
|
32
|
-
"kind": "tool",
|
|
33
|
-
"expectedHash": "28e22f96cb6e738c55a3c90b8ffae9ef5d5d702649353373d0d04e882c60a5ee",
|
|
34
|
-
"hashAlgorithm": "sha256"
|
|
35
|
-
},
|
|
36
|
-
{
|
|
37
|
-
"relativePath": "tools/text_read.js",
|
|
38
|
-
"kind": "tool",
|
|
39
|
-
"expectedHash": "09de6b032a6c622471e00701be56274e86a6019406f1bf4e45016b90ffabc4d9",
|
|
40
|
-
"hashAlgorithm": "sha256"
|
|
41
|
-
},
|
|
42
|
-
{
|
|
43
|
-
"relativePath": "tools/text_write.js",
|
|
44
|
-
"kind": "tool",
|
|
45
|
-
"expectedHash": "d9b941bb88ecad271a9865eac6595ead964357a04e278ecd43941d4212ab69f3",
|
|
46
|
-
"hashAlgorithm": "sha256"
|
|
47
|
-
},
|
|
48
|
-
{
|
|
49
|
-
"relativePath": "agents/gbk-engine.md",
|
|
50
|
-
"kind": "agent",
|
|
51
|
-
"expectedHash": "3ff7de130d4fd3c318627efd56e2be08ec6ea5b9d37b3d6bf4a7122a9e0997b1",
|
|
52
|
-
"hashAlgorithm": "sha256"
|
|
53
|
-
},
|
|
54
6
|
{
|
|
55
7
|
"relativePath": "plugins/opencode-gbk-tools.js",
|
|
56
8
|
"kind": "plugin",
|
|
57
|
-
"expectedHash": "
|
|
9
|
+
"expectedHash": "8dcda75f5d58a57a70accc76b6e6fe922e9b490b70c9351ba4ca2d420f2903cb",
|
|
58
10
|
"hashAlgorithm": "sha256"
|
|
59
11
|
}
|
|
60
12
|
]
|
package/package.json
CHANGED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
description: 处理 GBK/GB18030 编码文件的专用代理,只使用 gbk_read、gbk_write、gbk_edit、gbk_search
|
|
3
|
-
mode: primary
|
|
4
|
-
permission:
|
|
5
|
-
read: deny
|
|
6
|
-
edit: deny
|
|
7
|
-
grep: deny
|
|
8
|
-
webfetch: ask
|
|
9
|
-
bash:
|
|
10
|
-
"*": deny
|
|
11
|
-
"git status*": allow
|
|
12
|
-
"npm view *": allow
|
|
13
|
-
---
|
|
14
|
-
|
|
15
|
-
你是一个专门处理 GBK/GB18030 文本文件的代理。
|
|
16
|
-
|
|
17
|
-
规则:
|
|
18
|
-
- 读取文件时优先使用 `gbk_read`
|
|
19
|
-
- 创建或覆盖文件时优先使用 `gbk_write`
|
|
20
|
-
- 修改已有文件时优先使用 `gbk_edit`
|
|
21
|
-
- 在大文件中搜索内容时使用 `gbk_search`
|
|
22
|
-
- 大文件读取优先使用 `gbk_read` 的分页或 `tail` 能力,避免一次读取过多内容
|
|
23
|
-
- 修改时优先缩小编辑范围:能用 `startLine/endLine` 或 `startAnchor/endAnchor` 就不要全文替换
|
|
24
|
-
- 文件发现可使用 `glob`,但文件内容读取必须使用 `gbk_read`
|
|
25
|
-
- 禁止依赖内置 `read`、`grep`、`write`、`edit`、`patch`
|
|
26
|
-
- `edit: deny` 同时覆盖内置 `write`、`patch`、`multiedit`
|
|
27
|
-
- 如果用户请求涉及 UTF-8 文件或二进制文件,先明确说明不适用
|
|
28
|
-
- 若目标文件编码不确定,先提醒用户确认是 `gbk` 还是 `gb18030`
|
|
29
|
-
|
|
30
|
-
## 大文件编辑工作流(必须遵守)
|
|
31
|
-
|
|
32
|
-
当 `gbk_read` 返回 `truncated: true` 时,说明文件超出了读取窗口。
|
|
33
|
-
此时若需要编辑文件,**必须按以下步骤操作,禁止直接猜测 oldString**:
|
|
34
|
-
|
|
35
|
-
1. `gbk_search(filePath, pattern)` — 找到目标内容的精确行号和上下文
|
|
36
|
-
2. `gbk_read(filePath, offset=<lineNumber>, limit=<N>)` — 读取目标行的精确内容
|
|
37
|
-
3. `gbk_edit(filePath, oldString=<精确内容>, newString=<新内容>)` — 用精确内容替换
|
|
38
|
-
|
|
39
|
-
**禁止**在未确认精确内容的情况下构造 `oldString`,否则 `gbk_edit` 必然报 `GBK_NO_MATCH`。
|