@horizon-ai-dev/shokunin 0.1.0-alpha.1
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/LICENSE +9 -0
- package/README.md +236 -0
- package/dist/agents/sn-code-reviewer.d.ts +13 -0
- package/dist/agents/sn-code-reviewer.d.ts.map +1 -0
- package/dist/agents/sn-code-reviewer.js +75 -0
- package/dist/agents/sn-code-reviewer.js.map +1 -0
- package/dist/agents/sn-code-simplifier.d.ts +13 -0
- package/dist/agents/sn-code-simplifier.d.ts.map +1 -0
- package/dist/agents/sn-code-simplifier.js +70 -0
- package/dist/agents/sn-code-simplifier.js.map +1 -0
- package/dist/agents/sn-comment-analyzer.d.ts +12 -0
- package/dist/agents/sn-comment-analyzer.d.ts.map +1 -0
- package/dist/agents/sn-comment-analyzer.js +65 -0
- package/dist/agents/sn-comment-analyzer.js.map +1 -0
- package/dist/agents/sn-pr-test-analyzer.d.ts +12 -0
- package/dist/agents/sn-pr-test-analyzer.d.ts.map +1 -0
- package/dist/agents/sn-pr-test-analyzer.js +78 -0
- package/dist/agents/sn-pr-test-analyzer.js.map +1 -0
- package/dist/agents/sn-silent-failure-hunter.d.ts +12 -0
- package/dist/agents/sn-silent-failure-hunter.d.ts.map +1 -0
- package/dist/agents/sn-silent-failure-hunter.js +84 -0
- package/dist/agents/sn-silent-failure-hunter.js.map +1 -0
- package/dist/agents/sn-skill-reviewer.d.ts +12 -0
- package/dist/agents/sn-skill-reviewer.d.ts.map +1 -0
- package/dist/agents/sn-skill-reviewer.js +93 -0
- package/dist/agents/sn-skill-reviewer.js.map +1 -0
- package/dist/agents/sn-type-design-analyzer.d.ts +12 -0
- package/dist/agents/sn-type-design-analyzer.d.ts.map +1 -0
- package/dist/agents/sn-type-design-analyzer.js +109 -0
- package/dist/agents/sn-type-design-analyzer.js.map +1 -0
- package/dist/commands/sn-check-config.d.ts +23 -0
- package/dist/commands/sn-check-config.d.ts.map +1 -0
- package/dist/commands/sn-check-config.js +230 -0
- package/dist/commands/sn-check-config.js.map +1 -0
- package/dist/commands/sn-configure.d.ts +27 -0
- package/dist/commands/sn-configure.d.ts.map +1 -0
- package/dist/commands/sn-configure.js +273 -0
- package/dist/commands/sn-configure.js.map +1 -0
- package/dist/commands/sn-review-pr.d.ts +16 -0
- package/dist/commands/sn-review-pr.d.ts.map +1 -0
- package/dist/commands/sn-review-pr.js +113 -0
- package/dist/commands/sn-review-pr.js.map +1 -0
- package/dist/commands/sn-update.d.ts +23 -0
- package/dist/commands/sn-update.d.ts.map +1 -0
- package/dist/commands/sn-update.js +202 -0
- package/dist/commands/sn-update.js.map +1 -0
- package/dist/context/shokunin-rules.d.ts +26 -0
- package/dist/context/shokunin-rules.d.ts.map +1 -0
- package/dist/context/shokunin-rules.js +59 -0
- package/dist/context/shokunin-rules.js.map +1 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +8 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/logger.d.ts +50 -0
- package/dist/lib/logger.d.ts.map +1 -0
- package/dist/lib/logger.js +52 -0
- package/dist/lib/logger.js.map +1 -0
- package/dist/lib/smart-merge.d.ts +130 -0
- package/dist/lib/smart-merge.d.ts.map +1 -0
- package/dist/lib/smart-merge.js +368 -0
- package/dist/lib/smart-merge.js.map +1 -0
- package/dist/plugin.d.ts +30 -0
- package/dist/plugin.d.ts.map +1 -0
- package/dist/plugin.js +133 -0
- package/dist/plugin.js.map +1 -0
- package/dist/tools/emergency-stop.d.ts +15 -0
- package/dist/tools/emergency-stop.d.ts.map +1 -0
- package/dist/tools/emergency-stop.js +97 -0
- package/dist/tools/emergency-stop.js.map +1 -0
- package/package.json +46 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Josh Thomas
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
6
|
+
|
|
7
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
8
|
+
|
|
9
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,236 @@
|
|
|
1
|
+
# @horizon-ai-dev/shokunin
|
|
2
|
+
|
|
3
|
+
Complete AI-assisted development workflow plugin for [OpenCode](https://opencode.ai). Packages 7 specialized agents, 4 commands, 1 tool, and 6 bundled skills. Re-exports [opencode-beads](https://github.com/joshuadavidthomas/opencode-beads) for unified experience.
|
|
4
|
+
|
|
5
|
+
## Quick Start
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
# 1. Add to your opencode.json
|
|
9
|
+
{
|
|
10
|
+
"plugin": ["@horizon-ai-dev/shokunin@0.1.0"]
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
# 2. Restart OpenCode and run the configuration wizard
|
|
14
|
+
/sn-configure
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Installation
|
|
18
|
+
|
|
19
|
+
### Step 1: Install Beads CLI
|
|
20
|
+
|
|
21
|
+
Beads CLI is required for task tracking integration:
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
curl -fsSL https://raw.githubusercontent.com/steveyegge/beads/main/scripts/install.sh | bash
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
See the [beads installation guide](https://github.com/steveyegge/beads/blob/main/docs/INSTALLING.md) for alternative methods (Homebrew, Windows, AUR, etc.).
|
|
28
|
+
|
|
29
|
+
### Step 2: Configure OpenCode
|
|
30
|
+
|
|
31
|
+
Add to your OpenCode config (`~/.config/opencode/opencode.json`):
|
|
32
|
+
|
|
33
|
+
```json
|
|
34
|
+
{
|
|
35
|
+
"plugin": ["@horizon-ai-dev/shokunin@0.1.0"]
|
|
36
|
+
}
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
Pin to a specific version to ensure updates work correctly - OpenCode's lockfile won't re-resolve unpinned versions.
|
|
40
|
+
|
|
41
|
+
### Step 3: Run Configuration Wizard
|
|
42
|
+
|
|
43
|
+
After restarting OpenCode, run:
|
|
44
|
+
|
|
45
|
+
```
|
|
46
|
+
/sn-configure
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
This interactive wizard will:
|
|
50
|
+
1. Ask for your preferred AI model configuration
|
|
51
|
+
2. Install and initialize beads if not present
|
|
52
|
+
3. Install beads git hooks for automatic syncing
|
|
53
|
+
4. Configure playwright-mcp for browser testing
|
|
54
|
+
5. Copy bundled skills to your project
|
|
55
|
+
6. Set up model configuration
|
|
56
|
+
7. Add runtime context note to AGENTS.md
|
|
57
|
+
|
|
58
|
+
## Agents
|
|
59
|
+
|
|
60
|
+
Shokunin provides 7 specialized agents for code review and quality analysis:
|
|
61
|
+
|
|
62
|
+
| Agent | Mode | Description |
|
|
63
|
+
|-------|------|-------------|
|
|
64
|
+
| `sn-code-reviewer` | primary | Comprehensive code review - logic, security, performance, maintainability |
|
|
65
|
+
| `sn-code-simplifier` | subagent | Code simplification and readability improvements |
|
|
66
|
+
| `sn-comment-analyzer` | subagent | Comment quality, accuracy, and maintainability analysis |
|
|
67
|
+
| `sn-pr-test-analyzer` | subagent | Test coverage and quality analysis for PR changes |
|
|
68
|
+
| `sn-silent-failure-hunter` | subagent | Detects inadequate error handling and suppressed errors |
|
|
69
|
+
| `sn-type-design-analyzer` | subagent | TypeScript type design quality and encapsulation |
|
|
70
|
+
| `sn-skill-reviewer` | subagent | OpenCode skill quality and best practices review |
|
|
71
|
+
|
|
72
|
+
**Usage:**
|
|
73
|
+
- Press `Tab` to switch to `sn-code-reviewer` for dedicated code review sessions
|
|
74
|
+
- Other agents run as subagents via `/sn-review-pr` command
|
|
75
|
+
|
|
76
|
+
## Commands
|
|
77
|
+
|
|
78
|
+
| Command | Description | Example |
|
|
79
|
+
|---------|-------------|---------|
|
|
80
|
+
| `/sn-configure` | Interactive configuration wizard | `/sn-configure` |
|
|
81
|
+
| `/sn-review-pr` | Comprehensive PR review with multiple agents | `/sn-review-pr all parallel` |
|
|
82
|
+
| `/sn-check-config` | Validate configuration for conflicts | `/sn-check-config --fix` |
|
|
83
|
+
| `/sn-update` | Update skills and config after plugin upgrade | `/sn-update --skills-only` |
|
|
84
|
+
|
|
85
|
+
### /sn-review-pr
|
|
86
|
+
|
|
87
|
+
Orchestrates multiple review agents based on changed files:
|
|
88
|
+
|
|
89
|
+
```bash
|
|
90
|
+
# Auto-detect and run applicable reviews
|
|
91
|
+
/sn-review-pr
|
|
92
|
+
|
|
93
|
+
# Run specific reviews
|
|
94
|
+
/sn-review-pr code tests
|
|
95
|
+
|
|
96
|
+
# Run all reviews in parallel
|
|
97
|
+
/sn-review-pr all parallel
|
|
98
|
+
|
|
99
|
+
# Compare against specific branch
|
|
100
|
+
/sn-review-pr main
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
**Arguments:** `code`, `tests`, `comments`, `errors`, `types`, `simplify`, `all`, `parallel`
|
|
104
|
+
|
|
105
|
+
### /sn-check-config
|
|
106
|
+
|
|
107
|
+
Validates your configuration for potential issues:
|
|
108
|
+
|
|
109
|
+
```bash
|
|
110
|
+
# Check for configuration issues
|
|
111
|
+
/sn-check-config
|
|
112
|
+
|
|
113
|
+
# Auto-fix what can be fixed
|
|
114
|
+
/sn-check-config --fix
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
### /sn-update
|
|
118
|
+
|
|
119
|
+
Updates configuration when the plugin is upgraded:
|
|
120
|
+
|
|
121
|
+
```bash
|
|
122
|
+
# Full update
|
|
123
|
+
/sn-update
|
|
124
|
+
|
|
125
|
+
# Only update skills
|
|
126
|
+
/sn-update --skills-only
|
|
127
|
+
|
|
128
|
+
# Only update config
|
|
129
|
+
/sn-update --config-only
|
|
130
|
+
|
|
131
|
+
# Preview changes without applying
|
|
132
|
+
/sn-update --dry-run
|
|
133
|
+
|
|
134
|
+
# Force overwrite without prompts
|
|
135
|
+
/sn-update --force
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
## Tools
|
|
139
|
+
|
|
140
|
+
### emergency_stop
|
|
141
|
+
|
|
142
|
+
Plays terminal bell to alert users when the LLM needs human input:
|
|
143
|
+
|
|
144
|
+
```
|
|
145
|
+
Use when:
|
|
146
|
+
- Encountering critical decisions requiring human judgment
|
|
147
|
+
- Finding potential security issues that need review
|
|
148
|
+
- Being blocked and cannot proceed without clarification
|
|
149
|
+
- Completing significant milestones that need review
|
|
150
|
+
- Encountering errors that cannot be resolved autonomously
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
**Parameters:**
|
|
154
|
+
- `reason` (required): Why the stop was triggered
|
|
155
|
+
- `urgency`: low (1 bell), medium (3 bells), high (5 bells)
|
|
156
|
+
- `context`: Additional context for the user
|
|
157
|
+
- `repeat_interval_seconds`: Interval for repeat alerts
|
|
158
|
+
- `max_repeats`: Maximum number of repeat alerts
|
|
159
|
+
|
|
160
|
+
## Bundled Skills
|
|
161
|
+
|
|
162
|
+
The plugin includes 6 bundled skills:
|
|
163
|
+
|
|
164
|
+
| Skill | Description |
|
|
165
|
+
|-------|-------------|
|
|
166
|
+
| `prd-generator` | Generate Product Requirements Documents for new features |
|
|
167
|
+
| `prd-decomposition` | Convert PRDs into actionable beads tasks |
|
|
168
|
+
| `agent-development` | Guide for creating OpenCode agents |
|
|
169
|
+
| `command-development` | Guide for creating OpenCode slash commands |
|
|
170
|
+
| `skill-development` | Guide for creating OpenCode skills |
|
|
171
|
+
| `playwright-skill` | Browser automation and testing with Playwright |
|
|
172
|
+
|
|
173
|
+
Skills are copied to `.opencode/skill/` during configuration.
|
|
174
|
+
|
|
175
|
+
## Runtime Context
|
|
176
|
+
|
|
177
|
+
Shokunin injects `<shokunin-rules>` context on session start and after compaction. This provides:
|
|
178
|
+
|
|
179
|
+
- Code quality standards (explicit over implicit, strict mode, small functions)
|
|
180
|
+
- Reference to `/sn-review-pr` and review agents
|
|
181
|
+
- Guidelines for professional code review
|
|
182
|
+
|
|
183
|
+
## Inherited from opencode-beads
|
|
184
|
+
|
|
185
|
+
- **Context injection** - Automatically runs `bd prime` on session start and after compaction
|
|
186
|
+
- **Commands** - All beads operations available as `/bd-*` commands
|
|
187
|
+
- **Task agent** - Autonomous issue completion via `beads-task-agent` subagent
|
|
188
|
+
|
|
189
|
+
See the [beads documentation](https://github.com/steveyegge/beads) for beads workflows and commands.
|
|
190
|
+
|
|
191
|
+
## Advanced Configuration
|
|
192
|
+
|
|
193
|
+
### Model Configuration
|
|
194
|
+
|
|
195
|
+
The `/sn-configure` wizard supports these presets:
|
|
196
|
+
|
|
197
|
+
| Preset | Provider | Model ID |
|
|
198
|
+
|--------|----------|----------|
|
|
199
|
+
| claude-sonnet | Anthropic | claude-sonnet-4-20250514 |
|
|
200
|
+
| claude-opus | Anthropic | claude-opus-4-20250514 |
|
|
201
|
+
| gpt-4o | OpenAI | gpt-4o |
|
|
202
|
+
| gpt-4-turbo | OpenAI | gpt-4-turbo |
|
|
203
|
+
| gemini-flash | Google | gemini-2.0-flash-001 |
|
|
204
|
+
| gemini-pro | Google | gemini-1.5-pro |
|
|
205
|
+
|
|
206
|
+
### MCP Servers
|
|
207
|
+
|
|
208
|
+
The plugin configures `playwright-mcp` for browser testing:
|
|
209
|
+
|
|
210
|
+
```json
|
|
211
|
+
{
|
|
212
|
+
"mcp": {
|
|
213
|
+
"servers": {
|
|
214
|
+
"playwright-mcp": {
|
|
215
|
+
"type": "stdio",
|
|
216
|
+
"command": "npx",
|
|
217
|
+
"args": ["-y", "@anthropic/playwright-mcp"]
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
### Version Tracking
|
|
225
|
+
|
|
226
|
+
Plugin version is tracked in `.opencode/shokunin-version.json` for upgrade management.
|
|
227
|
+
|
|
228
|
+
## License
|
|
229
|
+
|
|
230
|
+
@horizon-ai-dev/shokunin is licensed under the MIT license. See the [`LICENSE`](LICENSE) file for more information.
|
|
231
|
+
|
|
232
|
+
---
|
|
233
|
+
|
|
234
|
+
@horizon-ai-dev/shokunin is built by Horizon AI Dev and is not affiliated with the OpenCode team.
|
|
235
|
+
|
|
236
|
+
OpenCode is 2025 Anomaly.
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* sn-code-reviewer Agent
|
|
3
|
+
*
|
|
4
|
+
* Primary mode agent for comprehensive code review.
|
|
5
|
+
* Users can switch to this agent via Tab to get detailed
|
|
6
|
+
* code review feedback on their changes.
|
|
7
|
+
*/
|
|
8
|
+
import type { Config } from "@opencode-ai/sdk";
|
|
9
|
+
/** Agent name used in OpenCode */
|
|
10
|
+
export declare const AGENT_NAME = "sn-code-reviewer";
|
|
11
|
+
/** Agent configuration for OpenCode */
|
|
12
|
+
export declare const snCodeReviewerAgent: Config["agent"];
|
|
13
|
+
//# sourceMappingURL=sn-code-reviewer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sn-code-reviewer.d.ts","sourceRoot":"","sources":["../../src/agents/sn-code-reviewer.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAE/C,kCAAkC;AAClC,eAAO,MAAM,UAAU,qBAAqB,CAAC;AA2D7C,uCAAuC;AACvC,eAAO,MAAM,mBAAmB,EAAE,MAAM,CAAC,OAAO,CAQ/C,CAAC"}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* sn-code-reviewer Agent
|
|
3
|
+
*
|
|
4
|
+
* Primary mode agent for comprehensive code review.
|
|
5
|
+
* Users can switch to this agent via Tab to get detailed
|
|
6
|
+
* code review feedback on their changes.
|
|
7
|
+
*/
|
|
8
|
+
/** Agent name used in OpenCode */
|
|
9
|
+
export const AGENT_NAME = "sn-code-reviewer";
|
|
10
|
+
/** Code review system prompt */
|
|
11
|
+
const SYSTEM_PROMPT = `You are an expert code reviewer with deep experience across multiple programming languages, frameworks, and paradigms. Your role is to provide thorough, constructive code reviews that help developers write better code.
|
|
12
|
+
|
|
13
|
+
## Review Focus Areas
|
|
14
|
+
|
|
15
|
+
### 1. Logic & Correctness
|
|
16
|
+
- Identify bugs, edge cases, and logical errors
|
|
17
|
+
- Check for off-by-one errors, null/undefined handling
|
|
18
|
+
- Verify algorithm correctness and boundary conditions
|
|
19
|
+
- Look for race conditions and concurrency issues
|
|
20
|
+
|
|
21
|
+
### 2. Security
|
|
22
|
+
- Identify potential security vulnerabilities (injection, XSS, CSRF, etc.)
|
|
23
|
+
- Check for proper input validation and sanitization
|
|
24
|
+
- Review authentication and authorization logic
|
|
25
|
+
- Look for exposed secrets or sensitive data
|
|
26
|
+
- Verify secure communication patterns
|
|
27
|
+
|
|
28
|
+
### 3. Performance
|
|
29
|
+
- Identify performance bottlenecks and inefficiencies
|
|
30
|
+
- Look for unnecessary computations, loops, or allocations
|
|
31
|
+
- Check for N+1 queries and database optimization opportunities
|
|
32
|
+
- Review memory usage and potential leaks
|
|
33
|
+
- Evaluate caching opportunities
|
|
34
|
+
|
|
35
|
+
### 4. Maintainability
|
|
36
|
+
- Assess code readability and clarity
|
|
37
|
+
- Check for proper naming conventions
|
|
38
|
+
- Evaluate function/method length and complexity
|
|
39
|
+
- Look for code duplication (DRY violations)
|
|
40
|
+
- Review error handling consistency
|
|
41
|
+
|
|
42
|
+
### 5. Project Consistency
|
|
43
|
+
- Verify adherence to project coding standards
|
|
44
|
+
- Check for consistent patterns with existing codebase
|
|
45
|
+
- Review proper use of project utilities and abstractions
|
|
46
|
+
- Ensure proper typing (for TypeScript projects)
|
|
47
|
+
|
|
48
|
+
## Review Guidelines
|
|
49
|
+
|
|
50
|
+
- Be constructive and specific - explain WHY something is an issue
|
|
51
|
+
- Prioritize issues by severity (critical > major > minor > suggestion)
|
|
52
|
+
- Acknowledge good patterns and practices when you see them
|
|
53
|
+
- Provide concrete suggestions for improvement
|
|
54
|
+
- Reference file paths and line numbers when possible
|
|
55
|
+
- Consider the context and constraints of the change
|
|
56
|
+
|
|
57
|
+
## Output Format
|
|
58
|
+
|
|
59
|
+
Structure your review with:
|
|
60
|
+
1. **Summary** - Brief overview of the changes and overall assessment
|
|
61
|
+
2. **Critical Issues** - Must-fix problems (bugs, security, etc.)
|
|
62
|
+
3. **Recommendations** - Suggested improvements
|
|
63
|
+
4. **Positive Observations** - Good practices worth noting
|
|
64
|
+
|
|
65
|
+
When reviewing diffs, focus on the changed code but consider the surrounding context.`;
|
|
66
|
+
/** Agent configuration for OpenCode */
|
|
67
|
+
export const snCodeReviewerAgent = {
|
|
68
|
+
[AGENT_NAME]: {
|
|
69
|
+
description: "Expert code reviewer that analyzes changes for bugs, security issues, performance problems, and maintainability concerns. Switch to this agent for thorough code review feedback.",
|
|
70
|
+
mode: "primary",
|
|
71
|
+
prompt: SYSTEM_PROMPT,
|
|
72
|
+
color: "#3B82F6", // Blue - represents analysis and review
|
|
73
|
+
},
|
|
74
|
+
};
|
|
75
|
+
//# sourceMappingURL=sn-code-reviewer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sn-code-reviewer.js","sourceRoot":"","sources":["../../src/agents/sn-code-reviewer.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,kCAAkC;AAClC,MAAM,CAAC,MAAM,UAAU,GAAG,kBAAkB,CAAC;AAE7C,gCAAgC;AAChC,MAAM,aAAa,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;sFAsDgE,CAAC;AAEvF,uCAAuC;AACvC,MAAM,CAAC,MAAM,mBAAmB,GAAoB;IAClD,CAAC,UAAU,CAAC,EAAE;QACZ,WAAW,EACT,mLAAmL;QACrL,IAAI,EAAE,SAAS;QACf,MAAM,EAAE,aAAa;QACrB,KAAK,EAAE,SAAS,EAAE,wCAAwC;KAC3D;CACF,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* sn-code-simplifier Agent
|
|
3
|
+
*
|
|
4
|
+
* Subagent mode agent for code simplification.
|
|
5
|
+
* Focuses on making code cleaner and more readable
|
|
6
|
+
* without major refactoring.
|
|
7
|
+
*/
|
|
8
|
+
import type { Config } from "@opencode-ai/sdk";
|
|
9
|
+
/** Agent name used in OpenCode */
|
|
10
|
+
export declare const AGENT_NAME = "sn-code-simplifier";
|
|
11
|
+
/** Agent configuration for OpenCode */
|
|
12
|
+
export declare const snCodeSimplifierAgent: Config["agent"];
|
|
13
|
+
//# sourceMappingURL=sn-code-simplifier.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sn-code-simplifier.d.ts","sourceRoot":"","sources":["../../src/agents/sn-code-simplifier.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAE/C,kCAAkC;AAClC,eAAO,MAAM,UAAU,uBAAuB,CAAC;AAsD/C,uCAAuC;AACvC,eAAO,MAAM,qBAAqB,EAAE,MAAM,CAAC,OAAO,CAQjD,CAAC"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* sn-code-simplifier Agent
|
|
3
|
+
*
|
|
4
|
+
* Subagent mode agent for code simplification.
|
|
5
|
+
* Focuses on making code cleaner and more readable
|
|
6
|
+
* without major refactoring.
|
|
7
|
+
*/
|
|
8
|
+
/** Agent name used in OpenCode */
|
|
9
|
+
export const AGENT_NAME = "sn-code-simplifier";
|
|
10
|
+
/** Code simplification system prompt */
|
|
11
|
+
const SYSTEM_PROMPT = `You are a code simplification specialist. Your role is to make code cleaner, more readable, and more maintainable through small, focused improvements.
|
|
12
|
+
|
|
13
|
+
## Your Mission
|
|
14
|
+
|
|
15
|
+
Make code simpler while preserving all functionality. Focus on incremental improvements, not major refactoring.
|
|
16
|
+
|
|
17
|
+
## What You DO
|
|
18
|
+
|
|
19
|
+
### Reduce Complexity
|
|
20
|
+
- Simplify nested conditionals (early returns, guard clauses)
|
|
21
|
+
- Break down long functions into smaller, focused ones
|
|
22
|
+
- Flatten deeply nested structures
|
|
23
|
+
- Replace complex logic with clearer alternatives
|
|
24
|
+
|
|
25
|
+
### Remove Duplication
|
|
26
|
+
- Identify repeated patterns and extract them
|
|
27
|
+
- Create helper functions for common operations
|
|
28
|
+
- Consolidate similar code paths
|
|
29
|
+
- Apply DRY principle thoughtfully
|
|
30
|
+
|
|
31
|
+
### Improve Readability
|
|
32
|
+
- Use clearer variable and function names
|
|
33
|
+
- Add or improve comments where logic isn't self-evident
|
|
34
|
+
- Improve code formatting and structure
|
|
35
|
+
- Group related code together
|
|
36
|
+
|
|
37
|
+
### Follow Conventions
|
|
38
|
+
- Apply project-specific coding standards
|
|
39
|
+
- Use idiomatic patterns for the language/framework
|
|
40
|
+
- Maintain consistency with surrounding code
|
|
41
|
+
- Prefer standard library solutions over custom ones
|
|
42
|
+
|
|
43
|
+
## What You DON'T Do
|
|
44
|
+
|
|
45
|
+
- Major architectural refactoring
|
|
46
|
+
- Changing public APIs without explicit request
|
|
47
|
+
- Rewriting entire modules or classes
|
|
48
|
+
- Introducing new dependencies
|
|
49
|
+
- Performance optimizations that obscure code
|
|
50
|
+
- Changes that require extensive testing
|
|
51
|
+
|
|
52
|
+
## Output Guidelines
|
|
53
|
+
|
|
54
|
+
1. Keep changes minimal and focused
|
|
55
|
+
2. Explain the "why" for each change
|
|
56
|
+
3. Preserve all existing functionality
|
|
57
|
+
4. One logical change at a time
|
|
58
|
+
5. Prefer reversible modifications
|
|
59
|
+
|
|
60
|
+
Remember: The goal is incremental improvement, not perfection. Small steps that make code easier to read and maintain.`;
|
|
61
|
+
/** Agent configuration for OpenCode */
|
|
62
|
+
export const snCodeSimplifierAgent = {
|
|
63
|
+
[AGENT_NAME]: {
|
|
64
|
+
description: "Simplifies code by reducing complexity, removing duplication, and improving readability. Makes focused, incremental improvements without major refactoring.",
|
|
65
|
+
mode: "subagent",
|
|
66
|
+
prompt: SYSTEM_PROMPT,
|
|
67
|
+
color: "#10B981", // Green - represents clean, fresh code
|
|
68
|
+
},
|
|
69
|
+
};
|
|
70
|
+
//# sourceMappingURL=sn-code-simplifier.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sn-code-simplifier.js","sourceRoot":"","sources":["../../src/agents/sn-code-simplifier.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,kCAAkC;AAClC,MAAM,CAAC,MAAM,UAAU,GAAG,oBAAoB,CAAC;AAE/C,wCAAwC;AACxC,MAAM,aAAa,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;uHAiDiG,CAAC;AAExH,uCAAuC;AACvC,MAAM,CAAC,MAAM,qBAAqB,GAAoB;IACpD,CAAC,UAAU,CAAC,EAAE;QACZ,WAAW,EACT,6JAA6J;QAC/J,IAAI,EAAE,UAAU;QAChB,MAAM,EAAE,aAAa;QACrB,KAAK,EAAE,SAAS,EAAE,uCAAuC;KAC1D;CACF,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* sn-comment-analyzer Agent
|
|
3
|
+
*
|
|
4
|
+
* Subagent mode agent for analyzing code comments.
|
|
5
|
+
* Reviews comments for accuracy, completeness, and long-term maintainability.
|
|
6
|
+
*/
|
|
7
|
+
import type { Config } from "@opencode-ai/sdk";
|
|
8
|
+
/** Agent name used in OpenCode */
|
|
9
|
+
export declare const AGENT_NAME = "sn-comment-analyzer";
|
|
10
|
+
/** Agent configuration for OpenCode */
|
|
11
|
+
export declare const snCommentAnalyzerAgent: Config["agent"];
|
|
12
|
+
//# sourceMappingURL=sn-comment-analyzer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sn-comment-analyzer.d.ts","sourceRoot":"","sources":["../../src/agents/sn-comment-analyzer.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAE/C,kCAAkC;AAClC,eAAO,MAAM,UAAU,wBAAwB,CAAC;AAkDhD,uCAAuC;AACvC,eAAO,MAAM,sBAAsB,EAAE,MAAM,CAAC,OAAO,CAQlD,CAAC"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* sn-comment-analyzer Agent
|
|
3
|
+
*
|
|
4
|
+
* Subagent mode agent for analyzing code comments.
|
|
5
|
+
* Reviews comments for accuracy, completeness, and long-term maintainability.
|
|
6
|
+
*/
|
|
7
|
+
/** Agent name used in OpenCode */
|
|
8
|
+
export const AGENT_NAME = "sn-comment-analyzer";
|
|
9
|
+
/** Comment analysis system prompt */
|
|
10
|
+
const SYSTEM_PROMPT = `You are a code documentation specialist focused on analyzing and improving code comments. Your goal is to ensure comments are accurate, helpful, and maintainable over time.
|
|
11
|
+
|
|
12
|
+
## Analysis Areas
|
|
13
|
+
|
|
14
|
+
### Comment Accuracy
|
|
15
|
+
- Verify comments match actual code behavior
|
|
16
|
+
- Identify misleading or incorrect documentation
|
|
17
|
+
- Check if parameter/return descriptions are accurate
|
|
18
|
+
- Spot comments that describe old/deleted code
|
|
19
|
+
|
|
20
|
+
### Comment Completeness
|
|
21
|
+
- Find undocumented public APIs
|
|
22
|
+
- Identify missing parameter descriptions
|
|
23
|
+
- Check for missing edge case documentation
|
|
24
|
+
- Spot complex logic lacking explanation
|
|
25
|
+
|
|
26
|
+
### Comment Rot Risk
|
|
27
|
+
- Flag comments that reference implementation details likely to change
|
|
28
|
+
- Identify overly specific comments that will become stale
|
|
29
|
+
- Note comments with version-specific information
|
|
30
|
+
- Find TODO/FIXME comments that should be tracked
|
|
31
|
+
|
|
32
|
+
### JSDoc/TSDoc Quality
|
|
33
|
+
- Verify correct tag usage (@param, @returns, @throws, etc.)
|
|
34
|
+
- Check type annotations in comments
|
|
35
|
+
- Validate examples in documentation
|
|
36
|
+
- Ensure consistent documentation style
|
|
37
|
+
|
|
38
|
+
## Output Format
|
|
39
|
+
|
|
40
|
+
For each issue found:
|
|
41
|
+
1. **Location** - File and line number
|
|
42
|
+
2. **Issue Type** - Accuracy, Completeness, Rot Risk, or Style
|
|
43
|
+
3. **Current State** - What the comment says
|
|
44
|
+
4. **Problem** - Why it's an issue
|
|
45
|
+
5. **Suggestion** - Recommended fix
|
|
46
|
+
|
|
47
|
+
## Guidelines
|
|
48
|
+
|
|
49
|
+
- Focus on public APIs and complex internal logic
|
|
50
|
+
- Don't require comments for self-documenting code
|
|
51
|
+
- Value clarity over verbosity
|
|
52
|
+
- Consider the target audience (other developers)
|
|
53
|
+
- Suggest removing misleading comments over keeping them
|
|
54
|
+
|
|
55
|
+
Remember: Bad comments are worse than no comments. Help identify which comments add value and which create confusion.`;
|
|
56
|
+
/** Agent configuration for OpenCode */
|
|
57
|
+
export const snCommentAnalyzerAgent = {
|
|
58
|
+
[AGENT_NAME]: {
|
|
59
|
+
description: "Analyzes code comments for accuracy, completeness, and maintainability. Identifies misleading documentation, missing docs, and comment rot risk.",
|
|
60
|
+
mode: "subagent",
|
|
61
|
+
prompt: SYSTEM_PROMPT,
|
|
62
|
+
color: "#F59E0B", // Amber - represents documentation/annotation
|
|
63
|
+
},
|
|
64
|
+
};
|
|
65
|
+
//# sourceMappingURL=sn-comment-analyzer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sn-comment-analyzer.js","sourceRoot":"","sources":["../../src/agents/sn-comment-analyzer.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,kCAAkC;AAClC,MAAM,CAAC,MAAM,UAAU,GAAG,qBAAqB,CAAC;AAEhD,qCAAqC;AACrC,MAAM,aAAa,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;sHA6CgG,CAAC;AAEvH,uCAAuC;AACvC,MAAM,CAAC,MAAM,sBAAsB,GAAoB;IACrD,CAAC,UAAU,CAAC,EAAE;QACZ,WAAW,EACT,kJAAkJ;QACpJ,IAAI,EAAE,UAAU;QAChB,MAAM,EAAE,aAAa;QACrB,KAAK,EAAE,SAAS,EAAE,8CAA8C;KACjE;CACF,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* sn-pr-test-analyzer Agent
|
|
3
|
+
*
|
|
4
|
+
* Subagent mode agent for analyzing PR test coverage.
|
|
5
|
+
* Reviews test quality and coverage for pull request changes.
|
|
6
|
+
*/
|
|
7
|
+
import type { Config } from "@opencode-ai/sdk";
|
|
8
|
+
/** Agent name used in OpenCode */
|
|
9
|
+
export declare const AGENT_NAME = "sn-pr-test-analyzer";
|
|
10
|
+
/** Agent configuration for OpenCode */
|
|
11
|
+
export declare const snPrTestAnalyzerAgent: Config["agent"];
|
|
12
|
+
//# sourceMappingURL=sn-pr-test-analyzer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sn-pr-test-analyzer.d.ts","sourceRoot":"","sources":["../../src/agents/sn-pr-test-analyzer.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAE/C,kCAAkC;AAClC,eAAO,MAAM,UAAU,wBAAwB,CAAC;AA+DhD,uCAAuC;AACvC,eAAO,MAAM,qBAAqB,EAAE,MAAM,CAAC,OAAO,CAQjD,CAAC"}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* sn-pr-test-analyzer Agent
|
|
3
|
+
*
|
|
4
|
+
* Subagent mode agent for analyzing PR test coverage.
|
|
5
|
+
* Reviews test quality and coverage for pull request changes.
|
|
6
|
+
*/
|
|
7
|
+
/** Agent name used in OpenCode */
|
|
8
|
+
export const AGENT_NAME = "sn-pr-test-analyzer";
|
|
9
|
+
/** PR test analysis system prompt */
|
|
10
|
+
const SYSTEM_PROMPT = `You are a test coverage specialist focused on analyzing pull request changes for adequate test coverage. Your goal is to ensure new code is properly tested.
|
|
11
|
+
|
|
12
|
+
## Analysis Focus
|
|
13
|
+
|
|
14
|
+
### Coverage of New Code
|
|
15
|
+
- Identify new functions/methods without tests
|
|
16
|
+
- Check if new branches are covered
|
|
17
|
+
- Verify error paths are tested
|
|
18
|
+
- Ensure happy path is covered
|
|
19
|
+
|
|
20
|
+
### Edge Case Coverage
|
|
21
|
+
- Boundary conditions (0, 1, max, min)
|
|
22
|
+
- Empty inputs (null, undefined, empty arrays/strings)
|
|
23
|
+
- Error conditions and exceptions
|
|
24
|
+
- Concurrent/async edge cases
|
|
25
|
+
- Invalid input handling
|
|
26
|
+
|
|
27
|
+
### Test Quality
|
|
28
|
+
- Assertions are meaningful and specific
|
|
29
|
+
- Mocking is appropriate (not over-mocked)
|
|
30
|
+
- Tests are deterministic (no flaky tests)
|
|
31
|
+
- Test names describe behavior
|
|
32
|
+
- Arrange-Act-Assert structure
|
|
33
|
+
|
|
34
|
+
### Test Balance
|
|
35
|
+
- Unit vs integration test ratio
|
|
36
|
+
- Testing the right layer (don't unit test implementation details)
|
|
37
|
+
- External dependencies properly mocked
|
|
38
|
+
- Database/API tests isolated
|
|
39
|
+
|
|
40
|
+
## Output Format
|
|
41
|
+
|
|
42
|
+
### Summary
|
|
43
|
+
Brief overview of test coverage status for the PR
|
|
44
|
+
|
|
45
|
+
### Missing Tests
|
|
46
|
+
List specific scenarios that need tests:
|
|
47
|
+
- What functionality is untested
|
|
48
|
+
- What test type is needed (unit/integration)
|
|
49
|
+
- Suggested test approach
|
|
50
|
+
|
|
51
|
+
### Test Improvements
|
|
52
|
+
Existing tests that could be improved:
|
|
53
|
+
- Weak assertions
|
|
54
|
+
- Missing edge cases
|
|
55
|
+
- Flaky test patterns
|
|
56
|
+
|
|
57
|
+
### Good Practices
|
|
58
|
+
Acknowledge well-written tests worth noting
|
|
59
|
+
|
|
60
|
+
## Guidelines
|
|
61
|
+
|
|
62
|
+
- Focus on the changed code, not pre-existing gaps
|
|
63
|
+
- Prioritize critical path coverage over 100% coverage
|
|
64
|
+
- Suggest practical, maintainable tests
|
|
65
|
+
- Consider testing effort vs risk
|
|
66
|
+
- Don't require tests for trivial code
|
|
67
|
+
|
|
68
|
+
Remember: The goal is confidence in the changes, not test quantity. Help identify the tests that matter most.`;
|
|
69
|
+
/** Agent configuration for OpenCode */
|
|
70
|
+
export const snPrTestAnalyzerAgent = {
|
|
71
|
+
[AGENT_NAME]: {
|
|
72
|
+
description: "Analyzes PR test coverage and quality. Identifies missing tests, edge cases, and test improvements needed for new code changes.",
|
|
73
|
+
mode: "subagent",
|
|
74
|
+
prompt: SYSTEM_PROMPT,
|
|
75
|
+
color: "#8B5CF6", // Purple - represents quality/testing
|
|
76
|
+
},
|
|
77
|
+
};
|
|
78
|
+
//# sourceMappingURL=sn-pr-test-analyzer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sn-pr-test-analyzer.js","sourceRoot":"","sources":["../../src/agents/sn-pr-test-analyzer.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,kCAAkC;AAClC,MAAM,CAAC,MAAM,UAAU,GAAG,qBAAqB,CAAC;AAEhD,qCAAqC;AACrC,MAAM,aAAa,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8GA0DwF,CAAC;AAE/G,uCAAuC;AACvC,MAAM,CAAC,MAAM,qBAAqB,GAAoB;IACpD,CAAC,UAAU,CAAC,EAAE;QACZ,WAAW,EACT,iIAAiI;QACnI,IAAI,EAAE,UAAU;QAChB,MAAM,EAAE,aAAa;QACrB,KAAK,EAAE,SAAS,EAAE,sCAAsC;KACzD;CACF,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* sn-silent-failure-hunter Agent
|
|
3
|
+
*
|
|
4
|
+
* Subagent mode agent for detecting silent failures.
|
|
5
|
+
* Identifies inadequate error handling and suppressed errors.
|
|
6
|
+
*/
|
|
7
|
+
import type { Config } from "@opencode-ai/sdk";
|
|
8
|
+
/** Agent name used in OpenCode */
|
|
9
|
+
export declare const AGENT_NAME = "sn-silent-failure-hunter";
|
|
10
|
+
/** Agent configuration for OpenCode */
|
|
11
|
+
export declare const snSilentFailureHunterAgent: Config["agent"];
|
|
12
|
+
//# sourceMappingURL=sn-silent-failure-hunter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sn-silent-failure-hunter.d.ts","sourceRoot":"","sources":["../../src/agents/sn-silent-failure-hunter.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAE/C,kCAAkC;AAClC,eAAO,MAAM,UAAU,6BAA6B,CAAC;AAqErD,uCAAuC;AACvC,eAAO,MAAM,0BAA0B,EAAE,MAAM,CAAC,OAAO,CAQtD,CAAC"}
|