feat: option to open a workspace in the launch directory - #2563
Conversation
|
Hi @iacore, thanks for your interest in contributing. Herdr does not accept unsolicited implementation pull requests from contributors who are not listed in The pull request author is not an approved contributor. If you encountered a reproducible bug, report the observed behavior through the bug issue template. A report does not reserve the work or authorize a pull request; accepted fixes are normally implemented by Herdr’s maintainer-controlled agents. Feature requests, behavior changes, and other proposals belong in GitHub Discussions. Do not open an issue merely to justify an implementation that was already written. If a maintainer explicitly wants this implementation, they can reopen the pull request. Reopening by anyone else will be closed again automatically. See https://github.com/herdrdev/herdr/blob/master/CONTRIBUTING.md for the contribution policy. |
|
Important Review skippedAuto reviews are limited based on label configuration. 🏷️ Required labels (at least one) (1)
Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Comment |
Adds
[session] open_workspace_in_launch_directory(defaultfalse).When enabled, running
herdrfrom a directory focuses the workspace forthat directory, or opens a new workspace there when the restored session
has none — instead of always restoring the previous layout. This makes
"open a terminal in the project I'm in" work for a long-running
persistent session.
Implementation summary:
Hellohandshake(
launch_cwd). Direct terminal attaches and remote attaches sendNone— the local launch directory is meaningless on a remote server.ClientConnected, the server runsensure_workspace_for_launch_cwd:canonicalized match against each workspace's resolved identity cwd →
focus it; otherwise create a workspace there (one tab, one shell pane)
and focus it. Gated on the config flag.
HERDR_STARTUP_CWDdaemon-seed hack is removed. It only seeded astartup workspace when the restored session was empty, and only when a
fresh server was spawned. The handshake cwd covers the daemon-spawn path
too, including non-empty restored sessions.
Tests:
open_workspace_in_launch_directory_defaults_off_and_parsesclient_attach_with_launch_cwd_creates_workspace_thereclient_attach_with_matching_launch_cwd_focuses_existing_workspaceclient_attach_with_launch_cwd_skipped_when_config_offclient_attach_without_launch_cwd_does_not_create_workspaceDocs updated under
docs/next/(config reference + session-state).Not covered: an option to always open a new pane even when the workspace
exists; the current behavior focuses the existing workspace to avoid
accumulating panes per attach. Happy to adjust based on maintainer input.
Refs: #2508 (reply in thread)