switchroom 0.12.1 → 0.12.3

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.
@@ -46894,8 +46894,8 @@ var {
46894
46894
  } = import__.default;
46895
46895
 
46896
46896
  // src/build-info.ts
46897
- var VERSION = "0.12.1";
46898
- var COMMIT_SHA = "0de1edd1";
46897
+ var VERSION = "0.12.3";
46898
+ var COMMIT_SHA = "88d8cd0a";
46899
46899
 
46900
46900
  // src/cli/agent.ts
46901
46901
  init_source();
@@ -68770,22 +68770,36 @@ import { spawnSync as spawnSync8 } from "node:child_process";
68770
68770
  import { join as join42, dirname as dirname13, resolve as resolve30 } from "node:path";
68771
68771
  import { homedir as homedir22 } from "node:os";
68772
68772
  var DEFAULT_COMPOSE_PATH = join42(homedir22(), ".switchroom", "compose", "docker-compose.yml");
68773
- function isGitCheckout(scriptPath) {
68773
+ function runningFromSwitchroomCheckout(scriptPath) {
68774
68774
  let dir = dirname13(scriptPath);
68775
- for (let i = 0;i < 10; i++) {
68776
- if (existsSync48(join42(dir, ".git")))
68777
- return true;
68775
+ for (let i = 0;i < 12; i++) {
68776
+ if (existsSync48(join42(dir, ".git"))) {
68777
+ try {
68778
+ const pkg = JSON.parse(readFileSync45(join42(dir, "package.json"), "utf-8"));
68779
+ if (pkg.name === "switchroom")
68780
+ return true;
68781
+ } catch {}
68782
+ }
68778
68783
  const parent = dirname13(dir);
68779
68784
  if (parent === dir)
68780
- return false;
68785
+ break;
68781
68786
  dir = parent;
68782
68787
  }
68783
68788
  return false;
68784
68789
  }
68790
+ function rebuildRefusalMessage(scriptPath) {
68791
+ if (runningFromSwitchroomCheckout(scriptPath))
68792
+ return null;
68793
+ return `--rebuild builds the CLI from a git checkout, but switchroom is ` + `running from "${scriptPath}" \u2014 not a switchroom source checkout ` + `(this is a published / installed copy). Rebuilding from source ` + `here would drift this host off the reviewed, CI-published ` + `release. Use the published path:
68794
+ ` + `
68795
+ ` + ` npm i -g switchroom@latest && switchroom update
68796
+ ` + `
68797
+ ` + `(\`--rebuild\` is for switchroom maintainers iterating on a source ` + `checkout \u2014 not for published installs.)`;
68798
+ }
68785
68799
  function planUpdate(opts) {
68786
68800
  const composePath = opts.composePath ?? DEFAULT_COMPOSE_PATH;
68787
68801
  const runner = opts.runner ?? defaultRunner;
68788
- const scriptPath = process.argv[1] ?? "";
68802
+ const scriptPath = opts.scriptPath ?? process.argv[1] ?? "";
68789
68803
  const steps = [];
68790
68804
  const releaseOverrideArgs = [];
68791
68805
  if (opts.channel)
@@ -68832,8 +68846,9 @@ function planUpdate(opts) {
68832
68846
  name: "rebuild-source",
68833
68847
  description: "git pull upstream main + bun install + npm run build",
68834
68848
  run: () => {
68835
- if (!isGitCheckout(scriptPath)) {
68836
- throw new Error(`--rebuild requires a git checkout, but the CLI is running ` + `from ${scriptPath} which has no .git ancestor (looks like ` + `an installed binary). Drop --rebuild or invoke from a ` + `source checkout.`);
68849
+ const refusal = rebuildRefusalMessage(scriptPath);
68850
+ if (refusal) {
68851
+ throw new Error(refusal);
68837
68852
  }
68838
68853
  const pull = runner("git", ["pull", "--ff-only", "upstream", "main"]);
68839
68854
  if (pull.status !== 0)
@@ -69153,6 +69168,14 @@ async function runUpdate(opts) {
69153
69168
  `));
69154
69169
  return 2;
69155
69170
  }
69171
+ if (opts.rebuild) {
69172
+ const refusal = rebuildRefusalMessage(opts.scriptPath ?? process.argv[1] ?? "");
69173
+ if (refusal) {
69174
+ stderr(source_default.red(refusal + `
69175
+ `));
69176
+ return 2;
69177
+ }
69178
+ }
69156
69179
  const steps = planUpdate(opts);
69157
69180
  if (opts.check) {
69158
69181
  stdout(source_default.bold(`switchroom update --check (dry-run)
@@ -69190,7 +69213,7 @@ Dry-run only; nothing was changed. Re-run without --check to apply.
69190
69213
  return 0;
69191
69214
  }
69192
69215
  function registerUpdateCommand(program3) {
69193
- program3.command("update").description("Update switchroom on this host: pull images, refresh scaffolds, recreate containers. Wraps the full `pull && apply && up -d` flow.").option("--check", "Dry-run: print the steps that would execute, exit 0.").option("--skip-images", "Skip the docker image pull (offline mode).").option("--rebuild", "Source-checkout users: also git pull + bun install + npm run build before applying. Auto-skipped when the CLI is an installed binary.").option("--status", "Read-only snapshot: report local CLI version, image digest + pull time, container creation time per service. Does NOT invoke any update steps. Wired by Telegram /upgrade-status (#927).").option("--json", "Output as JSON (currently only honored under --status; other modes ignore).").addOption(new Option("--channel <c>", "Override the resolved release block for this update run: follow the named channel (dev|rc|latest). Mutually exclusive with --pin.").choices(["dev", "rc", "latest"]).conflicts("pin")).addOption(new Option("--pin <p>", "Override the resolved release block for this update run: pin to a specific build (sha-<7-40 hex> or v<semver>). Mutually exclusive with --channel.").conflicts("channel")).option("--force", "[legacy v0.6 no-op]").option("--no-restart", "[legacy v0.6 no-op]").option("--resume <file>", "[legacy v0.6 no-op]").option("--phase <phase>", "[legacy v0.6 no-op]").action(async (opts) => {
69216
+ program3.command("update").description("Update switchroom on this host: pull images, refresh scaffolds, recreate containers. Wraps the full `pull && apply && up -d` flow.").option("--check", "Dry-run: print the steps that would execute, exit 0.").option("--skip-images", "Skip the docker image pull (offline mode).").option("--rebuild", "Source-checkout / maintainer only: git pull + bun install + npm run build before applying. REFUSED on a published install \u2014 use `npm i -g switchroom@latest && switchroom update` there.").option("--status", "Read-only snapshot: report local CLI version, image digest + pull time, container creation time per service. Does NOT invoke any update steps. Wired by Telegram /upgrade-status (#927).").option("--json", "Output as JSON (currently only honored under --status; other modes ignore).").addOption(new Option("--channel <c>", "Override the resolved release block for this update run: follow the named channel (dev|rc|latest). Mutually exclusive with --pin.").choices(["dev", "rc", "latest"]).conflicts("pin")).addOption(new Option("--pin <p>", "Override the resolved release block for this update run: pin to a specific build (sha-<7-40 hex> or v<semver>). Mutually exclusive with --channel.").conflicts("channel")).option("--force", "[legacy v0.6 no-op]").option("--no-restart", "[legacy v0.6 no-op]").option("--resume <file>", "[legacy v0.6 no-op]").option("--phase <phase>", "[legacy v0.6 no-op]").action(async (opts) => {
69194
69217
  if (opts.pin && !/^(sha-[0-9a-f]{7,40}|v\d+\.\d+\.\d+)$/.test(opts.pin)) {
69195
69218
  console.error(source_default.red(`--pin "${opts.pin}" is invalid. Expected sha-<7-40 hex> or v<semver>.`));
69196
69219
  process.exit(2);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "switchroom",
3
- "version": "0.12.1",
3
+ "version": "0.12.3",
4
4
  "description": "Run Claude Code 24/7 on your Claude Pro/Max subscription over Telegram. Open-source alternative to OpenClaw and NanoClaw — no API keys.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -46559,11 +46559,11 @@ function sweepStaleTurnActiveMarker(stateDir, opts) {
46559
46559
  }
46560
46560
 
46561
46561
  // ../src/build-info.ts
46562
- var VERSION = "0.12.1";
46563
- var COMMIT_SHA = "0de1edd1";
46564
- var COMMIT_DATE = "2026-05-18T08:08:32Z";
46565
- var LATEST_PR = 1503;
46566
- var COMMITS_AHEAD_OF_TAG = null;
46562
+ var VERSION = "0.12.3";
46563
+ var COMMIT_SHA = "88d8cd0a";
46564
+ var COMMIT_DATE = "2026-05-18T09:24:07Z";
46565
+ var LATEST_PR = 1509;
46566
+ var COMMITS_AHEAD_OF_TAG = 2;
46567
46567
 
46568
46568
  // gateway/boot-version.ts
46569
46569
  function formatRelativeAgo(iso) {