npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

onenote-cli

v0.1.0

Published

CLI tool to operate Microsoft OneNote via Graph API

Readme

onenote-cli

Make your OneNote notebooks survive in the age of AI.

A CLI that lets AI agents (and humans) search, read, and operate your OneNote — with full-text page-level search and deep links that open directly to the matching page.

Features

  • Page-level search — search inside all your OneNote pages, get results with URLs that open directly to the matching page in OneNote Online
  • Notebooks / Sections / Pages — list, get, create, delete via Graph API
  • 5,000-item workaround — when Graph OneNote API is blocked by the SharePoint document library limit, automatically falls back to OneDrive file API + local binary parsing
  • Local cache — downloads .one files, extracts text (UTF-8 + UTF-16LE), builds a searchable index
  • Official OneNote URLs — resolves page GUIDs via GET /me/onenote/sections/0-{guid}/pages to get URLs that bypass OneNote Online's session caching
  • Device code flow auth — works in SSH / headless / terminal environments
  • Cross-directory.env.local and cache are loaded from the package directory, so onenote works from any working directory

Install

As an AI Agent Skill

# Claude Code / OpenClaw / Codex / Cursor / any SKILL.md-compatible agent
npx skills add snomiao/onenote-cli

Manual

git clone https://github.com/snomiao/onenote-cli.git
cd onenote-cli
bun install

Setup

  1. Register an Azure AD app at entra.microsoft.com (see docs/setup.md for full walkthrough)
  2. Copy .env.example to .env.local and set your Client ID:
    cp .env.example .env.local
    # Edit .env.local with your Application (client) ID
  3. Login:
    bun run src/index.ts auth login

Usage

# Auth
onenote auth login          # Login via device code flow
onenote auth whoami         # Show current user
onenote auth setup          # Print setup instructions
onenote auth logout         # Clear tokens

# Notebooks
onenote notebooks list
onenote notebooks get <id>
onenote notebooks create <name>

# Sections (falls back to OneDrive if Graph API is blocked)
onenote sections list -n <notebook-id>
onenote sections create -n <notebook-id> --name <name>

# Pages
onenote pages list -s <section-id>
onenote pages get <id>
onenote pages content <id>
onenote pages create -s <section-id> -t <title> -b "<html>"
onenote pages delete <id>

# Search
onenote sync                # Download and cache all sections
onenote search <query>      # Full-text page-level search (local)
onenote search <query> -o   # Online section-level search (Graph API)

Search Example

$ onenote search 年金番号

# (20250303) nenkin bangou screenshot @mynaportal
  Section: MyNumberCard-マイナンバカード | Notebook: sno@ja
  基础**年金番号** ...
  https://snomiao-my.sharepoint.com/.../Notebooks/sno@ja?wd=target(...)

2 page-level results found.

Clicking the URL opens OneNote Online directly on the matching page.

How Search Works

  1. onenote sync downloads all .one section files from OneDrive
  2. Extracts page GUIDs from the MS-ONESTORE binary format
  3. Fetches official page URLs via OneNote Graph API (/me/onenote/sections/0-{guid}/pages)
  4. On search, scans the binary for matches (UTF-8 and UTF-16LE), attributes each match to the correct page via context-based anchor lookup
  5. Returns results with official OneNote URLs that navigate directly to the page

See docs/local-search-architecture.md for the full technical design.

API Permissions Required

| Permission | Type | Purpose | |---|---|---| | Notes.Read | Delegated | Read notebooks | | Notes.ReadWrite | Delegated | Create/modify pages | | Notes.ReadWrite.All | Delegated | Access all notebooks | | Files.Read | Delegated | Download .one files from OneDrive | | Files.Read.All | Delegated | Access all accessible files | | Sites.Read.All | Delegated | Search via SharePoint listItem API |

File Structure

src/
  index.ts      CLI entry point (yargs)
  auth.ts       MSAL device code flow + .env.local auto-loader
  graph.ts      Microsoft Graph API client (OneNote + OneDrive)
  cache.ts      Local cache, .one binary parser, page GUID extraction
docs/
  setup.md                     Azure AD registration walkthrough
  local-search-architecture.md Technical design of local search
  graph-api-endpoints.md       OneNote Graph API reference
  development-notes.md         Lessons learned
  onen0te-cli-analysis.md      Competitor UX analysis

Configuration

| Source | Location | Priority | |---|---|---| | .env.local | Package root (auto-loaded) | Highest | | ~/.onenote-cli/config.json | Home directory | Fallback | | ONENOTE_CLIENT_ID env var | Shell environment | Overrides all |

Cache location: <package>/.onenote/cache/ (override with ONENOTE_CACHE_DIR)

License

MIT