codeam-cli 2.4.20 → 2.4.22

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/CHANGELOG.md CHANGED
@@ -4,6 +4,18 @@ All notable changes to `codeam-cli` are documented here.
4
4
 
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6
6
 
7
+ ## [2.4.21] — 2026-05-03
8
+
9
+ ### Fixed
10
+
11
+ - **cli:** Only run keep-alive heartbeat inside a Codespace (v2.4.21)
12
+
13
+ ## [2.4.20] — 2026-05-03
14
+
15
+ ### Added
16
+
17
+ - **cli:** Handle set_keep_alive command from apps' Settings modal (v2.4.20)
18
+
7
19
  ## [2.4.19] — 2026-05-03
8
20
 
9
21
  ### Added
package/dist/index.js CHANGED
@@ -179,7 +179,7 @@ var import_qrcode_terminal = __toESM(require("qrcode-terminal"));
179
179
  // package.json
180
180
  var package_default = {
181
181
  name: "codeam-cli",
182
- version: "2.4.20",
182
+ version: "2.4.22",
183
183
  description: "Remote control Claude Code (and other AI coding agents) from your mobile phone. Pair your device, send prompts, stream responses in real-time, and approve commands \u2014 from anywhere.",
184
184
  main: "dist/index.js",
185
185
  bin: {
@@ -2772,9 +2772,14 @@ except Exception:sys.exit(0)
2772
2772
  break;
2773
2773
  case "set_keep_alive": {
2774
2774
  const enabled = !!cmd.payload.enabled;
2775
+ const inCodespaceEnv = process.env.CODESPACES === "true";
2775
2776
  setKeepAlive(enabled);
2776
2777
  try {
2777
- await relay.sendResult(cmd.id, "success", { enabled });
2778
+ await relay.sendResult(
2779
+ cmd.id,
2780
+ "success",
2781
+ { enabled, applied: enabled && inCodespaceEnv, runtime: inCodespaceEnv ? "github-codespaces" : "local" }
2782
+ );
2778
2783
  } catch {
2779
2784
  }
2780
2785
  break;
@@ -3023,13 +3028,14 @@ except Exception:sys.exit(0)
3023
3028
  setTimeout(() => {
3024
3029
  fetchQuotaUsage();
3025
3030
  }, 5e3);
3031
+ const inCodespace = process.env.CODESPACES === "true";
3026
3032
  let keepAliveTimer = null;
3027
3033
  function setKeepAlive(enabled) {
3028
3034
  if (keepAliveTimer) {
3029
3035
  clearInterval(keepAliveTimer);
3030
3036
  keepAliveTimer = null;
3031
3037
  }
3032
- if (!enabled) return;
3038
+ if (!enabled || !inCodespace) return;
3033
3039
  const ping = () => {
3034
3040
  const proc = (0, import_child_process4.spawn)("bash", ["-lc", "gh codespace list >/dev/null 2>&1 || true"], {
3035
3041
  stdio: "ignore",
@@ -5377,6 +5383,40 @@ var GitHubCodespacesProvider = class {
5377
5383
  if (ok) O2.success("gh installed");
5378
5384
  else O2.error("gh install failed");
5379
5385
  }
5386
+ /**
5387
+ * Re-run `gh auth refresh` with broader scopes so `gh repo list`
5388
+ * can return repos in orgs the user belongs to (and team repos
5389
+ * accessible via membership). The default codespace scope set
5390
+ * (`codespace,repo,read:user`) already covers the user's own
5391
+ * repos and most personal collaborator repos, but org repos and
5392
+ * private team repos require `read:org`. We add `read:org` here
5393
+ * and re-issue.
5394
+ */
5395
+ async expandListScopes() {
5396
+ wt(
5397
+ [
5398
+ "We'll re-authorize `gh` with broader scopes so org and team",
5399
+ "repositories show up in the list. A browser will open for",
5400
+ "a one-tap approval."
5401
+ ].join("\n"),
5402
+ "Expanding GitHub scopes"
5403
+ );
5404
+ resetStdinForChild();
5405
+ await new Promise((resolve2, reject) => {
5406
+ const proc = (0, import_child_process5.spawn)(
5407
+ "gh",
5408
+ ["auth", "refresh", "-h", "github.com", "-s", "repo,read:org"],
5409
+ { stdio: "inherit" }
5410
+ );
5411
+ proc.on("exit", (code) => {
5412
+ if (code === 0) resolve2();
5413
+ else reject(new Error(
5414
+ "gh auth refresh failed. Re-run `gh auth refresh -h github.com -s repo,read:org` manually."
5415
+ ));
5416
+ });
5417
+ proc.on("error", reject);
5418
+ });
5419
+ }
5380
5420
  async listProjects() {
5381
5421
  const { stdout } = await execFileP2(
5382
5422
  "gh",
@@ -5668,34 +5708,54 @@ async function deploy() {
5668
5708
  pt(err instanceof Error ? err.message : String(err));
5669
5709
  process.exit(1);
5670
5710
  }
5671
- const listStep = fe();
5672
- listStep.start("Loading your projects\u2026");
5673
- let projects = [];
5674
- try {
5675
- projects = await provider.listProjects();
5676
- listStep.stop(`\u2713 ${projects.length} project${projects.length === 1 ? "" : "s"} available`);
5677
- } catch (err) {
5678
- listStep.stop(`\u2717 Could not list projects`);
5679
- pt(err instanceof Error ? err.message : String(err));
5680
- process.exit(1);
5681
- }
5682
- if (projects.length === 0) {
5683
- pt("No projects found on the account.");
5684
- process.exit(0);
5685
- }
5686
- const projectId = await _t({
5687
- message: "Select a project to deploy:",
5688
- options: projects.slice(0, 50).map((proj) => ({
5711
+ const EXPAND_SCOPES = "__expand_scopes__";
5712
+ let project = null;
5713
+ while (!project) {
5714
+ const listStep = fe();
5715
+ listStep.start("Loading your projects\u2026");
5716
+ let projects = [];
5717
+ try {
5718
+ projects = await provider.listProjects();
5719
+ listStep.stop(`\u2713 ${projects.length} project${projects.length === 1 ? "" : "s"} available`);
5720
+ } catch (err) {
5721
+ listStep.stop(`\u2717 Could not list projects`);
5722
+ pt(err instanceof Error ? err.message : String(err));
5723
+ process.exit(1);
5724
+ }
5725
+ const options = projects.slice(0, 50).map((proj) => ({
5689
5726
  value: proj.id,
5690
5727
  label: proj.fullName,
5691
5728
  hint: proj.description ? proj.description.slice(0, 80) : proj.private ? "private" : "public"
5692
- }))
5693
- });
5694
- if (q(projectId) || typeof projectId !== "string") {
5695
- pt("Cancelled.");
5696
- process.exit(0);
5729
+ }));
5730
+ if (provider.expandListScopes) {
5731
+ options.push({
5732
+ value: EXPAND_SCOPES,
5733
+ label: import_picocolors8.default.cyan("+ Don't see your project? Expand scopes\u2026"),
5734
+ hint: "Re-authorize with broader scopes (org / team repos)"
5735
+ });
5736
+ }
5737
+ if (options.length === 0) {
5738
+ pt("No projects found on the account.");
5739
+ process.exit(0);
5740
+ }
5741
+ const projectId = await _t({
5742
+ message: "Select a project to deploy:",
5743
+ options
5744
+ });
5745
+ if (q(projectId) || typeof projectId !== "string") {
5746
+ pt("Cancelled.");
5747
+ process.exit(0);
5748
+ }
5749
+ if (projectId === EXPAND_SCOPES) {
5750
+ try {
5751
+ await provider.expandListScopes();
5752
+ } catch (err) {
5753
+ O2.warn(err instanceof Error ? err.message : String(err));
5754
+ }
5755
+ continue;
5756
+ }
5757
+ project = projects.find((proj) => proj.id === projectId) ?? null;
5697
5758
  }
5698
- const project = projects.find((proj) => proj.id === projectId);
5699
5759
  let workspace = null;
5700
5760
  if (provider.listExistingWorkspaces && provider.startWorkspace) {
5701
5761
  const existingStep = fe();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "codeam-cli",
3
- "version": "2.4.20",
3
+ "version": "2.4.22",
4
4
  "description": "Remote control Claude Code (and other AI coding agents) from your mobile phone. Pair your device, send prompts, stream responses in real-time, and approve commands — from anywhere.",
5
5
  "main": "dist/index.js",
6
6
  "bin": {