@readwise/cli 0.3.0 → 0.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/README.md +9 -11
  2. package/dist/index.js +2 -51
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -7,10 +7,7 @@ Commands are auto-discovered from the Readwise API, so the CLI stays up to date
7
7
  ## Install
8
8
 
9
9
  ```bash
10
- git clone <repo-url> && cd readwise
11
- npm install
12
- npm run build
13
- npm link
10
+ npm install -g @readwise/cli
14
11
  ```
15
12
 
16
13
  ## Setup
@@ -125,16 +122,17 @@ Pipe results to `jq`:
125
122
  readwise reader-list-documents --limit 3 --json | jq '.results[].title'
126
123
  ```
127
124
 
125
+ ## How it works
126
+
127
+ The CLI connects to the [Readwise MCP server](https://mcp2.readwise.io) internally, auto-discovers available tools, and exposes each one as a CLI command. The tool list is cached locally for 24 hours.
128
+
128
129
  ## Development
129
130
 
130
131
  ```bash
132
+ git clone https://github.com/readwise/readwise-cli && cd readwise-cli
133
+ npm install
134
+ npm run build
135
+
131
136
  # Run without building
132
137
  npx tsx src/index.ts --help
133
-
134
- # Build
135
- npm run build
136
138
  ```
137
-
138
- ## How it works
139
-
140
- The CLI connects to the [Readwise MCP server](https://mcp2.readwise.io) internally, auto-discovers available tools, and exposes each one as a CLI command. The tool list is cached locally for 24 hours.
package/dist/index.js CHANGED
@@ -2,8 +2,8 @@
2
2
  import { createInterface } from "node:readline";
3
3
  import { Command } from "commander";
4
4
  import { login, loginWithToken, ensureValidToken } from "./auth.js";
5
- import { getTools, callTool } from "./mcp.js";
6
- import { registerTools, displayResult } from "./commands.js";
5
+ import { getTools } from "./mcp.js";
6
+ import { registerTools } from "./commands.js";
7
7
  import { loadConfig } from "./config.js";
8
8
  import { VERSION } from "./version.js";
9
9
  function readHiddenInput(prompt) {
@@ -85,55 +85,6 @@ program
85
85
  process.exitCode = 1;
86
86
  }
87
87
  });
88
- program
89
- .command("search <query>")
90
- .description("Search across Reader documents and Readwise highlights")
91
- .option("--limit <n>", "Max results per source (default: 10)")
92
- .action(async (query, options) => {
93
- try {
94
- const { token, authType } = await ensureValidToken();
95
- const limit = options.limit ? Number(options.limit) : 10;
96
- const json = program.opts().json || false;
97
- const [readerResult, highlightsResult] = await Promise.all([
98
- callTool(token, authType, "reader_search_documents", { query, limit }),
99
- callTool(token, authType, "readwise_search_highlights", { vector_search_term: query, limit }),
100
- ]);
101
- if (json) {
102
- const combined = {};
103
- for (const item of readerResult.content) {
104
- if (item.type === "text" && item.text) {
105
- try {
106
- combined.reader = JSON.parse(item.text);
107
- }
108
- catch {
109
- combined.reader = item.text;
110
- }
111
- }
112
- }
113
- for (const item of highlightsResult.content) {
114
- if (item.type === "text" && item.text) {
115
- try {
116
- combined.highlights = JSON.parse(item.text);
117
- }
118
- catch {
119
- combined.highlights = item.text;
120
- }
121
- }
122
- }
123
- process.stdout.write(JSON.stringify(combined) + "\n");
124
- }
125
- else {
126
- console.log("\x1b[1m\x1b[36m── Reader Documents ──\x1b[0m\n");
127
- displayResult(readerResult, false);
128
- console.log("\n\x1b[1m\x1b[36m── Readwise Highlights ──\x1b[0m\n");
129
- displayResult(highlightsResult, false);
130
- }
131
- }
132
- catch (err) {
133
- process.stderr.write(`\x1b[31m${err.message}\x1b[0m\n`);
134
- process.exitCode = 1;
135
- }
136
- });
137
88
  async function main() {
138
89
  const config = await loadConfig();
139
90
  const forceRefresh = process.argv.includes("--refresh");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@readwise/cli",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
4
4
  "description": "Command-line interface for Readwise and Reader",
5
5
  "type": "module",
6
6
  "bin": {