codepage-bridge-mcp 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/.claude-plugin/marketplace.json +19 -0
- package/.claude-plugin/plugin.json +15 -0
- package/.mcp.json +11 -0
- package/LICENSE +21 -0
- package/README.md +990 -0
- package/README_CN.md +781 -0
- package/dist/src/core.d.ts +56 -0
- package/dist/src/core.js +166 -0
- package/dist/src/core.js.map +1 -0
- package/dist/src/diff.d.ts +8 -0
- package/dist/src/diff.js +11 -0
- package/dist/src/diff.js.map +1 -0
- package/dist/src/encoding/codec.d.ts +5 -0
- package/dist/src/encoding/codec.js +75 -0
- package/dist/src/encoding/codec.js.map +1 -0
- package/dist/src/encoding/index.d.ts +3 -0
- package/dist/src/encoding/index.js +4 -0
- package/dist/src/encoding/index.js.map +1 -0
- package/dist/src/encoding/rules.d.ts +4 -0
- package/dist/src/encoding/rules.js +70 -0
- package/dist/src/encoding/rules.js.map +1 -0
- package/dist/src/encoding/types.d.ts +22 -0
- package/dist/src/encoding/types.js +2 -0
- package/dist/src/encoding/types.js.map +1 -0
- package/dist/src/filesystem/atomic.d.ts +6 -0
- package/dist/src/filesystem/atomic.js +91 -0
- package/dist/src/filesystem/atomic.js.map +1 -0
- package/dist/src/filesystem/cache.d.ts +21 -0
- package/dist/src/filesystem/cache.js +40 -0
- package/dist/src/filesystem/cache.js.map +1 -0
- package/dist/src/filesystem/index.d.ts +4 -0
- package/dist/src/filesystem/index.js +5 -0
- package/dist/src/filesystem/index.js.map +1 -0
- package/dist/src/filesystem/mutex.d.ts +5 -0
- package/dist/src/filesystem/mutex.js +23 -0
- package/dist/src/filesystem/mutex.js.map +1 -0
- package/dist/src/filesystem/path.d.ts +9 -0
- package/dist/src/filesystem/path.js +53 -0
- package/dist/src/filesystem/path.js.map +1 -0
- package/dist/src/media/errors.d.ts +14 -0
- package/dist/src/media/errors.js +29 -0
- package/dist/src/media/errors.js.map +1 -0
- package/dist/src/media/image.d.ts +11 -0
- package/dist/src/media/image.js +81 -0
- package/dist/src/media/image.js.map +1 -0
- package/dist/src/media/index.d.ts +5 -0
- package/dist/src/media/index.js +6 -0
- package/dist/src/media/index.js.map +1 -0
- package/dist/src/media/notebook.d.ts +47 -0
- package/dist/src/media/notebook.js +122 -0
- package/dist/src/media/notebook.js.map +1 -0
- package/dist/src/media/pdf.d.ts +25 -0
- package/dist/src/media/pdf.js +104 -0
- package/dist/src/media/pdf.js.map +1 -0
- package/dist/src/media/types.d.ts +14 -0
- package/dist/src/media/types.js +2 -0
- package/dist/src/media/types.js.map +1 -0
- package/dist/src/prompts.d.ts +8 -0
- package/dist/src/prompts.js +46 -0
- package/dist/src/prompts.js.map +1 -0
- package/dist/src/schemas.d.ts +138 -0
- package/dist/src/schemas.js +81 -0
- package/dist/src/schemas.js.map +1 -0
- package/dist/src/server.d.ts +159 -0
- package/dist/src/server.js +98 -0
- package/dist/src/server.js.map +1 -0
- package/dist/src/toolTypes.d.ts +31 -0
- package/dist/src/toolTypes.js +2 -0
- package/dist/src/toolTypes.js.map +1 -0
- package/dist/src/tools/edit.d.ts +3 -0
- package/dist/src/tools/edit.js +168 -0
- package/dist/src/tools/edit.js.map +1 -0
- package/dist/src/tools/grep.d.ts +21 -0
- package/dist/src/tools/grep.js +192 -0
- package/dist/src/tools/grep.js.map +1 -0
- package/dist/src/tools/read.d.ts +3 -0
- package/dist/src/tools/read.js +137 -0
- package/dist/src/tools/read.js.map +1 -0
- package/dist/src/tools/write.d.ts +3 -0
- package/dist/src/tools/write.js +80 -0
- package/dist/src/tools/write.js.map +1 -0
- package/dist/src/validation.d.ts +6 -0
- package/dist/src/validation.js +42 -0
- package/dist/src/validation.js.map +1 -0
- package/examples/claude-config/settings.fragment.json +17 -0
- package/examples/minimal-project/.encoding-rules +10 -0
- package/examples/minimal-project/.mcp.json +11 -0
- package/examples/minimal-project/CLAUDE.md +15 -0
- package/install/download-release-unix.sh +72 -0
- package/install/download-release-windows.ps1 +61 -0
- package/install/install-from-release-unix.sh +18 -0
- package/install/install-from-release-windows.ps1 +19 -0
- package/install/install-from-source-unix.sh +44 -0
- package/install/install-from-source-windows.ps1 +45 -0
- package/install/install-this-release-unix.sh +37 -0
- package/install/install-this-release-windows.ps1 +36 -0
- package/package.json +64 -0
package/README.md
ADDED
|
@@ -0,0 +1,990 @@
|
|
|
1
|
+
# Codepage Bridge MCP
|
|
2
|
+
|
|
3
|
+
[中文说明 / README_CN](README_CN.md)
|
|
4
|
+
|
|
5
|
+
Encoding-transparent file tools for Claude Code and other MCP clients.
|
|
6
|
+
|
|
7
|
+
Codepage Bridge exposes `Read`, `Grep`, `Edit`, and `Write` over MCP while transparently converting project files between their on-disk legacy encoding and Unicode text for the LLM. The model sees normal Unicode text; files are written back in the encoding selected by the nearest `.encoding-rules`.
|
|
8
|
+
|
|
9
|
+
It is designed for legacy codebases that still use GBK/GB2312/GB18030, Big5, Shift-JIS, EUC-KR, Windows codepages, UTF-16, and other non-UTF-8 encodings.
|
|
10
|
+
|
|
11
|
+
## Quick Start
|
|
12
|
+
|
|
13
|
+
You currently have three installation paths:
|
|
14
|
+
|
|
15
|
+
### Option A — Install from Marketplace (plugin-ready, publish step still required)
|
|
16
|
+
|
|
17
|
+
This is the intended long-term default path for ordinary users.
|
|
18
|
+
|
|
19
|
+
Current status:
|
|
20
|
+
|
|
21
|
+
- the repository now contains the minimum Claude Code plugin / marketplace structure;
|
|
22
|
+
- the plugin declares Codepage Bridge through a plugin-local `.mcp.json`;
|
|
23
|
+
- the plugin includes `/setup`, `/setup-project`, and `/doctor` commands.
|
|
24
|
+
|
|
25
|
+
What is still required before true marketplace one-click installation works end to end:
|
|
26
|
+
|
|
27
|
+
1. publish `codepage-bridge-mcp` to npm or another `npx`-reachable registry;
|
|
28
|
+
2. add this repository to a Claude Code marketplace source;
|
|
29
|
+
3. install the plugin from that marketplace.
|
|
30
|
+
|
|
31
|
+
Once those steps are completed, users will be able to install Codepage Bridge from marketplace without cloning the repository.
|
|
32
|
+
|
|
33
|
+
For now, use **GitHub Release installation** below.
|
|
34
|
+
|
|
35
|
+
### Option B — Install from GitHub Release (recommended for normal users right now)
|
|
36
|
+
|
|
37
|
+
This is the current recommended path for ordinary users.
|
|
38
|
+
|
|
39
|
+
You can choose one of two sub-paths:
|
|
40
|
+
|
|
41
|
+
1. **You already downloaded and extracted the release package**
|
|
42
|
+
2. **You want a script to download the release package for you**
|
|
43
|
+
|
|
44
|
+
Both paths avoid local `npm install` and local `npm run build`.
|
|
45
|
+
|
|
46
|
+
They still require local:
|
|
47
|
+
|
|
48
|
+
- `claude`
|
|
49
|
+
- `node`
|
|
50
|
+
|
|
51
|
+
### Option C — Install from source (contributors and local development only)
|
|
52
|
+
|
|
53
|
+
Use this path only if you want to:
|
|
54
|
+
|
|
55
|
+
- develop Codepage Bridge itself;
|
|
56
|
+
- inspect or modify the implementation;
|
|
57
|
+
- debug installation issues locally.
|
|
58
|
+
|
|
59
|
+
Typical flow:
|
|
60
|
+
|
|
61
|
+
1. clone the repository;
|
|
62
|
+
2. run `npm install`;
|
|
63
|
+
3. run `npm run build`;
|
|
64
|
+
4. register the MCP manually or via the source installer.
|
|
65
|
+
|
|
66
|
+
If you skip the built-in tool blocking and `CLAUDE.md` policy steps, Claude Code may continue using its built-in file tools and bypass `.encoding-rules`.
|
|
67
|
+
|
|
68
|
+
---
|
|
69
|
+
|
|
70
|
+
## Marketplace / Plugin Publishing Plan
|
|
71
|
+
|
|
72
|
+
This repository now includes the minimum Claude Code marketplace/plugin structure:
|
|
73
|
+
|
|
74
|
+
- `.claude-plugin/plugin.json`
|
|
75
|
+
- `.claude-plugin/marketplace.json`
|
|
76
|
+
- plugin-local `.mcp.json`
|
|
77
|
+
- plugin commands in `commands/`
|
|
78
|
+
|
|
79
|
+
The plugin-local `.mcp.json` currently starts Codepage Bridge with:
|
|
80
|
+
|
|
81
|
+
```json
|
|
82
|
+
{
|
|
83
|
+
"mcpServers": {
|
|
84
|
+
"codepage-bridge": {
|
|
85
|
+
"command": "npx",
|
|
86
|
+
"args": ["-y", "codepage-bridge-mcp"]
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
That means marketplace installation depends on the package name `codepage-bridge-mcp` being publicly installable through `npx`.
|
|
93
|
+
|
|
94
|
+
### Publishing steps
|
|
95
|
+
|
|
96
|
+
1. publish `codepage-bridge-mcp` to npm;
|
|
97
|
+
2. keep `package.json`, `.claude-plugin/plugin.json`, and `.claude-plugin/marketplace.json` versions in sync;
|
|
98
|
+
3. add this repository to a Claude Code marketplace source;
|
|
99
|
+
6. validate the plugin with:
|
|
100
|
+
|
|
101
|
+
```bash
|
|
102
|
+
claude plugin validate . --strict
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
7. install from marketplace and run `/setup`.
|
|
106
|
+
|
|
107
|
+
---
|
|
108
|
+
|
|
109
|
+
## Install from GitHub Release
|
|
110
|
+
|
|
111
|
+
This is the easiest path for end users today.
|
|
112
|
+
|
|
113
|
+
There are **two valid ways** to use the Release installer flow.
|
|
114
|
+
|
|
115
|
+
### Path 1 — You already downloaded and extracted a release package
|
|
116
|
+
|
|
117
|
+
This is the preferred path if you are already inside an extracted release directory.
|
|
118
|
+
|
|
119
|
+
Use:
|
|
120
|
+
|
|
121
|
+
#### Windows
|
|
122
|
+
|
|
123
|
+
```powershell
|
|
124
|
+
powershell -ExecutionPolicy Bypass -File .\install\install-this-release-windows.ps1
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
#### macOS / Linux
|
|
128
|
+
|
|
129
|
+
```bash
|
|
130
|
+
bash ./install/install-this-release-unix.sh
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
What it does:
|
|
134
|
+
|
|
135
|
+
- checks that the current extracted package contains `dist/src/server.js`;
|
|
136
|
+
- registers Claude Code MCP using that local package;
|
|
137
|
+
- does **not** download anything.
|
|
138
|
+
|
|
139
|
+
### Path 2 — You want the installer to download the release package for you
|
|
140
|
+
|
|
141
|
+
Use:
|
|
142
|
+
|
|
143
|
+
#### Windows
|
|
144
|
+
|
|
145
|
+
```powershell
|
|
146
|
+
powershell -ExecutionPolicy Bypass -File .\install\download-release-windows.ps1
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
#### macOS / Linux
|
|
150
|
+
|
|
151
|
+
```bash
|
|
152
|
+
bash ./install/download-release-unix.sh
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
What it does:
|
|
156
|
+
|
|
157
|
+
- fetches the latest release from GitHub;
|
|
158
|
+
- downloads the correct platform archive;
|
|
159
|
+
- extracts it under the user install directory;
|
|
160
|
+
- registers Claude Code MCP.
|
|
161
|
+
|
|
162
|
+
You can also install a specific version.
|
|
163
|
+
|
|
164
|
+
#### Windows
|
|
165
|
+
|
|
166
|
+
```powershell
|
|
167
|
+
powershell -ExecutionPolicy Bypass -File .\install\download-release-windows.ps1 -Version v0.1.0
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
#### macOS / Linux
|
|
171
|
+
|
|
172
|
+
```bash
|
|
173
|
+
bash ./install/download-release-unix.sh v0.1.0
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
### Compatibility wrappers
|
|
177
|
+
|
|
178
|
+
The old `install-from-release-*` scripts are kept as compatibility wrappers:
|
|
179
|
+
|
|
180
|
+
- if run inside an extracted release package, they install from local files;
|
|
181
|
+
- otherwise they fall back to downloading the release package.
|
|
182
|
+
|
|
183
|
+
These are still valid, but the clearer scripts are:
|
|
184
|
+
|
|
185
|
+
- `install-this-release-*`
|
|
186
|
+
- `download-release-*`
|
|
187
|
+
|
|
188
|
+
### What Release installation still requires
|
|
189
|
+
|
|
190
|
+
The release installation path still expects these commands to already exist locally:
|
|
191
|
+
|
|
192
|
+
- `claude`
|
|
193
|
+
- `node`
|
|
194
|
+
|
|
195
|
+
It does **not** require:
|
|
196
|
+
|
|
197
|
+
- `git clone`
|
|
198
|
+
- `npm install`
|
|
199
|
+
- `npm run build`
|
|
200
|
+
|
|
201
|
+
---
|
|
202
|
+
|
|
203
|
+
## Install from source
|
|
204
|
+
|
|
205
|
+
Use this path only for contributors, local debugging, or development.
|
|
206
|
+
|
|
207
|
+
### 1. Clone the repository
|
|
208
|
+
|
|
209
|
+
```bash
|
|
210
|
+
git clone git@github.com:skyispainted/codepage-bridge-mcp.git
|
|
211
|
+
cd codepage-bridge-mcp
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
### 2. Install dependencies
|
|
215
|
+
|
|
216
|
+
```bash
|
|
217
|
+
npm install
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
### 3. Build
|
|
221
|
+
|
|
222
|
+
```bash
|
|
223
|
+
npm run build
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
The server entry point is:
|
|
227
|
+
|
|
228
|
+
```text
|
|
229
|
+
dist/src/server.js
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
### 4. Or use the source installer scripts
|
|
233
|
+
|
|
234
|
+
These scripts perform the local build and MCP registration for you.
|
|
235
|
+
|
|
236
|
+
#### Windows
|
|
237
|
+
|
|
238
|
+
```powershell
|
|
239
|
+
powershell -ExecutionPolicy Bypass -File .\install\install-from-source-windows.ps1
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
#### macOS / Linux
|
|
243
|
+
|
|
244
|
+
```bash
|
|
245
|
+
bash ./install/install-from-source-unix.sh
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
---
|
|
249
|
+
|
|
250
|
+
## Why
|
|
251
|
+
|
|
252
|
+
Claude Code built-in file tools assume UTF-8 for normal text reads. In legacy projects this can lead to:
|
|
253
|
+
|
|
254
|
+
- unreadable C/C++ comments and string literals;
|
|
255
|
+
- searches that silently miss text;
|
|
256
|
+
- edits that corrupt the original codepage;
|
|
257
|
+
- accidental UTF-8 rewrites of GBK or other legacy files.
|
|
258
|
+
|
|
259
|
+
Codepage Bridge keeps encoding conversion below the model boundary:
|
|
260
|
+
|
|
261
|
+
```text
|
|
262
|
+
legacy bytes on disk -> decode by .encoding-rules -> Unicode for the LLM
|
|
263
|
+
Unicode from the LLM -> strict encode by .encoding-rules -> legacy bytes on disk
|
|
264
|
+
```
|
|
265
|
+
|
|
266
|
+
If new text cannot be represented in the target encoding, the write fails instead of silently replacing characters with `?`.
|
|
267
|
+
|
|
268
|
+
---
|
|
269
|
+
|
|
270
|
+
## Features
|
|
271
|
+
|
|
272
|
+
- Encoding-aware `Read`, `Grep`, `Edit`, and `Write` tools.
|
|
273
|
+
- Project-level `.encoding-rules` with gitignore-like glob behavior.
|
|
274
|
+
- The nearest `.encoding-rules` defines both the project root and active rules.
|
|
275
|
+
- Last matching rule wins; `!pattern` resets matching files to strict UTF-8.
|
|
276
|
+
- Basename patterns such as `*.cpp` match at every directory depth.
|
|
277
|
+
- Strict UTF-8 fallback for files not matched by a rule.
|
|
278
|
+
- GBK/GB2312/GB18030, Big5, Shift-JIS, EUC-KR, Windows codepages, UTF-8, and UTF-16 support.
|
|
279
|
+
- BOM and dominant line-ending preservation for edits.
|
|
280
|
+
- Read-before-write protection and stale-write detection using byte hashes.
|
|
281
|
+
- Atomic temporary-file writes and per-path write locks.
|
|
282
|
+
- Symlink and project-root boundary checks.
|
|
283
|
+
- Image, PDF, and Jupyter Notebook reading.
|
|
284
|
+
- Grep output modes, context lines, glob/type filters, regex flags, and pagination.
|
|
285
|
+
- Large-file partial edit authorization: the model only needs to read the target lines it wants to edit, not the entire file.
|
|
286
|
+
|
|
287
|
+
---
|
|
288
|
+
|
|
289
|
+
## Requirements
|
|
290
|
+
|
|
291
|
+
- Node.js 20 or newer.
|
|
292
|
+
- Claude Code or another MCP client with stdio server support.
|
|
293
|
+
- Optional: Poppler commands `pdfinfo` and `pdftoppm` for PDF page rendering.
|
|
294
|
+
|
|
295
|
+
Check prerequisites:
|
|
296
|
+
|
|
297
|
+
### Windows
|
|
298
|
+
|
|
299
|
+
```powershell
|
|
300
|
+
node --version
|
|
301
|
+
npm --version
|
|
302
|
+
claude --version
|
|
303
|
+
```
|
|
304
|
+
|
|
305
|
+
### macOS / Linux
|
|
306
|
+
|
|
307
|
+
```bash
|
|
308
|
+
node --version
|
|
309
|
+
npm --version
|
|
310
|
+
claude --version
|
|
311
|
+
```
|
|
312
|
+
|
|
313
|
+
---
|
|
314
|
+
|
|
315
|
+
## Claude Code Setup
|
|
316
|
+
|
|
317
|
+
You can install Codepage Bridge either:
|
|
318
|
+
|
|
319
|
+
- **user-level**: available in all your projects;
|
|
320
|
+
- **project-level**: committed as part of a single repository.
|
|
321
|
+
|
|
322
|
+
### Option A — User-level setup
|
|
323
|
+
|
|
324
|
+
Recommended if you use legacy-encoded projects regularly.
|
|
325
|
+
|
|
326
|
+
#### Windows
|
|
327
|
+
|
|
328
|
+
```powershell
|
|
329
|
+
claude mcp add --scope user codepage-bridge -- node C:\absolute\path\to\codepage-bridge-mcp\dist\src\server.js
|
|
330
|
+
```
|
|
331
|
+
|
|
332
|
+
#### macOS / Linux
|
|
333
|
+
|
|
334
|
+
```bash
|
|
335
|
+
claude mcp add --scope user codepage-bridge -- node /absolute/path/to/codepage-bridge-mcp/dist/src/server.js
|
|
336
|
+
```
|
|
337
|
+
|
|
338
|
+
Verify:
|
|
339
|
+
|
|
340
|
+
```bash
|
|
341
|
+
claude mcp get codepage-bridge
|
|
342
|
+
claude mcp list
|
|
343
|
+
```
|
|
344
|
+
|
|
345
|
+
Expected result:
|
|
346
|
+
|
|
347
|
+
- name: `codepage-bridge`
|
|
348
|
+
- status: `Connected`
|
|
349
|
+
|
|
350
|
+
### Option B — Project-level setup
|
|
351
|
+
|
|
352
|
+
Recommended if you want the repository itself to declare the MCP.
|
|
353
|
+
|
|
354
|
+
Create `.mcp.json` in the project root:
|
|
355
|
+
|
|
356
|
+
```json
|
|
357
|
+
{
|
|
358
|
+
"mcpServers": {
|
|
359
|
+
"codepage-bridge": {
|
|
360
|
+
"type": "stdio",
|
|
361
|
+
"command": "node",
|
|
362
|
+
"args": [
|
|
363
|
+
"/absolute/path/to/codepage-bridge-mcp/dist/src/server.js"
|
|
364
|
+
]
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
}
|
|
368
|
+
```
|
|
369
|
+
|
|
370
|
+
Shared project MCP configurations may require approval the first time Claude Code opens the project.
|
|
371
|
+
|
|
372
|
+
Minimal templates are included under:
|
|
373
|
+
|
|
374
|
+
- `examples/minimal-project/`
|
|
375
|
+
- `examples/claude-config/`
|
|
376
|
+
|
|
377
|
+
---
|
|
378
|
+
|
|
379
|
+
## Extremely Important: Disable the Built-in File Tools
|
|
380
|
+
|
|
381
|
+
Installing the MCP is **not sufficient by itself**.
|
|
382
|
+
|
|
383
|
+
Claude Code may continue choosing its built-in:
|
|
384
|
+
|
|
385
|
+
- `Read`
|
|
386
|
+
- `Grep`
|
|
387
|
+
- `Edit`
|
|
388
|
+
- `Write`
|
|
389
|
+
- `NotebookEdit`
|
|
390
|
+
|
|
391
|
+
Those tools bypass `.encoding-rules`.
|
|
392
|
+
|
|
393
|
+
You must block them and allow the Codepage Bridge tools.
|
|
394
|
+
|
|
395
|
+
### Edit `~/.claude/settings.json`
|
|
396
|
+
|
|
397
|
+
Add the following entries to your existing settings file:
|
|
398
|
+
|
|
399
|
+
```json
|
|
400
|
+
{
|
|
401
|
+
"permissions": {
|
|
402
|
+
"allow": [
|
|
403
|
+
"mcp__codepage-bridge__Read",
|
|
404
|
+
"mcp__codepage-bridge__Grep",
|
|
405
|
+
"mcp__codepage-bridge__Edit",
|
|
406
|
+
"mcp__codepage-bridge__Write"
|
|
407
|
+
],
|
|
408
|
+
"deny": [
|
|
409
|
+
"Read",
|
|
410
|
+
"Grep",
|
|
411
|
+
"Edit",
|
|
412
|
+
"Write",
|
|
413
|
+
"NotebookEdit"
|
|
414
|
+
]
|
|
415
|
+
}
|
|
416
|
+
}
|
|
417
|
+
```
|
|
418
|
+
|
|
419
|
+
**Do not replace your whole settings file unless it is empty.** Merge these arrays into your existing configuration.
|
|
420
|
+
|
|
421
|
+
### If your settings file already has `permissions.allow`
|
|
422
|
+
|
|
423
|
+
Append these four entries:
|
|
424
|
+
|
|
425
|
+
```json
|
|
426
|
+
"mcp__codepage-bridge__Read"
|
|
427
|
+
"mcp__codepage-bridge__Grep"
|
|
428
|
+
"mcp__codepage-bridge__Edit"
|
|
429
|
+
"mcp__codepage-bridge__Write"
|
|
430
|
+
```
|
|
431
|
+
|
|
432
|
+
### If your settings file already has `permissions.deny`
|
|
433
|
+
|
|
434
|
+
Append these five entries:
|
|
435
|
+
|
|
436
|
+
```json
|
|
437
|
+
"Read"
|
|
438
|
+
"Grep"
|
|
439
|
+
"Edit"
|
|
440
|
+
"Write"
|
|
441
|
+
"NotebookEdit"
|
|
442
|
+
```
|
|
443
|
+
|
|
444
|
+
An example merge snippet is included in:
|
|
445
|
+
|
|
446
|
+
- `examples/claude-config/settings.fragment.json`
|
|
447
|
+
|
|
448
|
+
---
|
|
449
|
+
|
|
450
|
+
## Add a `CLAUDE.md` Policy
|
|
451
|
+
|
|
452
|
+
Even with built-in tools denied, the model can still try to bypass the bridge with shell commands or scripts.
|
|
453
|
+
|
|
454
|
+
Add this to the project `CLAUDE.md`, or to `~/.claude/CLAUDE.md` for a global policy:
|
|
455
|
+
|
|
456
|
+
```markdown
|
|
457
|
+
## File encoding policy
|
|
458
|
+
|
|
459
|
+
Use Codepage Bridge for all project file content operations:
|
|
460
|
+
|
|
461
|
+
- Read with `mcp__codepage-bridge__Read`.
|
|
462
|
+
- Search with `mcp__codepage-bridge__Grep`.
|
|
463
|
+
- Edit with `mcp__codepage-bridge__Edit`.
|
|
464
|
+
- Create or completely rewrite with `mcp__codepage-bridge__Write`.
|
|
465
|
+
|
|
466
|
+
Do not use built-in Read, Grep, Edit, Write, NotebookEdit, shell commands,
|
|
467
|
+
PowerShell commands, or scripts as substitutes for project file content access.
|
|
468
|
+
Glob may only be used to discover paths.
|
|
469
|
+
|
|
470
|
+
Do not manually transcode files or normalize line endings. `.encoding-rules`
|
|
471
|
+
is the source of truth.
|
|
472
|
+
```
|
|
473
|
+
|
|
474
|
+
A minimal project policy file is included in:
|
|
475
|
+
|
|
476
|
+
- `examples/minimal-project/CLAUDE.md`
|
|
477
|
+
|
|
478
|
+
Why both `settings.json` and `CLAUDE.md`?
|
|
479
|
+
|
|
480
|
+
- `deny` removes unsafe built-in tools from the model's available tool list.
|
|
481
|
+
- `CLAUDE.md` prevents the model from bypassing the bridge using shell tools.
|
|
482
|
+
|
|
483
|
+
---
|
|
484
|
+
|
|
485
|
+
## Create `.encoding-rules`
|
|
486
|
+
|
|
487
|
+
Every project using Codepage Bridge must contain `.encoding-rules` at its root.
|
|
488
|
+
|
|
489
|
+
Example:
|
|
490
|
+
|
|
491
|
+
```text
|
|
492
|
+
# Last matching rule wins
|
|
493
|
+
*.c gbk
|
|
494
|
+
*.cpp gbk
|
|
495
|
+
*.h gbk
|
|
496
|
+
legacy/**/*.txt windows-1251
|
|
497
|
+
assets/**/*.csv shift_jis
|
|
498
|
+
**/*.json utf8
|
|
499
|
+
|
|
500
|
+
# Cancel earlier matches and return to strict UTF-8
|
|
501
|
+
!SourceCode/generated/**
|
|
502
|
+
```
|
|
503
|
+
|
|
504
|
+
Syntax:
|
|
505
|
+
|
|
506
|
+
```text
|
|
507
|
+
<glob-pattern> <encoding>
|
|
508
|
+
```
|
|
509
|
+
|
|
510
|
+
Rules:
|
|
511
|
+
|
|
512
|
+
- Empty lines and lines beginning with `#` are ignored.
|
|
513
|
+
- `*`, `**`, and `?` use glob semantics.
|
|
514
|
+
- Patterns without `/`, such as `*.cpp`, match basenames at every directory depth.
|
|
515
|
+
- Patterns containing `/` are relative to the `.encoding-rules` directory.
|
|
516
|
+
- The last matching rule wins.
|
|
517
|
+
- `!pattern` cancels previous matches and selects strict UTF-8.
|
|
518
|
+
- Files with no matching rule use strict UTF-8.
|
|
519
|
+
- The nearest `.encoding-rules` is used; its directory is the allowed project root.
|
|
520
|
+
|
|
521
|
+
Supported examples:
|
|
522
|
+
|
|
523
|
+
```text
|
|
524
|
+
utf8
|
|
525
|
+
utf-16le
|
|
526
|
+
gbk
|
|
527
|
+
gb2312
|
|
528
|
+
gb18030
|
|
529
|
+
big5
|
|
530
|
+
shift_jis
|
|
531
|
+
euc-kr
|
|
532
|
+
windows-1251
|
|
533
|
+
windows-1252
|
|
534
|
+
```
|
|
535
|
+
|
|
536
|
+
A starter file is included in:
|
|
537
|
+
|
|
538
|
+
- `examples/minimal-project/.encoding-rules`
|
|
539
|
+
|
|
540
|
+
---
|
|
541
|
+
|
|
542
|
+
## Verify the Setup
|
|
543
|
+
|
|
544
|
+
### 1. Check the MCP is connected
|
|
545
|
+
|
|
546
|
+
```bash
|
|
547
|
+
claude mcp get codepage-bridge
|
|
548
|
+
```
|
|
549
|
+
|
|
550
|
+
Expected:
|
|
551
|
+
|
|
552
|
+
- `Scope`: user or project, depending on how you installed it
|
|
553
|
+
- `Status`: `Connected`
|
|
554
|
+
|
|
555
|
+
### 2. Start a fresh Claude Code session in a legacy project
|
|
556
|
+
|
|
557
|
+
### 3. Ask Claude to read a legacy-encoded file
|
|
558
|
+
|
|
559
|
+
For example:
|
|
560
|
+
|
|
561
|
+
```text
|
|
562
|
+
Read SourceCode/Main.cpp and show the first 10 lines.
|
|
563
|
+
```
|
|
564
|
+
|
|
565
|
+
### 4. Confirm the model uses Codepage Bridge tools
|
|
566
|
+
|
|
567
|
+
In a verbose / print-mode session, the tool call should be one of:
|
|
568
|
+
|
|
569
|
+
- `mcp__codepage-bridge__Read`
|
|
570
|
+
- `mcp__codepage-bridge__Grep`
|
|
571
|
+
- `mcp__codepage-bridge__Edit`
|
|
572
|
+
- `mcp__codepage-bridge__Write`
|
|
573
|
+
|
|
574
|
+
It should **not** call built-in `Read`, `Grep`, `Edit`, or `Write`.
|
|
575
|
+
|
|
576
|
+
---
|
|
577
|
+
|
|
578
|
+
## Tools
|
|
579
|
+
|
|
580
|
+
### `Read`
|
|
581
|
+
|
|
582
|
+
```json
|
|
583
|
+
{
|
|
584
|
+
"file_path": "C:\\project\\SourceCode\\Main.cpp",
|
|
585
|
+
"offset": 1,
|
|
586
|
+
"limit": 200,
|
|
587
|
+
"pages": "1-5"
|
|
588
|
+
}
|
|
589
|
+
```
|
|
590
|
+
|
|
591
|
+
Behavior:
|
|
592
|
+
|
|
593
|
+
- Text is decoded according to `.encoding-rules` and returned as Unicode.
|
|
594
|
+
- Output uses numbered lines compatible with Claude Code workflows.
|
|
595
|
+
- Files larger than 256 KiB require `offset` and `limit`.
|
|
596
|
+
- Multiple ranged reads of the same unchanged file are merged by line coverage.
|
|
597
|
+
- Ranges may be sequential, overlapping, out of order, or concurrent within one MCP process.
|
|
598
|
+
- If the file changes, accumulated coverage is invalidated.
|
|
599
|
+
- Supports PNG, JPEG, GIF, WebP, PDF pages, and Notebook cells.
|
|
600
|
+
- Notebook reads do not accept text-line `offset` or `limit`.
|
|
601
|
+
|
|
602
|
+
### `Grep`
|
|
603
|
+
|
|
604
|
+
```json
|
|
605
|
+
{
|
|
606
|
+
"pattern": "error|failed",
|
|
607
|
+
"path": "C:\\project",
|
|
608
|
+
"glob": "**/*.log",
|
|
609
|
+
"output_mode": "content",
|
|
610
|
+
"-i": false,
|
|
611
|
+
"-n": true,
|
|
612
|
+
"-C": 2,
|
|
613
|
+
"head_limit": 250,
|
|
614
|
+
"offset": 0
|
|
615
|
+
}
|
|
616
|
+
```
|
|
617
|
+
|
|
618
|
+
Supported options:
|
|
619
|
+
|
|
620
|
+
- `output_mode`: `content`, `files_with_matches`, or `count`
|
|
621
|
+
- `glob`
|
|
622
|
+
- common `type` filters
|
|
623
|
+
- `-i`, `-n`, `-o`
|
|
624
|
+
- `-A`, `-B`, `-C`, `context`
|
|
625
|
+
- `multiline`
|
|
626
|
+
- `head_limit`, `offset`
|
|
627
|
+
|
|
628
|
+
Each candidate file is decoded using its own nearest `.encoding-rules`. Explicit single-file decode failures are reported as errors rather than being misreported as zero matches.
|
|
629
|
+
|
|
630
|
+
### `Edit`
|
|
631
|
+
|
|
632
|
+
```json
|
|
633
|
+
{
|
|
634
|
+
"file_path": "C:\\project\\SourceCode\\Main.cpp",
|
|
635
|
+
"old_string": "old text",
|
|
636
|
+
"new_string": "new text",
|
|
637
|
+
"replace_all": false
|
|
638
|
+
}
|
|
639
|
+
```
|
|
640
|
+
|
|
641
|
+
Behavior:
|
|
642
|
+
|
|
643
|
+
- Existing files do not require reading the whole file.
|
|
644
|
+
- An edit is authorized when every line covered by the selected `old_string` match was actually returned to the model.
|
|
645
|
+
- For unique targets in large files, the model only needs to read the relevant nearby lines.
|
|
646
|
+
- With `replace_all: true`, every matching range must have been read.
|
|
647
|
+
- If a target was not read, the error reports the exact missing line range(s).
|
|
648
|
+
- The file is re-read and hashed immediately before writing.
|
|
649
|
+
- Multiple matches are rejected unless `replace_all` is true.
|
|
650
|
+
- Straight/curly quote compatibility follows Claude Code edit behavior.
|
|
651
|
+
- The original encoding, BOM, and dominant line ending are preserved.
|
|
652
|
+
|
|
653
|
+
### `Write`
|
|
654
|
+
|
|
655
|
+
```json
|
|
656
|
+
{
|
|
657
|
+
"file_path": "C:\\project\\SourceCode\\NewFile.cpp",
|
|
658
|
+
"content": "full content"
|
|
659
|
+
}
|
|
660
|
+
```
|
|
661
|
+
|
|
662
|
+
Behavior:
|
|
663
|
+
|
|
664
|
+
- New files use the encoding selected by `.encoding-rules`.
|
|
665
|
+
- Existing files still require a complete prior `Read`.
|
|
666
|
+
- Existing files retain encoding and BOM metadata.
|
|
667
|
+
- Complete rewrites use the line endings supplied by the caller.
|
|
668
|
+
|
|
669
|
+
---
|
|
670
|
+
|
|
671
|
+
## Minimal Templates Included
|
|
672
|
+
|
|
673
|
+
This repository includes starter files under:
|
|
674
|
+
|
|
675
|
+
- `examples/minimal-project/.encoding-rules`
|
|
676
|
+
- `examples/minimal-project/.mcp.json`
|
|
677
|
+
- `examples/minimal-project/CLAUDE.md`
|
|
678
|
+
- `examples/claude-config/settings.fragment.json`
|
|
679
|
+
|
|
680
|
+
Use them as copy-paste starting points.
|
|
681
|
+
|
|
682
|
+
---
|
|
683
|
+
|
|
684
|
+
## NPM_TOKEN automation note
|
|
685
|
+
|
|
686
|
+
The GitHub release workflow now publishes the npm package automatically before packaging release assets.
|
|
687
|
+
|
|
688
|
+
Repository maintainers must configure a GitHub Actions secret named NPM_TOKEN.
|
|
689
|
+
|
|
690
|
+
Important: if a token was ever pasted into chat, terminal history, logs, or screenshots, revoke it in npm immediately and create a new publish token before storing it in GitHub Secrets.
|
|
691
|
+
|
|
692
|
+
Use a token that can publish packages under your npm account or organization.
|
|
693
|
+
|
|
694
|
+
## Maintainer Release Flow
|
|
695
|
+
|
|
696
|
+
To publish a new release:
|
|
697
|
+
|
|
698
|
+
```bash
|
|
699
|
+
git tag v0.1.0
|
|
700
|
+
git push origin v0.1.0
|
|
701
|
+
```
|
|
702
|
+
|
|
703
|
+
The GitHub Release workflow will:`r`n`r`n- publish the npm package using `NPM_TOKEN`;
|
|
704
|
+
|
|
705
|
+
- run type checks;
|
|
706
|
+
- run the full test suite;
|
|
707
|
+
- build the project;
|
|
708
|
+
- prune dev dependencies;
|
|
709
|
+
- package platform-specific release archives;
|
|
710
|
+
- generate per-asset SHA256 files;
|
|
711
|
+
- generate a combined `checksums.txt` file;
|
|
712
|
+
- publish the assets to GitHub Releases.
|
|
713
|
+
|
|
714
|
+
---
|
|
715
|
+
|
|
716
|
+
## npm Publish Readiness
|
|
717
|
+
|
|
718
|
+
The repository is now prepared for npm publishing.
|
|
719
|
+
|
|
720
|
+
### Package shape
|
|
721
|
+
|
|
722
|
+
The published tarball contains only:
|
|
723
|
+
|
|
724
|
+
- `dist/src/`
|
|
725
|
+
- `.claude-plugin/`
|
|
726
|
+
- `.mcp.json`
|
|
727
|
+
- `install/`
|
|
728
|
+
- `examples/`
|
|
729
|
+
- `README.md`
|
|
730
|
+
- `README_CN.md`
|
|
731
|
+
- `LICENSE`
|
|
732
|
+
|
|
733
|
+
It does **not** publish:
|
|
734
|
+
|
|
735
|
+
- `src/`
|
|
736
|
+
- `test/`
|
|
737
|
+
- `node_modules/`
|
|
738
|
+
- project-local `.claude/`
|
|
739
|
+
- release build caches
|
|
740
|
+
|
|
741
|
+
### Prepublish checks
|
|
742
|
+
|
|
743
|
+
`prepublishOnly` now runs:
|
|
744
|
+
|
|
745
|
+
```bash
|
|
746
|
+
npm run check
|
|
747
|
+
npm test
|
|
748
|
+
npm run build
|
|
749
|
+
```
|
|
750
|
+
|
|
751
|
+
### Dry-run verification
|
|
752
|
+
|
|
753
|
+
Before publishing, run:
|
|
754
|
+
|
|
755
|
+
```bash
|
|
756
|
+
npm pack --dry-run
|
|
757
|
+
```
|
|
758
|
+
|
|
759
|
+
This verifies the final npm tarball contents.
|
|
760
|
+
|
|
761
|
+
### Publish steps
|
|
762
|
+
|
|
763
|
+
1. log in to npm:
|
|
764
|
+
|
|
765
|
+
```bash
|
|
766
|
+
npm login
|
|
767
|
+
```
|
|
768
|
+
|
|
769
|
+
2. publish the package:
|
|
770
|
+
|
|
771
|
+
```bash
|
|
772
|
+
npm publish
|
|
773
|
+
```
|
|
774
|
+
|
|
775
|
+
3. verify that this works:
|
|
776
|
+
|
|
777
|
+
```bash
|
|
778
|
+
npx -y codepage-bridge-mcp
|
|
779
|
+
```
|
|
780
|
+
|
|
781
|
+
Once that succeeds, the plugin / marketplace path becomes fully installable because the plugin-local `.mcp.json` already points at:
|
|
782
|
+
|
|
783
|
+
```json
|
|
784
|
+
{
|
|
785
|
+
"mcpServers": {
|
|
786
|
+
"codepage-bridge": {
|
|
787
|
+
"command": "npx",
|
|
788
|
+
"args": ["-y", "codepage-bridge-mcp"]
|
|
789
|
+
}
|
|
790
|
+
}
|
|
791
|
+
}
|
|
792
|
+
```
|
|
793
|
+
## Final Marketplace Publish & Install Plan
|
|
794
|
+
|
|
795
|
+
Codepage Bridge is now **plugin-ready** and **npm-ready**.
|
|
796
|
+
|
|
797
|
+
### What is already done
|
|
798
|
+
|
|
799
|
+
- plugin manifests exist:
|
|
800
|
+
- `.claude-plugin/plugin.json`
|
|
801
|
+
- `.claude-plugin/marketplace.json`
|
|
802
|
+
- plugin-local MCP declaration exists:
|
|
803
|
+
- `.mcp.json`
|
|
804
|
+
- plugin commands exist:
|
|
805
|
+
- `/setup`
|
|
806
|
+
- `/setup-project`
|
|
807
|
+
- `/doctor`
|
|
808
|
+
- npm publish metadata is prepared in `package.json`
|
|
809
|
+
- `npm pack --dry-run` has been verified
|
|
810
|
+
- `claude plugin validate . --strict` passes
|
|
811
|
+
|
|
812
|
+
### What is still required before marketplace installation fully works
|
|
813
|
+
|
|
814
|
+
1. log in to npm
|
|
815
|
+
2. publish `codepage-bridge-mcp`
|
|
816
|
+
3. add this repository to a Claude Code marketplace source
|
|
817
|
+
4. install the plugin from marketplace
|
|
818
|
+
|
|
819
|
+
### Actual publish checklist
|
|
820
|
+
|
|
821
|
+
Run these commands locally:
|
|
822
|
+
|
|
823
|
+
```bash
|
|
824
|
+
npm login
|
|
825
|
+
npm whoami
|
|
826
|
+
npm pack --dry-run
|
|
827
|
+
npm publish
|
|
828
|
+
```
|
|
829
|
+
|
|
830
|
+
After publish, verify:
|
|
831
|
+
|
|
832
|
+
```bash
|
|
833
|
+
npx -y codepage-bridge-mcp
|
|
834
|
+
```
|
|
835
|
+
|
|
836
|
+
If that works, the plugin-side `.mcp.json` launcher is valid for marketplace installs.
|
|
837
|
+
|
|
838
|
+
### Marketplace installation flow after npm publish
|
|
839
|
+
|
|
840
|
+
Once the npm package is live, the intended user flow is:
|
|
841
|
+
|
|
842
|
+
1. add or update the marketplace source in Claude Code
|
|
843
|
+
2. install the plugin from marketplace
|
|
844
|
+
3. run `/setup`
|
|
845
|
+
4. merge `examples/claude-config/settings.fragment.json`
|
|
846
|
+
5. add project `.encoding-rules`
|
|
847
|
+
6. add the `CLAUDE.md` policy
|
|
848
|
+
|
|
849
|
+
### Important limitation
|
|
850
|
+
|
|
851
|
+
Marketplace installation can install the plugin and declare the MCP, but safe usage still depends on project configuration:
|
|
852
|
+
|
|
853
|
+
- deny built-in `Read`, `Grep`, `Edit`, `Write`, `NotebookEdit`
|
|
854
|
+
- use Codepage Bridge for all file content operations
|
|
855
|
+
- add `.encoding-rules` to each legacy-encoded project
|
|
856
|
+
## Troubleshooting
|
|
857
|
+
|
|
858
|
+
### `No .encoding-rules found`
|
|
859
|
+
|
|
860
|
+
Cause:
|
|
861
|
+
|
|
862
|
+
- the project root does not contain `.encoding-rules`;
|
|
863
|
+
- you are pointing at a file outside the intended project root.
|
|
864
|
+
|
|
865
|
+
Fix:
|
|
866
|
+
|
|
867
|
+
- add `.encoding-rules` to the project root;
|
|
868
|
+
- ensure the target path is inside that project tree.
|
|
869
|
+
|
|
870
|
+
### `Invalid byte sequence for utf-8`
|
|
871
|
+
|
|
872
|
+
Cause:
|
|
873
|
+
|
|
874
|
+
- the file was decoded as UTF-8 but is actually in another encoding;
|
|
875
|
+
- your `.encoding-rules` did not match the file.
|
|
876
|
+
|
|
877
|
+
Fix:
|
|
878
|
+
|
|
879
|
+
- confirm the rule file exists;
|
|
880
|
+
- confirm the pattern matches nested paths;
|
|
881
|
+
- for language-wide rules, prefer patterns like `*.cpp gbk`.
|
|
882
|
+
|
|
883
|
+
### `Text contains characters not representable in ...`
|
|
884
|
+
|
|
885
|
+
Cause:
|
|
886
|
+
|
|
887
|
+
- the new text contains characters that the target encoding cannot represent.
|
|
888
|
+
|
|
889
|
+
Fix:
|
|
890
|
+
|
|
891
|
+
- change the text;
|
|
892
|
+
- or explicitly move the file to an encoding that can represent those characters.
|
|
893
|
+
|
|
894
|
+
### `The target text has not been read`
|
|
895
|
+
|
|
896
|
+
Cause:
|
|
897
|
+
|
|
898
|
+
- the model tried to edit a region it has not actually seen.
|
|
899
|
+
|
|
900
|
+
Fix:
|
|
901
|
+
|
|
902
|
+
- read the exact lines reported in the error;
|
|
903
|
+
- retry the edit.
|
|
904
|
+
|
|
905
|
+
### `Pending approval`
|
|
906
|
+
|
|
907
|
+
Cause:
|
|
908
|
+
|
|
909
|
+
- a project `.mcp.json` server has not been approved yet by Claude Code.
|
|
910
|
+
|
|
911
|
+
Fix:
|
|
912
|
+
|
|
913
|
+
- open Claude Code in the project and approve the server;
|
|
914
|
+
- or install Codepage Bridge at user scope.
|
|
915
|
+
|
|
916
|
+
### `Failed to connect`
|
|
917
|
+
|
|
918
|
+
Check:
|
|
919
|
+
|
|
920
|
+
- `node --version`
|
|
921
|
+
- `claude --version`
|
|
922
|
+
- `Test-Path dist/src/server.js` on Windows
|
|
923
|
+
- `test -f ./dist/src/server.js` on macOS/Linux
|
|
924
|
+
- `claude mcp get codepage-bridge`
|
|
925
|
+
|
|
926
|
+
Then rebuild:
|
|
927
|
+
|
|
928
|
+
```bash
|
|
929
|
+
npm install
|
|
930
|
+
npm run build
|
|
931
|
+
```
|
|
932
|
+
|
|
933
|
+
### Claude still uses built-in file tools
|
|
934
|
+
|
|
935
|
+
Cause:
|
|
936
|
+
|
|
937
|
+
- built-in tools were not denied;
|
|
938
|
+
- the model is bypassing through shell commands.
|
|
939
|
+
|
|
940
|
+
Fix:
|
|
941
|
+
|
|
942
|
+
- update `~/.claude/settings.json` `allow/deny` entries;
|
|
943
|
+
- add the `CLAUDE.md` policy;
|
|
944
|
+
- start a new Claude session.
|
|
945
|
+
|
|
946
|
+
---
|
|
947
|
+
|
|
948
|
+
## Safety Notes
|
|
949
|
+
|
|
950
|
+
1. Commit `.encoding-rules` with the project.
|
|
951
|
+
2. Test rules on representative nested files before large edits.
|
|
952
|
+
3. Use basename globs for language-wide rules, for example `*.cpp gbk`.
|
|
953
|
+
4. Do not silently convert encodings.
|
|
954
|
+
5. Do not bypass the bridge with shell tools or scripts.
|
|
955
|
+
6. Keep the MCP process trusted; it has read/write access inside roots defined by `.encoding-rules`.
|
|
956
|
+
7. Review generated diffs; encoding preservation does not guarantee semantic correctness.
|
|
957
|
+
8. PDF support is optional; install Poppler or avoid PDF reads.
|
|
958
|
+
9. Notebook editing is intentionally unavailable. Notebook reading is supported, but there is no `NotebookEdit` tool.
|
|
959
|
+
10. Windows network/device paths are rejected before I/O to avoid unintended SMB access and credential leakage.
|
|
960
|
+
|
|
961
|
+
---
|
|
962
|
+
|
|
963
|
+
## Development
|
|
964
|
+
|
|
965
|
+
```bash
|
|
966
|
+
npm install
|
|
967
|
+
npm run check
|
|
968
|
+
npm test
|
|
969
|
+
npm run build
|
|
970
|
+
npm start
|
|
971
|
+
```
|
|
972
|
+
|
|
973
|
+
Automated coverage currently includes:
|
|
974
|
+
|
|
975
|
+
- encoding rule precedence;
|
|
976
|
+
- nested basename matching;
|
|
977
|
+
- strict codecs;
|
|
978
|
+
- lossy-write rejection;
|
|
979
|
+
- stale-write protection;
|
|
980
|
+
- atomic writes;
|
|
981
|
+
- symlink boundaries;
|
|
982
|
+
- images, PDFs, and Notebook reads;
|
|
983
|
+
- GBK read/edit/write flows;
|
|
984
|
+
- Grep modes and error handling;
|
|
985
|
+
- full-file and target-range edit authorization;
|
|
986
|
+
- MCP protocol registration.
|
|
987
|
+
|
|
988
|
+
## License
|
|
989
|
+
|
|
990
|
+
MIT. See [LICENSE](LICENSE).
|