opencode-plugin-coding 0.1.2

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.

Potentially problematic release.


This version of opencode-plugin-coding might be problematic. Click here for more details.

@@ -0,0 +1,184 @@
1
+ # Security Reviewer Guide
2
+
3
+ Applies to the dedicated security reviewer agent. In v1, this reviewer runs **pre-merge only** — after code-review rounds converge and immediately before the merge decision.
4
+
5
+ ---
6
+
7
+ ## Purpose
8
+
9
+ The security reviewer provides a focused security analysis of the PR diff. It can **block** the merge if critical security issues are found. This is a specialized role — it does not replace the security aspects of core/normal reviewers but adds a dedicated, thorough security pass that runs after all code-review rounds have converged.
10
+
11
+ ---
12
+
13
+ ## Critical Constraints
14
+
15
+ - **Repository:** Use the repo name from `.opencode/workflow.json` → `project.repo`
16
+ - **Substitute all placeholders:** `PR_NUMBER`, `BRANCH`, `ROUND`, `MODEL_ID`, `SHA`
17
+ - **Timing:** Pre-merge only (runs after code-review rounds converge, immediately before merge decision)
18
+ - **Allowed bash commands:** `gh api *`, `gh pr view *`, `gh pr diff *`
19
+
20
+ ---
21
+
22
+ ## Comment Format (Required)
23
+
24
+ Every comment must start with:
25
+
26
+ ```
27
+ **[Security] <your-model-id>:**
28
+ ```
29
+
30
+ Example: `**[Security] github-copilot/claude-sonnet-4.6:**`
31
+
32
+ ---
33
+
34
+ ## Workflow
35
+
36
+ ### Step 1: Read project context
37
+
38
+ ```bash
39
+ gh api repos/<REPO>/contents/AGENTS.md --jq '.content' | base64 -d
40
+ ```
41
+
42
+ Read any security-relevant docs from `workflow.json` → `docsToRead`.
43
+
44
+ ### Step 2: Read the PR diff
45
+
46
+ ```bash
47
+ gh pr view $PR_NUMBER --json title,body,headRefName,headRefOid,files
48
+ gh pr diff $PR_NUMBER
49
+ ```
50
+
51
+ ### Step 3: Security analysis
52
+
53
+ Perform a systematic security review across these categories:
54
+
55
+ #### Input Validation
56
+ - User input sanitization and validation
57
+ - SQL/NoSQL injection vectors
58
+ - XSS (cross-site scripting) opportunities
59
+ - Command injection via unsanitized shell inputs
60
+ - Path traversal vulnerabilities
61
+
62
+ #### Authentication & Authorization
63
+ - Auth bypass opportunities
64
+ - Missing or incorrect permission checks
65
+ - Token/session handling issues
66
+ - Privilege escalation paths
67
+
68
+ #### Data Protection
69
+ - Sensitive data exposure (logs, error messages, API responses)
70
+ - Missing encryption for sensitive data at rest or in transit
71
+ - Hardcoded secrets, API keys, or credentials
72
+ - PII handling compliance
73
+
74
+ #### Dependency & Supply Chain
75
+ - Known vulnerable dependencies being added
76
+ - Unsafe use of `eval()`, `Function()`, or dynamic code execution
77
+ - Unsafe deserialization
78
+
79
+ #### API & Network
80
+ - Missing rate limiting on sensitive endpoints
81
+ - CORS misconfiguration
82
+ - Insecure HTTP methods or headers
83
+ - Missing CSRF protection
84
+
85
+ #### Error Handling
86
+ - Information leakage through error messages
87
+ - Unhandled errors that could cause denial of service
88
+ - Error conditions that bypass security controls
89
+
90
+ ### Step 4: Classify findings
91
+
92
+ | Severity | Criteria | Action |
93
+ |----------|----------|--------|
94
+ | **Critical** | Exploitable vulnerability, data breach risk, auth bypass | **Blocks** merge — must be fixed first |
95
+ | **High** | Significant security weakness, requires attacker effort | **Blocks** merge |
96
+ | **Medium** | Defense-in-depth issue, hardening opportunity | **Advisory** — reported but does not block |
97
+ | **Low** | Best practice, minor hardening | **Advisory** |
98
+ | **Info** | Observation, no direct risk | **Advisory** |
99
+
100
+ ### Step 5: Post review
101
+
102
+ ```bash
103
+ COMMIT_SHA=$(gh pr view $PR_NUMBER --json headRefOid --jq '.headRefOid')
104
+ ```
105
+
106
+ **If you found security issues**, post findings with inline comments:
107
+
108
+ ```bash
109
+ gh api repos/<REPO>/pulls/$PR_NUMBER/reviews \
110
+ --method POST \
111
+ --header "Content-Type: application/json" \
112
+ --input - <<'EOF'
113
+ {
114
+ "commit_id": "ACTUAL_SHA",
115
+ "event": "COMMENT",
116
+ "body": "**[Security] model-id:**\n\n### Overall Risk: MEDIUM / HIGH / CRITICAL\n\n### Findings\n1. [Critical/High/Medium/Low/Info] ...\n\n### Verdict: BLOCK",
117
+ "comments": [
118
+ {
119
+ "path": "src/path/to/file.ts",
120
+ "line": 42,
121
+ "side": "RIGHT",
122
+ "body": "**[Security] model-id:**\n[Severity] <description>"
123
+ }
124
+ ]
125
+ }
126
+ EOF
127
+ ```
128
+
129
+ **If you found NO security issues**, you **must still post a review** — post PASS:
130
+
131
+ ```bash
132
+ gh api repos/<REPO>/pulls/$PR_NUMBER/reviews \
133
+ --method POST \
134
+ --header "Content-Type: application/json" \
135
+ --input - <<'EOF'
136
+ {
137
+ "commit_id": "ACTUAL_SHA",
138
+ "event": "COMMENT",
139
+ "body": "**[Security] model-id:** PASS — no security issues found"
140
+ }
141
+ EOF
142
+ ```
143
+
144
+ Do **not** summarize what the PR does or describe the changes. The review body contains **only** findings + verdict, or PASS — nothing else.
145
+
146
+ **Rules:**
147
+
148
+ - `event`: always `"COMMENT"` — never `"APPROVE"` or `"REQUEST_CHANGES"`
149
+ - `body` (review summary): **must never be empty** — write findings + verdict, or PASS
150
+ - `line`: must be a line number present in the **diff hunk RIGHT side** — see validation step below
151
+ - `side`: `"RIGHT"` always
152
+ - Omit `comments` array entirely when no inline comments
153
+ - Use `<<'EOF'` (single-quoted) so the shell does not expand `$` inside JSON
154
+
155
+ #### Validate line numbers before posting
156
+
157
+ For each inline comment, confirm the target line appears in the diff. Run `gh pr diff $PR_NUMBER` and find the file's hunk. Only lines with a `+` prefix (added) or ` ` prefix (context) on the RIGHT side are valid targets. Lines with `-` prefix (removed) are LEFT-side only and will cause a posting error. If the line number is not in any hunk, the GitHub API will reject the comment — **do not guess line numbers from the full file**; use only lines visible in the diff output.
158
+
159
+ #### Verify posting succeeded
160
+
161
+ Check that the response contains `"id":`. If absent or errored, retry once using the `--field` form. Report success/failure — **do not silently discard findings**.
162
+
163
+ ---
164
+
165
+ ## Conciseness Rules (Strictly Enforced)
166
+
167
+ - Each inline comment: **1–3 sentences max**
168
+ - Summary: **findings + verdict only, or PASS** — no PR description, no preambles
169
+ - Do **not** summarize what the PR does — report security findings only
170
+ - No duplicate posts
171
+
172
+ ---
173
+
174
+ ## Output to Orchestrator
175
+
176
+ Return exactly:
177
+
178
+ 1. **Overall risk level:** LOW / MEDIUM / HIGH / CRITICAL
179
+ 2. **Verdict:** PASS or BLOCK
180
+ 3. **Critical/High findings** — count + one-line description of each (these block)
181
+ 4. **Medium/Low/Info findings** — count + one-line description of each (advisory)
182
+ 5. **Posting status** — review ID if succeeded, or failure description
183
+
184
+ If verdict is **BLOCK**, the orchestrator sends critical/high findings to `core-coder` for fixes, then returns to Phase 3 (code review). After code-review rounds converge again, the security review re-runs.
package/package.json ADDED
@@ -0,0 +1,19 @@
1
+ {
2
+ "name": "opencode-plugin-coding",
3
+ "version": "0.1.2",
4
+ "description": "A shared OpenCode plugin for multi-agent software development workflows: brainstorm, plan, orchestrate, review, debug.",
5
+ "type": "module",
6
+ "main": ".opencode/plugins/opencode-plugin-coding.js",
7
+ "license": "MIT",
8
+ "files": [
9
+ ".opencode/plugins/",
10
+ "commands/",
11
+ "guides/",
12
+ "skills/",
13
+ "templates/"
14
+ ],
15
+ "repository": {
16
+ "type": "git",
17
+ "url": "git@github.com:ZooplanktonAI/opencode-plugin-coding.git"
18
+ }
19
+ }
@@ -0,0 +1,143 @@
1
+ ---
2
+ name: brainstorm
3
+ description: Socratic design interview that refines rough ideas into a validated design document before implementation begins.
4
+ ---
5
+
6
+ # Brainstorm
7
+
8
+ A Socratic design interview that takes a rough idea and refines it into a clear, validated design document. Use this skill before `plan` to ensure the approach is sound before committing to implementation.
9
+
10
+ Inspired by Prometheus planning from Oh-My-OpenAgent and the brainstorming skill from Superpowers.
11
+
12
+ ---
13
+
14
+ ## When to Activate
15
+
16
+ - User has a vague feature idea or request
17
+ - User says "brainstorm", "design", "think through", "explore options"
18
+ - Before a complex task where the approach is not obvious
19
+ - The orchestrator defers to brainstorm before planning
20
+
21
+ ---
22
+
23
+ ## Process
24
+
25
+ ### Phase 1: Understand the Problem
26
+
27
+ Ask clarifying questions to understand:
28
+
29
+ 1. **What** — What is the user trying to achieve? What problem does this solve?
30
+ 2. **Why** — Why is this needed now? What's the motivation?
31
+ 3. **Who** — Who is the target user? What's their workflow?
32
+ 4. **Constraints** — What are hard constraints (timeline, compatibility, tech stack)?
33
+
34
+ **Rules:**
35
+ - Ask **at most 3 questions per round** — do not overwhelm
36
+ - If the user's intent is already clear, skip to Phase 2
37
+ - Acknowledge what you understand before asking follow-ups
38
+
39
+ ### Phase 2: Explore the Design Space
40
+
41
+ Investigate the codebase to understand the current state:
42
+
43
+ ```bash
44
+ # Read project context
45
+ cat AGENTS.md
46
+ # Read relevant source files
47
+ # Search for related existing code
48
+ ```
49
+
50
+ Then present **2–3 concrete approaches**, each with:
51
+
52
+ - **Approach name** — brief label
53
+ - **How it works** — 2-3 sentences
54
+ - **Pros** — key advantages
55
+ - **Cons** — key disadvantages
56
+ - **Effort estimate** — small / medium / large
57
+
58
+ Ask the user which direction they prefer, or if they want to explore a different option.
59
+
60
+ ### Phase 3: Deep Dive
61
+
62
+ Once a direction is chosen:
63
+
64
+ 1. **Architecture** — How does this fit into the existing codebase? What modules are affected?
65
+ 2. **Data model** — What data structures or schemas change?
66
+ 3. **API surface** — What interfaces change? New endpoints, new props, new methods?
67
+ 4. **Edge cases** — What could go wrong? What are the boundary conditions?
68
+ 5. **Testing strategy** — How will this be verified?
69
+
70
+ Present the deep dive and ask for confirmation or adjustments.
71
+
72
+ ### Phase 4: Write Design Document
73
+
74
+ Produce a design document and **write it to disk** at `.opencode/designs/<feature-name>.md`:
75
+
76
+ ```markdown
77
+ ---
78
+ status: draft
79
+ created: <date>
80
+ author: brainstorm
81
+ ---
82
+
83
+ # Design: <Feature Name>
84
+
85
+ ## Problem Statement
86
+ <1-2 sentences>
87
+
88
+ ## Chosen Approach
89
+ <name and brief description>
90
+
91
+ ## Architecture
92
+ <how it fits into the codebase>
93
+
94
+ ## Data Model Changes
95
+ <schema changes, new types, etc.>
96
+
97
+ ## API Surface Changes
98
+ <new/modified interfaces>
99
+
100
+ ## Edge Cases and Risks
101
+ <list>
102
+
103
+ ## Testing Strategy
104
+ <how to verify>
105
+
106
+ ## Estimated Scope
107
+ <small / medium / large>
108
+
109
+ ## Open Questions
110
+ <anything still unresolved>
111
+ ```
112
+
113
+ ### Phase 5: Validate
114
+
115
+ Before finalizing, self-review the design:
116
+
117
+ - [ ] Does the design address the original problem?
118
+ - [ ] Are there any placeholder or vague sections?
119
+ - [ ] Is the scope realistic?
120
+ - [ ] Are edge cases covered?
121
+ - [ ] Is the testing strategy concrete?
122
+
123
+ If issues are found, revise and present the updated version.
124
+
125
+ ---
126
+
127
+ ## Output
128
+
129
+ Return to the user (or orchestrator):
130
+
131
+ 1. **Design document path** — `.opencode/designs/<feature-name>.md`
132
+ 2. **Recommended next step** — typically "Run the `plan` skill to decompose this into implementation tasks"
133
+ 3. **Open questions** — anything that needs user input before planning
134
+
135
+ ---
136
+
137
+ ## Interaction Style
138
+
139
+ - Be a thoughtful collaborator, not a yes-machine
140
+ - Challenge assumptions when they seem risky
141
+ - Suggest simpler alternatives when the user is over-engineering
142
+ - Keep each response focused — don't dump everything at once
143
+ - Use concrete code examples when discussing architecture
@@ -0,0 +1,137 @@
1
+ ---
2
+ name: git-worktree
3
+ description: Create and manage isolated git worktrees for parallel development. Set up before orchestrate, clean up after merge.
4
+ ---
5
+
6
+ # Git Worktree
7
+
8
+ Manage isolated git worktrees for the multi-agent workflow. Each agent works in its own worktree to avoid conflicts. Read agent names from `workflow.json` → `agents` (each entry is a `{ name, model }` object — use `.name` for paths).
9
+
10
+ ---
11
+
12
+ ## When to Activate
13
+
14
+ - Before `orchestrate` — ensure worktrees exist
15
+ - After merge — clean up worktree state
16
+ - User asks to set up or reset worktrees
17
+
18
+ ---
19
+
20
+ ## Worktree Layout
21
+
22
+ | Agent | Path | Purpose |
23
+ |-------|------|---------|
24
+ | `coreCoder` | `.worktrees/<coreCoder.name>` | Implementation workspace |
25
+ | Each entry in `coreReviewers` | `.worktrees/<entry.name>` | Code review with full verification |
26
+
27
+ Normal reviewers do **not** need worktrees — they use `gh pr diff` (read-only).
28
+
29
+ ---
30
+
31
+ ## Setup
32
+
33
+ ### Create worktrees (idempotent)
34
+
35
+ Read `agents.coreCoder.name` and each `agents.coreReviewers[i].name` from `workflow.json`. For each, create a worktree if it doesn't exist:
36
+
37
+ ```bash
38
+ # For coreCoder.name:
39
+ ls .worktrees/<coreCoder.name> 2>/dev/null || git worktree add --detach .worktrees/<coreCoder.name>
40
+
41
+ # For each entry in coreReviewers:
42
+ ls .worktrees/<entry.name> 2>/dev/null || git worktree add --detach .worktrees/<entry.name>
43
+ ```
44
+
45
+ ### Ensure .gitignore entry
46
+
47
+ `.worktrees/` must be in `.gitignore`. The `/zooplankton-coding-init` command handles this automatically.
48
+
49
+ ### Install dependencies (if needed)
50
+
51
+ After creating a new worktree, install dependencies:
52
+
53
+ ```bash
54
+ cd .worktrees/<agent-name> && <packageManager> install
55
+ ```
56
+
57
+ Core reviewer worktrees also need dependencies for running verification commands.
58
+
59
+ ---
60
+
61
+ ## Before Each Task
62
+
63
+ Clean and sync each worktree before use:
64
+
65
+ ```bash
66
+ cd .worktrees/<agent-name>
67
+
68
+ # Abort any in-progress operations
69
+ git merge --abort 2>/dev/null
70
+ git rebase --abort 2>/dev/null
71
+ git cherry-pick --abort 2>/dev/null
72
+
73
+ # Discard uncommitted changes
74
+ git checkout -- . 2>/dev/null
75
+ git clean -fd
76
+
77
+ # Fetch latest
78
+ git fetch origin
79
+ ```
80
+
81
+ For **core-coder**, create a feature branch:
82
+
83
+ ```bash
84
+ git checkout -B <username>--<branch-name> origin/<defaultBranch>
85
+ ```
86
+
87
+ For **core-reviewers**, check out the PR branch:
88
+
89
+ ```bash
90
+ git checkout --detach origin/<pr-branch>
91
+ ```
92
+
93
+ ---
94
+
95
+ ## After Merge
96
+
97
+ Detach all worktrees so the feature branch can be deleted:
98
+
99
+ ```bash
100
+ # For coreCoder.name:
101
+ git -C .worktrees/<coreCoder.name> checkout --detach HEAD
102
+
103
+ # For each entry in coreReviewers:
104
+ git -C .worktrees/<entry.name> checkout --detach HEAD
105
+ ```
106
+
107
+ Then delete the branch locally and remotely (handled by the `orchestrate` skill).
108
+
109
+ ---
110
+
111
+ ## Troubleshooting
112
+
113
+ ### Worktree locked
114
+
115
+ ```bash
116
+ git worktree unlock .worktrees/<name>
117
+ ```
118
+
119
+ ### Worktree directory exists but is not a valid worktree
120
+
121
+ ```bash
122
+ git worktree remove .worktrees/<name> --force
123
+ git worktree add --detach .worktrees/<name>
124
+ ```
125
+
126
+ ### Cannot delete branch because it's checked out in a worktree
127
+
128
+ Detach the worktree first (see "After Merge" above).
129
+
130
+ ---
131
+
132
+ ## Rules
133
+
134
+ - **Never work on the default branch** in any worktree — always create or checkout a feature/PR branch
135
+ - **Always clean before use** — stale state from a previous task can cause subtle bugs
136
+ - **Worktrees are persistent** — don't recreate them between tasks, just clean and re-checkout
137
+ - **`.worktrees/` is always gitignored** — never commit worktree directories