@andrzejchm/notion-cli 0.1.0
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.
- package/README.md +75 -0
- package/dist/cli.js +1605 -0
- package/dist/cli.js.map +1 -0
- package/docs/agent-skill.md +475 -0
- package/package.json +48 -0
package/README.md
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
# notion-cli
|
|
2
|
+
|
|
3
|
+
Read Notion pages and databases from the terminal. Built for AI coding agents and developers.
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
npm install -g @andrzejchm/notion-cli
|
|
7
|
+
notion init # enter your Notion integration token
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
## What it does
|
|
11
|
+
|
|
12
|
+
- `notion search` — find pages and databases by title
|
|
13
|
+
- `notion read <id>` — read any page as full-fidelity markdown
|
|
14
|
+
- `notion db query <id>` — query database entries with filtering and sorting
|
|
15
|
+
- Dual output: formatted tables in terminal, JSON when piped (agent-friendly)
|
|
16
|
+
|
|
17
|
+
## Quick Start
|
|
18
|
+
|
|
19
|
+
1. Create a Notion integration at https://www.notion.so/profile/integrations/internal
|
|
20
|
+
2. Share your pages/databases with the integration (⋯ → Add connections)
|
|
21
|
+
3. Run `notion init` and enter your token
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
# Find a page
|
|
25
|
+
notion search "meeting notes"
|
|
26
|
+
|
|
27
|
+
# Read it as markdown
|
|
28
|
+
notion read https://www.notion.so/workspace/Meeting-Notes-abc123
|
|
29
|
+
|
|
30
|
+
# Query a database
|
|
31
|
+
notion db query abc123def456 --filter "Status=Done" --json | jq '.[] | .properties'
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## Agent Usage
|
|
35
|
+
|
|
36
|
+
For AI agents, pipe commands to get JSON output:
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
notion search "my project" | jq '.[0].id'
|
|
40
|
+
notion db query "$DB_ID" | jq '.[] | .properties.Title'
|
|
41
|
+
notion read "$PAGE_ID" # markdown output works in agents too
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
See [`docs/agent-skill.md`](docs/agent-skill.md) for the complete agent skill reference including Claude Code, OpenCode, and Codex setup instructions.
|
|
45
|
+
|
|
46
|
+
## Commands
|
|
47
|
+
|
|
48
|
+
| Command | Description |
|
|
49
|
+
|---------|-------------|
|
|
50
|
+
| `notion init` | Set up Notion integration token |
|
|
51
|
+
| `notion search <query>` | Search pages and databases by title |
|
|
52
|
+
| `notion ls` | List all accessible pages and databases |
|
|
53
|
+
| `notion open <id>` | Open a page in the browser |
|
|
54
|
+
| `notion read <id>` | Read a page as markdown |
|
|
55
|
+
| `notion db schema <id>` | Show database property schema |
|
|
56
|
+
| `notion db query <id>` | Query database entries |
|
|
57
|
+
| `notion users` | List workspace members |
|
|
58
|
+
| `notion comments <id>` | Read page comments |
|
|
59
|
+
|
|
60
|
+
## Authentication
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
# Option 1: interactive setup (recommended)
|
|
64
|
+
notion init
|
|
65
|
+
|
|
66
|
+
# Option 2: environment variable
|
|
67
|
+
export NOTION_API_TOKEN=ntn_your_token_here
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
Token format: starts with `ntn_` (new) or `secret_` (legacy).
|
|
71
|
+
Get your token at: https://www.notion.so/profile/integrations/internal
|
|
72
|
+
|
|
73
|
+
## License
|
|
74
|
+
|
|
75
|
+
MIT
|