opencode-log 0.3.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- opencode_log/__init__.py +3 -0
- opencode_log/cache.py +240 -0
- opencode_log/cli.py +565 -0
- opencode_log/markdown.py +197 -0
- opencode_log/models.py +131 -0
- opencode_log/normalizer.py +146 -0
- opencode_log/render.py +360 -0
- opencode_log/storage.py +271 -0
- opencode_log/templates/combined.html +345 -0
- opencode_log/templates/components/base_styles.css +126 -0
- opencode_log/templates/components/edit_diff_styles.css +76 -0
- opencode_log/templates/components/filter_styles.css +168 -0
- opencode_log/templates/components/global_styles.css +237 -0
- opencode_log/templates/components/message_styles.css +1057 -0
- opencode_log/templates/components/page_nav_styles.css +79 -0
- opencode_log/templates/components/project_card_styles.css +138 -0
- opencode_log/templates/components/pygments_styles.css +218 -0
- opencode_log/templates/components/search.html +774 -0
- opencode_log/templates/components/search_inline.html +29 -0
- opencode_log/templates/components/search_inline_script.html +3 -0
- opencode_log/templates/components/search_results_panel.html +10 -0
- opencode_log/templates/components/search_styles.css +371 -0
- opencode_log/templates/components/session_nav.html +39 -0
- opencode_log/templates/components/session_nav_styles.css +106 -0
- opencode_log/templates/components/timeline.html +493 -0
- opencode_log/templates/components/timeline_styles.css +151 -0
- opencode_log/templates/components/timezone_converter.js +115 -0
- opencode_log/templates/components/todo_styles.css +186 -0
- opencode_log/templates/index.html +308 -0
- opencode_log/templates/transcript.html +372 -0
- opencode_log-0.3.0.dist-info/METADATA +519 -0
- opencode_log-0.3.0.dist-info/RECORD +35 -0
- opencode_log-0.3.0.dist-info/WHEEL +4 -0
- opencode_log-0.3.0.dist-info/entry_points.txt +2 -0
- opencode_log-0.3.0.dist-info/licenses/LICENSE +21 -0
|
@@ -0,0 +1,519 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: opencode-log
|
|
3
|
+
Version: 0.3.0
|
|
4
|
+
Summary: Generate browsable HTML logs from OpenCode local storage
|
|
5
|
+
Project-URL: Homepage, https://github.com/CatVinci-Studio/opencode-log
|
|
6
|
+
Project-URL: Repository, https://github.com/CatVinci-Studio/opencode-log
|
|
7
|
+
Project-URL: Issues, https://github.com/CatVinci-Studio/opencode-log/issues
|
|
8
|
+
Project-URL: Documentation, https://catvinci-studio.github.io/opencode-log/
|
|
9
|
+
Author: opencode-log contributors
|
|
10
|
+
License-Expression: MIT
|
|
11
|
+
License-File: LICENSE
|
|
12
|
+
Keywords: cli,html,logs,opencode,transcript
|
|
13
|
+
Classifier: Environment :: Console
|
|
14
|
+
Classifier: Operating System :: OS Independent
|
|
15
|
+
Classifier: Programming Language :: Python :: 3
|
|
16
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
17
|
+
Classifier: Topic :: Software Development :: Build Tools
|
|
18
|
+
Requires-Python: >=3.10
|
|
19
|
+
Requires-Dist: click>=8.1.7
|
|
20
|
+
Requires-Dist: dateparser>=1.2.0
|
|
21
|
+
Requires-Dist: jinja2>=3.1.4
|
|
22
|
+
Requires-Dist: mistune>=3.1.4
|
|
23
|
+
Requires-Dist: pygments>=2.19.0
|
|
24
|
+
Description-Content-Type: text/markdown
|
|
25
|
+
|
|
26
|
+
# opencode-log
|
|
27
|
+
|
|
28
|
+
`opencode-log` is a powerful CLI tool that turns local OpenCode sessions into clean, interactive, and searchable HTML logs with advanced visualization features.
|
|
29
|
+
|
|
30
|
+
[GitHub Repository](https://github.com/CatVinci-Studio/opencode-log) | [Issues](https://github.com/CatVinci-Studio/opencode-log/issues) | [Docs / GitHub Pages](https://catvinci-studio.github.io/opencode-log/)
|
|
31
|
+
|
|
32
|
+
---
|
|
33
|
+
|
|
34
|
+
## English
|
|
35
|
+
|
|
36
|
+
### What It Does
|
|
37
|
+
|
|
38
|
+
`opencode-log` reads OpenCode local storage and generates a rich, interactive browsable site with:
|
|
39
|
+
|
|
40
|
+
- A global `index.html` with project cards and statistics
|
|
41
|
+
- Per-project `combined_transcripts.html` with all sessions combined
|
|
42
|
+
- Per-session `session-<id>.html` files for detailed review
|
|
43
|
+
- Full Markdown export support for lightweight sharing
|
|
44
|
+
|
|
45
|
+
It is designed for reviewing long coding sessions, tool traces, reasoning blocks, token/cost usage, and project evolution over time.
|
|
46
|
+
|
|
47
|
+
### Key Features
|
|
48
|
+
|
|
49
|
+
#### 🎨 **Modern, Interactive UI**
|
|
50
|
+
- **Timeline Visualization**: Interactive, zoomable timeline (vis-timeline) with message grouping and click-to-navigate
|
|
51
|
+
- **Advanced Search & Filter**: Real-time search with message type filtering (user, assistant, tool, reasoning)
|
|
52
|
+
- **Floating Action Buttons**: Quick access to timeline, search, details toggle, and scroll-to-top
|
|
53
|
+
- **Timezone Conversion**: Automatic conversion of all timestamps to local timezone
|
|
54
|
+
- **Responsive Design**: Works seamlessly on desktop and mobile devices
|
|
55
|
+
|
|
56
|
+
#### 📊 **Rich Content Rendering**
|
|
57
|
+
- **Syntax Highlighting**: Code blocks with Pygments syntax highlighting for multiple languages
|
|
58
|
+
- **Markdown Support**: Full markdown rendering with mistune
|
|
59
|
+
- **Message Folding**: Collapsible tool calls, reasoning blocks, and nested content
|
|
60
|
+
- **Message Types**: Support for user/assistant messages, tool use/results, thinking content, and more
|
|
61
|
+
|
|
62
|
+
#### 💾 **OpenCode-Specific Features**
|
|
63
|
+
- **Todo Lists**: Display session todo items from `storage/todo/*.json`
|
|
64
|
+
- **Session Diffs**: Show file changes with additions/deletions from `storage/session_diff/*.json`
|
|
65
|
+
- **Token Metrics**: Track input/output/reasoning/cache tokens per message and session
|
|
66
|
+
- **Cost Tracking**: Calculate and display session and project costs
|
|
67
|
+
|
|
68
|
+
#### ⚡ **Performance & Efficiency**
|
|
69
|
+
- **Smart Caching**: Parsed session cache and render signature cache (skip unchanged pages)
|
|
70
|
+
- **Lazy Loading**: Timeline and syntax highlighting load on-demand
|
|
71
|
+
- **Pagination Support**: Large sessions automatically split into manageable pages
|
|
72
|
+
- **Incremental Rendering**: Only regenerate changed files
|
|
73
|
+
|
|
74
|
+
#### 🔍 **Data Analysis**
|
|
75
|
+
- **Date Range Filtering**: Natural language date filtering (e.g., "7 days ago", "yesterday")
|
|
76
|
+
- **Session Statistics**: Message count, tool usage, token consumption, and cost per session
|
|
77
|
+
- **Project Overview**: Aggregate statistics across all projects and sessions
|
|
78
|
+
- **Search History**: Browser-side search with instant results
|
|
79
|
+
|
|
80
|
+
### Installation
|
|
81
|
+
|
|
82
|
+
#### Option A: Local development install
|
|
83
|
+
|
|
84
|
+
```bash
|
|
85
|
+
cd opencode-log
|
|
86
|
+
pip install -e .
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
#### Option B: Run with `uvx` from local path
|
|
90
|
+
|
|
91
|
+
```bash
|
|
92
|
+
uvx --from /path/to/opencode-log opencode-log --help
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
#### Option C: Run with `uvx` from PyPI (after release)
|
|
96
|
+
|
|
97
|
+
```bash
|
|
98
|
+
uvx opencode-log --help
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
### Quick Start
|
|
102
|
+
|
|
103
|
+
```bash
|
|
104
|
+
# Process all projects and open in browser (default behavior)
|
|
105
|
+
opencode-log
|
|
106
|
+
|
|
107
|
+
# Process all projects without opening browser
|
|
108
|
+
opencode-log --no-open-browser
|
|
109
|
+
|
|
110
|
+
# Process specific project
|
|
111
|
+
opencode-log /path/to/your/project
|
|
112
|
+
|
|
113
|
+
# Filter by date range with natural language
|
|
114
|
+
opencode-log --from-date "7 days ago" --to-date "today"
|
|
115
|
+
|
|
116
|
+
# Generate both HTML and Markdown
|
|
117
|
+
opencode-log --format both
|
|
118
|
+
|
|
119
|
+
# Check environment and storage
|
|
120
|
+
opencode-log --doctor
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
### CLI Options
|
|
124
|
+
|
|
125
|
+
```text
|
|
126
|
+
Positional Arguments:
|
|
127
|
+
[PROJECT_PATH] Optional path to specific project directory
|
|
128
|
+
|
|
129
|
+
Storage & Input:
|
|
130
|
+
--storage-dir PATH OpenCode storage directory
|
|
131
|
+
[default: ~/.local/share/opencode/storage]
|
|
132
|
+
|
|
133
|
+
Output Control:
|
|
134
|
+
-o, --output PATH Output directory [default: ./opencode-logs]
|
|
135
|
+
-f, --format [html|md|markdown|both]
|
|
136
|
+
Output format [default: html]
|
|
137
|
+
|
|
138
|
+
Project Selection:
|
|
139
|
+
--all-projects Process all projects (default if no PROJECT_PATH)
|
|
140
|
+
--max-sessions INTEGER Limit sessions per project
|
|
141
|
+
|
|
142
|
+
Date Filtering:
|
|
143
|
+
--from-date TEXT Filter from date (e.g., "2 hours ago", "yesterday")
|
|
144
|
+
--to-date TEXT Filter to date (e.g., "1 hour ago", "today")
|
|
145
|
+
|
|
146
|
+
Session Control:
|
|
147
|
+
--no-individual-sessions Skip individual session files
|
|
148
|
+
--page-size INTEGER Messages per page [default: 2000]
|
|
149
|
+
|
|
150
|
+
Cache Management:
|
|
151
|
+
--no-cache Disable caching
|
|
152
|
+
--clear-cache Clear cache before processing
|
|
153
|
+
--clear-output Clear output files before processing
|
|
154
|
+
|
|
155
|
+
Browser:
|
|
156
|
+
--no-open-browser Don't open browser after generation
|
|
157
|
+
(default is to auto-open)
|
|
158
|
+
|
|
159
|
+
Feature Toggles:
|
|
160
|
+
--no-todos Skip loading/rendering todos
|
|
161
|
+
--no-diffs Skip loading/rendering diffs
|
|
162
|
+
--no-timeline Disable timeline visualization
|
|
163
|
+
--no-syntax-highlight Disable code syntax highlighting
|
|
164
|
+
|
|
165
|
+
Debugging:
|
|
166
|
+
--doctor Run environment checks and exit
|
|
167
|
+
--debug Show full traceback on errors
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
### Advanced Examples
|
|
171
|
+
|
|
172
|
+
```bash
|
|
173
|
+
# Fast generation: disable optional features
|
|
174
|
+
opencode-log --no-timeline --no-syntax-highlight --no-todos --no-diffs
|
|
175
|
+
|
|
176
|
+
# Clean regeneration
|
|
177
|
+
opencode-log --clear-cache --clear-output
|
|
178
|
+
|
|
179
|
+
# Export to markdown for sharing
|
|
180
|
+
opencode-log --format markdown -o ./export
|
|
181
|
+
|
|
182
|
+
# Process recent sessions only
|
|
183
|
+
opencode-log --from-date "last week" --max-sessions 10
|
|
184
|
+
|
|
185
|
+
# Single project with custom output
|
|
186
|
+
opencode-log /path/to/project -o ./my-project-logs
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
### Output Structure
|
|
190
|
+
|
|
191
|
+
```text
|
|
192
|
+
opencode-logs/
|
|
193
|
+
├── index.html
|
|
194
|
+
├── projects/
|
|
195
|
+
│ ├── <project-slug>/
|
|
196
|
+
│ │ ├── combined_transcripts.html
|
|
197
|
+
│ │ ├── session-<id>.html
|
|
198
|
+
│ │ └── ...
|
|
199
|
+
└── .opencode-log-cache/
|
|
200
|
+
├── state.json
|
|
201
|
+
└── sessions/
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
### Notes
|
|
205
|
+
|
|
206
|
+
- Primary data source is OpenCode internal storage.
|
|
207
|
+
- Storage schema is internal and may change in future OpenCode versions.
|
|
208
|
+
- Cache files live under `<output>/.opencode-log-cache/`.
|
|
209
|
+
|
|
210
|
+
### Common Warnings
|
|
211
|
+
|
|
212
|
+
#### Multiple Session Schema Versions
|
|
213
|
+
|
|
214
|
+
If you see:
|
|
215
|
+
```
|
|
216
|
+
Warning: multiple session schema versions detected: 1.1.32, 1.1.34, ...
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
**This is normal!** It means you've used different versions of OpenCode over time. opencode-log automatically handles all versions and this warning is informational only.
|
|
220
|
+
|
|
221
|
+
**To hide the warning:**
|
|
222
|
+
```bash
|
|
223
|
+
opencode-log --no-warnings
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
**Why it happens:**
|
|
227
|
+
- OpenCode evolves its storage format across versions
|
|
228
|
+
- Your historical sessions remain in the storage directory
|
|
229
|
+
- Each session records the OpenCode version that created it
|
|
230
|
+
|
|
231
|
+
**Impact:** None. All versions are fully supported and compatible.
|
|
232
|
+
|
|
233
|
+
### Release to PyPI
|
|
234
|
+
|
|
235
|
+
Recommended (GitHub Actions + Trusted Publishing):
|
|
236
|
+
|
|
237
|
+
1. In PyPI project settings, add a Trusted Publisher for this repo:
|
|
238
|
+
- Owner: `CatVinci-Studio`
|
|
239
|
+
- Repository: `opencode-log`
|
|
240
|
+
- Workflow: `.github/workflows/release.yml`
|
|
241
|
+
- Environment: `pypi`
|
|
242
|
+
2. Publish to PyPI by either:
|
|
243
|
+
- manually running workflow **Release Python Package**, or
|
|
244
|
+
- creating and pushing a version tag (for example `v0.3.1`).
|
|
245
|
+
|
|
246
|
+
```bash
|
|
247
|
+
git tag v0.3.1
|
|
248
|
+
git push origin v0.3.1
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
Optional local publish (token-based):
|
|
252
|
+
|
|
253
|
+
```bash
|
|
254
|
+
# 1) Build
|
|
255
|
+
uv build
|
|
256
|
+
|
|
257
|
+
# 2) Validate package metadata
|
|
258
|
+
uvx twine check dist/*
|
|
259
|
+
|
|
260
|
+
# 3) Upload to PyPI
|
|
261
|
+
uvx twine upload dist/*
|
|
262
|
+
```
|
|
263
|
+
|
|
264
|
+
### GitHub Pages (Project Website)
|
|
265
|
+
|
|
266
|
+
You can host docs/examples on GitHub Pages from this repository.
|
|
267
|
+
|
|
268
|
+
Recommended setup:
|
|
269
|
+
|
|
270
|
+
1. Push repository to: `https://github.com/CatVinci-Studio/opencode-log`
|
|
271
|
+
2. In GitHub repo settings, open **Pages**
|
|
272
|
+
3. Set source to **GitHub Actions**
|
|
273
|
+
4. Add a docs workflow (or publish static files from `docs/`)
|
|
274
|
+
5. Site URL will be:
|
|
275
|
+
`https://catvinci-studio.github.io/opencode-log/`
|
|
276
|
+
|
|
277
|
+
---
|
|
278
|
+
|
|
279
|
+
## 中文
|
|
280
|
+
|
|
281
|
+
### 项目介绍
|
|
282
|
+
|
|
283
|
+
`opencode-log` 是一个功能强大的 CLI 工具,用于将本地 OpenCode 会话转换成交互式、可搜索的 HTML 日志网站,并提供高级可视化功能。
|
|
284
|
+
|
|
285
|
+
它会生成:
|
|
286
|
+
|
|
287
|
+
- 全局索引页 `index.html` 及项目卡片统计
|
|
288
|
+
- 每个项目的 `combined_transcripts.html`(合并所有会话)
|
|
289
|
+
- 每个会话的 `session-<id>.html` 详细页面
|
|
290
|
+
- 完整的 Markdown 导出支持,便于分享
|
|
291
|
+
|
|
292
|
+
适合用于回看长对话、工具调用过程、reasoning 内容、token/cost 使用情况,以及项目演进历史。
|
|
293
|
+
|
|
294
|
+
### 核心功能
|
|
295
|
+
|
|
296
|
+
#### 🎨 **现代化交互界面**
|
|
297
|
+
- **时间线可视化**:交互式、可缩放的时间线(vis-timeline),支持消息分组和点击导航
|
|
298
|
+
- **高级搜索与过滤**:实时搜索,支持按消息类型过滤(用户、助手、工具、推理)
|
|
299
|
+
- **悬浮操作按钮**:快速访问时间线、搜索、详情切换和回到顶部
|
|
300
|
+
- **时区转换**:自动将所有时间戳转换为本地时区显示
|
|
301
|
+
- **响应式设计**:在桌面和移动设备上无缝工作
|
|
302
|
+
|
|
303
|
+
#### 📊 **丰富内容渲染**
|
|
304
|
+
- **语法高亮**:使用 Pygments 为多种编程语言提供代码高亮
|
|
305
|
+
- **Markdown 支持**:使用 mistune 进行完整 markdown 渲染
|
|
306
|
+
- **消息折叠**:可折叠的工具调用、推理块和嵌套内容
|
|
307
|
+
- **消息类型**:支持用户/助手消息、工具使用/结果、思考内容等
|
|
308
|
+
|
|
309
|
+
#### 💾 **OpenCode 专属功能**
|
|
310
|
+
- **Todo 列表**:显示来自 `storage/todo/*.json` 的会话任务
|
|
311
|
+
- **会话 Diff**:展示来自 `storage/session_diff/*.json` 的文件变更(增加/删除行数)
|
|
312
|
+
- **Token 指标**:跟踪每条消息和会话的输入/输出/推理/缓存 token
|
|
313
|
+
- **成本追踪**:计算并显示会话和项目成本
|
|
314
|
+
|
|
315
|
+
#### ⚡ **性能与效率**
|
|
316
|
+
- **智能缓存**:解析会话缓存和渲染签名缓存(跳过未变化的页面)
|
|
317
|
+
- **按需加载**:时间线和语法高亮按需加载
|
|
318
|
+
- **分页支持**:大型会话自动分页为可管理的页面
|
|
319
|
+
- **增量渲染**:仅重新生成已更改的文件
|
|
320
|
+
|
|
321
|
+
#### 🔍 **数据分析**
|
|
322
|
+
- **日期范围过滤**:自然语言日期过滤(如 "7 days ago"、"yesterday")
|
|
323
|
+
- **会话统计**:每个会话的消息数、工具使用、token 消耗和成本
|
|
324
|
+
- **项目概览**:跨所有项目和会话的汇总统计
|
|
325
|
+
- **搜索历史**:浏览器端搜索,即时结果
|
|
326
|
+
|
|
327
|
+
### 安装方式
|
|
328
|
+
|
|
329
|
+
#### 方式 A:本地开发安装
|
|
330
|
+
|
|
331
|
+
```bash
|
|
332
|
+
cd opencode-log
|
|
333
|
+
pip install -e .
|
|
334
|
+
```
|
|
335
|
+
|
|
336
|
+
#### 方式 B:使用 `uvx` 运行本地项目
|
|
337
|
+
|
|
338
|
+
```bash
|
|
339
|
+
uvx --from /path/to/opencode-log opencode-log --help
|
|
340
|
+
```
|
|
341
|
+
|
|
342
|
+
#### 方式 C:发布后直接 `uvx` 运行
|
|
343
|
+
|
|
344
|
+
```bash
|
|
345
|
+
uvx opencode-log --help
|
|
346
|
+
```
|
|
347
|
+
|
|
348
|
+
### 快速开始
|
|
349
|
+
|
|
350
|
+
```bash
|
|
351
|
+
# 处理全部项目并自动打开浏览器(默认行为)
|
|
352
|
+
opencode-log
|
|
353
|
+
|
|
354
|
+
# 处理全部项目但不打开浏览器
|
|
355
|
+
opencode-log --no-open-browser
|
|
356
|
+
|
|
357
|
+
# 处理指定项目
|
|
358
|
+
opencode-log /你的项目路径
|
|
359
|
+
|
|
360
|
+
# 用自然语言过滤日期范围
|
|
361
|
+
opencode-log --from-date "7 days ago" --to-date "today"
|
|
362
|
+
|
|
363
|
+
# 同时生成 HTML 和 Markdown
|
|
364
|
+
opencode-log --format both
|
|
365
|
+
|
|
366
|
+
# 环境检查
|
|
367
|
+
opencode-log --doctor
|
|
368
|
+
```
|
|
369
|
+
|
|
370
|
+
### CLI 参数说明
|
|
371
|
+
|
|
372
|
+
```text
|
|
373
|
+
位置参数:
|
|
374
|
+
[PROJECT_PATH] 可选的项目目录路径
|
|
375
|
+
|
|
376
|
+
存储与输入:
|
|
377
|
+
--storage-dir PATH OpenCode 存储目录
|
|
378
|
+
[默认: ~/.local/share/opencode/storage]
|
|
379
|
+
|
|
380
|
+
输出控制:
|
|
381
|
+
-o, --output PATH 输出目录 [默认: ./opencode-logs]
|
|
382
|
+
-f, --format [html|md|markdown|both]
|
|
383
|
+
输出格式 [默认: html]
|
|
384
|
+
|
|
385
|
+
项目选择:
|
|
386
|
+
--all-projects 处理所有项目(未指定 PROJECT_PATH 时为默认)
|
|
387
|
+
--max-sessions INTEGER 限制每个项目的会话数
|
|
388
|
+
|
|
389
|
+
日期过滤:
|
|
390
|
+
--from-date TEXT 起始日期(如 "2 hours ago"、"yesterday")
|
|
391
|
+
--to-date TEXT 结束日期(如 "1 hour ago"、"today")
|
|
392
|
+
|
|
393
|
+
会话控制:
|
|
394
|
+
--no-individual-sessions 跳过单独会话文件
|
|
395
|
+
--page-size INTEGER 每页最大消息数 [默认: 2000]
|
|
396
|
+
|
|
397
|
+
缓存管理:
|
|
398
|
+
--no-cache 禁用缓存
|
|
399
|
+
--clear-cache 处理前清除缓存
|
|
400
|
+
--clear-output 处理前清除输出文件
|
|
401
|
+
|
|
402
|
+
浏览器:
|
|
403
|
+
--no-open-browser 生成后不打开浏览器
|
|
404
|
+
(默认会自动打开)
|
|
405
|
+
|
|
406
|
+
功能开关:
|
|
407
|
+
--no-todos 跳过 todo 加载/渲染
|
|
408
|
+
--no-diffs 跳过 diff 加载/渲染
|
|
409
|
+
--no-timeline 禁用时间线可视化
|
|
410
|
+
--no-syntax-highlight 禁用代码语法高亮
|
|
411
|
+
|
|
412
|
+
调试:
|
|
413
|
+
--doctor 运行环境检查并退出
|
|
414
|
+
--debug 显示完整错误堆栈
|
|
415
|
+
```
|
|
416
|
+
|
|
417
|
+
### 高级示例
|
|
418
|
+
|
|
419
|
+
```bash
|
|
420
|
+
# 快速生成:禁用可选功能
|
|
421
|
+
opencode-log --no-timeline --no-syntax-highlight --no-todos --no-diffs
|
|
422
|
+
|
|
423
|
+
# 完全重新生成
|
|
424
|
+
opencode-log --clear-cache --clear-output
|
|
425
|
+
|
|
426
|
+
# 导出为 Markdown 用于分享
|
|
427
|
+
opencode-log --format markdown -o ./导出
|
|
428
|
+
|
|
429
|
+
# 只处理最近的会话
|
|
430
|
+
opencode-log --from-date "上周" --max-sessions 10
|
|
431
|
+
|
|
432
|
+
# 单个项目自定义输出
|
|
433
|
+
opencode-log /项目路径 -o ./我的项目日志
|
|
434
|
+
```
|
|
435
|
+
|
|
436
|
+
### 输出目录结构
|
|
437
|
+
|
|
438
|
+
```text
|
|
439
|
+
opencode-logs/
|
|
440
|
+
├── index.html
|
|
441
|
+
├── projects/
|
|
442
|
+
│ ├── <project-slug>/
|
|
443
|
+
│ │ ├── combined_transcripts.html
|
|
444
|
+
│ │ ├── session-<id>.html
|
|
445
|
+
│ │ └── ...
|
|
446
|
+
└── .opencode-log-cache/
|
|
447
|
+
├── state.json
|
|
448
|
+
└── sessions/
|
|
449
|
+
```
|
|
450
|
+
|
|
451
|
+
### 说明
|
|
452
|
+
|
|
453
|
+
- 当前主要依赖 OpenCode 内部存储格式。
|
|
454
|
+
- 内部存储结构后续可能变化,建议关注兼容性。
|
|
455
|
+
- 缓存目录位于 `<output>/.opencode-log-cache/`。
|
|
456
|
+
|
|
457
|
+
### 常见警告
|
|
458
|
+
|
|
459
|
+
#### 多个会话架构版本
|
|
460
|
+
|
|
461
|
+
如果看到:
|
|
462
|
+
```
|
|
463
|
+
Warning: multiple session schema versions detected: 1.1.32, 1.1.34, ...
|
|
464
|
+
```
|
|
465
|
+
|
|
466
|
+
**这是正常的!** 这意味着你在不同时间使用了不同版本的 OpenCode。opencode-log 会自动处理所有版本,此警告仅供参考。
|
|
467
|
+
|
|
468
|
+
**隐藏警告:**
|
|
469
|
+
```bash
|
|
470
|
+
opencode-log --no-warnings
|
|
471
|
+
```
|
|
472
|
+
|
|
473
|
+
**原因:**
|
|
474
|
+
- OpenCode 在不同版本间会演进其存储格式
|
|
475
|
+
- 历史会话仍保留在存储目录中
|
|
476
|
+
- 每个会话都记录了创建它的 OpenCode 版本
|
|
477
|
+
|
|
478
|
+
**影响:** 无。所有版本都完全支持和兼容。
|
|
479
|
+
|
|
480
|
+
### 发布到 PyPI
|
|
481
|
+
|
|
482
|
+
推荐使用 GitHub Actions + Trusted Publishing(无需在仓库保存 PyPI Token):
|
|
483
|
+
|
|
484
|
+
1. 在 PyPI 项目设置中添加 Trusted Publisher:
|
|
485
|
+
- Owner: `CatVinci-Studio`
|
|
486
|
+
- Repository: `opencode-log`
|
|
487
|
+
- Workflow: `.github/workflows/release.yml`
|
|
488
|
+
- Environment: `pypi`
|
|
489
|
+
2. 发布到 PyPI 的方式:
|
|
490
|
+
- 手动触发 **Release Python Package** 工作流;或
|
|
491
|
+
- 创建并推送版本标签(如 `v0.3.1`)
|
|
492
|
+
|
|
493
|
+
```bash
|
|
494
|
+
git tag v0.3.1
|
|
495
|
+
git push origin v0.3.1
|
|
496
|
+
```
|
|
497
|
+
|
|
498
|
+
本地发布(Token 方式,可选):
|
|
499
|
+
|
|
500
|
+
```bash
|
|
501
|
+
# 1) 构建
|
|
502
|
+
uv build
|
|
503
|
+
|
|
504
|
+
# 2) 包体校验
|
|
505
|
+
uvx twine check dist/*
|
|
506
|
+
|
|
507
|
+
# 3) 发布到 PyPI
|
|
508
|
+
uvx twine upload dist/*
|
|
509
|
+
```
|
|
510
|
+
|
|
511
|
+
### GitHub 仓库与网站
|
|
512
|
+
|
|
513
|
+
建议仓库地址:
|
|
514
|
+
|
|
515
|
+
- `https://github.com/CatVinci-Studio/opencode-log`
|
|
516
|
+
|
|
517
|
+
建议开启 GitHub Pages,用于项目网站/文档展示:
|
|
518
|
+
|
|
519
|
+
- 站点地址:`https://catvinci-studio.github.io/opencode-log/`
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
opencode_log/__init__.py,sha256=9IFfTvFMTu1mt_TdJvM_vZAmNF_poHZSvDz-APZippc,49
|
|
2
|
+
opencode_log/cache.py,sha256=axdt-Raxgzc2hRbJsc2keTSwbnIUMNnysxtzx81dc7E,8315
|
|
3
|
+
opencode_log/cli.py,sha256=LTxjfftAXrgNeNN83rl21dYwVrXXfW0CflNS75cfnPg,19405
|
|
4
|
+
opencode_log/markdown.py,sha256=izBD7XrPXAq0Dyo-QR7aOD3LVPYQztdWZ2_1n4P6OMs,6727
|
|
5
|
+
opencode_log/models.py,sha256=LPIU6IV69MOQuZkyJOGV7UCJLt09zz9KgZt5vDeDwDU,2979
|
|
6
|
+
opencode_log/normalizer.py,sha256=PNg7GYXckSvEMfkuyXhLT5tfM_pbyAYarr8VddTQKDA,4768
|
|
7
|
+
opencode_log/render.py,sha256=k3w9MLY7RZV4Vrs7M4bw0J7Te2aSNQ2HfWjImEJzoFs,11535
|
|
8
|
+
opencode_log/storage.py,sha256=tOROsnURx1qWW6wUYn8zEOfzhqC6VwN7_O3Gu05pGFA,8481
|
|
9
|
+
opencode_log/templates/combined.html,sha256=9OukYx6Bc5172oEM5CDwrePGPuplkJW5MT2A163puOk,13258
|
|
10
|
+
opencode_log/templates/index.html,sha256=wn1kdUZ3DC4Z_FHliqU-jz-DOJWDeZmCg26recnzric,8006
|
|
11
|
+
opencode_log/templates/transcript.html,sha256=s-UiXRHIf_sIr-yrXs_lHICpIBbx6pbjzozN-eymK9g,14055
|
|
12
|
+
opencode_log/templates/components/base_styles.css,sha256=F8GACJh2spQkztN5DVgU3uOzBmaKfYM2OzmFmxVKrzM,2806
|
|
13
|
+
opencode_log/templates/components/edit_diff_styles.css,sha256=ChX8Ta7VF6X9Kkd1TC-x4lRqu1s5z6vrbharylaV8oM,1380
|
|
14
|
+
opencode_log/templates/components/filter_styles.css,sha256=yhzriS6iX0yGq3sbyeRIC-fkCWb93anxqfJy6crKMwE,3297
|
|
15
|
+
opencode_log/templates/components/global_styles.css,sha256=vMxKqU-XaAuSyijHqynUWXWiJahg4sV1JTxnCGtSzzo,5580
|
|
16
|
+
opencode_log/templates/components/message_styles.css,sha256=w507_5QN_hsParElMo68NKYQkV9e9Ady_a3eZ1KIKm4,23829
|
|
17
|
+
opencode_log/templates/components/page_nav_styles.css,sha256=iyv64s3FgaeQ-usEkdZTx_4pp8gOezy-HEzY5plo2zI,1632
|
|
18
|
+
opencode_log/templates/components/project_card_styles.css,sha256=DCc8qgdN9NmSjQdTAhem8pnem18MgmVmSU77LpOwG_g,2692
|
|
19
|
+
opencode_log/templates/components/pygments_styles.css,sha256=KGPjlbhTiC3Xf79qq-wtUxQ-n2GZkp1NQen_zwwqq8U,7475
|
|
20
|
+
opencode_log/templates/components/search.html,sha256=Z3pfUzkT06EzTp6XMRaYFRxQ8mC3ot4dr68aZ0Z4kaw,28937
|
|
21
|
+
opencode_log/templates/components/search_inline.html,sha256=bjASi6fqfsARAepoOXhFRR3xeSTAkkV4wb5Fyuj3N_o,1264
|
|
22
|
+
opencode_log/templates/components/search_inline_script.html,sha256=HGnJa-LpVVbb5YWa0iwTj6EtUdSSgI8YuB-mgfGvUqE,57
|
|
23
|
+
opencode_log/templates/components/search_results_panel.html,sha256=YczMF39RE7uiG_-2eW6p7FyooimFKb0N_8Adjs4DLbk,426
|
|
24
|
+
opencode_log/templates/components/search_styles.css,sha256=3J6MefccFV7r8ARE_BNWITrIEbvNF6nNQm5WVafXS9E,7113
|
|
25
|
+
opencode_log/templates/components/session_nav.html,sha256=h0I84V3twlf0XQj6R-Q55a9L2_woNV4DN6z5KpX8EO0,1799
|
|
26
|
+
opencode_log/templates/components/session_nav_styles.css,sha256=CvNsdO8P0PebzaZMX8KkcbhL19PFx0yPtYBoBaq1ydE,2118
|
|
27
|
+
opencode_log/templates/components/timeline.html,sha256=1ErkklYR_lVih2shfHWv4vIiyvhZg_8bywxJCB2PvC0,22801
|
|
28
|
+
opencode_log/templates/components/timeline_styles.css,sha256=LsnvRLFgu_ObRfNmBtzTbmxBQvBuhhV9tD4N1Fzicn4,3359
|
|
29
|
+
opencode_log/templates/components/timezone_converter.js,sha256=i7LduN-wHozJMz9Kk7WEAyW_oG6D-3O2L1fUnGWTp24,5230
|
|
30
|
+
opencode_log/templates/components/todo_styles.css,sha256=myn76O1xbcUBm2v-YiUc77okCfD-zsR-LR7gxu0fLuc,3535
|
|
31
|
+
opencode_log-0.3.0.dist-info/METADATA,sha256=9BbosRK79I7U-VI7J744v4y5j3IN0SLAbvohydw2Sfs,16244
|
|
32
|
+
opencode_log-0.3.0.dist-info/WHEEL,sha256=QccIxa26bgl1E6uMy58deGWi-0aeIkkangHcxk2kWfw,87
|
|
33
|
+
opencode_log-0.3.0.dist-info/entry_points.txt,sha256=Xy43oSIwOotSgZyleas9VDGuskr6pQlkYzRFYJDLpX4,55
|
|
34
|
+
opencode_log-0.3.0.dist-info/licenses/LICENSE,sha256=8_1cYjJOydlMaxdwCIkVaa5emgU0eCAsbH3uhhSsw1Y,1082
|
|
35
|
+
opencode_log-0.3.0.dist-info/RECORD,,
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 opencode-log contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|