@pi-unipi/footer 0.1.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.
- package/README.md +206 -0
- package/index.ts +6 -0
- package/package.json +52 -0
- package/src/commands.ts +204 -0
- package/src/config.ts +177 -0
- package/src/events.ts +256 -0
- package/src/index.ts +208 -0
- package/src/presets.ts +131 -0
- package/src/registry/index.ts +162 -0
- package/src/rendering/icons.ts +318 -0
- package/src/rendering/renderer.ts +310 -0
- package/src/rendering/separators.ts +112 -0
- package/src/rendering/theme.ts +98 -0
- package/src/segments/compactor.ts +135 -0
- package/src/segments/core.ts +283 -0
- package/src/segments/kanboard.ts +75 -0
- package/src/segments/mcp.ts +100 -0
- package/src/segments/memory.ts +140 -0
- package/src/segments/notify.ts +50 -0
- package/src/segments/ralph.ts +109 -0
- package/src/segments/status-ext.ts +119 -0
- package/src/segments/workflow.ts +100 -0
- package/src/tui/settings-tui.ts +252 -0
- package/src/types.ts +183 -0
package/src/types.ts
ADDED
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @pi-unipi/footer — Type definitions
|
|
3
|
+
*
|
|
4
|
+
* All TypeScript types for the footer package: segments, groups, config,
|
|
5
|
+
* presets, separators, theme.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import type { Theme, ThemeColor } from "@mariozechner/pi-coding-agent";
|
|
9
|
+
|
|
10
|
+
// ─── Semantic Colors ────────────────────────────────────────────────────────
|
|
11
|
+
|
|
12
|
+
/** Semantic color names mapped to segment groups */
|
|
13
|
+
export type SemanticColor =
|
|
14
|
+
| "model"
|
|
15
|
+
| "path"
|
|
16
|
+
| "git"
|
|
17
|
+
| "compactor"
|
|
18
|
+
| "memory"
|
|
19
|
+
| "mcp"
|
|
20
|
+
| "ralph"
|
|
21
|
+
| "ralphOn"
|
|
22
|
+
| "ralphOff"
|
|
23
|
+
| "workflow"
|
|
24
|
+
| "workflowBrainstorm"
|
|
25
|
+
| "workflowPlan"
|
|
26
|
+
| "workflowWork"
|
|
27
|
+
| "workflowReview"
|
|
28
|
+
| "workflowAuto"
|
|
29
|
+
| "workflowOther"
|
|
30
|
+
| "kanboard"
|
|
31
|
+
| "notify"
|
|
32
|
+
| "separator"
|
|
33
|
+
| "border"
|
|
34
|
+
| "context"
|
|
35
|
+
| "contextWarn"
|
|
36
|
+
| "contextError"
|
|
37
|
+
| "cost"
|
|
38
|
+
| "tokens"
|
|
39
|
+
| "thinking"
|
|
40
|
+
| "thinkingMinimal"
|
|
41
|
+
| "thinkingLow"
|
|
42
|
+
| "thinkingMedium"
|
|
43
|
+
| "thinkingHigh"
|
|
44
|
+
| "thinkingXhigh";
|
|
45
|
+
|
|
46
|
+
/** A theme color name or custom hex color */
|
|
47
|
+
export type ColorValue = ThemeColor | `#${string}`;
|
|
48
|
+
|
|
49
|
+
/** Theme-like interface for rendering */
|
|
50
|
+
export type ThemeLike = Pick<Theme, "fg">;
|
|
51
|
+
|
|
52
|
+
/** Mapping of semantic color names to actual colors */
|
|
53
|
+
export type ColorScheme = Partial<Record<SemanticColor, ColorValue>>;
|
|
54
|
+
|
|
55
|
+
// ─── Separators ─────────────────────────────────────────────────────────────
|
|
56
|
+
|
|
57
|
+
/** Icon style — determines which icon set is used for segments */
|
|
58
|
+
export type IconStyle = "nerd" | "emoji" | "text";
|
|
59
|
+
|
|
60
|
+
/** Separator styles for segment dividers */
|
|
61
|
+
export type SeparatorStyle =
|
|
62
|
+
| "powerline"
|
|
63
|
+
| "powerline-thin"
|
|
64
|
+
| "slash"
|
|
65
|
+
| "pipe"
|
|
66
|
+
| "dot"
|
|
67
|
+
| "ascii";
|
|
68
|
+
|
|
69
|
+
/** Separator definition with left/right glyph strings */
|
|
70
|
+
export interface SeparatorDef {
|
|
71
|
+
left: string;
|
|
72
|
+
right: string;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
// ─── Segments ───────────────────────────────────────────────────────────────
|
|
76
|
+
|
|
77
|
+
/** Rendered segment output */
|
|
78
|
+
export interface RenderedSegment {
|
|
79
|
+
/** The rendered content string (may include ANSI codes) */
|
|
80
|
+
content: string;
|
|
81
|
+
/** Whether this segment is visible */
|
|
82
|
+
visible: boolean;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/** Context passed to segment render functions */
|
|
86
|
+
export interface FooterSegmentContext {
|
|
87
|
+
/** Pi theme for coloring */
|
|
88
|
+
theme: ThemeLike;
|
|
89
|
+
/** Resolved color scheme */
|
|
90
|
+
colors: ColorScheme;
|
|
91
|
+
/** Data from the registry for this segment's group */
|
|
92
|
+
data: unknown;
|
|
93
|
+
/** Available width for this segment */
|
|
94
|
+
width: number;
|
|
95
|
+
/** Per-segment options from preset */
|
|
96
|
+
options?: Record<string, unknown>;
|
|
97
|
+
/** Full pi context (for core segments that need ctx.sessionManager, etc.) */
|
|
98
|
+
piContext?: unknown;
|
|
99
|
+
/** Footer data provider (for core segments that need git, extension statuses) */
|
|
100
|
+
footerData?: unknown;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/** Segment render function type */
|
|
104
|
+
export type SegmentRenderFn = (ctx: FooterSegmentContext) => RenderedSegment;
|
|
105
|
+
|
|
106
|
+
/** A single footer segment definition */
|
|
107
|
+
export interface FooterSegment {
|
|
108
|
+
/** Unique segment identifier (e.g., "model", "compactions") */
|
|
109
|
+
id: string;
|
|
110
|
+
/** Display label */
|
|
111
|
+
label: string;
|
|
112
|
+
/** Icon glyph (Nerd Font or ASCII) */
|
|
113
|
+
icon: string;
|
|
114
|
+
/** Render function */
|
|
115
|
+
render: SegmentRenderFn;
|
|
116
|
+
/** Whether this segment is shown by default */
|
|
117
|
+
defaultShow: boolean;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
// ─── Groups ─────────────────────────────────────────────────────────────────
|
|
121
|
+
|
|
122
|
+
/** A group of related segments (typically one per package) */
|
|
123
|
+
export interface FooterGroup {
|
|
124
|
+
/** Unique group identifier (e.g., "core", "compactor") */
|
|
125
|
+
id: string;
|
|
126
|
+
/** Display name */
|
|
127
|
+
name: string;
|
|
128
|
+
/** Group icon */
|
|
129
|
+
icon: string;
|
|
130
|
+
/** Segments within this group */
|
|
131
|
+
segments: FooterSegment[];
|
|
132
|
+
/** Whether this group is shown by default */
|
|
133
|
+
defaultShow: boolean;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
// ─── Settings ───────────────────────────────────────────────────────────────
|
|
137
|
+
|
|
138
|
+
/** Per-group settings */
|
|
139
|
+
export interface FooterGroupSettings {
|
|
140
|
+
/** Whether this group is visible */
|
|
141
|
+
show: boolean;
|
|
142
|
+
/** Per-segment visibility overrides */
|
|
143
|
+
segments?: Record<string, boolean>;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
/** Footer settings stored in settings.json */
|
|
147
|
+
export interface FooterSettings {
|
|
148
|
+
/** Whether the footer is enabled */
|
|
149
|
+
enabled: boolean;
|
|
150
|
+
/** Active preset name */
|
|
151
|
+
preset: string;
|
|
152
|
+
/** Separator style */
|
|
153
|
+
separator: SeparatorStyle;
|
|
154
|
+
/** Icon style: nerd (Nerd Font glyphs), emoji (Unicode emoji), text (plain labels) */
|
|
155
|
+
iconStyle: IconStyle;
|
|
156
|
+
/** Per-group settings */
|
|
157
|
+
groups: Record<string, FooterGroupSettings>;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
/** Full footer config (settings + runtime state) */
|
|
161
|
+
export interface FooterConfig {
|
|
162
|
+
settings: FooterSettings;
|
|
163
|
+
/** Runtime: whether footer is currently active */
|
|
164
|
+
active: boolean;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
// ─── Presets ────────────────────────────────────────────────────────────────
|
|
168
|
+
|
|
169
|
+
/** Preset definition */
|
|
170
|
+
export interface PresetDef {
|
|
171
|
+
/** Segments on the left side of the status bar */
|
|
172
|
+
leftSegments: string[];
|
|
173
|
+
/** Segments on the right side of the status bar */
|
|
174
|
+
rightSegments: string[];
|
|
175
|
+
/** Secondary row segments (shown when terminal is narrow) */
|
|
176
|
+
secondarySegments: string[];
|
|
177
|
+
/** Separator style for this preset */
|
|
178
|
+
separator: SeparatorStyle;
|
|
179
|
+
/** Color scheme for this preset */
|
|
180
|
+
colors?: ColorScheme;
|
|
181
|
+
/** Per-segment options */
|
|
182
|
+
segmentOptions?: Record<string, Record<string, unknown>>;
|
|
183
|
+
}
|