@ygncode/pi-insights 1.0.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 ygncode
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.
package/README.md ADDED
@@ -0,0 +1,129 @@
1
+ # pi-insights
2
+
3
+ Beautiful analytics reports for your [pi coding agent](https://pi.dev) sessions.
4
+
5
+ `pi-insights` is a Pi extension that adds an `/insights` command. It scans your local Pi session history and generates a self-contained HTML dashboard with usage, model, project, session, and “rage” analytics.
6
+
7
+ ## Features
8
+
9
+ - **Overview** — Activity calendar, sessions/tokens/cost per day, activity by hour, and top tools
10
+ - **Models** — Token distribution, per-model breakdown, thinking levels, and stop reasons
11
+ - **Projects** — Per-project sessions, messages, tokens, and cost with sortable bars
12
+ - **Sessions** — Searchable/filterable session table by project name or date
13
+ - **Rage 🤬** — Profanity analytics: swear rate, filthiest model, peak hour, top words, and project breakdown
14
+ - **Portable report** — Single self-contained HTML file; no server required, works from `file://`
15
+
16
+ ## Install
17
+
18
+ ### From npm
19
+
20
+ ```bash
21
+ pi install npm:@ygncode/pi-insights
22
+ ```
23
+
24
+ ### From GitHub
25
+
26
+ ```bash
27
+ pi install git:github.com/ygncode/pi-insights
28
+ ```
29
+
30
+ ### Try without installing
31
+
32
+ ```bash
33
+ pi -e npm:@ygncode/pi-insights
34
+ # or
35
+ pi -e git:github.com/ygncode/pi-insights
36
+ ```
37
+
38
+ ## Usage
39
+
40
+ Inside Pi, run:
41
+
42
+ ```text
43
+ /insights
44
+ ```
45
+
46
+ The report opens automatically and is written to:
47
+
48
+ ```text
49
+ ~/.pi/agent/insights-reports/pi-insights.html
50
+ ```
51
+
52
+ Each run overwrites the same report file.
53
+
54
+ ## What gets analyzed?
55
+
56
+ `pi-insights` reads local Pi session JSONL files from:
57
+
58
+ ```text
59
+ ~/.pi/agent/sessions/
60
+ ```
61
+
62
+ No data is uploaded by this extension. The generated report is local HTML.
63
+
64
+ ## Package metadata
65
+
66
+ This repo is a Pi package. `package.json` declares:
67
+
68
+ ```json
69
+ {
70
+ "keywords": ["pi-package"],
71
+ "pi": {
72
+ "extensions": ["./index.ts"]
73
+ }
74
+ }
75
+ ```
76
+
77
+ That allows users to install it with `pi install` from npm, GitHub, or a local path.
78
+
79
+ ## pi.dev package gallery
80
+
81
+ This package is prepared for the [Pi package gallery](https://pi.dev/packages):
82
+
83
+ - npm package name: `@ygncode/pi-insights`
84
+ - GitHub repo: `https://github.com/ygncode/pi-insights`
85
+ - Pi package keyword: `pi-package`
86
+ - Pi extension manifest: `pi.extensions = ["./index.ts"]`
87
+
88
+ After publishing to npm, submit or list the package on <https://pi.dev/packages> using the npm package URL/name.
89
+
90
+ ## Development
91
+
92
+ ```bash
93
+ npm install
94
+ npm run build # build the React frontend into dist/
95
+ npm test # run all tests
96
+ npm run test:watch # watch mode
97
+ npm run test:coverage
98
+ ```
99
+
100
+ `dist/` is intentionally included in the package so Pi can run the extension immediately after npm/git installation without requiring users to build the frontend.
101
+
102
+ ## Architecture
103
+
104
+ ```text
105
+ index.ts — Extension entry point; registers the /insights command
106
+ lib/
107
+ parser.ts — Parses JSONL session files into ParsedSession objects
108
+ analytics.ts — Computes aggregate stats from parsed sessions
109
+ rage.ts — Profanity detection
110
+ types.ts — Shared TypeScript interfaces
111
+ src/
112
+ App.tsx — React frontend
113
+ utils.ts — Formatting helpers
114
+ components/
115
+ ContributionCalendar.tsx
116
+ tests/
117
+ lib/ — Unit tests for parser, analytics, rage
118
+ src/ — Unit tests for frontend utils
119
+ ```
120
+
121
+ ## Tech stack
122
+
123
+ - React 19 + TypeScript 6 + Vite 8
124
+ - Recharts 3
125
+ - Vitest 4
126
+
127
+ ## License
128
+
129
+ MIT