@bitefoundry/onenote 0.1.3 → 0.2.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/docs/NPM.md CHANGED
@@ -1,142 +1,172 @@
1
- # npm distribution
2
-
3
- `@bitefoundry/onenote` is distributed on npm as a small JavaScript launcher plus one
4
- optional dependency per platform. The launcher resolves the prebuilt Rust binary
5
- and execs it directly (with `scripts/postinstall.mjs` linking the native binary
6
- into `bin/` and Windows shims for zero-Node-startup execution), so there is no
7
- compiler, Node native addon, or network download during install.
8
-
9
- The Rust crate is named `onenote-cli` and produces the standalone **Microsoft OneNote**
10
- binary (`onenote` / `onenote.exe`). The npm package is scoped as `@bitefoundry/onenote`
11
- and installs both **`onenote`** and the short alias **`note`**.
12
-
13
- ## Install and run
14
-
15
- ```sh
16
- # one-off
17
- npx @bitefoundry/onenote --version
18
-
19
- # global install (installs `onenote` and `note`)
20
- npm install -g @bitefoundry/onenote
21
- onenote --version
22
- note --version
23
-
24
- # project-local
25
- npm install @bitefoundry/onenote
26
- npx onenote notebooks
27
- ```
28
-
29
- All workflows share the same Microsoft Entra ID login (or automatic M365 shared-session
30
- bootstrap from `teams-cli` / `outlook-cli`), SQLite WAL + FTS5 cache (`cache.db`),
31
- background sync daemon (`onenote daemon start | status | stop | restart`), local HTTP API
32
- (`onenote serve`, default `127.0.0.1:8788`), MCP server (`onenote mcp`), and multi-protocol
33
- terminal image preview (`Kitty` / `iTerm2` / `Sixel` / `Halfblock` via `onenote preview-file`
34
- and the interactive TUI).
35
-
36
- - `onenote login`, `onenote logout`, `onenote whoami`, `onenote doctor --online`
37
- - `onenote notebooks`, `onenote sections [notebook]`, `onenote pages <section>`, `onenote read <page>`
38
- - `onenote create-notebook <name>`, `onenote create-section <notebook> <name>`
39
- - `onenote create <section> <title> [--body ...] [--image ...] [--level 0|1|2]`
40
- - `onenote append <page> [--body ...] [--image ...]`
41
- - `onenote update <page> [--block-id <id> --body ...] [--title ...] [--body ...]`
42
- - `onenote check <page> <block-id> [--done | --undone]`, `onenote delete <page>`
43
- - `onenote search <query>`, `onenote resource <page> [index] [--out ...]`
44
- - `onenote sync`, `onenote daemon <start|status|stop|restart|run>`, `onenote tui`, `onenote serve`, `onenote mcp`, `onenote preview-file <path>`, `onenote self-update`
45
-
46
- ## Supported platforms
47
-
48
- | npm package | OS | CPU | Rust target |
49
- | ------------------------------- | ------- | ----- | ----------------------------------- |
50
- | `@bitefoundry/onenote-win32-x64` | Windows | x64 | `x86_64-pc-windows-msvc` |
51
- | `@bitefoundry/onenote-win32-arm64` | Windows | arm64 | `aarch64-pc-windows-msvc` |
52
- | `@bitefoundry/onenote-darwin-x64` | macOS | x64 | `x86_64-apple-darwin` |
53
- | `@bitefoundry/onenote-darwin-arm64` | macOS | arm64 | `aarch64-apple-darwin` |
54
- | `@bitefoundry/onenote-linux-x64` | Linux | x64 | `x86_64-unknown-linux-gnu` (2.28) |
55
- | `@bitefoundry/onenote-linux-arm64` | Linux | arm64 | `aarch64-unknown-linux-gnu` (2.28) |
56
-
57
- Linux packages are cross-compiled in CI with `cargo-zigbuild` against **GLIBC 2.28** (`*.2.28`)
58
- and verified with `scripts/verify-glibc.mjs` plus an `almalinux:8` container smoke test, so
59
- prebuilt binaries run out of the box on **AlmaLinux 8 / RHEL 8+ / Rocky Linux 8+ / Ubuntu 20.04+ / Debian 10+**.
60
- Older glibc distributions (e.g., CentOS 7 with `GLIBC < 2.28`) and Alpine/musl Linux should
61
- build from source with Cargo (`cargo build --release`).
62
-
63
- ## How resolution works
64
-
65
- `bin/onenote.js` and `bin/note.js` look up `@bitefoundry/onenote-<platform>-<arch>` through
66
- `require.resolve`, then execute `node_modules/@bitefoundry/onenote-<platform>-<arch>/bin/onenote`
67
- (or `onenote.exe` on Windows) with `stdio: 'inherit'`. On `npm install`, `scripts/postinstall.mjs`
68
- additionally links the native binary directly for zero-Node-startup execution.
69
- Signals (`SIGINT`, `SIGTERM`, `SIGHUP`) are forwarded and the launcher exits with the child's
70
- exit code. If the platform package is missing, the launcher prints the supported platforms
71
- and the `--include=optional` hint instead of a stack trace.
72
-
73
- ## Layout
74
-
75
- ```
76
- package.json # @bitefoundry/onenote launcher package (bin: onenote, note)
77
- bin/onenote.js # onenote launcher
78
- bin/note.js # note shorthand launcher
79
- scripts/postinstall.mjs # zero-Node native binary linker on npm install
80
- npm/onenote-<platform>/ # one package per platform
81
- package.json # os/cpu/files, same version as root
82
- bin/onenote[.exe] # added by scripts/build-npm.mjs, never committed
83
- scripts/build-npm.mjs # copy target/<triple>/release/onenote[.exe]
84
- scripts/sync-version.mjs # Cargo.toml version -> all package.json files
85
- scripts/verify-glibc.mjs # verify Linux ELF GLIBC <= 2.28 symbol ceiling
86
- .github/workflows/release.yml # tag-triggered build, publish, GitHub Release
87
- ```
88
-
89
- ## Versioning
90
-
91
- `Cargo.toml` (`[package].version`) is the single source of truth. To bump:
92
-
93
- ```sh
94
- # edit Cargo.toml [package].version
95
- node scripts/sync-version.mjs
96
- node scripts/sync-version.mjs --check
97
- ```
98
-
99
- ## External token brokers, M365 bootstrap & token scopes
100
-
101
- ### Required Microsoft Graph delegated scopes
102
-
103
- `offline_access`, `User.Read`, `Notes.Read`, `Notes.ReadWrite`, `Notes.Create`
104
-
105
- Run `onenote whoami` or `onenote doctor` to inspect JWT `scp`/`roles` claims automatically.
106
-
107
- ### `config.toml` (recommended persistent setup)
108
-
109
- ```toml
110
- # Windows: %APPDATA%\onenote-cli\config.toml
111
- # Linux/macOS: ~/.config/onenote-cli/config.toml
112
- token_file = "~/.cursor/tc-auth/access_token"
113
- token_refresh_cmd = "python ~/.cursor/tc-auth/graph-auth.py refresh"
114
- token_refresh_mins = 5
115
- ```
116
-
117
- ### Key environment variables
118
-
119
- | Variable | Summary |
120
- | --- | --- |
121
- | `ONENOTE_ACCESS_TOKEN` | Static Bearer token override (automatically skips OS keyring) |
122
- | `ONENOTE_TOKEN_FILE` | External token file path (raw JWT or JSON; skips OS keyring) |
123
- | `ONENOTE_TOKEN_REFRESH_CMD` | Shell command run to refresh expiring/`401` tokens |
124
- | `ONENOTE_TOKEN_REFRESH_MINS` | Refresh lead window in minutes before expiry (default `5`) |
125
- | `ONENOTE_SHARE_M365_AUTH` | Share/bootstrap M365 token session from `TEAMS_TOKEN_FILE` or `teams-cli` (default `true`) |
126
- | `ONENOTE_DISABLE_KEYRING=1` | Disable OS keyring and use `credentials.json` only |
127
- | `ONENOTE_CLIENT_ID` | Override Entra ID application client ID (falls back to `TEAMS_CLIENT_ID`, `AZURE_CLIENT_ID`) |
128
- | `ONENOTE_TENANT_ID` | Override Entra ID tenant ID (default `common`; falls back to `TEAMS_TENANT_ID`, `AZURE_TENANT_ID`) |
129
- | `ONENOTE_CONFIG_DIR` | Override config/credentials directory |
130
- | `ONENOTE_DATA_DIR` | Override SQLite cache (`cache.db`) directory |
131
- | `ONENOTE_NO_BROWSER` | Disable automatic browser launch during login (`1` / `true`) |
132
- | `ONENOTE_AUTO_DAEMON` | Auto-start/attach to the background sync daemon (`1` / `true`, default `false`) |
133
- | `ONENOTE_IMAGE_PROTOCOL` | Terminal image protocol override (`auto`, `kitty`, `iterm2`, `sixel`, `halfblock`) |
134
- | `ONENOTE_GITHUB_REPO` | Override GitHub `owner/repo` used by `onenote self-update` (default `BiteFoundry/onenote`) |
135
- | `ONENOTE_GITHUB_TOKEN` | GitHub token for private release checks in `onenote self-update` |
136
-
137
- ## Troubleshooting
138
-
139
- - **`no prebuilt binary found for <platform>-<arch>`** — reinstall with
140
- `npm install -g @bitefoundry/onenote --include=optional`.
141
- - **Older Linux (`GLIBC < 2.28`) or Alpine/musl Linux** — build from source with Cargo (`cargo build --release`).
142
- - **Verify the binary** — `node -p "require.resolve('@bitefoundry/onenote-win32-x64/package.json')"` (adjust for your platform).
1
+ # npm distribution
2
+
3
+ `@bitefoundry/onenote` is distributed on npm as a small JavaScript launcher plus one
4
+ optional dependency per platform. The launcher resolves the prebuilt Rust binary
5
+ and execs it directly (with `scripts/postinstall.mjs` linking the native binary
6
+ into `bin/` and Windows shims for zero-Node-startup execution), so there is no
7
+ compiler, Node native addon, or network download during install.
8
+
9
+ The Rust crate is named `onenote-cli` and produces the standalone **Microsoft OneNote**
10
+ binary (`onenote` / `onenote.exe`). The npm package `@bitefoundry/onenote` installs the `onenote` command.
11
+
12
+ ## Install and run
13
+
14
+ ```sh
15
+ # one-off
16
+ npx @bitefoundry/onenote --version
17
+
18
+ # global install
19
+ npm install -g @bitefoundry/onenote
20
+ onenote --version
21
+
22
+ # project-local
23
+ npm install @bitefoundry/onenote
24
+ npx onenote notebooks
25
+ ```
26
+
27
+ All workflows share the same Microsoft Entra ID login (or automatic M365 shared-session
28
+ bootstrap from `teams-cli` / `outlook-cli`), SQLite WAL + FTS5 cache (`cache.db`),
29
+ background sync daemon (`onenote daemon start | status | stop | restart`), local HTTP API
30
+ (`onenote serve`, default `127.0.0.1:8793`), MCP server (`onenote mcp`), and multi-protocol
31
+ terminal image preview (`Kitty` / `iTerm2` / `Sixel` / `Halfblock` via `onenote preview-file`
32
+ and the interactive TUI).
33
+
34
+ - `onenote login`, `onenote logout`, `onenote whoami`, `onenote doctor --online`
35
+ - `onenote notebooks`, `onenote sections [notebook]`, `onenote pages <section>`, `onenote read <page> [--json [--compact]]`
36
+ - `onenote create-notebook <name>`, `onenote create-section <notebook> <name>`
37
+ - `onenote rename-section <section-id> --name <new-name> [--json]`
38
+ - `onenote rename-notebook --drive-id <drive-id> --item-id <item-id> --name <name> [--json]`
39
+ - Windows `onenote desktop-set-page-level <desktop-page-id> --level <0|1|2> [--json]` and `onenote desktop-rename-section <desktop-section-id> --name <name> [--json]`
40
+ - `onenote create <section> --title <title> [markdown] [--file <file>] [--image <path>] [--level 0]`
41
+ - `onenote append <page> [markdown] [--file <file>] [--image <path>]`
42
+ - `onenote update <page> [--title <title>] [--body <markdown> | --file <file>] [--block-id <id>]`
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>]`
45
+ - `onenote sync`, `onenote daemon <start|status|stop|restart|run>`, `onenote tui`, `onenote serve`, `onenote mcp`, `onenote preview-file <path>`, `onenote self-update`
46
+
47
+ ```sh
48
+ onenote append 'me|PAGE_ID' 'Evidence' --json
49
+ onenote resource 'me|PAGE_ID' --index 0 --out ./downloads --json
50
+ onenote read 'me|PAGE_ID' --format blocks
51
+ onenote update 'me|PAGE_ID' --block-id 'p:{ELEMENT_ID}' --replace-text READY --with-text APPROVED
52
+ onenote update 'me|PAGE_ID' --block-id 'p:{ELEMENT_ID}' --body '**Approval complete**'
53
+ ```
54
+
55
+ Use `--replace-text` and `--with-text` to change one exact substring in a block's text while keeping its XHTML markup. Use `--body` with `--block-id` to replace the entire block with Markdown. Page-wide `--body` updates on pages with multiple regions require text changes that can be matched to current elements. Use `append` to add content to the primary region.
56
+
57
+ Graph creates a top-level page. Windows desktop commands can promote or indent an existing page. Use the OneNote app's **Move** command to move a page. [Hierarchy operations and permissions](API.md#hierarchy-operations)
58
+
59
+ ## Upgrade scripts and clients
60
+
61
+ Replace the previous `note` alias with `onenote` in scripts.
62
+
63
+ ```sh
64
+ # Previous invocation
65
+ note notebooks --json
66
+
67
+ # Current invocation
68
+ onenote notebooks --json
69
+ ```
70
+
71
+ In your MCP configuration, change `{"command":"note","args":["mcp"]}` to `{"command":"onenote","args":["mcp"]}`. If you installed the PowerShell profile launcher, rerun `scripts/install-profile.ps1` and restart the shell to load the updated profile.
72
+
73
+ npm removes the previous package's global `note` launcher during an upgrade. If you manually replaced that file with another program's launcher, move it to a separate `PATH` directory before upgrading.
74
+
75
+ Change HTTP clients from `http://127.0.0.1:8788` to `http://127.0.0.1:8793` to use the new default. To keep an existing client on port `8788`, run `onenote serve --port 8788` when that port is available. Teams uses `8788` by default.
76
+
77
+ ## Supported platforms
78
+
79
+ | npm package | OS | CPU | Rust target |
80
+ | ------------------------------- | ------- | ----- | ----------------------------------- |
81
+ | `@bitefoundry/onenote-win32-x64` | Windows | x64 | `x86_64-pc-windows-msvc` |
82
+ | `@bitefoundry/onenote-win32-arm64` | Windows | arm64 | `aarch64-pc-windows-msvc` |
83
+ | `@bitefoundry/onenote-darwin-x64` | macOS | x64 | `x86_64-apple-darwin` |
84
+ | `@bitefoundry/onenote-darwin-arm64` | macOS | arm64 | `aarch64-apple-darwin` |
85
+ | `@bitefoundry/onenote-linux-x64` | Linux | x64 | `x86_64-unknown-linux-gnu` (2.28) |
86
+ | `@bitefoundry/onenote-linux-arm64` | Linux | arm64 | `aarch64-unknown-linux-gnu` (2.28) |
87
+
88
+ Linux packages are cross-compiled in CI with `cargo-zigbuild` against **GLIBC 2.28** (`*.2.28`)
89
+ and verified with `scripts/verify-glibc.mjs` plus an `almalinux:8` container smoke test, so
90
+ prebuilt binaries run out of the box on **AlmaLinux 8 / RHEL 8+ / Rocky Linux 8+ / Ubuntu 20.04+ / Debian 10+**.
91
+ Older glibc distributions (e.g., CentOS 7 with `GLIBC < 2.28`) and Alpine/musl Linux should
92
+ build from source with Cargo (`cargo build --release`).
93
+
94
+ ## How resolution works
95
+
96
+ `bin/onenote.js` looks up `@bitefoundry/onenote-<platform>-<arch>` through
97
+ `require.resolve`, then execute `node_modules/@bitefoundry/onenote-<platform>-<arch>/bin/onenote`
98
+ (or `onenote.exe` on Windows) with `stdio: 'inherit'`. On `npm install`, `scripts/postinstall.mjs`
99
+ additionally links the native binary directly for zero-Node-startup execution.
100
+ Signals (`SIGINT`, `SIGTERM`, `SIGHUP`) are forwarded and the launcher exits with the child's
101
+ exit code. If the platform package is missing, the launcher prints the supported platforms
102
+ and the `--include=optional` hint instead of a stack trace.
103
+
104
+ ## Layout
105
+
106
+ ```
107
+ package.json # @bitefoundry/onenote launcher package (bin: onenote)
108
+ bin/onenote.js # onenote launcher
109
+ scripts/postinstall.mjs # zero-Node native binary linker on npm install
110
+ npm/onenote-<platform>/ # one package per platform
111
+ package.json # os/cpu/files, same version as root
112
+ bin/onenote[.exe] # added by scripts/build-npm.mjs, never committed
113
+ scripts/build-npm.mjs # copy target/<triple>/release/onenote[.exe]
114
+ scripts/sync-version.mjs # Cargo.toml version -> all package.json files
115
+ scripts/verify-glibc.mjs # verify Linux ELF GLIBC <= 2.28 symbol ceiling
116
+ .github/workflows/release.yml # tag-triggered build, publish, GitHub Release
117
+ ```
118
+
119
+ ## Versioning
120
+
121
+ `Cargo.toml` (`[package].version`) is the single source of truth. To bump:
122
+
123
+ ```sh
124
+ # edit Cargo.toml [package].version
125
+ node scripts/sync-version.mjs
126
+ node scripts/sync-version.mjs --check
127
+ ```
128
+
129
+ ## External token brokers, M365 bootstrap & token scopes
130
+
131
+ ### Microsoft Graph delegated scopes
132
+
133
+ Basic sign-in requests `offline_access`, `User.Read`, `Notes.Read`, `Notes.ReadWrite`, and `Notes.Create`. A company tenant sign-in also requests `Notes.Read.All`, `Notes.ReadWrite.All`, and `Team.ReadBasic.All`. [Company-managed sign-in and permissions](../README.md#company-managed-microsoft-entra-sign-in)
134
+
135
+ Run `onenote whoami` or `onenote doctor` to inspect JWT `scp`/`roles` claims automatically.
136
+
137
+ ### `config.toml` (recommended persistent setup)
138
+
139
+ ```toml
140
+ # Windows: %APPDATA%\onenote-cli\config.toml
141
+ # Linux/macOS: ~/.config/onenote-cli/config.toml
142
+ token_file = "~/.cursor/tc-auth/access_token"
143
+ token_refresh_cmd = "python ~/.cursor/tc-auth/graph-auth.py refresh"
144
+ token_refresh_mins = 5
145
+ ```
146
+
147
+ ### Key environment variables
148
+
149
+ | Variable | Summary |
150
+ | --- | --- |
151
+ | `ONENOTE_ACCESS_TOKEN` | Static Bearer token override (automatically skips OS keyring) |
152
+ | `ONENOTE_TOKEN_FILE` | External token file path (raw JWT or JSON; skips OS keyring) |
153
+ | `ONENOTE_TOKEN_REFRESH_CMD` | Shell command run to refresh expiring/`401` tokens |
154
+ | `ONENOTE_TOKEN_REFRESH_MINS` | Refresh lead window in minutes before expiry (default `5`) |
155
+ | `ONENOTE_SHARE_M365_AUTH` | Share/bootstrap M365 token session from `TEAMS_TOKEN_FILE` or `teams-cli` (default `true`) |
156
+ | `ONENOTE_DISABLE_KEYRING=1` | Disable OS keyring and use `credentials.json` only |
157
+ | `ONENOTE_CLIENT_ID` | Override Entra ID application client ID (falls back to `TEAMS_CLIENT_ID`, `AZURE_CLIENT_ID`) |
158
+ | `ONENOTE_TENANT_ID` | Override Entra ID tenant ID (default `common`; falls back to `TEAMS_TENANT_ID`, `AZURE_TENANT_ID`) |
159
+ | `ONENOTE_CONFIG_DIR` | Override config/credentials directory |
160
+ | `ONENOTE_DATA_DIR` | Override SQLite cache (`cache.db`) directory |
161
+ | `ONENOTE_NO_BROWSER` | Disable automatic browser launch during login (`1` / `true`) |
162
+ | `ONENOTE_AUTO_DAEMON` | Auto-start/attach to the background sync daemon (`1` / `true`, default `false`) |
163
+ | `ONENOTE_IMAGE_PROTOCOL` | Terminal image protocol override (`auto`, `kitty`, `iterm2`, `sixel`, `halfblock`) |
164
+ | `ONENOTE_GITHUB_REPO` | Override GitHub `owner/repo` used by `onenote self-update` (default `BiteFoundry/onenote`) |
165
+ | `ONENOTE_GITHUB_TOKEN` | GitHub token for private release checks in `onenote self-update` |
166
+
167
+ ## Troubleshooting
168
+
169
+ - **`no prebuilt binary found for <platform>-<arch>`** — reinstall with
170
+ `npm install -g @bitefoundry/onenote --include=optional`.
171
+ - **Older Linux (`GLIBC < 2.28`) or Alpine/musl Linux** — build from source with Cargo (`cargo build --release`).
172
+ - **Verify the binary** — `node -p "require.resolve('@bitefoundry/onenote-win32-x64/package.json')"` (adjust for your platform).
@@ -0,0 +1,314 @@
1
+ openapi: 3.1.0
2
+ info:
3
+ title: OneNote CLI Local HTTP API (@bitefoundry/onenote)
4
+ version: 0.1.0
5
+ description: >
6
+ Local HTTP JSON API exposed by `onenote serve` (default `127.0.0.1:8793`).
7
+ All `/v1/onenote/*` routes are also mirrored under `/onenote/*`.
8
+ servers:
9
+ - url: http://127.0.0.1:8793
10
+ components:
11
+ securitySchemes:
12
+ bearerAuth:
13
+ type: http
14
+ scheme: bearer
15
+ schemas:
16
+ ResourceDownloadResult:
17
+ type: object
18
+ required: [ok, path, file_name, mime_type, size_bytes, is_image]
19
+ properties:
20
+ ok: { type: boolean }
21
+ path: { type: string }
22
+ file_name: { type: string }
23
+ mime_type: { type: string }
24
+ size_bytes: { type: integer, format: int64 }
25
+ is_image: { type: boolean }
26
+ paths:
27
+ /health:
28
+ get:
29
+ summary: Health check
30
+ responses:
31
+ '200':
32
+ description: Service status
33
+ /v1/whoami:
34
+ get:
35
+ summary: Return signed-in Microsoft 365 profile
36
+ security:
37
+ - bearerAuth: []
38
+ responses:
39
+ '200':
40
+ description: User profile
41
+ /v1/onenote/notebooks:
42
+ get:
43
+ summary: List OneNote notebooks
44
+ security:
45
+ - bearerAuth: []
46
+ parameters:
47
+ - name: include_teams
48
+ in: query
49
+ schema: { type: boolean, default: true }
50
+ - name: refresh
51
+ in: query
52
+ schema: { type: boolean, default: false }
53
+ - name: offline
54
+ in: query
55
+ schema: { type: boolean, default: false }
56
+ responses:
57
+ '200':
58
+ description: Notebook list
59
+ post:
60
+ summary: Create a OneNote notebook
61
+ security:
62
+ - bearerAuth: []
63
+ requestBody:
64
+ required: true
65
+ content:
66
+ application/json:
67
+ schema:
68
+ type: object
69
+ required: [name]
70
+ properties:
71
+ name: { type: string }
72
+ group_id: { type: string }
73
+ site_id: { type: string }
74
+ responses:
75
+ '201':
76
+ description: Created notebook
77
+ /v1/onenote/sections:
78
+ get:
79
+ summary: List OneNote sections
80
+ security:
81
+ - bearerAuth: []
82
+ parameters:
83
+ - name: notebook
84
+ in: query
85
+ schema: { type: string }
86
+ - name: refresh
87
+ in: query
88
+ schema: { type: boolean, default: false }
89
+ - name: offline
90
+ in: query
91
+ schema: { type: boolean, default: false }
92
+ responses:
93
+ '200':
94
+ description: Section list
95
+ post:
96
+ summary: Create a OneNote section
97
+ security:
98
+ - bearerAuth: []
99
+ requestBody:
100
+ required: true
101
+ content:
102
+ application/json:
103
+ schema:
104
+ type: object
105
+ required: [notebook, name]
106
+ properties:
107
+ notebook: { type: string }
108
+ name: { type: string }
109
+ responses:
110
+ '201':
111
+ description: Created section
112
+ /v1/onenote/pages:
113
+ get:
114
+ summary: List OneNote pages in a section
115
+ security:
116
+ - bearerAuth: []
117
+ parameters:
118
+ - name: section
119
+ in: query
120
+ required: true
121
+ schema: { type: string }
122
+ - name: limit
123
+ in: query
124
+ schema: { type: integer, default: 50 }
125
+ - name: refresh
126
+ in: query
127
+ schema: { type: boolean, default: false }
128
+ - name: offline
129
+ in: query
130
+ schema: { type: boolean, default: false }
131
+ responses:
132
+ '200':
133
+ description: Page summaries
134
+ post:
135
+ summary: Create a top-level OneNote page from Markdown
136
+ security:
137
+ - bearerAuth: []
138
+ requestBody:
139
+ required: true
140
+ content:
141
+ application/json:
142
+ schema:
143
+ type: object
144
+ required: [section, title]
145
+ properties:
146
+ section: { type: string }
147
+ title: { type: string }
148
+ markdown: { type: string }
149
+ level: { type: integer, minimum: 0, maximum: 0, default: 0 }
150
+ image_paths:
151
+ type: array
152
+ items: { type: string }
153
+ responses:
154
+ '200':
155
+ description: Created page summary
156
+ '400':
157
+ description: Invalid input, including a nonzero page level
158
+ /v1/onenote/pages/{page}:
159
+ get:
160
+ summary: Read a OneNote page detail (blocks, Markdown, resources)
161
+ security:
162
+ - bearerAuth: []
163
+ parameters:
164
+ - name: page
165
+ in: path
166
+ required: true
167
+ schema: { type: string }
168
+ - name: section
169
+ in: query
170
+ schema: { type: string }
171
+ - name: refresh
172
+ in: query
173
+ schema: { type: boolean, default: false }
174
+ - name: offline
175
+ in: query
176
+ schema: { type: boolean, default: false }
177
+ responses:
178
+ '200':
179
+ description: Page detail
180
+ patch:
181
+ summary: Surgically replace a block or update page title/body
182
+ security:
183
+ - bearerAuth: []
184
+ parameters:
185
+ - name: page
186
+ in: path
187
+ required: true
188
+ schema: { type: string }
189
+ requestBody:
190
+ required: true
191
+ content:
192
+ application/json:
193
+ schema:
194
+ type: object
195
+ properties:
196
+ block_id: { type: string }
197
+ title: { type: string }
198
+ markdown: { type: string }
199
+ section: { type: string }
200
+ responses:
201
+ '200':
202
+ description: Updated page detail
203
+ delete:
204
+ summary: Delete a OneNote page
205
+ security:
206
+ - bearerAuth: []
207
+ parameters:
208
+ - name: page
209
+ in: path
210
+ required: true
211
+ schema: { type: string }
212
+ - name: section
213
+ in: query
214
+ schema: { type: string }
215
+ responses:
216
+ '200':
217
+ description: Deletion result
218
+ /v1/onenote/pages/{page}/append:
219
+ post:
220
+ summary: Append Markdown and optional images to a page
221
+ security:
222
+ - bearerAuth: []
223
+ parameters:
224
+ - name: page
225
+ in: path
226
+ required: true
227
+ schema: { type: string }
228
+ requestBody:
229
+ required: true
230
+ content:
231
+ application/json:
232
+ schema:
233
+ type: object
234
+ required: [markdown]
235
+ properties:
236
+ markdown: { type: string }
237
+ images:
238
+ type: array
239
+ items: { type: string }
240
+ section: { type: string }
241
+ responses:
242
+ '200':
243
+ description: Updated page detail
244
+ /v1/onenote/pages/{page}/todo:
245
+ post:
246
+ summary: Toggle or set a OneNote checkbox on a block
247
+ security:
248
+ - bearerAuth: []
249
+ parameters:
250
+ - name: page
251
+ in: path
252
+ required: true
253
+ schema: { type: string }
254
+ requestBody:
255
+ required: true
256
+ content:
257
+ application/json:
258
+ schema:
259
+ type: object
260
+ required: [block_id]
261
+ properties:
262
+ block_id: { type: string }
263
+ completed: { type: boolean }
264
+ section: { type: string }
265
+ responses:
266
+ '200':
267
+ description: Updated page detail
268
+ /v1/onenote/search:
269
+ get:
270
+ summary: Full-text search across cached OneNote pages
271
+ security:
272
+ - bearerAuth: []
273
+ parameters:
274
+ - name: q
275
+ in: query
276
+ required: true
277
+ schema: { type: string }
278
+ - name: section
279
+ in: query
280
+ schema: { type: string }
281
+ - name: limit
282
+ in: query
283
+ schema: { type: integer, default: 20 }
284
+ - name: refresh
285
+ in: query
286
+ schema: { type: boolean, default: false }
287
+ responses:
288
+ '200':
289
+ description: Search hits
290
+ /v1/onenote/resources/download:
291
+ post:
292
+ summary: Download an embedded OneNote image or file attachment
293
+ security:
294
+ - bearerAuth: []
295
+ requestBody:
296
+ required: true
297
+ content:
298
+ application/json:
299
+ schema:
300
+ type: object
301
+ required: [page]
302
+ properties:
303
+ page: { type: string }
304
+ index: { type: integer }
305
+ url: { type: string }
306
+ out: { type: string }
307
+ section: { type: string }
308
+ responses:
309
+ '200':
310
+ description: Downloaded resource metadata
311
+ content:
312
+ application/json:
313
+ schema:
314
+ $ref: '#/components/schemas/ResourceDownloadResult'