Releases: Coastal-Programs/notion-cli
v6.3.2
Fixed
- OAuth token endpoint requests now include
Notion-VersionandAccept: application/jsonheaders, matching the official Notion JS SDK (makenotion/notion-sdk-js) and developer-docs spec. Applied toexchangeCode,TokenRefresh,TokenIntrospect, andTokenRevokeininternal/oauth/oauth.go.
v6.3.1
Breaking
- Go module path is now
github.com/Coastal-Programs/notion-cli/v6. Per Go's major-version-suffix rule, modules at v2+ must carry a/vNsuffix. Without it,go install github.com/Coastal-Programs/notion-cli/cmd/notion-cli@latestresolved tov5.9.0+incompatibleand failed because that older tag did not containcmd/notion-cli. Update anygo installcommand and anyimportofpkg/outputto use the/v6prefix (e.g.go install github.com/Coastal-Programs/notion-cli/v6/cmd/notion-cli@latest). Fixes #86.
Changed
- Bumped default Notion-Version header from 2022-06-28 to 2026-03-11 (latest).
db querynow calls/v1/data_sources/{id}/query(Notion API 2025-09-03). Use--data-sourceto target a specific source on multi-source databases.block appendnow uses thepositionobject (Notion API 2026-03-11). The--afterflag is deprecated; use--position=after --after-block <id>.- Use
in_trashinstead ofarchived; recognisemeeting_notesblock type (renamed fromtranscription) per Notion API 2026-03-11.
Fixed
- Config fields previously loaded but never applied to the runtime client are now wired through.
NOTION_CLI_BASE_URL,NOTION_CLI_MAX_RETRIES,NOTION_CLI_BASE_DELAY,NOTION_CLI_MAX_DELAY, andNOTION_CLI_HTTP_KEEP_ALIVE(and their config-file equivalents) now affect HTTP behavior.NOTION_CLI_VERBOSE/verboseis honored as a fallback when the--verboseflag isn't set.
Added
auth refresh— explicitly refresh OAuth access token using stored refresh token; prints new expiry.auth status --remote— also calls token introspect to show active status, scope, and issued_at/expires_at.auth logout --local-only— skip the API revoke call and only clear local config.oauth.TokenRefresh,oauth.TokenIntrospect,oauth.TokenRevokeclient functions ininternal/oauth/oauth.go.Config.OAuthRefreshTokenandConfig.OAuthTokenExpiresAt(RFC3339) with full persistence (save/load/clear).Config.NeedsRefresh()— returns true when token expires within 5 minutes and a refresh token is present.- Auto-refresh-on-401: the Notion HTTP client transparently refreshes the OAuth token and retries once when a refresh token is available in config.
custom-emoji list --all— auto-paginate through all workspace custom emojis. Table output (id,name,url) by default. New httptest coverage forCustomEmojiListclient method.filescommand group (upload,retrieve,list) wrapping the Notion File Uploads API.files upload <path>auto-selects single-part (≤20 MB) or multi-part (>20 MB) upload, streams file contents in 10 MB chunks, shows a progress bar on TTY, and prints thefile_upload_idto stdout for piping.files listsupports--page-sizeand--allfor full pagination. Five new Notion client methods:FileUploadCreate,FileUploadSend,FileUploadComplete,FileUploadRetrieve,FileUploadList.view create— create a new Notion database view with--data-source,--name,--type(required) and optional--database,--filter,--sorts(JSON string or@<file>).view update <view_id>— update an existing view's--name,--filter, and/or--sorts.view delete <view_id>— delete a Notion view.view query --all— auto-paginate through all view query results and clean up the server-side query cache on completion.ViewCreate,ViewUpdate,ViewDeletemethods added to the Notion HTTP client.page trash <page_id>— moves a page to trash (in_trash: true). Requires--yesin non-TTY environments. Interactive mode prompts for confirmation.page restore <page_id>— restores a trashed page (in_trash: false).page move <page_id>— moves a page to a new parent viaPOST /pages/{id}/move. Supports--parent <page-id>,--data-source <data-source-id>, and--workspace(mutually exclusive).PageTrash,PageRestore,PageMovemethods added to the Notion HTTP client.commentcommand group (create,list,retrieve,update,delete) wrapping the Notion Comments API (Notion-Version 2026-03-11).comment createsupports--page/--block/--discussionparents (mutually exclusive),--textor--rich-text <file.json>, plus optional--display-nameand repeatable--attach-file <upload-id>(max 3).comment listsupports--page-sizeand--allfor full pagination.markdowncommand group (get,set) for reading and writing page content as enhanced markdown via/v1/pages/{id}/markdown(Notion API 2026-03-11).setsupports replace (default) and--append, with content from--content,--file, or stdin.custom-emojicommand group (list, retrieve) per Notion API 2026-03-11.notion.WithKeepAlive(bool)client option installs a transport withDisableKeepAlives=truewhen keep-alive is disabled in config.- Data Source HTTP client methods and resolver helper for the 2025-09-03 multi-source database split.
data-sourcecommand group (retrieve, create, update, query) for the 2025-09-03 multi-source database API.data-source templates <id>— lists page templates for a data source with--allpagination support.data-source properties update <id> --schema <json|@file>— updates a data source's properties schema.db querynow emits a deprecation notice to stderr when routing through auto-resolved data sources; suppress with--quiet.- Workspace cache (
sync) now indexes data sources extracted from database search results (data_sourceskey), stored in~/.notion-cli/databases.jsonunderdata_sources. listcommand now includes adata_sourcesarray alongsidedatabasesin the output.ExtractIDin the resolver now recognises thedataSource=query parameter in Notion URLs, returning the data source ID instead of the page/database path ID.dsalias moved fromdbtodata-source(breaking:notion-cli dsnow invokesdata-source).viewcommand group (list, retrieve, query, results, delete-query) per Notion API 2026-03-11.
Removed
- Dead code cleanup: removed the unused in-memory TTL
Cachestruct,NewCache, TTL constants (DatabaseTTL,UserTTL,PageTTL,BlockTTL), andCacheKeyForResourcefrominternal/cache/cache.go(and its test file). Only the workspace database cache (internal/cache/workspace.go) was ever wired up; the response cache was never integrated. Thecache_enabled/cache_max_size/disk_cache_enabledconfig fields are kept for forward compatibility but documented as reserved. - Removed unused error factory functions
IntegrationNotShared,ResourceNotFound,DatabaseIdConfusion,InvalidProperty,NetworkError, andTimeoutfrominternal/errors/errors.go. The HTTP client usesFromNotionAPIfor all API errors; these factories had no production callers.
v6.3.0
Why
After rotating NOTION_OAUTH_SECRET in Notion, the npm-published v6.2.1 binary became dead — its embedded secret no longer matches Notion's record. This release re-bakes the new secret and ships production hardening.
Highlights
- Multi-port OAuth callback (8080 → 8081 → 8089) — first free port wins. Fixes the most common failure (port conflict with Jenkins/Tomcat/dev servers).
auth login --manual— paste-back flow for SSH/container/firewall users. Auto-on when$SSH_TTYis set.- Polished OAuth callback page with dark-mode support.
doctornow probes OAuth port availability and the Notion authorize endpoint.- 5-minute auth login timeout (was 2).
Upgrade
npm i -g @coastal-programs/notion-cli@latest
notion-cli auth loginOperational notes
- Notion integration now requires three redirect URIs registered:
http://localhost:{8080,8081,8089}/callback. NOTION_OAUTH_SECRETwas rotated; old npm versions cannot authenticate.
v6.2.1
Changed
- Bumped Go toolchain from 1.25 to 1.26
- Updated
github.com/spf13/pflagfrom v1.0.9 to v1.0.10 - Updated CI publish workflow to use Go 1.26
Fixed
- Migrated golangci-lint config to v2 format (added
version: "2", removedgosimplelinter merged intostaticcheck) - Resolved all pre-existing errcheck, staticcheck QF1012, and unused lint errors across the codebase
v6.2.0 - Output flag & platform packages
What's New
--output/-oflag: All commands now accept--output <format>(or-o <format>) as an alternative to boolean flags. Valid formats:json,compact-json,csv,markdown,table,raw,pretty. Invalid values return a structured error envelope with suggestions.
Fixes
- Publish workflow: Platform package publish failures are no longer silently ignored. The workflow now reports explicit errors when packages fail to publish.
Upgrade
npm install -g @coastal-programs/notion-cli@latestSee CHANGELOG.md for full details.
v6.1.2 - Security fixes, bug fixes, OAuth credential rotation
What's Changed
Security
- Rotated OAuth client secret after credential leak in v6.1.1 binary
- Removed hardcoded OAuth client ID from Makefile — credentials now sourced exclusively from GitHub Secrets
- OAuth callback server binds to
127.0.0.1instead of0.0.0.0(prevents interception on shared machines) - Token exchange JSON body built with
json.Marshalinstead of string formatting (prevents injection)
Bug Fixes
- OAuth authorization URL now properly URL-encodes
redirect_uriparameter - JSON envelope version metadata now shows correct version (was stuck at
6.0.0) - User-Agent header now reports actual CLI version (was stuck at
1.0) db schemano longer panics on databases with no propertiesdoctorcommand now returns error envelope and non-zero exit code when checks failsearchdate filters validate format upfront instead of failing silentlysearch --page-sizevalidated against Notion's 100 limitdb query --sort-directionvalidates input with clear error for invalid valuesbatchalias changed frombtobato avoid collision withblock- Removed dead
--searchflag fromdb query - All error messages in
batchandconfigcommands now use structuredNotionCLIError whoami,sync,list,doctornow reject unexpected arguments
CI/CD
- Publish workflow now passes
NOTION_OAUTH_CLIENT_IDsecret to build steps
See CHANGELOG.md for full details.
v6.1.1 - Workflow & README fixes
Fixed
- Publish workflow now uploads binaries to GitHub releases correctly
- Publish workflow creates platform
bin/directories before copying - OAuth client secret now passed to build steps so
auth loginworks in published binaries - Go version bumped to 1.25 in CI to match go.mod
Changed
- README updated: OAuth login is the recommended setup method
- Added Authentication section with token precedence table
- Updated project structure, test counts, and troubleshooting docs
Full Changelog: v6.1.0...v6.1.1
v6.1.0 - OAuth Authentication
What's New
OAuth Authentication — Log in to Notion from the CLI without managing API tokens manually.
notion-cli auth login— Opens your browser, you authorize, and the token is saved automaticallynotion-cli auth logout— Clears stored OAuth tokensnotion-cli auth status— Shows current auth method and workspace info
Token Precedence
NOTION_TOKENenv var (CI/automation)- OAuth token from config (interactive login)
- Manual token from config file (fallback)
Other Improvements
doctorcommand now shows authentication method (oauth/env/token/none) with workspace name- Updated error messages to suggest
auth loginas the primary setup path - 6 new OAuth-specific error codes with actionable suggestions
- Build-time OAuth credential injection via Makefile ldflags
Technical Details
- New
internal/oauthpackage (stdlib only —net/http,crypto/rand) - CSRF protection via cryptographic state parameter
- Config file permissions remain 0600
- 14 new tests, 196 total passing
See CHANGELOG.md for full details.
v5.9.0 - Performance Optimizations & Critical Bug Fixes
🚀 Performance Optimizations
This release implements 5 major performance optimizations that provide 1.5-2x performance improvement for batch operations and repeated data access.
What's New
| Optimization | Best Case | Typical Case |
|---|---|---|
| Request Deduplication | 50% fewer API calls | 30% fewer calls |
| Parallel Operations | 80% faster bulk ops | 60% faster |
| Persistent Disk Cache | 60% better hit rate | 40% better |
| HTTP Keep-Alive | 20% latency reduction | 10% reduction |
| Response Compression | 70% bandwidth saved | 60% saved |
Phase 1: Request Deduplication
- Prevents duplicate concurrent API calls using promise memoization
- Automatically deduplicates identical requests in flight
- 30-50% reduction in duplicate API calls
- Files:
src/deduplication.ts(100% test coverage)
Phase 2: Parallel Operations
- Converts sequential operations to parallel execution
- Block deletion: 5 concurrent operations (configurable)
- Child fetching: 10 concurrent operations (configurable)
- 60-80% faster for bulk operations
- Files: Updated
src/notion.tswithbatchWithRetry
Phase 3: Persistent Disk Cache
- Cache persists across CLI invocations in
~/.notion-cli/cache/ - Atomic writes prevent corruption
- LRU eviction with 100MB default max size
- 40-60% improved cache hit rate
- Files:
src/utils/disk-cache.ts(95.38% test coverage)
Phase 4: HTTP Keep-Alive & Connection Pooling
- Reuses connections across requests
- Configurable pool size and keep-alive timeout
- 5-10% latency reduction
- Files:
src/http-agent.ts(100% test coverage)
Phase 5: Response Compression
- Automatic compression negotiation (gzip, deflate, brotli)
- 60-70% bandwidth reduction for JSON responses
- Zero configuration required
- Files: Updated
src/notion.tsfetch wrapper
🐛 Critical Bug Fixes
Three critical bugs identified during code review have been fixed:
1. Disk cache never returned data on first call
Problem: Fire-and-forget async pattern caused immediate cache miss.
Fix: Made cache.get() properly async with await for disk lookups.
2. HTTP agent imported but never used
Problem: Native fetch() doesn't support agent option.
Fix: Switched to undici Agent with dispatcher option.
3. Impossible error condition in parallel ops
Problem: Condition !result.success && result.data could never be true.
Fix: Changed to result.success && result.data && !result.data.success.
🧪 Testing
- 268 total tests (121 existing + 147 new)
- 90%+ coverage on all new code
- Zero test regressions
New Test Files
test/deduplication.test.ts- 37 tests (100% coverage)test/disk-cache.test.ts- 65 tests (95.38% coverage)test/http-agent.test.ts- 38 tests (100% coverage)test/cache-disk-integration.test.ts- 30 integration teststest/notion.test.ts- 59 integration teststest/parallel-operations.test.ts- 21 timing teststest/compression.test.ts- 18 tests
📦 Installation
npm install -g @coastal-programs/notion-cli@5.9.0🔧 Configuration
All features enabled by default. Configure via environment variables:
# Deduplication
NOTION_CLI_DEDUP_ENABLED=false
# Parallel Operations
NOTION_CLI_DELETE_CONCURRENCY=5
NOTION_CLI_CHILDREN_CONCURRENCY=10
# Disk Cache
NOTION_CLI_DISK_CACHE_ENABLED=false
NOTION_CLI_DISK_CACHE_MAX_SIZE=104857600
NOTION_CLI_DISK_CACHE_SYNC_INTERVAL=5000
# HTTP Keep-Alive
NOTION_CLI_HTTP_KEEP_ALIVE=false
NOTION_CLI_HTTP_KEEP_ALIVE_MS=60000
NOTION_CLI_HTTP_MAX_SOCKETS=50
NOTION_CLI_HTTP_MAX_FREE_SOCKETS=10
NOTION_CLI_HTTP_TIMEOUT=30000🔄 Migration
No breaking changes! All features work out of the box:
# Same commands, better performance
notion-cli db query <DB_ID>
# First run creates cache
notion-cli db query <DB_ID> # Fetches from API
# Second run uses disk cache
notion-cli db query <DB_ID> # Returns from cache (faster)📊 Dependencies
- Zero new production dependencies (uses Node.js built-ins only)
- All dependencies already in project
📝 Full Changelog
See CHANGELOG.md for complete details.
🤖 Built with Claude Code
v5.8.0 - Test Coverage & Codecov Improvements
🧪 What's New
This release significantly improves test coverage and Codecov integration.
✨ Test Coverage Improvements
- Comprehensive table-formatter tests: Added 75 unit tests achieving 100% line coverage and 96.42% branch coverage
- Covers all table rendering modes: CSV output, table formatting, sorting, filtering, and edge cases
- Includes real-world usage patterns from actual commands
- Tests follow project conventions with Mocha + Chai
🔧 Codecov Configuration
- Added
.codecov.ymlconfiguration file with coverage thresholds - Updated Codecov action to v4 (from v3)
- Fixed coverage file path to use
lcov.info - Configured PR comment layouts for better visibility
- Added flag definitions with carryforward enabled
📝 Documentation Updates
- Updated
docs/user-guides/envelope-testing.mdwith correct Codecov examples - Added explanatory comments to CI workflow for maintainability
- Improved documentation accuracy to match actual CI configuration
🐛 Bug Fixes
- Fixed table format tests for oclif v4 / cli-table3 compatibility
- Corrected coverage reporting paths in CI workflow
📊 Test Coverage Statistics
- table-formatter.ts: 100% lines | 96.42% branches | 100% functions
- 75 new unit tests added
- All CI checks passing ✅
🔗 Links
- Pull Request: #67
- Codecov Report: https://app.codecov.io/gh/Coastal-Programs/notion-cli/pull/67