rex-worktrees 0.3.2 → 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 +7 -5
- package/dist/rex-worktrees +1 -1
- package/dist/rex-worktrees.js +33 -20
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -67,12 +67,14 @@ The chooser is one flat form: **Project**, **Machine**, **Checkout** (or **Works
|
|
|
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
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
|
|
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;
|
|
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.
|
|
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
|
|
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
|
|
package/dist/rex-worktrees
CHANGED
package/dist/rex-worktrees.js
CHANGED
|
@@ -35626,6 +35626,13 @@ function M.setup(opts)
|
|
|
35626
35626
|
run = function(ctx)
|
|
35627
35627
|
local session_id = ctx.session_id or rex.session_id
|
|
35628
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
|
|
35629
35636
|
local command = { bin, "launch-popup", "--session", session_id }
|
|
35630
35637
|
local block_id = ctx.block_id or (session_id == rex.session_id and rex.block_id or nil)
|
|
35631
35638
|
if type(block_id) == "string" then
|
|
@@ -38463,9 +38470,9 @@ var fit = (text, width2) => Bun.stringWidth(text) > width2 ? Bun.sliceAnsi(text,
|
|
|
38463
38470
|
var pad = (text, width2) => text + " ".repeat(Math.max(0, width2 - Bun.stringWidth(text)));
|
|
38464
38471
|
var renderFormFrame = (view, focused, editing, columns, rows2, colors2 = !process.env.NO_COLOR, fill = true) => {
|
|
38465
38472
|
const width2 = Math.max(20, columns);
|
|
38466
|
-
const inside = width2 -
|
|
38473
|
+
const inside = width2 - 2;
|
|
38467
38474
|
const screen = [];
|
|
38468
|
-
const border = (body2) => `${color("\u2502", "muted", colors2)}
|
|
38475
|
+
const border = (body2) => `${color("\u2502", "muted", colors2)}${pad(body2, inside)}${color("\u2502", "muted", colors2)}`;
|
|
38469
38476
|
const line = (left, right) => color(`${left}${"\u2500".repeat(width2 - 2)}${right}`, "muted", colors2);
|
|
38470
38477
|
const add4 = (text) => screen.push(border(fit(text, inside)));
|
|
38471
38478
|
screen.push(line("\u250C", "\u2510"));
|
|
@@ -38999,7 +39006,7 @@ var popup = (command, context3, origin2 = {}, preferredMachine) => exports_Effec
|
|
|
38999
39006
|
id: "session",
|
|
39000
39007
|
label: "Session",
|
|
39001
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"),
|
|
39002
|
-
detail: draft.session?.kind === "existing" ? draft.session.id : draft.session?.kind === "new" ? "Create on
|
|
39009
|
+
detail: draft.session?.kind === "existing" ? draft.session.id : draft.session?.kind === "new" ? "Create on submit" : undefined,
|
|
39003
39010
|
disabled: !draft.host
|
|
39004
39011
|
}
|
|
39005
39012
|
];
|
|
@@ -39026,19 +39033,20 @@ var popup = (command, context3, origin2 = {}, preferredMachine) => exports_Effec
|
|
|
39026
39033
|
value: draft.mode === "auto" ? "Reuse matching tab, otherwise new tab" : draft.mode === "new-tab" ? "Always new tab" : "Split matching tab, otherwise new tab",
|
|
39027
39034
|
disabled: !draft.host
|
|
39028
39035
|
});
|
|
39029
|
-
const
|
|
39036
|
+
const awaitingConfirmation = !!(clonePlan || plan);
|
|
39030
39037
|
return {
|
|
39031
39038
|
rows: rows2.map((row) => ({ ...row, disabled: initializing || row.disabled })),
|
|
39032
|
-
submitLabel: clonePlan?.label ?? plan?.label ?? (draft.clone ? "
|
|
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"),
|
|
39033
39040
|
submitDisabled: initializing || !draft.host || !(cloneInputFor(draft) || inputFor(draft)),
|
|
39034
39041
|
notice: [
|
|
39035
|
-
|
|
39042
|
+
awaitingConfirmation ? "Review this action; submit again to launch" : draft.clone ? "Only pushed history transfers" : undefined,
|
|
39043
|
+
clonePlan?.warning,
|
|
39044
|
+
plan?.warning,
|
|
39036
39045
|
plan ? `Destination: ${plan.path}` : undefined,
|
|
39046
|
+
clonePlan && clonePlan.repo !== draft.clone?.repo ? `Changed destination: ${clonePlan.repo}` : undefined,
|
|
39037
39047
|
clonePlan?.detail,
|
|
39038
39048
|
clonePlan?.vcs === "jj" ? `Start from: ${draft.destination?.revision ? `${draft.destination.label} (${draft.destination.revision})` : "cloned default"}` : undefined,
|
|
39039
|
-
|
|
39040
|
-
plan?.detail,
|
|
39041
|
-
plan?.warning
|
|
39049
|
+
plan?.detail
|
|
39042
39050
|
].filter(Boolean).join(" \xB7 ") || undefined,
|
|
39043
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),
|
|
39044
39052
|
fitWarning: activeView?.fitWarning
|
|
@@ -39077,11 +39085,17 @@ var popup = (command, context3, origin2 = {}, preferredMachine) => exports_Effec
|
|
|
39077
39085
|
clonePlan = undefined;
|
|
39078
39086
|
continue;
|
|
39079
39087
|
}
|
|
39080
|
-
if (
|
|
39081
|
-
error2 =
|
|
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}`;
|
|
39082
39090
|
clonePlan = current2.success;
|
|
39083
39091
|
continue;
|
|
39084
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
|
+
}
|
|
39085
39099
|
const launched2 = yield* exports_Effect.result(submitClone(draft.host, command, cloneInput, clonePlan));
|
|
39086
39100
|
if (exports_Result.isFailure(launched2)) {
|
|
39087
39101
|
launchAcknowledged = true;
|
|
@@ -39110,18 +39124,17 @@ var popup = (command, context3, origin2 = {}, preferredMachine) => exports_Effec
|
|
|
39110
39124
|
plan = undefined;
|
|
39111
39125
|
continue;
|
|
39112
39126
|
}
|
|
39113
|
-
if (plan && !sameLaunchPlan(current.success, plan)) {
|
|
39114
|
-
error2 =
|
|
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}`;
|
|
39115
39129
|
plan = current.success;
|
|
39116
39130
|
continue;
|
|
39117
39131
|
}
|
|
39118
|
-
|
|
39119
|
-
|
|
39120
|
-
|
|
39121
|
-
|
|
39122
|
-
|
|
39123
|
-
|
|
39124
|
-
}
|
|
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;
|
|
39125
39138
|
}
|
|
39126
39139
|
const launched = yield* exports_Effect.result(submit(draft.host, command, input, plan));
|
|
39127
39140
|
if (exports_Result.isFailure(launched)) {
|