@hasna/codewith 0.1.3 → 0.1.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.
- package/bin/codex.js +31 -5
- package/package.json +7 -7
package/bin/codex.js
CHANGED
|
@@ -76,20 +76,32 @@ if (!platformPackage) {
|
|
|
76
76
|
throw new Error(`Unsupported target triple: ${targetTriple}`);
|
|
77
77
|
}
|
|
78
78
|
|
|
79
|
-
const
|
|
79
|
+
const codewithBinaryName = process.platform === "win32" ? "codewith.exe" : "codewith";
|
|
80
|
+
const legacyCodexBinaryName = process.platform === "win32" ? "codex.exe" : "codex";
|
|
80
81
|
const localVendorRoot = path.join(__dirname, "..", "vendor");
|
|
81
82
|
const packageBinaryPath = (vendorRoot) =>
|
|
82
|
-
path.join(vendorRoot, targetTriple, "bin",
|
|
83
|
+
path.join(vendorRoot, targetTriple, "bin", codewithBinaryName);
|
|
84
|
+
const legacyPackageBinaryPath = (vendorRoot) =>
|
|
85
|
+
path.join(vendorRoot, targetTriple, "bin", legacyCodexBinaryName);
|
|
83
86
|
const legacyBinaryPath = (vendorRoot) =>
|
|
84
|
-
path.join(vendorRoot, targetTriple, "codex",
|
|
87
|
+
path.join(vendorRoot, targetTriple, "codex", legacyCodexBinaryName);
|
|
85
88
|
|
|
86
89
|
function resolveNativePackage(vendorRoot) {
|
|
87
90
|
const packageRoot = path.join(vendorRoot, targetTriple);
|
|
91
|
+
const pathDir = resolvePathDir(packageRoot);
|
|
88
92
|
const binaryPath = packageBinaryPath(vendorRoot);
|
|
89
93
|
if (existsSync(binaryPath)) {
|
|
90
94
|
return {
|
|
91
95
|
binaryPath,
|
|
92
|
-
pathDir
|
|
96
|
+
pathDir,
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
const legacyPackagePath = legacyPackageBinaryPath(vendorRoot);
|
|
101
|
+
if (existsSync(legacyPackagePath)) {
|
|
102
|
+
return {
|
|
103
|
+
binaryPath: legacyPackagePath,
|
|
104
|
+
pathDir,
|
|
93
105
|
};
|
|
94
106
|
}
|
|
95
107
|
|
|
@@ -104,6 +116,20 @@ function resolveNativePackage(vendorRoot) {
|
|
|
104
116
|
return null;
|
|
105
117
|
}
|
|
106
118
|
|
|
119
|
+
function resolvePathDir(packageRoot) {
|
|
120
|
+
const codewithPathDir = path.join(packageRoot, "codewith-path");
|
|
121
|
+
if (existsSync(codewithPathDir)) {
|
|
122
|
+
return codewithPathDir;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
const codexPathDir = path.join(packageRoot, "codex-path");
|
|
126
|
+
if (existsSync(codexPathDir)) {
|
|
127
|
+
return codexPathDir;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
return path.join(packageRoot, "codex-path");
|
|
131
|
+
}
|
|
132
|
+
|
|
107
133
|
let nativePackage;
|
|
108
134
|
try {
|
|
109
135
|
const packageJsonPath = require.resolve(`${platformPackage}/package.json`);
|
|
@@ -181,7 +207,7 @@ function defaultCodewithHome() {
|
|
|
181
207
|
}
|
|
182
208
|
|
|
183
209
|
function resolveCodewithHome() {
|
|
184
|
-
return env.CODEWITH_HOME || defaultCodewithHome();
|
|
210
|
+
return env.CODEWITH_HOME || env.CODEX_HOME || defaultCodewithHome();
|
|
185
211
|
}
|
|
186
212
|
|
|
187
213
|
env.CODEX_HOME = resolveCodewithHome();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hasna/codewith",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.4",
|
|
4
4
|
"description": "Codewith command-line coding agent from Hasna.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"bin": {
|
|
@@ -24,11 +24,11 @@
|
|
|
24
24
|
},
|
|
25
25
|
"packageManager": "pnpm@10.33.0+sha512.10568bb4a6afb58c9eb3630da90cc9516417abebd3fabbe6739f0ae795728da1491e9db5a544c76ad8eb7570f5c4bb3d6c637b2cb41bfdcdb47fa823c8649319",
|
|
26
26
|
"optionalDependencies": {
|
|
27
|
-
"@hasna/codewith-linux-x64": "0.1.
|
|
28
|
-
"@hasna/codewith-linux-arm64": "0.1.
|
|
29
|
-
"@hasna/codewith-darwin-x64": "0.1.
|
|
30
|
-
"@hasna/codewith-darwin-arm64": "0.1.
|
|
31
|
-
"@hasna/codewith-win32-x64": "0.1.
|
|
32
|
-
"@hasna/codewith-win32-arm64": "0.1.
|
|
27
|
+
"@hasna/codewith-linux-x64": "0.1.4",
|
|
28
|
+
"@hasna/codewith-linux-arm64": "0.1.4",
|
|
29
|
+
"@hasna/codewith-darwin-x64": "0.1.4",
|
|
30
|
+
"@hasna/codewith-darwin-arm64": "0.1.4",
|
|
31
|
+
"@hasna/codewith-win32-x64": "0.1.4",
|
|
32
|
+
"@hasna/codewith-win32-arm64": "0.1.4"
|
|
33
33
|
}
|
|
34
34
|
}
|