aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorTianren Dong <tianrendong.dtr@gmail.com>2026-05-13 07:51:17 -0400
committerTianren Dong <tianrendong.dtr@gmail.com>2026-05-13 07:51:17 -0400
commite88e8a3a7a2258c5e7152da192effd8c788ae677 (patch)
treed913bfabdd1441e1bd74dab4b026041d3e6bf4e6 /scripts
parent2ebc7e8003d7b6c9d39074eb6d96831d56701117 (diff)
pi-chrome 0.14.9: trusted-mode primer + auto-sync manifest version
- Primer teaches agents the trusted:true escape hatch for CSP-locked pages (github.com, banks, many SaaS) where chrome_evaluate/chrome_snapshot throw EvalError due to missing 'unsafe-eval'. Agents now self-escalate instead of giving up and asking the user. - Corrects stale primer claim that chrome_evaluate works without 'unsafe-eval'. - scripts/sync-manifest-version.js wired to npm version + prepublishOnly lifecycle hooks; kills the recurring browser-extension manifest version drift (cf. 0.14.4, 0.14.8).
Diffstat (limited to 'scripts')
-rw-r--r--scripts/sync-manifest-version.js37
1 files changed, 37 insertions, 0 deletions
diff --git a/scripts/sync-manifest-version.js b/scripts/sync-manifest-version.js
new file mode 100644
index 0000000..b5515af
--- /dev/null
+++ b/scripts/sync-manifest-version.js
@@ -0,0 +1,37 @@
+#!/usr/bin/env node
+// Sync browser-extension/manifest.json version from package.json.
+// Run automatically by the `version` npm lifecycle hook (npm version <bump>),
+// and pre-publish, so the Chrome extension version never drifts from the npm
+// package version.
+const { readFileSync, writeFileSync } = require("node:fs");
+const { join } = require("node:path");
+
+const pkgPath = join(__dirname, "..", "package.json");
+const manifestPath = join(
+ __dirname,
+ "..",
+ "extensions",
+ "chrome-profile-bridge",
+ "browser-extension",
+ "manifest.json",
+);
+
+const pkg = JSON.parse(readFileSync(pkgPath, "utf8"));
+const manifest = JSON.parse(readFileSync(manifestPath, "utf8"));
+
+if (manifest.version === pkg.version) {
+ console.log(`manifest.json already at ${pkg.version}`);
+ process.exit(0);
+}
+
+const prev = manifest.version;
+manifest.version = pkg.version;
+writeFileSync(manifestPath, JSON.stringify(manifest, null, 2) + "\n");
+console.log(`manifest.json ${prev} -> ${pkg.version}`);
+
+// Stage so `npm version` includes manifest bump in the version commit.
+try {
+ require("node:child_process").execSync(`git add "${manifestPath}"`, { stdio: "ignore" });
+} catch {
+ /* not in a git checkout - ok */
+}