@bitefoundry/onenote 0.2.1 → 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 CHANGED
@@ -64,6 +64,8 @@ onenote whoami --json
64
64
 
65
65
  For persistent environment configuration, set `ONENOTE_CLIENT_ID` and `ONENOTE_TENANT_ID`.
66
66
 
67
+ When supplying a token without an embedded user ID (for example an opaque `ONENOTE_ACCESS_TOKEN` or `ONENOTE_TOKEN_FILE`), run `onenote whoami` once while online to record only the token fingerprint and user ID under `identity-map/`. Running local `search` (without `--refresh`) or `--offline` with an unrecorded token returns an `Unknown identity` error instead of falling back to an empty `default` cache. Running `onenote search <query> --refresh` also records the identity binding. Whenever the token rotates or changes, run `onenote whoami` once again for the new token.
68
+
67
69
  ---
68
70
 
69
71
  ## Keybindings Cheat Sheet
@@ -97,7 +99,7 @@ onenote pages "Acme Engineering/Architecture" --json
97
99
  onenote rename-section 'me|SECTION_ID' --name 'Architecture Notes' --json
98
100
  onenote rename-notebook --drive-id DRIVE_ID --item-id ITEM_ID --name 'Engineering Notes' --json
99
101
  onenote read "Q4 Architecture RFC" --json
100
- onenote read "Q4 Architecture RFC" --json --compact
102
+ onenote read "Q4 Architecture RFC" --json --full
101
103
  onenote copy-page 'me|PAGE_ID' --section 'me|SECTION_ID' --json
102
104
  onenote create "Architecture" --title "Release Notes" '## Shipped
103
105
  - [x] WAL pool' --json
@@ -105,6 +107,10 @@ onenote check "Migration Cutover" --block-id 'p:m3' --done --json
105
107
  onenote search "canary" --json
106
108
  ```
107
109
 
110
+ `onenote read PAGE --json` returns compact Markdown and identifiers by default; pass `--full` for parsed blocks, raw XHTML, and resources. Passing an explicit `--format <fmt> --json` returns the full JSON page, and adding `--compact` selects the compact shape.
111
+
112
+ `onenote notebooks --json` and `onenote sections --json` return 50 items by default (text output stays unbounded unless `--limit` is passed); `pages` defaults to 50 and `search` defaults to 30. All four JSON list responses include `returned`, `has_more`, and `next_cursor`, which can be passed back with `--limit` and `--cursor` to page through results.
113
+
108
114
  Use `onenote read PAGE --format blocks` to find a checkbox or text block's current element ID. Use `--done` or `--undone` to set a checkbox state. Omit both flags to toggle it.
109
115
 
110
116
  `copy-page` uses Microsoft Graph to create a new page in the destination section and preserves the original page and its links. If the copy is still pending, pass its `operation_url` with `--operation` to check the same copy. [Copy a page](docs/API.md#copy-a-page)
package/docs/API.md CHANGED
@@ -27,19 +27,19 @@ All OneNote endpoints are served under both `/v1/onenote/...` and the shorter `/
27
27
  | --- | --- | --- |
28
28
  | `GET` | `/health` | Health check (`{ ok, service, version }`) |
29
29
  | `GET` | `/v1/whoami` | Signed-in Microsoft 365 user profile |
30
- | `GET` | `/v1/onenote/notebooks` | List notebooks (`?include_teams=true&refresh=false&offline=false`) |
30
+ | `GET` | `/v1/onenote/notebooks` | List notebooks (`?include_teams=false&refresh=false&offline=false`) |
31
31
  | `POST` | `/v1/onenote/notebooks` | Create notebook (`{ name, group_id?, site_id? }`) |
32
32
  | `GET` | `/v1/onenote/sections` | List sections (`?notebook=...&refresh=false&offline=false`) |
33
33
  | `POST` | `/v1/onenote/sections` | Create section (`{ notebook, name }`) |
34
34
  | `GET` | `/v1/onenote/pages` | List pages in a section (`?section=...&limit=50&refresh=false&offline=false`) |
35
35
  | `POST` | `/v1/onenote/pages` | Create a top-level page (`{ section, title, markdown?, level?, image_paths? }`). `level` defaults to 0. |
36
- | `GET` | `/v1/onenote/pages/{page}` | Get structured page detail (`?section=...&refresh=false&offline=false`) |
36
+ | `GET` | `/v1/onenote/pages/{page}` | Get structured page detail (`?section=...&offline=false`) |
37
37
  | `PATCH` | `/v1/onenote/pages/{page}` | Update block or page (`{ block_id?, title?, markdown?, section? }`) |
38
38
  | `DELETE` | `/v1/onenote/pages/{page}` | Delete page (`?section=...`) |
