@andrzejchm/notion-cli 0.11.0 → 0.12.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.
@@ -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, 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, 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.
4
4
  ---
5
5
 
6
- ## Overview - skill version 0.11.0
6
+ ## Overview - skill version 0.12.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, 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, append or edit content, create pages, update properties, move pages, post comments, attach files, or archive pages.
9
9
 
10
- > **Version check:** Run `notion --version`. If your installed version is older than 0.11.0, update with `npm install -g @andrzejchm/notion-cli` and refresh this skill with `notion skill`.
10
+ > **Version check:** Run `notion --version`. If your installed version is older than 0.12.0, update with `npm install -g @andrzejchm/notion-cli` and refresh this skill with `notion skill`.
11
11
 
12
12
  ## Setup
13
13
 
@@ -34,6 +34,7 @@ Pages must be shared with your integration: open page → `⋯` → **Add connec
34
34
  - `notion append`, `notion append --after`, `notion create-page` (page parent): also need **Insert content**
35
35
  - `notion create-page --parent <db>`: also need **Insert content** + database must be shared with integration
36
36
  - `notion edit-page`: also need **Update content** + **Insert content**
37
+ - `notion attach`: also need **Insert content**
37
38
  - `notion comment`: also need **Read comments** + **Insert comments**
38
39
 
39
40
  ---
@@ -122,19 +123,26 @@ notion db create --parent <page-id|url> --title "My Database" # create a new da
122
123
  ```bash
123
124
  notion append <id|url> -m "## Heading\nParagraph text" # append markdown blocks to a page
124
125
  notion append <id|url> -m "$(cat notes.md)" # append file contents
126
+ notion append <id|url> --file screenshot.png # attach a local file
127
+ notion append <id|url> -m "See results:" --file chart.png # markdown + file attachment
128
+ notion append <id|url> --file a.png --file b.pdf # multiple files (repeatable)
125
129
 
126
130
  notion create-page --parent <page-id|url> --title "Title" # child page under a page
127
131
  notion create-page --parent <page-id|url> --title "Title" -m "# Hello" # with markdown body
128
132
  echo "# Content" | notion create-page --parent <page-id|url> --title "Title" # from stdin
133
+ notion create-page --parent <page-id|url> --title "Report" --file report.pdf # with file attachment
134
+ notion create-page --parent <page-id|url> --title "Notes" -m "# Agenda" --file slides.pdf --file notes.txt
129
135
 
130
136
  # Create entry in a database (auto-detected from parent ID)
131
137
  notion create-page --parent <db-id|url> --title "New Task"
132
138
  notion create-page --parent <db-id|url> --title "Task" --prop "Status=To Do" --prop "Priority=High"
133
139
  notion create-page --parent <db-id|url> --title "Task" --prop "Due=2026-04-01" -m "# Details"
134
140
 
135
- # Icon and cover
141
+ # Icon and cover (emoji, URL, or local file path)
136
142
  notion create-page --parent <id|url> --title "Page" --icon "🚀"
143
+ notion create-page --parent <id|url> --title "Page" --icon ./logo.png # upload local file as icon
137
144
  notion create-page --parent <id|url> --title "Page" --cover "https://example.com/img.jpg"
145
+ notion create-page --parent <id|url> --title "Page" --cover ./banner.jpg # upload local file as cover
138
146
 
139
147
  URL=$(notion create-page --parent <id|url> --title "Summary" -m "...") # capture URL
140
148
 
@@ -148,6 +156,25 @@ notion move <ids|urls...> --to <id|url> # move page
148
156
  notion move <ids|urls...> --to-db <id|url> # move pages to a database parent
149
157
  ```
150
158
 
159
+ #### File Attachments
160
+
161
+ Upload local files to Notion and attach them as blocks (image, file, PDF, audio, video). Block type is auto-detected from file extension. Files ≤20 MB upload in one request; larger files are chunked automatically.
162
+
163
+ ```bash
164
+ notion attach <id|url> screenshot.png # attach a single file
165
+ notion attach <id|url> report.pdf data.csv image.png # attach multiple files
166
+ notion attach <id|url> diagram.png --caption "Architecture diagram" # with caption
167
+ notion attach <id|url> file.svg --type image # override auto-detected type
168
+ ```
169
+
170
+ | Flag | Description |
171
+ |------|-------------|
172
+ | `--caption <text>` | Caption for the file block(s) |
173
+ | `--type <type>` | Override block type (`image\|file\|pdf\|audio\|video`) |
174
+ | `--json` | Output JSON response |
175
+
176
+ The `--file <path>` flag (repeatable) is also available on `notion append` and `notion create-page` for inline file attachment alongside markdown content.
177
+
151
178
  #### Updating Page Properties
152
179
 
