Skip to content

Add quick switcher (jot switch/open) with fuzzy search and editor launch#15

Open
Intina47 wants to merge 1 commit into
mainfrom
mamba/implement-terminal-based-quick-switcher
Open

Add quick switcher (jot switch/open) with fuzzy search and editor launch#15
Intina47 wants to merge 1 commit into
mainfrom
mamba/implement-terminal-based-quick-switcher

Conversation

@Intina47
Copy link
Copy Markdown
Owner

Motivation

  • Provide a keyboard-first quick switcher to speed navigation between notes using fuzzy search and tags.
  • Allow selecting a note to open it directly in the user-configured editor with line navigation where supported.

Description

  • Add switch and open CLI subcommands and wire them into main so jot switch (alias jot open) invokes a minimal TUI flow implemented in jotSwitch.
  • Implement note parsing (parseNote, extractTags, loadNotes) and a relevance-ranked fuzzy matcher (searchNotes, matchScore, fuzzyScore) that considers partial title matches and tags.
  • Add editor resolution and launch helpers (resolveEditor, editorCommand, openInEditor, supportsLineArg) to open the journal file at the selected note line, honoring JOT_EDITOR, EDITOR, or VISUAL.
  • Document the quick switcher in README.md and remove an accidental packaged artifact from the repo.
  • Add unit tests (TestSearchNotesRanksPartialMatches, TestJotSwitchSearchAndOpen) to validate ranking and the open flow using a scripted editor.

Testing

  • Ran go test ./... and the test suite passed (ok jot 0.020s).
  • Added tests cover partial-match ranking via searchNotes and the interactive open flow via jotSwitch, both executed as part of the test run.

Codex Task

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 0d87c19c65

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread main.go
Comment on lines +468 to +474
func editorCommand(editor string, path string, line int) (*exec.Cmd, error) {
fields := strings.Fields(editor)
if len(fields) == 0 {
return nil, errors.New("editor command is empty")
}
cmdName := fields[0]
args := append([]string{}, fields[1:]...)
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Handle editor paths that include spaces or quotes

The editor command is split with strings.Fields, which discards quoting and splits on whitespace. If a user sets JOT_EDITOR/EDITOR to a path with spaces (e.g., C:\Program Files\...\notepad++.exe on Windows or a quoted macOS app path), fields[0] becomes a truncated path and exec.Command fails with “file not found,” so jot switch cannot open notes. This is a regression introduced with the new editor launcher and will affect users whose editors live in space-containing paths unless the parsing honors quotes or uses a different mechanism.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant