openslimedit 1.0.2 → 1.0.4

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.
Files changed (3) hide show
  1. package/README.md +7 -15
  2. package/package.json +1 -1
  3. package/src/index.ts +1 -38
package/README.md CHANGED
@@ -44,26 +44,18 @@ No custom tools. No system prompt injection. No modifications to built-in tool b
44
44
 
45
45
  ## Installation
46
46
 
47
- ### Prerequisites
47
+ Add to your OpenCode config:
48
48
 
49
- - [OpenCode](https://github.com/anomalyco/opencode) with plugin hook support
50
- - [Bun](https://bun.sh) runtime
51
-
52
- ```bash
53
- npm install openslimedit
54
- ```
55
-
56
- Then add it to your OpenCode config (`.opencode/opencode.json` or `opencode.jsonc`):
57
-
58
- ```json
49
+ ```jsonc
50
+ // .opencode/opencode.jsonc
59
51
  {
60
- "plugin": [
61
- "openslimedit@latest"
62
- ]
52
+ "plugin": ["openslimedit@latest"]
63
53
  }
64
54
  ```
65
55
 
66
- Start OpenCode and the plugin activates automatically.
56
+ Using `@latest` ensures you always get the newest version automatically when OpenCode starts.
57
+
58
+ Restart OpenCode. The plugin will automatically start optimizing your sessions.
67
59
 
68
60
  ---
69
61
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "openslimedit",
3
- "version": "1.0.2",
3
+ "version": "1.0.4",
4
4
  "description": "OpenCode plugin that reduces token usage by up to 33% — compresses tool descriptions, compacts read output, adds line-range edit support",
5
5
  "type": "module",
6
6
  "license": "MIT",
package/src/index.ts CHANGED
@@ -1,42 +1,8 @@
1
1
  import type { Plugin } from "@opencode-ai/plugin"
2
2
  import * as fs from "fs"
3
3
  import * as path from "path"
4
- import { z } from "zod"
5
-
6
4
  const LINE_RANGE_RE = /^(\d+)(?:\s*-\s*(\d+))?$/
7
5
 
8
- // Minimal parameter schemas (no .describe() calls = no descriptions in JSON schema)
9
- const SLIM_PARAMS: Record<string, any> = {
10
- read: z.object({
11
- filePath: z.string(),
12
- offset: z.coerce.number().optional(),
13
- limit: z.coerce.number().optional(),
14
- }),
15
- edit: z.object({
16
- filePath: z.string(),
17
- oldString: z.string(),
18
- newString: z.string(),
19
- replaceAll: z.boolean().optional(),
20
- }),
21
- write: z.object({
22
- filePath: z.string(),
23
- content: z.string(),
24
- }),
25
- bash: z.object({
26
- command: z.string(),
27
- timeout: z.number().optional(),
28
- }),
29
- glob: z.object({
30
- pattern: z.string(),
31
- path: z.string().optional(),
32
- }),
33
- grep: z.object({
34
- pattern: z.string(),
35
- path: z.string().optional(),
36
- include: z.string().optional(),
37
- }),
38
- }
39
-
40
6
  export const OpenSlimeditPlugin: Plugin = async ({ directory }) => {
41
7
  function resolvePath(filePath: string): string {
42
8
  if (path.isAbsolute(filePath)) return path.normalize(filePath)
@@ -49,6 +15,7 @@ export const OpenSlimeditPlugin: Plugin = async ({ directory }) => {
49
15
  const SLIM: Record<string, string> = {
50
16
  read: "Read file content.",
51
17
  edit: "Edit file. oldString can be line range '55-64'.",
18
+ apply_patch: "Apply a patch to files.",
52
19
  write: "Write file.",
53
20
  bash: "Run shell command.",
54
21
  glob: "Find files.",
@@ -59,10 +26,6 @@ export const OpenSlimeditPlugin: Plugin = async ({ directory }) => {
59
26
  if (SLIM[input.toolID]) {
60
27
  output.description = SLIM[input.toolID]
61
28
  }
62
- // Parameter schema compression disabled — hurts large-file-edit on minimax
63
- // if (SLIM_PARAMS[input.toolID]) {
64
- // output.parameters = SLIM_PARAMS[input.toolID]
65
- // }
66
29
  },
67
30
 
68
31
  // Compact tool output: shorten read paths, strip footer, compress edit results