@different-ai/opencode-browser 4.3.1 → 4.3.2
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/cli.js +27 -0
- package/extension/manifest.json +1 -1
- package/package.json +1 -1
package/bin/cli.js
CHANGED
|
@@ -31,6 +31,7 @@ import { execSync } from "child_process";
|
|
|
31
31
|
const __filename = fileURLToPath(import.meta.url);
|
|
32
32
|
const __dirname = dirname(__filename);
|
|
33
33
|
const PACKAGE_ROOT = join(__dirname, "..");
|
|
34
|
+
const PACKAGE_JSON = join(PACKAGE_ROOT, "package.json");
|
|
34
35
|
|
|
35
36
|
const BASE_DIR = join(homedir(), ".opencode-browser");
|
|
36
37
|
const EXTENSION_DIR = join(BASE_DIR, "extension");
|
|
@@ -108,6 +109,14 @@ function resolveNodePath() {
|
|
|
108
109
|
return process.execPath;
|
|
109
110
|
}
|
|
110
111
|
|
|
112
|
+
function getPackageVersion() {
|
|
113
|
+
try {
|
|
114
|
+
const pkg = JSON.parse(readFileSync(PACKAGE_JSON, "utf-8"));
|
|
115
|
+
if (typeof pkg?.version === "string") return pkg.version;
|
|
116
|
+
} catch {}
|
|
117
|
+
return null;
|
|
118
|
+
}
|
|
119
|
+
|
|
111
120
|
function writeHostWrapper(nodePath) {
|
|
112
121
|
ensureDir(BASE_DIR);
|
|
113
122
|
const script = `#!/bin/sh\n"${nodePath}" "${NATIVE_HOST_DST}"\n`;
|
|
@@ -293,6 +302,24 @@ async function install() {
|
|
|
293
302
|
ensureDir(BASE_DIR);
|
|
294
303
|
const srcExtensionDir = join(PACKAGE_ROOT, "extension");
|
|
295
304
|
copyDirRecursive(srcExtensionDir, EXTENSION_DIR);
|
|
305
|
+
|
|
306
|
+
const packageVersion = getPackageVersion();
|
|
307
|
+
if (packageVersion) {
|
|
308
|
+
const manifestPath = join(EXTENSION_DIR, "manifest.json");
|
|
309
|
+
if (existsSync(manifestPath)) {
|
|
310
|
+
try {
|
|
311
|
+
const manifest = JSON.parse(readFileSync(manifestPath, "utf-8"));
|
|
312
|
+
if (manifest.version !== packageVersion) {
|
|
313
|
+
manifest.version = packageVersion;
|
|
314
|
+
writeFileSync(manifestPath, JSON.stringify(manifest, null, 2) + "\n");
|
|
315
|
+
success(`Updated extension manifest version to ${packageVersion}`);
|
|
316
|
+
}
|
|
317
|
+
} catch (e) {
|
|
318
|
+
warn(`Could not update extension manifest: ${e.message || String(e)}`);
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
|
|
296
323
|
success(`Extension files copied to: ${EXTENSION_DIR}`);
|
|
297
324
|
|
|
298
325
|
header("Step 3: Load & Pin Extension");
|
package/extension/manifest.json
CHANGED