Release v0.8.0

This commit is contained in:
Mario Zechner
2025-11-21 03:12:42 +01:00
parent cc88095140
commit 85adcf22bf
48 changed files with 1530 additions and 608 deletions
@@ -1,15 +1,7 @@
import { type Component, Container, Input, Spacer, Text } from "@mariozechner/pi-tui";
import chalk from "chalk";
import type { SessionManager } from "../session-manager.js";
/**
* Dynamic border component that adjusts to viewport width
*/
class DynamicBorder implements Component {
render(width: number): string[] {
return [chalk.blue("─".repeat(Math.max(1, width)))];
}
}
import { theme } from "../theme/theme.js";
import { DynamicBorder } from "./dynamic-border.js";
interface SessionItem {
path: string;
@@ -67,6 +59,10 @@ class SessionList implements Component {
this.selectedIndex = Math.min(this.selectedIndex, Math.max(0, this.filteredSessions.length - 1));
}
invalidate(): void {
// No cached state to invalidate currently
}
render(width: number): string[] {
const lines: string[] = [];
@@ -75,7 +71,7 @@ class SessionList implements Component {
lines.push(""); // Blank line after search
if (this.filteredSessions.length === 0) {
lines.push(chalk.gray(" No sessions found"));
lines.push(theme.fg("muted", " No sessions found"));
return lines;
}
@@ -112,16 +108,16 @@ class SessionList implements Component {
const normalizedMessage = session.firstMessage.replace(/\n/g, " ").trim();
// First line: cursor + message
const cursor = isSelected ? chalk.blue(" ") : " ";
const cursor = isSelected ? theme.fg("accent", " ") : " ";
const maxMsgWidth = width - 2; // Account for cursor
const truncatedMsg = normalizedMessage.substring(0, maxMsgWidth);
const messageLine = cursor + (isSelected ? chalk.bold(truncatedMsg) : truncatedMsg);
const messageLine = cursor + (isSelected ? theme.bold(truncatedMsg) : truncatedMsg);
// Second line: metadata (dimmed)
const modified = formatDate(session.modified);
const msgCount = `${session.messageCount} message${session.messageCount !== 1 ? "s" : ""}`;
const metadata = ` ${modified} · ${msgCount}`;
const metadataLine = chalk.dim(metadata);
const metadataLine = theme.fg("dim", metadata);
lines.push(messageLine);
lines.push(metadataLine);
@@ -130,7 +126,7 @@ class SessionList implements Component {
// Add scroll indicator if needed
if (startIndex > 0 || endIndex < this.filteredSessions.length) {
const scrollInfo = chalk.gray(` (${this.selectedIndex + 1}/${this.filteredSessions.length})`);
const scrollInfo = theme.fg("muted", ` (${this.selectedIndex + 1}/${this.filteredSessions.length})`);
lines.push(scrollInfo);
}
@@ -185,7 +181,7 @@ export class SessionSelectorComponent extends Container {
// Add header
this.addChild(new Spacer(1));
this.addChild(new Text(chalk.bold("Resume Session"), 1, 0));
this.addChild(new Text(theme.bold("Resume Session"), 1, 0));
this.addChild(new Spacer(1));
this.addChild(new DynamicBorder());
this.addChild(new Spacer(1));