feat: codex support

This commit is contained in:
Paul
2026-06-12 08:49:33 -04:00
parent cf97ccc509
commit c16f967d37
10 changed files with 245 additions and 20 deletions
+39
View File
@@ -0,0 +1,39 @@
const fs = require('fs');
const path = require('path');
const os = require('os');
const isCodex = Boolean(process.env.PLUGIN_DATA);
const statePath = isCodex
? path.join(process.env.PLUGIN_DATA, '.ponytail-active')
: path.join(os.homedir(), '.claude', '.ponytail-active');
function setMode(mode) {
fs.mkdirSync(path.dirname(statePath), { recursive: true });
fs.writeFileSync(statePath, mode);
}
function clearMode() {
try { fs.unlinkSync(statePath); } catch (e) {}
}
function writeHookOutput(event, mode, context = '') {
if (!isCodex) {
process.stdout.write(context);
return;
}
const output = { systemMessage: `PONYTAIL:${mode.toUpperCase()}` };
if (context) {
output.hookSpecificOutput = {
hookEventName: event,
additionalContext: context,
};
}
process.stdout.write(JSON.stringify(output));
}
module.exports = {
clearMode,
isCodex,
setMode,
writeHookOutput,
};