Files
ponytail/tests/commands.test.js
T
YIZIHN 084f10fb48 fix: ship the missing /ponytail-help command on Claude Code and OpenCode (#62)
Ships the previously-missing /ponytail-help adapter files (commands/ponytail-help.toml, .opencode/command/ponytail-help.md) and adds tests/commands.test.js, a parity guard asserting every pi-registered command has both adapter files. Thanks @hooni0918.
2026-06-15 16:32:02 +02:00

40 lines
1.5 KiB
JavaScript

#!/usr/bin/env node
// Every ponytail command the pi extension registers must also ship as a
// file-based command for the hosts that need one: Claude Code (commands/*.toml,
// which Gemini CLI reuses) and OpenCode (.opencode/command/*.md). /ponytail-help
// was advertised in the README and the help card but missing both files; this
// guards that drift -- a registered command with no adapter file fails here.
const test = require('node:test');
const assert = require('node:assert/strict');
const fs = require('fs');
const path = require('path');
const root = path.join(__dirname, '..');
// pi-extension registers the canonical command set.
const piSource = fs.readFileSync(path.join(root, 'pi-extension', 'index.js'), 'utf8');
const commands = [...piSource.matchAll(/registerCommand\(["']([\w-]+)["']/g)].map((m) => m[1]);
test('pi registers at least the base command', () => {
assert.ok(commands.includes('ponytail'), 'expected pi to register a ponytail command');
});
test('every registered command ships a Claude commands/*.toml', () => {
for (const name of commands) {
assert.ok(
fs.existsSync(path.join(root, 'commands', `${name}.toml`)),
`missing commands/${name}.toml`,
);
}
});
test('every registered command ships an OpenCode .opencode/command/*.md', () => {
for (const name of commands) {
assert.ok(
fs.existsSync(path.join(root, '.opencode', 'command', `${name}.md`)),
`missing .opencode/command/${name}.md`,
);
}
});