feat(notion): CLI integration — REST client, ask agent, MCP tools#186
Merged
Conversation
Adds an internal/notion package mirroring the Sentry/Linear shape: REST
client with Bearer auth + Notion-Version header, 429 backoff honoring
Retry-After, pages/databases/blocks/users operations, bounded recursive
block-tree fetch, minimal markdown↔blocks converter, and per-workspace
conversation history.
Surfaces the Notion share-with-integration gotcha in empty-state copy
and the ask-flow system prompt — the most common UX papercut for fresh
integrations.
CLI: `clanker notion {list,get,search,page,db,ask}`. MCP: 10 tools
(6 read + 4 destructive) registered alongside the existing providers.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
internal/notion/(client, pages, databases, blocks, markdown, users, conversation, status, static_commands) mirroring the Sentry/Linear shapeclanker notion {ask, list, get, search, page, db}for natural-language and direct opscreate_page,append_blocks,update_page_properties,create_database_row)Notes
Authorization: Bearer <token>+Notion-Version: 2022-06-28(opposite of Linear, which uses the raw key)get blockspredictable against the 3 req/sec rate limitRetry-After, capped at 30s; network-retry uses exponential backoffBlocksToMarkdown/searchcall instead of three round-tripsnotion.integration_token+ optionalnotion.default_database_id; env fallbackNOTION_API_KEY/NOTION_DATABASE_ID~/.clanker/notion-{workspace}.jsonTest plan
go test -race ./internal/notion/...— happy path, 429 withRetry-After, share-failure empty results, auth-error envelope extraction, conversation round-trip, markdown→blocks fidelity, safeSlug path-traversal defensego build ./...cleanclanker notion --helprenders subcommand treeclanker notion search "runbook",clanker notion page append --page <id> --text "## test",clanker notion ask "what databases do we have?"clanker mcp --transport stdioexposesclanker_notion_*tools