@owloops/claude-powerline 1.24.4 → 1.25.1

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 (46) hide show
  1. package/dist/browser.d.ts +676 -0
  2. package/dist/browser.js +3 -0
  3. package/dist/index.mjs +10 -10
  4. package/package.json +9 -1
  5. package/plugin/templates/config-tui-compact.json +4 -4
  6. package/plugin/templates/config-tui-full.json +5 -5
  7. package/plugin/templates/config-tui-standard.json +5 -5
  8. package/src/browser.ts +203 -0
  9. package/src/config/defaults.ts +79 -0
  10. package/src/config/loader.ts +462 -0
  11. package/src/index.ts +90 -0
  12. package/src/powerline.ts +904 -0
  13. package/src/segments/block.ts +31 -0
  14. package/src/segments/context.ts +221 -0
  15. package/src/segments/git.ts +492 -0
  16. package/src/segments/index.ts +25 -0
  17. package/src/segments/metrics.ts +175 -0
  18. package/src/segments/pricing.ts +454 -0
  19. package/src/segments/renderer.ts +796 -0
  20. package/src/segments/session.ts +207 -0
  21. package/src/segments/tmux.ts +35 -0
  22. package/src/segments/today.ts +191 -0
  23. package/src/themes/dark.ts +52 -0
  24. package/src/themes/gruvbox.ts +52 -0
  25. package/src/themes/index.ts +131 -0
  26. package/src/themes/light.ts +52 -0
  27. package/src/themes/nord.ts +52 -0
  28. package/src/themes/rose-pine.ts +52 -0
  29. package/src/themes/tokyo-night.ts +52 -0
  30. package/src/tui/grid.ts +712 -0
  31. package/src/tui/index.ts +4 -0
  32. package/src/tui/layouts.ts +285 -0
  33. package/src/tui/primitives.ts +175 -0
  34. package/src/tui/renderer.ts +206 -0
  35. package/src/tui/sections.ts +1080 -0
  36. package/src/tui/types.ts +181 -0
  37. package/src/utils/budget.ts +47 -0
  38. package/src/utils/cache.ts +247 -0
  39. package/src/utils/claude.ts +489 -0
  40. package/src/utils/color-support.ts +118 -0
  41. package/src/utils/colors.ts +120 -0
  42. package/src/utils/constants.ts +176 -0
  43. package/src/utils/formatters.ts +160 -0
  44. package/src/utils/logger.ts +5 -0
  45. package/src/utils/terminal-width.ts +117 -0
  46. package/src/utils/terminal.ts +11 -0
package/src/browser.ts ADDED
@@ -0,0 +1,203 @@
1
+ /**
2
+ * Browser-safe entry point for claude-powerline.
3
+ *
4
+ * Exports all rendering modules, themes, types, and utilities needed
5
+ * to generate statusline output without any Node.js built-in modules.
6
+ *
7
+ * Data providers (git, session, metrics, etc.) are NOT exported here —
8
+ * supply pre-built data objects to the rendering functions instead.
9
+ */
10
+
11
+ // --- Types ---
12
+
13
+ export type { ClaudeHookData } from "./utils/claude";
14
+
15
+ export type {
16
+ PowerlineConfig,
17
+ DisplayConfig,
18
+ LineConfig,
19
+ BudgetConfig,
20
+ BudgetItemConfig,
21
+ } from "./config/loader";
22
+
23
+ export type { ColorTheme, PowerlineColors, SegmentColor } from "./themes";
24
+
25
+ export type { GitInfo } from "./segments/git";
26
+ export type {
27
+ UsageInfo,
28
+ SessionInfo,
29
+ TokenBreakdown,
30
+ } from "./segments/session";
31
+ export type { ContextInfo } from "./segments/context";
32
+ export type { MetricsInfo } from "./segments/metrics";
33
+ export type { BlockInfo } from "./segments/block";
34
+ export type { TodayInfo } from "./segments/today";
35
+
36
+ export type {
37
+ SegmentConfig,
38
+ AnySegmentConfig,
39
+ DirectorySegmentConfig,
40
+ GitSegmentConfig,
41
+ UsageSegmentConfig,
42
+ ContextSegmentConfig,
43
+ MetricsSegmentConfig,
44
+ BlockSegmentConfig,
45
+ TodaySegmentConfig,
46
+ VersionSegmentConfig,
47
+ SessionIdSegmentConfig,
48
+ EnvSegmentConfig,
49
+ WeeklySegmentConfig,
50
+ PowerlineSymbols,
51
+ SegmentData,
52
+ BarDisplayStyle,
53
+ } from "./segments/renderer";
54
+
55
+ export type {
56
+ TuiData,
57
+ BoxChars,
58
+ TuiGridConfig,
59
+ TuiGridBreakpoint,
60
+ TuiTitleConfig,
61
+ TuiFooterConfig,
62
+ SegmentTemplate,
63
+ SegmentName,
64
+ AlignValue,
65
+ LayoutMode,
66
+ SymbolSet,
67
+ RenderCtx,
68
+ JustifyValue,
69
+ GridCell,
70
+ } from "./tui/types";
71
+
72
+ // --- Rendering ---
73
+
74
+ export { SegmentRenderer } from "./segments/renderer";
75
+ export { renderTuiPanel } from "./tui/renderer";
76
+ export type { TuiPanelOptions } from "./tui/renderer";
77
+
78
+ // --- Themes ---
79
+
80
+ export { getTheme, BUILT_IN_THEMES } from "./themes";
81
+ export {
82
+ darkTheme,
83
+ darkAnsi256Theme,
84
+ darkAnsiTheme,
85
+ lightTheme,
86
+ lightAnsi256Theme,
87
+ lightAnsiTheme,
88
+ nordTheme,
89
+ nordAnsi256Theme,
90
+ nordAnsiTheme,
91
+ tokyoNightTheme,
92
+ tokyoNightAnsi256Theme,
93
+ tokyoNightAnsiTheme,
94
+ rosePineTheme,
95
+ rosePineAnsi256Theme,
96
+ rosePineAnsiTheme,
97
+ gruvboxTheme,
98
+ gruvboxAnsi256Theme,
99
+ gruvboxAnsiTheme,
100
+ } from "./themes";
101
+
102
+ // --- Constants ---
103
+
104
+ export {
105
+ SYMBOLS,
106
+ TEXT_SYMBOLS,
107
+ RESET_CODE,
108
+ BOX_CHARS,
109
+ BOX_CHARS_TEXT,
110
+ BOX_PRESETS,
111
+ } from "./utils/constants";
112
+
113
+ // --- Pure utilities ---
114
+
115
+ export {
116
+ hexToAnsi,
117
+ extractBgToFg,
118
+ hexTo256Ansi,
119
+ hexToBasicAnsi,
120
+ hexColorDistance,
121
+ } from "./utils/colors";
122
+ export { stripAnsi, visibleLength, ESC } from "./utils/terminal";
123
+ export {
124
+ formatCost,
125
+ formatTokens,
126
+ formatTokenBreakdown,
127
+ formatTimeSince,
128
+ formatDuration,
129
+ formatModelName,
130
+ abbreviateFishStyle,
131
+ formatResponseTime,
132
+ formatTokenCount,
133
+ formatBurnRate,
134
+ collapseHome,
135
+ formatTimeRemaining,
136
+ formatLongTimeRemaining,
137
+ minutesUntilReset,
138
+ } from "./utils/formatters";
139
+ export { getBudgetStatus } from "./utils/budget";
140
+
141
+ // --- TUI components ---
142
+
143
+ export {
144
+ contentRow,
145
+ bottomBorder,
146
+ divider,
147
+ spreadEven,
148
+ spreadTwo,
149
+ colorize,
150
+ truncateAnsi,
151
+ padRight,
152
+ padLeft,
153
+ padCenter,
154
+ } from "./tui/primitives";
155
+ export {
156
+ buildTitleBar,
157
+ buildContextLine,
158
+ buildContextBar,
159
+ buildBlockBar,
160
+ buildWeeklyBar,
161
+ resolveSegments,
162
+ composeTemplate,
163
+ resolveTitleToken,
164
+ collectMetricSegments,
165
+ collectActivityParts,
166
+ collectWorkspaceParts,
167
+ collectFooterParts,
168
+ } from "./tui/sections";
169
+ export {
170
+ renderWideMetrics,
171
+ renderWideBottom,
172
+ renderMediumMetrics,
173
+ renderMediumBottom,
174
+ renderNarrowMetrics,
175
+ renderNarrowBottom,
176
+ } from "./tui/layouts";
177
+
178
+ // --- TUI grid helpers ---
179
+
180
+ export {
181
+ parseAreas,
182
+ cullMatrix,
183
+ calculateColumnWidths,
184
+ selectBreakpoint,
185
+ solveFitContentLayout,
186
+ renderGrid,
187
+ DIVIDER,
188
+ EMPTY_CELL,
189
+ LATE_RESOLVE_SEGMENTS,
190
+ } from "./tui/grid";
191
+ export type { GridResult } from "./tui/grid";
192
+
193
+ // --- Config defaults ---
194
+
195
+ export { DEFAULT_CONFIG } from "./config/defaults";
196
+
197
+ // --- Segment ref validation ---
198
+
199
+ export {
200
+ isValidSegmentRef,
201
+ VALID_SEGMENT_NAMES,
202
+ SEGMENT_PARTS,
203
+ } from "./tui/types";
@@ -0,0 +1,79 @@
1
+ import type { PowerlineConfig } from "./loader";
2
+
3
+ export const DEFAULT_CONFIG: PowerlineConfig = {
4
+ theme: "dark",
5
+ display: {
6
+ style: "minimal",
7
+ charset: "unicode",
8
+ colorCompatibility: "auto",
9
+ autoWrap: true,
10
+ padding: 1,
11
+ lines: [
12
+ {
13
+ segments: {
14
+ directory: {
15
+ enabled: true,
16
+ style: "basename",
17
+ },
18
+ git: {
19
+ enabled: true,
20
+ showSha: false,
21
+ showWorkingTree: false,
22
+ showOperation: false,
23
+ showTag: false,
24
+ showTimeSinceCommit: false,
25
+ showStashCount: false,
26
+ showUpstream: false,
27
+ showRepoName: false,
28
+ },
29
+ model: { enabled: true },
30
+ session: { enabled: true, type: "tokens", costSource: "calculated" },
31
+ today: { enabled: true, type: "cost" },
32
+ block: {
33
+ enabled: false,
34
+ type: "cost",
35
+ burnType: "cost",
36
+ displayStyle: "text",
37
+ },
38
+ weekly: { enabled: false, displayStyle: "text" },
39
+ version: { enabled: false },
40
+ tmux: { enabled: false },
41
+ sessionId: { enabled: false, showIdLabel: true },
42
+ context: {
43
+ enabled: true,
44
+ showPercentageOnly: false,
45
+ displayStyle: "text",
46
+ autocompactBuffer: 33000,
47
+ },
48
+ metrics: {
49
+ enabled: false,
50
+ showResponseTime: true,
51
+ showLastResponseTime: true,
52
+ showDuration: true,
53
+ showMessageCount: true,
54
+ showLinesAdded: true,
55
+ showLinesRemoved: true,
56
+ },
57
+ },
58
+ },
59
+ ],
60
+ },
61
+ budget: {
62
+ session: {
63
+ warningThreshold: 80,
64
+ },
65
+ today: {
66
+ warningThreshold: 80,
67
+ amount: 50,
68
+ },
69
+ block: {
70
+ warningThreshold: 80,
71
+ amount: 15,
72
+ },
73
+ },
74
+ modelContextLimits: {
75
+ default: 200000,
76
+ sonnet: 200000,
77
+ opus: 200000,
78
+ },
79
+ };