Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions hooks/ponytail-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,15 @@ function getDefaultMode() {
return DEFAULT_MODE;
}

function getHideStatus() {
if (process.env.PONYTAIL_HIDE_STATUS) return true;
try {
const configPath = getConfigPath();
const config = JSON.parse(fs.readFileSync(configPath, 'utf8').replace(/^\uFEFF/, ''));
return config.hideStatus === true;
} catch (_) { return false; }
}

function writeDefaultMode(mode) {
const normalized = normalizeConfigMode(mode);
if (!normalized) return null;
Expand All @@ -114,6 +123,7 @@ module.exports = {
getConfigDir,
getConfigPath,
getClaudeDir,
getHideStatus,
isShellSafe,
normalizeMode,
normalizeConfigMode,
Expand Down
3 changes: 3 additions & 0 deletions pi-extension/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ const require = createRequire(import.meta.url);
const {
DEFAULT_MODE,
getDefaultMode,
getHideStatus,
normalizeMode,
normalizeConfigMode,
normalizePersistedMode,
Expand Down Expand Up @@ -64,6 +65,8 @@ export default function ponytailExtension(pi) {
if (ctx) lastCtx = ctx;
const c = ctx || lastCtx;
if (!c?.ui?.setStatus || !c.ui.theme?.fg) return;
// ponytail: hide status via PONYTAIL_HIDE_STATUS env or hideStatus config (#324).
if (getHideStatus()) return;
const theme = c.ui.theme;
if (currentMode === "off") {
c.ui.setStatus("ponytail", "");
Expand Down
19 changes: 19 additions & 0 deletions pi-extension/test/extension.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,25 @@ test("status bar renders the mode and flips active on agent_start", async () =>
assert.match(statusWrites.at(-1).text, /●.*ULTRA/);
}));

test("status bar hides when PONYTAIL_HIDE_STATUS is set (#324)", async () => withTempConfig(async () => {
process.env.PONYTAIL_HIDE_STATUS = "1";
try {
const { events } = createPiHarness();
const statusWrites = [];
const ctx = createCommandContext({
sessionManager: { getEntries: () => [{ type: "custom", customType: "ponytail-mode", data: { mode: "ultra" } }] },
ui: { notify() {}, setStatus: (key, text) => statusWrites.push({ key, text }), theme: { fg: (_color, text) => text } },
});

await events.get("session_start")({ reason: "resume" }, ctx);
await events.get("agent_start")({}, ctx);

assert.deepEqual(statusWrites, [], "status should not be written when hidden");
} finally {
delete process.env.PONYTAIL_HIDE_STATUS;
}
}));

test("status bar stays silent when ui lacks a theme", async () => withTempConfig(async () => {
const { events } = createPiHarness();
const calls = [];
Expand Down