shellrecap 0.1.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 didrod205
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,198 @@
1
+ <div align="center">
2
+
3
+ # ❯ shellrecap
4
+
5
+ ### Spotify Wrapped for your terminal — what does your shell history say about you?
6
+
7
+ [![npm version](https://img.shields.io/npm/v/shellrecap.svg?color=success)](https://www.npmjs.com/package/shellrecap)
8
+ [![bundle size](https://img.shields.io/bundlephobia/minzip/shellrecap?label=core%20gzip)](https://bundlephobia.com/package/shellrecap)
9
+ [![CI](https://github.com/didrod205/shellrecap/actions/workflows/ci.yml/badge.svg)](https://github.com/didrod205/shellrecap/actions/workflows/ci.yml)
10
+ [![types](https://img.shields.io/npm/types/shellrecap.svg)](https://www.npmjs.com/package/shellrecap)
11
+ [![license](https://img.shields.io/npm/l/shellrecap.svg)](./LICENSE)
12
+
13
+ <img src="./examples/sample-card.png" width="420" alt="A shellrecap card: The Night Owl, 7,140 commands typed, git on top, peak hour 2 AM." />
14
+
15
+ ```bash
16
+ npx shellrecap # reads your shell history — and never uploads a byte of it
17
+ ```
18
+
19
+ </div>
20
+
21
+ You typed `git status` one thousand times this year. You retyped the same
22
+ 27-character `kubectl` incantation two hundred times instead of making an alias.
23
+ You committed `gti status` to history 31 times. And somewhere in that file there
24
+ may be a **token you once pasted into a command line**, sitting in plaintext.
25
+
26
+ **shellrecap reads your `zsh`/`bash`/`fish` history and turns it into a recap** —
27
+ your top commands, the hour you actually work, your typo hall of shame, the
28
+ aliases you're owed (with exact keystrokes saved), and any secrets you've left
29
+ in the file (**always masked**). A persona card sums you up, exportable as an SVG
30
+ made for posting.
31
+
32
+ Your shell history is full of paths, hostnames, and credentials — **the one file
33
+ you should never paste into a website or a chatbot**. So shellrecap runs entirely
34
+ on your machine: no hooks to install, no account, no network. It just reads the
35
+ file your shell already writes.
36
+
37
+ ```
38
+ 🦉 The Night Owl
39
+ Your terminal sees more moonlight than sunlight.
40
+
41
+ 7,140 commands · 56 unique · 41 different programs
42
+
43
+ Top commands
44
+ git ██████████████████████ 2,178
45
+ cd ████████ 761
46
+ ls ███████ 729
47
+
48
+ When you type (peak 2 AM · Monday)
49
+ ▇██▆▁▁▁▁▁▂▃▃▃▃▃▃▃▃▃▆▆███
50
+
51
+ Typos sl→ls ×86 · gti→git ×69 · cd..→cd .. ×48 · claer→clear ×39
52
+ 316 mistyped commands · 1,145 wasted keystrokes
53
+
54
+ Aliases you're owed (could have saved 48,031 keystrokes)
55
+ alias kgpp='kubectl get pods -n production'
56
+ typed 197× — saves 5,122 keystrokes
57
+
58
+ ⚠ 3 possible secrets in your history
59
+ ghp_FA… GitHub token — entry #546
60
+ ```
61
+
62
+ ## Why shellrecap?
63
+
64
+ - 🎤 **The roast you can't get elsewhere.** GitHub has a wrapped. Spotify has a
65
+ wrapped. Your terminal — where you actually live — has nothing. Until now.
66
+ - 🔒 **Built for the one file you must not upload.** No hooks, no daemon, no
67
+ account, no network calls. It reads `~/.zsh_history` (or bash/fish) locally and
68
+ computes everything in-process. The shareable card shows **only command names
69
+ and counts** — never full command lines, which can contain hostnames and paths.
70
+ - 🎁 **It pays you back.** Alias suggestions are computed from what *you* actually
71
+ retype, ranked by exact keystrokes saved — copy-paste one line into your rc file.
72
+ - 🧹 **It might save you an incident.** Tokens, AWS keys, `-p` passwords, and
73
+ inline `SECRET=` vars left in history are detected and reported **masked**, with
74
+ the entry number so you can delete the line.
75
+ - 🧠 **Deterministic, zero-dependency core.** Same history → same recap. The pure
76
+ engine is browser-safe (a paste-and-see playground is on the roadmap).
77
+
78
+ ## Install
79
+
80
+ ```bash
81
+ # run it now, no install
82
+ npx shellrecap
83
+
84
+ # or keep it around
85
+ npm install -g shellrecap
86
+ ```
87
+
88
+ Node ≥ 18. Works with **zsh** (plain & `EXTENDED_HISTORY`), **bash** (plain &
89
+ `HISTTIMEFORMAT`), and **fish**. Time-of-day stats appear when your history has
90
+ timestamps; everything else works regardless.
91
+
92
+ ## Quick start
93
+
94
+ ```bash
95
+ shellrecap # auto-finds your history (most recent shell wins)
96
+ shellrecap ~/.bash_history # point at a specific file
97
+ shellrecap --shell fish # force a format
98
+ shellrecap doctor # list the history files it can see (paths only)
99
+ shellrecap report # write shellrecap.svg + .md + .json to share
100
+ shellrecap report --theme candy # tokyonight | dark | light | candy
101
+ history | shellrecap --stdin # pipe anything
102
+ ```
103
+
104
+ ## What it figures out
105
+
106
+ | Group | What you get |
107
+ | ----- | ------------ |
108
+ | **Persona** | One of ten (🦉 Night Owl, 🧙 Pipe Wizard, 🔱 Sudo Summoner, 🐙 Git Gremlin, 🐳 Container Captain, 🧘 Vim Monk, 🎨 Typo Artist, 🧭 Navigator, 🌐 Polyglot, 🎛️ Steady Operator) — picked by deterministic rules |
109
+ | **Top commands** | Programs and "favorite moves" (`git status`, `docker compose`…), pipe & sudo rates |
110
+ | **Rhythm** | Commands by hour/weekday, peak hour, night-owl & weekend share, busiest day *(needs timestamps)* |
111
+ | **Typos** | Curated classics (`gti`, `sl`, `claer`…) plus edit-distance detection against your own top commands — with wasted-keystroke totals |
112
+ | **Aliases you're owed** | Exact long commands you retype, suggested alias names, keystrokes each would save |
113
+ | **Secrets** | GitHub/AWS/Slack/Stripe/npm tokens, JWTs, `-p` passwords, inline `SECRET=` vars — **always masked**, with the entry number to delete |
114
+
115
+ ## Real scenarios
116
+
117
+ **1. Post your card.** Run `shellrecap report`, open the SVG, screenshot, post.
118
+ The card carries only command names and counts — safe by construction.
119
+
120
+ **2. Actually fix your workflow.** Paste the top alias suggestion into your
121
+ `.zshrc` and stop retyping that 30-character `kubectl` line 200 times a year:
122
+
123
+ ```bash
124
+ shellrecap | grep "alias " # → alias kgpp='kubectl get pods -n production'
125
+ ```
126
+
127
+ **3. Audit your history for leaked credentials.** CI keys get pasted into
128
+ terminals more often than anyone admits:
129
+
130
+ ```bash
131
+ shellrecap --quiet --json recap.json # secrets[] lists kind + entry number, masked
132
+ ```
133
+
134
+ ## Configuration
135
+
136
+ `shellrecap init` writes `shellrecap.config.json`:
137
+
138
+ ```jsonc
139
+ {
140
+ "theme": "tokyonight", // card theme
141
+ "top": 8, // how many top commands / suggestions
142
+ "aliasMinCount": 10, // suggest an alias after this many repeats
143
+ "aliasMinLength": 12, // …for commands at least this long
144
+ "ignoreCommands": [], // base commands to exclude entirely
145
+ "secretScan": true // set false to skip the secret check
146
+ }
147
+ ```
148
+
149
+ Flags override config. `--tz <minutes>` pins the timezone for reproducible time
150
+ stats (defaults to this machine's offset).
151
+
152
+ ## Library API
153
+
154
+ The core is pure and browser-safe — feed it history text from anywhere:
155
+
156
+ ```ts
157
+ import { parseHistory, analyze, renderCard, DEFAULT_CONFIG } from "shellrecap";
158
+
159
+ const { entries, format } = parseHistory(rawHistoryText);
160
+ const report = analyze(entries, DEFAULT_CONFIG, {
161
+ sourceLabel: "~/.zsh_history",
162
+ format,
163
+ tzOffsetMin: 540,
164
+ });
165
+
166
+ console.log(report.persona.title, report.aliases.totalSavable);
167
+ const svg = renderCard(report, "tokyonight");
168
+ ```
169
+
170
+ ## Privacy, precisely
171
+
172
+ - Reads your history file(s) **read-only**, locally. No network code exists in
173
+ this package — grep `dist/` if you like.
174
+ - The terminal output may show full command lines (it stays in your terminal).
175
+ - The **SVG card and Markdown/JSON exports never include full command lines or
176
+ secret values** — commands appear as names + counts, secrets only as masked
177
+ previews (`ghp_FA…`).
178
+
179
+ ## Roadmap
180
+
181
+ - 🌐 **Browser playground** — paste history, see your card, 100% client-side
182
+ (the engine already runs in a browser).
183
+ - 🐚 Atuin (SQLite) and PowerShell (`ConsoleHost_history.txt`) support.
184
+ - 📊 Multi-file merge (zsh + bash on the same machine).
185
+ - 🤖 **Optional `--ai` layer (bring-your-own key)** for a written "year in your
186
+ terminal" paragraph. The core stays 100% offline and deterministic.
187
+
188
+ ## 💖 Sponsor
189
+
190
+ shellrecap is free and MIT-licensed, built in spare time. If it made you laugh,
191
+ saved you keystrokes, or caught a leaked token:
192
+
193
+ - ⭐ **Star this repo** — the simplest free way to help others find it.
194
+ - 🍋 **[Sponsor via Lemon Squeezy](https://elab-studio.lemonsqueezy.com/checkout/buy/5d059b89-51d0-456b-b33a-ed56994f7010)** — one-time or recurring.
195
+
196
+ ## License
197
+
198
+ [MIT](./LICENSE) © shellrecap contributors