39
- | `POST` | `/v1/onenote/pages/{page}/append` | Append Markdown/images (`{ markdown, images?, section? }`) |
40
- | `POST` | `/v1/onenote/pages/{page}/todo` | Toggle checkbox (`{ block_id, completed?, section? }`) |
41
- | `GET` | `/v1/onenote/search` | Search local FTS5 cache (`?q=...&section=...&limit=20&refresh=false`) |
42
- | `POST` | `/v1/onenote/resources/download` | Download embedded resource (`{ page, index?, url?, out?, section? }`) |
39
+ | `POST` | `/v1/onenote/pages/{page}/append` | Append Markdown/images (`{ markdown, images? \| image_paths?, section? }`) |
40
+ | `POST` | `/v1/onenote/pages/{page}/todo` | Set or toggle checkbox (`{ block_id?, index?, completed?, expected_content?, force?, section? }`; alias: `/pages/{page}/toggle-todo`) |
41
+ | `GET` | `/v1/onenote/search` | Search local FTS5 cache (`?q=...&section=...&limit=30&refresh=false`) |
42
+ | `POST` | `/v1/onenote/resources/download` | Download embedded resource (`{ page, index?, url?, out? \| out_dir?, section? }`; alias: `/pages/{page}/resources/download`) |
43
43
 
44
44
  ### Resource Download Response
45
45
 
@@ -111,4 +111,4 @@ onenote desktop-rename-section 'FULL_DESKTOP_SECTION_ID' --name 'Engineering Not
111
111
 
112
112
  Use levels 0, 1 and 2 for top-level pages and the two levels of subpages. A level update sends the page's ID and level and verifies the resulting level and original parent section. A section rename verifies the section ID, parent and name. The desktop Move workflow provides no documented Graph page-ID guarantee. [OneNote COM application interface](https://learn.microsoft.com/en-us/office/client-developer/onenote/application-interface-onenote) · [Hierarchy and XML schema enumerations](https://learn.microsoft.com/en-us/office/client-developer/onenote/enumerations-onenote-developer-reference)
113
113
 
114
- After a native hierarchy edit, wait for OneNote to sync. Use `onenote read PAGE --json` or MCP `get_page` to compare `summary.id`, `section_id`, `notebook_id`, `level`, and `raw_xhtml` with a previous read. Refresh hierarchy lists with `--refresh` and re-download referenced resources when binary preservation matters.
114
+ After a native hierarchy edit, wait for OneNote to sync. Use `onenote read PAGE --json --full` or MCP `get_page` with `compact: false` to compare `summary.id`, `section_id`, `notebook_id`, `level`, and `raw_xhtml` with a previous read. Refresh hierarchy lists with `--refresh` and re-download referenced resources when binary preservation matters.
package/docs/MCP.md CHANGED
@@ -35,10 +35,10 @@ If installed via `npx`:
35
35
  | Tool | Description | Key Parameters |
36
36
  | --- | --- | --- |
37
37
  | `whoami` | Return signed-in Microsoft 365 profile & auth mode | _(none)_ |
38
- | `list_notebooks` | List accessible OneNote notebooks (personal, Teams/Group, SharePoint) | `include_teams?`, `refresh?`, `offline?` |
39
- | `list_sections` | List sections in a notebook or across all notebooks | `notebook?`, `refresh?`, `offline?` |
40
- | `list_pages` | List pages in a section (supports `Notebook/Section`, name, or ID) | `section` (required), `limit?`, `refresh?`, `offline?` |
41
- | `get_page` | Read Markdown and page metadata, with XHTML, blocks and resources in the default response | `page` (required), `compact?`, `offline?` |
38
+ | `list_notebooks` | List accessible OneNote notebooks (personal, Teams/Group, SharePoint) | `include_teams?`, `limit?`, `cursor?`, `refresh?`, `offline?` |
39
+ | `list_sections` | List sections in a notebook or across all notebooks | `notebook?`, `limit?`, `cursor?`, `refresh?`, `offline?` |
40
+ | `list_pages` | List pages in a section (supports `Notebook/Section`, name, or ID) | `section` (required), `limit?`, `cursor?`, `refresh?`, `offline?` |
41
+ | `get_page` | Read compact Markdown and identifiers; pass compact: false for XHTML, blocks and resources | `page` (required), `compact?`, `offline?` |
42
42
  | `create_notebook` | Create a new OneNote notebook | `name` (required), `group_id?`, `site_id?` |
43
43
  | `rename_notebook` | Rename a OneNote notebook package by explicit storage IDs | `drive_id`, `item_id`, `name` (all required) |
44
44
  | `create_section` | Create a new section inside a notebook | `notebook` (required), `name` (required) |
