@andrzejchm/notion-cli 0.12.0 → 0.13.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/.agents/skills/using-notion-cli/SKILL.md +84 -8
- package/README.md +26 -1
- package/dist/cli.js +429 -50
- package/dist/cli.js.map +1 -1
- package/docs/FEATURE-PARITY.md +29 -20
- package/docs/README.agents.md +117 -1
- package/package.json +2 -2
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: using-notion-cli
|
|
3
|
-
description: Use when reading or writing Notion pages, searching a Notion workspace, querying or creating Notion databases, appending or editing page content, creating pages, updating page properties, moving pages, attaching files, adding comments, or archiving pages — via the `notion` CLI tool in the terminal.
|
|
3
|
+
description: Use when reading or writing Notion pages, searching a Notion workspace, querying or creating Notion databases, updating database schemas, batch-updating database rows, appending or editing page content, creating pages, updating page properties, moving pages, attaching files, adding comments, deleting blocks, or archiving pages and databases — via the `notion` CLI tool in the terminal.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
## Overview - skill version 0.
|
|
6
|
+
## Overview - skill version 0.13.0
|
|
7
7
|
|
|
8
|
-
`notion` is a CLI tool for reading and writing Notion content from the terminal or agent workflows. Use it any time you need to interact with Notion: read pages, search, query databases, append or edit content, create pages, update properties, move pages, post comments, attach files, or archive pages.
|
|
8
|
+
`notion` is a CLI tool for reading and writing Notion content from the terminal or agent workflows. Use it any time you need to interact with Notion: read pages, search, query databases, create and update database schemas, batch-update rows, append or edit content, create pages, update properties, move pages, post comments, attach files, delete blocks, or archive pages and databases.
|
|
9
9
|
|
|
10
|
-
> **Version check:** Run `notion --version`. If your installed version is older than 0.
|
|
10
|
+
> **Version check:** Run `notion --version`. If your installed version is older than 0.13.0, update with `npm install -g @andrzejchm/notion-cli` and refresh this skill with `notion skill`.
|
|
11
11
|
|
|
12
12
|
## Setup
|
|
13
13
|
|
|
@@ -36,6 +36,9 @@ Pages must be shared with your integration: open page → `⋯` → **Add connec
|
|
|
36
36
|
- `notion edit-page`: also need **Update content** + **Insert content**
|
|
37
37
|
- `notion attach`: also need **Insert content**
|
|
38
38
|
- `notion comment`: also need **Read comments** + **Insert comments**
|
|
39
|
+
- `notion db update`: also need **Update content**
|
|
40
|
+
- `notion db update-rows`: also need **Read content** + **Update content**
|
|
41
|
+
- `notion delete-block`: also need **Update content**
|
|
39
42
|
|
|
40
43
|
---
|
|
41
44
|
|
|
@@ -116,6 +119,52 @@ notion db query <id|url> --columns "Title,Status" # limit columns
|
|
|
116
119
|
notion db query <id|url> --json | jq '.[] | .properties'
|
|
117
120
|
|
|
118
121
|
notion db create --parent <page-id|url> --title "My Database" # create a new database
|
|
122
|
+
notion db create --parent <page-id|url> --title "Tasks" \
|
|
123
|
+
--prop "Status:select:To Do,In Progress,Done" \
|
|
124
|
+
--prop "Priority:select:High,Medium,Low" \
|
|
125
|
+
--prop "Due:date:" \
|
|
126
|
+
--prop "Notes:rich_text:" # with property definitions
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
#### Creating Databases with Properties
|
|
130
|
+
|
|
131
|
+
Use `--prop "Name:type[:options]"` (repeatable) to define columns when creating a database.
|
|
132
|
+
|
|
133
|
+
```bash
|
|
134
|
+
# Database with select, date, and text properties
|
|
135
|
+
notion db create --parent "$PAGE_ID" --title "Project Tracker" \
|
|
136
|
+
--prop "Status:select:To Do,In Progress,Done" \
|
|
137
|
+
--prop "Priority:select:High,Medium,Low" \
|
|
138
|
+
--prop "Due:date:" \
|
|
139
|
+
--prop "Notes:rich_text:"
|
|
140
|
+
|
|
141
|
+
# Minimal — title column is added automatically if not specified
|
|
142
|
+
notion db create --parent "$PAGE_ID" --title "Simple List"
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
Supported property types: `title`, `rich_text`, `number`, `select`, `multi_select`, `status`, `date`, `checkbox`, `url`, `email`, `phone_number`, `people`, `files`, `created_time`, `last_edited_time`.
|
|
146
|
+
|
|
147
|
+
**Important:** After creating a database, use `notion search "DB Title" --type database` to find the database ID for subsequent operations. The ID returned by `db create` is a URL-based ID that may differ from the API-accessible database ID.
|
|
148
|
+
|
|
149
|
+
#### Updating Database Schema
|
|
150
|
+
|
|
151
|
+
```bash
|
|
152
|
+
notion db update <id|url> --add-prop "Priority:number" # add a number property
|
|
153
|
+
notion db update <id|url> --add-prop "Severity:select:Low,Medium,High" # add select with options
|
|
154
|
+
notion db update <id|url> --remove-prop "Old Column" # remove a property
|
|
155
|
+
notion db update <id|url> --rename-prop "Status:Project Status" # rename a property
|
|
156
|
+
notion db update <id|url> --set-options "Priority:P1,P2,P3" # replace select options
|
|
157
|
+
notion db update <id|url> --title "New Database Title" # update title
|
|
158
|
+
notion db update <id|url> --add-prop "URL:url" --remove-prop "Notes" # multiple ops in one call
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
#### Batch Updating Database Rows
|
|
162
|
+
|
|
163
|
+
```bash
|
|
164
|
+
notion db update-rows <id|url> --filter "Status=Open" --prop "Priority=P3" # update filtered rows
|
|
165
|
+
notion db update-rows <id|url> --prop "Status=Closed" # update ALL rows
|
|
166
|
+
notion db update-rows <id|url> --filter "Status=Done" --prop "Priority=Low" --dry-run # preview
|
|
167
|
+
notion db update-rows <id|url> --filter "Category=Bug" --prop "Status=Done" --json # JSON output
|
|
119
168
|
```
|
|
120
169
|
|
|
121
170
|
### Write Operations
|
|
@@ -150,7 +199,8 @@ notion comment <id|url> -m "Reviewed and approved." # add comme
|
|
|
150
199
|
notion comment <id|url> -m "Reply" --reply-to <discussion-id> # reply to a discussion thread
|
|
151
200
|
notion comment <id|url> -m "Note" --block <block-id> # comment on a specific block
|
|
152
201
|
|
|
153
|
-
notion archive <id|url> # move page to trash
|
|
202
|
+
notion archive <id|url> # move page or database to trash
|
|
203
|
+
notion delete-block <id|url> # delete a block (inline db, paragraph, etc.)
|
|
154
204
|
|
|
155
205
|
notion move <ids|urls...> --to <id|url> # move pages to a new parent page
|
|
156
206
|
notion move <ids|urls...> --to-db <id|url> # move pages to a database parent
|
|
@@ -279,9 +329,14 @@ notion edit-page "$PAGE_ID" \
|
|
|
279
329
|
--find "Status: In Progress" --replace "Status: Done" \
|
|
280
330
|
--find "Blocked: yes" --replace "Blocked: none"
|
|
281
331
|
|
|
282
|
-
# Create a database
|
|
283
|
-
|
|
284
|
-
|
|
332
|
+
# Create a database with typed columns, then add entries
|
|
333
|
+
notion db create --parent "$PAGE_ID" --title "Sprint Tasks" \
|
|
334
|
+
--prop "Status:select:To Do,In Progress,Done" \
|
|
335
|
+
--prop "Priority:select:High,Medium,Low" \
|
|
336
|
+
--prop "Due:date:" --prop "Notes:rich_text:"
|
|
337
|
+
# Use search to get the API-accessible database ID (may differ from db create output)
|
|
338
|
+
DB_ID=$(notion search "Sprint Tasks" --type database | jq -r '.[0].id')
|
|
339
|
+
notion db schema "$DB_ID" # verify property names and valid values
|
|
285
340
|
notion create-page --parent "$DB_ID" --title "Fix login bug" \
|
|
286
341
|
--prop "Status=To Do" --prop "Priority=High" --prop "Due=2026-04-15"
|
|
287
342
|
|
|
@@ -308,6 +363,21 @@ notion append "$PAGE_ID" -m "## Data Analysis\nSee attached CSV:" --file ./expor
|
|
|
308
363
|
|
|
309
364
|
# Upload a local file as icon for a page
|
|
310
365
|
notion update "$PAGE_ID" --icon ./logo.png
|
|
366
|
+
|
|
367
|
+
# Modify a database schema — add a column after creation
|
|
368
|
+
notion db update "$DB_ID" --add-prop "Sprint:select:S1,S2,S3"
|
|
369
|
+
|
|
370
|
+
# Clean up stale select options
|
|
371
|
+
notion db update "$DB_ID" --set-options "Status:To Do,In Progress,Done"
|
|
372
|
+
|
|
373
|
+
# Batch close all "In Progress" tasks
|
|
374
|
+
notion db update-rows "$DB_ID" --filter "Status=In Progress" --prop "Status=Done"
|
|
375
|
+
|
|
376
|
+
# Preview a batch update before applying
|
|
377
|
+
notion db update-rows "$DB_ID" --filter "Priority=Low" --prop "Status=Archived" --dry-run
|
|
378
|
+
|
|
379
|
+
# Delete an inline database from a page
|
|
380
|
+
notion delete-block "$BLOCK_ID"
|
|
311
381
|
```
|
|
312
382
|
|
|
313
383
|
---
|
|
@@ -333,3 +403,9 @@ notion update "$PAGE_ID" --icon ./logo.png
|
|
|
333
403
|
**`--find` text not found** — Run `notion read <id>` to see the exact page content. The `--find` value must match text on the page exactly.
|
|
334
404
|
|
|
335
405
|
**`--after` selector not found** — Run `notion read <id>` to see the exact page content. The selector must match real text: `"start...end"` with ~10 chars from the beginning and end of the target range.
|
|
406
|
+
|
|
407
|
+
**`notion db update` fails with "Property not found"** — Run `notion db schema <id>` to see exact property names. For `--rename-prop` and `--set-options`, the property must exist.
|
|
408
|
+
|
|
409
|
+
**`notion db update-rows` updates 0 rows** — Check that your `--filter` matches rows: run `notion db query <id> --filter "..."` first.
|
|
410
|
+
|
|
411
|
+
**`notion archive` fails for a database** — Try using the data source ID (from `notion db schema <id> --json`) instead of the database page ID.
|
package/README.md
CHANGED
|
@@ -96,8 +96,10 @@ notion ls
|
|
|
96
96
|
| `notion open <id\|url>` | Open a page in your browser |
|
|
97
97
|
| `notion read <id\|url>` | Read a page as markdown |
|
|
98
98
|
| `notion db create --parent <id\|url> --title <title>` | Create a new database with property definitions |
|
|
99
|
+
| `notion db update [options] <id\|url>` | Update database schema (add/remove/rename properties, manage options) |
|
|
99
100
|
| `notion db schema <id\|url>` | Show database property schema and valid values |
|
|
100
101
|
| `notion db query <id\|url>` | Query database entries with filtering and sorting |
|
|
102
|
+
| `notion db update-rows [options] <id\|url>` | Batch update properties on filtered database rows |
|
|
101
103
|
| `notion users` | List workspace members |
|
|
102
104
|
| `notion comments <id\|url>` | Read page comments |
|
|
103
105
|
| `notion comment [id\|url] -m <text>` | Add a comment to a page, block, or thread |
|
|
@@ -107,7 +109,8 @@ notion ls
|
|
|
107
109
|
| `notion edit-page <id\|url> -m <markdown>` | Replace entire page content |
|
|
108
110
|
| `notion create-page --parent <id\|url> --title <title>` | Create a new page, prints URL |
|
|
109
111
|
| `notion update <id\|url> --prop "Name=Value"` | Update properties on a page |
|
|
110
|
-
| `notion archive <id\|url>` | Archive (trash) a page |
|
|
112
|
+
| `notion archive <id\|url>` | Archive (trash) a page or database |
|
|
113
|
+
| `notion delete-block <id\|url>` | Delete a block by ID or URL |
|
|
111
114
|
| `notion move <ids\|urls...> --to <id\|url>` | Move pages to a new parent page |
|
|
112
115
|
| `notion move <ids\|urls...> --to-db <id\|url>` | Move pages to a database parent |
|
|
113
116
|
| `notion completion bash\|zsh\|fish` | Install shell tab completion |
|
|
@@ -164,6 +167,28 @@ Property syntax: `Name:type[:options]`. Supported types: `title`, `rich_text`, `
|
|
|
164
167
|
| `--columns` | `--columns "Title,Status"` | Only show specific columns |
|
|
165
168
|
| `--json` | `--json` | Force JSON output |
|
|
166
169
|
|
|
170
|
+
### `notion db update` flags
|
|
171
|
+
|
|
172
|
+
| Flag | Example | Description |
|
|
173
|
+
|------|---------|-------------|
|
|
174
|
+
| `--add-prop <definition>` | `--add-prop "Priority:number"` | Add a new property (repeatable) |
|
|
175
|
+
| `--remove-prop <name>` | `--remove-prop "Old Column"` | Remove a property (repeatable) |
|
|
176
|
+
| `--rename-prop <old:new>` | `--rename-prop "Status:Project Status"` | Rename a property (repeatable) |
|
|
177
|
+
| `--set-options <prop:opts>` | `--set-options "Priority:High,Medium,Low"` | Replace all select/multi\_select options |
|
|
178
|
+
| `--title <title>` | `--title "New DB Name"` | Update database title |
|
|
179
|
+
| `--json` | `--json` | Output full JSON response |
|
|
180
|
+
|
|
181
|
+
Property syntax for `--add-prop`: same as `notion db create --prop` — `Name:type[:options]`.
|
|
182
|
+
|
|
183
|
+
### `notion db update-rows` flags
|
|
184
|
+
|
|
185
|
+
| Flag | Example | Description |
|
|
186
|
+
|------|---------|-------------|
|
|
187
|
+
| `--filter <expr>` | `--filter "Status=Done"` | Filter rows to update (repeatable, same syntax as `db query`) |
|
|
188
|
+
| `--prop <property=value>` | `--prop "Priority=High"` | Property to update (repeatable, required) |
|
|
189
|
+
| `--dry-run` | `--dry-run` | Show matching rows without making changes |
|
|
190
|
+
| `--json` | `--json` | Output JSON array of results |
|
|
191
|
+
|
|
167
192
|
---
|
|
168
193
|
|
|
169
194
|
## Output Modes
|