Skip to content

Unify note path resolution across CLI commands, et. al - #15

Merged
polymorcodeus merged 4 commits into
mainfrom
bug-reclassify
Sep 13, 2026
Merged

polymorcodeus merged 4 commits into
mainfrom
bug-reclassify

Conversation

@polymorcodeus

Copy link
Copy Markdown
Owner

Summary

Adds unified note resolution: park reclassify now accepts a bare basename or a literal path the way park show always did, and closes the findings from a full codebase review (a tilde-expansion gap in --from-file, duplicated error construction, dead exports, and keybinding drift risk).

What's new

  • Unified note resolution - park reclassify accepts a bare basename (searched across every configured category folder, archive included) or a literal path (absolute, or relative to the working directory), matching park show.
  • No double-join - store.ResolvePath treats any value containing a path separator as a literal path and never joins it onto a category folder.
  • Tilde expansion for ingestion - park new --from-file expands ~/$HOME exactly once, in note.IngestFile, so parsing, form preview, and source removal all see the same path; quoted ~/note.md paths previously failed at parse time.
  • Single category-error constructor - Config.UnknownCategoryError owns the "unknown category" message for all CLI Before hooks and domain packages (8 hand-written copies removed).
  • Keybinding single source - assist reclassify keys are matched in Update from the same key.Binding values that render help (categoryBinding pairs each category name with its binding).

Usage

Command Purpose
park reclassify <file> -c <category> <file> accepts a bare basename or a literal path
park new -f <path> <path> may use ~/$HOME

Behavior changes / guardrails

  • Same-category reclassify is still rejected with the same error, whether the note is named by basename, absolute path, or relative path.
  • Path-like arguments that do not exist as literal paths return os.ErrNotExist; bare basenames still search every category folder.
  • The new --category flag error now uses the shared unknown-category message.
  • Dead exported helpers removed: note.Note.HasCompleteMetadata, config.DefaultConfigPath, config.CategoryByKey. All config.Config methods now use pointer receivers; TUI constants renamed to maxWidth/defaultHeight.

Testing

  • New tests cover quoted-tilde ingestion, literal-path and relative-path reclassify, no-double-join resolution, the relative-path same-category guard, the shared error constructor, and CLI-level path reclassify.
  • Smoke-tested a built binary: basename, absolute, relative, and quoted-tilde invocations all behave as documented.
  • make check runs fmt, vet, lint, and tests; all green.

@polymorcodeus polymorcodeus self-assigned this Sep 13, 2026
@polymorcodeus polymorcodeus changed the title Unify note path resolution across CLI commands Unify note path resolution across CLI commands, et. al Sep 13, 2026
@polymorcodeus
polymorcodeus merged commit 95daef6 into main Sep 13, 2026
4 checks passed
@polymorcodeus
polymorcodeus deleted the bug-reclassify branch September 13, 2026 23:42
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