rex-worktrees 0.3.1 → 0.3.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.
package/README.md CHANGED
@@ -65,14 +65,16 @@ For a manual Lua installation, supply an absolute executable path with `require(
65
65
  The chooser is one flat form: **Project**, **Machine**, **Checkout** (or **Workspace**), **Session**, and **Mode** for an ordinary open. Only applicable fields appear; there is no Options menu. Machine is always explicit:
66
66
 
67
67
  - **Project:** select a known Git or JJ project, type a project name, or enter an absolute repository path. Linked checkouts appear under their canonical project. After an explicit project selection, the inspected checkout on the chosen machine is selected by default when available; a same-named directory on another host is never assumed to be that checkout.
68
- - **Machine:** select this machine or an existing Rex host. Changing machines keeps the logical project choice but clears host-bound checkout, base, clone destination, and session bindings; select or enter an actual project directory on the destination.
68
+ - **Machine:** select this machine or an existing Rex host. Changing machines keeps the logical project choice but clears host-bound checkout, base, clone destination, and session bindings; select or enter an actual project directory on the destination. The selected machine appears immediately with a disabled loading form while its connection and project choices are fetched; previous-machine checkout and session choices are not available during the wait.
69
69
  - **Checkout / Workspace:** Git offers exact existing checkout paths and branches together. Selecting a checkout opens that path; typing a branch name attaches a free branch or creates that branch and its checkout, while an occupied branch opens its existing checkout. Typed branch text is never a directory name. For a new Git branch, the form also shows **Directory**, an independent optional checkout directory name; select **Use default** to clear a custom name. JJ offers registered workspaces, including unavailable locations (visible but not openable), or a name for a new workspace. New JJ workspaces show **Start from**; an existing JJ workspace opens unchanged without it.
70
- - **Clone to:** when cloning a project, the form displays the literal absolute destination path; editing it changes only that destination. **Branch** (Git) or **Start from** (JJ) and an optional separate **Directory** (Git) or **Workspace** (JJ) name are visible on the same form. A Git clone without a default branch requires a branch choice. Select **Use default** to clear the optional checkout name; typing `none` is a literal name, not a clearing command. A project name unsafe as a directory requires an absolute destination. Destination collisions and writability errors appear on review without opening a task, and the destination remains editable.
71
- - **Session:** select an existing session by its exact ID, or type a name to create a new session on the selected machine. A typed name remains new even if an existing session has the same label; review shows **New: NAME** before confirmation. An empty session list still permits typing a name. Names must be nonblank, at most 128 characters, and contain no ASCII control characters.
70
+ - **Clone to:** when cloning a project, the form displays the literal absolute destination path; editing it changes only that destination. **Branch** (Git) or **Start from** (JJ) and an optional separate **Directory** (Git) or **Workspace** (JJ) name are visible on the same form. A Git clone without a default branch requires a branch choice. Select **Use default** to clear the optional checkout name; typing `none` is a literal name, not a clearing command. A project name unsafe as a directory requires an absolute destination. Destination collisions and writability errors appear on submit without opening a task, and the destination remains editable.
71
+ - **Session:** select an existing session by its exact ID, or type a name to create a new session on the selected machine. A typed name remains new even if an existing session has the same label; the form shows **New: NAME** before submission. An empty session list still permits typing a name. Names must be nonblank, at most 128 characters, and contain no ASCII control characters.
72
72
 
73
73
  **Mode** for an ordinary open reuses a matching live tab, opens another tab, or splits a matching task; a split without a matching task opens a new tab. Cloning always starts a new tab, so it has no Mode field. New JJ workspaces default **Start from** to the repository-configured `trunk()` mainline when it resolves to one valid commit; otherwise choose a source candidate or type a singular revision. A selected bookmark or revision overrides the default and pins its full commit ID without changing the entered workspace name. A JJ clone can use its native default or select/type a source revision resolved on the source machine. Bookmarks are optional and never created automatically. Source-only unpublished JJ changes and unpushed Git branches are unavailable to a destination clone.
74
74
 
75
- Use arrows or `j`/`k` to move, Tab/Shift+Tab to change fields, and Enter to edit or select the form action. In an editor, Enter or Ctrl+S **only accepts that field** and returns to the form; it never reviews or launches. Ctrl+U clears the editor; Esc cancels it (or closes the form). Submit explicitly from the form: an ordinary selected existing checkout in an existing exact session can open immediately if review confirms the displayed path and finds no warning or changed plan. Creating or attaching a checkout, cloning, a typed new session, JJ snapshot side effects, or a warning instead shows **Review**, then requires **Confirm**. If a plan differs from the one already displayed, the changed plan must be shown and submitted again. Clone review shows the validated source URL, destination, and published-history warning once rather than repeating the preliminary notice. No agent or model is required; the task opens a shell.
75
+ Use arrows or `j`/`k` to move, Tab/Shift+Tab to change fields, and Enter to edit or select the form action. In an editor, Enter or Ctrl+S **only accepts that field** and returns to the form; it never reviews or launches. Submit explicitly from the form: the first submit validates the current plan and opens or creates the selected checkout, JJ workspace, clone, or new session when there is no warning. A warning, display limitation, or reviewed path differing from an explicitly selected existing checkout shows the actual plan and requires another submit; if a previously reviewed plan changes, its updated destination or target is shown and must be submitted again. Clone validation includes the source URL and destination; only pushed history transfers. No agent or model is required; the task opens a shell.
76
+
77
+ The form adds no extra spacing between its side borders and content; selection gutters remain visible.
76
78
 
77
79
  ## Projects and checkout locations
78
80
 
@@ -118,7 +120,7 @@ rex-worktrees open --repo /absolute/path/jj-workspace \
118
120
  --session session:FULL-ID --name Task
119
121
  ```
