nitm-ai-dev-toolkit 3.0.22 → 4.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +15 -2
- package/README.md +56 -4
- package/bin/cli.js +29 -14
- package/package.json +3 -2
- package/src/monorepo/.claude/commands/ponytail-audit.md +4 -6
- package/src/monorepo/.claude/commands/ponytail-debt.md +3 -5
- package/src/monorepo/.claude/commands/ponytail-gain.md +2 -4
- package/src/monorepo/.claude/commands/ponytail-help.md +2 -4
- package/src/monorepo/.claude/commands/ponytail-review.md +3 -5
- package/src/monorepo/.claude/commands/ponytail.md +3 -5
- package/src/monorepo/.claude/prompt-snippets/bootstrap-patch.md +37 -17
- package/src/monorepo/.claude/prompt-snippets/bootstrap-upgrade.md +76 -51
- package/src/monorepo/.claude/prompt-snippets/bootstrap.md +130 -94
- package/src/monorepo/.codex/config.toml +6 -0
- package/src/monorepo/.github/prompts/review-staged.prompt.md +1 -1
- package/src/monorepo/.opencode/agents/admin-portal.md +10 -4
- package/src/monorepo/.opencode/agents/api-specialist.md +10 -4
- package/src/monorepo/.opencode/agents/backend-architect.md +10 -4
- package/src/monorepo/.opencode/agents/documenter.md +10 -4
- package/src/monorepo/.opencode/agents/feature-builder.md +13 -5
- package/src/monorepo/.opencode/agents/frontend-developer.md +10 -4
- package/src/monorepo/.opencode/agents/green.md +10 -4
- package/src/monorepo/.opencode/agents/implementer.md +10 -4
- package/src/monorepo/.opencode/agents/planner.md +10 -4
- package/src/monorepo/.opencode/agents/red.md +10 -4
- package/src/monorepo/.opencode/agents/refactor.md +10 -4
- package/src/monorepo/.opencode/agents/researcher.md +10 -4
- package/src/monorepo/.opencode/agents/reviewer.md +10 -4
- package/src/monorepo/.opencode/agents/tdd.md +13 -5
- package/src/monorepo/.opencode/opencode.jsonc +8 -10
- package/src/monorepo/AGENTS.md +16 -0
- package/src/monorepo/CLAUDE.md +1 -1
- package/src/monorepo/README.md +22 -0
- package/src/repo/.claude/agents/documenter.agent.md +1 -1
- package/src/repo/.claude/agents/planner.agent.md +1 -1
- package/src/repo/.claude/agents/researcher.agent.md +1 -1
- package/src/repo/.claude/agents/reviewer.agent.md +1 -1
- package/src/repo/.claude/commands/ponytail-audit.md +4 -6
- package/src/repo/.claude/commands/ponytail-debt.md +3 -5
- package/src/repo/.claude/commands/ponytail-gain.md +2 -4
- package/src/repo/.claude/commands/ponytail-help.md +2 -4
- package/src/repo/.claude/commands/ponytail-review.md +3 -5
- package/src/repo/.claude/commands/ponytail.md +3 -5
- package/src/repo/.claude/prompt-snippets/bootstrap-patch.md +37 -17
- package/src/repo/.claude/prompt-snippets/bootstrap-upgrade.md +87 -77
- package/src/repo/.claude/prompt-snippets/bootstrap.md +129 -125
- package/src/repo/.codex/config.toml +6 -0
- package/src/repo/.opencode/agents/admin-portal.md +10 -4
- package/src/repo/.opencode/agents/api-specialist.md +10 -4
- package/src/repo/.opencode/agents/backend-architect.md +10 -4
- package/src/repo/.opencode/agents/documenter.md +10 -4
- package/src/repo/.opencode/agents/feature-builder.md +13 -5
- package/src/repo/.opencode/agents/frontend-developer.md +10 -4
- package/src/repo/.opencode/agents/green.md +10 -4
- package/src/repo/.opencode/agents/implementer.md +10 -4
- package/src/repo/.opencode/agents/planner.md +10 -4
- package/src/repo/.opencode/agents/red.md +10 -4
- package/src/repo/.opencode/agents/refactor.md +10 -4
- package/src/repo/.opencode/agents/researcher.md +10 -4
- package/src/repo/.opencode/agents/reviewer.md +10 -4
- package/src/repo/.opencode/agents/tdd.md +13 -5
- package/src/repo/.opencode/opencode.jsonc +8 -10
- package/src/repo/AGENTS.md +16 -0
- package/src/repo/CLAUDE.md +1 -1
- package/src/repo/README.md +22 -0
- package/src/monorepo/.opencode/plugins/ponytail.mjs +0 -93
- package/src/repo/.opencode/plugins/ponytail.mjs +0 -93
|
@@ -1,10 +1,16 @@
|
|
|
1
1
|
---
|
|
2
2
|
description: "Write minimal code to make failing tests pass. Part of the TDD red-green-refactor cycle."
|
|
3
3
|
mode: subagent
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
request:
|
|
5
|
+
body:
|
|
6
|
+
temperature: 0.1
|
|
7
|
+
permissions:
|
|
8
|
+
- action: edit
|
|
9
|
+
resource: "*"
|
|
10
|
+
effect: allow
|
|
11
|
+
- action: shell
|
|
12
|
+
resource: "*"
|
|
13
|
+
effect: allow
|
|
8
14
|
---
|
|
9
15
|
|
|
10
16
|
# Green Agent (TDD — Make Tests Pass)
|
|
@@ -1,10 +1,16 @@
|
|
|
1
1
|
---
|
|
2
2
|
description: "Implement code changes for a specific task. Follow TDD, write tests alongside code, and self-review before reporting completion."
|
|
3
3
|
mode: subagent
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
request:
|
|
5
|
+
body:
|
|
6
|
+
temperature: 0.1
|
|
7
|
+
permissions:
|
|
8
|
+
- action: edit
|
|
9
|
+
resource: "*"
|
|
10
|
+
effect: allow
|
|
11
|
+
- action: shell
|
|
12
|
+
resource: "*"
|
|
13
|
+
effect: allow
|
|
8
14
|
---
|
|
9
15
|
|
|
10
16
|
# Implementer Agent
|
|
@@ -1,10 +1,16 @@
|
|
|
1
1
|
---
|
|
2
2
|
description: "Break down feature requests into implementation tasks. Read specifications, analyze codebase patterns, and produce structured plans with dependencies."
|
|
3
3
|
mode: subagent
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
request:
|
|
5
|
+
body:
|
|
6
|
+
temperature: 0.1
|
|
7
|
+
permissions:
|
|
8
|
+
- action: edit
|
|
9
|
+
resource: "*"
|
|
10
|
+
effect: allow
|
|
11
|
+
- action: shell
|
|
12
|
+
resource: "*"
|
|
13
|
+
effect: allow
|
|
8
14
|
---
|
|
9
15
|
|
|
10
16
|
# Planner Agent
|
|
@@ -1,10 +1,16 @@
|
|
|
1
1
|
---
|
|
2
2
|
description: "Write failing tests that define expected behavior. Part of the TDD red-green-refactor cycle."
|
|
3
3
|
mode: subagent
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
request:
|
|
5
|
+
body:
|
|
6
|
+
temperature: 0.1
|
|
7
|
+
permissions:
|
|
8
|
+
- action: edit
|
|
9
|
+
resource: "*"
|
|
10
|
+
effect: allow
|
|
11
|
+
- action: shell
|
|
12
|
+
resource: "*"
|
|
13
|
+
effect: allow
|
|
8
14
|
---
|
|
9
15
|
|
|
10
16
|
# Red Agent (TDD — Write Failing Tests)
|
|
@@ -1,10 +1,16 @@
|
|
|
1
1
|
---
|
|
2
2
|
description: "Improve code quality and structure while keeping all tests passing. Part of the TDD red-green-refactor cycle."
|
|
3
3
|
mode: subagent
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
request:
|
|
5
|
+
body:
|
|
6
|
+
temperature: 0.1
|
|
7
|
+
permissions:
|
|
8
|
+
- action: edit
|
|
9
|
+
resource: "*"
|
|
10
|
+
effect: allow
|
|
11
|
+
- action: shell
|
|
12
|
+
resource: "*"
|
|
13
|
+
effect: allow
|
|
8
14
|
---
|
|
9
15
|
|
|
10
16
|
# Refactor Agent (TDD — Improve Code Quality)
|
|
@@ -1,10 +1,16 @@
|
|
|
1
1
|
---
|
|
2
2
|
description: "Research codebase patterns, dependencies, and technical context. Analyze code structure, find relevant examples, and report findings without making changes."
|
|
3
3
|
mode: subagent
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
request:
|
|
5
|
+
body:
|
|
6
|
+
temperature: 0.1
|
|
7
|
+
permissions:
|
|
8
|
+
- action: edit
|
|
9
|
+
resource: "*"
|
|
10
|
+
effect: deny
|
|
11
|
+
- action: shell
|
|
12
|
+
resource: "*"
|
|
13
|
+
effect: deny
|
|
8
14
|
---
|
|
9
15
|
|
|
10
16
|
# Researcher Agent
|
|
@@ -1,10 +1,16 @@
|
|
|
1
1
|
---
|
|
2
2
|
description: "Review code changes for correctness, code quality, security, and adherence to project patterns. Provide actionable feedback with specific file and line references. Use immediately after writing or modifying code, or as a quality gate in orchestrated workflows."
|
|
3
3
|
mode: subagent
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
request:
|
|
5
|
+
body:
|
|
6
|
+
temperature: 0.1
|
|
7
|
+
permissions:
|
|
8
|
+
- action: edit
|
|
9
|
+
resource: "*"
|
|
10
|
+
effect: deny
|
|
11
|
+
- action: shell
|
|
12
|
+
resource: "*"
|
|
13
|
+
effect: allow
|
|
8
14
|
---
|
|
9
15
|
|
|
10
16
|
# Reviewer Agent
|
|
@@ -1,11 +1,19 @@
|
|
|
1
1
|
---
|
|
2
2
|
description: "Implement a feature using test-driven development with red-green-refactor cycle. Coordinates specialized subagents for writing failing tests, implementing code, and refactoring."
|
|
3
3
|
mode: subagent
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
4
|
+
request:
|
|
5
|
+
body:
|
|
6
|
+
temperature: 0.3
|
|
7
|
+
permissions:
|
|
8
|
+
- action: edit
|
|
9
|
+
resource: "*"
|
|
10
|
+
effect: allow
|
|
11
|
+
- action: shell
|
|
12
|
+
resource: "*"
|
|
13
|
+
effect: allow
|
|
14
|
+
- action: subagent
|
|
15
|
+
resource: "*"
|
|
16
|
+
effect: allow
|
|
9
17
|
---
|
|
10
18
|
|
|
11
19
|
# TDD Coordinator Agent
|
|
@@ -5,17 +5,15 @@
|
|
|
5
5
|
".opencode/rules/*.md",
|
|
6
6
|
".agents/skills/orient-to-recent-work/SKILL.md"
|
|
7
7
|
],
|
|
8
|
-
"skills":
|
|
9
|
-
"
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
},
|
|
14
|
-
"plugin": [
|
|
8
|
+
"skills": [
|
|
9
|
+
".agents/skills",
|
|
10
|
+
".claude/skills"
|
|
11
|
+
],
|
|
12
|
+
"plugins": [
|
|
15
13
|
"opencode-mem",
|
|
16
14
|
"@tarquinen/opencode-dcp@latest",
|
|
17
|
-
"@dietrichgebert/ponytail"
|
|
18
|
-
"opentmux"
|
|
15
|
+
"@dietrichgebert/ponytail@4.12.0"
|
|
16
|
+
// "opentmux": V1-only; enable only after it supports V2.
|
|
19
17
|
],
|
|
20
18
|
"lsp": true
|
|
21
|
-
}
|
|
19
|
+
}
|
package/src/repo/AGENTS.md
CHANGED
|
@@ -77,8 +77,24 @@ When stopping to ask a question, do not just post an open-ended block of text. F
|
|
|
77
77
|
|
|
78
78
|
> **Full details:** See `.github/instructions/agent-conduct.instructions.md`
|
|
79
79
|
|
|
80
|
+
## OpenCode V2 Context
|
|
81
|
+
|
|
82
|
+
OpenCode use with toolkit v4 requires native V2; Slim >=3.0.0 requires OpenCode >=2.0.7. Read [native setup](README.md#native-opencode-v2) before migration. All bootstrap flows run `opencode --version` before changes for confirmed OpenCode use: V1 must stop and upgrade OpenCode or remain on toolkit 3.x; missing/unparseable versions block OpenCode steps and toolkit 4.0.0 marking. Directory presence is not harness proof; other-harness-only setup is unaffected.
|
|
83
|
+
|
|
84
|
+
Use `agents`/`system`, `request.body.temperature`, ordered `permissions` (`action`/`resource`/`effect`, `shell`/`subagent`), `commands`, `plugins`, directory-based `skills`, and `mcp.servers`. Preserve user models/providers/plugins and Slim's separate strict schema; do not host-migrate its `prompt`/`permission`/`variant` fields or silently upgrade the separate external starter. Templates register the author's native V2 `@dietrichgebert/ponytail@4.12.0` locally instead of a bundled Ponytail plugin; `opentmux` stays commented as V1-only. Remove only known obsolete toolkit Ponytail `.js`/`.mjs`/`.ts` copies after backup and approval, preserve unrelated local plugins, and merge/deduplicate upstream registration locally without editing global config. No local API port or bridge is used; plugin/runtime integration is untested.
|
|
85
|
+
|
|
86
|
+
Ambient `AGENTS.md` works; config `instructions` entries do not load. `@refs` are ordinary text: explicitly read linked snippets. `request.body.temperature` remains in config, but the current runner does not send it. Preserve `lsp: true`; use project lint/typecheck/compiler commands, not unavailable V2 LSP diagnostics. Back up V1 before native conversion; converted files are incompatible with V1. Activate on the next run/restart.
|
|
87
|
+
|
|
80
88
|
## Detailed Instructions
|
|
81
89
|
|
|
90
|
+
### Native Codex
|
|
91
|
+
|
|
92
|
+
Codex-scoped installs include `.github/instructions/` and `.claude/rules-snippets/` solely as AGENTS-linked standards and their wrapper sources. Read them as references when relevant, not as automatically loaded Codex rules or evidence of Copilot/Claude use; other harness command, agent, and config directories are excluded from `--env codex`.
|
|
93
|
+
|
|
94
|
+
Codex uses this `AGENTS.md` and `.agents/skills/` natively; more-specific nested `AGENTS.md` files provide scoped guidance. Read linked standards when relevant rather than assuming tool-specific rules are auto-loaded. Optional `.codex/config.toml` is comment-only and preserves inherited defaults; project config loads only after explicit user trust. Do not grant self-trust, change security/model/feature defaults, translate Claude frontmatter into Codex agents, or activate MCP servers automatically. Codex MCP uses native `[mcp_servers.name]` TOML, not `.mcp.json`.
|
|
95
|
+
|
|
96
|
+
For npm setup, read and follow `.nitm/BOOTSTRAP.md`. If manually copied and `.nitm/` is absent, read `.claude/prompt-snippets/bootstrap.md` as a task document; `/bootstrap` is not a native Codex command. Determine the actual harness from runtime information or ask; scaffold directories alone do not establish use. Named custom-agent examples below apply only to harnesses that support their formats; in Codex, use workflow skills and only available native delegation capabilities.
|
|
97
|
+
|
|
82
98
|
Detailed standards are split into focused instruction files in `.github/instructions/`:
|
|
83
99
|
|
|
84
100
|
| Instruction File | Description |
|
package/src/repo/CLAUDE.md
CHANGED
|
@@ -47,5 +47,5 @@
|
|
|
47
47
|
- Commands are in `.opencode/commands/`.
|
|
48
48
|
- Rules are in `.opencode/rules/`.
|
|
49
49
|
- Agents are in `.opencode/agents/`.
|
|
50
|
-
-
|
|
50
|
+
- Native V2 loads ambient `AGENTS.md`, not config `instructions` entries. Explicitly read referenced snippets (`@refs` are ordinary text, not attachments). See [OpenCode setup](README.md#native-opencode-v2).
|
|
51
51
|
- Skills are loaded from `.agents/skills/` and `.claude/skills/`.
|
package/src/repo/README.md
CHANGED
|
@@ -110,6 +110,28 @@ See the following files for AI-assisted development:
|
|
|
110
110
|
|
|
111
111
|
## AI Instructions and Commands
|
|
112
112
|
|
|
113
|
+
### Native OpenCode V2
|
|
114
|
+
|
|
115
|
+
Toolkit v4 requires **OpenCode V2 (major >=2)** for OpenCode use; oh-my-opencode-slim >=3.0.0 requires OpenCode >=2.0.7. Bootstrap, patch, and upgrade run `opencode --version` before changes (optional leading `v` accepted). V1 must stop before OpenCode customization/migration or marking toolkit 4.0.0: upgrade OpenCode or remain on toolkit 3.x. A missing CLI or unparseable version stops OpenCode steps and version marking until confirmed/installed. Confirm harness use from runtime evidence or ask, not scaffold directories; other-harness-only setup is unaffected.
|
|
116
|
+
|
|
117
|
+
The template's local `plugins` array registers the author's native V2 package `@dietrichgebert/ponytail@4.12.0`, alongside `opencode-mem` and `@tarquinen/opencode-dcp@latest`; `opentmux` remains commented as V1-only. The obsolete local Ponytail plugin is no longer bundled; no local API port or bridge is used. For existing projects, back up and obtain approval before removing only known toolkit `.opencode/plugins/ponytail.js`, `.mjs`, or `.ts` copies; preserve unrelated local plugins and merge/deduplicate upstream registration locally without editing global plugins. Native local plugins are discovered automatically; do not register them twice.
|
|
118
|
+
|
|
119
|
+
With approval, merge `"plugins": ["oh-my-opencode-slim@3.0.0"]` locally without replacing other registrations. Slim's separate strict schema retains `prompt`, `permission`, and `variant`; do not host-migrate it. The external starter is a separate package, not automatically upgraded. Plugin/runtime integration has not been tested.
|
|
120
|
+
|
|
121
|
+
Use native `agents`/`system`, `request.body.temperature`, ordered `permissions` (`action`/`resource`/`effect`, `shell`/`subagent`), `commands`/`subagent`, `plugins` with `{ "package": "…", "options": {} }`, skill-directory arrays, and `mcp.servers` with inverse `disabled` and `timeout.catalog`/`timeout.execution`. Follow the [V2 migration guide](https://opencode.ai/v2/docs/migrate-v1) and [plugin guide](https://opencode.ai/v2/docs/build/plugins); the published schema may describe V1 and is not V2 validation authority.
|
|
122
|
+
|
|
123
|
+
Ambient `AGENTS.md` works; config `instructions` entries are not loaded. `@refs` are ordinary text: read linked snippets explicitly. `request.body.temperature` remains in config, but the current runner does not send it. Preserve `lsp: true`; use project lint/typecheck/compiler commands (no V2 LSP tools/diagnostics currently).
|
|
124
|
+
|
|
125
|
+
`--env opencode` supplies minimal shared references without activating other harnesses. Back up V1, merge rather than clobber models/providers/plugins, and activate on the next run/restart. Native-converted files are incompatible with V1. Verify with installed V2; `doctor` is not runtime validation. Toolkit 4.0.0 publishing has not been executed.
|
|
126
|
+
|
|
127
|
+
### Native Codex
|
|
128
|
+
|
|
129
|
+
`--env codex` includes `.codex/`, `.agents/`, and shared context, plus `.github/instructions/` and `.claude/rules-snippets/` solely to supply AGENTS-linked standards and their wrapper source content. No other harness command, agent, or config directories are installed; these references do not establish Copilot/Claude use or load automatically as Codex rules. Other harness scopes are unchanged.
|
|
130
|
+
|
|
131
|
+
Codex reads `AGENTS.md` and `.agents/skills/` natively. The optional comment-only `.codex/config.toml` preserves inherited defaults and is loaded only after explicit user trust; it does not grant trust or activate MCP servers. Codex MCP uses native `[mcp_servers.name]` TOML, not `.mcp.json`.
|
|
132
|
+
|
|
133
|
+
For npm setup, ask Codex to read and follow `.nitm/BOOTSTRAP.md`. For manual copies without `.nitm/`, provide `.claude/prompt-snippets/bootstrap.md` as a task document (copy the shared snippets too). For AI-guided updates, provide `.claude/prompt-snippets/bootstrap-patch.md`. The slash commands below and tool-specific custom-agent formats are not native Codex commands or agent definitions. Bootstrap must identify the actual running harness or ask, not infer it from scaffolded directories.
|
|
134
|
+
|
|
113
135
|
This repository includes AI instruction files to standardize development workflows across tools. The `.cursor/` and `.github/` folders define how AI assistants should analyze, plan, implement, and review changes.
|
|
114
136
|
|
|
115
137
|
### Planning
|
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
// ponytail — OpenCode plugin.
|
|
2
|
-
//
|
|
3
|
-
// Injects the ponytail ruleset into every chat's system prompt at the active
|
|
4
|
-
// intensity, and persists /ponytail mode switches. Reuses the shared instruction
|
|
5
|
-
// builder so Claude Code, Codex, pi, and OpenCode all read one source of truth.
|
|
6
|
-
//
|
|
7
|
-
// OpenCode loads this as a server plugin — add it to your opencode.jsonc:
|
|
8
|
-
// { "plugin": ["./.opencode/plugins/ponytail.mjs"] }
|
|
9
|
-
|
|
10
|
-
import { createRequire } from "module";
|
|
11
|
-
import fs from "fs";
|
|
12
|
-
import os from "os";
|
|
13
|
-
import path from "path";
|
|
14
|
-
import { fileURLToPath } from "url";
|
|
15
|
-
|
|
16
|
-
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
17
|
-
|
|
18
|
-
// The shared instruction builder is CommonJS; bridge to it from this ES module.
|
|
19
|
-
const require = createRequire(import.meta.url);
|
|
20
|
-
const {
|
|
21
|
-
getPonytailInstructions,
|
|
22
|
-
} = require("../../hooks/ponytail-instructions");
|
|
23
|
-
const {
|
|
24
|
-
getDefaultMode,
|
|
25
|
-
normalizePersistedMode,
|
|
26
|
-
} = require("../../hooks/ponytail-config");
|
|
27
|
-
|
|
28
|
-
// OpenCode has no flag-file convention of its own; keep mode beside its config.
|
|
29
|
-
const statePath = path.join(
|
|
30
|
-
process.env.XDG_CONFIG_HOME || path.join(os.homedir(), ".config"),
|
|
31
|
-
"opencode",
|
|
32
|
-
".ponytail-active",
|
|
33
|
-
);
|
|
34
|
-
|
|
35
|
-
function readMode() {
|
|
36
|
-
try {
|
|
37
|
-
return (
|
|
38
|
-
normalizePersistedMode(fs.readFileSync(statePath, "utf8").trim()) ||
|
|
39
|
-
getDefaultMode()
|
|
40
|
-
);
|
|
41
|
-
} catch (e) {
|
|
42
|
-
return getDefaultMode();
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
function writeMode(mode) {
|
|
47
|
-
fs.mkdirSync(path.dirname(statePath), { recursive: true });
|
|
48
|
-
fs.writeFileSync(statePath, mode);
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
export default async ({ client } = {}) => {
|
|
52
|
-
const log = (level, message) => {
|
|
53
|
-
try {
|
|
54
|
-
client &&
|
|
55
|
-
client.app &&
|
|
56
|
-
client.app.log({ body: { service: "ponytail", level, message } });
|
|
57
|
-
} catch (e) {}
|
|
58
|
-
};
|
|
59
|
-
|
|
60
|
-
const ponytailSkillsDir = path.resolve(__dirname, "../../.agents/skills");
|
|
61
|
-
|
|
62
|
-
return {
|
|
63
|
-
// Register skills directory so opencode discovers ponytail skills.
|
|
64
|
-
config: async (config) => {
|
|
65
|
-
config.skills = config.skills || {};
|
|
66
|
-
config.skills.paths = config.skills.paths || [];
|
|
67
|
-
if (!config.skills.paths.includes(ponytailSkillsDir)) {
|
|
68
|
-
config.skills.paths.push(ponytailSkillsDir);
|
|
69
|
-
}
|
|
70
|
-
},
|
|
71
|
-
|
|
72
|
-
// Append the ruleset to the system prompt every turn.
|
|
73
|
-
"experimental.chat.system.transform": async (_input, output) => {
|
|
74
|
-
const mode = readMode();
|
|
75
|
-
if (mode === "off") return;
|
|
76
|
-
output.system.push(getPonytailInstructions(mode));
|
|
77
|
-
},
|
|
78
|
-
|
|
79
|
-
// Persist `/ponytail <level>` so the next turn's injection follows it.
|
|
80
|
-
// ponytail: mode applies from the next message, not the current one — the
|
|
81
|
-
// transform reads the flag the command writes. Good enough; switch to a
|
|
82
|
-
// synchronous store if same-turn switching ever matters.
|
|
83
|
-
"command.execute.before": async (input) => {
|
|
84
|
-
if (!input || input.command !== "ponytail") return;
|
|
85
|
-
// `off` is persisted like any mode; the transform reads it and stays silent.
|
|
86
|
-
const mode =
|
|
87
|
-
normalizePersistedMode((input.arguments || "").trim()) ||
|
|
88
|
-
getDefaultMode();
|
|
89
|
-
writeMode(mode);
|
|
90
|
-
log("info", "ponytail " + mode);
|
|
91
|
-
},
|
|
92
|
-
};
|
|
93
|
-
};
|
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
// ponytail — OpenCode plugin.
|
|
2
|
-
//
|
|
3
|
-
// Injects the ponytail ruleset into every chat's system prompt at the active
|
|
4
|
-
// intensity, and persists /ponytail mode switches. Reuses the shared instruction
|
|
5
|
-
// builder so Claude Code, Codex, pi, and OpenCode all read one source of truth.
|
|
6
|
-
//
|
|
7
|
-
// OpenCode loads this as a server plugin — add it to your opencode.jsonc:
|
|
8
|
-
// { "plugin": ["./.opencode/plugins/ponytail.mjs"] }
|
|
9
|
-
|
|
10
|
-
import { createRequire } from "module";
|
|
11
|
-
import fs from "fs";
|
|
12
|
-
import os from "os";
|
|
13
|
-
import path from "path";
|
|
14
|
-
import { fileURLToPath } from "url";
|
|
15
|
-
|
|
16
|
-
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
17
|
-
|
|
18
|
-
// The shared instruction builder is CommonJS; bridge to it from this ES module.
|
|
19
|
-
const require = createRequire(import.meta.url);
|
|
20
|
-
const {
|
|
21
|
-
getPonytailInstructions,
|
|
22
|
-
} = require("../../hooks/ponytail-instructions");
|
|
23
|
-
const {
|
|
24
|
-
getDefaultMode,
|
|
25
|
-
normalizePersistedMode,
|
|
26
|
-
} = require("../../hooks/ponytail-config");
|
|
27
|
-
|
|
28
|
-
// OpenCode has no flag-file convention of its own; keep mode beside its config.
|
|
29
|
-
const statePath = path.join(
|
|
30
|
-
process.env.XDG_CONFIG_HOME || path.join(os.homedir(), ".config"),
|
|
31
|
-
"opencode",
|
|
32
|
-
".ponytail-active",
|
|
33
|
-
);
|
|
34
|
-
|
|
35
|
-
function readMode() {
|
|
36
|
-
try {
|
|
37
|
-
return (
|
|
38
|
-
normalizePersistedMode(fs.readFileSync(statePath, "utf8").trim()) ||
|
|
39
|
-
getDefaultMode()
|
|
40
|
-
);
|
|
41
|
-
} catch (e) {
|
|
42
|
-
return getDefaultMode();
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
function writeMode(mode) {
|
|
47
|
-
fs.mkdirSync(path.dirname(statePath), { recursive: true });
|
|
48
|
-
fs.writeFileSync(statePath, mode);
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
export default async ({ client } = {}) => {
|
|
52
|
-
const log = (level, message) => {
|
|
53
|
-
try {
|
|
54
|
-
client &&
|
|
55
|
-
client.app &&
|
|
56
|
-
client.app.log({ body: { service: "ponytail", level, message } });
|
|
57
|
-
} catch (e) {}
|
|
58
|
-
};
|
|
59
|
-
|
|
60
|
-
const ponytailSkillsDir = path.resolve(__dirname, "../../.agents/skills");
|
|
61
|
-
|
|
62
|
-
return {
|
|
63
|
-
// Register skills directory so opencode discovers ponytail skills.
|
|
64
|
-
config: async (config) => {
|
|
65
|
-
config.skills = config.skills || {};
|
|
66
|
-
config.skills.paths = config.skills.paths || [];
|
|
67
|
-
if (!config.skills.paths.includes(ponytailSkillsDir)) {
|
|
68
|
-
config.skills.paths.push(ponytailSkillsDir);
|
|
69
|
-
}
|
|
70
|
-
},
|
|
71
|
-
|
|
72
|
-
// Append the ruleset to the system prompt every turn.
|
|
73
|
-
"experimental.chat.system.transform": async (_input, output) => {
|
|
74
|
-
const mode = readMode();
|
|
75
|
-
if (mode === "off") return;
|
|
76
|
-
output.system.push(getPonytailInstructions(mode));
|
|
77
|
-
},
|
|
78
|
-
|
|
79
|
-
// Persist `/ponytail <level>` so the next turn's injection follows it.
|
|
80
|
-
// ponytail: mode applies from the next message, not the current one — the
|
|
81
|
-
// transform reads the flag the command writes. Good enough; switch to a
|
|
82
|
-
// synchronous store if same-turn switching ever matters.
|
|
83
|
-
"command.execute.before": async (input) => {
|
|
84
|
-
if (!input || input.command !== "ponytail") return;
|
|
85
|
-
// `off` is persisted like any mode; the transform reads it and stays silent.
|
|
86
|
-
const mode =
|
|
87
|
-
normalizePersistedMode((input.arguments || "").trim()) ||
|
|
88
|
-
getDefaultMode();
|
|
89
|
-
writeMode(mode);
|
|
90
|
-
log("info", "ponytail " + mode);
|
|
91
|
-
},
|
|
92
|
-
};
|
|
93
|
-
};
|