Skip to content

refactor: replace magic numbers and weak error types#178

Merged
sakebomb merged 1 commit into
mainfrom
fix/type-safety-cleanup
May 10, 2026
Merged

refactor: replace magic numbers and weak error types#178
sakebomb merged 1 commit into
mainfrom
fix/type-safety-cleanup

Conversation

@sakebomb
Copy link
Copy Markdown
Owner

Summary

  • Named display layout constants in tools.ts (SEARCH_EXCERPT_LEN, NOTE_EXCERPT_LEN, CONTEXT_EXCERPT_LEN, SNIPPET_MAX, LIST_TOOL_COL_WIDTH, LIST_ID_COL_WIDTH) replacing 6 scattered magic numbers
  • Replaced catch (e: any) with catch (e: unknown) + isEnoent() type guard in install/index.ts, eliminating the only two type suppressions in src/

Test plan

  • 693 tests pass, 0 failures
  • tsc --noEmit clean
  • No behaviour changes — purely naming and typing improvements

- Extract display layout constants in tools.ts (SEARCH_EXCERPT_LEN,
  NOTE_EXCERPT_LEN, CONTEXT_EXCERPT_LEN, SNIPPET_MAX, LIST_TOOL_COL_WIDTH,
  LIST_ID_COL_WIDTH) so formatting intent is named and consistent
- Replace catch(e:any) in install/index.ts with catch(e:unknown) + isEnoent()
  type guard, eliminating the only two type suppressions in src/
@sakebomb sakebomb merged commit 5b696a1 into main May 10, 2026
3 checks passed
@sakebomb sakebomb deleted the fix/type-safety-cleanup branch May 10, 2026 22:08
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