pi-jar 0.1.9 → 0.2.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/src/welcome.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { sliceByColumn, stripTerminalSequences, truncateToWidth, visibleWidth } from "@earendil-works/pi-tui";
1
+ import { sliceByColumn, stripTerminalSequences, truncateToWidth, visibleWidth, wrapTextWithAnsi } from "@earendil-works/pi-tui";
2
2
  import { FLAME_RAMP, FLAME_WIDTH, flameFrame, rgb, supportsTruecolor } from "./flame.ts";
3
3
  import { cleanText } from "./status.ts";
4
4
  import { iconSet, withIcon } from "./icons.ts";
@@ -10,6 +10,8 @@ export interface WelcomeInfo {
10
10
  model?: string;
11
11
  effort?: string;
12
12
  activeRole?: string;
13
+ /** Active configuration profile, shown even before a session is named. */
14
+ profile?: string;
13
15
  project?: string;
14
16
  context?: string;
15
17
  cost?: string;
@@ -189,6 +191,8 @@ function card(width: number, fg: Paint, info: WelcomeInfo): string[] {
189
191
  cell(center(fg("dim", "— welcome to ") + fg("accent", "pi-jar") + fg("dim", " —"), inner)),
190
192
  cell(""),
191
193
  divider,
194
+ ...wrapTextWithAnsi(cleanText(info.profile ?? "Default", 32) || "Default", Math.max(1, inner - labelWidth))
195
+ .map((line, index) => cell(index ? fg("dim", " ".repeat(labelWidth)) + fg("accent", line) : label("PROFILE", line, "accent"))),
192
196
  cell(label("PROJECT", withIcon("folder", info.project || "unavailable") + " · " + git, info.dirty ? "warning" : "muted")),
193
197
  cell(label("SESSION", [info.context ?? "ctx ?", quota, info.cost ?? ""].filter(Boolean).join(" · "))),
194
198
  divider,
@@ -262,6 +266,7 @@ function renderWelcome(width: number, frame: number, fg: Paint, info: WelcomeInf
262
266
  ...flame.slice(4).map((line) => fit(sliceByColumn(line, start, Math.min(width, FLAME_WIDTH)))),
263
267
  ...PI_COMPACT.map((line) => fit(fg("accent", line))),
264
268
  fit(fg("accent", "pi-jar")),
269
+ fit(fg("accent", "Profile: " + (cleanText(info.profile ?? "Default", 32) || "Default"))),
265
270
  ...wrap(cleanText(info.message ?? HOPEFUL_WELCOME_MESSAGES[0], 100), width).map((line) => fit("\x1b[1m" + fg("warning", line) + "\x1b[22m")),
266
271
  fit(fg(info.settingsClickable === false ? "dim" : "accent", info.settingsClickable === false ? "ctrl+alt+s settings" : "[ ⚙ Settings ]")),
267
272
  ""