Adding support for Copilot Marketplace plugin (#47)
* Add GitHub Copilot plugin and marketplace manifests for Ponytail Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Add Copilot hook adapters and plugin data runtime precedence Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Document Copilot plugin install flow and instruction fallback mode Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Fix Copilot hooks for native output context and state-only mode tracking Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * docs: add Copilot CLI namespaced command examples Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Collapse Copilot hooks into shared activate/mode-tracker The Copilot hook files duplicated ponytail-activate.js and ponytail-mode-tracker.js, differing only in output shape. Move that difference into writeHookOutput (isCopilot branch) and point copilot-hooks.json at the shared hooks. Deletes both forks (-73 lines). Refs #1 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> * Align Copilot manifest version to 4.4.0 with cross-manifest parity test Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Make Copilot and Codex host detection exclusive in runtime output routing Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Add Copilot debt command validation with a pull request acceptance checklist Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Removed PR template * Drop tautological copilot command-form test The namespaced-form assertion built '/ponytail:ponytail-debt' from two constants and compared it to itself — it tests string concatenation, not wiring. The file-exists check above already catches a renamed manifest. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> --------- Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.8
Copilot
parent
1c420ad2f3
commit
c1c80f3cc8
@@ -0,0 +1,20 @@
|
|||||||
|
{
|
||||||
|
"name": "ponytail",
|
||||||
|
"description": "Lazy senior dev mode for AI agents. The best code is the code you never wrote.",
|
||||||
|
"owner": {
|
||||||
|
"name": "Dietrich Gebert",
|
||||||
|
"url": "https://github.com/DietrichGebert"
|
||||||
|
},
|
||||||
|
"plugins": [
|
||||||
|
{
|
||||||
|
"name": "ponytail",
|
||||||
|
"description": "Forces the laziest solution that works. YAGNI, stdlib first, one line over fifty.",
|
||||||
|
"source": "./",
|
||||||
|
"category": "productivity",
|
||||||
|
"tags": ["yagni", "minimalism", "code-review", "productivity"],
|
||||||
|
"commands": "commands/",
|
||||||
|
"skills": "skills/",
|
||||||
|
"hooks": "hooks/copilot-hooks.json"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
{
|
||||||
|
"name": "ponytail",
|
||||||
|
"description": "Lazy senior dev mode. Forces the simplest, shortest solution that actually works: YAGNI, stdlib first, no unrequested abstractions.",
|
||||||
|
"version": "4.4.0",
|
||||||
|
"author": {
|
||||||
|
"name": "Dietrich Gebert",
|
||||||
|
"url": "https://github.com/DietrichGebert"
|
||||||
|
},
|
||||||
|
"homepage": "https://github.com/DietrichGebert/ponytail",
|
||||||
|
"repository": "https://github.com/DietrichGebert/ponytail",
|
||||||
|
"license": "MIT",
|
||||||
|
"keywords": ["yagni", "minimalism", "code-review", "productivity"],
|
||||||
|
"commands": "commands/",
|
||||||
|
"skills": "skills/",
|
||||||
|
"hooks": "hooks/copilot-hooks.json"
|
||||||
|
}
|
||||||
@@ -88,6 +88,27 @@ codex
|
|||||||
Open `/plugins`, select the Ponytail marketplace, and install Ponytail. Then
|
Open `/plugins`, select the Ponytail marketplace, and install Ponytail. Then
|
||||||
open `/hooks`, review and trust its two lifecycle hooks, and start a new thread.
|
open `/hooks`, review and trust its two lifecycle hooks, and start a new thread.
|
||||||
|
|
||||||
|
### GitHub Copilot CLI
|
||||||
|
|
||||||
|
```bash
|
||||||
|
copilot plugin marketplace add DietrichGebert/ponytail
|
||||||
|
copilot plugin install ponytail@ponytail
|
||||||
|
```
|
||||||
|
|
||||||
|
In an interactive Copilot CLI session, use the slash equivalents:
|
||||||
|
|
||||||
|
```
|
||||||
|
/plugin marketplace add DietrichGebert/ponytail
|
||||||
|
/plugin install ponytail@ponytail
|
||||||
|
```
|
||||||
|
|
||||||
|
Copilot CLI namespaces plugin commands by plugin name. For example:
|
||||||
|
|
||||||
|
```text
|
||||||
|
/ponytail:ponytail ultra
|
||||||
|
/ponytail:ponytail-review
|
||||||
|
```
|
||||||
|
|
||||||
### Pi agent harness
|
### Pi agent harness
|
||||||
|
|
||||||
```
|
```
|
||||||
@@ -116,11 +137,11 @@ That was it. He'd be proud. He won't say it.
|
|||||||
|
|
||||||
Active every session, with a handful of commands (see [Commands](#commands)). `/ponytail ultra` exists for when the codebase has wronged you personally. Startup and mode-change text shows the current mode.
|
Active every session, with a handful of commands (see [Commands](#commands)). `/ponytail ultra` exists for when the codebase has wronged you personally. Startup and mode-change text shows the current mode.
|
||||||
|
|
||||||
Cursor, Windsurf, Cline, Copilot, Aider, Kiro: 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: 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.
|
Kiro: copy `.kiro/steering/ponytail.md` to `~/.kiro/steering/` (global) or `.kiro/steering/` in your project.
|
||||||
|
|
||||||
GitHub Copilot CLI: it already reads `AGENTS.md` and `.github/copilot-instructions.md` in a project, or copy the rules into `~/.copilot/copilot-instructions.md` to run ponytail in every project.
|
GitHub Copilot CLI fallback (instruction-only mode): it reads `AGENTS.md` and `.github/copilot-instructions.md` in a project, or copy the rules into `~/.copilot/copilot-instructions.md` to run ponytail in every project. This path keeps always-on guidance, but does not add plugin mode switches or hooks.
|
||||||
|
|
||||||
Antigravity and VS Code with the Codex extension: both read `AGENTS.md`, which this repo ships, so it works from the repo root with no setup (`~/.codex/AGENTS.md` makes Codex global, `.agents/rules/` makes it an always-on rule in Antigravity).
|
Antigravity and VS Code with the Codex extension: both read `AGENTS.md`, which this repo ships, so it works from the repo root with no setup (`~/.codex/AGENTS.md` makes Codex global, `.agents/rules/` makes it an always-on rule in Antigravity).
|
||||||
|
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ to load in a given agent.
|
|||||||
| Windsurf | `.windsurf/rules/ponytail.md` | Project rule. |
|
| Windsurf | `.windsurf/rules/ponytail.md` | Project rule. |
|
||||||
| Cline | `.clinerules/ponytail.md` | Project rule. |
|
| Cline | `.clinerules/ponytail.md` | Project rule. |
|
||||||
| GitHub Copilot | `.github/copilot-instructions.md` | Repository instruction file. |
|
| GitHub Copilot | `.github/copilot-instructions.md` | Repository instruction file. |
|
||||||
| GitHub Copilot CLI | `AGENTS.md`, `.github/copilot-instructions.md`, `~/.copilot/copilot-instructions.md` | Reads custom instructions: per-project from `AGENTS.md` or `.github/copilot-instructions.md`, or globally from `~/.copilot/copilot-instructions.md`. Instruction-tier (no `/ponytail` levels or hooks). |
|
| 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. |
|
| 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. |
|
||||||
| 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. |
|
| 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. |
|
| Kiro | `.kiro/steering/ponytail.md` | Steering rule; copy globally or into a project. |
|
||||||
|
|||||||
@@ -0,0 +1,21 @@
|
|||||||
|
{
|
||||||
|
"version": 1,
|
||||||
|
"hooks": {
|
||||||
|
"sessionStart": [
|
||||||
|
{
|
||||||
|
"type": "command",
|
||||||
|
"bash": "node \"${PLUGIN_ROOT}/hooks/ponytail-activate.js\"",
|
||||||
|
"powershell": "node \"${PLUGIN_ROOT}\\hooks\\ponytail-activate.js\"",
|
||||||
|
"timeoutSec": 5
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"userPromptSubmitted": [
|
||||||
|
{
|
||||||
|
"type": "command",
|
||||||
|
"bash": "node \"${PLUGIN_ROOT}/hooks/ponytail-mode-tracker.js\"",
|
||||||
|
"powershell": "node \"${PLUGIN_ROOT}\\hooks\\ponytail-mode-tracker.js\"",
|
||||||
|
"timeoutSec": 5
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -2,10 +2,15 @@ const fs = require('fs');
|
|||||||
const path = require('path');
|
const path = require('path');
|
||||||
const { getClaudeDir } = require('./ponytail-config');
|
const { getClaudeDir } = require('./ponytail-config');
|
||||||
|
|
||||||
const isCodex = Boolean(process.env.PLUGIN_DATA);
|
const STATE_FILE = '.ponytail-active';
|
||||||
const statePath = isCodex
|
const isCopilot = Boolean(process.env.COPILOT_PLUGIN_DATA);
|
||||||
? path.join(process.env.PLUGIN_DATA, '.ponytail-active')
|
const isCodex = !isCopilot && Boolean(process.env.PLUGIN_DATA);
|
||||||
: path.join(getClaudeDir(), '.ponytail-active');
|
|
||||||
|
let stateDir = getClaudeDir();
|
||||||
|
if (isCodex) stateDir = process.env.PLUGIN_DATA;
|
||||||
|
if (isCopilot) stateDir = process.env.COPILOT_PLUGIN_DATA;
|
||||||
|
|
||||||
|
const statePath = path.join(stateDir, STATE_FILE);
|
||||||
|
|
||||||
function setMode(mode) {
|
function setMode(mode) {
|
||||||
fs.mkdirSync(path.dirname(statePath), { recursive: true });
|
fs.mkdirSync(path.dirname(statePath), { recursive: true });
|
||||||
@@ -17,10 +22,13 @@ function clearMode() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function writeHookOutput(event, mode, context = '') {
|
function writeHookOutput(event, mode, context = '') {
|
||||||
if (!isCodex) {
|
if (isCopilot) {
|
||||||
process.stdout.write(context);
|
// Copilot reads additionalContext on SessionStart; ignores output elsewhere.
|
||||||
|
process.stdout.write(JSON.stringify(
|
||||||
|
event === 'SessionStart' && context ? { additionalContext: context } : {}));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (isCodex) {
|
||||||
const output = { systemMessage: `PONYTAIL:${mode.toUpperCase()}` };
|
const output = { systemMessage: `PONYTAIL:${mode.toUpperCase()}` };
|
||||||
if (context) {
|
if (context) {
|
||||||
output.hookSpecificOutput = {
|
output.hookSpecificOutput = {
|
||||||
@@ -29,11 +37,15 @@ function writeHookOutput(event, mode, context = '') {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
process.stdout.write(JSON.stringify(output));
|
process.stdout.write(JSON.stringify(output));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
process.stdout.write(context);
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
clearMode,
|
clearMode,
|
||||||
isCodex,
|
isCodex,
|
||||||
|
isCopilot,
|
||||||
setMode,
|
setMode,
|
||||||
writeHookOutput,
|
writeHookOutput,
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -0,0 +1,33 @@
|
|||||||
|
#!/usr/bin/env node
|
||||||
|
// Smoke test for the Copilot plugin adapter: keep command wiring minimal and
|
||||||
|
// ensure the debt command is part of the shared command surface.
|
||||||
|
|
||||||
|
const test = require('node:test');
|
||||||
|
const assert = require('node:assert/strict');
|
||||||
|
const fs = require('fs');
|
||||||
|
const path = require('path');
|
||||||
|
|
||||||
|
const root = path.join(__dirname, '..');
|
||||||
|
const REQUIRED_COMMAND_FILES = [
|
||||||
|
'ponytail.toml',
|
||||||
|
'ponytail-review.toml',
|
||||||
|
'ponytail-audit.toml',
|
||||||
|
'ponytail-debt.toml',
|
||||||
|
];
|
||||||
|
|
||||||
|
function readJSON(relPath) {
|
||||||
|
return JSON.parse(fs.readFileSync(path.join(root, relPath), 'utf8'));
|
||||||
|
}
|
||||||
|
|
||||||
|
test('copilot plugin command directory includes ponytail-debt', () => {
|
||||||
|
const manifest = readJSON('.github/plugin/plugin.json');
|
||||||
|
assert.equal(manifest.name, 'ponytail');
|
||||||
|
assert.equal(manifest.commands, 'commands/');
|
||||||
|
|
||||||
|
for (const file of REQUIRED_COMMAND_FILES) {
|
||||||
|
assert.ok(
|
||||||
|
fs.existsSync(path.join(root, manifest.commands, file)),
|
||||||
|
`missing command file: ${manifest.commands}${file}`,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
});
|
||||||
@@ -16,6 +16,12 @@ const MANIFEST = 'gemini-extension.json';
|
|||||||
const EXTENSION_NAME = 'ponytail';
|
const EXTENSION_NAME = 'ponytail';
|
||||||
// Floating refs are a supply-chain footgun; the manifest version must be pinned.
|
// Floating refs are a supply-chain footgun; the manifest version must be pinned.
|
||||||
const PINNED_SEMVER = /^\d+\.\d+\.\d+$/;
|
const PINNED_SEMVER = /^\d+\.\d+\.\d+$/;
|
||||||
|
const VERSIONED_MANIFESTS = [
|
||||||
|
'gemini-extension.json',
|
||||||
|
'.claude-plugin/plugin.json',
|
||||||
|
'.codex-plugin/plugin.json',
|
||||||
|
'.github/plugin/plugin.json',
|
||||||
|
];
|
||||||
// Gemini auto-discovers these by directory; the manifest is only useful if they exist.
|
// Gemini auto-discovers these by directory; the manifest is only useful if they exist.
|
||||||
const REUSED_COMMANDS = ['commands/ponytail.toml', 'commands/ponytail-review.toml'];
|
const REUSED_COMMANDS = ['commands/ponytail.toml', 'commands/ponytail-review.toml'];
|
||||||
const REUSED_SKILLS = ['skills/ponytail/SKILL.md'];
|
const REUSED_SKILLS = ['skills/ponytail/SKILL.md'];
|
||||||
@@ -46,9 +52,15 @@ test('manifest names the ponytail extension with a pinned version', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
test('version stays aligned with the other plugin manifests', () => {
|
test('version stays aligned with the other plugin manifests', () => {
|
||||||
const manifest = loadManifest();
|
const versions = VERSIONED_MANIFESTS.map((rel) => {
|
||||||
const claude = JSON.parse(read('.claude-plugin/plugin.json'));
|
const manifest = JSON.parse(read(rel));
|
||||||
assert.equal(manifest.version, claude.version);
|
assert.match(manifest.version, PINNED_SEMVER, `${rel} version must be pinned semver`);
|
||||||
|
return manifest.version;
|
||||||
|
});
|
||||||
|
const [sharedVersion, ...rest] = versions;
|
||||||
|
for (const version of rest) {
|
||||||
|
assert.equal(version, sharedVersion);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
test('contextFileName resolves to a file carrying the ponytail rules', () => {
|
test('contextFileName resolves to a file carrying the ponytail rules', () => {
|
||||||
|
|||||||
@@ -99,5 +99,44 @@ assert.equal(
|
|||||||
'flag must not land in ~/.claude when CLAUDE_CONFIG_DIR is set',
|
'flag must not land in ~/.claude when CLAUDE_CONFIG_DIR is set',
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const copilotData = path.join(temp, 'copilot-data');
|
||||||
|
const codexData = path.join(temp, 'codex-data-shadow');
|
||||||
|
result = run('ponytail-activate.js', {
|
||||||
|
HOME: home,
|
||||||
|
USERPROFILE: home,
|
||||||
|
COPILOT_PLUGIN_DATA: copilotData,
|
||||||
|
PLUGIN_DATA: codexData,
|
||||||
|
PONYTAIL_DEFAULT_MODE: 'full',
|
||||||
|
});
|
||||||
|
assert.equal(result.status, 0, result.stderr);
|
||||||
|
assert.equal(fs.readFileSync(path.join(copilotData, '.ponytail-active'), 'utf8'), 'full');
|
||||||
|
assert.equal(
|
||||||
|
fs.existsSync(path.join(codexData, '.ponytail-active')),
|
||||||
|
false,
|
||||||
|
'copilot hooks must not write mode state to codex PLUGIN_DATA',
|
||||||
|
);
|
||||||
|
output = JSON.parse(result.stdout);
|
||||||
|
assert.match(output.additionalContext, /PONYTAIL MODE ACTIVE — level: full/);
|
||||||
|
|
||||||
|
result = run(
|
||||||
|
'ponytail-mode-tracker.js',
|
||||||
|
{
|
||||||
|
HOME: home,
|
||||||
|
USERPROFILE: home,
|
||||||
|
COPILOT_PLUGIN_DATA: copilotData,
|
||||||
|
PLUGIN_DATA: codexData,
|
||||||
|
},
|
||||||
|
JSON.stringify({ prompt: '/ponytail ultra' }),
|
||||||
|
);
|
||||||
|
assert.equal(result.status, 0, result.stderr);
|
||||||
|
assert.equal(fs.readFileSync(path.join(copilotData, '.ponytail-active'), 'utf8'), 'ultra');
|
||||||
|
assert.equal(
|
||||||
|
fs.existsSync(path.join(codexData, '.ponytail-active')),
|
||||||
|
false,
|
||||||
|
'copilot mode tracker must keep codex PLUGIN_DATA untouched',
|
||||||
|
);
|
||||||
|
output = JSON.parse(result.stdout);
|
||||||
|
assert.deepEqual(output, {});
|
||||||
|
|
||||||
fs.rmSync(temp, { recursive: true, force: true });
|
fs.rmSync(temp, { recursive: true, force: true });
|
||||||
console.log('hook compatibility checks passed');
|
console.log('hook compatibility checks passed');
|
||||||
|
|||||||
Reference in New Issue
Block a user