@bitefoundry/onenote 0.1.4 → 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/LICENSE +21 -0
- package/README.md +31 -11
- package/docs/API.md +7 -4
- package/docs/NPM.md +25 -10
- package/docs/openapi.yaml +2 -2
- package/package.json +8 -10
- package/scripts/postinstall.mjs +7 -11
- package/bin/note.js +0 -4
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 BiteFoundry
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
| **Minimal-Chrome 3-Pane TUI** | Personal, Teams/Group & SharePoint notebooks, colored section ribbon, nested subpages (`level 0/1/2`), bidirectional XHTML ↔ Markdown canvas, surgical `data-id` `PATCH` edits, `0ms` optimistic to-do toggles, Link Extractor (`u`), File Picker with `zoxide` (`Ctrl+F`), and 6 themes. |
|
|
25
25
|
| **High-Res Terminal Images** | Inline thumbnails & fullscreen HD previews (`v` / `Alt+v`) with 80ms protocol probing for **Kitty**, **iTerm2**, **Sixel** (Floyd-Steinberg dithering), and **24-bit Unicode Half-Blocks** + `Ctrl+V` clipboard PNG upload. |
|
|
26
26
|
| **Local SQLite FTS5 + IPC Daemon** | WAL-mode SQLite cache with 4-reader pool, trigram full-text search (`/`), persistent `DraftStore`, and a shared background sync daemon (`onenote daemon start`). |
|
|
27
|
-
| **4-in-1 Agent Interface** | Interactive **TUI** (`onenote`
|
|
27
|
+
| **4-in-1 Agent Interface** | Interactive **TUI** (`onenote`), scriptable `--json` **CLI**, local **HTTP JSON API** (`onenote serve`, port `8793`), and stdio **MCP Server** (`onenote mcp`). |
|
|
28
28
|
|
|
29
29
|
---
|
|
30
30
|
|
|
@@ -37,12 +37,32 @@ npm i -g @bitefoundry/onenote
|
|
|
37
37
|
# 2. Authenticate with Microsoft 365 (PKCE loopback, --device-code, or --token-file)
|
|
38
38
|
onenote login
|
|
39
39
|
|
|
40
|
-
# 3. Launch the interactive TUI
|
|
40
|
+
# 3. Launch the interactive TUI
|
|
41
41
|
onenote
|
|
42
42
|
```
|
|
43
43
|
|
|
44
|
-
|
|
45
|
-
|
|
44
|
+
Build from source with `cargo build --release`. See [installation and migration](docs/NPM.md) for updating scripts, MCP configurations, and local HTTP clients.
|
|
45
|
+
|
|
46
|
+
### Company-managed Microsoft Entra sign-in
|
|
47
|
+
|
|
48
|
+
`onenote login` uses the public Microsoft Graph Command Line Tools client by default. To use a company-owned app, register it as a public client and configure the `http://localhost` redirect URI. Enable public client flows for headless `--device-code` sign-in. [Company app registration guide](https://github.com/BiteFoundry/teams/blob/master/docs/ENTERPRISE.md)
|
|
49
|
+
|
|
50
|
+
Add the Microsoft Graph delegated permissions your users need and have your Entra administrator grant consent where required.
|
|
51
|
+
|
|
52
|
+
| Feature | Delegated scopes |
|
|
53
|
+
| --- | --- |
|
|
54
|
+
| Profile and session refresh | `User.Read`, `offline_access` |
|
|
55
|
+
| Read, create, and edit the user's OneNote content | `Notes.Read`, `Notes.Create`, `Notes.ReadWrite` |
|
|
56
|
+
| Discover joined Teams and read or edit organizational notebooks the user can access | `Team.ReadBasic.All`, `Notes.Read.All`, `Notes.ReadWrite.All` |
|
|
57
|
+
|
|
58
|
+
The default sign-in adds the organizational scopes when you specify your company's tenant ID. Set `scopes` in `config.toml` to request a narrower set that matches your workflow.
|
|
59
|
+
|
|
60
|
+
```sh
|
|
61
|
+
onenote login --client-id YOUR_APP_ID --tenant-id YOUR_TENANT_ID
|
|
62
|
+
onenote whoami --json
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
For persistent environment configuration, set `ONENOTE_CLIENT_ID` and `ONENOTE_TENANT_ID`.
|
|
46
66
|
|
|
47
67
|
---
|
|
48
68
|
|
|
@@ -94,12 +114,12 @@ On Windows, `desktop-set-page-level` and `desktop-rename-section` work on existi
|
|
|
94
114
|
### Local HTTP API (`onenote serve`)
|
|
95
115
|
|
|
96
116
|
```sh
|
|
97
|
-
# Start local Axum JSON server (default 127.0.0.1:
|
|
98
|
-
onenote serve --
|
|
117
|
+
# Start local Axum JSON server (default 127.0.0.1:8793)
|
|
118
|
+
onenote serve --token dev-secret
|
|
99
119
|
|
|
100
120
|
# Query pages & FTS5 search from scripts or agents
|
|
101
121
|
curl -H "Authorization: Bearer dev-secret" \
|
|
102
|
-
"http://127.0.0.1:
|
|
122
|
+
"http://127.0.0.1:8793/v1/onenote/search?q=canary&limit=10"
|
|
103
123
|
```
|
|
104
124
|
|
|
105
125
|
Full route reference & OpenAPI 3.1 spec: [docs/API.md](docs/API.md) · [docs/openapi.yaml](docs/openapi.yaml).
|
|
@@ -129,10 +149,10 @@ Full tool catalog & schemas: [docs/MCP.md](docs/MCP.md).
|
|
|
129
149
|
| --- | --- | --- |
|
|
130
150
|
| [`@bitefoundry/teams`](https://www.npmjs.com/package/@bitefoundry/teams) | `teams` | Microsoft Teams chats, channels, threads & meetings |
|
|
131
151
|
| [`@bitefoundry/outlook`](https://www.npmjs.com/package/@bitefoundry/outlook) | `outlook` | Microsoft Outlook mail, calendar & contacts |
|
|
132
|
-
| **`@bitefoundry/onenote`** | `onenote
|
|
133
|
-
| [`@bitefoundry/sharepoint`](https://www.npmjs.com/package/@bitefoundry/sharepoint) | `sharepoint`, `
|
|
134
|
-
| [`@bitefoundry/atlassian`](https://www.npmjs.com/package/@bitefoundry/atlassian) | `atlassian`, `
|
|
135
|
-
| [`@bitefoundry/notion`](https://www.npmjs.com/package/@bitefoundry/notion) | `notion
|
|
152
|
+
| **`@bitefoundry/onenote`** | `onenote` | Microsoft OneNote notebooks, sections, pages & XHTML/Markdown |
|
|
153
|
+
| [`@bitefoundry/sharepoint`](https://www.npmjs.com/package/@bitefoundry/sharepoint) | `sharepoint`, `bitefoundry-onedrive` | Microsoft SharePoint sites, document libraries & OneDrive files |
|
|
154
|
+
| [`@bitefoundry/atlassian`](https://www.npmjs.com/package/@bitefoundry/atlassian) | `atlassian`, `confluence`, `conf` | Atlassian Jira issues, boards, sprints & Confluence pages |
|
|
155
|
+
| [`@bitefoundry/notion`](https://www.npmjs.com/package/@bitefoundry/notion) | `notion` | Notion pages, databases, blocks & Markdown sync |
|
|
136
156
|
|
|
137
157
|
---
|
|
138
158
|
|
package/docs/API.md
CHANGED
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
# Local HTTP JSON API (`onenote serve`)
|
|
2
2
|
|
|
3
|
-
`onenote serve` runs a local Axum HTTP server bound to `127.0.0.1:
|
|
3
|
+
`onenote serve` runs a local Axum HTTP server bound to `127.0.0.1:8793` by default.
|
|
4
4
|
|
|
5
5
|
```sh
|
|
6
|
-
# Start with default port (127.0.0.1:
|
|
6
|
+
# Start with default port (127.0.0.1:8793)
|
|
7
7
|
onenote serve
|
|
8
8
|
|
|
9
|
-
#
|
|
10
|
-
onenote serve --
|
|
9
|
+
# Keep a client configured for the previous port
|
|
10
|
+
onenote serve --port 8788
|
|
11
|
+
|
|
12
|
+
# Set a bind address and require a Bearer token
|
|
13
|
+
onenote serve --bind 127.0.0.1 --token my-secret-token
|
|
11
14
|
```
|
|
12
15
|
|
|
13
16
|
When `--token` is provided, every endpoint except `/health` requires:
|
package/docs/NPM.md
CHANGED
|
@@ -7,8 +7,7 @@ into `bin/` and Windows shims for zero-Node-startup execution), so there is no
|
|
|
7
7
|
compiler, Node native addon, or network download during install.
|
|
8
8
|
|
|
9
9
|
The Rust crate is named `onenote-cli` and produces the standalone **Microsoft OneNote**
|
|
10
|
-
binary (`onenote` / `onenote.exe`). The npm package
|
|
11
|
-
and installs both **`onenote`** and the short alias **`note`**.
|
|
10
|
+
binary (`onenote` / `onenote.exe`). The npm package `@bitefoundry/onenote` installs the `onenote` command.
|
|
12
11
|
|
|
13
12
|
## Install and run
|
|
14
13
|
|
|
@@ -16,10 +15,9 @@ and installs both **`onenote`** and the short alias **`note`**.
|
|
|
16
15
|
# one-off
|
|
17
16
|
npx @bitefoundry/onenote --version
|
|
18
17
|
|
|
19
|
-
# global install
|
|
18
|
+
# global install
|
|
20
19
|
npm install -g @bitefoundry/onenote
|
|
21
20
|
onenote --version
|
|
22
|
-
note --version
|
|
23
21
|
|
|
24
22
|
# project-local
|
|
25
23
|
npm install @bitefoundry/onenote
|
|
@@ -29,7 +27,7 @@ npx onenote notebooks
|
|
|
29
27
|
All workflows share the same Microsoft Entra ID login (or automatic M365 shared-session
|
|
30
28
|
bootstrap from `teams-cli` / `outlook-cli`), SQLite WAL + FTS5 cache (`cache.db`),
|
|
31
29
|
background sync daemon (`onenote daemon start | status | stop | restart`), local HTTP API
|
|
32
|
-
(`onenote serve`, default `127.0.0.1:
|
|
30
|
+
(`onenote serve`, default `127.0.0.1:8793`), MCP server (`onenote mcp`), and multi-protocol
|
|
33
31
|
terminal image preview (`Kitty` / `iTerm2` / `Sixel` / `Halfblock` via `onenote preview-file`
|
|
34
32
|
and the interactive TUI).
|
|
35
33
|
|
|
@@ -58,6 +56,24 @@ Use `--replace-text` and `--with-text` to change one exact substring in a block'
|
|
|
58
56
|
|
|
59
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)
|
|
60
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
|
+
|
|
61
77
|
## Supported platforms
|
|
62
78
|
|
|
63
79
|
| npm package | OS | CPU | Rust target |
|
|
@@ -77,7 +93,7 @@ build from source with Cargo (`cargo build --release`).
|
|
|
77
93
|
|
|
78
94
|
## How resolution works
|
|
79
95
|
|
|
80
|
-
`bin/onenote.js`
|
|
96
|
+
`bin/onenote.js` looks up `@bitefoundry/onenote-<platform>-<arch>` through
|
|
81
97
|
`require.resolve`, then execute `node_modules/@bitefoundry/onenote-<platform>-<arch>/bin/onenote`
|
|
82
98
|
(or `onenote.exe` on Windows) with `stdio: 'inherit'`. On `npm install`, `scripts/postinstall.mjs`
|
|
83
99
|
additionally links the native binary directly for zero-Node-startup execution.
|
|
@@ -88,9 +104,8 @@ and the `--include=optional` hint instead of a stack trace.
|
|
|
88
104
|
## Layout
|
|
89
105
|
|
|
90
106
|
```
|
|
91
|
-
package.json # @bitefoundry/onenote launcher package (bin: onenote
|
|
107
|
+
package.json # @bitefoundry/onenote launcher package (bin: onenote)
|
|
92
108
|
bin/onenote.js # onenote launcher
|
|
93
|
-
bin/note.js # note shorthand launcher
|
|
94
109
|
scripts/postinstall.mjs # zero-Node native binary linker on npm install
|
|
95
110
|
npm/onenote-<platform>/ # one package per platform
|
|
96
111
|
package.json # os/cpu/files, same version as root
|
|
@@ -113,9 +128,9 @@ node scripts/sync-version.mjs --check
|
|
|
113
128
|
|
|
114
129
|
## External token brokers, M365 bootstrap & token scopes
|
|
115
130
|
|
|
116
|
-
###
|
|
131
|
+
### Microsoft Graph delegated scopes
|
|
117
132
|
|
|
118
|
-
`offline_access`, `User.Read`, `Notes.Read`, `Notes.ReadWrite`, `Notes.Create`
|
|
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)
|
|
119
134
|
|
|
120
135
|
Run `onenote whoami` or `onenote doctor` to inspect JWT `scp`/`roles` claims automatically.
|
|
121
136
|
|
package/docs/openapi.yaml
CHANGED
|
@@ -3,10 +3,10 @@ info:
|
|
|
3
3
|
title: OneNote CLI Local HTTP API (@bitefoundry/onenote)
|
|
4
4
|
version: 0.1.0
|
|
5
5
|
description: >
|
|
6
|
-
Local HTTP JSON API exposed by `onenote serve` (default `127.0.0.1:
|
|
6
|
+
Local HTTP JSON API exposed by `onenote serve` (default `127.0.0.1:8793`).
|
|
7
7
|
All `/v1/onenote/*` routes are also mirrored under `/onenote/*`.
|
|
8
8
|
servers:
|
|
9
|
-
- url: http://127.0.0.1:
|
|
9
|
+
- url: http://127.0.0.1:8793
|
|
10
10
|
components:
|
|
11
11
|
securitySchemes:
|
|
12
12
|
bearerAuth:
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bitefoundry/onenote",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.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",
|
|
@@ -8,12 +8,10 @@
|
|
|
8
8
|
},
|
|
9
9
|
"license": "MIT",
|
|
10
10
|
"bin": {
|
|
11
|
-
"onenote": "bin/onenote.js"
|
|
12
|
-
"note": "bin/note.js"
|
|
11
|
+
"onenote": "bin/onenote.js"
|
|
13
12
|
},
|
|
14
13
|
"files": [
|
|
15
14
|
"bin/onenote.js",
|
|
16
|
-
"bin/note.js",
|
|
17
15
|
"scripts/postinstall.mjs",
|
|
18
16
|
"docs/NPM.md",
|
|
19
17
|
"docs/API.md",
|
|
@@ -42,11 +40,11 @@
|
|
|
42
40
|
"build:npm": "node scripts/build-npm.mjs"
|
|
43
41
|
},
|
|
44
42
|
"optionalDependencies": {
|
|
45
|
-
"@bitefoundry/onenote-win32-x64": "0.
|
|
46
|
-
"@bitefoundry/onenote-win32-arm64": "0.
|
|
47
|
-
"@bitefoundry/onenote-darwin-x64": "0.
|
|
48
|
-
"@bitefoundry/onenote-darwin-arm64": "0.
|
|
49
|
-
"@bitefoundry/onenote-linux-x64": "0.
|
|
50
|
-
"@bitefoundry/onenote-linux-arm64": "0.
|
|
43
|
+
"@bitefoundry/onenote-win32-x64": "0.2.0",
|
|
44
|
+
"@bitefoundry/onenote-win32-arm64": "0.2.0",
|
|
45
|
+
"@bitefoundry/onenote-darwin-x64": "0.2.0",
|
|
46
|
+
"@bitefoundry/onenote-darwin-arm64": "0.2.0",
|
|
47
|
+
"@bitefoundry/onenote-linux-x64": "0.2.0",
|
|
48
|
+
"@bitefoundry/onenote-linux-arm64": "0.2.0"
|
|
51
49
|
}
|
|
52
50
|
}
|
package/scripts/postinstall.mjs
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
// Zero-Node-Process npm native binary linker.
|
|
3
3
|
//
|
|
4
|
-
// On Unix (linux/darwin): replaces installed `bin/onenote.js`
|
|
4
|
+
// On Unix (linux/darwin): replaces installed `bin/onenote.js` with
|
|
5
5
|
// hardlinks/symlinks directly to `@bitefoundry/onenote-<platform>-<arch>/bin/onenote` so npm's
|
|
6
6
|
// bin symlink execve's the native Rust binary directly (0ms Node startup, 0MB Node RSS).
|
|
7
7
|
//
|
|
8
|
-
// On Windows (win32): creates
|
|
9
|
-
// and rewrites npm's
|
|
8
|
+
// On Windows (win32): creates a native `bin/onenote.exe` hardlink (fallback copy)
|
|
9
|
+
// and rewrites npm's `onenote[.cmd|.ps1]` shims when present to invoke
|
|
10
10
|
// the native executable directly without spawning `node.exe`.
|
|
11
11
|
|
|
12
12
|
import fs from 'node:fs';
|
|
@@ -14,7 +14,7 @@ import path from 'node:path';
|
|
|
14
14
|
import { createRequire } from 'node:module';
|
|
15
15
|
import { fileURLToPath } from 'node:url';
|
|
16
16
|
|
|
17
|
-
const BIN_NAMES = ['onenote'
|
|
17
|
+
const BIN_NAMES = ['onenote'];
|
|
18
18
|
const PKG_ROOT = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..');
|
|
19
19
|
|
|
20
20
|
function linkOrCopyFile(source, destination) {
|
|
@@ -95,10 +95,7 @@ function collectWindowsShimDirs(pkgRoot, env = process.env) {
|
|
|
95
95
|
|
|
96
96
|
function shimReferencesLauncher(content, name) {
|
|
97
97
|
const normalized = content.replace(/\\/g, '/').toLowerCase();
|
|
98
|
-
return (
|
|
99
|
-
normalized.includes('@bitefoundry/onenote') &&
|
|
100
|
-
normalized.includes(`bin/${name}.js`)
|
|
101
|
-
);
|
|
98
|
+
return normalized.includes(`/@bitefoundry/onenote/bin/${name}.js"`);
|
|
102
99
|
}
|
|
103
100
|
|
|
104
101
|
function rewriteWindowsShims(shimDir, pkgRoot) {
|
|
@@ -135,11 +132,10 @@ function rewriteWindowsShims(shimDir, pkgRoot) {
|
|
|
135
132
|
const ps1Body = [
|
|
136
133
|
'#!/usr/bin/env pwsh',
|
|
137
134
|
'$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent',
|
|
138
|
-
`$exePath = Join-Path $basedir '${relWin.replace(/'/g, "''")}'`,
|
|
139
135
|
'if ($MyInvocation.ExpectingInput) {',
|
|
140
|
-
|
|
136
|
+
` $input | & "$basedir/${relPosix}" $args`,
|
|
141
137
|
'} else {',
|
|
142
|
-
|
|
138
|
+
` & "$basedir/${relPosix}" $args`,
|
|
143
139
|
'}',
|
|
144
140
|
'exit $LASTEXITCODE',
|
|
145
141
|
'',
|
package/bin/note.js
DELETED