opencode-froggy 0.9.0 → 0.10.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/README.md +145 -8
- package/agent/code-simplifier.md +7 -5
- package/command/commit-push.md +1 -1
- package/command/diff-summary.md +3 -4
- package/command/release.md +10 -5
- package/command/review-changes.md +3 -2
- package/package.json +1 -1
- package/skill/tdd/SKILL.md +44 -0
package/README.md
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
<a href="https://www.npmjs.com/package/opencode-froggy"><img src="https://badge.fury.io/js/opencode-froggy.svg" alt="npm version"></a>
|
|
8
8
|
</p>
|
|
9
9
|
|
|
10
|
-
OpenCode plugin providing hooks, specialized agents (architect, doc-writer, rubber-duck, partner, code-reviewer, code-simplifier), skills (
|
|
10
|
+
OpenCode plugin providing hooks, specialized agents (architect, doc-writer, rubber-duck, partner, code-reviewer, code-simplifier), skills (ask-questions-if-underspecified, tdd), and tools (gitingest, pdf-to-markdown, blockchain queries, agent-promote).
|
|
11
11
|
|
|
12
12
|
---
|
|
13
13
|
|
|
@@ -17,7 +17,11 @@ OpenCode plugin providing hooks, specialized agents (architect, doc-writer, rubb
|
|
|
17
17
|
- [Commands](#commands)
|
|
18
18
|
- [Agents](#agents)
|
|
19
19
|
- [Skills](#skills)
|
|
20
|
-
- [
|
|
20
|
+
- [Overview](#overview)
|
|
21
|
+
- [Available Skills](#available-skills)
|
|
22
|
+
- [Discovery Locations](#discovery-locations)
|
|
23
|
+
- [Creating a Skill](#creating-a-skill)
|
|
24
|
+
- [Automatic Activation](#automatic-activation)
|
|
21
25
|
- [Tools](#tools)
|
|
22
26
|
- [gitingest](#gitingest)
|
|
23
27
|
- [prompt-session](#prompt-session)
|
|
@@ -117,15 +121,148 @@ Shows stats overview, commits, files changed, and full diff between branches.
|
|
|
117
121
|
|
|
118
122
|
## Skills
|
|
119
123
|
|
|
120
|
-
Skills are loaded on
|
|
124
|
+
Skills are contextual instructions loaded on demand via the `skill` tool. The agent invokes `skill({ name: "skill-name" })` to load the instructions when needed.
|
|
121
125
|
|
|
122
|
-
###
|
|
126
|
+
### Overview
|
|
123
127
|
|
|
124
|
-
|
|
128
|
+
- Skills provide specialized guidance for specific tasks
|
|
129
|
+
- Instructions are loaded only when explicitly requested
|
|
130
|
+
- Multiple skills can exist with the same name; the highest-priority location wins
|
|
125
131
|
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
132
|
+
### Available Skills
|
|
133
|
+
|
|
134
|
+
| Skill | Description |
|
|
135
|
+
|-------|-------------|
|
|
136
|
+
| `ask-questions-if-underspecified` | Clarify requirements before implementing. Use when serious doubts arise. |
|
|
137
|
+
| `tdd` | Apply Test-Driven Development workflow for new features and bugfixes. |
|
|
138
|
+
|
|
139
|
+
#### Example: ask-questions-if-underspecified
|
|
140
|
+
|
|
141
|
+
**User request:**
|
|
142
|
+
> "Add authentication to the API"
|
|
143
|
+
|
|
144
|
+
**Agent response (after loading the skill):**
|
|
145
|
+
|
|
146
|
+
The agent recognizes this request has multiple interpretations and uses the `question` tool:
|
|
147
|
+
|
|
148
|
+
```
|
|
149
|
+
┌─ Authentication Approach ────────────────────────────────────────┐
|
|
150
|
+
│ │
|
|
151
|
+
│ Which authentication method should be implemented? │
|
|
152
|
+
│ │
|
|
153
|
+
│ ○ JWT tokens (Recommended) │
|
|
154
|
+
│ ○ Session-based with cookies │
|
|
155
|
+
│ ○ OAuth 2.0 / OpenID Connect │
|
|
156
|
+
│ ○ API keys │
|
|
157
|
+
│ ○ Other │
|
|
158
|
+
│ │
|
|
159
|
+
└──────────────────────────────────────────────────────────────────┘
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
After the user selects "JWT tokens", the agent confirms:
|
|
163
|
+
|
|
164
|
+
> "I'll add JWT-based authentication to the API endpoints using the existing Express middleware pattern. Success = all `/api/*` routes require a valid token, with a `/auth/login` endpoint for token generation."
|
|
165
|
+
|
|
166
|
+
Then implementation begins.
|
|
167
|
+
|
|
168
|
+
#### Example: tdd
|
|
169
|
+
|
|
170
|
+
**User request:**
|
|
171
|
+
> "Add a function to calculate the total price with tax"
|
|
172
|
+
|
|
173
|
+
**Agent response (after loading the skill):**
|
|
174
|
+
|
|
175
|
+
The agent follows the TDD workflow:
|
|
176
|
+
|
|
177
|
+
1. **Requirement Synthesis:**
|
|
178
|
+
> "I'll create a function that calculates total price with tax. It should accept a price and tax rate, returning the total."
|
|
179
|
+
|
|
180
|
+
2. **Test Specification:**
|
|
181
|
+
```typescript
|
|
182
|
+
describe("calculateTotalWithTax", () => {
|
|
183
|
+
it("should add tax to the base price", () => {
|
|
184
|
+
expect(calculateTotalWithTax(100, 0.2)).toBe(120)
|
|
185
|
+
})
|
|
186
|
+
|
|
187
|
+
it("should handle zero tax rate", () => {
|
|
188
|
+
expect(calculateTotalWithTax(100, 0)).toBe(100)
|
|
189
|
+
})
|
|
190
|
+
})
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
3. **Implementation:**
|
|
194
|
+
```typescript
|
|
195
|
+
function calculateTotalWithTax(price: number, taxRate: number): number {
|
|
196
|
+
return price * (1 + taxRate)
|
|
197
|
+
}
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
The tests are written first (red), then the minimal implementation to pass them (green).
|
|
201
|
+
|
|
202
|
+
### Discovery Locations
|
|
203
|
+
|
|
204
|
+
Skills are discovered from the following locations, in order of increasing priority:
|
|
205
|
+
|
|
206
|
+
| Priority | Scope | Location |
|
|
207
|
+
|----------|-------|----------|
|
|
208
|
+
| 1 (lowest) | plugin | `<plugin>/skill/` |
|
|
209
|
+
| 2 | global | `~/.config/opencode/skill/` |
|
|
210
|
+
| 3 (highest) | project | `<project>/.opencode/skill/` |
|
|
211
|
+
|
|
212
|
+
If multiple skills share the same name, the one from the highest-priority location takes precedence.
|
|
213
|
+
|
|
214
|
+
### Creating a Skill
|
|
215
|
+
|
|
216
|
+
Each skill lives in its own directory with a `SKILL.md` file:
|
|
217
|
+
|
|
218
|
+
```
|
|
219
|
+
skill/
|
|
220
|
+
└── my-skill/
|
|
221
|
+
└── SKILL.md
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
The `SKILL.md` file uses YAML frontmatter for metadata:
|
|
225
|
+
|
|
226
|
+
```markdown
|
|
227
|
+
---
|
|
228
|
+
name: my-skill
|
|
229
|
+
description: Short description of the skill (required)
|
|
230
|
+
use_when: >
|
|
231
|
+
Condition for automatic activation (optional).
|
|
232
|
+
---
|
|
233
|
+
|
|
234
|
+
# Detailed Instructions
|
|
235
|
+
|
|
236
|
+
Markdown content with step-by-step guidance...
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
#### Frontmatter Fields
|
|
240
|
+
|
|
241
|
+
| Field | Required | Description |
|
|
242
|
+
|-------|----------|-------------|
|
|
243
|
+
| `name` | Yes | Unique identifier for the skill |
|
|
244
|
+
| `description` | Yes | Short description (displayed in skill listings) |
|
|
245
|
+
| `use_when` | No | Condition for automatic activation |
|
|
246
|
+
|
|
247
|
+
A skill without `name` or `description` will be ignored.
|
|
248
|
+
|
|
249
|
+
### Automatic Activation
|
|
250
|
+
|
|
251
|
+
If a skill defines `use_when`, a directive is injected into the system prompt:
|
|
252
|
+
|
|
253
|
+
```
|
|
254
|
+
MANDATORY: Call skill({ name: "my-skill" }) <use_when content>
|
|
255
|
+
```
|
|
256
|
+
|
|
257
|
+
This instructs the agent to load the skill when the specified condition is met.
|
|
258
|
+
|
|
259
|
+
**What is injected:**
|
|
260
|
+
- The skill `name`
|
|
261
|
+
- The `use_when` text (normalized: multiple spaces collapsed to single space)
|
|
262
|
+
|
|
263
|
+
**What is NOT injected:**
|
|
264
|
+
- The `description`
|
|
265
|
+
- The markdown content (loaded only when the skill is invoked)
|
|
129
266
|
|
|
130
267
|
---
|
|
131
268
|
|
package/agent/code-simplifier.md
CHANGED
|
@@ -26,6 +26,7 @@ You do not introduce new features, fix bugs, or change logic. You only improve h
|
|
|
26
26
|
|
|
27
27
|
### 2. Scope discipline
|
|
28
28
|
- Only simplify code that was **modified or introduced in the current session**.
|
|
29
|
+
- This includes **untracked files** (new files not yet committed) listed in the working tree.
|
|
29
30
|
- Do not refactor adjacent or pre-existing code unless strictly required to simplify the modified section.
|
|
30
31
|
- No cross-file refactors unless the change itself spans multiple files.
|
|
31
32
|
|
|
@@ -61,11 +62,12 @@ Apply simplifications only when they clearly improve readability or maintainabil
|
|
|
61
62
|
|
|
62
63
|
## Execution process
|
|
63
64
|
|
|
64
|
-
1. Identify code that was added or modified in the current session
|
|
65
|
-
2.
|
|
66
|
-
3.
|
|
67
|
-
4.
|
|
68
|
-
5.
|
|
65
|
+
1. Identify code that was added or modified in the current session, **including untracked files listed in the diff**.
|
|
66
|
+
2. **Read the content of untracked files** using the Read tool before analyzing them.
|
|
67
|
+
3. Analyze the code for unnecessary complexity, redundancy, or unclear structure.
|
|
68
|
+
4. Apply minimal, behavior-preserving refinements.
|
|
69
|
+
5. Re-check that functionality, outputs, and side effects are unchanged.
|
|
70
|
+
6. Produce the simplified code.
|
|
69
71
|
|
|
70
72
|
## Output requirements
|
|
71
73
|
|
package/command/commit-push.md
CHANGED
|
@@ -9,7 +9,7 @@ agent: build
|
|
|
9
9
|
|
|
10
10
|
## Your task
|
|
11
11
|
|
|
12
|
-
1.
|
|
12
|
+
1. /diff-summary to analyze all working tree changes
|
|
13
13
|
2. Present a summary to the user:
|
|
14
14
|
- Files modified/added/deleted with stats
|
|
15
15
|
- Proposed commit message based on the changes
|
package/command/diff-summary.md
CHANGED
|
@@ -43,9 +43,8 @@ else
|
|
|
43
43
|
git diff
|
|
44
44
|
|
|
45
45
|
echo ""
|
|
46
|
-
echo "## Untracked Files
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
done
|
|
46
|
+
echo "## Untracked Files (new)"
|
|
47
|
+
echo "These files are new and not yet tracked by git. Read them directly to see their content."
|
|
48
|
+
git ls-files --others --exclude-standard
|
|
50
49
|
fi
|
|
51
50
|
'`
|
package/command/release.md
CHANGED
|
@@ -4,8 +4,7 @@ description: Prepare and execute a release with version bumping, changelog updat
|
|
|
4
4
|
|
|
5
5
|
## Context
|
|
6
6
|
|
|
7
|
-
- Current version: !`
|
|
8
|
-
- Latest tag: !`git describe --tags --abbrev=0 2>/dev/null || echo "none"`
|
|
7
|
+
- Current version: !`git describe --tags --abbrev=0 2>/dev/null || echo "0.0.0"`
|
|
9
8
|
- Commits since last tag: !`git log $(git describe --tags --abbrev=0 2>/dev/null || echo "HEAD~10")..HEAD --oneline 2>/dev/null || git log --oneline -10`
|
|
10
9
|
|
|
11
10
|
## CRITICAL CONSTRAINT
|
|
@@ -20,8 +19,8 @@ Any destructive or remote action requires confirmation, including:
|
|
|
20
19
|
|
|
21
20
|
### Step 1: Determine last released version
|
|
22
21
|
|
|
23
|
-
1.
|
|
24
|
-
2. If no
|
|
22
|
+
1. Use the latest Git tag that matches `v<semver>` or `<semver>`.
|
|
23
|
+
2. If no tag exists, consider this the first release (`0.0.0`).
|
|
25
24
|
3. Collect commits since the last version (tag to `HEAD`).
|
|
26
25
|
|
|
27
26
|
### Step 2: Propose version bump
|
|
@@ -35,10 +34,16 @@ Present the recommendation and ask the user to confirm before changing any files
|
|
|
35
34
|
|
|
36
35
|
### Step 3: Update release artifacts (after confirmation)
|
|
37
36
|
|
|
38
|
-
- Update the version in `package.json`.
|
|
39
37
|
- Update `CHANGELOG` with a new section for the version.
|
|
40
38
|
- Summarize changes based on the commit range.
|
|
41
39
|
- Preserve the existing changelog format.
|
|
40
|
+
- Auto-detect and update the version file if present:
|
|
41
|
+
- Node.js: `package.json`
|
|
42
|
+
- Python: `pyproject.toml` or `setup.py`
|
|
43
|
+
- Rust: `Cargo.toml`
|
|
44
|
+
- PHP: `composer.json`
|
|
45
|
+
- Ruby: `*.gemspec`
|
|
46
|
+
- Go: tags only (no version file)
|
|
42
47
|
|
|
43
48
|
### Step 4: Tag and publish (after confirmation)
|
|
44
49
|
|
|
@@ -16,7 +16,8 @@ agent: code-reviewer
|
|
|
16
16
|
!`git diff --stat`
|
|
17
17
|
!`git diff`
|
|
18
18
|
|
|
19
|
-
## Untracked Files
|
|
20
|
-
|
|
19
|
+
## Untracked Files (new)
|
|
20
|
+
These files are new and not yet tracked by git. Read them directly to see their content.
|
|
21
|
+
!`git ls-files --others --exclude-standard`
|
|
21
22
|
|
|
22
23
|
Review the above changes for quality, correctness, and adherence to project guidelines.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "opencode-froggy",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.10.0",
|
|
4
4
|
"description": "OpenCode plugin with a hook layer (tool.before.*, session.idle...), agents (code-reviewer, doc-writer), and commands (/review-pr, /commit)",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: tdd
|
|
3
|
+
description: Apply Test-Driven Development workflow for new features and bugfixes.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# TDD Protocol
|
|
7
|
+
|
|
8
|
+
## Core Principle
|
|
9
|
+
|
|
10
|
+
- **TDD First**: Test-Driven Development is the default approach.
|
|
11
|
+
- **Goal**: Prioritize behavioral correctness and regression safety over formal compliance.
|
|
12
|
+
|
|
13
|
+
## Workflow
|
|
14
|
+
|
|
15
|
+
1. **Requirement Synthesis**: Briefly summarize the requirements before coding.
|
|
16
|
+
2. **Test Specification**: Write tests describing the expected behavior (unit, integration, or E2E).
|
|
17
|
+
3. **Implementation**: Update the logic only to the extent required to satisfy those tests.
|
|
18
|
+
|
|
19
|
+
## Mandatory Rules
|
|
20
|
+
|
|
21
|
+
- **No Test, No Code**: Every new feature or bugfix must include relevant test coverage.
|
|
22
|
+
- **Black-Box Testing**: Validate observable behavior, not internal implementation details.
|
|
23
|
+
- **Merge Requirement**: Tests are mandatory for completion unless an explicit exception is documented.
|
|
24
|
+
|
|
25
|
+
## Preferred Practice
|
|
26
|
+
|
|
27
|
+
- **Red-Green-Refactor**: Start with a failing test whenever practical.
|
|
28
|
+
- **Right-Sized Testing**:
|
|
29
|
+
- **Unit Tests**: For pure logic and isolated functions.
|
|
30
|
+
- **Integration Tests**: For system interactions and API boundaries.
|
|
31
|
+
- **E2E Tests**: For critical user journeys and "happy paths."
|
|
32
|
+
|
|
33
|
+
## Explicit Exceptions (Must be justified)
|
|
34
|
+
|
|
35
|
+
- Pure refactoring (where behavior remains identical).
|
|
36
|
+
- Exploratory spikes or R&D.
|
|
37
|
+
- UI/Styling iterations where unit tests offer diminishing returns.
|
|
38
|
+
- Complex integrations where mocking is counterproductive.
|
|
39
|
+
- Emergency hotfixes (requires a follow-up ticket for test debt).
|
|
40
|
+
|
|
41
|
+
## Quality Bar
|
|
42
|
+
|
|
43
|
+
- **Readability**: Tests must serve as documentation for the feature.
|
|
44
|
+
- **Reliability**: Tests must be deterministic (no flakes) and decoupled from implementation internals.
|