@andrzejchm/notion-cli 0.2.0 → 0.3.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 +45 -23
- package/dist/cli.js +2269 -1946
- package/dist/cli.js.map +1 -1
- package/docs/README.agents.md +10 -6
- package/docs/skills/using-notion-cli/SKILL.md +16 -26
- package/package.json +10 -2
package/docs/README.agents.md
CHANGED
|
@@ -7,7 +7,7 @@ Complete guide for using notion-cli with [OpenCode](https://opencode.ai).
|
|
|
7
7
|
Tell OpenCode:
|
|
8
8
|
|
|
9
9
|
```
|
|
10
|
-
Fetch and follow instructions from https://raw.githubusercontent.com/andrzejchm/notion-cli/main/docs/README.
|
|
10
|
+
Fetch and follow instructions from https://raw.githubusercontent.com/andrzejchm/notion-cli/main/docs/README.agents.md
|
|
11
11
|
```
|
|
12
12
|
|
|
13
13
|
## Installation
|
|
@@ -35,17 +35,21 @@ curl -fsSL https://raw.githubusercontent.com/andrzejchm/notion-cli/main/docs/ski
|
|
|
35
35
|
|
|
36
36
|
### 3. Authenticate
|
|
37
37
|
|
|
38
|
-
**
|
|
38
|
+
**Interactive setup** (choose OAuth or integration token):
|
|
39
39
|
```bash
|
|
40
|
-
notion
|
|
41
|
-
|
|
40
|
+
notion auth login
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
**Integration token only** (CI/agents — no TTY needed):
|
|
44
|
+
```bash
|
|
45
|
+
export NOTION_API_TOKEN=ntn_your_token_here
|
|
42
46
|
```
|
|
43
47
|
|
|
44
48
|
Get a token: https://www.notion.so/profile/integrations/internal
|
|
45
49
|
|
|
46
|
-
**OAuth
|
|
50
|
+
**OAuth** (recommended for write operations — attributes comments/pages to your user):
|
|
47
51
|
```bash
|
|
48
|
-
notion auth login #
|
|
52
|
+
notion auth login # select "OAuth user login" in the prompt
|
|
49
53
|
notion auth login --manual # headless: prints URL, paste redirect back
|
|
50
54
|
```
|
|
51
55
|
|
|
@@ -10,7 +10,7 @@ compatibility: opencode
|
|
|
10
10
|
Install once:
|
|
11
11
|
```bash
|
|
12
12
|
npm install -g @andrzejchm/notion-cli
|
|
13
|
-
notion
|
|
13
|
+
notion auth login # interactive setup — choose OAuth or integration token
|
|
14
14
|
```
|
|
15
15
|
|
|
16
16
|
Or set env var (preferred for CI/agents):
|
|
@@ -33,24 +33,23 @@ Pages must be shared with your integration: open page → `⋯` → **Add connec
|
|
|
33
33
|
|
|
34
34
|
Two auth methods are available. If both are configured, **OAuth takes precedence**.
|
|
35
35
|
|
|
36
|
-
|
|
37
|
-
|
|
36
|
+
| Method | Command | Attribution | Notes |
|
|
37
|
+
|--------|---------|-------------|-------|
|
|
38
|
+
| Interactive setup | `notion auth login` | — | Guides you to choose; TTY required |
|
|
39
|
+
| OAuth user login | select "OAuth user login" in `notion auth login` | Your Notion account | Browser required; `--manual` for headless |
|
|
40
|
+
| Integration token | select "Integration token" in `notion auth login` | Integration bot | Works in CI/headless; must connect integration to pages |
|
|
38
41
|
|
|
39
42
|
```bash
|
|
40
|
-
notion
|
|
41
|
-
|
|
43
|
+
notion auth login # interactive selector — OAuth or integration token
|
|
44
|
+
notion auth login --manual # headless OAuth (prints URL, paste redirect back)
|
|
45
|
+
notion auth status # show current auth state
|
|
46
|
+
notion auth logout # remove a profile (interactive selector)
|
|
47
|
+
notion auth logout --profile <name> # remove specific profile directly
|
|
48
|
+
notion auth list # list all saved profiles
|
|
49
|
+
notion auth use <name> # switch active profile
|
|
42
50
|
```
|
|
43
51
|
|
|
44
|
-
|
|
45
|
-
Set up via `notion auth login`. Comments and pages are attributed to your **actual Notion user account**.
|
|
46
|
-
|
|
47
|
-
```bash
|
|
48
|
-
notion auth login [--profile <name>] [--manual] # opens browser OAuth flow; --manual for headless
|
|
49
|
-
notion auth logout [--profile <name>] # removes OAuth tokens
|
|
50
|
-
notion auth status [--profile <name>] # shows current auth state
|
|
51
|
-
```
|
|
52
|
-
|
|
53
|
-
**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.
|
|
52
|
+
**Headless/CI agents:** Use `NOTION_API_TOKEN=<token>` env var — overrides all config, no TTY needed.
|
|
54
53
|
|
|
55
54
|
---
|
|
56
55
|
|
|
@@ -117,15 +116,6 @@ URL=$(notion create-page --parent <id|url> --title "Summary" -m "...") # captu
|
|
|
117
116
|
notion comment <id|url> -m "Reviewed and approved." # add comment to a page
|
|
118
117
|
```
|
|
119
118
|
|
|
120
|
-
### Auth
|
|
121
|
-
|
|
122
|
-
```bash
|
|
123
|
-
notion init # interactive setup (requires TTY)
|
|
124
|
-
notion profile list # show saved profiles
|
|
125
|
-
notion profile use <name> # switch active profile
|
|
126
|
-
notion profile remove <name> # delete a profile
|
|
127
|
-
```
|
|
128
|
-
|
|
129
119
|
---
|
|
130
120
|
|
|
131
121
|
## ID Formats
|
|
@@ -173,13 +163,13 @@ my-report-command | notion create-page --parent "$PAGE_ID" --title "Auto Report"
|
|
|
173
163
|
|
|
174
164
|
**404 / page not found** — Share the page with your integration: page → `⋯` → **Add connections**.
|
|
175
165
|
|
|
176
|
-
**401 / unauthorized** — Run `notion
|
|
166
|
+
**401 / unauthorized** — Run `notion auth login` or set `NOTION_API_TOKEN`.
|
|
177
167
|
|
|
178
168
|
**Search returns nothing** — Search is title-only. Page must be shared with integration.
|
|
179
169
|
|
|
180
170
|
**Empty db query** — Run `notion db schema <id>` to see valid property names and values.
|
|
181
171
|
|
|
182
|
-
**`notion
|
|
172
|
+
**`notion auth login` requires TTY** — Use `NOTION_API_TOKEN` env var in agents, or use `notion auth login --manual` for headless OAuth.
|
|
183
173
|
|
|
184
174
|
**`notion comment` returns "Insufficient permissions"** — Enable **Read comments** + **Insert comments** in integration capabilities: notion.so/profile/integrations/internal → your integration → Capabilities.
|
|
185
175
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@andrzejchm/notion-cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "Read Notion pages and databases from the terminal. Built for AI agents and developers.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"notion",
|
|
@@ -36,7 +36,14 @@
|
|
|
36
36
|
"build": "tsup",
|
|
37
37
|
"dev": "tsup --watch",
|
|
38
38
|
"test": "vitest run",
|
|
39
|
-
"test:watch": "vitest"
|
|
39
|
+
"test:watch": "vitest",
|
|
40
|
+
"typecheck": "tsc --noEmit",
|
|
41
|
+
"lint": "biome lint .",
|
|
42
|
+
"format": "biome format .",
|
|
43
|
+
"format:write": "biome format --write .",
|
|
44
|
+
"check": "biome check .",
|
|
45
|
+
"check:write": "biome check --write .",
|
|
46
|
+
"ci": "npm run typecheck && npm run check"
|
|
40
47
|
},
|
|
41
48
|
"dependencies": {
|
|
42
49
|
"@inquirer/prompts": "^8.3.0",
|
|
@@ -46,6 +53,7 @@
|
|
|
46
53
|
"yaml": "^2.8.0"
|
|
47
54
|
},
|
|
48
55
|
"devDependencies": {
|
|
56
|
+
"@biomejs/biome": "^2.4.4",
|
|
49
57
|
"@commander-js/extra-typings": "^14.0.0",
|
|
50
58
|
"@types/node": "^22",
|
|
51
59
|
"tsup": "^8.5.0",
|