Skip to content

Commit f851d4b

Browse files
committed
feat(module): add ponytail opencode plugin
- Package DietrichGebert/ponytail v5.3.2 keeping the full source tree - Add module.opencode.ponytail.enable option - Add HACK stubs for opencode plugin probe bug (anomalyco/opencode#48122)
1 parent 65c0076 commit f851d4b

5 files changed

Lines changed: 63 additions & 0 deletions

File tree

‎home/users/jonas/common.nix‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,8 @@
9898
enable = true;
9999
playwright.enable = true;
100100
garmin.enable = true;
101+
ponytail.enable = true;
102+
101103
# To get the full list of skills:
102104
# nix eval --json --file modules/common/opencode/skills-catalog.nix | jaq .
103105
skills.enabled = [ "social" ];

‎modules/common/opencode/default.nix‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ let
2323
enableSnip = cfg.snip.enable;
2424
enableCopilotAutoModel = cfg.copilotAutoModel.enable;
2525
copilotAutoModelAutos = cfg.copilotAutoModel.autos;
26+
enablePonytail = cfg.ponytail.enable;
2627
};
2728

2829
skillsConfig = import ./skills.nix {

‎modules/common/opencode/interface.nix‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,10 @@ in
9090
enable = mkEnableOption "snip shell-command recording plugin for opencode";
9191
};
9292

93+
ponytail = {
94+
enable = mkEnableOption "ponytail lazy-senior-dev plugin for opencode";
95+
};
96+
9397
playwright = {
9498
enable = mkEnableOption "Playwright browser-automation MCP server (for LinkedIn profile editing and similar tasks)";
9599
};
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
{
2+
lib,
3+
stdenvNoCC,
4+
fetchFromGitHub,
5+
}:
6+
7+
stdenvNoCC.mkDerivation rec {
8+
pname = "ponytail";
9+
version = "5.3.2";
10+
src = fetchFromGitHub {
11+
owner = "DietrichGebert";
12+
repo = "ponytail";
13+
rev = "v${version}";
14+
hash = "sha256-IJlhfkdXI6pMZZCZO7XBRg88LBiNfzc5Gnm4ofGybL8=";
15+
};
16+
17+
dontBuild = true;
18+
19+
# Keep whole tree: ponytail.mjs resolves ../../hooks and ../../skills.
20+
installPhase = ''
21+
runHook preInstall
22+
mkdir -p $out
23+
cp -r . $out/
24+
workaroundForOpencodePluginProbe
25+
runHook postInstall
26+
'';
27+
28+
# HACK: opencode's plugin loader probes server/tui/rpc entrypoints and treats
29+
# Bun's ResolveMessage (not instanceof Error) for a missing file as fatal,
30+
# breaking the whole config bootstrap.
31+
# https://github.com/anomalyco/opencode/issues/48122
32+
# TODO: remove once a released opencode includes the fix.
33+
# server.mjs must re-export the real entry (an empty stub would shadow it);
34+
# tui/rpc only need valid no-op plugins.
35+
preInstall = ''
36+
workaroundForOpencodePluginProbe() {
37+
echo "export { default } from './index.js'" > $out/.opencode/plugins/server.mjs
38+
for entrypoint in tui rpc; do
39+
echo 'export default { id: "ponytail", setup: async () => {} }' \
40+
> "$out/.opencode/plugins/$entrypoint.mjs"
41+
done
42+
}
43+
'';
44+
45+
meta = {
46+
description = "Lazy senior dev mode for AI agents, with OpenCode 2 plugin-loader workaround";
47+
homepage = "https://github.com/DietrichGebert/ponytail";
48+
license = lib.licenses.mit;
49+
platforms = lib.platforms.all;
50+
};
51+
}

‎modules/common/opencode/plugins.nix‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,12 @@
44
enableSnip ? false,
55
enableCopilotAutoModel ? false,
66
copilotAutoModelAutos ? [ ],
7+
enablePonytail ? false,
78
}:
89
let
910
inherit (pkgs) callPackage;
1011
opencode-snip = callPackage ./packages/opencode-snip { };
12+
ponytail = callPackage ./packages/ponytail { };
1113
opencode-github-copilot-auto-model = callPackage ./packages/opencode-github-copilot-auto-model { };
1214
copilotAutoModelEntry =
1315
if copilotAutoModelAutos != [ ] then
@@ -29,5 +31,8 @@ in
2931
]
3032
++ lib.optionals enableCopilotAutoModel [
3133
copilotAutoModelEntry
34+
]
35+
++ lib.optionals enablePonytail [
36+
"${ponytail}/.opencode/plugins"
3237
];
3338
}

0 commit comments

Comments
 (0)