Skip to content

Feature: add new /kindle-sync command#15

Open
theryananderson wants to merge 9 commits intoheyitsnoah:mainfrom
theryananderson:feature/kindle-sync
Open

Feature: add new /kindle-sync command#15
theryananderson wants to merge 9 commits intoheyitsnoah:mainfrom
theryananderson:feature/kindle-sync

Conversation

@theryananderson
Copy link
Copy Markdown

Adds a complete Kindle highlights sync system that automatically scrapes highlights from read.amazon.com/notebookand saves them as formatted Markdown notes in the user's vault. The integration includes smart authentication, caching, and an interactive Claude Code command for syncing.

Key features:

  • Interactive sync: Choose how many books to sync (10, 25, 50, or all) via /kindle-sync command
  • Zero-config first run: Automatically prompts for folder selection and handles Amazon authentication
  • Smart auto-authentication: Detects missing/expired auth and handles it automatically with auto-retry
  • Intelligent caching: First sync scrapes, subsequent syncs use cached data (instant updates)
  • Rich Markdown output: YAML frontmatter, tags, Kindle app deep links, and customizable templates

@heyitsnoah
Copy link
Copy Markdown
Owner

@claude review please

@claude
Copy link
Copy Markdown

claude bot commented Oct 20, 2025

Claude encountered an error —— View job

Failed with exit code 128

I'll analyze this and get back to you.

@heyitsnoah
Copy link
Copy Markdown
Owner

@theryananderson think we could do TS instead of JS?

@theryananderson
Copy link
Copy Markdown
Author

@theryananderson think we could do TS instead of JS?

Yes absolutely! I wrote it originally as a standalone app in TS and then I think the AI ported it to JS when I was moving it into Claudesidian because the rest of the repo looked like it was JS. But that should be an easy enough update.

@theryananderson
Copy link
Copy Markdown
Author

@heyitsnoah alright, typesafe version for you to review!

Copy link
Copy Markdown
Owner

@heyitsnoah heyitsnoah left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great feature! Did a YAGNI/KISS review and found a few pieces of unused code that can be removed:

1. Dead logic in sync.ts:266

const needsScraping = force || all || specificBooks || !all

This is always true (if all is false, !all is true). Suggest simplifying to just run the auth check unconditionally:

const hasAuth = await checkAuthExists()
if (!hasAuth) {
  console.log('⚠️  No authentication found.\n')
  await runAuth()
}

2. Unused FileSystemError class in lib/errors.ts:36-43

Defined but never instantiated anywhere. Can be deleted.

3. Unused validateBookExport function in lib/validation.ts:84-96

Only parseBookExports is used. This function can be deleted.

4. Unused extractBookId function in lib/utils.ts:27-42

ASIN is extracted directly from DOM element IDs in the scraper. This function is never called.

5. Unused config properties in lib/config.ts

In ScrapingConfig, only rateLimitBaseDelay and rateLimitJitter are used. These can be removed:

  • maxLazyLoadRounds
  • maxStableRounds
  • pageLoadTimeout
  • scrollBaseDelay
  • scrollDelayIncrease
  • scrollJitter

6. Unused colorAttribute selector in lib/config.ts

The scraper doesn't extract highlight colors. This selector can be removed from HighlightSelectors.


These are all minor cleanups (~64 lines). The feature itself works great! 🎉

@theryananderson
Copy link
Copy Markdown
Author

@heyitsnoah dead code cleaned up and logic simplified. I also cleaned out the 3 merge conflicts (2 small things and one set of package updates).

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.

2 participants