Skip to content

refactor: modernize CLI infrastructure and UX#20

Merged
m1ngsama merged 10 commits intomainfrom
refactor/modernization
Apr 27, 2026
Merged

refactor: modernize CLI infrastructure and UX#20
m1ngsama merged 10 commits intomainfrom
refactor/modernization

Conversation

@m1ngsama
Copy link
Copy Markdown
Member

Closes #19

Summary

  • Replace axios with native fetch + AbortController across calendar, status, and docs modules
  • Upgrade dependencies: marked 15, TypeScript 5.9, open 11, clack 1.2, chalk 5.6
  • Add XDG Base Directory config support with ~/.nbtca/ legacy fallback
  • Add i18n fmt() helper, vim-keys context toggle, iterative directory browsing, LRU cache eviction
  • Cross-platform Node.js build script, CI test step

Commits (9)

  1. refactor: XDG config directory with legacy fallback
  2. refactor: add i18n fmt helper, replace .replace() chains
  3. fix: vim-keys text input conflict, shared SIGINT handler, extended CJK ranges
  4. fix: remove dead code in links.ts, fix any type in status.ts
  5. fix: show year in calendar dates for cross-year events
  6. refactor: convert recursive directory browsing to iterative loops
  7. feat: LRU cache eviction and content-aware doc search
  8. chore: upgrade deps (marked 15, TS 5.9, open 11), remove axios for native fetch
  9. feat: cross-platform build script and CI test step

Test plan

  • Clean build passes (npm run build)
  • TypeScript strict check (tsc --noEmit)
  • All 12 CLI contract tests pass (npm test)
  • 23-point smoke test: version, help, URL commands, status JSON, events JSON, theme read/write/reset, language switch, error handling, XDG paths, build artifacts, no axios residue
  • Table alignment verified for en/zh × unicode/ascii
  • CI passes on Node 20 and 22

🤖 Generated with Claude Code

m1ngsama and others added 10 commits April 27, 2026 12:47
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…K ranges

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…tive fetch

- Remove axios, replace all HTTP calls with native fetch + AbortController
- Upgrade marked 11→15, typescript 5.3→5.9, open 10→11, @clack/prompts 1.2
- Upgrade @types/node 22, tsx 4.21
- Fix marked.setOptions→marked.use API for marked 15

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Replace shell-based postbuild with Node.js copy-assets script for
cross-platform compatibility. Add test step to CI, remove redundant
tsc --noEmit check. Fix test to use XDG config path.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Fix --today filter: compare Date objects instead of formatted strings
  to handle cross-year events correctly
- Convert remaining .replace() calls in docs.ts to fmt() for consistency
- Rename evictOldest to evictStalest to accurately reflect FIFO behavior
- Improve abort timeout error messages: show "Request timed out" instead
  of cryptic "The operation was aborted" across all fetch call sites
- Restore build step in npm test for local dev safety

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@m1ngsama m1ngsama merged commit 91560b8 into main Apr 27, 2026
2 checks passed
@m1ngsama m1ngsama deleted the refactor/modernization branch April 27, 2026 05: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.

Modernize CLI: XDG config, native fetch, dependency upgrades, UX improvements

1 participant