Skip to main content
vincentor

notion-cli

by vincentorv1.0.0

Notion CLI 集成 - 管理页面、数据库、内容块、搜索和导出

Installation guide →
1 skill 8 commands GitHub

Commands

notion-block

管理 Notion 页面内容块 - 添加文本、列表、代码等

notion-config

管理 Notion CLI 配置 - 设置 Token、查看配置

notion-db

操作 Notion 数据库 - 查询、添加、更新记录

notion-export

导出 Notion 页面为 Markdown、JSON 或纯文本

notion-page

创建、查看、更新 Notion 页面

notion-search

搜索 Notion 页面和数据库

notion-todo

管理 Notion 中的待办事项 - 添加、完成、查看

notion-write

在 Notion 中快速创建和编写内容 - 文章、笔记、文档

Documentation

# Notion CLI Plugin for Claude Code

一个强大的 Claude Code 插件,提供完整的 Notion 工作区管理功能。

## 功能特性

- 📝 **页面管理** - 创建、编辑、删除页面
- 🗄️ **数据库操作** - 完整的 CRUD 操作支持
- 🔍 **全局搜索** - 快速查找页面和数据库
- ✅ **待办管理** - 添加、更新、完成待办事项
- 📊 **内容块编辑** - 支持 30+ 种块类型
- 💾 **导出功能** - Markdown/JSON/Text 格式导出
- 🎯 **智能工作流** - 针对常见场景优化的命令组合

## 快速开始

### 1. 安装依赖

```bash
cd notion-cli/src
uv sync
```

### 2. 配置 Token

```bash
uv run notion-cli config set-token
```

或者设置环境变量:

```bash
export NOTION_TOKEN=secret_your_token_here
```

### 3. 授权访问

在 Notion 中为页面/数据库添加 Integration 访问权限:
1. 打开页面/数据库
2. 点击右上角 "..." 菜单
3. 选择 "Add connections" → 选择你的 Integration

## Skill

### `/notion`

主技能,支持所有 Notion 操作。当用户提到 Notion、笔记、数据库时自动激活。

## Commands

| 命令 | 说明 |
|------|------|
| `/notion-search` | 搜索页面和数据库 |
| `/notion-page` | 页面操作(创建、查看、更新、删除) |
| `/notion-db` | 数据库操作(查询、添加、更新记录) |
| `/notion-block` | 内容块操作(添加文本、列表、代码等) |
| `/notion-export` | 导出页面为 Markdown/JSON/Text |
| `/notion-config` | 配置管理(Token 设置) |

## 使用示例

```bash
# 搜索笔记
/notion-search 项目计划

# 列出数据库
/notion-db list

# 查看数据库记录
/notion-db rows <database_id>

# 添加数据库记录
/notion-db add <database_id> -p "Name=新任务" -p "Status:select=Todo"

# 导出页面
/notion-export <page_id> --format markdown

# 添加内容块
/notion-block add <page_id> --type heading_1 --content "标题"
```

## 配置文件

- 配置目录:`~/.notion-cli/`
- Token 存储:`~/.notion-cli/config.yaml`

## 许可证

MIT