mirror of
https://github.com/getpaseo/paseo.git
synced 2026-11-03 23:23:21 +00:00
fix(plugins): New workspace commands work from mount effects, and branch and base ref match what creation uses
A command called from a New workspace item's mount effect rejected because the setup model only received its inputs and the pickers' handlers from a passive effect on the screen, which runs after a child's. The model now takes its inputs at construction, picks the base and isolation itself, and is refreshed in a layout effect; the screen supplies the side effects of a pick (the PR attachment, the remembered isolation) as listeners. The branch a plugin sets was dropped when no base was resolved, such as on a detached HEAD, because it was sent only for an explicit branch-off. It now applies whenever the worktree cuts a new branch, decided in one place that mirrors the daemon. baseRef.name was the display-shortened branch name, so setting back what was read based the worktree on the local branch instead of the origin one. It is now the exact ref creation uses, and host and baseRef are frozen like project and metadata.
This commit is contained in:
@@ -12,22 +12,31 @@ export interface PluginNewWorkspace {
|
||||
readonly project: { readonly id: string; readonly name: string } | null;
|
||||
/** What the screen will create. A project that cannot make worktrees reads `"local"`. */
|
||||
readonly isolation: "local" | "worktree";
|
||||
/** What a new worktree starts from; `null` until the project's default is known. */
|
||||
/**
|
||||
* What a new worktree starts from; `null` until the project's default is known. A branch's
|
||||
* `name` is the exact ref creation uses, such as `refs/remotes/origin/main`, so
|
||||
* `setBaseRef(newWorkspace.baseRef)` changes nothing.
|
||||
*/
|
||||
readonly baseRef:
|
||||
| { readonly type: "branch"; readonly name: string }
|
||||
| { readonly type: "change-request"; readonly number: number }
|
||||
| null;
|
||||
/**
|
||||
* The name of the branch a new worktree is created on; `null` lets Paseo pick one. It is kept
|
||||
* while isolation is local or the base is a change request, and applies only to a worktree
|
||||
* created from a branch.
|
||||
* while isolation is local or the base is a change request. It names the new branch of any
|
||||
* worktree that cuts one, from the default base or a chosen branch, and does not apply to a
|
||||
* worktree that checks out an existing branch or change request.
|
||||
*/
|
||||
readonly branch: string | null;
|
||||
/** The workspace's metadata, not the first agent's. */
|
||||
readonly metadata: Readonly<Record<string, JsonValue>>;
|
||||
/** Rejects `"worktree"` for a project that cannot make worktrees. */
|
||||
setIsolation(isolation: "local" | "worktree"): Promise<void>;
|
||||
/** Starts the workspace from a branch. Rejects while no project is chosen. */
|
||||
/**
|
||||
* Starts the workspace from a branch. `name` is any ref the Base picker offers, such as
|
||||
* `refs/remotes/origin/main`, or a bare branch name, which Paseo resolves the way it does for
|
||||
* a branch name it is given anywhere else. Rejects while no project is chosen.
|
||||
*/
|
||||
setBaseRef(ref: { type: "branch"; name: string }): Promise<void>;
|
||||
setBranch(name: string | null): Promise<void>;
|
||||
/** Top-level keys replace; `null` removes the key. Rejects on a host without metadata support. */
|
||||
|
||||
Reference in New Issue
Block a user