Skip to content

feat: add keeply export command#4

Open
RolfKoenders wants to merge 2 commits into
mainfrom
feat/html-export
Open

feat: add keeply export command#4
RolfKoenders wants to merge 2 commits into
mainfrom
feat/html-export

Conversation

@RolfKoenders

Copy link
Copy Markdown
Member

Summary

  • New keeply export command — no equivalent existed before
  • Supports --format json (default) and --format html for Netscape browser import
  • Outputs to stdout by default (composable: keeply export | jq '.[].url')
  • --output <file> writes to disk and prints Saved to <file> to stderr
  • --include-trashed flag to include soft-deleted bookmarks
  • Uses raw fetch with ApiKey auth header (rather than KeeplyApi.request() which always calls .json())
  • Helpful error when no API key is configured, pointing to keeply config set-key
  • 9 tests in export.spec.ts covering all flags, stdout/file modes, API errors, and missing config

Test plan

  • npx tsc --noEmit — clean
  • npm test — all 59 tests pass including 9 new export tests
  • keeply export — streams JSON to terminal
  • keeply export --format html --output bookmarks.html — writes file, prints "Saved to bookmarks.html"
  • keeply export | jq '.[].url' — works as pipe

Closes Keeply-link/docs#3

New keeply export command downloads all bookmarks to stdout (default)
or a file via --output. Supports --format json (default) and
--format html for browser-importable Netscape format. Composable
with pipes: keeply export | jq '.[].url'.

Closes Keeply-link/docs#3

@RolfKoenders RolfKoenders left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Overall solid implementation with good test coverage. One issue:\n\n****: The entire file was reformatted from single quotes to double quotes, creating a noisy diff. This makes it hard to see the actual functional change (adding ). Please revert the quote-style changes to match the existing file style, or split the formatting into a separate commit.\n\nOther minor notes:\n- Consider adding a timeout on the call for large exports.\n- The mutation pattern in tests works but is slightly fragile if tests ever run in parallel.\n\nPlease fix the quote churn in and I'll approve.

@RolfKoenders

Copy link
Copy Markdown
Member Author

Review: Needs minor fix\n\nOverall solid implementation with good test coverage. One issue:\n\n****: The entire file was reformatted from single quotes to double quotes, creating a noisy diff. This makes it hard to see the actual functional change (adding ). Please revert the quote-style changes to match the existing file style, or split the formatting into a separate commit.\n\nOther minor notes:\n- Consider adding a timeout on the call for large exports.\n- The mutation pattern in tests works but is slightly fragile if tests ever run in parallel.\n\nPlease fix the quote churn in and this will be good to go.

The CLI project had no prettier config, so the pre-commit hook
reformatted index.ts from single quotes (existing style) to double
quotes (prettier default). Added .prettierrc matching the project
standard (singleQuote: true) so future changes stay consistent.
Now the only diff in index.ts vs main is the registerExportCommand
import and call.
@RolfKoenders

Copy link
Copy Markdown
Member Author

Fixed in 6b87383.

Root cause: the CLI project had no .prettierrc, so the pre-commit hook reformatted src/index.ts to prettier's default (double quotes) even though the existing codebase uses single quotes. Added .prettierrc matching the project standard (singleQuote: true, same as app-backend). After reformatting, index.ts now only differs from main by the two functional lines: the registerExportCommand import and the register call.

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