120
122
 
121
- `popup` runs the chooser in the invoking terminal; `launch-popup` opens its floating UI in the source Rex window. For `launch-popup` from an external terminal, supply `--session`; inside Rex, the originating session is available automatically. `launch-popup --host` keeps the UI on the caller's server while selecting another execution host. `--host` accepts an existing Rex host label or registry ID; find exact destination session IDs with `rex -S HOST ls --json`. `open --session` still requires an existing exact ID; new-session naming is available in the popup. Remote `--repo` and `--worktree` paths must be absolute paths on the destination.
123
+ `popup` runs the chooser in the invoking terminal; `launch-popup` opens its floating UI in the source Rex window. For `launch-popup` from an external terminal, supply `--session`; inside Rex, the originating session is available automatically. The `worktrees_open` shortcut delegates to the originating Rex server when invoked from a remote tab, so its popup and helper run on that machine. `launch-popup --host` keeps the UI on the caller's server while selecting another execution host. `--host` accepts an existing Rex host label or registry ID; find exact destination session IDs with `rex -S HOST ls --json`. `open --session` still requires an existing exact ID; new-session naming is available in the popup. Remote `--repo` and `--worktree` paths must be absolute paths on the destination.
122
124
 
123
125
  `open` detects Git or JJ at `--repo`; no VCS switch is needed. Git accepts `--branch` or `--worktree`, with `--worktree-name` for a new branch checkout. JJ accepts `--worktree` for an existing workspace, or `--revision` plus `--worktree-name` for a new workspace. `--repo` is the actual invoking JJ workspace on the destination: relative revisions such as `@-` resolve there, and creating a new workspace may snapshot it. `--name` independently labels the tab or pane. By default, a matching live tab is reused; `--additional` opens another tab, and `--split` splits a matching task or falls back to a new tab. These two flags cannot be combined. `--client ID` selects an exact Rex app client when needed. See `rex-worktrees --help` for popup origin/context flags.
124
126
 
@@ -126,7 +128,7 @@ rex-worktrees open --repo /absolute/path/jj-workspace \
126
128
 
