@andrzejchm/notion-cli 0.1.2 → 0.2.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 +66 -8
- package/dist/cli.js +821 -34
- package/dist/cli.js.map +1 -1
- package/docs/README.agents.md +77 -0
- package/docs/demo.gif +0 -0
- package/docs/demo.tape +26 -0
- package/docs/notion-cli-icon.png +0 -0
- package/docs/skills/using-notion-cli/SKILL.md +186 -0
- package/package.json +2 -2
- package/docs/agent-skill.md +0 -474
package/README.md
CHANGED
|
@@ -1,20 +1,23 @@
|
|
|
1
1
|
# notion-cli
|
|
2
2
|
|
|
3
|
-
> Read Notion pages
|
|
3
|
+
> Read and write Notion pages from your terminal — built for AI coding agents and developers.
|
|
4
4
|
|
|
5
5
|
[](https://www.npmjs.com/package/@andrzejchm/notion-cli)
|
|
6
|
+
[](https://github.com/andrzejchm/homebrew-notion-cli)
|
|
6
7
|
[](https://nodejs.org)
|
|
7
8
|
[](LICENSE)
|
|
8
9
|
|
|
9
10
|
```bash
|
|
11
|
+
# Homebrew (recommended)
|
|
12
|
+
brew tap andrzejchm/notion-cli
|
|
13
|
+
brew install notion-cli
|
|
14
|
+
|
|
15
|
+
# npm (alternative)
|
|
10
16
|
npm install -g @andrzejchm/notion-cli
|
|
17
|
+
|
|
11
18
|
notion init # paste your Notion integration token once
|
|
12
19
|
```
|
|
13
20
|
|
|
14
|
-

|
|
15
|
-
|
|
16
|
-
---
|
|
17
|
-
|
|
18
21
|
## For AI Agents
|
|
19
22
|
|
|
20
23
|
```
|
|
@@ -23,11 +26,18 @@ Fetch and follow instructions from https://raw.githubusercontent.com/andrzejchm/
|
|
|
23
26
|
|
|
24
27
|
---
|
|
25
28
|
|
|
29
|
+

|
|
30
|
+
|
|
31
|
+
---
|
|
32
|
+
|
|
26
33
|
## Features
|
|
27
34
|
|
|
28
35
|
- **`notion search`** — find any page or database by title
|
|
29
36
|
- **`notion read`** — render any page as full-fidelity markdown
|
|
30
37
|
- **`notion db query`** — filter, sort, and select columns from any database
|
|
38
|
+
- **`notion append`** — append markdown content to an existing page
|
|
39
|
+
- **`notion create-page`** — create a new page with markdown body, prints URL to stdout
|
|
40
|
+
- **`notion comment`** — add a comment to a page
|
|
31
41
|
- **Agent-friendly** — plain text tables by default; `--json` for machine-readable output
|
|
32
42
|
- **Flexible auth** — interactive setup or `NOTION_API_TOKEN` env var
|
|
33
43
|
- **Accepts URLs** — pass full Notion URLs anywhere an ID is expected
|
|
@@ -47,8 +57,18 @@ notion db query "$DB_ID" --filter "Status=In Progress" --sort "Priority:asc"
|
|
|
47
57
|
# Get JSON output for scripting / AI agents
|
|
48
58
|
notion db query "$DB_ID" --filter "Status=Done" | jq '.[] | .properties.Title'
|
|
49
59
|
|
|
50
|
-
#
|
|
51
|
-
notion
|
|
60
|
+
# Append markdown blocks to an existing page
|
|
61
|
+
notion append "$PAGE_ID" -m "## Summary\nGenerated by AI agent."
|
|
62
|
+
|
|
63
|
+
# Create a new page and capture its URL
|
|
64
|
+
URL=$(notion create-page --parent "$PAGE_ID" --title "Meeting Notes" -m "# Agenda\n- Item 1")
|
|
65
|
+
echo "Created: $URL"
|
|
66
|
+
|
|
67
|
+
# Pipe content to a new page
|
|
68
|
+
my-summarize-command | notion create-page --parent "$PAGE_ID" --title "Auto Summary"
|
|
69
|
+
|
|
70
|
+
# Add a comment to a page
|
|
71
|
+
notion comment "$PAGE_ID" -m "Reviewed and approved."
|
|
52
72
|
|
|
53
73
|
# List everything your integration can access
|
|
54
74
|
notion ls
|
|
@@ -69,6 +89,9 @@ notion ls
|
|
|
69
89
|
| `notion db query <id\|url>` | Query database entries with filtering and sorting |
|
|
70
90
|
| `notion users` | List workspace members |
|
|
71
91
|
| `notion comments <id\|url>` | Read page comments |
|
|
92
|
+
| `notion comment <id\|url> -m <text>` | Add a comment to a page |
|
|
93
|
+
| `notion append <id\|url> -m <markdown>` | Append markdown blocks to a page |
|
|
94
|
+
| `notion create-page --parent <id\|url> --title <title>` | Create a new page, prints URL |
|
|
72
95
|
| `notion profile list\|use\|remove` | Manage multiple auth profiles |
|
|
73
96
|
| `notion completion bash\|zsh\|fish` | Install shell tab completion |
|
|
74
97
|
|
|
@@ -98,6 +121,12 @@ The CLI auto-detects your context:
|
|
|
98
121
|
|
|
99
122
|
## Authentication
|
|
100
123
|
|
|
124
|
+
Two authentication methods are available. If both are configured, **OAuth takes precedence** for API calls.
|
|
125
|
+
|
|
126
|
+
### Internal integration token
|
|
127
|
+
|
|
128
|
+
Run `notion init`. Suitable for read-only operations and automated agents. Write operations are attributed to the **integration bot** (not a real user).
|
|
129
|
+
|
|
101
130
|
```bash
|
|
102
131
|
# Interactive setup (recommended for first-time use)
|
|
103
132
|
notion init
|
|
@@ -114,6 +143,31 @@ notion profile use <name>
|
|
|
114
143
|
Token format: starts with `ntn_` (new) or `secret_` (legacy integrations).
|
|
115
144
|
Get a token: [notion.so/profile/integrations/internal](https://www.notion.so/profile/integrations/internal)
|
|
116
145
|
|
|
146
|
+
### OAuth user login (recommended for write operations)
|
|
147
|
+
|
|
148
|
+
Run `notion auth login`. Notion opens in your browser. After approving, your comments and pages will be attributed to your **actual Notion account** — not the integration bot.
|
|
149
|
+
|
|
150
|
+
```bash
|
|
151
|
+
notion auth login # Opens browser, authenticates
|
|
152
|
+
notion comment <id> -m "My comment" # Now attributed to your user
|
|
153
|
+
notion auth status # Check auth state
|
|
154
|
+
notion auth logout # Remove OAuth session
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
**Headless / remote servers:** `notion auth login --manual` prints the auth URL for you to open in a local browser, then prompts you to paste the redirect URL back.
|
|
158
|
+
|
|
159
|
+
### Integration capabilities
|
|
160
|
+
|
|
161
|
+
Read-only commands (`search`, `read`, `db query`, etc.) need **Read content** only.
|
|
162
|
+
|
|
163
|
+
Write commands require additional capabilities — enable in your integration settings ([notion.so/profile/integrations/internal](https://www.notion.so/profile/integrations/internal) → your integration → **Capabilities**):
|
|
164
|
+
|
|
165
|
+
| Command | Required capabilities |
|
|
166
|
+
|---------|----------------------|
|
|
167
|
+
| `notion append` | Read content, Insert content |
|
|
168
|
+
| `notion create-page` | Read content, Insert content |
|
|
169
|
+
| `notion comment` | Read content, Insert content, Read comments, Insert comments |
|
|
170
|
+
|
|
117
171
|
---
|
|
118
172
|
|
|
119
173
|
## Troubleshooting
|
|
@@ -126,8 +180,12 @@ Get a token: [notion.so/profile/integrations/internal](https://www.notion.so/pro
|
|
|
126
180
|
|
|
127
181
|
**Empty database query:** Run `notion db schema <id>` first to see valid property names and values.
|
|
128
182
|
|
|
183
|
+
**`notion comment` returns "Insufficient permissions":** Enable **Read comments** and **Insert comments** in your integration capabilities: [notion.so/profile/integrations/internal](https://www.notion.so/profile/integrations/internal) → your integration → Capabilities.
|
|
184
|
+
|
|
185
|
+
**`notion append` / `notion create-page` returns "Insufficient permissions":** Enable **Insert content** in your integration capabilities.
|
|
186
|
+
|
|
129
187
|
---
|
|
130
188
|
|
|
131
189
|
## License
|
|
132
190
|
|
|
133
|
-
MIT © [Andrzej
|
|
191
|
+
MIT © [Andrzej Chmielewski](https://github.com/andrzejchm)
|