Repository navigation
Conversation
These libraries enable bidirectional markdown conversion: - notion-to-md: Export Notion pages to markdown format - @tryfabric/martian: Convert markdown to Notion block format
New commands: - `user list` - List all workspace users with pagination support - `user get <user-id>` - Retrieve a specific user by ID - `user me` - Get the current bot user information Features: - Streaming support with --stream flag for large workspaces - All standard output formats (table, json, plain, compact) - Consistent error handling with existing commands
New commands: - `comment list <page-id>` - List all comments on a page - `comment add <page-id> <text>` - Add a new comment to a page Features: - Full pagination support for pages with many comments - Streaming support with --stream flag - All standard output formats (table, json, plain, compact) This enables CLI-based code review workflows and automated commenting on Notion pages.
New commands: - `team list` - List all teams/teamspaces in the workspace Note: Teams API is enterprise-only. The command gracefully handles non-enterprise workspaces by displaying a helpful message instead of throwing an error.
New functions: - exportPageToMarkdown(pageId, client) - Convert Notion page to markdown - importMarkdownToBlocks(content) - Convert markdown to Notion blocks Uses: - notion-to-md for Notion → Markdown conversion - @tryfabric/martian for Markdown → Notion block conversion This enables round-trip markdown workflows where users can export pages for editing in their preferred editor and re-import changes.
New API functions: - getUser(userId) - Retrieve a specific user - listTeams() - List teams (enterprise-only, graceful fallback) - listComments(blockId) - List comments on a page/block - createComment(pageId, richText) - Add a comment to a page - movePage(pageId, newParentId) - Move page to new parent - duplicatePage(pageId, options) - Deep copy page with all blocks The duplicatePage function handles complex nested structures: - Recursively copies all child blocks - Preserves column layouts and tables - Copies page icon and cover - Supports custom title for the duplicate Also includes helper functions for block type conversion to ensure proper handling of all Notion block types during duplication.
New page subcommands: \`page import <file>\` - Import a markdown file as a new Notion page - Options: --parent, --database, --title, --batch-size, --delay-ms - Handles files larger than 100 blocks via batched append \`page export <page-id>\` - Export a Notion page to markdown format - Options: --output (file path, defaults to stdout) \`page move <page-id>\` - Move a page to a new parent (page or database) - Options: --to <parent-id> - Auto-detects parent type (page vs database) \`page duplicate <page-id>\` - Create a deep copy of a page including all blocks - Options: --title (custom title for the copy) - Preserves nested content, columns, tables, icon, and cover These commands enable powerful CLI workflows for content management, backup/restore, and batch operations on Notion pages.
Register the new command modules in the main CLI entry point: - createUserCommand() for user management - createCommentCommand() for page comments - createTeamCommand() for team/teamspace listing All commands are now available via: onotion user [list|get|me] onotion comment [list|add] onotion team list
These are development artifacts used during implementation: - reference/ - cloned repos used for API patterns - PLAN.md - implementation planning document
|
Hey @elyase, thanks for the PR — sorry it took so long for me to get around to it, this somehow got lost in my inbox. The PR has a really nice scope and the duplicate logic around tables and column lists clearly took some work to get right. That said, there are a couple of things I'd want fixed before merging. The The bigger one is
A few smaller things:
Once the import title-prop and duplicate property/child-page issues are sorted I'm happy to merge. Thanks again, this is a nice addition :) |
Summary
This PR adds several new features to make onotion a more complete Notion CLI, inspired by features from litencatt/notion-cli and the official Notion MCP server.
New Commands
User Management
onotion user list- List all workspace users with paginationonotion user get <user-id>- Get a specific user by IDonotion user me- Get the current bot userComments
onotion comment list <page-id>- List all comments on a pageonotion comment add <page-id> <text>- Add a comment to a pageTeams (Enterprise)
onotion team list- List teams/teamspaces (gracefully handles non-enterprise)Page Operations
onotion page import <file.md>- Import markdown file as a new pageonotion page export <page-id>- Export page to markdownonotion page move <page-id> --to <parent-id>- Move page to new parentonotion page duplicate <page-id>- Deep copy page with all blocksNew Dependencies
notion-to-md- For exporting Notion pages to markdown@tryfabric/martian- For converting markdown to Notion blocksTechnical Details
duplicatePagehandles complex nested structures (columns, tables, nested blocks)movePageauto-detects parent type (page vs database)Testing
pnpm buildpassespnpm test- 25 tests passpage importwith real markdown filepage exportround-tripuser mewith real Notion workspaceTest plan
onotion user meto verify user commandsonotion page import <file.md> -p <parent-id>with a markdown fileonotion page export <page-id>to verify markdown outputonotion comment list <page-id>on a page with comments🤖 Generated with Claude Code