153
180
  ```bash
@@ -160,7 +187,16 @@ notion update <id|url> --prop "Done=true" # checkbox (tru
160
187
  notion update <id|url> --prop "Status=" # clear a property (empty value)
161
188
  ```
162
189
 
163
- Supported types: title, rich_text, select, status, multi_select, number, checkbox, url, email, phone_number, date.
190
+ Supported types: title, rich_text, select, status, multi_select, number, checkbox, url, email, phone_number, date, files.
191
+
192
+ ```bash
193
+ # Files property — local file paths or URLs (comma-separated for multiple)
194
+ notion update <id|url> --prop "Attachments=./report.pdf" # upload local file
195
+ notion update <id|url> --prop "Attachments=https://example.com/file.pdf" # external URL
196
+ notion update <id|url> --prop "Attachments=./a.pdf,./b.png" # multiple files
197
+ ```
198
+
199
+ > **Note:** Setting a `files` property **replaces** all existing files (Notion API behavior). To keep existing files, re-include them in the value.
164
200
 
165
201
  #### Surgical Editing
166
202
 
@@ -259,6 +295,19 @@ notion move "$PAGE_ID" --to "$ARCHIVE_ID"
259
295
 
260
296
  # Move multiple pages into a database
261
297
  notion move page1-id page2-id --to-db "$DB_ID"
298
+
299
+ # Attach a generated screenshot to a documentation page
300
+ notion attach "$PAGE_ID" ./screenshot.png --caption "Current UI state"
301
+
302
+ # Create a report page with attached artifacts
303
+ notion create-page --parent "$PAGE_ID" --title "Build Report $(date +%Y-%m-%d)" \
304
+ -m "# Build Results\nAll tests passed." --file ./test-results.pdf --file ./coverage.png
305
+
306
+ # Append analysis with supporting data file
307
+ notion append "$PAGE_ID" -m "## Data Analysis\nSee attached CSV:" --file ./export.csv
308
+
309
+ # Upload a local file as icon for a page
310
+ notion update "$PAGE_ID" --icon ./logo.png
262
311
  ```
263
312
 
264
313
  ---
package/README.md CHANGED
@@ -102,6 +102,7 @@ notion ls
102
102
  | `notion comments <id\|url>` | Read page comments |
103
103
  | `notion comment [id\|url] -m <text>` | Add a comment to a page, block, or thread |
104
104
  | `notion append <id\|url> -m <markdown>` | Append markdown blocks to a page |
105
+ | `notion attach <id\|url> <file> [files...]` | Upload and attach file(s) to a page |
105
106
  | `notion edit-page <id\|url> --find <old> --replace <new>` | Search-and-replace text on a page |
106
107
  | `notion edit-page <id\|url> -m <markdown>` | Replace entire page content |
107
108
  | `notion create-page --parent <id\|url> --title <title>` | Create a new page, prints URL |
@@ -111,6 +112,29 @@ notion ls
111
112
  | `notion move <ids\|urls...> --to-db <id\|url>` | Move pages to a database parent |
112
113
  | `notion completion bash\|zsh\|fish` | Install shell tab completion |
113
114
 
115
+ ### `notion attach` flags
116
+
117
+ | Flag | Example | Description |
118
+ |------|---------|-------------|
119
+ | `--caption <text>` | `--caption "My screenshot"` | Caption for the file block(s) |
120
+ | `--type <type>` | `--type image` | Override auto-detected block type (`image\|file\|pdf\|audio\|video`) |
121
+ | `--json` | `--json` | Output JSON response |
122
+
123
+ ### `notion append` / `notion create-page` — `--file` flag
124
+
125
+ Both commands accept a repeatable `--file <path>` option to attach local files after the markdown content is written:
126
+
127
+ ```bash
128
+ # Append markdown and attach a file
129
+ notion append "$PAGE_ID" -m "See attached screenshot:" --file screenshot.png
130
+
131
+ # Create a page with an attached PDF
132
+ notion create-page --parent "$PAGE_ID" --title "Report" --file report.pdf
133
+
134
+ # Attach multiple files
135
+ notion append "$PAGE_ID" --file image.png --file data.csv
136
+ ```
137
+
114
138
  ### `notion search` / `notion ls` flags
115
139
 
116
140
  | Flag | Example | Description |
@@ -220,6 +244,7 @@ Write commands require additional capabilities — enable in your integration se
220
244
  | Command | Required capabilities |
221
245
  |---------|----------------------|
222
246
  | `notion append` | Read content, Insert content |
247
+ | `notion attach` | Read content, Insert content |
223
248
  | `notion create-page` | Read content, Insert content |
224
249
  | `notion update` | Read content, Update content |
225
250
  | `notion comment` | Read content, Insert content, Read comments, Insert comments |