Release binaries / Build macOS ARM64 (push) Has been cancelled
Release binaries / Build macOS x64 (push) Has been cancelled
Release binaries / Build Linux ARM64 (push) Has been cancelled
Release binaries / Build Linux musl ARM64 (push) Has been cancelled
Release binaries / Build Linux musl x64 (push) Has been cancelled
Release binaries / Build Linux x64 (push) Has been cancelled
Release binaries / Build Windows x64 (push) Has been cancelled
Release binaries / Attach binaries to GitHub Release (push) Has been cancelled
Standalone product rename across the whole repo (issue: project identity): - Binary/package/repo/skill/docs: agent-browser[-stealth] → chrome-use (single binary name `chrome-use`; old aliases agent-browser/abs dropped). - Version: 0.27.0-fork.51 → 1.0.0 (drop the upstream-fork counter). - Native-messaging host: com.agent_browser.connect → com.leeguoo.chrome_use (CLI + ab-connect extension in lockstep — this is a breaking handshake change, extension bumped 0.4.2 → 0.5.0, needs a Web Store republish). - Config dir: ~/.agent-browser → ~/.chrome-use. - README/zh: reframed from "stealth fork of agent-browser" to a standalone product with a small `originally based on vercel-labs/agent-browser` credit. - Kept AGENT_BROWSER_* env vars working (63 vars across the codebase; renaming them would break every existing script/skill for no user-facing gain). Build green, 802 unit tests pass, fmt + clippy clean. Upstream attribution to vercel-labs/agent-browser preserved.
88 lines
2.6 KiB
JavaScript
88 lines
2.6 KiB
JavaScript
#!/usr/bin/env node
|
|
|
|
/**
|
|
* Syncs the version from package.json to all other config files.
|
|
* Run this script before building or releasing.
|
|
*/
|
|
|
|
import { execSync } from "child_process";
|
|
import { readFileSync, writeFileSync } from "fs";
|
|
import { dirname, join } from "path";
|
|
import { fileURLToPath } from "url";
|
|
|
|
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
const rootDir = join(__dirname, "..");
|
|
const cliDir = join(rootDir, "cli");
|
|
|
|
// Read version from package.json (single source of truth)
|
|
const packageJson = JSON.parse(
|
|
readFileSync(join(rootDir, "package.json"), "utf-8")
|
|
);
|
|
const version = packageJson.version;
|
|
|
|
function parseForkVersion(raw) {
|
|
const match = raw.match(/^([0-9]+\.[0-9]+\.[0-9]+)-fork\.([A-Za-z0-9.-]+)$/);
|
|
if (!match) return null;
|
|
return {
|
|
upstream: match[1],
|
|
fork: match[2],
|
|
};
|
|
}
|
|
|
|
const forkVersion = parseForkVersion(version);
|
|
if (forkVersion) {
|
|
console.log(
|
|
`Syncing version ${version} (upstream=${forkVersion.upstream}, fork=${forkVersion.fork}) to all config files...`
|
|
);
|
|
} else {
|
|
console.log(`Syncing version ${version} to all config files...`);
|
|
}
|
|
|
|
// Update Cargo.toml
|
|
const cargoTomlPath = join(cliDir, "Cargo.toml");
|
|
let cargoToml = readFileSync(cargoTomlPath, "utf-8");
|
|
const cargoVersionRegex = /^version\s*=\s*"[^"]*"/m;
|
|
const newCargoVersion = `version = "${version}"`;
|
|
const cargoNameMatch = cargoToml.match(/^name\s*=\s*"([^"]+)"/m);
|
|
const cargoPackageName = cargoNameMatch?.[1] ?? "chrome-use";
|
|
|
|
let cargoTomlUpdated = false;
|
|
if (cargoVersionRegex.test(cargoToml)) {
|
|
const oldMatch = cargoToml.match(cargoVersionRegex)?.[0];
|
|
if (oldMatch !== newCargoVersion) {
|
|
cargoToml = cargoToml.replace(cargoVersionRegex, newCargoVersion);
|
|
writeFileSync(cargoTomlPath, cargoToml);
|
|
console.log(` Updated cli/Cargo.toml: ${oldMatch} -> ${newCargoVersion}`);
|
|
cargoTomlUpdated = true;
|
|
} else {
|
|
console.log(` cli/Cargo.toml already up to date`);
|
|
}
|
|
} else {
|
|
console.error(" Could not find version field in cli/Cargo.toml");
|
|
process.exit(1);
|
|
}
|
|
|
|
// Update Cargo.lock to match Cargo.toml
|
|
if (cargoTomlUpdated) {
|
|
try {
|
|
execSync(`cargo update -p ${cargoPackageName} --offline`, {
|
|
cwd: cliDir,
|
|
stdio: "pipe",
|
|
});
|
|
console.log(` Updated cli/Cargo.lock`);
|
|
} catch {
|
|
// --offline may fail if package not in cache, try without it
|
|
try {
|
|
execSync(`cargo update -p ${cargoPackageName}`, {
|
|
cwd: cliDir,
|
|
stdio: "pipe",
|
|
});
|
|
console.log(` Updated cli/Cargo.lock`);
|
|
} catch (e) {
|
|
console.error(` Warning: Could not update Cargo.lock: ${e.message}`);
|
|
}
|
|
}
|
|
}
|
|
|
|
console.log("Version sync complete.");
|