feat(jump): implement the jump flow - #40
Merged
Merged
Conversation
order is a pure function: Projects with a Visit come first (newest first, ties alphabetical by Rel), never-visited Projects follow alphabetically, and a Stale Visit contributes no row. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Resolve discovers Projects, reads History's latest Visits, takes the exact-match shortcut on a Project's Name or Rel, otherwise runs the Picker (via the injectable PickFunc) with the query prefilled, confirms the chosen directory still exists, Records the Visit (warning to stderr on failure, still returning the path), and returns the absolute path. Cancel is the ErrCancelled sentinel. Tests cover the exact Name and Kind/Name shortcuts, an ambiguous name opening the Picker prefilled, no match opening the Picker, cancel, a vanished chosen directory, and a failing History write still returning the path. Closes #27 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Closed
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
Implements
internal/jump, per the package layout decision (#13) and the command surface (#11):Resolve(ctx, cfg config.Config, hist *history.History, query string, pick PickFunc) (string, error)— the pick flow entry point.order(projects, latest, root) []picker.Row— the pure ordering rule: Projects with a Visit newest first (ties alphabetical by Rel), never-visited Projects after (alphabetical), a Stale Visit contributing no row.PickFunc, mirroringpicker.Run's signature, so tests inject a fake Picker; production passespicker.Runwith agit.GetStatus-backedStatusFunc.ErrCancelled, the sentinel returned when the Picker is cancelled.Flow: discover Projects, read History's latest Visits, take the exact-match shortcut when
queryequals exactly one Project's Name orRel(), otherwise run the Picker with the query prefilled, confirm the chosen directory still exists,Recordthe Visit (a failure warns on stderr but still returns the path), and return the absolute path.Why
internal/jumpis the seam between Project discovery, History, and the Picker: the CLI'spickcommand (ticket #21, blocked on this one) callsResolvedirectly.Tests
Table-driven,
package jump_testforResolve,package jumpfor the pureorderhelper:kind/nameshortcut skips the PickerErrCancelledCloses #27
🤖 Generated with Claude Code