happenin 0.2.0 → 0.4.0
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.
- package/README.md +45 -5
- package/assets/help.md +10 -3
- package/dist/bin.js +527 -118
- package/package.json +7 -5
package/README.md
CHANGED
|
@@ -5,10 +5,20 @@
|
|
|
5
5
|
[](docs/CODE_OF_CONDUCT.md)
|
|
6
6
|
[](http://makeapullrequest.com)
|
|
7
7
|
|
|
8
|
-
A
|
|
8
|
+
A CLI that records Cursor and Claude Code agent events to a local SQLite database and serves a live browser dashboard.
|
|
9
9
|
|
|
10
10
|

|
|
11
11
|
|
|
12
|
+
## Try it
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
npx -y happenin install # add record hooks to Cursor and Claude Code
|
|
16
|
+
npx -y happenin import # import existing transcripts
|
|
17
|
+
npx -y happenin dashboard # open the live dashboard
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
No global install needed: hooks installed this way run through `npx`. For a permanent setup, use the [global install](#install).
|
|
21
|
+
|
|
12
22
|
## Why
|
|
13
23
|
|
|
14
24
|
Cursor and Claude Code can emit local hooks for each session, tool use, prompt, file edit, and lifecycle event. `happenin` adds `record` hooks to those agents, writes the payloads to a local SQLite database, and serves a live browser dashboard. Data never leaves your machine.
|
|
@@ -19,7 +29,7 @@ Cursor and Claude Code can emit local hooks for each session, tool use, prompt,
|
|
|
19
29
|
|
|
20
30
|
## Requirements
|
|
21
31
|
|
|
22
|
-
- macOS
|
|
32
|
+
- macOS, Linux, or Windows
|
|
23
33
|
- Node.js `>= 22.13.0` (uses the built-in `node:sqlite` module, available since Node 22.13)
|
|
24
34
|
- Zero runtime dependencies
|
|
25
35
|
- The dashboard loads htmx and htmx-ext-sse from a CDN
|
|
@@ -58,7 +68,7 @@ The dashboard opens at `http://localhost:8765`. New events appear automatically.
|
|
|
58
68
|
|
|
59
69
|
### `happenin install [--cursor] [--claude]`
|
|
60
70
|
|
|
61
|
-
Backs up and appends `happenin record` hooks to `~/.cursor/hooks.json` and `~/.claude/settings.json`. Backups are written to `~/.happenin/backups/`.
|
|
71
|
+
Backs up and appends `happenin record` hooks to `~/.cursor/hooks.json` and `~/.claude/settings.json`. Backups are written to `~/.happenin/backups/`. Re-running `install` replaces the previous `happenin` hooks instead of duplicating them, and hooks installed through `npx -y happenin install` are written as `npx -y happenin` commands so they keep working without a global install.
|
|
62
72
|
|
|
63
73
|
```bash
|
|
64
74
|
happenin install --cursor
|
|
@@ -79,15 +89,21 @@ echo '{"hook_event_name":"sessionStart","sessionId":"abc123"}' | happenin record
|
|
|
79
89
|
echo '{"sessionId":"abc123"}' | happenin record claude SessionStart
|
|
80
90
|
```
|
|
81
91
|
|
|
82
|
-
### `happenin import`
|
|
92
|
+
### `happenin import [--force]`
|
|
83
93
|
|
|
84
94
|
Imports existing transcripts:
|
|
85
95
|
|
|
86
|
-
- Claude Code JSONL from `~/.claude/projects/<project>/<session>.jsonl`.
|
|
96
|
+
- Claude Code JSONL from `~/.claude/projects/<project>/<session>.jsonl`. Each `tool_use` block in an
|
|
97
|
+
assistant message becomes its own event with `tool_name` set (and `file_path` for file-editing
|
|
98
|
+
tools, `skill_name` for `Skill` calls), so tool usage, skills used, and files touched are
|
|
99
|
+
queryable per session and show up on the dashboard.
|
|
87
100
|
- Cursor `prompt_history.json` and `meta.json` from `~/.cursor/chats/<hash>/<session>/`.
|
|
88
101
|
|
|
89
102
|
`store.db` is skipped because it is encrypted.
|
|
90
103
|
|
|
104
|
+
Files are only re-parsed when their modification time changes; pass `--force` to clear that
|
|
105
|
+
tracking and re-import everything from scratch (useful after upgrading `happenin`).
|
|
106
|
+
|
|
91
107
|
### `happenin query [options]`
|
|
92
108
|
|
|
93
109
|
Query events from the local database and print them as JSON, JSONL, or a summary.
|
|
@@ -120,6 +136,30 @@ Starts a local HTTP server and opens the dashboard.
|
|
|
120
136
|
- `--no-open` — do not open the browser.
|
|
121
137
|
- `--silent` — alias for `--no-open`; used automatically by `npm start`.
|
|
122
138
|
|
|
139
|
+
The main screen shows total sessions/events, average duration, and success rate for the selected
|
|
140
|
+
date range, plus charts for the top 10 tools, top 10 skills, and top 10 markdown files touched.
|
|
141
|
+
Clicking a tool, skill, or file jumps to a list of every session that used it. The markdown files
|
|
142
|
+
chart can be scoped to one directory with the "md files directory" filter (the common path prefix
|
|
143
|
+
is stripped from the dropdown labels, and paths under `/private` are excluded).
|
|
144
|
+
|
|
145
|
+
The persistent filter bar also has multi-select "directories", "skills", and "integrations (MCP)"
|
|
146
|
+
controls. Each lets you pick several values at once — matching sessions with _any_ of the selected
|
|
147
|
+
values in that category (OR) — and the categories combine with every other filter, including each
|
|
148
|
+
other, with AND (e.g. directory X or Y, AND skill A or B). The "integrations (MCP)" list is derived
|
|
149
|
+
from the data itself: it parses the `mcp__<server>__<tool>` naming convention on recorded tool
|
|
150
|
+
calls and lists every distinct MCP server actually seen, with no hardcoded set of servers.
|
|
151
|
+
|
|
152
|
+
A context breakdown widget splits recorded payload size (and, for imported Claude sessions, token
|
|
153
|
+
usage) into four buckets: MCP server calls, markdown file reads, bloatware (skill loads and
|
|
154
|
+
lifecycle/hook noise), and actual value (real tool calls and conversation turns). It appears on the
|
|
155
|
+
main dashboard for the current filter/date range, and again inside a session's detail view scoped
|
|
156
|
+
to that session. This is a heuristic, not an exact accounting — Claude Code does not log its system
|
|
157
|
+
prompt or tool schemas to the transcript, so there is no ground truth to bucket against.
|
|
158
|
+
|
|
159
|
+
The "Recent Sessions" bar above the charts is collapsed by default — clicking it replaces the
|
|
160
|
+
metrics/charts with the full session list; clicking it again (or picking a session) returns to the
|
|
161
|
+
previous view.
|
|
162
|
+
|
|
123
163
|
```bash
|
|
124
164
|
happenin dashboard --port 9000 --silent
|
|
125
165
|
```
|
package/assets/help.md
CHANGED
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
# happenin
|
|
2
2
|
|
|
3
|
-
A
|
|
3
|
+
A CLI that records Cursor and Claude Code agent events to a local SQLite database and serves a live browser dashboard.
|
|
4
4
|
|
|
5
5
|
## Commands
|
|
6
6
|
|
|
7
7
|
### `happenin install [--cursor] [--claude]`
|
|
8
8
|
|
|
9
9
|
Backs up and appends `happenin record` hooks to your Cursor and Claude Code configuration files.
|
|
10
|
+
Re-running install replaces previous happenin hooks instead of duplicating them. When happenin
|
|
11
|
+
runs through npx, hooks are written as `npx -y happenin` commands so they keep working without a
|
|
12
|
+
global install.
|
|
10
13
|
|
|
11
14
|
- `--cursor` — install Cursor hooks only.
|
|
12
15
|
- `--claude` — install Claude Code hooks only.
|
|
@@ -22,15 +25,19 @@ The hook target. Reads a JSON payload from stdin, writes it to `~/.happenin/happ
|
|
|
22
25
|
|
|
23
26
|
This command is normally called by the agent hooks, not directly.
|
|
24
27
|
|
|
25
|
-
### `happenin import`
|
|
28
|
+
### `happenin import [--force]`
|
|
26
29
|
|
|
27
30
|
Imports existing transcripts:
|
|
28
31
|
|
|
29
|
-
- Claude Code JSONL from `~/.claude/projects/<project>/<session>.jsonl`.
|
|
32
|
+
- Claude Code JSONL from `~/.claude/projects/<project>/<session>.jsonl`. Each `tool_use` block in an
|
|
33
|
+
assistant message becomes its own event with `tool_name` set (and `file_path` for file-editing
|
|
34
|
+
tools, `skill_name` for `Skill` calls).
|
|
30
35
|
- Cursor `prompt_history.json` and `meta.json` from `~/.cursor/chats/<hash>/<session>/`.
|
|
31
36
|
|
|
32
37
|
`store.db` is skipped because it is encrypted.
|
|
33
38
|
|
|
39
|
+
- `--force` — clear import tracking and re-import every discovered file from scratch.
|
|
40
|
+
|
|
34
41
|
### `happenin query [options]`
|
|
35
42
|
|
|
36
43
|
Query events from the local database and print them as JSON, JSONL, or a summary.
|