super-opencode 1.1.0 → 1.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.
- package/.opencode/agents/architect.md +84 -84
- package/.opencode/agents/backend.md +124 -124
- package/.opencode/agents/frontend.md +137 -137
- package/.opencode/agents/optimizer.md +51 -51
- package/.opencode/agents/pm-agent.md +105 -105
- package/.opencode/agents/quality.md +107 -107
- package/.opencode/agents/researcher.md +105 -105
- package/.opencode/agents/reviewer.md +80 -80
- package/.opencode/agents/security.md +107 -107
- package/.opencode/agents/writer.md +136 -136
- package/.opencode/commands/soc-analyze.md +136 -137
- package/.opencode/commands/soc-brainstorm.md +109 -110
- package/.opencode/commands/soc-cleanup.md +107 -107
- package/.opencode/commands/soc-design.md +0 -1
- package/.opencode/commands/soc-explain.md +113 -113
- package/.opencode/commands/soc-git.md +104 -104
- package/.opencode/commands/soc-help.md +94 -94
- package/.opencode/commands/soc-implement.md +112 -112
- package/.opencode/commands/soc-improve.md +105 -105
- package/.opencode/commands/soc-pm.md +99 -99
- package/.opencode/commands/soc-research.md +105 -105
- package/.opencode/commands/soc-review.md +102 -102
- package/.opencode/commands/soc-test.md +109 -109
- package/.opencode/commands/soc-workflow.md +97 -97
- package/.opencode/settings.json +3 -3
- package/.opencode/skills/confidence-check/SKILL.md +97 -97
- package/.opencode/skills/debug-protocol/SKILL.md +83 -83
- package/.opencode/skills/reflexion/SKILL.md +108 -108
- package/.opencode/skills/security-audit/SKILL.md +90 -90
- package/.opencode/skills/self-check/SKILL.md +95 -95
- package/.opencode/skills/simplification/SKILL.md +92 -92
- package/AGENTS.md +175 -175
- package/LICENSE +21 -21
- package/dist/cli.js +8 -5
- package/package.json +45 -45
|
@@ -1,107 +1,107 @@
|
|
|
1
|
-
---
|
|
2
|
-
description: "Systematically clean up code, remove dead code, and optimize project structure"
|
|
3
|
-
---
|
|
4
|
-
|
|
5
|
-
# /soc-cleanup
|
|
6
|
-
|
|
7
|
-
## 1. Command Overview
|
|
8
|
-
The `/soc-cleanup` command is the "Janitor" of the codebase. It safely identifies and removes technical debt, unused exports, and dead code. It operates in two modes: `Safe` (conservative) and `Aggressive` (deep cleaning). Its primary directive is "Do No Harm."
|
|
9
|
-
|
|
10
|
-
## 2. Triggers & Routing
|
|
11
|
-
The command routes cleanup tasks based on the `--type` flag.
|
|
12
|
-
|
|
13
|
-
| Trigger Scenario | Flag | Target Agent | Tool Used |
|
|
14
|
-
| :--- | :--- | :--- | :--- |
|
|
15
|
-
| **Dead Code** | `--type code` | `[quality]` | TSPrune, Knip |
|
|
16
|
-
| **Unused Imports** | `--type imports` | `[quality]` | ESLint/Birome |
|
|
17
|
-
| **File Structure** | `--type files` | `[architect]` | Filesystem Analysis |
|
|
18
|
-
| **Deep Clean** | `--type all` | `[quality]` | All tools |
|
|
19
|
-
|
|
20
|
-
## 3. Usage & Arguments
|
|
21
|
-
```bash
|
|
22
|
-
/soc-cleanup [target] [flags]
|
|
23
|
-
```
|
|
24
|
-
|
|
25
|
-
### Arguments
|
|
26
|
-
- **`[target]`**: Directory or file to clean (default: current context).
|
|
27
|
-
|
|
28
|
-
### Flags
|
|
29
|
-
- **`--type [code|imports|files|all]`**: **MANDATORY**.
|
|
30
|
-
- **`--safe`**: (Default) Only removes code with 0 references.
|
|
31
|
-
- **`--aggressive`**: Removes code with indirect/suspect references (requires confirmation).
|
|
32
|
-
- **`--preview`**: Lists changes without applying them (Dry Run).
|
|
33
|
-
|
|
34
|
-
## 4. Behavioral Flow (Orchestration)
|
|
35
|
-
|
|
36
|
-
### Phase 1: Analysis (The Scanner)
|
|
37
|
-
1. **Map**: Scans `[target]` for exports and imports.
|
|
38
|
-
2. **Trace**: Builds a dependency graph.
|
|
39
|
-
3. **Flag**: Identifies "orphan" nodes (code with no incoming edges).
|
|
40
|
-
|
|
41
|
-
### Phase 2: Plan (The Stratagem)
|
|
42
|
-
- If `safe`: Select only orphans with 0 references.
|
|
43
|
-
- If `aggressive`: Select orphans + "soft" references (comments, test-only usage).
|
|
44
|
-
|
|
45
|
-
### Phase 3: Execution (The Broom)
|
|
46
|
-
1. **Backup**: (Implicit) Relies on Git.
|
|
47
|
-
2. **Remove**: Deletes lines/files.
|
|
48
|
-
3. **Verify**: Runs build/tests. If fail -> Revert.
|
|
49
|
-
|
|
50
|
-
## 5. Output Guidelines (The Contract)
|
|
51
|
-
|
|
52
|
-
### Cleanup Report
|
|
53
|
-
```markdown
|
|
54
|
-
## Cleanup Report: [Target]
|
|
55
|
-
|
|
56
|
-
### Summary
|
|
57
|
-
- **Removed**: 15 unused exports
|
|
58
|
-
- **Deleted**: 2 dead files
|
|
59
|
-
- **Bytes Saved**: 4.5KB
|
|
60
|
-
|
|
61
|
-
### Actions Taken
|
|
62
|
-
- [x] Removed `oldFunction` from `src/utils.ts` (0 refs).
|
|
63
|
-
- [x] Deleted `src/components/unused-modal.tsx`.
|
|
64
|
-
|
|
65
|
-
### Skipped (Safety Check)
|
|
66
|
-
- [ ] `legacyAuth.ts` (Referenced in TODO comment).
|
|
67
|
-
```
|
|
68
|
-
|
|
69
|
-
## 6. Examples
|
|
70
|
-
|
|
71
|
-
### A. Safe Import Cleanup
|
|
72
|
-
```bash
|
|
73
|
-
/soc-cleanup src/ --type imports --safe
|
|
74
|
-
```
|
|
75
|
-
*Effect:* Removes unused `import` statements and sorts remaining ones.
|
|
76
|
-
|
|
77
|
-
### B. Dead Code Preview
|
|
78
|
-
```bash
|
|
79
|
-
/soc-cleanup --type code --preview
|
|
80
|
-
```
|
|
81
|
-
*Effect:* Lists all exported functions that are never imported, but does not delete them.
|
|
82
|
-
|
|
83
|
-
## 7. Dependencies & Capabilities
|
|
84
|
-
|
|
85
|
-
### Agents
|
|
86
|
-
- **Quality**: `@[.opencode/agents/quality.md]` - Primary agent for code analysis.
|
|
87
|
-
- **Architect**: `@[.opencode/agents/architect.md]` - For structural cleanup.
|
|
88
|
-
|
|
89
|
-
### Skills
|
|
90
|
-
- **Safety Check**: `@[.opencode/skills/security-audit/SKILL.md]` - ensuring cleanup doesn't remove security gates.
|
|
91
|
-
- **Reflexion**: `@[.opencode/skills/reflexion/SKILL.md]` - Recovering if cleanup breaks the build.
|
|
92
|
-
|
|
93
|
-
### MCP Integration
|
|
94
|
-
- **`context7`**: Verifying if "unused" code is actually a framework entry point (e.g., Next.js pages).
|
|
95
|
-
- **`filesystem`**: Moving and deleting files.
|
|
96
|
-
|
|
97
|
-
## 8. Boundaries
|
|
98
|
-
|
|
99
|
-
**Will:**
|
|
100
|
-
- Remove unused imports.
|
|
101
|
-
- Delete files with 0 references (in `aggressive` mode).
|
|
102
|
-
- Consolidate duplicate logic (if explicitly identified).
|
|
103
|
-
|
|
104
|
-
**Will Not:**
|
|
105
|
-
- **Delete "Commented Out" Code**: Unless explicitly told to.
|
|
106
|
-
- **Touch Config Files**: (e.g., `tsconfig.json`) without explicit intent.
|
|
107
|
-
- **Break Public APIs**: Will not remove exports from `index.ts` files in libraries.
|
|
1
|
+
---
|
|
2
|
+
description: "Systematically clean up code, remove dead code, and optimize project structure"
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# /soc-cleanup
|
|
6
|
+
|
|
7
|
+
## 1. Command Overview
|
|
8
|
+
The `/soc-cleanup` command is the "Janitor" of the codebase. It safely identifies and removes technical debt, unused exports, and dead code. It operates in two modes: `Safe` (conservative) and `Aggressive` (deep cleaning). Its primary directive is "Do No Harm."
|
|
9
|
+
|
|
10
|
+
## 2. Triggers & Routing
|
|
11
|
+
The command routes cleanup tasks based on the `--type` flag.
|
|
12
|
+
|
|
13
|
+
| Trigger Scenario | Flag | Target Agent | Tool Used |
|
|
14
|
+
| :--- | :--- | :--- | :--- |
|
|
15
|
+
| **Dead Code** | `--type code` | `[quality]` | TSPrune, Knip |
|
|
16
|
+
| **Unused Imports** | `--type imports` | `[quality]` | ESLint/Birome |
|
|
17
|
+
| **File Structure** | `--type files` | `[architect]` | Filesystem Analysis |
|
|
18
|
+
| **Deep Clean** | `--type all` | `[quality]` | All tools |
|
|
19
|
+
|
|
20
|
+
## 3. Usage & Arguments
|
|
21
|
+
```bash
|
|
22
|
+
/soc-cleanup [target] [flags]
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
### Arguments
|
|
26
|
+
- **`[target]`**: Directory or file to clean (default: current context).
|
|
27
|
+
|
|
28
|
+
### Flags
|
|
29
|
+
- **`--type [code|imports|files|all]`**: **MANDATORY**.
|
|
30
|
+
- **`--safe`**: (Default) Only removes code with 0 references.
|
|
31
|
+
- **`--aggressive`**: Removes code with indirect/suspect references (requires confirmation).
|
|
32
|
+
- **`--preview`**: Lists changes without applying them (Dry Run).
|
|
33
|
+
|
|
34
|
+
## 4. Behavioral Flow (Orchestration)
|
|
35
|
+
|
|
36
|
+
### Phase 1: Analysis (The Scanner)
|
|
37
|
+
1. **Map**: Scans `[target]` for exports and imports.
|
|
38
|
+
2. **Trace**: Builds a dependency graph.
|
|
39
|
+
3. **Flag**: Identifies "orphan" nodes (code with no incoming edges).
|
|
40
|
+
|
|
41
|
+
### Phase 2: Plan (The Stratagem)
|
|
42
|
+
- If `safe`: Select only orphans with 0 references.
|
|
43
|
+
- If `aggressive`: Select orphans + "soft" references (comments, test-only usage).
|
|
44
|
+
|
|
45
|
+
### Phase 3: Execution (The Broom)
|
|
46
|
+
1. **Backup**: (Implicit) Relies on Git.
|
|
47
|
+
2. **Remove**: Deletes lines/files.
|
|
48
|
+
3. **Verify**: Runs build/tests. If fail -> Revert.
|
|
49
|
+
|
|
50
|
+
## 5. Output Guidelines (The Contract)
|
|
51
|
+
|
|
52
|
+
### Cleanup Report
|
|
53
|
+
```markdown
|
|
54
|
+
## Cleanup Report: [Target]
|
|
55
|
+
|
|
56
|
+
### Summary
|
|
57
|
+
- **Removed**: 15 unused exports
|
|
58
|
+
- **Deleted**: 2 dead files
|
|
59
|
+
- **Bytes Saved**: 4.5KB
|
|
60
|
+
|
|
61
|
+
### Actions Taken
|
|
62
|
+
- [x] Removed `oldFunction` from `src/utils.ts` (0 refs).
|
|
63
|
+
- [x] Deleted `src/components/unused-modal.tsx`.
|
|
64
|
+
|
|
65
|
+
### Skipped (Safety Check)
|
|
66
|
+
- [ ] `legacyAuth.ts` (Referenced in TODO comment).
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
## 6. Examples
|
|
70
|
+
|
|
71
|
+
### A. Safe Import Cleanup
|
|
72
|
+
```bash
|
|
73
|
+
/soc-cleanup src/ --type imports --safe
|
|
74
|
+
```
|
|
75
|
+
*Effect:* Removes unused `import` statements and sorts remaining ones.
|
|
76
|
+
|
|
77
|
+
### B. Dead Code Preview
|
|
78
|
+
```bash
|
|
79
|
+
/soc-cleanup --type code --preview
|
|
80
|
+
```
|
|
81
|
+
*Effect:* Lists all exported functions that are never imported, but does not delete them.
|
|
82
|
+
|
|
83
|
+
## 7. Dependencies & Capabilities
|
|
84
|
+
|
|
85
|
+
### Agents
|
|
86
|
+
- **Quality**: `@[.opencode/agents/quality.md]` - Primary agent for code analysis.
|
|
87
|
+
- **Architect**: `@[.opencode/agents/architect.md]` - For structural cleanup.
|
|
88
|
+
|
|
89
|
+
### Skills
|
|
90
|
+
- **Safety Check**: `@[.opencode/skills/security-audit/SKILL.md]` - ensuring cleanup doesn't remove security gates.
|
|
91
|
+
- **Reflexion**: `@[.opencode/skills/reflexion/SKILL.md]` - Recovering if cleanup breaks the build.
|
|
92
|
+
|
|
93
|
+
### MCP Integration
|
|
94
|
+
- **`context7`**: Verifying if "unused" code is actually a framework entry point (e.g., Next.js pages).
|
|
95
|
+
- **`filesystem`**: Moving and deleting files.
|
|
96
|
+
|
|
97
|
+
## 8. Boundaries
|
|
98
|
+
|
|
99
|
+
**Will:**
|
|
100
|
+
- Remove unused imports.
|
|
101
|
+
- Delete files with 0 references (in `aggressive` mode).
|
|
102
|
+
- Consolidate duplicate logic (if explicitly identified).
|
|
103
|
+
|
|
104
|
+
**Will Not:**
|
|
105
|
+
- **Delete "Commented Out" Code**: Unless explicitly told to.
|
|
106
|
+
- **Touch Config Files**: (e.g., `tsconfig.json`) without explicit intent.
|
|
107
|
+
- **Break Public APIs**: Will not remove exports from `index.ts` files in libraries.
|
|
@@ -1,113 +1,113 @@
|
|
|
1
|
-
---
|
|
2
|
-
description: Code explanation and understanding
|
|
3
|
-
---
|
|
4
|
-
|
|
5
|
-
# /soc-explain
|
|
6
|
-
|
|
7
|
-
## 1. Command Overview
|
|
8
|
-
The `/soc-explain` command is the "Tutor." It translates complex code, errors, or concepts into natural language. It adapts its depth to the user's needs, from simple analogies to expert technical deep-dives. It generates documentation that can be saved.
|
|
9
|
-
|
|
10
|
-
## 2. Triggers & Routing
|
|
11
|
-
The command uses the `writer` agent effectively to synthesize information.
|
|
12
|
-
|
|
13
|
-
| Trigger Scenario | Flag | Target Agent | Style |
|
|
14
|
-
| :--- | :--- | :--- | :--- |
|
|
15
|
-
| **High Level** | `--depth simple` | `[writer]` | Analogies, non-technical |
|
|
16
|
-
| **Standard** | `--depth detailed` | `[writer]` | Code logic, flow, syntax |
|
|
17
|
-
| **Deep Dive** | `--depth expert` | `[architect]` | Memory, performance, edge cases |
|
|
18
|
-
|
|
19
|
-
## 3. Usage & Arguments
|
|
20
|
-
```bash
|
|
21
|
-
/soc-explain [target] [flags]
|
|
22
|
-
```
|
|
23
|
-
|
|
24
|
-
### Arguments
|
|
25
|
-
- **`[target]`**: Code snippet, file path, error message, or concept (e.g., "Dependency Injection").
|
|
26
|
-
|
|
27
|
-
### Flags
|
|
28
|
-
- **`--depth [simple|detailed|expert]`**: (Default: `detailed`).
|
|
29
|
-
- **`--context [file]`**: Add extra context for better explanation.
|
|
30
|
-
|
|
31
|
-
## 4. Behavioral Flow (Orchestration)
|
|
32
|
-
|
|
33
|
-
### Phase 1: Analysis
|
|
34
|
-
1. **Parse**: Is the target a file, a string, or a concept?
|
|
35
|
-
2. **Context**: If it's an error, where did it come from? If it's code, what language?
|
|
36
|
-
|
|
37
|
-
### Phase 2: Synthesis (The Lesson)
|
|
38
|
-
- **Analogy**: "Think of a Promise like a pizza buzzer..."
|
|
39
|
-
- **Technical**: "It wraps the value in a microtask queue..."
|
|
40
|
-
- **Example**: "Here is how you use it:"
|
|
41
|
-
|
|
42
|
-
### Phase 3: Formatting
|
|
43
|
-
- Structure with clear Headers.
|
|
44
|
-
- Use Code Blocks for syntax.
|
|
45
|
-
- Highlight "Key Takeaways."
|
|
46
|
-
|
|
47
|
-
## 5. Output Guidelines (The Contract)
|
|
48
|
-
|
|
49
|
-
### Explanation Document
|
|
50
|
-
```markdown
|
|
51
|
-
## Explanation: [Topic]
|
|
52
|
-
|
|
53
|
-
### Summary
|
|
54
|
-
[1-2 sentences. The TL;DR.]
|
|
55
|
-
|
|
56
|
-
### Conceptual Analogy (If Simple)
|
|
57
|
-
[Mundane comparison]
|
|
58
|
-
|
|
59
|
-
### Technical Breakdown
|
|
60
|
-
- **Component A**: Does X.
|
|
61
|
-
- **Component B**: Does Y.
|
|
62
|
-
|
|
63
|
-
### Code Example
|
|
64
|
-
```javascript
|
|
65
|
-
// Before
|
|
66
|
-
badCode()
|
|
67
|
-
|
|
68
|
-
// After (corrected/explained)
|
|
69
|
-
goodCode()
|
|
70
|
-
```
|
|
71
|
-
|
|
72
|
-
### Key Takeaways
|
|
73
|
-
1. [Point 1]
|
|
74
|
-
2. [Point 2]
|
|
75
|
-
```
|
|
76
|
-
|
|
77
|
-
## 6. Examples
|
|
78
|
-
|
|
79
|
-
### A. Async/Await (Expert)
|
|
80
|
-
```bash
|
|
81
|
-
/soc-explain "How Node Event Loop works" --depth expert
|
|
82
|
-
```
|
|
83
|
-
*Effect:* Explains Phases (Timers, Poll, Check), Microtasks vs Macrotasks, and `process.nextTick`.
|
|
84
|
-
|
|
85
|
-
### B. Error Parsing
|
|
86
|
-
```bash
|
|
87
|
-
/soc-explain "TypeError: Cannot read property 'map' of undefined"
|
|
88
|
-
```
|
|
89
|
-
*Effect:* Explains that the array is missing, helps identify the source variable, suggests Optional Chaining (`?.`).
|
|
90
|
-
|
|
91
|
-
## 7. Dependencies & Capabilities
|
|
92
|
-
|
|
93
|
-
### Agents
|
|
94
|
-
- **Writer**: `@[.opencode/agents/writer.md]` - Primary explainer.
|
|
95
|
-
- **Architect**: `@[.opencode/agents/architect.md]` - For system-level concepts.
|
|
96
|
-
|
|
97
|
-
### Skills
|
|
98
|
-
- **Simplification**: `@[.opencode/skills/simplification/SKILL.md]` - To de-jargonize complex topics.
|
|
99
|
-
|
|
100
|
-
### MCP Integration
|
|
101
|
-
- **`context7`**: Fetching official docs to cite sources.
|
|
102
|
-
- **`read_file`**: Reading the full content of the file being explained.
|
|
103
|
-
|
|
104
|
-
## 8. Boundaries
|
|
105
|
-
|
|
106
|
-
**Will:**
|
|
107
|
-
- Explain *why* code works.
|
|
108
|
-
- Suggest *best practices*.
|
|
109
|
-
- Debug *logic* errors via explanation.
|
|
110
|
-
|
|
111
|
-
**Will Not:**
|
|
112
|
-
- **Write the Fix**: It explains the fix; `/soc-implement` writes it.
|
|
113
|
-
- **Execute Code**: It analyzes static text.
|
|
1
|
+
---
|
|
2
|
+
description: Code explanation and understanding
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# /soc-explain
|
|
6
|
+
|
|
7
|
+
## 1. Command Overview
|
|
8
|
+
The `/soc-explain` command is the "Tutor." It translates complex code, errors, or concepts into natural language. It adapts its depth to the user's needs, from simple analogies to expert technical deep-dives. It generates documentation that can be saved.
|
|
9
|
+
|
|
10
|
+
## 2. Triggers & Routing
|
|
11
|
+
The command uses the `writer` agent effectively to synthesize information.
|
|
12
|
+
|
|
13
|
+
| Trigger Scenario | Flag | Target Agent | Style |
|
|
14
|
+
| :--- | :--- | :--- | :--- |
|
|
15
|
+
| **High Level** | `--depth simple` | `[writer]` | Analogies, non-technical |
|
|
16
|
+
| **Standard** | `--depth detailed` | `[writer]` | Code logic, flow, syntax |
|
|
17
|
+
| **Deep Dive** | `--depth expert` | `[architect]` | Memory, performance, edge cases |
|
|
18
|
+
|
|
19
|
+
## 3. Usage & Arguments
|
|
20
|
+
```bash
|
|
21
|
+
/soc-explain [target] [flags]
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
### Arguments
|
|
25
|
+
- **`[target]`**: Code snippet, file path, error message, or concept (e.g., "Dependency Injection").
|
|
26
|
+
|
|
27
|
+
### Flags
|
|
28
|
+
- **`--depth [simple|detailed|expert]`**: (Default: `detailed`).
|
|
29
|
+
- **`--context [file]`**: Add extra context for better explanation.
|
|
30
|
+
|
|
31
|
+
## 4. Behavioral Flow (Orchestration)
|
|
32
|
+
|
|
33
|
+
### Phase 1: Analysis
|
|
34
|
+
1. **Parse**: Is the target a file, a string, or a concept?
|
|
35
|
+
2. **Context**: If it's an error, where did it come from? If it's code, what language?
|
|
36
|
+
|
|
37
|
+
### Phase 2: Synthesis (The Lesson)
|
|
38
|
+
- **Analogy**: "Think of a Promise like a pizza buzzer..."
|
|
39
|
+
- **Technical**: "It wraps the value in a microtask queue..."
|
|
40
|
+
- **Example**: "Here is how you use it:"
|
|
41
|
+
|
|
42
|
+
### Phase 3: Formatting
|
|
43
|
+
- Structure with clear Headers.
|
|
44
|
+
- Use Code Blocks for syntax.
|
|
45
|
+
- Highlight "Key Takeaways."
|
|
46
|
+
|
|
47
|
+
## 5. Output Guidelines (The Contract)
|
|
48
|
+
|
|
49
|
+
### Explanation Document
|
|
50
|
+
```markdown
|
|
51
|
+
## Explanation: [Topic]
|
|
52
|
+
|
|
53
|
+
### Summary
|
|
54
|
+
[1-2 sentences. The TL;DR.]
|
|
55
|
+
|
|
56
|
+
### Conceptual Analogy (If Simple)
|
|
57
|
+
[Mundane comparison]
|
|
58
|
+
|
|
59
|
+
### Technical Breakdown
|
|
60
|
+
- **Component A**: Does X.
|
|
61
|
+
- **Component B**: Does Y.
|
|
62
|
+
|
|
63
|
+
### Code Example
|
|
64
|
+
```javascript
|
|
65
|
+
// Before
|
|
66
|
+
badCode()
|
|
67
|
+
|
|
68
|
+
// After (corrected/explained)
|
|
69
|
+
goodCode()
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
### Key Takeaways
|
|
73
|
+
1. [Point 1]
|
|
74
|
+
2. [Point 2]
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
## 6. Examples
|
|
78
|
+
|
|
79
|
+
### A. Async/Await (Expert)
|
|
80
|
+
```bash
|
|
81
|
+
/soc-explain "How Node Event Loop works" --depth expert
|
|
82
|
+
```
|
|
83
|
+
*Effect:* Explains Phases (Timers, Poll, Check), Microtasks vs Macrotasks, and `process.nextTick`.
|
|
84
|
+
|
|
85
|
+
### B. Error Parsing
|
|
86
|
+
```bash
|
|
87
|
+
/soc-explain "TypeError: Cannot read property 'map' of undefined"
|
|
88
|
+
```
|
|
89
|
+
*Effect:* Explains that the array is missing, helps identify the source variable, suggests Optional Chaining (`?.`).
|
|
90
|
+
|
|
91
|
+
## 7. Dependencies & Capabilities
|
|
92
|
+
|
|
93
|
+
### Agents
|
|
94
|
+
- **Writer**: `@[.opencode/agents/writer.md]` - Primary explainer.
|
|
95
|
+
- **Architect**: `@[.opencode/agents/architect.md]` - For system-level concepts.
|
|
96
|
+
|
|
97
|
+
### Skills
|
|
98
|
+
- **Simplification**: `@[.opencode/skills/simplification/SKILL.md]` - To de-jargonize complex topics.
|
|
99
|
+
|
|
100
|
+
### MCP Integration
|
|
101
|
+
- **`context7`**: Fetching official docs to cite sources.
|
|
102
|
+
- **`read_file`**: Reading the full content of the file being explained.
|
|
103
|
+
|
|
104
|
+
## 8. Boundaries
|
|
105
|
+
|
|
106
|
+
**Will:**
|
|
107
|
+
- Explain *why* code works.
|
|
108
|
+
- Suggest *best practices*.
|
|
109
|
+
- Debug *logic* errors via explanation.
|
|
110
|
+
|
|
111
|
+
**Will Not:**
|
|
112
|
+
- **Write the Fix**: It explains the fix; `/soc-implement` writes it.
|
|
113
|
+
- **Execute Code**: It analyzes static text.
|
|
@@ -1,104 +1,104 @@
|
|
|
1
|
-
---
|
|
2
|
-
description: "Git operations with intelligent commit messages and workflow optimization"
|
|
3
|
-
---
|
|
4
|
-
|
|
5
|
-
# /soc-git
|
|
6
|
-
|
|
7
|
-
## 1. Command Overview
|
|
8
|
-
The `/soc-git` command is the "Version Controller." It wraps standard git operations with intelligence. It can analyze diffs to generate Conventional Commit messages, check for accidental secrets before pushing, and manage branching strategies.
|
|
9
|
-
|
|
10
|
-
## 2. Triggers & Routing
|
|
11
|
-
The command routes to the `writer` agent for message generation and `security` for pre-push checks.
|
|
12
|
-
|
|
13
|
-
| Trigger Scenario | Flag | Target Agent | Action |
|
|
14
|
-
| :--- | :--- | :--- | :--- |
|
|
15
|
-
| **Commit Message** | `--smart` | `[writer]` | Generate `feat(scope): desc` |
|
|
16
|
-
| **Pre-Push** | `push` | `[security]` | Scan for secrets |
|
|
17
|
-
| **Branching** | `branch` | `[pm-agent]` | Enforce naming conventions |
|
|
18
|
-
|
|
19
|
-
## 3. Usage & Arguments
|
|
20
|
-
```bash
|
|
21
|
-
/soc-git [operation] [args] [flags]
|
|
22
|
-
```
|
|
23
|
-
|
|
24
|
-
### Arguments
|
|
25
|
-
- **`[operation]`**: `commit`, `push`, `pull`, `branch`, `status`, `diff`.
|
|
26
|
-
|
|
27
|
-
### Flags
|
|
28
|
-
- **`--smart`**: Auto-generate messages/descriptions.
|
|
29
|
-
- **`--force`**: Bypass safety checks (Use with caution).
|
|
30
|
-
|
|
31
|
-
## 4. Behavioral Flow (Orchestration)
|
|
32
|
-
|
|
33
|
-
### Phase 1: Context Analysis
|
|
34
|
-
1. **Status Check**: Run `git status`.
|
|
35
|
-
2. **Diff Analysis**: Run `git diff --staged`.
|
|
36
|
-
3. **Safety Check**: Scan pending changes for keys/env files.
|
|
37
|
-
|
|
38
|
-
### Phase 2: Operations
|
|
39
|
-
- **Commit**:
|
|
40
|
-
- If `--smart`: Feed diff to LLM -> Generate Conventional Commit.
|
|
41
|
-
- If standard: Execute `git commit -m`.
|
|
42
|
-
- **Push**:
|
|
43
|
-
- Check upstream. If missing, auto-set `-u origin`.
|
|
44
|
-
- **Branch**:
|
|
45
|
-
- Normalize name (e.g., `My Feature` -> `feat/my-feature`).
|
|
46
|
-
|
|
47
|
-
### Phase 3: Post-Op
|
|
48
|
-
- Confirm success.
|
|
49
|
-
- Show Next Step (e.g., "Ready to open PR").
|
|
50
|
-
|
|
51
|
-
## 5. Output Guidelines (The Contract)
|
|
52
|
-
|
|
53
|
-
### Git Operation Result
|
|
54
|
-
```markdown
|
|
55
|
-
## Git: [Operation]
|
|
56
|
-
|
|
57
|
-
### Status
|
|
58
|
-
✅ Success / ❌ Failure
|
|
59
|
-
|
|
60
|
-
### Details
|
|
61
|
-
- **Branch**: `feat/user-auth`
|
|
62
|
-
- **Commit**: `a1b2c3d` - "feat(auth): add login route"
|
|
63
|
-
|
|
64
|
-
### Tips
|
|
65
|
-
- [ ] Run `/test` before pushing.
|
|
66
|
-
```
|
|
67
|
-
|
|
68
|
-
## 6. Examples
|
|
69
|
-
|
|
70
|
-
### A. Smart Commit
|
|
71
|
-
```bash
|
|
72
|
-
/soc-git commit --smart
|
|
73
|
-
```
|
|
74
|
-
*Effect:* Analyzes staged files, detects added login logic, commits with: `feat(auth): implement user login flow`.
|
|
75
|
-
|
|
76
|
-
### B. Branch Creation
|
|
77
|
-
```bash
|
|
78
|
-
/soc-git branch "Update README"
|
|
79
|
-
```
|
|
80
|
-
*Effect:* Creates and checks out `docs/update-readme` (auto-categorized).
|
|
81
|
-
|
|
82
|
-
## 7. Dependencies & Capabilities
|
|
83
|
-
|
|
84
|
-
### Agents
|
|
85
|
-
- **Writer**: `@[.opencode/agents/writer.md]` - For commit messages.
|
|
86
|
-
- **Security**: `@[.opencode/agents/security.md]` - For pre-commit hooks.
|
|
87
|
-
|
|
88
|
-
### Skills
|
|
89
|
-
- **Security Audit**: `@[.opencode/skills/security-audit/SKILL.md]` - Scanning staged files.
|
|
90
|
-
|
|
91
|
-
### MCP Integration
|
|
92
|
-
- **`run_command`**: Executing actual git binaries.
|
|
93
|
-
- **`filesystem`**: Reading ignores and config.
|
|
94
|
-
|
|
95
|
-
## 8. Boundaries
|
|
96
|
-
|
|
97
|
-
**Will:**
|
|
98
|
-
- Execute git commands.
|
|
99
|
-
- Generate text for messages.
|
|
100
|
-
- Block commits with secrets (unless `--force`).
|
|
101
|
-
|
|
102
|
-
**Will Not:**
|
|
103
|
-
- **Solve Merge Conflicts**: It will report them, but user must resolve.
|
|
104
|
-
- **Rewrite History**: No `rebase` or `reset --hard` without explicit user confirmation.
|
|
1
|
+
---
|
|
2
|
+
description: "Git operations with intelligent commit messages and workflow optimization"
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# /soc-git
|
|
6
|
+
|
|
7
|
+
## 1. Command Overview
|
|
8
|
+
The `/soc-git` command is the "Version Controller." It wraps standard git operations with intelligence. It can analyze diffs to generate Conventional Commit messages, check for accidental secrets before pushing, and manage branching strategies.
|
|
9
|
+
|
|
10
|
+
## 2. Triggers & Routing
|
|
11
|
+
The command routes to the `writer` agent for message generation and `security` for pre-push checks.
|
|
12
|
+
|
|
13
|
+
| Trigger Scenario | Flag | Target Agent | Action |
|
|
14
|
+
| :--- | :--- | :--- | :--- |
|
|
15
|
+
| **Commit Message** | `--smart` | `[writer]` | Generate `feat(scope): desc` |
|
|
16
|
+
| **Pre-Push** | `push` | `[security]` | Scan for secrets |
|
|
17
|
+
| **Branching** | `branch` | `[pm-agent]` | Enforce naming conventions |
|
|
18
|
+
|
|
19
|
+
## 3. Usage & Arguments
|
|
20
|
+
```bash
|
|
21
|
+
/soc-git [operation] [args] [flags]
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
### Arguments
|
|
25
|
+
- **`[operation]`**: `commit`, `push`, `pull`, `branch`, `status`, `diff`.
|
|
26
|
+
|
|
27
|
+
### Flags
|
|
28
|
+
- **`--smart`**: Auto-generate messages/descriptions.
|
|
29
|
+
- **`--force`**: Bypass safety checks (Use with caution).
|
|
30
|
+
|
|
31
|
+
## 4. Behavioral Flow (Orchestration)
|
|
32
|
+
|
|
33
|
+
### Phase 1: Context Analysis
|
|
34
|
+
1. **Status Check**: Run `git status`.
|
|
35
|
+
2. **Diff Analysis**: Run `git diff --staged`.
|
|
36
|
+
3. **Safety Check**: Scan pending changes for keys/env files.
|
|
37
|
+
|
|
38
|
+
### Phase 2: Operations
|
|
39
|
+
- **Commit**:
|
|
40
|
+
- If `--smart`: Feed diff to LLM -> Generate Conventional Commit.
|
|
41
|
+
- If standard: Execute `git commit -m`.
|
|
42
|
+
- **Push**:
|
|
43
|
+
- Check upstream. If missing, auto-set `-u origin`.
|
|
44
|
+
- **Branch**:
|
|
45
|
+
- Normalize name (e.g., `My Feature` -> `feat/my-feature`).
|
|
46
|
+
|
|
47
|
+
### Phase 3: Post-Op
|
|
48
|
+
- Confirm success.
|
|
49
|
+
- Show Next Step (e.g., "Ready to open PR").
|
|
50
|
+
|
|
51
|
+
## 5. Output Guidelines (The Contract)
|
|
52
|
+
|
|
53
|
+
### Git Operation Result
|
|
54
|
+
```markdown
|
|
55
|
+
## Git: [Operation]
|
|
56
|
+
|
|
57
|
+
### Status
|
|
58
|
+
✅ Success / ❌ Failure
|
|
59
|
+
|
|
60
|
+
### Details
|
|
61
|
+
- **Branch**: `feat/user-auth`
|
|
62
|
+
- **Commit**: `a1b2c3d` - "feat(auth): add login route"
|
|
63
|
+
|
|
64
|
+
### Tips
|
|
65
|
+
- [ ] Run `/test` before pushing.
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
## 6. Examples
|
|
69
|
+
|
|
70
|
+
### A. Smart Commit
|
|
71
|
+
```bash
|
|
72
|
+
/soc-git commit --smart
|
|
73
|
+
```
|
|
74
|
+
*Effect:* Analyzes staged files, detects added login logic, commits with: `feat(auth): implement user login flow`.
|
|
75
|
+
|
|
76
|
+
### B. Branch Creation
|
|
77
|
+
```bash
|
|
78
|
+
/soc-git branch "Update README"
|
|
79
|
+
```
|
|
80
|
+
*Effect:* Creates and checks out `docs/update-readme` (auto-categorized).
|
|
81
|
+
|
|
82
|
+
## 7. Dependencies & Capabilities
|
|
83
|
+
|
|
84
|
+
### Agents
|
|
85
|
+
- **Writer**: `@[.opencode/agents/writer.md]` - For commit messages.
|
|
86
|
+
- **Security**: `@[.opencode/agents/security.md]` - For pre-commit hooks.
|
|
87
|
+
|
|
88
|
+
### Skills
|
|
89
|
+
- **Security Audit**: `@[.opencode/skills/security-audit/SKILL.md]` - Scanning staged files.
|
|
90
|
+
|
|
91
|
+
### MCP Integration
|
|
92
|
+
- **`run_command`**: Executing actual git binaries.
|
|
93
|
+
- **`filesystem`**: Reading ignores and config.
|
|
94
|
+
|
|
95
|
+
## 8. Boundaries
|
|
96
|
+
|
|
97
|
+
**Will:**
|
|
98
|
+
- Execute git commands.
|
|
99
|
+
- Generate text for messages.
|
|
100
|
+
- Block commits with secrets (unless `--force`).
|
|
101
|
+
|
|
102
|
+
**Will Not:**
|
|
103
|
+
- **Solve Merge Conflicts**: It will report them, but user must resolve.
|
|
104
|
+
- **Rewrite History**: No `rebase` or `reset --hard` without explicit user confirmation.
|