127
129
  A submitted checkout or clone task can continue after the chooser closes, and closing a tab does not delete its checkout or clone. If a launch times out or Rex reports an uncertain result, inspect the destination repository and exact session before retrying; partial/registered JJ workspaces and clone destinations are retained rather than blindly removed or retried. Opening or browsing an existing JJ workspace does not snapshot, edit, update-stale, rebase, or move bookmarks. **Creating a JJ workspace invokes native `jj workspace add`, which may snapshot the actual source workspace and change its JJ working-copy commit and Git index intent-to-add entries**; the review notice names that source. Git worktrees keep their separate files, HEAD, and index while sharing refs, objects, remotes, and config. The tool does not force checkout, switch, stash, reset, clean, or prune. A cross-host clone transfers only published Git history from the source origin, not uncommitted files, local-only commits/branches/changes, source credentials, or environment. An explicitly pinned JJ base must be reachable after destination clone or the retained clone requires inspection; omitting a pin uses the clone's native default. Destination credentials and network access must work independently. Shells are not confined to the checkout. Associations live per destination at `${XDG_STATE_HOME:-~/.local/state}/rex-worktrees/associations`; Git/JJ inventory remains authoritative if an association becomes stale.
128
130
 
129
- New Rex sessions are created only after final review. If the tab or focus step fails, inspect the retained session before retrying; neither sessions nor checkouts are automatically deleted or blindly retried.
131
+ New Rex sessions are created only on form submission, after plan validation and any required confirmation. If the tab or focus step fails, inspect the retained session before retrying; neither sessions nor checkouts are automatically deleted or blindly retried.
130
132
 
131
133
  The release workflow builds and checks macOS ARM64 and Linux x64 executables in their native CI runners, including Git/JJ integration tests and malformed-request smoke checks. Linux destinations have not been verified against a live remote Rex/JJ setup; cross-host execution and cloning remain experimental. Each execution machine requires a matching Rex Worktrees build (older helper protocols are rejected), its own Git/JJ executables as applicable, and a connected Rex host. Native app navigation requires Rex Remote Control permission. Local endpoints must be Unix endpoints; Windows named pipes are not supported. For a custom local Unix server, set `REX_WORKTREES_LOCAL_ENDPOINT=unix:///absolute/path/server.sock` in the plugin environment.
132
134
 
@@ -1,4 +1,4 @@
1
1
  [diffend] Oversized file quarantined before diffing.
2
2
  name: package/dist/rex-worktrees
3
3
  size: 64491792 bytes
4
- sha256: 235ebfe826805f6c2bc6bce787c14f1dbed9d38d1d05c7d9e9401319719705fe
4
+ sha256: fa2f0d926edb47e2640c8a5b8bac530c9a025f0e297023a88a54a462759925ca
@@ -35486,27 +35486,35 @@ var connectMachine = exports_Effect.fnUntraced(function* (machine) {
35486
35486
  yield* exports_Schema.decodeUnknownEffect(RexHelperArgsSchema)(helper.args);
35487
35487
  return { ...current, hostId: identity3.host_id };
35488
35488
  });
