Skip to content

armgit / Cap

Public Imported from GitHub
0

Open source Loom alternative. Beautiful, shareable screen recordings.

fix(cli): report the desktop version from the bundled CLI

Richie McIlroyd373a57abba4
diff --git a/Cargo.lock b/Cargo.lock
index 317744992..b1cc18b02 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -1259,7 +1259,7 @@ dependencies = [
[[package]]
name = "cap"
-version = "0.1.0"
+version = "0.6.1"
dependencies = [
"base64 0.22.1",
"cap-automation",
diff --git a/apps/cli/Cargo.toml b/apps/cli/Cargo.toml
index 195534978..8f815390e 100644
--- a/apps/cli/Cargo.toml
+++ b/apps/cli/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "cap"
-version = "0.1.0"
+version = "0.6.1"
edition = "2024"
[dependencies]
diff --git a/scripts/sync-desktop-versions.mjs b/scripts/sync-desktop-versions.mjs
index a1f80a6bd..9cd37ab3e 100644
--- a/scripts/sync-desktop-versions.mjs
+++ b/scripts/sync-desktop-versions.mjs
@@ -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]");
@@ -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}`);
@@ -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}`);
+}