@sillybit/renamer-opencode-plugin 0.1.0

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Sillybit.io
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,144 @@
1
+ # renamer-opencode-plugin
2
+
3
+ A small OpenCode plugin that **replaces case-insensitive occurrences of `opencode`** with a configurable word (default: `Renamer`) across OpenCode outputs.
4
+
5
+ This is mainly useful for **privacy/safety**: it helps reduce accidental disclosure of the platform name in logs, screenshots, demos, shared transcripts, or tool output.
6
+
7
+ ## Why would I use this?
8
+
9
+ - **Safer sharing**: reduces chance your pasted output reveals “opencode”.
10
+ - **Cleaner demos and screenshots**: consistent wording in public materials.
11
+ - **Non-invasive**: avoids changing URLs, file paths, and code blocks so you don’t break commands, stack traces, or links.
12
+
13
+ ## What it changes (and what it doesn’t)
14
+
15
+ The plugin runs on multiple OpenCode hooks, including chat messages, system prompts, tool output, and session titles.
16
+
17
+ It **does not replace** inside:
18
+
19
+ - URLs (example: `https://opencode.ai/docs/plugins`)
20
+ - file paths (example: `.opencode/...`, `/usr/local/...`, `C:\Users\...`)
21
+ - inline code and fenced code blocks (anything inside backticks)
22
+
23
+ ## Quickstart (npm)
24
+
25
+ 1. Add the plugin to your OpenCode config (`opencode.json` or `opencode.jsonc`):
26
+
27
+ ```json
28
+ {
29
+ "$schema": "https://opencode.ai/config.json",
30
+ "plugin": ["@sillybit/renamer-opencode-plugin"]
31
+ }
32
+ ```
33
+
34
+ 2. Restart OpenCode.
35
+
36
+ OpenCode installs npm plugins automatically at startup (cached under `~/.cache/opencode/node_modules/`).
37
+
38
+ ## Configuration
39
+
40
+ Config is optional. If you don’t configure anything, the plugin is enabled and replaces `opencode` → `Renamer`.
41
+
42
+ Config files are JSON and loaded from both locations:
43
+
44
+ - Global: `~/.config/opencode/renamer-config.json`
45
+ - Project: `.opencode/renamer-config.json`
46
+
47
+ Project config overrides global config.
48
+
49
+ Example:
50
+
51
+ ```json
52
+ {
53
+ "enabled": true,
54
+ "replacement": "Renamer"
55
+ }
56
+ ```
57
+
58
+ ### Environment variables (highest precedence)
59
+
60
+ - `OPENCODE_RENAMER_REPLACE_ENABLED` (`true`/`false`, also supports `1/0`, `yes/no`, `on/off`)
61
+ - `OPENCODE_RENAMER_REPLACE_TEXT` (non-empty string)
62
+
63
+ ## Examples
64
+
65
+ ### Normal text (replaced)
66
+
67
+ Input:
68
+ `I’m using opencode for this task`
69
+
70
+ Output (default):
71
+ `I’m using Renamer for this task`
72
+
73
+ ### URL (not replaced)
74
+
75
+ `https://opencode.ai/docs/plugins` stays unchanged.
76
+
77
+ ### Code (not replaced)
78
+
79
+ Inline code: `` `opencode` `` stays unchanged.
80
+
81
+ Fenced code blocks stay unchanged:
82
+
83
+ ```sh
84
+ echo "opencode"
85
+ ```
86
+
87
+ ## Behavior details
88
+
89
+ - Match is case-insensitive: `OpenCode`, `OPENCODE`, `opencode` all become your `replacement`.
90
+ - Replacement target is intentionally fixed to `opencode` (not configurable).
91
+
92
+ ## Development
93
+
94
+ ```bash
95
+ bun install
96
+ bun run build
97
+ ```
98
+
99
+ ## Contributing
100
+
101
+ ### Commit Message Convention
102
+
103
+ This project follows [Conventional Commits](https://www.conventionalcommits.org/) specification.
104
+
105
+ **Format:**
106
+
107
+ ```
108
+ <type>(<scope>): <subject>
109
+
110
+ <body>
111
+
112
+ <footer>
113
+ ```
114
+
115
+ **Types:**
116
+
117
+ - `feat`: New feature
118
+ - `fix`: Bug fix
119
+ - `docs`: Documentation changes
120
+ - `style`: Code style changes (formatting, missing semicolons, etc.)
121
+ - `refactor`: Code refactoring
122
+ - `perf`: Performance improvements
123
+ - `test`: Adding or updating tests
124
+ - `chore`: Maintenance tasks (dependencies, build config, etc.)
125
+
126
+ **Examples:**
127
+
128
+ ```
129
+ feat: add support for custom replacement patterns
130
+ fix: exclude URLs from text replacement
131
+ docs: update installation instructions
132
+ chore: update dependencies
133
+ ```
134
+
135
+ **Breaking Changes:**
136
+ Use `!` after the type/scope to indicate breaking changes:
137
+
138
+ ```
139
+ feat!: change default replacement from "Renamer" to "Custom"
140
+ ```
141
+
142
+ ## License
143
+
144
+ MIT
@@ -0,0 +1,3 @@
1
+ import type { Plugin } from "@opencode-ai/plugin";
2
+ export declare const RenamerReplacePlugin: Plugin;
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAgOlD,eAAO,MAAM,oBAAoB,EAAE,MA8GlC,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,246 @@
1
+ import fs from "node:fs/promises";
2
+ import os from "node:os";
3
+ import path from "node:path";
4
+ const DEFAULT_CONFIG = {
5
+ enabled: true,
6
+ replacement: "Renamer",
7
+ };
8
+ const CONFIG_FILENAME = "renamer-config.json";
9
+ const ENV_ENABLED = "OPENCODE_RENAMER_REPLACE_ENABLED";
10
+ const ENV_REPLACEMENT = "OPENCODE_RENAMER_REPLACE_TEXT";
11
+ const URL_REGEX = /https?:\/\/[^\s`"')\]]+/gi;
12
+ const PATH_REGEX = /(?:\b[a-zA-Z]:\\[^\s`"')\]]+)|(?:~\/[^\s`"')\]]+)|(?:\.\.?\/[^\s`"')\]]+)|(?:\/[^\s`"')\]]+)/g;
13
+ const OPENCODE_REGEX = /opencode/gi;
14
+ function parseBool(value) {
15
+ if (value === undefined)
16
+ return undefined;
17
+ const normalized = value.trim().toLowerCase();
18
+ if (["true", "1", "yes", "y", "on"].includes(normalized))
19
+ return true;
20
+ if (["false", "0", "no", "n", "off"].includes(normalized))
21
+ return false;
22
+ return undefined;
23
+ }
24
+ function shouldReloadConfig(state) {
25
+ if (!state.lastLoaded)
26
+ return true;
27
+ return Date.now() - state.lastLoaded > 1000;
28
+ }
29
+ async function readConfigFile(filePath) {
30
+ const raw = await fs.readFile(filePath, "utf8").catch(() => undefined);
31
+ if (!raw)
32
+ return undefined;
33
+ try {
34
+ const parsed = JSON.parse(raw);
35
+ return parsed;
36
+ }
37
+ catch {
38
+ return undefined;
39
+ }
40
+ }
41
+ async function loadConfig(state) {
42
+ if (!shouldReloadConfig(state) && state.cachedConfig) {
43
+ return state.cachedConfig;
44
+ }
45
+ const projectConfig = state.projectConfigPath
46
+ ? await readConfigFile(state.projectConfigPath)
47
+ : undefined;
48
+ const globalConfig = state.globalConfigPath
49
+ ? await readConfigFile(state.globalConfigPath)
50
+ : undefined;
51
+ const merged = {
52
+ ...DEFAULT_CONFIG,
53
+ ...(globalConfig ?? {}),
54
+ ...(projectConfig ?? {}),
55
+ };
56
+ const envEnabled = parseBool(process.env[ENV_ENABLED]);
57
+ if (envEnabled !== undefined) {
58
+ merged.enabled = envEnabled;
59
+ }
60
+ const envReplacement = process.env[ENV_REPLACEMENT];
61
+ if (envReplacement && envReplacement.trim().length > 0) {
62
+ merged.replacement = envReplacement;
63
+ }
64
+ state.cachedConfig = merged;
65
+ state.lastLoaded = Date.now();
66
+ return merged;
67
+ }
68
+ function replaceOpencode(text, replacement) {
69
+ if (!text)
70
+ return text;
71
+ return text.replace(OPENCODE_REGEX, replacement);
72
+ }
73
+ function replaceOutsideRanges(text, replacement, ranges) {
74
+ if (ranges.length === 0)
75
+ return replaceOpencode(text, replacement);
76
+ const sorted = ranges
77
+ .map((range) => [Math.max(0, range[0]), Math.max(0, range[1])])
78
+ .filter(([start, end]) => end > start)
79
+ .sort((a, b) => a[0] - b[0]);
80
+ let result = "";
81
+ let cursor = 0;
82
+ for (const [start, end] of sorted) {
83
+ if (start > cursor) {
84
+ result += replaceOpencode(text.slice(cursor, start), replacement);
85
+ }
86
+ result += text.slice(start, end);
87
+ cursor = Math.max(cursor, end);
88
+ }
89
+ if (cursor < text.length) {
90
+ result += replaceOpencode(text.slice(cursor), replacement);
91
+ }
92
+ return result;
93
+ }
94
+ function replaceExcludingUrlsAndPaths(text, replacement) {
95
+ const ranges = [];
96
+ const urlMatches = text.matchAll(URL_REGEX);
97
+ for (const match of urlMatches) {
98
+ if (match.index === undefined)
99
+ continue;
100
+ ranges.push([match.index, match.index + match[0].length]);
101
+ }
102
+ const pathMatches = text.matchAll(PATH_REGEX);
103
+ for (const match of pathMatches) {
104
+ if (match.index === undefined)
105
+ continue;
106
+ ranges.push([match.index, match.index + match[0].length]);
107
+ }
108
+ return replaceOutsideRanges(text, replacement, ranges);
109
+ }
110
+ function replaceInInlineCodeSegments(text, replacement) {
111
+ const segments = text.split("`");
112
+ return segments
113
+ .map((segment, index) => {
114
+ if (index % 2 === 1)
115
+ return segment;
116
+ return replaceExcludingUrlsAndPaths(segment, replacement);
117
+ })
118
+ .join("`");
119
+ }
120
+ function replaceInText(text, replacement) {
121
+ const blocks = text.split("```");
122
+ return blocks
123
+ .map((block, index) => {
124
+ if (index % 2 === 1)
125
+ return block;
126
+ return replaceInInlineCodeSegments(block, replacement);
127
+ })
128
+ .join("```");
129
+ }
130
+ function replaceInParts(parts, replacement) {
131
+ for (const part of parts) {
132
+ if (part.type === "text" && typeof part.text === "string") {
133
+ part.text = replaceInText(part.text, replacement);
134
+ }
135
+ if (part.type === "subtask") {
136
+ if (typeof part.prompt === "string") {
137
+ part.prompt = replaceInText(part.prompt, replacement);
138
+ }
139
+ if (typeof part.description === "string") {
140
+ part.description = replaceInText(part.description, replacement);
141
+ }
142
+ }
143
+ if (typeof part.title === "string") {
144
+ part.title = replaceInText(part.title, replacement);
145
+ }
146
+ if (typeof part.description === "string") {
147
+ part.description = replaceInText(part.description, replacement);
148
+ }
149
+ }
150
+ }
151
+ function replaceInMessages(messages, replacement) {
152
+ for (const message of messages) {
153
+ replaceInParts(message.parts, replacement);
154
+ if (typeof message.info?.title === "string") {
155
+ message.info.title = replaceInText(message.info.title, replacement);
156
+ }
157
+ }
158
+ }
159
+ function updateSessionTitleIfNeeded(title, replacement) {
160
+ if (!title)
161
+ return title;
162
+ if (!OPENCODE_REGEX.test(title))
163
+ return title;
164
+ return replaceInText(title, replacement);
165
+ }
166
+ export const RenamerReplacePlugin = async ({ client, directory, worktree, }) => {
167
+ const state = {};
168
+ const projectRoot = worktree || directory;
169
+ state.projectConfigPath = path.join(projectRoot, ".opencode", CONFIG_FILENAME);
170
+ state.globalConfigPath = path.join(os.homedir(), ".config", "opencode", CONFIG_FILENAME);
171
+ async function withConfig(fn) {
172
+ const config = await loadConfig(state);
173
+ return fn(config);
174
+ }
175
+ return {
176
+ event: async ({ event }) => {
177
+ if (event.type === "file.edited" ||
178
+ event.type === "file.watcher.updated") {
179
+ const filePath = event.path;
180
+ if (filePath &&
181
+ (filePath === state.projectConfigPath ||
182
+ filePath === state.globalConfigPath)) {
183
+ state.lastLoaded = 0;
184
+ }
185
+ }
186
+ if (event.type === "session.updated") {
187
+ await withConfig(async (config) => {
188
+ if (!config.enabled)
189
+ return;
190
+ const title = event.title;
191
+ const updated = updateSessionTitleIfNeeded(title, config.replacement);
192
+ if (!updated || updated === title)
193
+ return;
194
+ const sessionID = event.sessionID;
195
+ if (!sessionID)
196
+ return;
197
+ await client.session.update({
198
+ path: { id: sessionID },
199
+ body: { title: updated },
200
+ });
201
+ });
202
+ }
203
+ },
204
+ "chat.message": async (_input, output) => {
205
+ await withConfig((config) => {
206
+ if (!config.enabled)
207
+ return;
208
+ replaceInParts(output.parts, config.replacement);
209
+ });
210
+ },
211
+ "experimental.chat.system.transform": async (_input, output) => {
212
+ await withConfig((config) => {
213
+ if (!config.enabled)
214
+ return;
215
+ output.system = output.system.map((item) => replaceInText(item, config.replacement));
216
+ });
217
+ },
218
+ "experimental.chat.messages.transform": async (_input, output) => {
219
+ await withConfig((config) => {
220
+ if (!config.enabled)
221
+ return;
222
+ replaceInMessages(output.messages, config.replacement);
223
+ });
224
+ },
225
+ "experimental.text.complete": async (_input, output) => {
226
+ await withConfig((config) => {
227
+ if (!config.enabled)
228
+ return;
229
+ output.text = replaceInText(output.text, config.replacement);
230
+ });
231
+ },
232
+ "tool.execute.after": async (_input, output) => {
233
+ await withConfig((config) => {
234
+ if (!config.enabled)
235
+ return;
236
+ if (typeof output.title === "string") {
237
+ output.title = replaceInText(output.title, config.replacement);
238
+ }
239
+ if (typeof output.output === "string") {
240
+ output.output = replaceInText(output.output, config.replacement);
241
+ }
242
+ });
243
+ },
244
+ };
245
+ };
246
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAClC,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAiB7B,MAAM,cAAc,GAAkB;IACpC,OAAO,EAAE,IAAI;IACb,WAAW,EAAE,SAAS;CACvB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MAAM,EAAE,MAAM,EAAE,EAAE;YAC7C,MAAM,UAAU,CAAC,CAAC,MAAM,EAAE,EAAE;gBAC1B,IAAI,CAAC,MAAM,CAAC,OAAO;oBAAE,OAAO;gBAC5B,IAAI,OAAO,MAAM,CAAC,KAAK,KAAK,QAAQ,EAAE,CAAC;oBACrC,MAAM,CAAC,KAAK,GAAG,aAAa,CAAC,MAAM,CAAC,KAAK,EAAE,MAAM,CAAC,WAAW,CAAC,CAAC;gBACjE,CAAC;gBACD,IAAI,OAAO,MAAM,CAAC,MAAM,KAAK,QAAQ,EAAE,CAAC;oBACtC,MAAM,CAAC,MAAM,GAAG,aAAa,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,WAAW,CAAC,CAAC;gBACnE,CAAC;YACH,CAAC,CAAC,CAAC;QACL,CAAC;KACF,CAAC;AACJ,CAAC,CAAC"}
package/package.json ADDED
@@ -0,0 +1,55 @@
1
+ {
2
+ "name": "@sillybit/renamer-opencode-plugin",
3
+ "version": "0.1.0",
4
+ "description": "OpenCode plugin that replaces case-insensitive 'opencode' text with a configurable value (default: 'Renamer') across chat messages, system prompts, tool outputs, and session titles",
5
+ "type": "module",
6
+ "main": "dist/index.js",
7
+ "types": "dist/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "types": "./dist/index.d.ts",
11
+ "default": "./dist/index.js"
12
+ }
13
+ },
14
+ "files": [
15
+ "dist",
16
+ "README.md",
17
+ "LICENSE"
18
+ ],
19
+ "scripts": {
20
+ "build": "tsc -p tsconfig.json",
21
+ "prepack": "bun run build",
22
+ "format": "biome format --write .",
23
+ "lint": "biome lint .",
24
+ "check": "biome check --write ."
25
+ },
26
+ "license": "MIT",
27
+ "publishConfig": {
28
+ "access": "public"
29
+ },
30
+ "repository": {
31
+ "type": "git",
32
+ "url": "https://github.com/Sillybit-io/renamer-opencode-plugin.git"
33
+ },
34
+ "homepage": "https://github.com/Sillybit-io/renamer-opencode-plugin#readme",
35
+ "bugs": {
36
+ "url": "https://github.com/Sillybit-io/renamer-opencode-plugin/issues"
37
+ },
38
+ "keywords": [
39
+ "opencode",
40
+ "opencode-plugin",
41
+ "renamer",
42
+ "text-transform"
43
+ ],
44
+ "engines": {
45
+ "node": ">=18"
46
+ },
47
+ "dependencies": {
48
+ "@opencode-ai/plugin": "^1.1.21"
49
+ },
50
+ "devDependencies": {
51
+ "@biomejs/biome": "^2.3.11",
52
+ "@types/node": "^24.5.0",
53
+ "typescript": "^5.9.3"
54
+ }
55
+ }