claugs 0.5.0__tar.gz
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.
- claugs-0.5.0/.gitignore +2 -0
- claugs-0.5.0/LICENSE +13 -0
- claugs-0.5.0/PKG-INFO +154 -0
- claugs-0.5.0/README.md +123 -0
- claugs-0.5.0/docs/plans/2026-02-23-user-message-subtypes-design.md +45 -0
- claugs-0.5.0/docs/superpowers/plans/2026-03-17-search-timestamps.md +2009 -0
- claugs-0.5.0/docs/superpowers/plans/2026-03-18-group-by.md +1324 -0
- claugs-0.5.0/docs/superpowers/specs/2026-03-17-search-timestamps-design.md +262 -0
- claugs-0.5.0/docs/superpowers/specs/2026-03-18-claugs-refactor-design.md +329 -0
- claugs-0.5.0/docs/superpowers/specs/2026-03-18-group-by-design.md +272 -0
- claugs-0.5.0/pyproject.toml +54 -0
- claugs-0.5.0/screenshots/compact.png +0 -0
- claugs-0.5.0/screenshots/demo.gif +0 -0
- claugs-0.5.0/screenshots/demo.svg +126 -0
- claugs-0.5.0/src/claude_logs/__init__.py +180 -0
- claugs-0.5.0/src/claude_logs/__main__.py +14 -0
- claugs-0.5.0/src/claude_logs/blocks.py +122 -0
- claugs-0.5.0/src/claude_logs/cli.py +713 -0
- claugs-0.5.0/src/claude_logs/dateparse.py +134 -0
- claugs-0.5.0/src/claude_logs/formatters.py +251 -0
- claugs-0.5.0/src/claude_logs/grouping.py +541 -0
- claugs-0.5.0/src/claude_logs/models.py +981 -0
- claugs-0.5.0/src/claude_logs/stream.py +146 -0
- claugs-0.5.0/src/claude_logs/watcher.py +226 -0
- claugs-0.5.0/tests/__init__.py +0 -0
- claugs-0.5.0/tests/conftest.py +145 -0
- claugs-0.5.0/tests/fixtures/README.md +53 -0
- claugs-0.5.0/tests/fixtures/multi_project/project-a/session-001.jsonl +4 -0
- claugs-0.5.0/tests/fixtures/multi_project/project-b/session-002.jsonl +4 -0
- claugs-0.5.0/tests/fixtures/v2.1.75/complete_session.jsonl +9 -0
- claugs-0.5.0/tests/fixtures/v2.1.77/complete_session.jsonl +9 -0
- claugs-0.5.0/tests/test_before_after.py +138 -0
- claugs-0.5.0/tests/test_claugs_integration.py +1292 -0
- claugs-0.5.0/tests/test_cli_group_by.py +149 -0
- claugs-0.5.0/tests/test_cli_timestamps.py +47 -0
- claugs-0.5.0/tests/test_compact_bug.py +35 -0
- claugs-0.5.0/tests/test_dateparse.py +131 -0
- claugs-0.5.0/tests/test_grouping_bucket.py +25 -0
- claugs-0.5.0/tests/test_grouping_parse.py +52 -0
- claugs-0.5.0/tests/test_grouping_render.py +224 -0
- claugs-0.5.0/tests/test_grouping_scout.py +103 -0
- claugs-0.5.0/tests/test_header_suffix.py +64 -0
- claugs-0.5.0/tests/test_search.py +118 -0
- claugs-0.5.0/tests/test_timestamp_display.py +107 -0
- claugs-0.5.0/tests/test_timestamp_filter.py +65 -0
claugs-0.5.0/.gitignore
ADDED
claugs-0.5.0/LICENSE
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
|
|
2
|
+
Version 2, December 2004
|
|
3
|
+
|
|
4
|
+
Copyright (C) 2004 Sam Hocevar <sam@hocevar.net>
|
|
5
|
+
|
|
6
|
+
Everyone is permitted to copy and distribute verbatim or modified
|
|
7
|
+
copies of this license document, and changing it is allowed as long
|
|
8
|
+
as the name is changed.
|
|
9
|
+
|
|
10
|
+
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
|
|
11
|
+
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
|
12
|
+
|
|
13
|
+
0. You just DO WHAT THE FUCK YOU WANT TO.
|
claugs-0.5.0/PKG-INFO
ADDED
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: claugs
|
|
3
|
+
Version: 0.5.0
|
|
4
|
+
Summary: Parse and prettify Claude Code JSONL session logs
|
|
5
|
+
Project-URL: Homepage, https://github.com/shitchell/claugs
|
|
6
|
+
Project-URL: Repository, https://github.com/shitchell/claugs
|
|
7
|
+
Project-URL: Issues, https://github.com/shitchell/claugs/issues
|
|
8
|
+
Author: Shaun Mitchell
|
|
9
|
+
License-Expression: WTFPL
|
|
10
|
+
License-File: LICENSE
|
|
11
|
+
Keywords: anthropic,claude,cli,jsonl,logs
|
|
12
|
+
Classifier: Development Status :: 4 - Beta
|
|
13
|
+
Classifier: Environment :: Console
|
|
14
|
+
Classifier: Intended Audience :: Developers
|
|
15
|
+
Classifier: License :: Public Domain
|
|
16
|
+
Classifier: Operating System :: OS Independent
|
|
17
|
+
Classifier: Programming Language :: Python :: 3
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
21
|
+
Classifier: Topic :: Utilities
|
|
22
|
+
Requires-Python: >=3.10
|
|
23
|
+
Requires-Dist: pydantic>=2.0
|
|
24
|
+
Requires-Dist: python-dateutil>=2.8
|
|
25
|
+
Requires-Dist: typing-extensions>=4.0
|
|
26
|
+
Provides-Extra: dev
|
|
27
|
+
Requires-Dist: pytest>=7.0; extra == 'dev'
|
|
28
|
+
Provides-Extra: watch
|
|
29
|
+
Requires-Dist: watchdog>=3.0; extra == 'watch'
|
|
30
|
+
Description-Content-Type: text/markdown
|
|
31
|
+
|
|
32
|
+
# claude-stream
|
|
33
|
+
|
|
34
|
+
[](https://pypi.org/project/claude-stream/)
|
|
35
|
+
|
|
36
|
+
Parse and prettify Claude Code JSONL stream output.
|
|
37
|
+
|
|
38
|
+

|
|
39
|
+
|
|
40
|
+
## Installation
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
pip install claude-stream
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
For file watching support:
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
pip install "claude-stream[watch]"
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
---
|
|
53
|
+
|
|
54
|
+

|
|
55
|
+
|
|
56
|
+
## Usage
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
# Read from a file
|
|
60
|
+
claude-stream session.jsonl
|
|
61
|
+
|
|
62
|
+
# Show only last N lines
|
|
63
|
+
claude-stream session.jsonl -n 20
|
|
64
|
+
|
|
65
|
+
# Read from stdin
|
|
66
|
+
cat session.jsonl | claude-stream
|
|
67
|
+
|
|
68
|
+
# Parse the most recent session
|
|
69
|
+
claude-stream --latest
|
|
70
|
+
claude-stream --latest -n 50 # Last 50 lines
|
|
71
|
+
|
|
72
|
+
# Find and parse a session by UUID
|
|
73
|
+
claude-stream --session abc123
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
### Watch Mode
|
|
77
|
+
|
|
78
|
+
Watch for new messages in real-time (like `tail -f`):
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
# Watch all Claude sessions
|
|
82
|
+
claude-stream --watch ~/.claude/projects/
|
|
83
|
+
|
|
84
|
+
# Watch from any project directory (auto-resolves to Claude path)
|
|
85
|
+
claude-stream --watch .
|
|
86
|
+
claude-stream --watch ~/myproject
|
|
87
|
+
|
|
88
|
+
# Watch with initial context (last N lines)
|
|
89
|
+
claude-stream --watch . -n 10
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
When given a directory outside `~/.claude`, the path is automatically
|
|
93
|
+
converted to Claude's project format (e.g., `/home/user/project` becomes
|
|
94
|
+
`~/.claude/projects/-home-user-project`).
|
|
95
|
+
|
|
96
|
+
### Output Formats
|
|
97
|
+
|
|
98
|
+
```bash
|
|
99
|
+
# ANSI terminal colors (default for TTY)
|
|
100
|
+
claude-stream session.jsonl
|
|
101
|
+
|
|
102
|
+
# Markdown
|
|
103
|
+
claude-stream --format markdown session.jsonl > export.md
|
|
104
|
+
|
|
105
|
+
# Plain text (default when piped)
|
|
106
|
+
claude-stream session.jsonl | less
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
Output automatically switches to plain text when piped. Use `--format ansi` to force colors.
|
|
110
|
+
|
|
111
|
+
### Filtering
|
|
112
|
+
|
|
113
|
+
```bash
|
|
114
|
+
# Show only specific message types
|
|
115
|
+
claude-stream --show-type assistant --show-type user session.jsonl
|
|
116
|
+
|
|
117
|
+
# Show only messages with specific tools
|
|
118
|
+
claude-stream --show-tool Bash --show-tool Read session.jsonl
|
|
119
|
+
|
|
120
|
+
# Grep for patterns
|
|
121
|
+
claude-stream --grep "error" session.jsonl
|
|
122
|
+
|
|
123
|
+
# Exclude patterns
|
|
124
|
+
claude-stream --exclude "thinking" session.jsonl
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
### Display Options
|
|
128
|
+
|
|
129
|
+
```bash
|
|
130
|
+
# Hide thinking blocks
|
|
131
|
+
claude-stream --hide-thinking session.jsonl
|
|
132
|
+
|
|
133
|
+
# Hide tool results
|
|
134
|
+
claude-stream --hide-tool-results session.jsonl
|
|
135
|
+
|
|
136
|
+
# Show metadata (UUIDs, timestamps)
|
|
137
|
+
claude-stream --show-metadata session.jsonl
|
|
138
|
+
|
|
139
|
+
# Compact mode (hide thinking, tool results, metadata)
|
|
140
|
+
claude-stream --compact session.jsonl
|
|
141
|
+
|
|
142
|
+
# Show line numbers
|
|
143
|
+
claude-stream --line-numbers session.jsonl
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
## Architecture
|
|
147
|
+
|
|
148
|
+
- **Pydantic models** parse JSON into typed message structures
|
|
149
|
+
- **Messages** produce `RenderBlock` lists (flexible rendering primitives)
|
|
150
|
+
- **Formatters** convert `RenderBlocks` to output formats (ANSI, Markdown, Plain)
|
|
151
|
+
|
|
152
|
+
## License
|
|
153
|
+
|
|
154
|
+
[WTFPL](http://www.wtfpl.net/)
|
claugs-0.5.0/README.md
ADDED
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
# claude-stream
|
|
2
|
+
|
|
3
|
+
[](https://pypi.org/project/claude-stream/)
|
|
4
|
+
|
|
5
|
+
Parse and prettify Claude Code JSONL stream output.
|
|
6
|
+
|
|
7
|
+

|
|
8
|
+
|
|
9
|
+
## Installation
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
pip install claude-stream
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
For file watching support:
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
pip install "claude-stream[watch]"
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+

|
|
24
|
+
|
|
25
|
+
## Usage
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
# Read from a file
|
|
29
|
+
claude-stream session.jsonl
|
|
30
|
+
|
|
31
|
+
# Show only last N lines
|
|
32
|
+
claude-stream session.jsonl -n 20
|
|
33
|
+
|
|
34
|
+
# Read from stdin
|
|
35
|
+
cat session.jsonl | claude-stream
|
|
36
|
+
|
|
37
|
+
# Parse the most recent session
|
|
38
|
+
claude-stream --latest
|
|
39
|
+
claude-stream --latest -n 50 # Last 50 lines
|
|
40
|
+
|
|
41
|
+
# Find and parse a session by UUID
|
|
42
|
+
claude-stream --session abc123
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
### Watch Mode
|
|
46
|
+
|
|
47
|
+
Watch for new messages in real-time (like `tail -f`):
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
# Watch all Claude sessions
|
|
51
|
+
claude-stream --watch ~/.claude/projects/
|
|
52
|
+
|
|
53
|
+
# Watch from any project directory (auto-resolves to Claude path)
|
|
54
|
+
claude-stream --watch .
|
|
55
|
+
claude-stream --watch ~/myproject
|
|
56
|
+
|
|
57
|
+
# Watch with initial context (last N lines)
|
|
58
|
+
claude-stream --watch . -n 10
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
When given a directory outside `~/.claude`, the path is automatically
|
|
62
|
+
converted to Claude's project format (e.g., `/home/user/project` becomes
|
|
63
|
+
`~/.claude/projects/-home-user-project`).
|
|
64
|
+
|
|
65
|
+
### Output Formats
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
# ANSI terminal colors (default for TTY)
|
|
69
|
+
claude-stream session.jsonl
|
|
70
|
+
|
|
71
|
+
# Markdown
|
|
72
|
+
claude-stream --format markdown session.jsonl > export.md
|
|
73
|
+
|
|
74
|
+
# Plain text (default when piped)
|
|
75
|
+
claude-stream session.jsonl | less
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
Output automatically switches to plain text when piped. Use `--format ansi` to force colors.
|
|
79
|
+
|
|
80
|
+
### Filtering
|
|
81
|
+
|
|
82
|
+
```bash
|
|
83
|
+
# Show only specific message types
|
|
84
|
+
claude-stream --show-type assistant --show-type user session.jsonl
|
|
85
|
+
|
|
86
|
+
# Show only messages with specific tools
|
|
87
|
+
claude-stream --show-tool Bash --show-tool Read session.jsonl
|
|
88
|
+
|
|
89
|
+
# Grep for patterns
|
|
90
|
+
claude-stream --grep "error" session.jsonl
|
|
91
|
+
|
|
92
|
+
# Exclude patterns
|
|
93
|
+
claude-stream --exclude "thinking" session.jsonl
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
### Display Options
|
|
97
|
+
|
|
98
|
+
```bash
|
|
99
|
+
# Hide thinking blocks
|
|
100
|
+
claude-stream --hide-thinking session.jsonl
|
|
101
|
+
|
|
102
|
+
# Hide tool results
|
|
103
|
+
claude-stream --hide-tool-results session.jsonl
|
|
104
|
+
|
|
105
|
+
# Show metadata (UUIDs, timestamps)
|
|
106
|
+
claude-stream --show-metadata session.jsonl
|
|
107
|
+
|
|
108
|
+
# Compact mode (hide thinking, tool results, metadata)
|
|
109
|
+
claude-stream --compact session.jsonl
|
|
110
|
+
|
|
111
|
+
# Show line numbers
|
|
112
|
+
claude-stream --line-numbers session.jsonl
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
## Architecture
|
|
116
|
+
|
|
117
|
+
- **Pydantic models** parse JSON into typed message structures
|
|
118
|
+
- **Messages** produce `RenderBlock` lists (flexible rendering primitives)
|
|
119
|
+
- **Formatters** convert `RenderBlocks` to output formats (ANSI, Markdown, Plain)
|
|
120
|
+
|
|
121
|
+
## License
|
|
122
|
+
|
|
123
|
+
[WTFPL](http://www.wtfpl.net/)
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# User Message Subtypes
|
|
2
|
+
|
|
3
|
+
## Problem
|
|
4
|
+
|
|
5
|
+
Claude Code's JSONL format stores three distinct categories of content as `type: "user"` messages:
|
|
6
|
+
|
|
7
|
+
1. **Real user input** - what the human typed
|
|
8
|
+
2. **Tool results** - responses from tool calls (Bash, Read, etc.)
|
|
9
|
+
3. **System-injected meta content** - skill loading, system reminders (`isMeta: true`)
|
|
10
|
+
|
|
11
|
+
This means `--show-type user` shows all three, `--hide-tool-results` only suppresses rendered content (not the messages themselves), and system-injected content renders with a `USER` header indistinguishable from real input.
|
|
12
|
+
|
|
13
|
+
## Design
|
|
14
|
+
|
|
15
|
+
### Subtype classification
|
|
16
|
+
|
|
17
|
+
Each `type: "user"` message gets a subtype based on JSONL fields:
|
|
18
|
+
|
|
19
|
+
| Subtype | Detection |
|
|
20
|
+
|---------|-----------|
|
|
21
|
+
| `user-input` | No `toolUseResult`, no `isMeta`, content is string |
|
|
22
|
+
| `tool-result` | Has `toolUseResult` (not subagent) |
|
|
23
|
+
| `subagent-result` | `toolUseResult` with `agentId` |
|
|
24
|
+
| `meta` | `isMeta: true` |
|
|
25
|
+
| `local-command` | Content starts with `<command-name>` or `<local-command-stdout>` |
|
|
26
|
+
|
|
27
|
+
### Filtering
|
|
28
|
+
|
|
29
|
+
`--show-subtype` applies to user messages via their computed subtype. Without `--show-subtype`, all subtypes display (backward compatible).
|
|
30
|
+
|
|
31
|
+
Example: `--show-type user --show-subtype user-input` shows only real human input.
|
|
32
|
+
|
|
33
|
+
### `--hide-tool-results` fix
|
|
34
|
+
|
|
35
|
+
When `show_tool_results=False`, tool-result and subagent-result user messages are fully filtered out in `should_show_message()`, not just content-suppressed.
|
|
36
|
+
|
|
37
|
+
### Meta rendering
|
|
38
|
+
|
|
39
|
+
Messages with `isMeta: true` render as `USER [meta]` instead of plain `USER`.
|
|
40
|
+
|
|
41
|
+
## Changes
|
|
42
|
+
|
|
43
|
+
1. **`models.py`**: Add `isMeta` field, `get_subtype()` method, `[meta]` tag in `render_user_input()`
|
|
44
|
+
2. **`stream.py`**: Subtype filtering for user messages, `--hide-tool-results` suppression
|
|
45
|
+
3. **`cli.py`**: No changes needed (existing flags sufficient)
|