Add headless open <name> subcommand#47
Merged
Merged
Conversation
Open a project's workspace by name without the interactive fuzzy picker. runOpen reuses the picker's openProject, so a template's layout has a single source of truth whether it's opened via the browser or by name. - main.go: register the `open` subcommand - open.go: runOpen + findProject (exact match, case-insensitive fallback, helpful "available projects" error). A direct invocation has no HERDR_PLUGIN_CONFIG_DIR injected, so ensureManagedConfigDir asks the running herdr (`herdr plugin config-dir <id>`) for its managed config dir and exports it — finding the very same templates the picker shows. - util.go: shared pluginID constant, also swapped into the existing --plugin call sites in projects.go and quickactions.go. - open_test.go: cover findProject and the config-dir discovery helpers (a fake herdr via HERDR_BIN_PATH keeps them deterministic offline). - README: document `herdr-plus open <name>`.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds a headless
open <name>subcommand so a project's workspace can be opened by name, without the interactive fuzzy picker:This is the scriptable entry point the picker never gave us — for shell aliases, keybindings, and AI agents that want to spin up a known workspace in one shot.
How
main.go— registers theopensubcommand.open.go—runOpenloads the project templates, resolves the name viafindProject(exact match first, then a case-insensitive fallback; a miss errors with the list of available projects), and hands the project to the existingopenProject— the exact code path the picker runs on Enter. So the template → workspace layout has a single source of truth regardless of how it's opened.HERDR_PLUGIN_CONFIG_DIR, but a directherdr-plus open ...from a shell has no such injection, so config would look in the standalone~/.config/herdr-plusand miss the managed templates.ensureManagedConfigDirasks the running herdr (herdr plugin config-dir <id>) for its managed dir and exports it — doing exactly what herdr would have done — soopenfinds the same templates the picker shows.configBaseDiris intentionally left untouched (the picker path already short-circuits on the injected env var).util.go— a sharedpluginIDconstant, also swapped into the existing--plugincall sites inprojects.go/quickactions.go.Testing
open_test.gocoversfindProject(all resolution paths) and the config-dir discovery helpers, using a fakeherdrlocated viaHERDR_BIN_PATHso the tests stay deterministic with no real herdr present.go build ./...,go vet ./..., andgo test -race ./...all pass locally.open dotfilesthat materialized the full 4-tab workspace.Notes
openis a direct-invocation subcommand, not a manifest action (actions take fixed commands, so they can't accept a runtime<name>).