opencode-gbk-tools 0.1.4 → 0.1.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 CHANGED
@@ -92,6 +92,28 @@ opencode-gbk doctor
92
92
  opencode-gbk doctor --project
93
93
  ```
94
94
 
95
+ ## 卸载
96
+
97
+ 如果你是通过 `setup` 或手动修改 `opencode.json` / `opencode.jsonc` 启用 npm plugin:
98
+
99
+ - 删除 `plugin` 数组中的 `"opencode-gbk-tools"`
100
+ - 如果不再需要 `gbk-engine`,再删除对应 agent 文件
101
+ - 项目级:`.opencode/agents/gbk-engine.md`
102
+ - 全局:`~/.config/opencode/agents/gbk-engine.md`
103
+
104
+ 如果你是通过 CLI 安装 agent 或工具文件:
105
+
106
+ ```bash
107
+ opencode-gbk uninstall
108
+ opencode-gbk uninstall --project
109
+ ```
110
+
111
+ 说明:
112
+
113
+ - `opencode-gbk uninstall` 会卸载全局安装到 `~/.config/opencode` 下的文件
114
+ - `opencode-gbk uninstall --project` 会卸载当前项目 `.opencode/` 下的文件
115
+ - `uninstall` 只会删除通过本包 manifest 记录过的文件,不会自动改写你的 `opencode.json` / `opencode.jsonc` plugin 配置
116
+
95
117
  ## Agent
96
118
 
97
119
  安装后会生成 `gbk-engine`。
@@ -16720,17 +16720,23 @@ async function replaceGbkFileText(input) {
16720
16720
 
16721
16721
  // src/tools/gbk_edit.ts
16722
16722
  var gbk_edit_default = tool({
16723
- description: "Edit GBK encoded text files with exact replacement",
16723
+ description: `Edit GBK/GB18030 encoded text files with exact string replacement.
16724
+
16725
+ Reads the FULL file content regardless of file size \u2014 not limited by gbk_read's line window.
16726
+ Safe to use on files with more than 2000 lines.
16727
+
16728
+ For large files, use 'startLine'/'endLine' or 'startAnchor'/'endAnchor' to narrow the search scope
16729
+ and avoid false matches. Scoped edits also improve performance on very large files.`,
16724
16730
  args: {
16725
16731
  filePath: tool.schema.string().describe("Target file path"),
16726
- oldString: tool.schema.string().describe("Text to replace"),
16732
+ oldString: tool.schema.string().describe("Exact text to replace (must match file content, not gbk_read output with line numbers)"),
16727
16733
  newString: tool.schema.string().describe("Replacement text"),
16728
- replaceAll: tool.schema.boolean().optional().describe("Replace all occurrences"),
16729
- startLine: tool.schema.union([tool.schema.number().int().positive(), tool.schema.literal(-1)]).optional().describe("Restrict edit to 1-based start line"),
16730
- endLine: tool.schema.union([tool.schema.number().int().positive(), tool.schema.literal(-1)]).optional().describe("Restrict edit to 1-based end line"),
16731
- startAnchor: tool.schema.string().optional().describe("Restrict edit to content after this anchor"),
16732
- endAnchor: tool.schema.string().optional().describe("Restrict edit to content before this anchor"),
16733
- encoding: tool.schema.enum(["gbk", "gb18030"]).optional().describe("Text encoding"),
16734
+ replaceAll: tool.schema.boolean().optional().describe("Replace all occurrences (default: false, requires unique match)"),
16735
+ startLine: tool.schema.union([tool.schema.number().int().positive(), tool.schema.literal(-1)]).optional().describe("Restrict edit scope to 1-based start line (inclusive)"),
16736
+ endLine: tool.schema.union([tool.schema.number().int().positive(), tool.schema.literal(-1)]).optional().describe("Restrict edit scope to 1-based end line (inclusive)"),
16737
+ startAnchor: tool.schema.string().optional().describe("Restrict edit to content after this anchor string"),
16738
+ endAnchor: tool.schema.string().optional().describe("Restrict edit to content before this anchor string"),
16739
+ encoding: tool.schema.enum(["gbk", "gb18030"]).optional().describe("Text encoding (default: gbk)"),
16734
16740
  allowExternal: tool.schema.boolean().optional().describe("Allow paths outside workspace root")
16735
16741
  },
16736
16742
  async execute(args, context) {
@@ -16604,13 +16604,21 @@ async function readGbkFile(input) {
16604
16604
 
16605
16605
  // src/tools/gbk_read.ts
16606
16606
  var gbk_read_default = tool({
16607
- description: "Read GBK encoded text files",
16607
+ description: `Read GBK/GB18030 encoded text files with line numbers.
16608
+
16609
+ Returns up to 'limit' lines (default 2000) starting from 'offset'.
16610
+ When the file has more lines than the window, 'truncated' is true and 'totalLines' shows the full count.
16611
+
16612
+ IMPORTANT: If 'truncated' is true, the returned content is incomplete.
16613
+ DO NOT use the returned content as 'oldString' for gbk_edit on a truncated file.
16614
+ To edit content beyond the visible window, use gbk_edit with 'startLine'/'endLine' to target the exact range,
16615
+ or read the specific range first with 'offset' set to the desired line number.`,
16608
16616
  args: {
16609
16617
  filePath: tool.schema.string().describe("Target file path"),
16610
- offset: tool.schema.union([tool.schema.number().int().positive(), tool.schema.literal(-1)]).optional().describe("1-based start line"),
16611
- limit: tool.schema.union([tool.schema.number().int().positive(), tool.schema.literal(-1)]).optional().describe("Number of lines to read"),
16618
+ offset: tool.schema.union([tool.schema.number().int().positive(), tool.schema.literal(-1)]).optional().describe("1-based start line (default: 1)"),
16619
+ limit: tool.schema.union([tool.schema.number().int().positive(), tool.schema.literal(-1)]).optional().describe("Number of lines to read (default: 2000). Use -1 to apply the default."),
16612
16620
  tail: tool.schema.boolean().optional().describe("Read last N lines instead of offset-based window"),
16613
- encoding: tool.schema.enum(["gbk", "gb18030"]).optional().describe("Text encoding"),
16621
+ encoding: tool.schema.enum(["gbk", "gb18030"]).optional().describe("Text encoding (default: gbk)"),
16614
16622
  allowExternal: tool.schema.boolean().optional().describe("Allow paths outside workspace root")
16615
16623
  },
16616
16624
  async execute(args, context) {
@@ -16971,17 +16971,23 @@ async function writeGbkFile(input) {
16971
16971
 
16972
16972
  // src/tools/gbk_edit.ts
16973
16973
  var gbk_edit_default = tool({
16974
- description: "Edit GBK encoded text files with exact replacement",
16974
+ description: `Edit GBK/GB18030 encoded text files with exact string replacement.
16975
+
16976
+ Reads the FULL file content regardless of file size \u2014 not limited by gbk_read's line window.
16977
+ Safe to use on files with more than 2000 lines.
16978
+
16979
+ For large files, use 'startLine'/'endLine' or 'startAnchor'/'endAnchor' to narrow the search scope
16980
+ and avoid false matches. Scoped edits also improve performance on very large files.`,
16975
16981
  args: {
16976
16982
  filePath: tool.schema.string().describe("Target file path"),
16977
- oldString: tool.schema.string().describe("Text to replace"),
16983
+ oldString: tool.schema.string().describe("Exact text to replace (must match file content, not gbk_read output with line numbers)"),
16978
16984
  newString: tool.schema.string().describe("Replacement text"),
16979
- replaceAll: tool.schema.boolean().optional().describe("Replace all occurrences"),
16980
- startLine: tool.schema.union([tool.schema.number().int().positive(), tool.schema.literal(-1)]).optional().describe("Restrict edit to 1-based start line"),
16981
- endLine: tool.schema.union([tool.schema.number().int().positive(), tool.schema.literal(-1)]).optional().describe("Restrict edit to 1-based end line"),
16982
- startAnchor: tool.schema.string().optional().describe("Restrict edit to content after this anchor"),
16983
- endAnchor: tool.schema.string().optional().describe("Restrict edit to content before this anchor"),
16984
- encoding: tool.schema.enum(["gbk", "gb18030"]).optional().describe("Text encoding"),
16985
+ replaceAll: tool.schema.boolean().optional().describe("Replace all occurrences (default: false, requires unique match)"),
16986
+ startLine: tool.schema.union([tool.schema.number().int().positive(), tool.schema.literal(-1)]).optional().describe("Restrict edit scope to 1-based start line (inclusive)"),
16987
+ endLine: tool.schema.union([tool.schema.number().int().positive(), tool.schema.literal(-1)]).optional().describe("Restrict edit scope to 1-based end line (inclusive)"),
16988
+ startAnchor: tool.schema.string().optional().describe("Restrict edit to content after this anchor string"),
16989
+ endAnchor: tool.schema.string().optional().describe("Restrict edit to content before this anchor string"),
16990
+ encoding: tool.schema.enum(["gbk", "gb18030"]).optional().describe("Text encoding (default: gbk)"),
16985
16991
  allowExternal: tool.schema.boolean().optional().describe("Allow paths outside workspace root")
16986
16992
  },
16987
16993
  async execute(args, context) {
@@ -16992,13 +16998,21 @@ var gbk_edit_default = tool({
16992
16998
 
16993
16999
  // src/tools/gbk_read.ts
16994
17000
  var gbk_read_default = tool({
16995
- description: "Read GBK encoded text files",
17001
+ description: `Read GBK/GB18030 encoded text files with line numbers.
17002
+
17003
+ Returns up to 'limit' lines (default 2000) starting from 'offset'.
17004
+ When the file has more lines than the window, 'truncated' is true and 'totalLines' shows the full count.
17005
+
17006
+ IMPORTANT: If 'truncated' is true, the returned content is incomplete.
17007
+ DO NOT use the returned content as 'oldString' for gbk_edit on a truncated file.
17008
+ To edit content beyond the visible window, use gbk_edit with 'startLine'/'endLine' to target the exact range,
17009
+ or read the specific range first with 'offset' set to the desired line number.`,
16996
17010
  args: {
16997
17011
  filePath: tool.schema.string().describe("Target file path"),
16998
- offset: tool.schema.union([tool.schema.number().int().positive(), tool.schema.literal(-1)]).optional().describe("1-based start line"),
16999
- limit: tool.schema.union([tool.schema.number().int().positive(), tool.schema.literal(-1)]).optional().describe("Number of lines to read"),
17012
+ offset: tool.schema.union([tool.schema.number().int().positive(), tool.schema.literal(-1)]).optional().describe("1-based start line (default: 1)"),
17013
+ limit: tool.schema.union([tool.schema.number().int().positive(), tool.schema.literal(-1)]).optional().describe("Number of lines to read (default: 2000). Use -1 to apply the default."),
17000
17014
  tail: tool.schema.boolean().optional().describe("Read last N lines instead of offset-based window"),
17001
- encoding: tool.schema.enum(["gbk", "gb18030"]).optional().describe("Text encoding"),
17015
+ encoding: tool.schema.enum(["gbk", "gb18030"]).optional().describe("Text encoding (default: gbk)"),
17002
17016
  allowExternal: tool.schema.boolean().optional().describe("Allow paths outside workspace root")
17003
17017
  },
17004
17018
  async execute(args, context) {
@@ -1,18 +1,18 @@
1
1
  {
2
2
  "manifestVersion": 1,
3
3
  "packageName": "opencode-gbk-tools",
4
- "packageVersion": "0.1.4",
4
+ "packageVersion": "0.1.5",
5
5
  "artifacts": [
6
6
  {
7
7
  "relativePath": "tools/gbk_edit.js",
8
8
  "kind": "tool",
9
- "expectedHash": "6a8a26850a21e47a9ececc2b8606452491a654d5fc79ef908cfbcea9e6c5b7e3",
9
+ "expectedHash": "3d0eb2fab5e3eca869923c2a3cc00e58ed429a4be4dbed22d13e5a5343bd5acc",
10
10
  "hashAlgorithm": "sha256"
11
11
  },
12
12
  {
13
13
  "relativePath": "tools/gbk_read.js",
14
14
  "kind": "tool",
15
- "expectedHash": "c61e5ee95e05e96965c76e5dc2f18b3943bc3c2a76567b415839442358024d46",
15
+ "expectedHash": "799c53835bfe7237c5bf1e4858a67d20fffe00f90958ef48b72877cb95c1c07f",
16
16
  "hashAlgorithm": "sha256"
17
17
  },
18
18
  {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencode-gbk-tools",
3
- "version": "0.1.4",
3
+ "version": "0.1.5",
4
4
  "description": "GBK/GB18030 custom tools and agent for OpenCode",
5
5
  "type": "module",
6
6
  "license": "MIT",