Skip to content

feat(jump): implement the jump flow - #40

Merged
hammadmajid merged 2 commits into
mainfrom
feat/jump
Sep 16, 2026
Merged

hammadmajid merged 2 commits into
mainfrom
feat/jump

Conversation

@hammadmajid

Copy link
Copy Markdown
Contributor

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, mirroring picker.Run's signature, so tests inject a fake Picker; production passes picker.Run with a git.GetStatus-backed StatusFunc.
  • ErrCancelled, the sentinel returned when the Picker is cancelled.

Flow: discover Projects, read History's latest Visits, take the exact-match shortcut when query equals exactly one Project's Name or Rel(), otherwise run the Picker with the query prefilled, confirm the chosen directory still exists, Record the Visit (a failure warns on stderr but still returns the path), and return the absolute path.

Why

internal/jump is the seam between Project discovery, History, and the Picker: the CLI's pick command (ticket #21, blocked on this one) calls Resolve directly.

Tests

Table-driven, package jump_test for Resolve, package jump for the pure order helper:

  • ordering: visited-first newest-first, ties alphabetical, never-visited alphabetical, Stale Visits contribute no row
  • exact Name shortcut skips the Picker
  • exact kind/name shortcut skips the Picker
  • an ambiguous Name (matching two Kinds) opens the Picker prefilled
  • no match opens the Picker prefilled
  • cancel returns ErrCancelled
  • a vanished chosen directory errors
  • a failing History write still returns the path

Closes #27

🤖 Generated with Claude Code

hammadmajid and others added 2 commits September 17, 2026 01:05
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>
@hammadmajid
hammadmajid merged commit 0582bfb into main Sep 16, 2026
2 of 3 checks passed
@hammadmajid
hammadmajid deleted the feat/jump branch September 16, 2026 20:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Implement the jump flow

1 participant