@bitefoundry/onenote 0.3.0 → 0.4.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/LICENSE +21 -21
- package/README.md +181 -169
- package/docs/API.md +114 -114
- package/docs/MCP.md +130 -130
- package/docs/NPM.md +172 -172
- package/docs/openapi.yaml +322 -320
- package/package.json +50 -50
package/docs/NPM.md
CHANGED
|
@@ -1,172 +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 `@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 [--limit N] [--cursor N]`, `onenote sections [notebook] [--limit N] [--cursor N]`, `onenote pages <section> [--limit N] [--cursor N]`, `onenote read <page> [--json [--full]]`
|
|
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> [--limit N] [--cursor N]`, `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).
|
|
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 [--limit N] [--cursor N]`, `onenote sections [notebook] [--limit N] [--cursor N]`, `onenote pages <section> [--limit N] [--cursor N]`, `onenote read <page> [--json [--full]]`
|
|
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> [--limit N] [--cursor N]`, `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).
|