Skip to content

fast01/cc_export

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

English | 中文

cc_export

将 Claude Code 当前会话的 JSONL 记录一键导出为可读的 Markdown 文件, 包含全部细节内容。

✨ 功能

  • 在 Claude Code 中输入 /cc_export 即可触发
  • 自动定位当前会话的 JSONL 文件
  • 转换为结构清晰的 Markdown(含角色标记、工具调用、思考过程折叠)
  • 输出到项目根目录,文件名为 <session-id>.md

🚀 一键安装

curl -fsSL https://raw.githubusercontent.com/fast01/cc_export/main/install.sh | bash

📦 手动安装

** 系统需要安装有 python **

git clone https://github.com/fast01/cc_export.git
cd cc_export

# 安装命令文件
mkdir -p ~/.claude/commands
cp cc_export.md ~/.claude/commands/

# 安装 Python 脚本
mkdir -p ~/.claude/bin
cp cc_export.py ~/.claude/bin/
chmod +x ~/.claude/bin/cc_export.py

📖 使用方法

在 Claude Code 中输入:

/cc_export

Claude 会自动:

  1. 通过 ${CLAUDE_SESSION_ID} 定位当前会话 JSONL 文件
  2. 调用 python3 ~/.claude/bin/cc_export.py 执行转换
  3. 在项目根目录生成 <session-id>.md

📁 文件结构

安装后的文件布局:

~/.claude/
├── commands/
│   └── cc_export.md       # slash 命令(Claude 读取的 prompt)
└── bin/
    └── cc_export.py       # JSONL → Markdown 转换脚本

🔧 自定义

修改输出路径

编辑 ~/.claude/commands/cc_export.md,修改步骤 3 中的输出路径:

python3 ~/.claude/bin/cc_export.py "<JSONL_PATH>" "<你想要的路径>"

或者手动执行该命令。

修改 Markdown 格式

直接编辑 ~/.claude/bin/cc_export.py,按需调整。

🗑️ 卸载

rm ~/.claude/commands/cc_export.md
rm ~/.claude/bin/cc_export.py

⚠️ 已知限制

  • ${CLAUDE_SESSION_ID} 在 skill/command 模板中以字符串替换方式生效(v2.1.9+), 但不一定作为环境变量暴露到 shell。命令中已包含兜底逻辑(取最新 JSONL 文件)。
  • JSONL 格式可能随 Claude Code 版本更新而变化,Python 脚本可能需要相应调整。

📄 License

MIT

About

enhanced version of /export (export claude code conversation to md with full details)

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors