Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion apps/cli/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "cap"
version = "0.1.0"
version = "0.6.1"
edition = "2024"

[dependencies]
Expand Down
15 changes: 14 additions & 1 deletion scripts/sync-desktop-versions.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ const tauriManifest = path.join(
"Cargo.toml",
);
const gpuiManifest = path.join(repoRoot, "apps", "desktop-gpui", "Cargo.toml");
// The bundled `cap` CLI reports its own version (`cap --version`, MCP server
// info, `cap doctor`), so it ships with the desktop version too.
const cliManifest = path.join(repoRoot, "apps", "cli", "Cargo.toml");

function packageVersion(source, manifestPath) {
const packageStart = source.indexOf("[package]");
Expand Down Expand Up @@ -39,12 +42,14 @@ function replacePackageVersion(source, manifestPath, version) {
return source.slice(0, packageStart) + nextSection + source.slice(end);
}

const [tauriSource, gpuiSource] = await Promise.all([
const [tauriSource, gpuiSource, cliSource] = await Promise.all([
fs.readFile(tauriManifest, "utf8"),
fs.readFile(gpuiManifest, "utf8"),
fs.readFile(cliManifest, "utf8"),
]);
const version = packageVersion(tauriSource, tauriManifest);
const gpuiVersion = packageVersion(gpuiSource, gpuiManifest);
const cliVersion = packageVersion(cliSource, cliManifest);

if (!/^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?(?:\+[0-9A-Za-z.-]+)?$/.test(version))
throw new Error(`Invalid desktop version: ${version}`);
Expand All @@ -58,3 +63,11 @@ if (gpuiVersion !== version) {
} else {
console.log(`Cap desktop versions match: ${version}`);
}

if (cliVersion !== version) {
await fs.writeFile(
cliManifest,
replacePackageVersion(cliSource, cliManifest, version),
);
console.log(`Synchronized Cap CLI ${cliVersion} -> ${version}`);
}
Loading