@andrzejchm/notion-cli 0.4.1 → 0.6.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/dist/cli.js +419 -755
- package/dist/cli.js.map +1 -1
- package/docs/skills/using-notion-cli/SKILL.md +42 -1
- package/package.json +2 -2
|
@@ -24,7 +24,8 @@ Pages must be shared with your integration: open page → `⋯` → **Add connec
|
|
|
24
24
|
|
|
25
25
|
**Integration capabilities** (set at notion.so/profile/integrations/internal → your integration → Capabilities):
|
|
26
26
|
- Read-only commands: **Read content** only
|
|
27
|
-
- `notion append`, `notion create-page`: also need **Insert content**
|
|
27
|
+
- `notion append`, `notion append --after`, `notion create-page`: also need **Insert content**
|
|
28
|
+
- `notion edit-page`: also need **Update content** + **Insert content**
|
|
28
29
|
- `notion comment`: also need **Read comments** + **Insert comments**
|
|
29
30
|
|
|
30
31
|
---
|
|
@@ -116,6 +117,29 @@ URL=$(notion create-page --parent <id|url> --title "Summary" -m "...") # captu
|
|
|
116
117
|
notion comment <id|url> -m "Reviewed and approved." # add comment to a page
|
|
117
118
|
```
|
|
118
119
|
|
|
120
|
+
#### Surgical Editing
|
|
121
|
+
|
|
122
|
+
Insert content at a specific location or replace a targeted section instead of the whole page.
|
|
123
|
+
|
|
124
|
+
```bash
|
|
125
|
+
# Append after a matched section (inserts new blocks right after the match)
|
|
126
|
+
notion append <id|url> -m "New content" --after "## Status...end of status"
|
|
127
|
+
|
|
128
|
+
# Replace an entire page's content
|
|
129
|
+
notion edit-page <id|url> -m "# Replacement\nNew full-page content"
|
|
130
|
+
|
|
131
|
+
# Replace only a matched section (leaves the rest of the page intact)
|
|
132
|
+
notion edit-page <id|url> -m "## Updated Section\nNew text" --range "## Old Section...old last line"
|
|
133
|
+
|
|
134
|
+
# Replace a section that contains child pages/databases (requires explicit opt-in)
|
|
135
|
+
notion edit-page <id|url> -m "## Clean Slate" --range "## Archive...end" --allow-deleting-content
|
|
136
|
+
|
|
137
|
+
# Pipe replacement content from a file
|
|
138
|
+
cat updated-section.md | notion edit-page <id|url> --range "## Notes...end of notes"
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
> **Ellipsis selector format:** Both `--after` and `--range` use the same selector syntax: `"start text...end text"`. Provide ~10 characters from the beginning of the target content, three dots (`...`), then ~10 characters from the end. The selector matches the first contiguous range of blocks whose text starts with the prefix and ends with the suffix. Run `notion read <id>` first to see the exact content and pick accurate selectors.
|
|
142
|
+
|
|
119
143
|
---
|
|
120
144
|
|
|
121
145
|
## ID Formats
|
|
@@ -155,6 +179,19 @@ echo "Created: $URL"
|
|
|
155
179
|
|
|
156
180
|
# Pipe command output into a new page
|
|
157
181
|
my-report-command | notion create-page --parent "$PAGE_ID" --title "Auto Report"
|
|
182
|
+
|
|
183
|
+
# Surgically update a specific section of a page
|
|
184
|
+
# 1. Read the page to find the section boundaries
|
|
185
|
+
notion read "$PAGE_ID"
|
|
186
|
+
# 2. Identify a selector from the output, e.g. the section starts with "## Status"
|
|
187
|
+
# and ends with "Blocked: none" — build the ellipsis selector from those
|
|
188
|
+
# 3. Replace just that section
|
|
189
|
+
notion edit-page "$PAGE_ID" -m "## Status\nAll tasks complete.\nBlocked: none" \
|
|
190
|
+
--range "## Status...Blocked: none"
|
|
191
|
+
|
|
192
|
+
# Insert a new sub-section after an existing section
|
|
193
|
+
notion append "$PAGE_ID" -m "## New Sub-section\nContent here" \
|
|
194
|
+
--after "## Existing Section...last line of section"
|
|
158
195
|
```
|
|
159
196
|
|
|
160
197
|
---
|
|
@@ -174,3 +211,7 @@ my-report-command | notion create-page --parent "$PAGE_ID" --title "Auto Report"
|
|
|
174
211
|
**`notion comment` returns "Insufficient permissions"** — Enable **Read comments** + **Insert comments** in integration capabilities: notion.so/profile/integrations/internal → your integration → Capabilities.
|
|
175
212
|
|
|
176
213
|
**`notion append` / `notion create-page` returns "Insufficient permissions"** — Enable **Insert content** in integration capabilities.
|
|
214
|
+
|
|
215
|
+
**`notion edit-page` returns "Insufficient permissions"** — Enable **Update content** in integration capabilities.
|
|
216
|
+
|
|
217
|
+
**`--range` / `--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.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@andrzejchm/notion-cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"description": "Read Notion pages and databases from the terminal. Built for AI agents and developers.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"notion",
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
},
|
|
48
48
|
"dependencies": {
|
|
49
49
|
"@inquirer/prompts": "^8.3.0",
|
|
50
|
-
"@notionhq/client": "^5.
|
|
50
|
+
"@notionhq/client": "^5.11.1",
|
|
51
51
|
"chalk": "^5.6.0",
|
|
52
52
|
"commander": "^14.0.0",
|
|
53
53
|
"yaml": "^2.8.0"
|