Skip to content

Commit 3151051

Browse files
hugocasaclaude
andcommitted
feat(cli): show the migration warning on oneshot/linear/project commands
Previously the "other webmux servers detected" nudge only fired in `webmux project`. Broaden it to the other occasional, server-talking commands (oneshot, linear) by hoisting the check into the webmux.ts dispatch — the registry read is cheap and the warning is silent unless peers actually exist. Deliberately excludes the high-frequency worktree commands (list/open/ send/…), where a per-invocation warning would be noisy, and `project migrate` itself (which does the consolidating). Centralizing the call also removes the now-redundant one in project-commands.ts. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 92b1d13 commit 3151051

2 files changed

Lines changed: 16 additions & 4 deletions

File tree

bin/src/project-commands.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { resolve } from "node:path";
22
import { createApi, type ProjectInitPhase, type ProjectInitState } from "@webmux/api-contract";
33
import { CommandUsageError, formatServerError } from "./shared";
4-
import { runMigrate, warnIfOtherInstances } from "./migrate.ts";
4+
import { runMigrate } from "./migrate.ts";
55

66
const PROJECT_SETUP_POLL_INTERVAL_MS = 700;
77
const PROJECT_SETUP_TIMEOUT_MS = 5 * 60_000;
@@ -124,9 +124,6 @@ export async function runProjectCommand(args: string[], port: number): Promise<n
124124
return runMigrate(port);
125125
}
126126

127-
// Nudge toward consolidation when other servers are still running.
128-
warnIfOtherInstances(port);
129-
130127
const api = createApi(`http://localhost:${port}`);
131128
try {
132129
if (parsed.subcommand === "ls") {

bin/src/webmux.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -353,6 +353,21 @@ async function main(args: string[] = process.argv.slice(2)): Promise<void> {
353353
}
354354
}
355355

356+
// Nudge toward consolidation when other webmux servers are running — on the
357+
// occasional management commands (oneshot/linear/project), but NOT the
358+
// high-frequency worktree commands (list/open/send/…) where a per-invocation
359+
// warning would be noisy, nor `project migrate` (which consolidates them
360+
// itself). Cheap: a local registry read, silent unless peers exist, and to
361+
// stderr so it never pollutes piped output.
362+
const isProjectMigrate = parsed.command === "project" && parsed.commandArgs[0] === "migrate";
363+
const isOccasionalServerCommand = parsed.command === "oneshot"
364+
|| parsed.command === "linear"
365+
|| parsed.command === "project";
366+
if (isOccasionalServerCommand && !isProjectMigrate) {
367+
const { warnIfOtherInstances } = await import("./migrate.ts");
368+
warnIfOtherInstances(effectivePort);
369+
}
370+
356371
if (parsed.command === "oneshot") {
357372
const { runOneshotCommand } = await import("./oneshot.ts");
358373
const exitCode = await runOneshotCommand(parsed.commandArgs, effectivePort);

0 commit comments

Comments
 (0)