@@ -51,12 +51,18 @@ If installed via `npx`:
51
51
  | `update_block`, `update_page` | Replace a block, edit its text, or update the page title/body | `page` (required), `block_id?`, `title?`, `markdown?`, `replace_text?`, `with_text?`, `expected_content?`, `force?` |
52
52
  | `toggle_todo` | Set or toggle a checkbox by element ID or zero-based index | `page` (required), `block_id?`, `todo_index?`, `completed?`, `expected_content?`, `force?` |
53
53
  | `delete_page` | Permanently delete a OneNote page | `page` (required), `confirm: true` (required) |
54
- | `search_pages` | Full-text search across locally cached OneNote pages (SQLite FTS5) | `query` (required), `section?`, `limit?`, `refresh?` |
54
+ | `search_pages` | Full-text search across locally cached OneNote pages (SQLite FTS5) | `query` (required), `section?`, `limit?`, `cursor?`, `refresh?` |
55
55
  | `download_resource` | Download an embedded OneNote image or file attachment to disk | `page` (required), `index?`, `out_dir?` |
56
56
 
57
+ The server resolves the signed-in account and local cache on the first `tools/call`; `initialize`, `ping`, and `tools/list` respond without contacting Graph or selecting a cache.
58
+
57
59
  ### Page reads and writes
58
60
 
59
- Pass `compact: true` to `get_page` for `page.id`, `page.title`, `page.last_modified_at` and `page.body_markdown`. Read without `compact` to find `page.blocks[].element_id`, or inspect `page.raw_xhtml`. Use current element IDs for block writes. Both `update_block` and its `update_page` alias appear in `tools/list`.
61
+ `get_page` returns the compact page by default, including `page.page_key`, `page.scope`, `page.omitted`, and `page.hint`. Pass `compact: false` to read `page.blocks[].element_id`, `page.raw_xhtml`, and `page.resources`. Write tools (`append_page`, `update_block`, `update_page`, `toggle_todo`) always return the full `page` object. Use current element IDs for block writes. Both `update_block` and its `update_page` alias appear in `tools/list`.
62
+
63
+ ### List paging
64
+
65
+ `list_notebooks` and `list_sections` return up to 50 items by default (`limit` range `1`–`1000`); `list_pages` defaults to 50 and `search_pages` defaults to 30. All four responses include `returned`, `has_more`, and `next_cursor` (pass `next_cursor` back as `cursor` to read the next page). When called with `offline: true`, `list_notebooks`, `list_sections`, and `list_pages` also include `cache_synced_at` (an RFC 3339 timestamp string, or `null` when the cache has never been synced). `search_pages` includes `cache: { pages, pages_with_body }` to show how many cached pages exist and how many have hydrated bodies.
60
66
 
