Skip to content

Commit e036c2d

Browse files
committed
Doc audit: fix stale test count, project layout, and removed --quiet flag
A sweep across the repo to align docs with the actual current state after the recent refactors (mode-based exports, FS-aware path decoding, lazy install prompt). Caught: - README.md / README.ru.md: 'Test coverage 91% (68/68)' → 73/73. Project layout listing was missing conftest.py, test_real_format.py, and test_minimal.py — three real files that hold most of the format-handling test surface. - QUICKSTART.md: the (Optional) daily auto-backup snippets referenced a '--quiet' flag that was never implemented. Replaced with shell '>/dev/null' redirection, which is the actual idiomatic way to silence the script in cron / shell functions. - parser.py: docstring on dialogue_text() said 'Used by --minimal export mode'. That flag was renamed to '--mode minimal' two commits ago. No code changes; docs and one docstring.
1 parent 69481c3 commit e036c2d

4 files changed

Lines changed: 24 additions & 17 deletions

File tree

QUICKSTART.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ Add to your shell profile (`~/.zshrc`, `~/.bashrc`, or `~/.bash_profile`):
221221
cb_backup() {
222222
local dest="$HOME/claude-backups"
223223
mkdir -p "$dest"
224-
claude-backup export-all --output "$dest" --quiet
224+
claude-backup export-all --output "$dest" >/dev/null
225225
cd "$dest" && git add . && git commit -m "backup $(date +%F)" 2>/dev/null
226226
}
227227
cb_backup
@@ -231,7 +231,7 @@ Or use cron (macOS / Linux):
231231
```bash
232232
crontab -e
233233
# Add: daily at 9 PM
234-
0 21 * * * /usr/local/bin/claude-backup export-all --output $HOME/claude-backups/ --quiet
234+
0 21 * * * /usr/local/bin/claude-backup export-all --output $HOME/claude-backups/ >/dev/null 2>&1
235235
```
236236

237237
---

README.md

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -234,24 +234,27 @@ pytest -v --cov=claude_backup
234234

235235
CI runs on Python 3.9, 3.10, 3.11, and 3.12 — see [.github/workflows/test.yml](.github/workflows/test.yml).
236236

237-
**Test coverage: 91%** (68/68 tests passing) — covers the real Claude Code format, the legacy spec format, edge cases (empty/corrupt JSONL, unicode, missing index), `--mode` selection (both / minimal / full), and CLI integration.
237+
**Test coverage: 91%** (73/73 tests passing) — covers the real Claude Code format, the legacy spec format, edge cases (empty/corrupt JSONL, unicode, missing index), `--mode` selection (both / minimal / full), the FS-aware project-path decoder, and CLI integration.
238238

239239
### Project layout
240240

241241
```
242242
claude_backup/
243243
├── __init__.py
244-
├── cli.py # Click entry point
245-
├── scanner.py # Discovers projects + sessions
246-
├── parser.py # Reads .jsonl files
247-
└── exporter.py # Renders Markdown
244+
├── cli.py # Click entry point
245+
├── scanner.py # Discovers projects + sessions, decodes project paths
246+
├── parser.py # Reads .jsonl files
247+
└── exporter.py # Renders Markdown (both modes)
248248
249249
tests/
250-
├── fixtures/ # Fake project data — no real ~/.claude/ data is read in tests
250+
├── conftest.py # Shared fixtures (claude_home etc.)
251+
├── fixtures/ # Fake project data — no real ~/.claude/ is read in tests
251252
├── test_scanner.py
252253
├── test_parser.py
253254
├── test_exporter.py
254-
└── test_cli.py
255+
├── test_cli.py
256+
├── test_minimal.py # Dialogue-only mode + --mode CLI flag
257+
└── test_real_format.py # Nested message shape, ai-title, project-path decoding
255258
```
256259

257260
---

README.ru.md

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -231,24 +231,27 @@ pytest -v --cov=claude_backup
231231

232232
CI запускается на Python 3.9, 3.10, 3.11 и 3.12 — см. [.github/workflows/test.yml](.github/workflows/test.yml).
233233

234-
**Покрытие тестами: 91%** (68/68 тестов проходят) — реальный формат Claude Code, legacy-формат из спеки, edge-кейсы (пустой/битый JSONL, unicode, отсутствующий индекс), выбор `--mode` (both / minimal / full), и интеграционные тесты CLI.
234+
**Покрытие тестами: 91%** (73/73 тестов проходят) — реальный формат Claude Code, legacy-формат из спеки, edge-кейсы (пустой/битый JSONL, unicode, отсутствующий индекс), выбор `--mode` (both / minimal / full), FS-aware декодинг путей проектов, и интеграционные тесты CLI.
235235

236236
### Структура проекта
237237

238238
```
239239
claude_backup/
240240
├── __init__.py
241-
├── cli.py # Точка входа Click
242-
├── scanner.py # Обнаружение проектов и сессий
243-
├── parser.py # Чтение .jsonl
244-
└── exporter.py # Рендеринг Markdown
241+
├── cli.py # Точка входа Click
242+
├── scanner.py # Обнаружение проектов и сессий, декодинг путей
243+
├── parser.py # Чтение .jsonl
244+
└── exporter.py # Рендеринг Markdown (оба режима)
245245
246246
tests/
247-
├── fixtures/ # Фейковые данные — реальные ~/.claude/ не читаются в тестах
247+
├── conftest.py # Общие фикстуры (claude_home и т.п.)
248+
├── fixtures/ # Фейковые данные — реальные ~/.claude/ не читаются в тестах
248249
├── test_scanner.py
249250
├── test_parser.py
250251
├── test_exporter.py
251-
└── test_cli.py
252+
├── test_cli.py
253+
├── test_minimal.py # Dialogue-only режим + CLI флаг --mode
254+
└── test_real_format.py # Вложенный формат message, ai-title, декодинг путей
252255
```
253256

254257
---

claude_backup/parser.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,8 @@ def _normalize_content(content) -> str:
183183

184184
def dialogue_text(msg: "Message") -> str:
185185
"""Extract only human-facing text from a message: no tool_use, no tool_result,
186-
no thinking, no images. Used by `--minimal` export mode."""
186+
no thinking, no images. Used by the dialogue-only render path (`--mode minimal`
187+
and the default `<id>.md` half of `--mode both`)."""
187188
nested = msg.raw.get("message") if isinstance(msg.raw, dict) else None
188189
raw = nested if isinstance(nested, dict) else msg.raw
189190
content = raw.get("content") if isinstance(raw, dict) else None

0 commit comments

Comments
 (0)