encoding-converter-ai 0.1.0 → 0.1.1
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/dist/index.js +19 -2
- package/package.json +28 -28
package/dist/index.js
CHANGED
|
@@ -3883,10 +3883,21 @@ async function installClaudeCode() {
|
|
|
3883
3883
|
const srcPath = path3.join(__dirname, "converter.js");
|
|
3884
3884
|
const destPath = path3.join(hookDir, "converter.js");
|
|
3885
3885
|
try {
|
|
3886
|
+
try {
|
|
3887
|
+
await fs4.access(srcPath);
|
|
3888
|
+
} catch {
|
|
3889
|
+
throw new Error(`Source file not found: ${srcPath}`);
|
|
3890
|
+
}
|
|
3886
3891
|
await fs4.copyFile(srcPath, destPath);
|
|
3892
|
+
try {
|
|
3893
|
+
await fs4.access(destPath);
|
|
3894
|
+
console.log(` \u2192 Copied converter.js to ${hookDir}`);
|
|
3895
|
+
} catch {
|
|
3896
|
+
throw new Error(`Copy appeared to succeed but destination not found: ${destPath}`);
|
|
3897
|
+
}
|
|
3887
3898
|
} catch (err) {
|
|
3888
3899
|
log("error", "Failed to copy converter.js", { error: err.message });
|
|
3889
|
-
throw new Error(`Could not
|
|
3900
|
+
throw new Error(`Could not install converter.js: ${err.message}`);
|
|
3890
3901
|
}
|
|
3891
3902
|
const settingsPath = path3.join(os3.homedir(), ".claude", "settings.json");
|
|
3892
3903
|
let settings = {};
|
|
@@ -3978,11 +3989,17 @@ async function installOpenCode() {
|
|
|
3978
3989
|
const srcPath = path3.join(__dirname, "plugin.js");
|
|
3979
3990
|
const destPath = path3.join(pluginDir, "encoding-converter.js");
|
|
3980
3991
|
try {
|
|
3992
|
+
try {
|
|
3993
|
+
await fs4.access(srcPath);
|
|
3994
|
+
} catch {
|
|
3995
|
+
throw new Error(`Source file not found: ${srcPath}`);
|
|
3996
|
+
}
|
|
3981
3997
|
await fs4.copyFile(srcPath, destPath);
|
|
3998
|
+
console.log(` \u2192 Copied plugin.js to ${pluginDir}`);
|
|
3982
3999
|
log("info", "OpenCode plugin installed", { destPath });
|
|
3983
4000
|
} catch (err) {
|
|
3984
4001
|
log("error", "Failed to copy plugin.js", { error: err.message });
|
|
3985
|
-
throw new Error(`Could not
|
|
4002
|
+
throw new Error(`Could not install plugin.js: ${err.message}`);
|
|
3986
4003
|
}
|
|
3987
4004
|
}
|
|
3988
4005
|
|
package/package.json
CHANGED
|
@@ -1,28 +1,28 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "encoding-converter-ai",
|
|
3
|
-
"version": "0.1.
|
|
4
|
-
"description": "Auto-convert GB18030 ↔ UTF-8 for AI coding tools (Claude Code, OpenCode)",
|
|
5
|
-
"main": "dist/converter.js",
|
|
6
|
-
"bin": {
|
|
7
|
-
"encoding-converter-ai": "dist/index.js"
|
|
8
|
-
},
|
|
9
|
-
"scripts": {
|
|
10
|
-
"build": "node build.js",
|
|
11
|
-
"prepare": "node build.js",
|
|
12
|
-
"test": "vitest run",
|
|
13
|
-
"test:watch": "vitest",
|
|
14
|
-
"typecheck": "tsc --noEmit"
|
|
15
|
-
},
|
|
16
|
-
"keywords": ["encoding", "gb18030", "utf-8", "claude-code", "opencode"],
|
|
17
|
-
"license": "MIT",
|
|
18
|
-
"dependencies": {
|
|
19
|
-
"iconv-lite": "^0.6.3",
|
|
20
|
-
"@inquirer/prompts": "^7.0.0"
|
|
21
|
-
},
|
|
22
|
-
"devDependencies": {
|
|
23
|
-
"esbuild": "^0.20.0",
|
|
24
|
-
"@types/node": "^22.0.0",
|
|
25
|
-
"typescript": "^5.5.0",
|
|
26
|
-
"vitest": "^3.0.0"
|
|
27
|
-
}
|
|
28
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "encoding-converter-ai",
|
|
3
|
+
"version": "0.1.1",
|
|
4
|
+
"description": "Auto-convert GB18030 ↔ UTF-8 for AI coding tools (Claude Code, OpenCode)",
|
|
5
|
+
"main": "dist/converter.js",
|
|
6
|
+
"bin": {
|
|
7
|
+
"encoding-converter-ai": "dist/index.js"
|
|
8
|
+
},
|
|
9
|
+
"scripts": {
|
|
10
|
+
"build": "node build.js",
|
|
11
|
+
"prepare": "node build.js",
|
|
12
|
+
"test": "vitest run",
|
|
13
|
+
"test:watch": "vitest",
|
|
14
|
+
"typecheck": "tsc --noEmit"
|
|
15
|
+
},
|
|
16
|
+
"keywords": ["encoding", "gb18030", "utf-8", "claude-code", "opencode"],
|
|
17
|
+
"license": "MIT",
|
|
18
|
+
"dependencies": {
|
|
19
|
+
"iconv-lite": "^0.6.3",
|
|
20
|
+
"@inquirer/prompts": "^7.0.0"
|
|
21
|
+
},
|
|
22
|
+
"devDependencies": {
|
|
23
|
+
"esbuild": "^0.20.0",
|
|
24
|
+
"@types/node": "^22.0.0",
|
|
25
|
+
"typescript": "^5.5.0",
|
|
26
|
+
"vitest": "^3.0.0"
|
|
27
|
+
}
|
|
28
|
+
}
|