Skip to content

feat(run): ask for the current note before a choice that uses it - #21

Merged
chhoumann merged 5 commits into
mainfrom
current-note
Oct 7, 2026
Merged

chhoumann merged 5 commits into
mainfrom
current-note

Conversation

@chhoumann

Copy link
Copy Markdown
Owner

Why

QuickAdd takes the current note from Obsidian's active tab. A run started from Raycast therefore used whatever tab was open, and "append link" wrote links into random notes (#20). The extension now asks for the note and passes it with current=, so QuickAdd never reads the active tab for that run.

What changed

  • A choice whose currentNote is optional or required shows a searchable note picker before Run and before a Quicklink run. An optional choice lists No current note first. The run gets current=<path> or current=none.
  • Quick Capture, Capture Selection, and Capture Clipboard refuse a required choice with a message that points to Run QuickAdd Choice. They run an optional one with current=none.
  • The list, Quicklinks, and capture commands use the choice list that ensureVaultReady already fetches. The cached list is gone, so the decision never comes from a stale currentNote.

Scope

  • Run in Obsidian passes no current=, because there the active tab is the user's choice.
  • Needs the QuickAdd release with current= (chhoumann/quickadd feat/cli-current-note). The docs say 2.33, the next minor after the 2.32.0 release branch. Older QuickAdd sends no currentNote, so nothing changes for it.

Verification

  • npm run e2e:protocol against the plugin branch build: all 19 cases pass. New cases cover current=<path>, current=none, the currentNote labels, and a decoy note that stays open in the active tab and is never written.
  • Live in Raycast with the dev build: the required capture showed the picker, and picking Output/Current.md wrote - current: from raycast into it, from a Quicklink and from the list. The optional capture listed No current note first, and choosing it wrote - linked: no note with no link.
  • npm run lint, npm test (87 passed), npx tsc --noEmit, npm run build pass.

QuickAdd takes the current note from Obsidian's active tab, so a run
started from Raycast used whatever tab was open. A choice whose
currentNote is optional or required now shows a note picker first and
the run gets current=<path> or current=none. Quicklinks ask the same
way. The capture commands refuse a required choice and run an optional
one with current=none.

The choice list, Quicklinks, and the capture commands now use the list
that ensureVaultReady already fetched, so they decide from a fresh
currentNote instead of a cached list.
Two fixtures: a capture to the current note, and a capture with an
optional append link and {{LINKCURRENT}}. The script runs them with
current=<path> and current=none while another note is the open tab.
The note pick happens after the vault-open relaunch, so carrying a pick through
the deeplink context had no caller.
A choice that does not ask for a note still ran with QuickAdd's active tab as
its current note, so a selection there could fill {{VALUE}} silently. Every
run now sends the pick or none; a QuickAdd without currentNote gets nothing.
@chhoumann
chhoumann merged commit 8c7938b into main Oct 7, 2026
1 check passed
@chhoumann
chhoumann deleted the current-note branch October 7, 2026 09:29
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.

1 participant