ccsinfo 0.1.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.
- ccsinfo-0.1.0/.claude/settings.local.json +11 -0
- ccsinfo-0.1.0/.envrc +1 -0
- ccsinfo-0.1.0/.flake8 +11 -0
- ccsinfo-0.1.0/.gitignore +50 -0
- ccsinfo-0.1.0/.pre-commit-config.yaml +59 -0
- ccsinfo-0.1.0/PKG-INFO +468 -0
- ccsinfo-0.1.0/README.md +428 -0
- ccsinfo-0.1.0/pyproject.toml +112 -0
- ccsinfo-0.1.0/src/ccsinfo/__init__.py +3 -0
- ccsinfo-0.1.0/src/ccsinfo/__main__.py +5 -0
- ccsinfo-0.1.0/src/ccsinfo/cli/__init__.py +1 -0
- ccsinfo-0.1.0/src/ccsinfo/cli/commands/__init__.py +11 -0
- ccsinfo-0.1.0/src/ccsinfo/cli/commands/projects.py +222 -0
- ccsinfo-0.1.0/src/ccsinfo/cli/commands/search.py +198 -0
- ccsinfo-0.1.0/src/ccsinfo/cli/commands/sessions.py +407 -0
- ccsinfo-0.1.0/src/ccsinfo/cli/commands/stats.py +218 -0
- ccsinfo-0.1.0/src/ccsinfo/cli/commands/tasks.py +286 -0
- ccsinfo-0.1.0/src/ccsinfo/cli/main.py +71 -0
- ccsinfo-0.1.0/src/ccsinfo/cli/state.py +12 -0
- ccsinfo-0.1.0/src/ccsinfo/core/__init__.py +1 -0
- ccsinfo-0.1.0/src/ccsinfo/core/client.py +120 -0
- ccsinfo-0.1.0/src/ccsinfo/core/models/__init__.py +40 -0
- ccsinfo-0.1.0/src/ccsinfo/core/models/base.py +27 -0
- ccsinfo-0.1.0/src/ccsinfo/core/models/messages.py +113 -0
- ccsinfo-0.1.0/src/ccsinfo/core/models/projects.py +17 -0
- ccsinfo-0.1.0/src/ccsinfo/core/models/sessions.py +77 -0
- ccsinfo-0.1.0/src/ccsinfo/core/models/stats.py +34 -0
- ccsinfo-0.1.0/src/ccsinfo/core/models/tasks.py +44 -0
- ccsinfo-0.1.0/src/ccsinfo/core/parsers/__init__.py +89 -0
- ccsinfo-0.1.0/src/ccsinfo/core/parsers/history.py +235 -0
- ccsinfo-0.1.0/src/ccsinfo/core/parsers/jsonl.py +170 -0
- ccsinfo-0.1.0/src/ccsinfo/core/parsers/sessions.py +443 -0
- ccsinfo-0.1.0/src/ccsinfo/core/parsers/tasks.py +159 -0
- ccsinfo-0.1.0/src/ccsinfo/core/services/__init__.py +20 -0
- ccsinfo-0.1.0/src/ccsinfo/core/services/project_service.py +149 -0
- ccsinfo-0.1.0/src/ccsinfo/core/services/search_service.py +157 -0
- ccsinfo-0.1.0/src/ccsinfo/core/services/session_service.py +288 -0
- ccsinfo-0.1.0/src/ccsinfo/core/services/stats_service.py +167 -0
- ccsinfo-0.1.0/src/ccsinfo/core/services/task_service.py +131 -0
- ccsinfo-0.1.0/src/ccsinfo/server/__init__.py +5 -0
- ccsinfo-0.1.0/src/ccsinfo/server/app.py +20 -0
- ccsinfo-0.1.0/src/ccsinfo/server/routers/__init__.py +12 -0
- ccsinfo-0.1.0/src/ccsinfo/server/routers/health.py +27 -0
- ccsinfo-0.1.0/src/ccsinfo/server/routers/projects.py +51 -0
- ccsinfo-0.1.0/src/ccsinfo/server/routers/search.py +37 -0
- ccsinfo-0.1.0/src/ccsinfo/server/routers/sessions.py +92 -0
- ccsinfo-0.1.0/src/ccsinfo/server/routers/stats.py +28 -0
- ccsinfo-0.1.0/src/ccsinfo/server/routers/tasks.py +44 -0
- ccsinfo-0.1.0/src/ccsinfo/utils/__init__.py +47 -0
- ccsinfo-0.1.0/src/ccsinfo/utils/formatters.py +86 -0
- ccsinfo-0.1.0/src/ccsinfo/utils/paths.py +82 -0
- ccsinfo-0.1.0/tests/__init__.py +1 -0
- ccsinfo-0.1.0/tests/conftest.py +112 -0
- ccsinfo-0.1.0/tests/test_models.py +611 -0
- ccsinfo-0.1.0/tests/test_parsers.py +309 -0
- ccsinfo-0.1.0/tests/test_services.py +270 -0
- ccsinfo-0.1.0/tests/test_utils_paths.py +246 -0
- ccsinfo-0.1.0/tox.ini +9 -0
- ccsinfo-0.1.0/uv.lock +1128 -0
ccsinfo-0.1.0/.envrc
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
layout uv
|
ccsinfo-0.1.0/.flake8
ADDED
ccsinfo-0.1.0/.gitignore
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
# Python
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
*$py.class
|
|
5
|
+
*.so
|
|
6
|
+
.Python
|
|
7
|
+
build/
|
|
8
|
+
develop-eggs/
|
|
9
|
+
dist/
|
|
10
|
+
downloads/
|
|
11
|
+
eggs/
|
|
12
|
+
.eggs/
|
|
13
|
+
lib/
|
|
14
|
+
lib64/
|
|
15
|
+
parts/
|
|
16
|
+
sdist/
|
|
17
|
+
var/
|
|
18
|
+
wheels/
|
|
19
|
+
*.egg-info/
|
|
20
|
+
.installed.cfg
|
|
21
|
+
*.egg
|
|
22
|
+
|
|
23
|
+
# Virtual environments
|
|
24
|
+
.venv/
|
|
25
|
+
venv/
|
|
26
|
+
ENV/
|
|
27
|
+
|
|
28
|
+
# Testing
|
|
29
|
+
.tox/
|
|
30
|
+
.nox/
|
|
31
|
+
.coverage
|
|
32
|
+
.coverage.*
|
|
33
|
+
htmlcov/
|
|
34
|
+
.pytest_cache/
|
|
35
|
+
.mypy_cache/
|
|
36
|
+
|
|
37
|
+
# IDE
|
|
38
|
+
.idea/
|
|
39
|
+
.vscode/
|
|
40
|
+
*.swp
|
|
41
|
+
*.swo
|
|
42
|
+
|
|
43
|
+
# OS
|
|
44
|
+
.DS_Store
|
|
45
|
+
Thumbs.db
|
|
46
|
+
|
|
47
|
+
# Project specific
|
|
48
|
+
*.log
|
|
49
|
+
.env
|
|
50
|
+
.env.*
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
---
|
|
2
|
+
default_language_version:
|
|
3
|
+
python: python3
|
|
4
|
+
|
|
5
|
+
ci:
|
|
6
|
+
autofix_prs: false
|
|
7
|
+
autoupdate_commit_msg: "ci: [pre-commit.ci] pre-commit autoupdate"
|
|
8
|
+
|
|
9
|
+
repos:
|
|
10
|
+
- repo: https://github.com/pre-commit/pre-commit-hooks
|
|
11
|
+
rev: v6.0.0
|
|
12
|
+
hooks:
|
|
13
|
+
- id: check-added-large-files
|
|
14
|
+
- id: check-docstring-first
|
|
15
|
+
- id: check-executables-have-shebangs
|
|
16
|
+
- id: check-merge-conflict
|
|
17
|
+
- id: check-symlinks
|
|
18
|
+
- id: detect-private-key
|
|
19
|
+
- id: mixed-line-ending
|
|
20
|
+
- id: debug-statements
|
|
21
|
+
- id: trailing-whitespace
|
|
22
|
+
args: [--markdown-linebreak-ext=md] # Do not process Markdown files.
|
|
23
|
+
- id: end-of-file-fixer
|
|
24
|
+
- id: check-ast
|
|
25
|
+
- id: check-builtin-literals
|
|
26
|
+
- id: check-docstring-first
|
|
27
|
+
- id: check-toml
|
|
28
|
+
|
|
29
|
+
- repo: https://github.com/PyCQA/flake8
|
|
30
|
+
rev: 7.3.0
|
|
31
|
+
hooks:
|
|
32
|
+
- id: flake8
|
|
33
|
+
args: [--config=.flake8]
|
|
34
|
+
additional_dependencies:
|
|
35
|
+
[git+https://github.com/RedHatQE/flake8-plugins.git, flake8-mutable]
|
|
36
|
+
|
|
37
|
+
- repo: https://github.com/Yelp/detect-secrets
|
|
38
|
+
rev: v1.5.0
|
|
39
|
+
hooks:
|
|
40
|
+
- id: detect-secrets
|
|
41
|
+
|
|
42
|
+
- repo: https://github.com/astral-sh/ruff-pre-commit
|
|
43
|
+
rev: v0.14.14
|
|
44
|
+
hooks:
|
|
45
|
+
- id: ruff
|
|
46
|
+
- id: ruff-format
|
|
47
|
+
|
|
48
|
+
- repo: https://github.com/gitleaks/gitleaks
|
|
49
|
+
rev: v8.30.0
|
|
50
|
+
hooks:
|
|
51
|
+
- id: gitleaks
|
|
52
|
+
|
|
53
|
+
- repo: https://github.com/pre-commit/mirrors-mypy
|
|
54
|
+
rev: v1.19.1
|
|
55
|
+
hooks:
|
|
56
|
+
- id: mypy
|
|
57
|
+
exclude: (tests/)
|
|
58
|
+
additional_dependencies:
|
|
59
|
+
[types-requests, types-PyYAML, types-colorama, types-aiofiles]
|
ccsinfo-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,468 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: ccsinfo
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Claude Code Session Info CLI and Server
|
|
5
|
+
Project-URL: Homepage, https://github.com/myk-org/ccsinfo
|
|
6
|
+
Project-URL: Repository, https://github.com/myk-org/ccsinfo
|
|
7
|
+
Author-email: Meni Yakove <myakove@gmail.com>
|
|
8
|
+
License-Expression: MIT
|
|
9
|
+
Keywords: api,claude,claude-code,cli,sessions
|
|
10
|
+
Classifier: Development Status :: 3 - Alpha
|
|
11
|
+
Classifier: Environment :: Console
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
14
|
+
Classifier: Operating System :: OS Independent
|
|
15
|
+
Classifier: Programming Language :: Python :: 3
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
18
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
19
|
+
Classifier: Typing :: Typed
|
|
20
|
+
Requires-Python: >=3.12
|
|
21
|
+
Requires-Dist: fastapi>=0.109.0
|
|
22
|
+
Requires-Dist: httpx>=0.27.0
|
|
23
|
+
Requires-Dist: orjson>=3.9.0
|
|
24
|
+
Requires-Dist: pendulum>=3.0.0
|
|
25
|
+
Requires-Dist: pydantic>=2.0.0
|
|
26
|
+
Requires-Dist: rich>=13.0.0
|
|
27
|
+
Requires-Dist: typer[all]>=0.9.0
|
|
28
|
+
Requires-Dist: uvicorn[standard]>=0.27.0
|
|
29
|
+
Provides-Extra: charts
|
|
30
|
+
Requires-Dist: plotext>=5.2.0; extra == 'charts'
|
|
31
|
+
Provides-Extra: dev
|
|
32
|
+
Requires-Dist: mypy>=1.5.0; extra == 'dev'
|
|
33
|
+
Requires-Dist: pytest-asyncio>=0.21.0; extra == 'dev'
|
|
34
|
+
Requires-Dist: pytest-cov>=4.1.0; extra == 'dev'
|
|
35
|
+
Requires-Dist: pytest-xdist>=3.5.0; extra == 'dev'
|
|
36
|
+
Requires-Dist: pytest>=7.4.0; extra == 'dev'
|
|
37
|
+
Requires-Dist: ruff>=0.1.0; extra == 'dev'
|
|
38
|
+
Requires-Dist: tox>=4.0.0; extra == 'dev'
|
|
39
|
+
Description-Content-Type: text/markdown
|
|
40
|
+
|
|
41
|
+
# ccsinfo
|
|
42
|
+
|
|
43
|
+
A CLI and REST API for viewing and analyzing Claude Code session data.
|
|
44
|
+
|
|
45
|
+
## Features
|
|
46
|
+
|
|
47
|
+
- **List and inspect Claude Code sessions** - Browse all sessions stored in `~/.claude/projects/`
|
|
48
|
+
- **View conversation history and tool calls** - Examine messages, assistant responses, and tool invocations
|
|
49
|
+
- **Track tasks across sessions** - Monitor pending, in-progress, and completed tasks
|
|
50
|
+
- **Search sessions and prompt history** - Find sessions by content or query historical prompts
|
|
51
|
+
- **Usage statistics and trends** - Analyze activity patterns with daily and global stats
|
|
52
|
+
- **REST API for remote access** - Access session data programmatically via HTTP endpoints
|
|
53
|
+
- **Works locally or as client to remote server** - Run standalone or connect to a centralized ccsinfo server
|
|
54
|
+
|
|
55
|
+
## Installation
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
# Install as a CLI tool
|
|
59
|
+
uv tool install .
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
### With Chart Support
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
# Install with charts extras (for terminal charts)
|
|
66
|
+
uv tool install ".[charts]"
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
### Development Installation
|
|
70
|
+
|
|
71
|
+
```bash
|
|
72
|
+
# Clone and install in development mode
|
|
73
|
+
uv pip install -e ".[dev]"
|
|
74
|
+
|
|
75
|
+
# Install pre-commit hooks
|
|
76
|
+
pre-commit install
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
## Quick Start
|
|
80
|
+
|
|
81
|
+
List all sessions:
|
|
82
|
+
|
|
83
|
+
```bash
|
|
84
|
+
$ ccsinfo sessions list
|
|
85
|
+
Sessions
|
|
86
|
+
┏━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━┳━━━━━━━━━━━━━━━━┳━━━━━━━━━━┓
|
|
87
|
+
┃ ID ┃ Project ┃ Messages ┃ Last Activity ┃ Status ┃
|
|
88
|
+
┡━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━╇━━━━━━━━━━━━━━━━╇━━━━━━━━━━┩
|
|
89
|
+
│ a1b2c3d4e5f6 │ my-project │ 42 │ 5 minutes ago │ Active │
|
|
90
|
+
│ b2c3d4e5f6a7 │ another-project │ 18 │ 2 hours ago │ Inactive │
|
|
91
|
+
└──────────────┴──────────────────┴──────────┴────────────────┴──────────┘
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
Show session details:
|
|
95
|
+
|
|
96
|
+
```bash
|
|
97
|
+
$ ccsinfo sessions show a1b2c3d4
|
|
98
|
+
╭───────────────────── Session: a1b2c3d4e5f6... ──────────────────────╮
|
|
99
|
+
│ ID: a1b2c3d4-e5f6-7890-abcd-ef1234567890 │
|
|
100
|
+
│ Project: my-project │
|
|
101
|
+
│ Path: /home/user/projects/my-project │
|
|
102
|
+
│ Created: 2025-01-28 10:30:00 │
|
|
103
|
+
│ Updated: 2025-01-28 10:35:00 │
|
|
104
|
+
│ Messages: 42 │
|
|
105
|
+
│ Status: Active │
|
|
106
|
+
╰─────────────────────────────────────────────────────────────────────╯
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
View global statistics:
|
|
110
|
+
|
|
111
|
+
```bash
|
|
112
|
+
$ ccsinfo stats global
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
Start the API server:
|
|
116
|
+
|
|
117
|
+
```bash
|
|
118
|
+
$ ccsinfo serve
|
|
119
|
+
INFO: Started server process
|
|
120
|
+
INFO: Uvicorn running on http://127.0.0.1:8080
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
## CLI Reference
|
|
124
|
+
|
|
125
|
+
### Sessions
|
|
126
|
+
|
|
127
|
+
| Command | Description |
|
|
128
|
+
|---------|-------------|
|
|
129
|
+
| `ccsinfo sessions list` | List all sessions |
|
|
130
|
+
| `ccsinfo sessions list --active` | Show only active sessions |
|
|
131
|
+
| `ccsinfo sessions list --project <id>` | Filter by project |
|
|
132
|
+
| `ccsinfo sessions show <id>` | Show session details |
|
|
133
|
+
| `ccsinfo sessions messages <id>` | Show conversation messages |
|
|
134
|
+
| `ccsinfo sessions tools <id>` | Show tool calls made in session |
|
|
135
|
+
| `ccsinfo sessions active` | Show currently active sessions |
|
|
136
|
+
|
|
137
|
+
**Examples:**
|
|
138
|
+
|
|
139
|
+
```bash
|
|
140
|
+
# List sessions with JSON output
|
|
141
|
+
ccsinfo sessions list --json
|
|
142
|
+
|
|
143
|
+
# Show messages from a session (partial ID match supported)
|
|
144
|
+
ccsinfo sessions messages a1b2c3
|
|
145
|
+
|
|
146
|
+
# Filter messages by role
|
|
147
|
+
ccsinfo sessions messages a1b2c3 --role user
|
|
148
|
+
|
|
149
|
+
# Show tool calls with details
|
|
150
|
+
ccsinfo sessions tools a1b2c3d4
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
### Projects
|
|
154
|
+
|
|
155
|
+
| Command | Description |
|
|
156
|
+
|---------|-------------|
|
|
157
|
+
| `ccsinfo projects list` | List all projects |
|
|
158
|
+
| `ccsinfo projects show <id>` | Show project details |
|
|
159
|
+
| `ccsinfo projects stats <id>` | Show project statistics |
|
|
160
|
+
|
|
161
|
+
**Examples:**
|
|
162
|
+
|
|
163
|
+
```bash
|
|
164
|
+
# List all projects
|
|
165
|
+
ccsinfo projects list
|
|
166
|
+
|
|
167
|
+
# Show stats for a specific project
|
|
168
|
+
ccsinfo projects stats my-project
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
### Tasks
|
|
172
|
+
|
|
173
|
+
| Command | Description |
|
|
174
|
+
|---------|-------------|
|
|
175
|
+
| `ccsinfo tasks list` | List all tasks |
|
|
176
|
+
| `ccsinfo tasks list -s <session>` | List tasks for a specific session |
|
|
177
|
+
| `ccsinfo tasks show <id> -s <session>` | Show task details |
|
|
178
|
+
| `ccsinfo tasks pending` | Show pending tasks across all sessions |
|
|
179
|
+
|
|
180
|
+
**Examples:**
|
|
181
|
+
|
|
182
|
+
```bash
|
|
183
|
+
# List all tasks
|
|
184
|
+
ccsinfo tasks list
|
|
185
|
+
|
|
186
|
+
# Show a specific task from a session
|
|
187
|
+
ccsinfo tasks show 5 -s a1b2c3d4
|
|
188
|
+
|
|
189
|
+
# Show only pending tasks
|
|
190
|
+
ccsinfo tasks pending
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
### Statistics
|
|
194
|
+
|
|
195
|
+
| Command | Description |
|
|
196
|
+
|---------|-------------|
|
|
197
|
+
| `ccsinfo stats global` | Show global usage statistics |
|
|
198
|
+
| `ccsinfo stats daily` | Show daily activity breakdown |
|
|
199
|
+
| `ccsinfo stats trends` | Show usage trends over time |
|
|
200
|
+
|
|
201
|
+
**Examples:**
|
|
202
|
+
|
|
203
|
+
```bash
|
|
204
|
+
# Get global stats in JSON format
|
|
205
|
+
ccsinfo stats global --json
|
|
206
|
+
|
|
207
|
+
# View daily activity
|
|
208
|
+
ccsinfo stats daily
|
|
209
|
+
|
|
210
|
+
# Analyze trends
|
|
211
|
+
ccsinfo stats trends
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
### Search
|
|
215
|
+
|
|
216
|
+
| Command | Description |
|
|
217
|
+
|---------|-------------|
|
|
218
|
+
| `ccsinfo search sessions <query>` | Search sessions by content |
|
|
219
|
+
| `ccsinfo search messages <query>` | Search message content |
|
|
220
|
+
| `ccsinfo search history <query>` | Search prompt history |
|
|
221
|
+
|
|
222
|
+
**Examples:**
|
|
223
|
+
|
|
224
|
+
```bash
|
|
225
|
+
# Search for sessions mentioning "refactor"
|
|
226
|
+
ccsinfo search sessions "refactor"
|
|
227
|
+
|
|
228
|
+
# Search message content
|
|
229
|
+
ccsinfo search messages "fix bug"
|
|
230
|
+
|
|
231
|
+
# Search prompt history
|
|
232
|
+
ccsinfo search history "implement feature"
|
|
233
|
+
```
|
|
234
|
+
|
|
235
|
+
### Server
|
|
236
|
+
|
|
237
|
+
| Command | Description |
|
|
238
|
+
|---------|-------------|
|
|
239
|
+
| `ccsinfo serve` | Start the REST API server |
|
|
240
|
+
|
|
241
|
+
**Options:**
|
|
242
|
+
|
|
243
|
+
```bash
|
|
244
|
+
# Start with defaults (127.0.0.1:8080)
|
|
245
|
+
ccsinfo serve
|
|
246
|
+
|
|
247
|
+
# Start on custom host and port for network access
|
|
248
|
+
ccsinfo serve --host 0.0.0.0 --port 8080
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
## Global Options
|
|
252
|
+
|
|
253
|
+
| Option | Short | Description |
|
|
254
|
+
|--------|-------|-------------|
|
|
255
|
+
| `--server-url` | `-s` | Connect to a remote ccsinfo server instead of reading local data |
|
|
256
|
+
| `--json` | `-j` | Output results in JSON format (available on most commands) |
|
|
257
|
+
| `--version` | `-v` | Show version information |
|
|
258
|
+
| `--help` | `-h` | Show help message |
|
|
259
|
+
|
|
260
|
+
**Examples:**
|
|
261
|
+
|
|
262
|
+
```bash
|
|
263
|
+
# Connect to a remote server
|
|
264
|
+
ccsinfo -s http://my-server:8080 sessions list
|
|
265
|
+
|
|
266
|
+
# Get JSON output
|
|
267
|
+
ccsinfo sessions list --json
|
|
268
|
+
|
|
269
|
+
# Show version
|
|
270
|
+
ccsinfo --version
|
|
271
|
+
```
|
|
272
|
+
|
|
273
|
+
## Environment Variables
|
|
274
|
+
|
|
275
|
+
| Variable | Description | Default |
|
|
276
|
+
|----------|-------------|---------|
|
|
277
|
+
| `CCSINFO_SERVER_URL` | Default server URL for client mode | None (local mode) |
|
|
278
|
+
|
|
279
|
+
**Example:**
|
|
280
|
+
|
|
281
|
+
```bash
|
|
282
|
+
export CCSINFO_SERVER_URL=http://my-server:8080
|
|
283
|
+
ccsinfo sessions list # Uses remote server automatically
|
|
284
|
+
```
|
|
285
|
+
|
|
286
|
+
## Server Mode
|
|
287
|
+
|
|
288
|
+
Run ccsinfo as a REST API server to provide remote access to session data:
|
|
289
|
+
|
|
290
|
+
```bash
|
|
291
|
+
# Start server with defaults (127.0.0.1:8080)
|
|
292
|
+
ccsinfo serve
|
|
293
|
+
|
|
294
|
+
# Start on all interfaces for network access
|
|
295
|
+
ccsinfo serve --host 0.0.0.0 --port 8080
|
|
296
|
+
```
|
|
297
|
+
|
|
298
|
+
The server provides a REST API that mirrors the CLI functionality. Use it to:
|
|
299
|
+
|
|
300
|
+
- Build dashboards and monitoring tools
|
|
301
|
+
- Integrate with other applications
|
|
302
|
+
- Access session data from remote machines
|
|
303
|
+
|
|
304
|
+
## API Reference
|
|
305
|
+
|
|
306
|
+
### Sessions
|
|
307
|
+
|
|
308
|
+
| Endpoint | Method | Description |
|
|
309
|
+
|----------|--------|-------------|
|
|
310
|
+
| `/sessions` | GET | List all sessions |
|
|
311
|
+
| `/sessions/active` | GET | List active sessions |
|
|
312
|
+
| `/sessions/{id}` | GET | Get session details |
|
|
313
|
+
| `/sessions/{id}/messages` | GET | Get session messages |
|
|
314
|
+
| `/sessions/{id}/tools` | GET | Get session tool calls |
|
|
315
|
+
| `/sessions/{id}/tasks` | GET | Get session tasks |
|
|
316
|
+
| `/sessions/{id}/progress` | GET | Get session progress |
|
|
317
|
+
| `/sessions/{id}/summary` | GET | Get session summary |
|
|
318
|
+
|
|
319
|
+
**Query Parameters:**
|
|
320
|
+
|
|
321
|
+
- `GET /sessions`: `project_id`, `active_only`, `limit`
|
|
322
|
+
- `GET /sessions/{id}/messages`: `role`, `limit`
|
|
323
|
+
|
|
324
|
+
### Projects
|
|
325
|
+
|
|
326
|
+
| Endpoint | Method | Description |
|
|
327
|
+
|----------|--------|-------------|
|
|
328
|
+
| `/projects` | GET | List all projects |
|
|
329
|
+
| `/projects/{id}` | GET | Get project details |
|
|
330
|
+
| `/projects/{id}/sessions` | GET | Get project sessions |
|
|
331
|
+
| `/projects/{id}/sessions/active` | GET | Get active project sessions |
|
|
332
|
+
| `/projects/{id}/stats` | GET | Get project statistics |
|
|
333
|
+
|
|
334
|
+
### Tasks
|
|
335
|
+
|
|
336
|
+
| Endpoint | Method | Description |
|
|
337
|
+
|----------|--------|-------------|
|
|
338
|
+
| `/tasks` | GET | List all tasks |
|
|
339
|
+
| `/tasks/pending` | GET | List pending tasks |
|
|
340
|
+
| `/tasks/{id}` | GET | Get task details (requires `session_id` query param) |
|
|
341
|
+
|
|
342
|
+
**Query Parameters:**
|
|
343
|
+
|
|
344
|
+
- `GET /tasks`: `session_id`, `status`
|
|
345
|
+
- `GET /tasks/{id}`: `session_id` (required)
|
|
346
|
+
|
|
347
|
+
### Statistics
|
|
348
|
+
|
|
349
|
+
| Endpoint | Method | Description |
|
|
350
|
+
|----------|--------|-------------|
|
|
351
|
+
| `/stats` | GET | Get global statistics |
|
|
352
|
+
| `/stats/daily` | GET | Get daily activity |
|
|
353
|
+
| `/stats/trends` | GET | Get usage trends |
|
|
354
|
+
|
|
355
|
+
**Query Parameters:**
|
|
356
|
+
|
|
357
|
+
- `GET /stats/daily`: `days` (default: 30)
|
|
358
|
+
|
|
359
|
+
### Search
|
|
360
|
+
|
|
361
|
+
| Endpoint | Method | Description |
|
|
362
|
+
|----------|--------|-------------|
|
|
363
|
+
| `/search` | GET | Search sessions |
|
|
364
|
+
| `/search/history` | GET | Search prompt history |
|
|
365
|
+
|
|
366
|
+
**Query Parameters:**
|
|
367
|
+
|
|
368
|
+
- `GET /search`: `q` (required), `limit`
|
|
369
|
+
- `GET /search/history`: `q` (required), `limit`
|
|
370
|
+
|
|
371
|
+
### System
|
|
372
|
+
|
|
373
|
+
| Endpoint | Method | Description |
|
|
374
|
+
|----------|--------|-------------|
|
|
375
|
+
| `/health` | GET | Health check endpoint |
|
|
376
|
+
| `/info` | GET | Server and version information |
|
|
377
|
+
|
|
378
|
+
### Example API Usage
|
|
379
|
+
|
|
380
|
+
```bash
|
|
381
|
+
# List sessions
|
|
382
|
+
curl http://localhost:8080/sessions
|
|
383
|
+
|
|
384
|
+
# Get session details
|
|
385
|
+
curl http://localhost:8080/sessions/a1b2c3d4
|
|
386
|
+
|
|
387
|
+
# Get messages from a session
|
|
388
|
+
curl "http://localhost:8080/sessions/a1b2c3d4/messages?limit=10"
|
|
389
|
+
|
|
390
|
+
# Search sessions
|
|
391
|
+
curl "http://localhost:8080/search?q=refactor"
|
|
392
|
+
|
|
393
|
+
# Get global stats
|
|
394
|
+
curl http://localhost:8080/stats
|
|
395
|
+
|
|
396
|
+
# Health check
|
|
397
|
+
curl http://localhost:8080/health
|
|
398
|
+
```
|
|
399
|
+
|
|
400
|
+
## Moltbot Skill
|
|
401
|
+
|
|
402
|
+
A Moltbot skill is available for AI assistants to query Claude Code sessions remotely.
|
|
403
|
+
|
|
404
|
+
**Install via ClawdHub:**
|
|
405
|
+
|
|
406
|
+
```bash
|
|
407
|
+
clawdhub install ccsinfo
|
|
408
|
+
```
|
|
409
|
+
|
|
410
|
+
**Skill page:** https://clawdhub.com/myakove/ccsinfo
|
|
411
|
+
|
|
412
|
+
The skill allows AI assistants running in Moltbot to:
|
|
413
|
+
- Query and analyze Claude Code session data via the ccsinfo REST API
|
|
414
|
+
- View conversation history, tool calls, and tasks
|
|
415
|
+
- Search sessions and track project statistics
|
|
416
|
+
- Monitor active sessions and progress
|
|
417
|
+
|
|
418
|
+
**Requirements:**
|
|
419
|
+
- ccsinfo server running (see Server Mode above)
|
|
420
|
+
- `CCSINFO_SERVER_URL` environment variable set to your server
|
|
421
|
+
|
|
422
|
+
**Example usage:** Ask your Moltbot assistant: *"Show my active Claude Code sessions"* or *"What were the recent tasks in my main project?"*
|
|
423
|
+
|
|
424
|
+
## Development
|
|
425
|
+
|
|
426
|
+
### Setup
|
|
427
|
+
|
|
428
|
+
```bash
|
|
429
|
+
# Clone the repository
|
|
430
|
+
git clone https://github.com/myk-org/ccsinfo.git
|
|
431
|
+
cd ccsinfo
|
|
432
|
+
|
|
433
|
+
# Install development dependencies
|
|
434
|
+
uv pip install -e ".[dev]"
|
|
435
|
+
|
|
436
|
+
# Install pre-commit hooks
|
|
437
|
+
pre-commit install
|
|
438
|
+
```
|
|
439
|
+
|
|
440
|
+
### Running Tests
|
|
441
|
+
|
|
442
|
+
```bash
|
|
443
|
+
# Run tests with tox
|
|
444
|
+
tox
|
|
445
|
+
|
|
446
|
+
# Run tests with pytest directly
|
|
447
|
+
uv run pytest
|
|
448
|
+
|
|
449
|
+
# Run with coverage
|
|
450
|
+
uv run pytest --cov=ccsinfo --cov-report=html
|
|
451
|
+
```
|
|
452
|
+
|
|
453
|
+
### Code Quality
|
|
454
|
+
|
|
455
|
+
```bash
|
|
456
|
+
# Run linting
|
|
457
|
+
uv run ruff check src/
|
|
458
|
+
|
|
459
|
+
# Run formatting
|
|
460
|
+
uv run ruff format src/
|
|
461
|
+
|
|
462
|
+
# Run type checking
|
|
463
|
+
tox -e typecheck
|
|
464
|
+
```
|
|
465
|
+
|
|
466
|
+
## License
|
|
467
|
+
|
|
468
|
+
MIT License. See [LICENSE](LICENSE) for details.
|