fix(sf-tui): remove welcome overlay that hangs on enter
The per-session branded welcome overlay was added by the SF rebrand
(9d739dfa5) as a boxed 'Press any key to continue...' splash shown once
per sf session. In practice: Enter doesn't dismiss it and typing renders
as garbled characters behind the overlay, blocking every TUI launch.
Branding was redundant with the header (installed at session_start) and
the footer (git branch + model). Shortcuts are discoverable via help.
Deleting the overlay eliminates the hang vector entirely.
Legacy-extension migration warnings (migrations.ts 'Press any key...')
are unaffected — those are vendored upstream Pi code on a different
code path and only fire when deprecated extensions are present.
This commit is contained in:
parent
6446381730
commit
e6676692fc
2 changed files with 0 additions and 133 deletions
|
|
@ -4,7 +4,6 @@
|
|||
* Features:
|
||||
* - Powerline footer: git branch, diff stats, last commit, model, cost, context
|
||||
* - Header: project name + branch + model
|
||||
* - Welcome overlay on session start
|
||||
* - Prompt history stash: Ctrl+Alt+H overlay
|
||||
*/
|
||||
|
||||
|
|
@ -15,13 +14,10 @@ import { openStashOverlay, readStash, pushStash, writeStash } from "./stash.js";
|
|||
import { openMarketplaceOverlay } from "./marketplace.js";
|
||||
import { renderFooter } from "./footer.js";
|
||||
import { renderHeader } from "./header.js";
|
||||
import { showWelcomeOverlay } from "./welcome.js";
|
||||
import { invalidateGitStatus } from "./git.js";
|
||||
import { registerSessionEmoji } from "./emoji.js";
|
||||
import { registerSessionColor } from "./color-band.js";
|
||||
|
||||
let hasShownWelcome = false;
|
||||
|
||||
function installHeader(ctx: ExtensionContext): void {
|
||||
if (!ctx.hasUI) return;
|
||||
ctx.ui.setHeader((_tui, theme) => {
|
||||
|
|
@ -76,11 +72,6 @@ export default function sfTui(pi: ExtensionAPI): void {
|
|||
handler: openMarketplaceOverlay,
|
||||
});
|
||||
|
||||
if (!hasShownWelcome) {
|
||||
hasShownWelcome = true;
|
||||
await showWelcomeOverlay(ctx);
|
||||
}
|
||||
|
||||
wasAutoActive = isAutoActive();
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -1,124 +0,0 @@
|
|||
import type { ExtensionContext, Theme } from "@singularity-forge/pi-coding-agent";
|
||||
import { visibleWidth, truncateToWidth, matchesKey, Key } from "@singularity-forge/pi-tui";
|
||||
import { refreshGitStatus } from "./git.js";
|
||||
|
||||
const LOGO_LINES = [
|
||||
" ╭────╮ ╭────╮ ",
|
||||
" │ │ │ ",
|
||||
" ╰────┤ ╰────╮ ",
|
||||
" │ │ ",
|
||||
" ╰────╯ ╰────╯ ",
|
||||
];
|
||||
|
||||
function padCenter(text: string, width: number): string {
|
||||
const vis = visibleWidth(text);
|
||||
const pad = Math.max(0, Math.floor((width - vis) / 2));
|
||||
return " ".repeat(pad) + text;
|
||||
}
|
||||
|
||||
class WelcomeOverlay {
|
||||
private tui: { requestRender: () => void };
|
||||
private theme: Theme;
|
||||
private onClose: () => void;
|
||||
|
||||
constructor(
|
||||
tui: { requestRender: () => void },
|
||||
theme: Theme,
|
||||
onClose: () => void,
|
||||
) {
|
||||
this.tui = tui;
|
||||
this.theme = theme;
|
||||
this.onClose = onClose;
|
||||
}
|
||||
|
||||
handleInput(data: string): void {
|
||||
if (
|
||||
matchesKey(data, Key.escape) ||
|
||||
matchesKey(data, Key.return) ||
|
||||
matchesKey(data, Key.enter) ||
|
||||
matchesKey(data, Key.space) ||
|
||||
data === "q"
|
||||
) {
|
||||
this.onClose();
|
||||
}
|
||||
}
|
||||
|
||||
render(width: number): string[] {
|
||||
const th = this.theme;
|
||||
const boxW = Math.min(70, width - 4);
|
||||
const innerW = boxW - 4;
|
||||
|
||||
const pad = (s: string) => s + " ".repeat(Math.max(0, width - visibleWidth(s)));
|
||||
const box = (s: string) => {
|
||||
const len = visibleWidth(s);
|
||||
return th.fg("dim", "│ ") + s + " ".repeat(Math.max(0, boxW - 2 - len)) + th.fg("dim", " │");
|
||||
};
|
||||
|
||||
const lines: string[] = [];
|
||||
lines.push(pad(th.fg("dim", "╭" + "─".repeat(boxW) + "╮")));
|
||||
|
||||
for (const logoLine of LOGO_LINES) {
|
||||
lines.push(pad(box(padCenter(th.fg("accent", logoLine), innerW))));
|
||||
}
|
||||
|
||||
const title = th.bold(th.fg("accent", "Singularity Forge"));
|
||||
lines.push(pad(box(padCenter(title, innerW))));
|
||||
lines.push(pad(box("")));
|
||||
|
||||
const version = `v${process.env.SF_VERSION || "0.0.0"}`;
|
||||
lines.push(pad(box(padCenter(th.fg("dim", version), innerW))));
|
||||
lines.push(pad(box("")));
|
||||
|
||||
const git = refreshGitStatus(process.cwd());
|
||||
if (git.branch) {
|
||||
const dirty = git.dirty ? th.fg("error", "✗") : th.fg("success", "✓");
|
||||
lines.push(pad(box(padCenter(`${th.fg("dim", "Git:")} ${th.fg("accent", git.branch)} ${dirty}`, innerW))));
|
||||
if (git.lastCommit) {
|
||||
const msg = truncateToWidth(git.lastCommit.message, innerW - 14);
|
||||
lines.push(pad(box(padCenter(`${th.fg("dim", "Last commit:")} ${th.fg("dim", msg)}`, innerW))));
|
||||
}
|
||||
lines.push(pad(box("")));
|
||||
}
|
||||
|
||||
const shortcuts = [
|
||||
`${th.fg("dim", "Ctrl+Alt+H")} prompt history`,
|
||||
`${th.fg("dim", "Ctrl+Alt+G")} dashboard`,
|
||||
`${th.fg("dim", "Ctrl+Alt+N")} notifications`,
|
||||
];
|
||||
for (const sc of shortcuts) {
|
||||
lines.push(pad(box(padCenter(sc, innerW))));
|
||||
}
|
||||
lines.push(pad(box("")));
|
||||
|
||||
lines.push(pad(box(padCenter(th.fg("dim", "Press any key to continue..."), innerW))));
|
||||
lines.push(pad(th.fg("dim", "╰" + "─".repeat(boxW) + "╯")));
|
||||
lines.push("");
|
||||
|
||||
return lines;
|
||||
}
|
||||
}
|
||||
|
||||
export async function showWelcomeOverlay(ctx: ExtensionContext): Promise<void> {
|
||||
if (!ctx.hasUI) return;
|
||||
|
||||
await ctx.ui.custom<boolean>(
|
||||
(tui, theme, _kb, done) => {
|
||||
const overlay = new WelcomeOverlay(tui, theme, () => done(true));
|
||||
return {
|
||||
render: (w) => overlay.render(w),
|
||||
invalidate: () => {},
|
||||
handleInput: (d) => overlay.handleInput(d),
|
||||
};
|
||||
},
|
||||
{
|
||||
overlay: true,
|
||||
overlayOptions: {
|
||||
width: "90%",
|
||||
minWidth: 50,
|
||||
maxHeight: "90%",
|
||||
anchor: "center",
|
||||
backdrop: true,
|
||||
},
|
||||
},
|
||||
);
|
||||
}
|
||||
Loading…
Add table
Reference in a new issue