rex-worktrees 0.2.0 → 0.3.1

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
@@ -62,16 +62,17 @@ rex.bind("ctrl+alt+w", "worktrees_open")
62
62
 
63
63
  For a manual Lua installation, supply an absolute executable path with `require("rex-worktrees").setup({ bin = "/absolute/path/to/rex-worktrees" })`.
64
64
 
65
- The chooser has six fields (five when opening an existing JJ workspace):
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
- - **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.
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.
69
- - **Worktree / Workspace:** Git shows worktrees; JJ shows all registered workspaces, including unavailable entries with an unknown/missing location (visible but not openable). Select an available checkout, type a name for a new checkout/workspace, or choose **Clone this project…** for a known logical project. A clone destination must be an editable absolute path on the destination machine; configured project roots offer suggestions. When cloning, typing a name here optionally creates a separate checkout/workspace; type `none` to use the clone's default.
70
- - **Branch / Start from:** Git branches retain their existing behavior: attach an unoccupied branch or create a new branch from the reviewed base. For a new JJ workspace, **Start from** selects the repository-configured `trunk()` mainline when it resolves to one valid commit. If no valid mainline is available, choose a source candidate or type a singular revision before creating the workspace. A bookmark or revision selection overrides the default; the action pins its full commit ID. This field is hidden when opening a selected existing JJ workspace, which opens unchanged. A JJ clone can use the clone's native default without a pin, or select/type a source revision resolved on the actual source machine before cloning. Bookmarks are optional; this tool never creates one automatically. Source-only unpublished JJ changes and unpushed Git branches are not available in a destination clone.
71
- - **Session:** choose an exact session on the selected machine.
72
- - **Mode:** reuse a matching live tab, open another tab, or split a matching task. If a split has no matching task, it opens a new tab. Cloning always starts a new tab.
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.
73
72
 
74
- Use arrows or `j`/`k` to move, Tab/Shift+Tab to change fields, and Enter to edit or submit. In an editor, type to filter or create, use arrows for existing options, and Ctrl+U to clear. In the popup, Ctrl+S commits a valid selection or typed edit and submits the reviewed action when available; an invalid edit does not submit, and plain Enter still only selects. Esc cancels an edit or, from the form, closes the chooser. Project and checkout paths appear in the selection lists rather than as extra lines on the main form. Review the checkout path and action before submitting. A clone proposal displays its validated source URL and exact destination, and requires **Clone & Open** consent; merely changing machines never starts cloning. No agent or model is required; the task opens a shell.
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
+
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
76
 
76
77
  ## Projects and checkout locations
77
78
 
@@ -91,9 +92,9 @@ Configuration is optional and belongs on the **execution machine** at `${XDG_CON
91
92
  }
92
93
  ```
93
94
 
94
- `projects` explicitly registers paths; optional `roots` scans two directory levels for projects and offers destination-path suggestions when cloning. Without either, the originating Rex pane's directory (or the CLI caller's directory) can suggest its Git or JJ project, but no parent directory is scanned. A local directory suggestion is not sent to another machine: enter or select the project directory on that destination. A path typed in the form is interpreted there. Git and JJ, not configuration, determine their existing checkouts and branches/revisions. A missing directory for a known source project with a validated origin can be proposed for Clone & Open; an existing valid directory continues through ordinary open.
95
+ `projects` explicitly registers paths; optional `roots` scans two directory levels for projects. Without either, the originating Rex pane's directory (or the CLI caller's directory) can suggest its Git or JJ project, but no parent directory is scanned. A local directory suggestion is not sent to another machine: paths typed in the form are interpreted on the selected destination. For a known project missing there, the proposed clone directory uses that machine's first configured root, otherwise the parent of its last successful clone, otherwise the one common parent of discovered projects, otherwise its home directory. This default never scans the home directory and can be changed in **Clone to**. A successful clone remembers its destination parent; editing or reviewing one does not. Git and JJ, not configuration, determine their existing checkouts and branches/revisions. Existing valid directories continue through ordinary open.
95
96
 
96
- For a popup launched from a Rex pane on this machine, the chooser checks that exact pane's reported directory (a local OSC 7 `file://` URI or absolute path). If Rex has not reported one, it uses the same pane's foreground process `cwd` when available. A remote pane or foreign URI is never treated as a local path. Context can legitimately be absent if the pane has no usable local directory, or the directory is not inside a Git or JJ repository; select or enter a project in that case. `--no-context` explicitly disables origin discovery.
97
+ For a popup launched from a Rex pane on this machine, the chooser checks that exact pane's reported directory (a local OSC 7 `file://` URI or absolute path). If that directory is absent or its URI is not trusted as local, it uses the same verified pane's foreground process `cwd` when available. A remote pane or foreign URI is never treated as a local path. Context can legitimately be absent if the pane has no usable local directory, or the directory is not inside a Git or JJ repository; select or enter a project in that case. `--no-context` explicitly disables origin discovery.
97
98
 
98
99
  New checkout location follows this order: a project's `worktreeRoot/<name>`, the global `worktreeRoot/<primary-project-name>/<name>`, or, by default, a sibling `<main-checkout>.worktrees/<name>`. `~` refers to the destination user's home; relative configuration paths resolve against the config file's directory. Checkout locations must be outside existing checkouts and version-control metadata. Collisions and escaping paths are rejected rather than renamed. JJ's own `git.colocate` setting governs whether its workspace also has Git metadata; the helper does not emulate colocation.
99
100
 
@@ -117,7 +118,7 @@ rex-worktrees open --repo /absolute/path/jj-workspace \
117
118
  --session session:FULL-ID --name Task
118
119
  ```
119
120
 
120
- `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`. Remote `--repo` and `--worktree` paths must be absolute paths on the destination.
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.
121
122
 
122
123
  `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.
123
124
 
@@ -125,6 +126,8 @@ rex-worktrees open --repo /absolute/path/jj-workspace \
125
126
 
126
127
  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.
127
128
 
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.
130
+
128
131
  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.
129
132
 
130
133
  ## Contributing
@@ -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: 5220c32f018d4e838d037d7c364c1cee719591a2b66f42befb8ca827de4388d8
4
+ sha256: 235ebfe826805f6c2bc6bce787c14f1dbed9d38d1d05c7d9e9401319719705fe