@npow/oh-my-claude 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.
Files changed (57) hide show
  1. package/README.md +317 -0
  2. package/bin/omc.js +403 -0
  3. package/docs/architecture.md +198 -0
  4. package/docs/segment-contract.md +186 -0
  5. package/docs/theme-format.md +156 -0
  6. package/package.json +35 -0
  7. package/src/cache.js +102 -0
  8. package/src/color.js +105 -0
  9. package/src/compositor.js +163 -0
  10. package/src/config.js +146 -0
  11. package/src/plugins.js +72 -0
  12. package/src/runner.js +160 -0
  13. package/src/segments/achievement.js +68 -0
  14. package/src/segments/api-timer.js +55 -0
  15. package/src/segments/battle-log.js +55 -0
  16. package/src/segments/cat.js +89 -0
  17. package/src/segments/coffee-cup.js +81 -0
  18. package/src/segments/commit-msg.js +95 -0
  19. package/src/segments/context-bar.js +50 -0
  20. package/src/segments/context-percent.js +40 -0
  21. package/src/segments/context-tokens.js +52 -0
  22. package/src/segments/cost-budget.js +43 -0
  23. package/src/segments/coworker.js +137 -0
  24. package/src/segments/custom-text.js +25 -0
  25. package/src/segments/directory.js +75 -0
  26. package/src/segments/emoji-story.js +99 -0
  27. package/src/segments/flex-space.js +25 -0
  28. package/src/segments/fortune-cookie.js +131 -0
  29. package/src/segments/garden.js +57 -0
  30. package/src/segments/git-branch.js +36 -0
  31. package/src/segments/git-status.js +56 -0
  32. package/src/segments/horoscope.js +134 -0
  33. package/src/segments/index.js +65 -0
  34. package/src/segments/lines-changed.js +29 -0
  35. package/src/segments/model-name.js +28 -0
  36. package/src/segments/narrator.js +129 -0
  37. package/src/segments/output-style.js +25 -0
  38. package/src/segments/rpg-stats.js +119 -0
  39. package/src/segments/separator-arrow.js +22 -0
  40. package/src/segments/separator-pipe.js +22 -0
  41. package/src/segments/separator-space.js +22 -0
  42. package/src/segments/session-cost.js +72 -0
  43. package/src/segments/session-timer.js +53 -0
  44. package/src/segments/smart-nudge.js +97 -0
  45. package/src/segments/soundtrack.js +133 -0
  46. package/src/segments/speedrun.js +94 -0
  47. package/src/segments/stock-ticker.js +71 -0
  48. package/src/segments/streak.js +131 -0
  49. package/src/segments/tamagotchi.js +95 -0
  50. package/src/segments/token-sparkline.js +73 -0
  51. package/src/segments/version.js +27 -0
  52. package/src/segments/vibe-check.js +109 -0
  53. package/src/segments/vim-mode.js +29 -0
  54. package/src/segments/weather-report.js +88 -0
  55. package/themes/default.json +59 -0
  56. package/themes/minimal.json +37 -0
  57. package/themes/powerline.json +73 -0
