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.
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
#!/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`,
|
||||
);
|
||||
}
|
||||
});
|
||||
Reference in New Issue
Block a user