61
67
  `rename_section` takes the section's current ID from `list_sections`. `rename_notebook` takes the current DriveItem ID and requires a delegated file-write token. The desktop tools use the Windows app's object IDs from `GetHierarchy`. [Hierarchy operations and permissions](API.md#hierarchy-operations)
62
68
 
package/docs/NPM.md CHANGED
@@ -32,7 +32,7 @@ terminal image preview (`Kitty` / `iTerm2` / `Sixel` / `Halfblock` via `onenote
32
32
  and the interactive TUI).
33
33
 
34
34
  - `onenote login`, `onenote logout`, `onenote whoami`, `onenote doctor --online`
35
- - `onenote notebooks`, `onenote sections [notebook]`, `onenote pages <section>`, `onenote read <page> [--json [--compact]]`
35
+ - `onenote notebooks [--limit N] [--cursor N]`, `onenote sections [notebook] [--limit N] [--cursor N]`, `onenote pages <section> [--limit N] [--cursor N]`, `onenote read <page> [--json [--full]]`
36
36
  - `onenote create-notebook <name>`, `onenote create-section <notebook> <name>`
37
37
  - `onenote rename-section <section-id> --name <new-name> [--json]`
38
38
  - `onenote rename-notebook --drive-id <drive-id> --item-id <item-id> --name <name> [--json]`
@@ -41,7 +41,7 @@ and the interactive TUI).
41
41
  - `onenote append <page> [markdown] [--file <file>] [--image <path>]`
42
42
  - `onenote update <page> [--title <title>] [--body <markdown> | --file <file>] [--block-id <id>]`
43
43
  - `onenote check <page> [--block-id <id> | --index <n>] [--done | --undone]`, `onenote delete <page> --yes`
44
- - `onenote search <query>`, `onenote resource <page> [--index <n>] [--out <directory>]`
44
+ - `onenote search <query> [--limit N] [--cursor N]`, `onenote resource <page> [--index <n>] [--out <directory>]`
45
45
  - `onenote sync`, `onenote daemon <start|status|stop|restart|run>`, `onenote tui`, `onenote serve`, `onenote mcp`, `onenote preview-file <path>`, `onenote self-update`
46
46
 
47
47
  ```sh
package/docs/openapi.yaml CHANGED
@@ -46,7 +46,7 @@ paths:
46
46
  parameters:
47
47
  - name: include_teams
48
48
  in: query
49
- schema: { type: boolean, default: true }
49
+ schema: { type: boolean, default: false }
50
50
  - name: refresh
51
51
  in: query
52
52
  schema: { type: boolean, default: false }
@@ -168,9 +168,6 @@ paths:
168
168
  - name: section
169
169
  in: query
170
170
  schema: { type: string }
171
- - name: refresh
172
- in: query
173
- schema: { type: boolean, default: false }
174
171
  - name: offline
175
172
  in: query
176
173
  schema: { type: boolean, default: false }
@@ -237,13 +234,19 @@ paths:
237
234
  images:
238
235
  type: array
239
236
  items: { type: string }
237
+ description: Alias of `image_paths` (do not send both keys in the same request).
238
+ image_paths:
239
+ type: array
240
+ items: { type: string }
240
241
  section: { type: string }
241
242
  responses:
242
243
  '200':
243
244
  description: Updated page detail
245
+ '400':
246
+ description: Invalid input, including specifying both `images` and `image_paths`
244
247
  /v1/onenote/pages/{page}/todo:
245
248
  post:
246
- summary: Toggle or set a OneNote checkbox on a block
249
+ summary: Set or toggle a OneNote checkbox on a block (also served at `/pages/{page}/toggle-todo`)
247
250
  security:
248
251
  - bearerAuth: []
249
252
  parameters:
@@ -257,10 +260,12 @@ paths:
257
260
  application/json:
258
261
  schema:
259
262
  type: object
260
- required: [block_id]
261
263
  properties:
262
264
  block_id: { type: string }
265
+ index: { type: integer, minimum: 0 }
263
266
  completed: { type: boolean }
267
+ expected_content: { type: string }
268
+ force: { type: boolean, default: false }
264
269
  section: { type: string }
265
270
  responses:
266
271
  '200':
@@ -280,7 +285,7 @@ paths:
280
285
  schema: { type: string }
281
286
  - name: limit
282
287
  in: query
283
- schema: { type: integer, default: 20 }
288
+ schema: { type: integer, default: 30 }
284
289
  - name: refresh
285
290
  in: query
286
291
  schema: { type: boolean, default: false }
@@ -289,7 +294,7 @@ paths:
289
294
  description: Search hits
290
295
  /v1/onenote/resources/download:
291
296
  post:
292
- summary: Download an embedded OneNote image or file attachment
297
+ summary: Download an embedded OneNote image or file attachment (also served at `/pages/{page}/resources/download`)
293
298
  security:
294
299
  - bearerAuth: []
295
300
  requestBody:
@@ -301,9 +306,10 @@ paths:
301
306
  required: [page]
302
307
  properties:
303
308
  page: { type: string }
304
- index: { type: integer }
309
+ index: { type: integer, minimum: 0 }
305
310
  url: { type: string }
306
311
  out: { type: string }
312
+ out_dir: { type: string }
307
313
  section: { type: string }
308
314
  responses:
309
315
  '200':
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bitefoundry/onenote",
3
- "version": "0.2.1",
3
+ "version": "0.3.0",
4
4
  "description": "Microsoft OneNote terminal client & AI agent toolkit — Notebooks, Sections, Pages, XHTML/Markdown & Resources (CLI, TUI, HTTP API, MCP)",
5
5
  "repository": {
6
6
  "type": "git",
@@ -40,11 +40,11 @@
40
40
  "build:npm": "node scripts/build-npm.mjs"
41
41
  },
42
42
  "optionalDependencies": {
43
- "@bitefoundry/onenote-win32-x64": "0.2.1",
44
- "@bitefoundry/onenote-win32-arm64": "0.2.1",
45
- "@bitefoundry/onenote-darwin-x64": "0.2.1",
46
- "@bitefoundry/onenote-darwin-arm64": "0.2.1",
47
- "@bitefoundry/onenote-linux-x64": "0.2.1",
48
- "@bitefoundry/onenote-linux-arm64": "0.2.1"
43
+ "@bitefoundry/onenote-win32-x64": "0.3.0",
44
+ "@bitefoundry/onenote-win32-arm64": "0.3.0",
45
+ "@bitefoundry/onenote-darwin-x64": "0.3.0",
46
+ "@bitefoundry/onenote-darwin-arm64": "0.3.0",
47
+ "@bitefoundry/onenote-linux-x64": "0.3.0",
48
+ "@bitefoundry/onenote-linux-arm64": "0.3.0"
49
49
  }
50
50
  }