Loading...
Loading...
Compare original and translation side by side
https://github.com/user/repogithub.com/user/repouser/repohttps://github.com/user/repogithub.com/user/repouser/repoanalysis-20240314-123045repo/git clonerepo/analysis-20240314-123045repo/git clonerepo/repo/analysis-20240314-123045/
├── repo/ # clone 的仓库代码
├── reports/ # 分析报告目录
│ ├── 01-主题1.md
│ ├── 02-主题2.md
│ ├── 03-主题3.md
│ └── 04-其他用户要求的主题.md
└── notion-sync.log # Notion 同步日志(如果启用notion同步脚本)repo/analysis-20240314-123045/
├── repo/ # Cloned repository code
├── reports/ # Analysis report directory
│ ├── 01-Topic1.md
│ ├── 02-Topic2.md
│ ├── 03-Topic3.md
│ └── 04-OtherUserRequestedTopics.md
└── notion-sync.log # Notion synchronization log (if notion sync script is enabled)~/.config/notion/api_keyscripts/notion_sync.pynotion-sync.log~/.config/notion/api_keyscripts/notion_sync.pynotion-sync.logscripts/notion_sync.pylistinfoundefinedscripts/notion_sync.pylistinfoundefined
**命令说明**:
| 命令 | 说明 | 示例 |
|------|------|------|
| `list` | 列出所有可用的父页面 | `python3 notion_sync.py list` |
| `list <query>` | 搜索特定页面 | `python3 notion_sync.py list "Reports"` |
| `info <page_id>` | 获取页面详细信息 | `python3 notion_sync.py info abc123...` |
| `upload <path> <page_id>` | 上传 Markdown 文件或目录 | `python3 notion_sync.py upload report.md abc123...` |
**示例**:
```bash
**Command Explanation**:
| Command | Description | Example |
|------|------|------|
| `list` | List all available parent pages | `python3 notion_sync.py list` |
| `list <query>` | Search for specific pages | `python3 notion_sync.py list "Reports"` |
| `info <page_id>` | Get page details | `python3 notion_sync.py info abc123...` |
| `upload <path> <page_id>` | Upload Markdown file or directory | `python3 notion_sync.py upload report.md abc123...` |
**Examples**:
```bash
**参数说明**:
- `path`: Markdown 文件路径或目录路径(必需)
- `parent_page_id`: Notion 父页面 ID(必需)
- `title`: 自定义标题(可选)
- 单文件:作为页面标题
- 目录:作为目录父页面标题,默认使用目录名
**Notion 页面结构(目录上传)**:
当上传目录时,脚本会创建层级结构:
**支持的 Markdown 格式**:
- 标题:`#`、`##`、`###`、`####`
- 代码块:```language ... ```(自动识别语言)
- 无序列表:`- ` 或 `* `
- 有序列表:`1.`、`2.`
- 引用块:`> `
- 分隔线:`---` 或 `***`
- 普通段落
**分块上传机制**:
Notion API 限制每次最多 100 个 blocks。对于大文件,脚本会自动:
1. 创建空页面
2. 分批次追加 blocks(每次最多 100 个)
3. 支持无限大小的 Markdown 文件
**API 配置**:
- API 版本: `2022-06-28`
- 认证方式: Bearer Token
- 配置文件: `~/.config/notion/api_key`
**错误处理**:
- API Key 不存在:返回 `{"success": false, "error": "..."}`
- 路径不存在:返回错误信息
- 单文件非 .md 格式:返回错误
- API 调用失败:记录到 `errors` 数组,继续处理其他文件
**输出格式**:
脚本返回 JSON 格式的结果:
```json
{
"success": true,
"synced_files": ["/path/to/file1.md", "/path/to/file2.md"],
"errors": [],
"pages_created": [
{
"type": "directory",
"path": "/path/to/reports",
"notion_page_id": "xxx",
"url": "https://notion.so/xxx"
},
{
"type": "file",
"file": "/path/to/file1.md",
"notion_page_id": "xxx",
"url": "https://notion.so/xxx",
"parent_directory": "reports"
}
]
}references/notion-sync.md
**Parameter Explanation**:
- `path`: Markdown file path or directory path (required)
- `parent_page_id`: Notion parent page ID (required)
- `title`: Custom title (optional)
- Single file: Used as page title
- Directory: Used as directory parent page title, defaults to directory name
**Notion Page Structure (Directory Upload)**:
When uploading a directory, the script will create a hierarchical structure:
**Supported Markdown Formats**:
- Headings: `#`, `##`, `###`, `####`
- Code blocks: ```language ... ``` (auto-detects language)
- Unordered lists: `- ` or `* `
- Ordered lists: `1.`, `2.`
- Blockquotes: `> `
- Horizontal rules: `---` or `***`
- Regular paragraphs
**Chunked Upload Mechanism**:
Notion API limits a maximum of 100 blocks per request. For large files, the script will automatically:
1. Create an empty page
2. Append blocks in batches (up to 100 blocks each time)
3. Supports Markdown files of unlimited size
**API Configuration**:
- API Version: `2022-06-28`
- Authentication Method: Bearer Token
- Configuration File: `~/.config/notion/api_key`
**Error Handling**:
- API Key does not exist: Returns `{"success": false, "error": "..."}`
- Path does not exist: Returns error message
- Single file is not .md format: Returns error
- API call fails: Records to `errors` array, continues processing other files
**Output Format**:
The script returns results in JSON format:
```json
{
"success": true,
"synced_files": ["/path/to/file1.md", "/path/to/file2.md"],
"errors": [],
"pages_created": [
{
"type": "directory",
"path": "/path/to/reports",
"notion_page_id": "xxx",
"url": "https://notion.so/xxx"
},
{
"type": "file",
"file": "/path/to/file1.md",
"notion_page_id": "xxx",
"url": "https://notion.so/xxx",
"parent_directory": "reports"
}
]
}references/notion-sync.mdrepo/reports/repo/reports/repo/reports//github-analysis/analysis-<timestamp>/reports/repo//github-analysis/analysis-<timestamp>/✅ 仓库分析完成!
📁 分析报告位置:/github-analysis/analysis-20240314-123045/reports/
📄 生成文件:
- 01-项目架构概览.md
- 02-代码质量分析.md
- 03-核心模块说明.md
📊 分析摘要:
- 技术栈:Python/FastAPI + React
- 代码文件:127 个
- 主要问题:发现 3 处潜在问题,详见代码质量分析报告
🔄 Notion 同步:已同步到 https://notion.so/xxx(如适用)
❓ 是否删除 clone 的仓库?(y/n)✅ Repository analysis completed!
📁 Analysis report location: /github-analysis/analysis-20240314-123045/reports/
📄 Generated files:
- 01-Project Architecture Overview.md
- 02-Code Quality Analysis.md
- 03-Core Module Description.md
📊 Analysis Summary:
- Tech Stack: Python/FastAPI + React
- Code Files: 127
- Main Issues: 3 potential issues found, see Code Quality Analysis report for details
🔄 Notion Synchronization: Synced to https://notion.so/xxx (if applicable)
❓ Delete cloned repository? (y/n)undefinedundefinedundefinedundefined