Compare commits

..
Author SHA1 Message Date
Emeriko 9a27039e32 fix: use --tags (not --tag) for clawhub skill publish 2026-06-23 23:04:34 +02:00
14 changed files with 13 additions and 354 deletions
-24
View File
@@ -1,24 +0,0 @@
name: publish
on:
push:
tags: ['v*']
workflow_dispatch:
permissions:
id-token: write
contents: read
jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '22'
# Trusted publishing (OIDC) needs npm >= 11.5.1; Node 22 ships npm 10.
- run: npm install -g npm@latest
# No token: id-token: write above lets npm authenticate via OIDC, and
# provenance is attached automatically. access set in publishConfig.
- run: npm publish
+4 -25
View File
@@ -1,13 +1,11 @@
// ponytail — OpenCode plugin.
//
// Injects the ponytail ruleset into every chat's system prompt at the active
// intensity, persists /ponytail mode switches, and registers slash commands so
// they work when the package is installed from npm. Reuses the shared
// instruction builder so Claude Code, Codex, pi, and OpenCode all read one
// source of truth.
// intensity, and persists /ponytail mode switches. Reuses the shared instruction
// builder so Claude Code, Codex, pi, and OpenCode all read one source of truth.
//
// OpenCode loads this as a server plugin — add it to your opencode.json:
// { "plugin": ["@dietrichgebert/ponytail"] }
// { "plugin": ["./.opencode/plugins/ponytail.mjs"] }
import { createRequire } from 'module';
import fs from 'fs';
@@ -42,15 +40,6 @@ function writeMode(mode) {
fs.writeFileSync(statePath, mode);
}
export function parseCommandFile(filePath) {
const content = fs.readFileSync(filePath, 'utf8');
// Tolerate CRLF: a Windows checkout (autocrlf) delivers \r\n, npm ships \n.
const match = content.match(/^---\r?\n([\s\S]*?)\r?\n---\r?\n([\s\S]*)$/);
if (!match) return null;
const description = match[1].match(/description:\s*(.+)/)?.[1]?.trim();
return { description, template: match[2].trim() };
}
export default async ({ client } = {}) => {
const log = (level, message) => {
try { client && client.app && client.app.log({ body: { service: 'ponytail', level, message } }); } catch (e) {}
@@ -59,18 +48,8 @@ export default async ({ client } = {}) => {
const ponytailSkillsDir = path.resolve(__dirname, '../../skills');
return {
// Register slash commands + skills directory.
// Register skills directory so opencode discovers ponytail skills.
config: async (config) => {
if (!config.command) config.command = {};
const commandDir = path.join(__dirname, '..', 'command');
try {
for (const file of fs.readdirSync(commandDir).filter((f) => f.endsWith('.md'))) {
const name = path.basename(file, '.md');
const parsed = parseCommandFile(path.join(commandDir, file));
if (parsed) config.command[name] = parsed;
}
} catch (e) {}
config.skills = config.skills || {};
config.skills.paths = config.skills.paths || [];
if (!config.skills.paths.includes(ponytailSkillsDir)) {
+3 -37
View File
@@ -105,11 +105,8 @@ The Claude Code and Codex plugins run two tiny Node.js lifecycle hooks, so `node
```
/plugin marketplace add DietrichGebert/ponytail
```
```
/plugin install ponytail@ponytail
```
(You have to send two separate prompts for the install to work)
The desktop app has no `/plugin` command. Install it from the UI instead: Customize, the + by personal plugins, Create plugin and add marketplace, Add from repository, then enter the repo URL (thanks @NiklasDHahn, #98).
@@ -154,13 +151,7 @@ pi install git:github.com/DietrichGebert/ponytail
### OpenCode
Add to `opencode.json`:
```json
{ "plugin": ["@dietrichgebert/ponytail"] }
```
Run from a checkout instead (the plugin reuses `hooks/` and `skills/`):
Run OpenCode from a checkout of this repo (the plugin reuses its `hooks/` and `skills/`), and add to `opencode.json`:
```json
{ "plugin": ["./.opencode/plugins/ponytail.mjs"] }
@@ -195,20 +186,6 @@ It reuses this repo's `gemini-extension.json`. One difference: Antigravity conve
Reads `AGENTS.md` from the project root, zero setup. Copy [`AGENTS.md`](AGENTS.md) to your project, or run `codewhale` from a checkout of this repo. That's it.
### Swival
Stage the collection in your library first, then add the skills you want:
```bash
swival skills add --global https://github.com/DietrichGebert/ponytail # stage into ~/.config/swival/library
swival skills add ponytail # install the collection into this project
swival skills add --global ponytail # or activate it in every project
```
Swival also reads `AGENTS.md` from the project root and `~/.config/swival/AGENTS.md` globally, the instruction-only fallback.
On the command line, use a `$` prefix to explicitly activate a skill. For example: `$ponytail-review`.
### OpenClaw
```bash
@@ -223,7 +200,7 @@ Active every session, with a handful of commands (see [Commands](#commands)). `/
Set the level for every new session with the `PONYTAIL_DEFAULT_MODE` env var (`lite`/`full`/`ultra`/`off`), or a `defaultMode` field in `~/.config/ponytail/config.json` (`%APPDATA%\ponytail\config.json` on Windows). The default is `full`.
Cursor, Windsurf, Cline, GitHub Copilot (editor), Aider, Kiro, Zed, CodeWhale, Swival: copy the matching rules file from this repo ([`.cursor/rules/`](.cursor/rules/), [`.windsurf/rules/`](.windsurf/rules/), [`.clinerules/`](.clinerules/), [`.github/copilot-instructions.md`](.github/copilot-instructions.md), [`AGENTS.md`](AGENTS.md), [`.kiro/steering/`](.kiro/steering/)).
Cursor, Windsurf, Cline, GitHub Copilot (editor), Aider, Kiro, Zed, CodeWhale: copy the matching rules file from this repo ([`.cursor/rules/`](.cursor/rules/), [`.windsurf/rules/`](.windsurf/rules/), [`.clinerules/`](.clinerules/), [`.github/copilot-instructions.md`](.github/copilot-instructions.md), [`AGENTS.md`](AGENTS.md), [`.kiro/steering/`](.kiro/steering/)).
Kiro: copy `.kiro/steering/ponytail.md` to `~/.kiro/steering/` (global) or `.kiro/steering/` in your project.
@@ -233,17 +210,6 @@ VS Code with the Codex extension reads `AGENTS.md`, which this repo ships, so it
Which files map to which agent: [Agent portability](docs/agent-portability.md).
### Uninstall
| Host | Command |
|------|---------|
| Claude Code | `/plugin remove ponytail` |
| Codex | `codex plugin remove ponytail` |
| Pi agent | `pi uninstall ponytail` |
| Cursor / Windsurf / Cline / etc. | Delete the copied rule file |
These remove the plugin's own files. They leave behind a small amount of state ponytail writes outside the plugin folder: the mode flag, `~/.config/ponytail/config.json`, and (if you accepted the setup nudge) a `statusLine` entry in `~/.claude/settings.json`. Run `node scripts/uninstall.js` to clean those up too. **Run it before the host remove command above** — the script is itself a plugin file, so removing the plugin first deletes it (or run it from a separate clone of this repo). It only removes the statusLine entry if it points at ponytail's own script, so a statusline you set up yourself is left untouched.
## Commands
| Command | What it does |
@@ -255,7 +221,7 @@ These remove the plugin's own files. They leave behind a small amount of state p
| `/ponytail-gain` | Show the measured impact scoreboard (less code, less cost, more speed) from the benchmark. |
| `/ponytail-help` | Quick reference for the commands above. |
Commands need a skill-capable host (Claude Code, Codex, OpenCode, Gemini, pi, Swival). In Codex they're skills, invoke with `@` (`@ponytail-review`). The instruction-only adapters (Cursor, Windsurf, Cline, Copilot, Kiro, Antigravity) load the always-on ruleset without the commands.
Commands need a skill-capable host (Claude Code, Codex, OpenCode, Gemini, pi). In Codex they're skills, invoke with `@` (`@ponytail-review`). The instruction-only adapters (Cursor, Windsurf, Cline, Copilot, Kiro, Antigravity) load the always-on ruleset without the commands.
## Development
-6
View File
@@ -15,7 +15,6 @@ import json
import re
import time
import urllib.request
import urllib.parse
from pathlib import Path
ROOT = Path(__file__).parent.parent
@@ -150,11 +149,6 @@ def main():
parser.add_argument("--repeat", type=int, default=1, help="Runs per cell; median reported (default: 1)")
parser.add_argument("--ollama-url", default="http://localhost:11434", help="Ollama base URL")
args = parser.parse_args()
parsed_url = urllib.parse.urlparse(args.ollama_url)
if parsed_url.scheme not in ("http", "https"):
parser.error(f"Invalid --ollama-url scheme: '{parsed_url.scheme}'. Only 'http' and 'https' are supported.")
run(args.model, args.repeat, args.ollama_url)
-1
View File
@@ -20,7 +20,6 @@ to load in a given agent.
| GitHub Copilot CLI | `.github/plugin/`, `AGENTS.md`, `.github/copilot-instructions.md`, `~/.copilot/copilot-instructions.md` | Plugin-supported (`copilot plugin marketplace add DietrichGebert/ponytail` + `copilot plugin install ponytail@ponytail`). Fallback instruction mode remains: per-project from `AGENTS.md` or `.github/copilot-instructions.md`, or globally from `~/.copilot/copilot-instructions.md` (instruction-tier, no `/ponytail` levels or hooks). |
| Antigravity | `AGENTS.md` | Reads `AGENTS.md` at the repo root as always-on rules (like `.cursorrules`/`CLAUDE.md`); `.agents/rules/` also works for workspace rules. Instruction-tier. |
| CodeWhale | `AGENTS.md` | Reads `AGENTS.md` from the repo root as project instructions; also reads `CLAUDE.md` and `.claude/instructions.md` as fallbacks. Instruction-tier. |
| Swival | `.swival/skills/`, `AGENTS.md` | `swival skills add https://github.com/DietrichGebert/ponytail` installs the six skills straight into `.swival/skills/`. Add `--global` to stage them in the library (`~/.config/swival/library`) first, then `swival skills add ponytail` (or `--global ponytail`) to activate per-project or everywhere. Also reads `AGENTS.md` from the repo root and `~/.config/swival/AGENTS.md` globally as instruction-tier fallback. |
| VS Code + Codex extension | `AGENTS.md` | The Codex extension reads `AGENTS.md` (repo root, or `~/.codex/AGENTS.md` globally). Instruction-tier; the full Codex plugin row above adds `/ponytail` levels and hooks. |
| Kiro | `.kiro/steering/ponytail.md` | Steering rule; copy globally or into a project. |
| Generic agents | `AGENTS.md` or `skills/*/SKILL.md` | Copy the compact rule file or load the skill files directly. |
+2 -2
View File
@@ -6,7 +6,7 @@
"hooks": [
{
"type": "command",
"command": "node \"${CLAUDE_PLUGIN_ROOT}/hooks/ponytail-activate.js\"; exit 0",
"command": "command -v node >/dev/null 2>&1 && node \"${CLAUDE_PLUGIN_ROOT}/hooks/ponytail-activate.js\" || exit 0",
"commandWindows": "if (Get-Command node -ErrorAction SilentlyContinue) { node \"$env:CLAUDE_PLUGIN_ROOT\\hooks\\ponytail-activate.js\" }",
"timeout": 5,
"statusMessage": "Loading ponytail mode..."
@@ -19,7 +19,7 @@
"hooks": [
{
"type": "command",
"command": "node \"${CLAUDE_PLUGIN_ROOT}/hooks/ponytail-mode-tracker.js\"; exit 0",
"command": "command -v node >/dev/null 2>&1 && node \"${CLAUDE_PLUGIN_ROOT}/hooks/ponytail-mode-tracker.js\" || exit 0",
"commandWindows": "if (Get-Command node -ErrorAction SilentlyContinue) { node \"$env:CLAUDE_PLUGIN_ROOT\\hooks\\ponytail-mode-tracker.js\" }",
"timeout": 5,
"statusMessage": "Tracking ponytail mode..."
+2 -31
View File
@@ -1,43 +1,14 @@
{
"name": "@dietrichgebert/ponytail",
"name": "ponytail",
"version": "4.8.1",
"description": "Lazy senior dev mode for AI agents. The best code is the code you never wrote.",
"keywords": ["opencode-plugin", "opencode", "ponytail", "pi-package", "pi", "skills"],
"keywords": ["pi-package", "pi", "skills", "ponytail"],
"license": "MIT",
"author": {
"name": "Dietrich Gebert",
"url": "https://github.com/DietrichGebert"
},
"homepage": "https://github.com/DietrichGebert/ponytail",
"repository": {
"type": "git",
"url": "git+https://github.com/DietrichGebert/ponytail.git"
},
"bugs": {
"url": "https://github.com/DietrichGebert/ponytail/issues"
},
"main": "./.opencode/plugins/ponytail.mjs",
"exports": {
".": "./.opencode/plugins/ponytail.mjs",
"./plugin": "./.opencode/plugins/ponytail.mjs"
},
"files": [
"AGENTS.md",
"hooks/",
"skills/",
".opencode/",
"pi-extension/",
"assets/",
"LICENSE"
],
"scripts": {
"test": "node --test tests/*.test.js && npm test --prefix pi-extension"
},
"pi": {
"extensions": ["./pi-extension/index.js"],
"skills": ["./skills"]
},
"publishConfig": {
"access": "public"
}
}
-32
View File
@@ -56,25 +56,6 @@ export { writeDefaultMode };
export default function ponytailExtension(pi) {
let currentMode = DEFAULT_MODE;
let configuredDefaultMode = getDefaultMode();
let isActive = false;
let lastCtx = null;
// -- Status bar --
function syncStatus(ctx) {
if (ctx) lastCtx = ctx;
const c = ctx || lastCtx;
if (!c?.ui?.setStatus || !c.ui.theme?.fg) return;
const theme = c.ui.theme;
if (currentMode === "off") {
c.ui.setStatus("ponytail", "");
return;
}
const levelIcons = { lite: "🌿", full: "⚡", ultra: "🔥" };
const icon = levelIcons[currentMode] || "";
const label = currentMode.toUpperCase();
const indicator = isActive ? theme.fg("accent", "●") : theme.fg("dim", "○");
c.ui.setStatus("ponytail", indicator + " 🐴 " + theme.fg("muted", "ponytail: ") + theme.fg("text", icon + " " + label));
}
const setMode = (mode, ctx) => {
const normalized = normalizePersistedMode(mode);
@@ -82,7 +63,6 @@ export default function ponytailExtension(pi) {
currentMode = normalized;
pi.appendEntry("ponytail-mode", { mode: normalized });
syncStatus(ctx);
ctx?.ui?.notify?.(`Ponytail mode set to ${normalized}.`, "info");
};
@@ -168,18 +148,6 @@ export default function ponytailExtension(pi) {
const entries = ctx?.sessionManager?.getBranch?.() || ctx?.sessionManager?.getEntries?.() || [];
configuredDefaultMode = getDefaultMode();
currentMode = resolveSessionMode(entries, configuredDefaultMode);
syncStatus(ctx);
ctx?.ui?.notify?.(`Ponytail loaded: ${currentMode}`, "info");
});
pi.on("agent_start", async (_event, ctx) => {
isActive = true;
syncStatus(ctx);
});
pi.on("agent_end", async (_event, ctx) => {
isActive = false;
syncStatus(ctx);
});
pi.on("before_agent_start", async (event) => {
-30
View File
@@ -135,33 +135,3 @@ test("a request mentioning normal mode stays active", async () => withTempConfig
const result = await events.get("before_agent_start")({ systemPrompt: "BASE" }, ctx);
assert.match(result.systemPrompt, /PONYTAIL MODE ACTIVE/);
}));
test("status bar renders the mode and flips active on agent_start", async () => withTempConfig(async () => {
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.equal(statusWrites.at(-2).key, "ponytail");
assert.match(statusWrites.at(-2).text, /○.*ULTRA/);
assert.match(statusWrites.at(-1).text, /●.*ULTRA/);
}));
test("status bar stays silent when ui lacks a theme", async () => withTempConfig(async () => {
const { events } = createPiHarness();
const calls = [];
const ctx = createCommandContext({
sessionManager: { getEntries: () => [{ type: "custom", customType: "ponytail-mode", data: { mode: "ultra" } }] },
ui: { notify() {}, setStatus: (_key, text) => calls.push(text) }, // setStatus present, theme absent
});
await events.get("session_start")({ reason: "resume" }, ctx);
await events.get("agent_start")({}, ctx);
assert.deepEqual(calls, []);
}));
-7
View File
@@ -31,13 +31,6 @@ test("resolveSessionMode prefers latest persisted session mode", () => {
assert.equal(resolveSessionMode(entries, "full"), "ultra");
});
test("resolveSessionMode returns fallback when entries is not an array", () => {
assert.equal(resolveSessionMode(null, "ultra"), "ultra");
assert.equal(resolveSessionMode(undefined, "lite"), "lite");
assert.equal(resolveSessionMode({}, "full"), "full");
assert.equal(resolveSessionMode("not an array"), "full"); // DEFAULT_MODE fallback
});
test("readDefaultMode and writeDefaultMode use XDG config path", () => {
const tempDir = mkdtempSync(join(tmpdir(), "ponytail-config-"));
const previousXdg = process.env.XDG_CONFIG_HOME;
-40
View File
@@ -1,40 +0,0 @@
#!/usr/bin/env node
// ponytail — removes state ponytail wrote outside the plugin's own files:
// the mode flag, the config file, and the statusLine entry it added to
// settings.json. Plugin files themselves are removed by each host's own
// uninstall command (see README); this only cleans up what those commands
// can't see.
const fs = require('fs');
const path = require('path');
const { getConfigPath, getClaudeDir } = require('../hooks/ponytail-config');
function removeIfExists(filePath, label) {
try {
fs.unlinkSync(filePath);
console.log(`Removed ${label}: ${filePath}`);
} catch (e) {
if (e.code !== 'ENOENT') throw e;
}
}
removeIfExists(path.join(getClaudeDir(), '.ponytail-active'), 'mode flag');
removeIfExists(getConfigPath(), 'config file');
const settingsPath = path.join(getClaudeDir(), 'settings.json');
try {
const raw = fs.readFileSync(settingsPath, 'utf8').replace(/^\uFEFF/, '');
const settings = JSON.parse(raw);
const cmd = settings.statusLine && settings.statusLine.command;
// ponytail: substring-match the script name, then drop the whole statusLine
// key. A combined statusline (e.g. caveman+ponytail) whose command contains
// "ponytail-statusline" gets removed wholesale. Parse out only ponytail's part
// if combined statuslines become common.
if (typeof cmd === 'string' && cmd.includes('ponytail-statusline')) {
delete settings.statusLine;
fs.writeFileSync(settingsPath, JSON.stringify(settings, null, 2), 'utf8');
console.log(`Removed ponytail statusLine entry from ${settingsPath}`);
}
} catch (e) {
if (e.code !== 'ENOENT') throw e;
}
-22
View File
@@ -18,8 +18,6 @@ const HOST_PLUGIN_MANIFESTS = [
];
// cmd.exe variable syntax (%FOO%); PowerShell leaves it literal, breaking the path.
const CMD_VAR_SYNTAX = /%[A-Za-z_][A-Za-z0-9_]*%/;
// PowerShell 5.1 rejects these POSIX shell guards when a host runs `command`.
const POSIX_GUARD_SYNTAX = /\bcommand\s+-v\b|&&|\|\||>\/dev\/null|2>&1/;
// Pull the hooks/<script> a command launches, so we can check it exists.
const HOOK_SCRIPT = /hooks[\\/]([\w.-]+\.(?:js|mjs|cjs|ps1|sh))/;
@@ -42,26 +40,6 @@ test('every commandWindows uses PowerShell $env: syntax, not cmd.exe %VAR%', ()
}
});
test('shared hook commands avoid POSIX-only guard syntax', () => {
const commands = commandHooks()
.map((h) => h.command)
.filter(Boolean);
assert.ok(commands.length > 0, 'expected at least one shared command entry');
for (const cmd of commands) {
assert.doesNotMatch(cmd, POSIX_GUARD_SYNTAX, `command uses POSIX-only guard syntax: ${cmd}`);
}
});
test('shared hook commands keep lifecycle hooks non-blocking', () => {
const commands = commandHooks()
.map((h) => h.command)
.filter(Boolean);
assert.ok(commands.length > 0, 'expected at least one shared command entry');
for (const cmd of commands) {
assert.match(cmd, /;\s*exit 0$/, `command must exit successfully if node or the hook script fails: ${cmd}`);
}
});
test('every hook command points at a script that ships in hooks/', () => {
for (const hook of commandHooks()) {
for (const cmd of [hook.command, hook.commandWindows].filter(Boolean)) {
+2 -21
View File
@@ -18,12 +18,10 @@ process.env.XDG_CONFIG_HOME = tmp;
delete process.env.PONYTAIL_DEFAULT_MODE;
const statePath = path.join(tmp, 'opencode', '.ponytail-active');
let loadPlugin, parseCommandFile;
let loadPlugin;
test.before(async () => {
const url = pathToFileURL(path.join(__dirname, '..', '.opencode', 'plugins', 'ponytail.mjs'));
const mod = await import(url);
loadPlugin = mod.default;
parseCommandFile = mod.parseCommandFile;
loadPlugin = (await import(url)).default;
});
function transform(hooks) {
@@ -63,21 +61,4 @@ test('unrelated commands do not touch the flag', async () => {
assert.equal(fs.existsSync(statePath), false);
});
test('parseCommandFile reads frontmatter description + body, LF and CRLF', () => {
const lf = path.join(tmp, 'cmd-lf.md');
fs.writeFileSync(lf, '---\ndescription: do a thing\n---\n\nthe template body\n');
assert.deepEqual(parseCommandFile(lf), { description: 'do a thing', template: 'the template body' });
// Windows checkouts (autocrlf) deliver CRLF — the parser must still match.
const crlf = path.join(tmp, 'cmd-crlf.md');
fs.writeFileSync(crlf, '---\r\ndescription: do a thing\r\n---\r\n\r\nthe template body\r\n');
assert.deepEqual(parseCommandFile(crlf), { description: 'do a thing', template: 'the template body' });
});
test('parseCommandFile returns null when there is no frontmatter', () => {
const bare = path.join(tmp, 'cmd-bare.md');
fs.writeFileSync(bare, 'no frontmatter here\n');
assert.equal(parseCommandFile(bare), null);
});
test.after(() => fs.rmSync(tmp, { recursive: true, force: true }));
-76
View File
@@ -1,76 +0,0 @@
#!/usr/bin/env node
const assert = require('assert');
const fs = require('fs');
const os = require('os');
const path = require('path');
const { spawnSync } = require('child_process');
const root = path.join(__dirname, '..');
function runUninstall(env) {
return spawnSync(process.execPath, [path.join(root, 'scripts', 'uninstall.js')], {
env: { ...process.env, ...env },
encoding: 'utf8',
});
}
delete process.env.CLAUDE_CONFIG_DIR;
const temp = fs.mkdtempSync(path.join(os.tmpdir(), 'ponytail-uninstall-'));
process.on('exit', () => fs.rmSync(temp, { recursive: true, force: true }));
const home = path.join(temp, 'home');
const claudeDir = path.join(home, '.claude');
fs.mkdirSync(claudeDir, { recursive: true });
const flagPath = path.join(claudeDir, '.ponytail-active');
fs.writeFileSync(flagPath, 'full');
const configDir = path.join(temp, 'config-home', 'ponytail');
fs.mkdirSync(configDir, { recursive: true });
const configPath = path.join(configDir, 'config.json');
fs.writeFileSync(configPath, JSON.stringify({ defaultMode: 'ultra' }));
const settingsPath = path.join(claudeDir, 'settings.json');
fs.writeFileSync(settingsPath, JSON.stringify({
statusLine: { type: 'command', command: 'bash /some/path/ponytail-statusline.sh' },
}));
const env = {
HOME: home,
USERPROFILE: home,
XDG_CONFIG_HOME: path.join(temp, 'config-home'),
};
let result = runUninstall(env);
assert.equal(result.status, 0, result.stderr);
assert.equal(fs.existsSync(flagPath), false, 'mode flag must be removed');
assert.equal(fs.existsSync(configPath), false, 'config file must be removed');
const settingsAfter = JSON.parse(fs.readFileSync(settingsPath, 'utf8'));
assert.equal(
settingsAfter.statusLine,
undefined,
'ponytail statusLine entry must be removed',
);
// A user's own, unrelated statusLine must survive untouched.
fs.writeFileSync(settingsPath, JSON.stringify({
statusLine: { type: 'command', command: 'bash ~/my-custom-statusline.sh' },
}));
result = runUninstall(env);
assert.equal(result.status, 0, result.stderr);
const settingsAfter2 = JSON.parse(fs.readFileSync(settingsPath, 'utf8'));
assert.equal(
settingsAfter2.statusLine.command,
'bash ~/my-custom-statusline.sh',
"a user's own statusLine must not be touched",
);
// Running on an already-clean machine must not throw.
result = runUninstall({ HOME: path.join(temp, 'home-empty'), USERPROFILE: path.join(temp, 'home-empty') });
assert.equal(result.status, 0, result.stderr);
console.log('uninstall script checks passed');