35489
- var request3 = exports_Effect.fnUntraced(function* (host, command, body) {
35489
+ var connectedRequest = exports_Effect.fnUntraced(function* (host, command, body) {
35490
35490
  const encoded = { version: 4, hostId: host.hostId, ...body };
35491
- let response;
35492
- if (host.local) {
35493
- response = yield* dispatchHost(encoded, command);
35494
- } else {
35491
+ const response = host.local ? yield* dispatchHost(encoded, command) : yield* exports_Schema.decodeUnknownEffect(RexWorktreesResponseSchema)(yield* remoteRex(host.selector, ["do", "worktrees_request", "--args", JSON.stringify({ request: JSON.stringify(encoded) }), "--json"]));
35492
+ if (response.hostId !== host.hostId || response.version !== 4 || response.kind !== body.kind && !(body.kind === "project" && response.kind === "project-missing" && response.path === body.path))
35493
+ return yield* fail20(`Unexpected Rex host/protocol response from ${host.label}; update rex-worktrees on that machine, run setup, and reload its Rex config`);
35494
+ return response;
35495
+ });
35496
+ var request3 = exports_Effect.fnUntraced(function* (host, command, body) {
35497
+ if (!host.local) {
35495
35498
  const current = yield* connectMachine(host);
35496
35499
  if (current.hostId !== host.hostId)
35497
35500
  return yield* fail20(`Rex host identity changed for ${host.label}; reconnect before continuing`);
35498
- const raw = yield* remoteRex(current.selector, ["do", "worktrees_request", "--args", JSON.stringify({ request: JSON.stringify(encoded) }), "--json"]);
35499
- response = yield* exports_Schema.decodeUnknownEffect(RexWorktreesResponseSchema)(raw);
35501
+ host = current;
35500
35502
  }
35501
- if (response.hostId !== host.hostId || response.version !== 4 || response.kind !== body.kind && !(body.kind === "project" && response.kind === "project-missing" && response.path === body.path))
35502
- return yield* fail20(`Unexpected Rex host/protocol response from ${host.label}; update rex-worktrees on that machine, run setup, and reload its Rex config`);
35503
- return response;
35503
+ return yield* connectedRequest(host, command, body);
35504
35504
  });
35505
+ var discovery = (result4) => ({ sessions: result4.sessions, clients: result4.clients, projects: result4.projects, roots: result4.roots ?? [], cloneRoot: result4.cloneRoot, ...result4.checkout ? { checkout: result4.checkout } : {} });
35505
35506
  var discover = exports_Effect.fnUntraced(function* (host, command, context3) {
35506
35507
  const result4 = yield* request3(host, command, { kind: "discover", ...host.local && context3 ? { context: context3 } : {} });
35507
35508
  if (result4.kind !== "discover")
35508
35509
  return yield* fail20("Unexpected discovery response");
35509
- return { sessions: result4.sessions, clients: result4.clients, projects: result4.projects, roots: result4.roots ?? [], cloneRoot: result4.cloneRoot, ...result4.checkout ? { checkout: result4.checkout } : {} };
35510
+ return discovery(result4);
35511
+ });
35512
+ var connectAndDiscover = exports_Effect.fnUntraced(function* (machine, command, context3) {
35513
+ const host = yield* connectMachine(machine);
35514
+ const result4 = yield* connectedRequest(host, command, { kind: "discover", ...host.local && context3 ? { context: context3 } : {} });
35515
+ if (result4.kind !== "discover")
35516
+ return yield* fail20("Unexpected discovery response");
35517
+ return { host, ...discovery(result4) };
35510
35518
  });
35511
35519
  var inspectProject = exports_Effect.fnUntraced(function* (host, command, path) {
35512
35520
  const result4 = yield* request3(host, command, { kind: "project", path });
@@ -35618,6 +35626,13 @@ function M.setup(opts)
35618
35626
  run = function(ctx)
35619
35627
  local session_id = ctx.session_id or rex.session_id
35620
35628
  if type(session_id) ~= "string" then error("Select a Rex session first", 0) end
35629
+ if ctx.server then
35630
+ local response, call_err = rex.server(ctx.server).call("client.action", {
35631
+ action = "worktrees_open", session_id = session_id, block_id = ctx.block_id,
35632
+ })
35633
+ if not response then error(call_err, 0) end
35634
+ return response.result
35635
+ end
35621
35636
  local command = { bin, "launch-popup", "--session", session_id }
35622
35637
  local block_id = ctx.block_id or (session_id == rex.session_id and rex.block_id or nil)
35623
35638
  if type(block_id) == "string" then
@@ -38455,9 +38470,9 @@ var fit = (text, width2) => Bun.stringWidth(text) > width2 ? Bun.sliceAnsi(text,
38455
38470
  var pad = (text, width2) => text + " ".repeat(Math.max(0, width2 - Bun.stringWidth(text)));
38456
38471
  var renderFormFrame = (view, focused, editing, columns, rows2, colors2 = !process.env.NO_COLOR, fill = true) => {
38457
38472
  const width2 = Math.max(20, columns);
38458
- const inside = width2 - 4;
38473
+ const inside = width2 - 2;
38459
38474
  const screen = [];
38460
- const border = (body2) => `${color("\u2502", "muted", colors2)} ${pad(body2, inside)} ${color("\u2502", "muted", colors2)}`;
38475
+ const border = (body2) => `${color("\u2502", "muted", colors2)}${pad(body2, inside)}${color("\u2502", "muted", colors2)}`;
38461
38476
  const line = (left, right) => color(`${left}${"\u2500".repeat(width2 - 2)}${right}`, "muted", colors2);
38462
38477
  const add4 = (text) => screen.push(border(fit(text, inside)));
38463
38478
  screen.push(line("\u250C", "\u2510"));
@@ -38620,7 +38635,6 @@ var inputFor = (draft) => {
38620
38635
  return draft.destination.path ? { ...common, vcs: "jj", path: draft.destination.path } : draft.worktreeName && draft.destination.revision ? { ...common, vcs: "jj", worktreeName: draft.worktreeName, revision: draft.destination.revision } : undefined;
38621
38636
  return draft.destination.branch ? { ...common, vcs: "git", branch: draft.destination.branch, ...draft.worktreeName ? { worktreeName: draft.worktreeName } : {} } : { ...common, vcs: "git", path: draft.destination.path };
38622
38637
  };
38623
- var changeMachine = (draft, machine) => draft.machine?.key === machine.key ? { ...draft, machine } : { machine, projectChoice: draft.projectChoice, mode: draft.mode };
38624
38638
  var changeProjectChoice = (draft, projectChoice) => ({
38625
38639
  ...draft,
38626
38640
  projectChoice,
@@ -38897,61 +38911,53 @@ var popup = (command, context3, origin2 = {}, preferredMachine) => exports_Effec
38897
38911
  return yield* exports_Effect.fail(new AppError({ message: "Project directory changed; select the exact project directory again" }));
38898
38912
  return inspected.success;
38899
38913
  });
38900
- const activate2 = exports_Effect.fnUntraced(function* (machine) {
38914
+ const activate2 = exports_Effect.fnUntraced(function* (machine, showLoading = false) {
38915
+ const previous = draft;
38901
38916
  const previousHostId = draft.host?.hostId;
38902
- draft = changeMachine(draft, machine);
38917
+ draft = { machine, projectChoice: draft.projectChoice, mode: draft.mode };
38918
+ sessions = [];
38919
+ plan = undefined;
38920
+ clonePlan = undefined;
38921
+ cloneRoot = "";
38922
+ cloneRoots = [];
38923
+ error2 = undefined;
38903
38924
  const discoveredContext = machine.local ? contextPath : undefined;
38904
38925
  contextPath = undefined;
38905
- const connected = yield* exports_Effect.result(connectMachine(machine));
38926
+ if (showLoading) {
38927
+ const pending = { ...formView(true), notice: `Connecting to ${machine.label}\u2026` };
38928
+ activeView = pending;
38929
+ yield* terminal.display(`\x1B[H\x1B[2J${renderFormFrame(pending, "machine", false, yield* terminal.columns, yield* terminal.rows)}`);
38930
+ }
38931
+ const connected = yield* exports_Effect.result(connectAndDiscover(machine, command, discoveredContext));
38906
38932
  if (exports_Result.isFailure(connected)) {
38907
- draft = { machine, projectChoice: draft.projectChoice, mode: draft.mode };
38908
- sessions = [];
38909
- plan = undefined;
38910
- clonePlan = undefined;
38911
- cloneRoot = "";
38912
- cloneRoots = [];
38913
38933
  error2 = problem(connected.failure);
38914
38934
  return;
38915
38935
  }
38916
- if (previousHostId && previousHostId !== connected.success.hostId) {
38917
- draft = { machine, projectChoice: draft.projectChoice, mode: draft.mode };
38918
- sessions = [];
38919
- plan = undefined;
38920
- clonePlan = undefined;
38921
- }
38922
- draft = { ...draft, host: connected.success };
38923
- const discovered = yield* exports_Effect.result(discover(connected.success, command, discoveredContext));
38924
- if (exports_Result.isFailure(discovered)) {
38925
- draft = { machine, projectChoice: draft.projectChoice, mode: draft.mode };
38926
- sessions = [];
38927
- plan = undefined;
38928
- clonePlan = undefined;
38929
- cloneRoot = "";
38930
- cloneRoots = [];
38931
- error2 = problem(discovered.failure);
38932
- return;
38933
- }
38934
- const found = discovered.success;
38936
+ const { host, ...found } = connected.success;
38937
+ if (previous.machine?.key === machine.key && previousHostId === host.hostId)
38938
+ draft = { ...previous, machine, host };
38939
+ else
38940
+ draft = { ...draft, host };
38935
38941
  cloneRoot = found.cloneRoot;
38936
38942
  cloneRoots = found.roots;
38937
38943
  projects = [
38938
- ...projects.filter((item) => item.source?.machineKey !== machine.key || item.source.hostId !== connected.success.hostId),
38939
- ...found.projects.map((repo) => known(connected.success, repo, found.checkout))
38944
+ ...projects.filter((item) => item.source?.machineKey !== machine.key || item.source.hostId !== host.hostId),
38945
+ ...found.projects.map((repo) => known(host, repo, found.checkout))
38940
38946
  ];
38941
38947
  sessions = found.sessions;
38942
38948
  draft = {
38943
38949
  ...draft,
38944
- session: draft.session?.kind === "new" ? draft.session : sessions.some((item) => item.id === (draft.session?.kind === "existing" ? draft.session.id : undefined)) ? draft.session : connected.success.local && origin2.sessionId && sessions.some((item) => item.id === origin2.sessionId) ? { kind: "existing", id: origin2.sessionId } : sessions.length === 1 ? { kind: "existing", id: sessions[0].id } : undefined,
38950
+ session: draft.session?.kind === "new" ? draft.session : sessions.some((item) => item.id === (draft.session?.kind === "existing" ? draft.session.id : undefined)) ? draft.session : host.local && origin2.sessionId && sessions.some((item) => item.id === origin2.sessionId) ? { kind: "existing", id: origin2.sessionId } : sessions.length === 1 ? { kind: "existing", id: sessions[0].id } : undefined,
38945
38951
  clientId: focusClient(found.clients)
38946
38952
  };
38947
38953
  if (!draft.projectChoice && found.checkout && discoveredContext) {
38948
- const inspected = yield* exports_Effect.result(inspectProject(connected.success, command, found.checkout.path));
38954
+ const inspected = yield* exports_Effect.result(inspectProject(host, command, found.checkout.path));
38949
38955
  if (exports_Result.isFailure(inspected)) {
38950
38956
  error2 = problem(inspected.failure);
38951
38957
  return;
38952
38958
  }
38953
38959
  if (exports_Result.isSuccess(inspected)) {
38954
- draft = changeProjectChoice(draft, known(connected.success, inspected.success.project, inspected.success.checkout));
38960
+ draft = changeProjectChoice(draft, known(host, inspected.success.project, inspected.success.checkout));
38955
38961
  draft = changeProject(draft, inspected.success.project);
38956
38962
  if (inspected.success.checkout.vcs === "jj")
38957
38963
  draft = { ...draft, sourcePath: inspected.success.checkout.path };
@@ -38960,7 +38966,7 @@ var popup = (command, context3, origin2 = {}, preferredMachine) => exports_Effec
38960
38966
  draft = selectWorktree(draft, tree);
38961
38967
  }
38962
38968
  } else if (draft.projectChoice) {
38963
- const inspected = yield* exports_Effect.result(bindProject(draft.projectChoice, connected.success, found.projects));
38969
+ const inspected = yield* exports_Effect.result(bindProject(draft.projectChoice, host, found.projects));
38964
38970
  if (exports_Result.isFailure(inspected)) {
38965
38971
  if (!exports_Terminal.isQuitError(inspected.failure))
38966
38972
  error2 = problem(inspected.failure);
@@ -39000,7 +39006,7 @@ var popup = (command, context3, origin2 = {}, preferredMachine) => exports_Effec
39000
39006
  id: "session",
39001
39007
  label: "Session",
39002
39008
  value: draft.session?.kind === "new" ? `New: ${draft.session.name}` : sessions.find((s) => s.id === (draft.session?.kind === "existing" ? draft.session.id : undefined))?.label ?? (draft.session?.kind === "existing" ? draft.session.id : "Choose or type new session"),
39003
- detail: draft.session?.kind === "existing" ? draft.session.id : draft.session?.kind === "new" ? "Create on confirmation" : undefined,
39009
+ detail: draft.session?.kind === "existing" ? draft.session.id : draft.session?.kind === "new" ? "Create on submit" : undefined,
39004
39010
  disabled: !draft.host
39005
39011
  }
39006
39012
  ];
@@ -39027,19 +39033,20 @@ var popup = (command, context3, origin2 = {}, preferredMachine) => exports_Effec
39027
39033
  value: draft.mode === "auto" ? "Reuse matching tab, otherwise new tab" : draft.mode === "new-tab" ? "Always new tab" : "Split matching tab, otherwise new tab",
39028
39034
  disabled: !draft.host
39029
39035
  });
39030
- const safeOpen = !draft.clone && !!draft.destination?.path && draft.session?.kind === "existing";
39036
+ const awaitingConfirmation = !!(clonePlan || plan);
39031
39037
  return {
39032
39038
  rows: rows2.map((row) => ({ ...row, disabled: initializing || row.disabled })),
39033
- submitLabel: clonePlan?.label ?? plan?.label ?? (draft.clone ? "Review clone" : safeOpen ? "Open checkout" : "Review & open"),
39039
+ submitLabel: clonePlan?.label ?? plan?.label ?? (draft.clone ? "Clone & Open" : draft.destination?.path ? "Open checkout" : draft.project?.vcs === "jj" ? "Create workspace & open" : "Create checkout & open"),
39034
39040
  submitDisabled: initializing || !draft.host || !(cloneInputFor(draft) || inputFor(draft)),
39035
39041
  notice: [
39036
- clonePlan || plan ? "Review this action; submit again to launch" : draft.clone ? "Only pushed history transfers" : undefined,
39042
+ awaitingConfirmation ? "Review this action; submit again to launch" : draft.clone ? "Only pushed history transfers" : undefined,
39043
+ clonePlan?.warning,
39044
+ plan?.warning,
39037
39045
  plan ? `Destination: ${plan.path}` : undefined,
39046
+ clonePlan && clonePlan.repo !== draft.clone?.repo ? `Changed destination: ${clonePlan.repo}` : undefined,
39038
39047
  clonePlan?.detail,
39039
39048
  clonePlan?.vcs === "jj" ? `Start from: ${draft.destination?.revision ? `${draft.destination.label} (${draft.destination.revision})` : "cloned default"}` : undefined,
39040
- clonePlan?.warning,
39041
- plan?.detail,
39042
- plan?.warning
39049
+ plan?.detail
39043
39050
  ].filter(Boolean).join(" \xB7 ") || undefined,
39044
39051
  error: initializing ? undefined : error2 ?? (!draft.projectChoice ? "Select a project" : !draft.machine ? "Select a Rex machine" : !draft.host ? "Connect to the selected machine and install its worktrees helper if missing" : !(draft.project || draft.clone) ? "Select the exact project directory on this machine" : !draft.destination && draft.project?.vcs !== "jj" && draft.clone?.vcs !== "jj" ? "Select a branch" : draft.project?.vcs === "jj" && (!draft.worktreeName && !draft.destination?.path || !!draft.worktreeName && !draft.destination?.revision) ? "Choose an existing workspace or a new workspace name and starting revision" : !draft.session ? "Choose an existing Rex session or type a new name" : undefined),
39045
39052
  fitWarning: activeView?.fitWarning
@@ -39078,11 +39085,17 @@ var popup = (command, context3, origin2 = {}, preferredMachine) => exports_Effec
39078
39085
  clonePlan = undefined;
39079
39086
  continue;
39080
39087
  }
39081
- if (!clonePlan || !sameClonePlan(current2.success, clonePlan)) {
39082
- error2 = clonePlan ? "Clone destination or Rex target changed; review the updated URL and destination before submitting again" : undefined;
39088
+ if (clonePlan && (!sameClonePlan(current2.success, clonePlan) || current2.success.warning !== clonePlan.warning)) {
39089
+ error2 = `Clone destination or Rex target changed; review the updated URL and destination before submitting again. Destination: ${current2.success.repo}`;
39083
39090
  clonePlan = current2.success;
39084
39091
  continue;
39085
39092
  }
39093
+ const wasReviewed2 = !!clonePlan;
39094
+ clonePlan = current2.success;
39095
+ if (!wasReviewed2 && (clonePlan.warning || safeDisplayText(clonePlan.repo) !== clonePlan.repo || view.fitWarning || naturalFormRows(view, yield* terminal.columns) + 1 > (yield* terminal.rows))) {
39096
+ error2 = undefined;
39097
+ continue;
39098
+ }
39086
39099
  const launched2 = yield* exports_Effect.result(submitClone(draft.host, command, cloneInput, clonePlan));
39087
39100
  if (exports_Result.isFailure(launched2)) {
39088
39101
  launchAcknowledged = true;
@@ -39111,18 +39124,17 @@ var popup = (command, context3, origin2 = {}, preferredMachine) => exports_Effec
39111
39124
  plan = undefined;
39112
39125
  continue;
39113
39126
  }
39114
- if (plan && !sameLaunchPlan(current.success, plan)) {
39115
- error2 = "Destination or Rex target changed; review the updated action before submitting again";
39127
+ if (plan && (!sameLaunchPlan(current.success, plan) || current.success.warning !== plan.warning)) {
39128
+ error2 = `Destination or Rex target changed; review the updated action before submitting again. Destination: ${current.success.path}`;
39116
39129
  plan = current.success;
39117
39130
  continue;
39118
39131
  }
39119
- if (!plan) {
39120
- const safeOpen = !!draft.destination?.path && draft.session?.kind === "existing" && current.success.checkout === "existing" && current.success.path === draft.destination.path && safeDisplayText(draft.destination.path) === draft.destination.path && !current.success.detail && !current.success.warning && !view.fitWarning && naturalFormRows(view, yield* terminal.columns) + 1 <= (yield* terminal.rows);
39121
- plan = current.success;
39122
- if (!safeOpen) {
39123
- error2 = undefined;
39124
- continue;
39125
- }
39132
+ const wasReviewed = !!plan;
39133
+ const changedPath = !wasReviewed && !!input.path && current.success.path !== input.path;
39134
+ plan = current.success;
39135
+ if (!wasReviewed && (changedPath || plan.warning || safeDisplayText(plan.path) !== plan.path || view.fitWarning || naturalFormRows(view, yield* terminal.columns) + 1 > (yield* terminal.rows))) {
39136
+ error2 = changedPath ? `Destination or Rex target changed; review the updated action before submitting again. Destination: ${plan.path}` : undefined;
39137
+ continue;
39126
39138
  }
39127
39139
  const launched = yield* exports_Effect.result(submit(draft.host, command, input, plan));
39128
39140
  if (exports_Result.isFailure(launched)) {
@@ -39153,7 +39165,7 @@ var popup = (command, context3, origin2 = {}, preferredMachine) => exports_Effec
39153
39165
  if (!machines.length)
39154
39166
  return yield* exports_Effect.fail(new AppError({ message: error2 ?? "No Rex machines available" }));
39155
39167
  const machine = yield* choose("Execution machine", machines.map((item) => selected(item, item.key === draft.machine?.key, item.label, item.local ? "This machine" : `Rex host \xB7 ${item.selector}`)));
39156
- yield* activate2(machine);
39168
+ yield* activate2(machine, true);
39157
39169
  } else if (action === "project") {
39158
39170
  const choices = projects.map((item) => ({
39159
39171
  value: item,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rex-worktrees",
3
- "version": "0.3.1",
3
+ "version": "0.3.3",
4
4
  "description": "Git worktrees and Jujutsu workspaces for Rex",
5
5
  "license": "MIT",
6
6
  "author": "Samuel Ho",