super-opencode 1.1.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/.opencode/agents/architect.md +84 -0
- package/.opencode/agents/backend.md +124 -0
- package/.opencode/agents/frontend.md +137 -0
- package/.opencode/agents/optimizer.md +51 -0
- package/.opencode/agents/pm-agent.md +105 -0
- package/.opencode/agents/quality.md +107 -0
- package/.opencode/agents/researcher.md +105 -0
- package/.opencode/agents/reviewer.md +80 -0
- package/.opencode/agents/security.md +107 -0
- package/.opencode/agents/writer.md +136 -0
- package/.opencode/commands/soc-analyze.md +137 -0
- package/.opencode/commands/soc-brainstorm.md +110 -0
- package/.opencode/commands/soc-cleanup.md +107 -0
- package/.opencode/commands/soc-design.md +122 -0
- package/.opencode/commands/soc-explain.md +113 -0
- package/.opencode/commands/soc-git.md +104 -0
- package/.opencode/commands/soc-help.md +94 -0
- package/.opencode/commands/soc-implement.md +112 -0
- package/.opencode/commands/soc-improve.md +105 -0
- package/.opencode/commands/soc-pm.md +99 -0
- package/.opencode/commands/soc-research.md +105 -0
- package/.opencode/commands/soc-review.md +102 -0
- package/.opencode/commands/soc-test.md +109 -0
- package/.opencode/commands/soc-workflow.md +97 -0
- package/.opencode/settings.json +3 -0
- package/.opencode/skills/confidence-check/SKILL.md +97 -0
- package/.opencode/skills/debug-protocol/SKILL.md +83 -0
- package/.opencode/skills/reflexion/SKILL.md +108 -0
- package/.opencode/skills/security-audit/SKILL.md +90 -0
- package/.opencode/skills/self-check/SKILL.md +95 -0
- package/.opencode/skills/simplification/SKILL.md +92 -0
- package/AGENTS.md +175 -0
- package/LICENSE +21 -0
- package/README.md +288 -0
- package/dist/cli.js +403 -0
- package/package.json +45 -0
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Code improvement and optimization
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# /soc-improve
|
|
6
|
+
|
|
7
|
+
## 1. Command Overview
|
|
8
|
+
The `/soc-improve` command is the "Optimizer." Unlike `implement` (which builds new things) or `cleanup` (which removes dead things), `improve` makes existing *working* code *better*. It focuses on performance, readability, security, and quality benchmarks.
|
|
9
|
+
|
|
10
|
+
## 2. Triggers & Routing
|
|
11
|
+
The command routes to specialized agents based on the `--focus` flag.
|
|
12
|
+
|
|
13
|
+
| Trigger Scenario | Flag | Target Agent | Goal |
|
|
14
|
+
| :--- | :--- | :--- | :--- |
|
|
15
|
+
| **Performance** | `--focus perf` | `[architect]` | Reduce latency/memory |
|
|
16
|
+
| **Code Quality** | `--focus quality` | `[quality]` | Refactor/Clean Clean |
|
|
17
|
+
| **Security Hardening** | `--focus security` | `[security]` | Patch vulnerabilities |
|
|
18
|
+
| **UX Polish** | `--focus ux` | `[frontend]` | A11y, animations |
|
|
19
|
+
|
|
20
|
+
## 3. Usage & Arguments
|
|
21
|
+
```bash
|
|
22
|
+
/soc-improve [target] [flags]
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
### Arguments
|
|
26
|
+
- **`[target]`**: File or component to optimize.
|
|
27
|
+
|
|
28
|
+
### Flags
|
|
29
|
+
- **`--focus [perf|quality|security|ux]`**: **MANDATORY**.
|
|
30
|
+
- **`--metric [target]`**: Optional goal (e.g., `< 100ms`).
|
|
31
|
+
|
|
32
|
+
## 4. Behavioral Flow (Orchestration)
|
|
33
|
+
|
|
34
|
+
### Phase 1: Benchmark (The Baseline)
|
|
35
|
+
1. **Measure**: Analyze current state (LOC, Complexity, or approximate Perf).
|
|
36
|
+
2. **Identify**: Find bottlenecks or anti-patterns.
|
|
37
|
+
|
|
38
|
+
### Phase 2: Plan (The Upgrade)
|
|
39
|
+
- Propose specific refactors.
|
|
40
|
+
- Estimate impact (e.g., "Replacing nested loop will reduce O(n^2) to O(n)").
|
|
41
|
+
|
|
42
|
+
### Phase 3: Execute (The Refactor)
|
|
43
|
+
1. **Edit**: Apply changes safely.
|
|
44
|
+
2. **Verify**: Ensure tests still pass (Regression Check).
|
|
45
|
+
3. **Compare**: Show Before vs After stats.
|
|
46
|
+
|
|
47
|
+
## 5. Output Guidelines (The Contract)
|
|
48
|
+
|
|
49
|
+
### Improvement Report
|
|
50
|
+
```markdown
|
|
51
|
+
## Improvement: [Target]
|
|
52
|
+
|
|
53
|
+
### Focus: [Focus Area]
|
|
54
|
+
|
|
55
|
+
### Changes Applied
|
|
56
|
+
1. **Refactor**: Extracted `LargeComponent` into 3 sub-components.
|
|
57
|
+
2. **Performance**: Memoized calculation of expensive value.
|
|
58
|
+
|
|
59
|
+
### Metrics
|
|
60
|
+
| Metric | Before | After | Delta |
|
|
61
|
+
| :--- | :--- | :--- | :--- |
|
|
62
|
+
| **Complexity** | 15 | 8 | -47% |
|
|
63
|
+
| **Lines** | 200 | 120 | -40% |
|
|
64
|
+
|
|
65
|
+
### Verification
|
|
66
|
+
✅ Tests Passed
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
## 6. Examples
|
|
70
|
+
|
|
71
|
+
### A. Performance Tuning
|
|
72
|
+
```bash
|
|
73
|
+
/soc-improve src/utils/sort.ts --focus perf
|
|
74
|
+
```
|
|
75
|
+
*Effect:* Replaces bubble sort with quicksort or uses a native method.
|
|
76
|
+
|
|
77
|
+
### B. Security Hardening
|
|
78
|
+
```bash
|
|
79
|
+
/soc-improve src/api/user.ts --focus security
|
|
80
|
+
```
|
|
81
|
+
*Effect:* Adds input validation (Zod) and rate limiting to an existing endpoint.
|
|
82
|
+
|
|
83
|
+
## 7. Dependencies & Capabilities
|
|
84
|
+
|
|
85
|
+
### Agents
|
|
86
|
+
- **Architect**: `@[.opencode/agents/architect.md]` - Performance strategy.
|
|
87
|
+
- **Quality**: `@[.opencode/agents/quality.md]` - Code structure.
|
|
88
|
+
- **Security**: `@[.opencode/agents/security.md]` - Hardening.
|
|
89
|
+
|
|
90
|
+
### Skills
|
|
91
|
+
- **Reflexion**: `@[.opencode/skills/reflexion/SKILL.md]` - Ensuring improvements don't break logic.
|
|
92
|
+
|
|
93
|
+
### MCP Integration
|
|
94
|
+
- **`context7`**: Checking for modern language features (e.g., utilizing new node.js APIs).
|
|
95
|
+
|
|
96
|
+
## 8. Boundaries
|
|
97
|
+
|
|
98
|
+
**Will:**
|
|
99
|
+
- Refactor code structure.
|
|
100
|
+
- Optimize algorithms.
|
|
101
|
+
- Add comments/documentation.
|
|
102
|
+
|
|
103
|
+
**Will Not:**
|
|
104
|
+
- **Change Behavior**: The external API/output must remain identical (unless fixing a bug).
|
|
105
|
+
- **Delete Features**: Use `/soc-cleanup` for removal.
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Project management and orchestration
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# /soc-pm
|
|
6
|
+
|
|
7
|
+
## 1. Command Overview
|
|
8
|
+
The `/soc-pm` command is the "Orchestrator." It manages the high-level state of the project. It uses the PDCA (Plan-Do-Check-Act) cycle to break down complex goals into `tasks`, track progress, and unblock other agents. It is the owner of `task.md`.
|
|
9
|
+
|
|
10
|
+
## 2. Triggers & Routing
|
|
11
|
+
The command is the primary interface for the `pm-agent`.
|
|
12
|
+
|
|
13
|
+
| Trigger Scenario | Flag | Target Agent | Action |
|
|
14
|
+
| :--- | :--- | :--- | :--- |
|
|
15
|
+
| **New Project** | `plan` | `[pm-agent]` | Create `task.md` |
|
|
16
|
+
| **Progress Check** | `status` | `[pm-agent]` | Read/Update `task.md` |
|
|
17
|
+
| **Verify Work** | `review` | `[pm-agent]` | Check deliverables |
|
|
18
|
+
|
|
19
|
+
## 3. Usage & Arguments
|
|
20
|
+
```bash
|
|
21
|
+
/soc-pm [action] [target] [flags]
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
### Arguments
|
|
25
|
+
- **`[action]`**: `plan`, `status`, `review`, `checkpoint`.
|
|
26
|
+
- **`[target]`**: (Optional) Specific feature or milestone.
|
|
27
|
+
|
|
28
|
+
### Flags
|
|
29
|
+
- **`--detail`**: Show full task history.
|
|
30
|
+
|
|
31
|
+
## 4. Behavioral Flow (Orchestration)
|
|
32
|
+
|
|
33
|
+
### Phase 1: Plan (The Roadmap)
|
|
34
|
+
1. **Analyze**: Read User Request -> Break into Epics/Stories.
|
|
35
|
+
2. **Document**: updates `task.md` with checkboxes `[ ]`.
|
|
36
|
+
|
|
37
|
+
### Phase 2: Do (Tracking)
|
|
38
|
+
- Monitors tool usage.
|
|
39
|
+
- Updates task status to `[/]` (In Progress) or `[x]` (Done).
|
|
40
|
+
|
|
41
|
+
### Phase 3: Check (The Audit)
|
|
42
|
+
- **Review**: Did we meet the acceptance criteria?
|
|
43
|
+
- **Reflect**: Use `reflexion` skill if blocked.
|
|
44
|
+
|
|
45
|
+
## 5. Output Guidelines (The Contract)
|
|
46
|
+
|
|
47
|
+
### Project Status Report
|
|
48
|
+
```markdown
|
|
49
|
+
## Project Status: [Phase]
|
|
50
|
+
|
|
51
|
+
### Progress
|
|
52
|
+
- **Completed**: 3/5 Tasks (60%)
|
|
53
|
+
- **Current Focus**: Implementing API Auth
|
|
54
|
+
|
|
55
|
+
### Task List
|
|
56
|
+
- [x] Setup DB Schema
|
|
57
|
+
- [/] **Implement Login Route** (Active)
|
|
58
|
+
- [ ] Write Tests
|
|
59
|
+
|
|
60
|
+
### Blockers
|
|
61
|
+
- Waiting for API Key from user.
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
## 6. Examples
|
|
65
|
+
|
|
66
|
+
### A. Initial Planning
|
|
67
|
+
```bash
|
|
68
|
+
/soc-pm plan "Build User Dashboard"
|
|
69
|
+
```
|
|
70
|
+
*Effect:* Creates `task.md` with breakdown: "Design UI", "Setup API", "Integrate Frontend".
|
|
71
|
+
|
|
72
|
+
### B. Status Update
|
|
73
|
+
```bash
|
|
74
|
+
/soc-pm status
|
|
75
|
+
```
|
|
76
|
+
*Effect:* Reads current state and summarizes what has been done vs what is left.
|
|
77
|
+
|
|
78
|
+
## 7. Dependencies & Capabilities
|
|
79
|
+
|
|
80
|
+
### Agents
|
|
81
|
+
- **PM Agent**: `@[.opencode/agents/pm-agent.md]` - Self-referential.
|
|
82
|
+
- **All Agents**: Delegates work to them.
|
|
83
|
+
|
|
84
|
+
### Skills
|
|
85
|
+
- **Reflexion**: `@[.opencode/skills/reflexion/SKILL.md]` - For unblocking the team.
|
|
86
|
+
|
|
87
|
+
### MCP Integration
|
|
88
|
+
- **`filesystem`**: Managing `task.md` and `implementation_plan.md`.
|
|
89
|
+
|
|
90
|
+
## 8. Boundaries
|
|
91
|
+
|
|
92
|
+
**Will:**
|
|
93
|
+
- Manage `task.md`.
|
|
94
|
+
- Delegate tasks to other agents.
|
|
95
|
+
- Track overall progress.
|
|
96
|
+
|
|
97
|
+
**Will Not:**
|
|
98
|
+
- **Write Code**: It manages those who write code.
|
|
99
|
+
- **Solve Technical Bugs**: It assigns `[backend]` or `[quality]` to solve them.
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Deep web research and documentation lookup
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# /soc-research
|
|
6
|
+
|
|
7
|
+
## 1. Command Overview
|
|
8
|
+
The `/soc-research` command is the "Archive." It scours the web and internal docs to find definitive truth. It operates on the "Cite or Die" principle: every claim must optionally be backed by a source. It does not hallucinate; it verifies.
|
|
9
|
+
|
|
10
|
+
## 2. Triggers & Routing
|
|
11
|
+
The command routes to the `researcher` agent.
|
|
12
|
+
|
|
13
|
+
| Trigger Scenario | Flag | Target Agent | Tool Used |
|
|
14
|
+
| :--- | :--- | :--- | :--- |
|
|
15
|
+
| **Quick Fact** | `--depth quick` | `[researcher]` | DuckDuckGo/Tavily |
|
|
16
|
+
| **Docs Lookup** | `[topic]` | `[researcher]` | `context7` |
|
|
17
|
+
| **Deep Dive** | `--depth deep` | `[researcher]` | Recursive Search |
|
|
18
|
+
|
|
19
|
+
## 3. Usage & Arguments
|
|
20
|
+
```bash
|
|
21
|
+
/soc-research [topic] [flags]
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
### Arguments
|
|
25
|
+
- **`[topic]`**: The question or technology to investigate.
|
|
26
|
+
|
|
27
|
+
### Flags
|
|
28
|
+
- **`--depth [quick|standard|deep]`**: (Default: `standard`).
|
|
29
|
+
- **`--domain [url]`**: Restrict search to specific site (e.g., `github.com`).
|
|
30
|
+
|
|
31
|
+
## 4. Behavioral Flow (Orchestration)
|
|
32
|
+
|
|
33
|
+
### Phase 1: Parsing
|
|
34
|
+
1. **Decompose**: Break query into keywords.
|
|
35
|
+
2. **Select**: Choose tool (`tavily` for web, `context7` for docs).
|
|
36
|
+
|
|
37
|
+
### Phase 2: Execution (The Hunt)
|
|
38
|
+
- **Broad Search**: Find candidate URLs.
|
|
39
|
+
- **Deep Read**: Scrape content.
|
|
40
|
+
- **Synthesize**: Cross-reference facts to find consensus.
|
|
41
|
+
|
|
42
|
+
### Phase 3: Reporting
|
|
43
|
+
- Construct "Review of Literature."
|
|
44
|
+
- Flag conflicting info ("Source A says X, Source B says Y").
|
|
45
|
+
|
|
46
|
+
## 5. Output Guidelines (The Contract)
|
|
47
|
+
|
|
48
|
+
### Research Report
|
|
49
|
+
```markdown
|
|
50
|
+
## Research: [Topic]
|
|
51
|
+
|
|
52
|
+
### Executive Summary
|
|
53
|
+
[Direct Answer]
|
|
54
|
+
|
|
55
|
+
### Key Findings
|
|
56
|
+
1. **[Fact 1]**: [Detail]
|
|
57
|
+
* *Source*: [Link]
|
|
58
|
+
2. **[Fact 2]**: [Detail]
|
|
59
|
+
|
|
60
|
+
### Code Patterns (if applicable)
|
|
61
|
+
```typescript
|
|
62
|
+
// Verified pattern from docs
|
|
63
|
+
const x = new Library();
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
### Conflicting Info
|
|
67
|
+
- StackOverflow suggests X, but Official Docs say Y (Deprecated).
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
## 6. Examples
|
|
71
|
+
|
|
72
|
+
### A. Library Selection
|
|
73
|
+
```bash
|
|
74
|
+
/soc-research "Best React form library 2025" --depth deep
|
|
75
|
+
```
|
|
76
|
+
*Effect:* Compares React Hook Form vs TanStack Form based on bundle size and weekly downloads.
|
|
77
|
+
|
|
78
|
+
### B. Bug Hunting
|
|
79
|
+
```bash
|
|
80
|
+
/soc-research "Prisma error P2002" --domain github.com
|
|
81
|
+
```
|
|
82
|
+
*Effect:* Finds specific GitHub issues related to Unique Constraint violations.
|
|
83
|
+
|
|
84
|
+
## 7. Dependencies & Capabilities
|
|
85
|
+
|
|
86
|
+
### Agents
|
|
87
|
+
- **Researcher**: `@[.opencode/agents/researcher.md]` - Primary persona.
|
|
88
|
+
|
|
89
|
+
### Skills
|
|
90
|
+
- **Sequential Thinking**: `@[.opencode/skills/sequential-thinking/SKILL.md]` - For resolving conflicts.
|
|
91
|
+
|
|
92
|
+
### MCP Integration
|
|
93
|
+
- **`tavily`**: Real-time web search.
|
|
94
|
+
- **`context7`**: Documentation retrieval.
|
|
95
|
+
|
|
96
|
+
## 8. Boundaries
|
|
97
|
+
|
|
98
|
+
**Will:**
|
|
99
|
+
- Find official documentation.
|
|
100
|
+
- Summarize community consensus.
|
|
101
|
+
- Provide direct links.
|
|
102
|
+
|
|
103
|
+
**Will Not:**
|
|
104
|
+
- **Execute Info**: It finds the code, but does not run it.
|
|
105
|
+
- **Make Decisions**: It informs decisions, but `architect` decides.
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Code review and quality assessment
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# /soc-review
|
|
6
|
+
|
|
7
|
+
## 1. Command Overview
|
|
8
|
+
The `/soc-review` command is the "Critic." It acts as a second pair of eyes before code is merged. It checks for logic errors, security vulnerabilities (OWASP), and adherence to the "Intentional Minimalism" design philosophy.
|
|
9
|
+
|
|
10
|
+
## 2. Triggers & Routing
|
|
11
|
+
The command routes to specialized reviewers.
|
|
12
|
+
|
|
13
|
+
| Trigger Scenario | Flag | Target Agent | Focus |
|
|
14
|
+
| :--- | :--- | :--- | :--- |
|
|
15
|
+
| **Logic/Bugs** | `--scope full` | `[reviewer]` | Correctness |
|
|
16
|
+
| **Security** | `--security` | `[security]` | Injection, AuthZ |
|
|
17
|
+
| **Style/Lint** | `--quick` | `[reviewer]` | Formatting, Naming |
|
|
18
|
+
|
|
19
|
+
## 3. Usage & Arguments
|
|
20
|
+
```bash
|
|
21
|
+
/soc-review [target] [flags]
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
### Arguments
|
|
25
|
+
- **`[target]`**: File, directory, or Pull Request ID to review.
|
|
26
|
+
|
|
27
|
+
### Flags
|
|
28
|
+
- **`--scope [full|quick]`**: (Default: `full`).
|
|
29
|
+
- **`--security`**: Triggers explicit security scan protocol.
|
|
30
|
+
|
|
31
|
+
## 4. Behavioral Flow (Orchestration)
|
|
32
|
+
|
|
33
|
+
### Phase 1: Context Loading
|
|
34
|
+
1. **Read**: Load the target code.
|
|
35
|
+
2. **Context**: Load `implementation_plan.md` (to see what was intended).
|
|
36
|
+
|
|
37
|
+
### Phase 2: Analysis (The Audit)
|
|
38
|
+
- **Static Analysis**: Grep for "smells" (`any`, `eval`, `console.log`).
|
|
39
|
+
- **Logic Check**: Trace variable data flow.
|
|
40
|
+
- **Design Check**: Does it match the Project Persona (Minimalism)?
|
|
41
|
+
|
|
42
|
+
### Phase 3: Reporting
|
|
43
|
+
- Categorize findings by Severity (Critical, Warning, Info).
|
|
44
|
+
- Reject if Critical issues exist.
|
|
45
|
+
|
|
46
|
+
## 5. Output Guidelines (The Contract)
|
|
47
|
+
|
|
48
|
+
### Code Review
|
|
49
|
+
```markdown
|
|
50
|
+
## Review: [Target]
|
|
51
|
+
|
|
52
|
+
### Verdict
|
|
53
|
+
❌ **Changes Requested** (1 Critical Issue)
|
|
54
|
+
|
|
55
|
+
### Findings
|
|
56
|
+
|
|
57
|
+
#### 🔴 Critical: SQL Injection
|
|
58
|
+
- **File**: `src/api/search.ts:15`
|
|
59
|
+
- **Code**: `db.query("SELECT * FROM users WHERE name = " + req.query.name)`
|
|
60
|
+
- **Fix**: Use parameterized query `$1`.
|
|
61
|
+
|
|
62
|
+
#### 🟡 Warning: Performance
|
|
63
|
+
- **File**: `src/utils.ts:40`
|
|
64
|
+
- **Issue**: `README.md` parsing is synchronous. Use `fs.promises`.
|
|
65
|
+
|
|
66
|
+
### Summary
|
|
67
|
+
Solid logic, but the SQL injection must be fixed before merge.
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
## 6. Examples
|
|
71
|
+
|
|
72
|
+
### A. Pre-Merge Review
|
|
73
|
+
```bash
|
|
74
|
+
/soc-review src/features/payments --security
|
|
75
|
+
```
|
|
76
|
+
*Effect:* Triggers `security` agent to specifically look for PCI compliance issues and raw secrets.
|
|
77
|
+
|
|
78
|
+
### B. Quick Sanity Check
|
|
79
|
+
```bash
|
|
80
|
+
/soc-review --quick
|
|
81
|
+
```
|
|
82
|
+
*Effect:* Scans changed files for obvious errors (lint, types) before commit.
|
|
83
|
+
|
|
84
|
+
## 7. Dependencies & Capabilities
|
|
85
|
+
|
|
86
|
+
### Agents
|
|
87
|
+
- **Reviewer**: `@[.opencode/agents/reviewer.md]` - General code quality.
|
|
88
|
+
- **Security**: `@[.opencode/agents/security.md]` - Vulnerability scanning.
|
|
89
|
+
|
|
90
|
+
### Skills
|
|
91
|
+
- **Security Audit**: `@[.opencode/skills/security-audit/SKILL.md]` - Automated checking.
|
|
92
|
+
|
|
93
|
+
## 8. Boundaries
|
|
94
|
+
|
|
95
|
+
**Will:**
|
|
96
|
+
- Point out specific lines of code.
|
|
97
|
+
- Suggest concrete fixes.
|
|
98
|
+
- Block "unsafe" code.
|
|
99
|
+
|
|
100
|
+
**Will Not:**
|
|
101
|
+
- **Fix the code**: It only comments. Use `/soc-improve` to fix.
|
|
102
|
+
- **Judge Aesthetics**: Unless it violates "Intentional Minimalism."
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Test generation and execution
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# /soc-test
|
|
6
|
+
|
|
7
|
+
## 1. Command Overview
|
|
8
|
+
The `/soc-test` command is the "Quality Gatekeeper." It generates, runs, and reports on tests. It ensures that no code is shipped without verification. It triggers the `quality` agent to write unit, integration, or E2E tests and uses the `reviewer` agent to analyze coverage.
|
|
9
|
+
|
|
10
|
+
## 2. Triggers & Routing
|
|
11
|
+
The command determines the scope and tool based on the arguments.
|
|
12
|
+
|
|
13
|
+
| Trigger Scenario | Flag | Target Agent | Tool Used |
|
|
14
|
+
| :--- | :--- | :--- | :--- |
|
|
15
|
+
| **Unit Testing** | `--type unit` | `[quality]` | Jest/Vitest |
|
|
16
|
+
| **Integration** | `--type integration` | `[quality]` | Supertest/Pytest |
|
|
17
|
+
| **E2E Flows** | `--type e2e` | `[quality]` | Playwright/Cypress |
|
|
18
|
+
| **Coverage Check**| `--coverage` | `[reviewer]` | Istanbul/C8 |
|
|
19
|
+
|
|
20
|
+
## 3. Usage & Arguments
|
|
21
|
+
```bash
|
|
22
|
+
/soc-test [target] [flags]
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
### Arguments
|
|
26
|
+
- **`[target]`**: File or directory to test (e.g., `src/utils/math.ts`).
|
|
27
|
+
|
|
28
|
+
### Flags
|
|
29
|
+
- **`--type [unit|integration|e2e]`**: (Optional) Default: `unit`.
|
|
30
|
+
- **`--coverage`**: Generates a coverage report.
|
|
31
|
+
- **`--watch`**: Runs in watch mode (interactive).
|
|
32
|
+
|
|
33
|
+
## 4. Behavioral Flow (Orchestration)
|
|
34
|
+
|
|
35
|
+
### Phase 1: Context & Gap Analysis
|
|
36
|
+
1. **Read**: Analyzes the source code in `[target]`.
|
|
37
|
+
2. **Scan**: Checks for existing `.test.ts` or `_test.py` files.
|
|
38
|
+
3. **Plan**: Identifies missing test cases (Edge cases, Error states, Happy path).
|
|
39
|
+
|
|
40
|
+
### Phase 2: Generation (The Writer)
|
|
41
|
+
The command prompts the `quality` agent:
|
|
42
|
+
> "Generate **[Type]** tests for **[Target]**.
|
|
43
|
+
> Ensure **[Coverage]**.
|
|
44
|
+
> Mock dependencies: **[External Services]**."
|
|
45
|
+
|
|
46
|
+
### Phase 3: Execution (The Runner)
|
|
47
|
+
1. **Run**: Executes the test command (e.g., `npm test`).
|
|
48
|
+
2. **Report**: Captures `stdout/stderr`.
|
|
49
|
+
3. **Reflect**: If tests fail, it suggests fixes (or fixes them if in `implement` mode).
|
|
50
|
+
|
|
51
|
+
## 5. Output Guidelines (The Contract)
|
|
52
|
+
|
|
53
|
+
### Test Execution Report
|
|
54
|
+
```markdown
|
|
55
|
+
## Test Report: [Target]
|
|
56
|
+
|
|
57
|
+
### 1. Summary
|
|
58
|
+
- **Status**: ❌ FAILED (2/10 failed)
|
|
59
|
+
- **Time**: 1.2s
|
|
60
|
+
|
|
61
|
+
### 2. Failures
|
|
62
|
+
- **Test**: `should return 400 on invalid email`
|
|
63
|
+
- **Expected**: `400`
|
|
64
|
+
- **Received**: `500`
|
|
65
|
+
- **Diagnosis**: Unhandled exception in controller.
|
|
66
|
+
|
|
67
|
+
### 3. Coverage
|
|
68
|
+
- **Line**: 85%
|
|
69
|
+
- **Branch**: 70% (Missing: `if (!user)`)
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
## 6. Examples
|
|
73
|
+
|
|
74
|
+
### A. Unit Test Generation
|
|
75
|
+
```bash
|
|
76
|
+
/soc-test src/utils/currency.ts --type unit
|
|
77
|
+
```
|
|
78
|
+
*Effect:* Generates `src/utils/currency.test.ts` covering rounding logic and currency codes.
|
|
79
|
+
|
|
80
|
+
### B. Integration Test
|
|
81
|
+
```bash
|
|
82
|
+
/soc-test src/api/auth --type integration
|
|
83
|
+
```
|
|
84
|
+
*Effect:* Sets up a mock database and tests the `/login` flow including DB persistence.
|
|
85
|
+
|
|
86
|
+
## 7. Dependencies & Capabilities
|
|
87
|
+
|
|
88
|
+
### Agents
|
|
89
|
+
- **Quality Assurance**: `@[.opencode/agents/quality.md]` - Primary agent for test generation.
|
|
90
|
+
- **Reviewer**: `@[.opencode/agents/reviewer.md]` - For evaluating test coverage and effectiveness.
|
|
91
|
+
|
|
92
|
+
### Skills
|
|
93
|
+
- **Self Check**: `@[.opencode/skills/self-check/SKILL.md]` - Verifying test results against requirements.
|
|
94
|
+
- **Debug Protocol**: `@[.opencode/skills/debug-protocol/SKILL.md]` - Analyzing test failures.
|
|
95
|
+
|
|
96
|
+
### MCP Integration
|
|
97
|
+
- **`run_command`**: Executing test runners (Jest, Vitest, Pytest).
|
|
98
|
+
- **`filesystem`**: processing integration test artifacts or coverage reports.
|
|
99
|
+
|
|
100
|
+
## 8. Boundaries
|
|
101
|
+
|
|
102
|
+
**Will:**
|
|
103
|
+
- Generate standard test files using the project's framework.
|
|
104
|
+
- Run tests and parse output.
|
|
105
|
+
- Mock external dependencies (S3, Stripe) to prevent flake.
|
|
106
|
+
|
|
107
|
+
**Will Not:**
|
|
108
|
+
- **Guarantee 100% Logic Coverage**: It covers code paths, not necessarily business intent.
|
|
109
|
+
- **Debug Production**: Tests run in `test` environment only.
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Custom workflow creation and execution
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# /soc-workflow
|
|
6
|
+
|
|
7
|
+
## 1. Command Overview
|
|
8
|
+
The `/soc-workflow` command is the "Factory." It allows users to create, list, and run custom sequences of agent commands. It turns a manual, multi-step process (e.g., "Check status -> Pull -> Build -> Deploy") into a single executable command.
|
|
9
|
+
|
|
10
|
+
## 2. Triggers & Routing
|
|
11
|
+
The command is a meta-orchestrator.
|
|
12
|
+
|
|
13
|
+
| Trigger Scenario | Flag | Action |
|
|
14
|
+
| :--- | :--- | :--- |
|
|
15
|
+
| **New Automation** | `create` | Templates a new `.md` file in `.agent/workflows/` |
|
|
16
|
+
| **Run Automation** | `run` | Parses and executes the steps in order |
|
|
17
|
+
| **List Available** | `list` | Scans directory for `.md` files |
|
|
18
|
+
|
|
19
|
+
## 3. Usage & Arguments
|
|
20
|
+
```bash
|
|
21
|
+
/soc-workflow [action] [name]
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
### Arguments
|
|
25
|
+
- **`[action]`**: `create`, `run`, `list`, `edit`, `delete`.
|
|
26
|
+
- **`[name]`**: Name of the workflow (e.g., `deploy`).
|
|
27
|
+
|
|
28
|
+
## 4. Behavioral Flow (Orchestration)
|
|
29
|
+
|
|
30
|
+
### Phase 1: Definition (Create)
|
|
31
|
+
1. **Template**: Creates a standard markdown file with "Steps."
|
|
32
|
+
2. **Define**: User fills in shell commands or agent commands (`/soc-git`, `/soc-test`).
|
|
33
|
+
|
|
34
|
+
### Phase 2: Execution (Run)
|
|
35
|
+
1. **Parse**: Reads the markdown.
|
|
36
|
+
2. **Step**: Executes step 1.
|
|
37
|
+
3. **Check**: If step 1 fails, stop (unless `continue_on_error: true`).
|
|
38
|
+
4. **Next**: Proceed to step 2.
|
|
39
|
+
|
|
40
|
+
## 5. Output Guidelines (The Contract)
|
|
41
|
+
|
|
42
|
+
### Workflow Definition (Template)
|
|
43
|
+
```markdown
|
|
44
|
+
---
|
|
45
|
+
description: Deploy to Staging
|
|
46
|
+
---
|
|
47
|
+
# Deploy Staging
|
|
48
|
+
1. **Test**: `/soc-test --type e2e`
|
|
49
|
+
2. **Build**: `npm run build`
|
|
50
|
+
3. **Deploy**: `/soc-git push origin staging`
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
### Execution Log
|
|
54
|
+
```markdown
|
|
55
|
+
## Workflow: Deploy Staging
|
|
56
|
+
1. [x] **Test**: Passed (2s)
|
|
57
|
+
2. [x] **Build**: Passed (15s)
|
|
58
|
+
3. [x] **Deploy**: Pushed a1b2c3d
|
|
59
|
+
✅ Workflow Complete
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
## 6. Examples
|
|
63
|
+
|
|
64
|
+
### A. Create Release Workflow
|
|
65
|
+
```bash
|
|
66
|
+
/soc-workflow create release
|
|
67
|
+
```
|
|
68
|
+
*Effect:* Creates `.agent/workflows/release.md` for the user to edit.
|
|
69
|
+
|
|
70
|
+
### B. Run Nightly Build
|
|
71
|
+
```bash
|
|
72
|
+
/soc-workflow run nightly
|
|
73
|
+
```
|
|
74
|
+
*Effect:* Runs the sequence defined in `nightly.md`.
|
|
75
|
+
|
|
76
|
+
## 7. Dependencies & Capabilities
|
|
77
|
+
|
|
78
|
+
### Agents
|
|
79
|
+
- **PM Agent**: `@[.opencode/agents/pm-agent.md]` - For oversight.
|
|
80
|
+
|
|
81
|
+
### Skills
|
|
82
|
+
- **None**: It relies on other commands.
|
|
83
|
+
|
|
84
|
+
### MCP Integration
|
|
85
|
+
- **`filesystem`**: Reading/Writing workflow files.
|
|
86
|
+
- **`run_command`**: Executing shell steps.
|
|
87
|
+
|
|
88
|
+
## 8. Boundaries
|
|
89
|
+
|
|
90
|
+
**Will:**
|
|
91
|
+
- Execute commands in sequence.
|
|
92
|
+
- Stop on error.
|
|
93
|
+
- Pass context between steps.
|
|
94
|
+
|
|
95
|
+
**Will Not:**
|
|
96
|
+
- **Auto-Debug**: If a step fails, the workflow just stops.
|
|
97
|
+
- **Parallize**: Steps are currently sequential only.
|