Repository navigation
feat(notes): accept a problem name as well as a problem ID - #50
Merged
night-slayer18 merged 3 commits intoSep 10, 2026
Merged
Conversation
The note command only accepted a numeric problem ID, while pick, show and hint already take either an ID or a title slug. Notes now do the same: a title slug is resolved through the LeetCode API and its frontend ID names the note file, so both forms point at the same file on disk. The resolved problem is passed to the note template generator, so creating a note by name still costs a single API call. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01T4JwzivBEbeq9u3zAXKUu2 Signed-off-by: acid-boi <yjbmki@gmail.com>
Adds coverage for name lookup, template reuse of the already fetched problem, rejected input, unknown names and unexpected lookup failures. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01T4JwzivBEbeq9u3zAXKUu2 Signed-off-by: acid-boi <yjbmki@gmail.com>
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01T4JwzivBEbeq9u3zAXKUu2 Signed-off-by: acid-boi <yjbmki@gmail.com>
Owner
|
hey @acid-boi, nice one! slug resolver is looking clean. good catch on reusing the fetched problem for the template too, saves the extra API call. error messages are way cleaner now and the tests cover the important stuff. merged 👍 |
Owner
|
also saw your note about the shared resolver — yeah that's worth doing. if you're up for it, raise a PR that pulls that ID-or-slug resolution logic into a shared utility and wires up |
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.
Summary
leetcode notenow accepts a problem name (title slug) in addition to a numeric problem ID, soleetcode note two-sum editworks the same wayleetcode note 1 editalways has.Problem "..." not foundinstead of dumping the raw Zod validation error, while genuine network failures still surface their message.Motivation / Context
pick,show,hint,reset,submissionsandtimerall accept either a problem ID or a title slug.notewas the odd one out and rejected anything non-numeric, which meant switching mental models mid-session: pick a problem by name, then look up its number to write a note about it.Type of Change
Checklist
npm test)npm run typecheck)npm run lint)How to test
Notes for the reviewer
isTitleSlugis deliberately the only new validation helper, and onlynoteuses it for now. A follow-up PR can share one resolver across every command that takes an ID or a slug, which would also stopshowandhintfrom printing raw Zod errors for an unknown slug.Existing behaviour is untouched: the TUI passes a numeric ID, so its note path is unchanged, and all 354 existing tests still pass alongside the 5 new ones.