package/README.md ADDED
@@ -0,0 +1,317 @@
1
+ # oh-my-claude
2
+
3
+ **Like oh-my-zsh, but for Claude Code.**
4
+
5
+ A statusline framework for Claude Code's `--statusline` feature. 41 segments, 3 themes, a plugin system, one command to install.
6
+
7
+ <!-- badges -->
8
+ <!-- ![npm version](https://img.shields.io/npm/v/oh-my-claude) -->
9
+ <!-- ![license](https://img.shields.io/github/license/...) -->
10
+
11
+ ---
12
+
13
+ ### What it looks like
14
+
15
+ **Default theme** -- two lines, works in every terminal:
16
+
17
+ ```
18
+ Opus myproject main +2 ~1 +83 -21 15m 0s
19
+ ▓▓▓▓▓▓▓░░░░░░░░░░░░░ 35% $4.56
20
+ ```
21
+
22
+ Context filling up? The bar changes color so you know before you hit the wall:
23
+
24
+ ```
25
+ ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓░░░░ 80% <-- turns red here
26
+ ```
27
+
28
+ ---
29
+
30
+ ## Install
31
+
32
+ ```bash
33
+ npx oh-my-claude
34
+ ```
35
+
36
+ That's it. Picks a theme, writes the config, wires up Claude Code. Restart Claude Code and you're done.
37
+
38
+ ---
39
+
40
+ ## Why oh-my-claude?
41
+
42
+ - **Know when to /compact** -- Context bar turns yellow at 60%, red at 80%. Never hit the wall blind.
43
+ - **Track what you're spending** -- Auto-detects your plan (Pro/Max). Session cost turns yellow before you blow budget.
44
+ - **See your git state** -- Branch + dirty files always visible. Never commit to the wrong branch again.
45
+ - **Make it yours** -- 41 segments, 3 themes, a plugin system, JSON config. From minimal to full dashboard.
46
+
47
+ ---
48
+
49
+ ## Segment Showcase
50
+
51
+ 41 segments. Mix and match to build the statusline that fits how you work. Here are four setups to show the range.
52
+
53
+ **The Productivity Setup:**
54
+ ```
55
+ Opus myproject main +2 ~1 +83 -21 15m 0s
56
+ ▓▓▓▓▓▓▓░░░░░░░░░░░░░ 35% $4.56
57
+ ```
58
+ Context bar, git info, cost tracking, lines changed, session timer. Everything you need, nothing you don't.
59
+
60
+ **The Fun Setup:**
61
+ ```
62
+ (^.^) ✨ vibing 🥠 "Weeks of coding can save hours of planning"
63
+ 🏕️ Base Camp (12%) +47 gold =^._.^= *perks up* [████]
64
+ ```
65
+ Tamagotchi pet, vibe check, fortune cookie, battle log, cat companion, coffee cup. Your terminal has personality now.
66
+
67
+ **The Gamer Setup:**
68
+ ```
69
+ Lv.3 STR:10 DEX:5 INT:12 WIS:8 CHA:0 ⏱️ 12:30 [A]
70
+ ▁▂▃▄▅▆ 🎵 lo-fi beats $OMC ▲ $4.56 🏆 First Blood
71
+ ```
72
+ RPG stats, speedrun timer, token sparkline, soundtrack, stock ticker, achievements. Every session is a run.
73
+
74
+ **The Minimal Setup:**
75
+ ```
76
+ myproject · main · 35% · $4.56
77
+ ```
78
+ Single line. Text only. No bars, no icons, no fuss. The `minimal` theme does this out of the box.
79
+
80
+ ---
81
+
82
+ ## All 41 Segments
83
+
84
+ Organized by what you're trying to do.
85
+
86
+ ### "I want to be productive"
87
+
88
+ The bread and butter. Context awareness, cost tracking, git state, and helpful nudges.
89
+
90
+ | Segment | What it shows | Example |
91
+ |---------|---------------|---------|
92
+ | `context-bar` | Visual progress bar for context window | `▓▓▓▓▓▓▓░░░░░░░░░░░░░ 35%` |
93
+ | `context-percent` | Context usage as a number | `35%` |
94
+ | `context-tokens` | Token count as used/total | `84k/200k` |
95
+ | `session-cost` | Running session cost in USD | `$4.56` |
96
+ | `cost-budget` | Cost vs your budget | `$3.50/$10.00` |
97
+ | `git-branch` | Current branch name | `main` |
98
+ | `git-status` | Staged, modified, untracked counts | `+2 ~1 ?3` |
99
+ | `lines-changed` | Lines added and removed | `+83 -21` |
100
+ | `smart-nudge` | Context-aware suggestions | `/compact` at 75%, `commit?` at 100 lines |
101
+ | `token-sparkline` | ASCII sparkline of context over time | `▁▂▃▄▅▆▇█` |
102
+
103
+ ### "I want to have fun while I wait"
104
+
105
+ Entertainment and personality. None of these are on by default -- add them to your theme when you want some life in your terminal.
106
+
107
+ | Segment | What it does | Example |
108
+ |---------|--------------|---------|
109
+ | `tamagotchi` | Virtual pet that reacts to your session | `(^.^)` happy, `(x_x) RIP` at 95% context |
110
+ | `cat` | A cat doing cat things | `=^._.^= *sits on context window*` |
111
+ | `vibe-check` | One-word mood derived from session metrics | `vibing`, `shipping`, `burning cash` |
112
+ | `fortune-cookie` | Rotating developer wisdom | `"Weeks of coding can save hours of planning"` |
113
+ | `narrator` | Third-person text adventure narration | `The walls close in...` |
114
+ | `soundtrack` | Suggests a music genre for the moment | `lo-fi beats`, `boss battle music` |
115
+ | `garden` | ASCII plants that grow as you code | `(.)` seed to `(tree)` at 500 lines |
116
+ | `coffee-cup` | Coffee that drains over a 2-hour session | `[████]` full to `[ ] refill?` |
117
+
118
+ ### "I want to gamify my session"
119
+
120
+ Turn your coding session into a game. Achievements, stats, and timers to keep you going.
121
+
122
+ | Segment | What it does | Example |
123
+ |---------|--------------|---------|
124
+ | `achievement` | Unlockable badges for session milestones | `Centurion` at 100 lines, `Whale` at $20 |
125
+ | `rpg-stats` | Session stats as D&D attributes | `Lv.3 STR:10 DEX:5 INT:12 WIS:8 CHA:0` |
126
+ | `speedrun` | Timer with cost-efficiency rating | `12:30 [A]` |
127
+ | `streak` | Consecutive-day usage streak | `5d streak` |
128
+ | `battle-log` | Session framed as a dungeon crawl | `Deep Dungeon (65%) +47 gold` |
129
+ | `stock-ticker` | Session cost as a stock price | `$OMC ▲ $4.56` |
130
+ | `emoji-story` | Growing sequence of emojis summarizing the session | A new emoji appended for each milestone |
131
+
132
+ ### "I want useful information"
133
+
134
+ Identity, navigation, and situational awareness. The segments that tell you where you are and what's happening.
135
+
136
+ | Segment | What it shows | Example |
137
+ |---------|---------------|---------|
138
+ | `model-name` | Current model display name | `Opus` |
139
+ | `directory` | Working directory (basename, fish, or full) | `myproject` |
140
+ | `session-timer` | How long this session has been running | `15m 0s` |
141
+ | `api-timer` | Cumulative API wait time | `api 3m 40s` |
142
+ | `vim-mode` | Current vim mode when active | `NORMAL` |
143
+ | `version` | Claude Code version string | `v2.1.34` |
144
+ | `weather-report` | Session conditions as a weather forecast | `Clear Skies`, `Stormy` at 85% context |
145
+ | `horoscope` | Daily coding horoscope by zodiac sign | `Mercury is in retrograde. Avoid force-pushing.` |
146
+ | `coworker` | Fake Slack messages reacting to your session | `@bot: 'ship it already'` |
147
+ | `commit-msg` | What the commit message should be | `git commit -m "feat: rewrite the entire codebase"` |
148
+
149
+ ### "I want to build my own layout"
150
+
151
+ Building blocks for custom themes. Separators, spacing, and raw text.
152
+
153
+ | Segment | Purpose |
154
+ |---------|---------|
155
+ | `separator-pipe` | Vertical pipe `│` between segments |
156
+ | `separator-arrow` | Powerline arrow `` separator |
157
+ | `separator-space` | Whitespace for breathing room |
158
+ | `flex-space` | Right-alignment marker for the compositor |
159
+ | `custom-text` | Your own static text string |
160
+ | `output-style` | Shows active output style (hidden when "default") |
161
+
162
+ ---
163
+
164
+ ## Themes
165
+
166
+ ### default
167
+
168
+ Two-line layout. No special fonts. Works everywhere.
169
+
170
+ ```
171
+ Opus myproject main +2 ~1 +83 -21 15m 0s
172
+ ▓▓▓▓▓▓▓░░░░░░░░░░░░░ 35% $1.23
173
+ ```
174
+
175
+ Line 1: model, directory, git branch, git status (left) / lines changed, session timer (right)
176
+ Line 2: context bar (left) / session cost (right)
177
+
178
+ ### minimal
179
+
180
+ Single line. Text only. No bars, no icons, no fuss.
181
+
182
+ ```
183
+ myproject · main +2 ~1 35% · $1.23
184
+ ```
185
+
186
+ ### powerline
187
+
188
+ Two-line layout with Nerd Font icons and arrow separators. Requires a [Nerd Font](https://www.nerdfonts.com/).
189
+
190
+ ```
191
+ Opus ~/c/myproject main +2 ~1 +83 -21 15m 0s
192
+ ███████░░░░░░░░ 35% 84k/200k $1.23 NORMAL
193
+ ```
194
+
195
+ Line 1: model, directory (fish-style), git branch, git status / lines changed, session timer
196
+ Line 2: context bar, token count / session cost, vim mode
197
+
198
+ ---
199
+
200
+ ## Configuration
201
+
202
+ After install, your config lives at `~/.claude/oh-my-claude/config.json`:
203
+
204
+ ```json
205
+ {
206
+ "theme": "default",
207
+ "segments": {
208
+ "cost-budget": {
209
+ "budget": 10
210
+ },
211
+ "session-cost": {
212
+ "plan": "pro"
213
+ },
214
+ "context-bar": {
215
+ "warnAt": 60,
216
+ "criticalAt": 80
217
+ }
218
+ }
219
+ }
220
+ ```
221
+
222
+ Pick a theme, override any segment config you want, done. Segment configs in `config.json` merge on top of the theme defaults.
223
+
224
+ ### Switch themes
225
+
226
+ Edit `config.json` and change `"theme"` to `"default"`, `"minimal"`, or `"powerline"`. Or run:
227
+
228
+ ```bash
229
+ omc themes
230
+ ```
231
+
232
+ ### Plan detection
233
+
234
+ The `session-cost` segment auto-detects your plan from context window size:
235
+ - 1M context = Max plan
236
+ - 200k context = Pro plan
237
+
238
+ Override it in config if needed: `"plan": "pro"`, `"max5"`, `"max20"`, or `"api"`.
239
+
240
+ ---
241
+
242
+ ## Add your own segment
243
+
244
+ You don't need to fork the repo. Plugins live in their own directory:
245
+
246
+ ```bash
247
+ omc create my-segment
248
+ ```
249
+
250
+ This creates `~/.claude/oh-my-claude/plugins/my-segment/segment.js`:
251
+
252
+ ```js
253
+ export const meta = {
254
+ name: 'my-segment',
255
+ description: 'My custom segment',
256
+ requires: [],
257
+ defaultConfig: {},
258
+ };
259
+
260
+ export function render(data, config) {
261
+ return { text: 'Hello!', style: 'cyan' };
262
+ }
263
+ ```
264
+
265
+ Add it to your theme's lines in `config.json`, restart Claude Code, done.
266
+
267
+ Three rules:
268
+ 1. Export `meta` with a `name`
269
+ 2. Export `render(data, config)`
270
+ 3. Return `{ text, style }` or `null`
271
+
272
+ The `data` object contains everything Claude Code sends -- model info, context window stats, cost, git state, and more. `null` means "hide this segment for now." Full data field reference: [docs/segment-contract.md](docs/segment-contract.md)
273
+
274
+ ### Share your segment
275
+
276
+ Made something cool? Two options:
277
+ - **PR it** -- Add your segment to `src/segments/` and open a pull request. We accept all reasonable contributions.
278
+ - **Share the file** -- Post your `segment.js` anywhere. Others can drop it in their plugins directory.
279
+
280
+ ---
281
+
282
+ ## CLI commands
283
+
284
+ ```
285
+ omc install Interactive install wizard
286
+ omc create Scaffold a new plugin segment
287
+ omc themes List available themes
288
+ omc list List all 41 segments with descriptions
289
+ omc validate Check that all segments export the correct shape
290
+ omc uninstall Remove oh-my-claude from Claude Code
291
+ omc help Show help
292
+ ```
293
+
294
+ ---
295
+
296
+ ## Requirements
297
+
298
+ - Node 18+
299
+ - Zero npm dependencies
300
+
301
+ ---
302
+
303
+ ## Contributing
304
+
305
+ PRs welcome. If you're adding a segment:
306
+
307
+ 1. One file per segment in `src/segments/`
308
+ 2. Export `meta` and `render` -- no exceptions
309
+ 3. Handle missing data gracefully (never crash the statusline)
310
+ 4. Add a test in `tests/` covering normal data, null fields, and edge cases
311
+ 5. Run `npm run validate` to check the contract
312
+
313
+ ---
314
+
315
+ ## License
316
+
317
+ MIT