feat: support opening notes by title in bear-open-note#84
Conversation
Add title parameter as an alternative to id for direct note lookup. Case-insensitive matching with disambiguation when multiple notes share the same title. Created with Claude Code under the supervision of Serhii Vasylenko
- Return soft error via createToolResponse() instead of throwing when neither id nor title is provided (Pattern B consistency) - Use COLLATE NOCASE instead of LOWER() for idiomatic SQLite case folding - Improve not-found message to mention partial text match via bear-search-notes - Add missing test cases: no-args validation and open-by-ID regression Created with Claude Code under the supervision of Serhii Vasylenko
Ensure note ID is extracted successfully before proceeding to the actual test step, consistent with the regression test case that already had this guard. Created with Claude Code under the supervision of Serhii Vasylenko
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
There was a problem hiding this comment.
Pull request overview
Adds direct title-based lookup to the existing bear-open-note tool so callers can open a note in one step without first running bear-search-notes, including a disambiguation response when multiple notes share a title.
Changes:
- Extend
bear-open-noteto accepttitle(case-insensitive exact match) as an alternative toid, with not-found and multiple-match handling. - Add
findNotesByTitle()database helper and a lightweightNoteTitleMatchtype for disambiguation. - Add system tests covering open-by-title behavior, case-insensitive matching, disambiguation, and regression for open-by-id.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
| tests/system/open-note-by-title.test.ts | Adds end-to-end system coverage for opening notes by title and related edge cases. |
| src/types.ts | Introduces NoteTitleMatch for lightweight title lookup/disambiguation results. |
| src/notes.ts | Adds findNotesByTitle() SQL query helper for case-insensitive exact title matches. |
| src/main.ts | Updates bear-open-note schema/handler to support title lookups and disambiguation responses. |
You can also share your feedback on Copilot code review. Take the survey.
Replace toLocaleDateString() with the ISO modification_date string for deterministic, locale-independent output. Add assertion that disambiguation response includes modification date metadata. Created with Claude Code under the supervision of Serhii Vasylenko
Regression guard for the ZTRASHED/ZARCHIVED/ZENCRYPTED filters in findNotesByTitle — this filter class has regressed before (bf5fe71). Created with Claude Code under the supervision of Serhii Vasylenko
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 4 out of 4 changed files in this pull request and generated no new comments.
You can also share your feedback on Copilot code review. Take the survey.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
You can also share your feedback on Copilot code review. Take the survey.
Replace length check with Set-based uniqueness assertion to catch the case where awaitNoteCreation returns the same ID twice. Created with Claude Code under the supervision of Serhii Vasylenko
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
You can also share your feedback on Copilot code review. Take the survey.
Created with Claude Code under the supervision of Serhii Vasylenko
Resolve import conflict in src/notes.ts — both branches added to the same import line (AttachedFile from #87, NoteTitleMatch from this feature). Created with Claude Code under the supervision of Serhii Vasylenko
Every callTool() usage was passing the raw ToolResponse object to helpers (tryExtractNoteId, extractNoteBody) and assertions that expect strings. All other test files unwrap via .content[0].text. The mismatch went undetected because tsconfig.json excludes test files from type-checking. Created with Claude Code under the supervision of Serhii Vasylenko
The instructions told LLMs to always search first, contradicting the new bear-open-note title parameter that eliminates that step. Created with Claude Code under the supervision of Serhii Vasylenko
Change 'Search error:' to 'Database error:' for input validation, matching getNoteContent() and the function's own catch block. Created with Claude Code under the supervision of Serhii Vasylenko
awaitNoteCreation polls by title and returns the most recent match, so creating two notes with the same title returns the same ID twice. Instead, verify the disambiguation response directly and extract IDs from its output for both assertions and cleanup. Created with Claude Code under the supervision of Serhii Vasylenko
The open-note-by-title entry was placed under the already-released 2.8.0 section. Moved to [Unreleased] and updated the issue link to the current repo URL. Created with Claude Code under the supervision of Serhii Vasylenko
The working tree version was not re-staged after the reproduction test that temporarily checked out the old version. Created with Claude Code under the supervision of Serhii Vasylenko
Summary
bear-open-notenow accepts an optionaltitleparameter as an alternative toid, enabling users to open a note by its title in a single tool call without searching firstcreateToolResponse()to avoid breaking agent flowsWhy
Users frequently know the exact title of the note they want to open but currently must call
bear-search-notesfirst to resolve the ID, then callbear-open-notewith that ID. Accepting a title directly eliminates this two-step friction.--
Closes #60