Skip to content

Commit fff3e44

Browse files
authored
Merge pull request #21 from d-oit/feature/adminEditor-code-quality-improvements
Feature/admin editor code quality improvements
2 parents 8bd4df6 + ca47215 commit fff3e44

File tree

163 files changed

+178616
-44051
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

163 files changed

+178616
-44051
lines changed

.opencode/.gitkeep

Whitespace-only changes.
Lines changed: 269 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,269 @@
1+
# OpenCode Agent Subfolder Structure
2+
3+
This document describes the new subfolder organization for OpenCode agents and the platform-specific management system.
4+
5+
## Directory Structure
6+
7+
```
8+
.opencode/agent/
9+
├── common/ # Always active agents
10+
│ ├── agent-orchestrator.md
11+
│ ├── code-reviewer.md
12+
│ ├── test-engineer.md
13+
│ └── ...
14+
├── platforms/ # Platform-specific agents
15+
│ ├── codeberg/
16+
│ │ ├── codeberg-specialist.md
17+
│ │ └── codeberg-workflow-manager.md
18+
│ ├── github/
19+
│ │ ├── github-specialist.md.disabled
20+
│ │ └── github-workflow-manager.md.disabled
21+
│ └── ...
22+
├── domains/ # Domain-specific agents
23+
│ ├── api/
24+
│ │ ├── api-designer.md
25+
│ │ └── database-specialist.md
26+
│ ├── ui/
27+
│ │ └── ui-ux-designer.md
28+
│ └── auth/
29+
└── general/ # General-purpose agents
30+
├── agent-creator.md
31+
├── code-architect.md
32+
└── ...
33+
```
34+
35+
## Platform Management
36+
37+
### Automatic Platform Detection
38+
39+
The system automatically detects your git platform based on repository files:
40+
41+
```bash
42+
# Detect platform
43+
npm run platform:detect
44+
45+
# Output: Detected platform: codeberg
46+
```
47+
48+
### Manual Platform Activation
49+
50+
```bash
51+
# Activate Codeberg agents
52+
npm run platform:codeberg
53+
54+
# Activate GitHub agents
55+
npm run platform:github
56+
57+
# Activate other platforms
58+
npm run platform:gitlab
59+
npm run platform:gitea
60+
npm run platform:forgejo
61+
```
62+
63+
### Setup for New Projects
64+
65+
```bash
66+
# Auto-setup based on detected platform
67+
npm run platform:setup
68+
69+
# This will:
70+
# 1. Detect your git platform
71+
# 2. Activate appropriate agents
72+
# 3. Deactivate conflicting agents
73+
```
74+
75+
## Agent Categories
76+
77+
### Common Agents (Always Active)
78+
- **agent-orchestrator**: Coordinates complex tasks
79+
- **code-reviewer**: Code quality and security analysis
80+
- **test-engineer**: Testing strategy and implementation
81+
- **security-auditor**: Security assessments
82+
- **performance-optimizer**: Performance analysis
83+
- **documentation-maintainer**: Documentation management
84+
85+
### Platform-Specific Agents
86+
- **codeberg-specialist**: Codeberg repository management
87+
- **github-specialist**: GitHub repository management
88+
- **gitlab-specialist**: GitLab repository management
89+
- **gitea-specialist**: Gitea repository management
90+
- **forgejo-specialist**: Forgejo repository management
91+
92+
### Domain-Specific Agents
93+
- **api-designer**: RESTful and GraphQL API design
94+
- **database-specialist**: Database schema and optimization
95+
- **ui-ux-designer**: User interface and experience design
96+
97+
### General-Purpose Agents
98+
- **agent-creator**: Create and manage OpenCode agents
99+
- **code-architect**: System architecture design
100+
- **ci-cd-manager**: CI/CD pipeline management
101+
- **deployment-specialist**: Deployment and environment management
102+
103+
## Scripts
104+
105+
### Platform Management
106+
```bash
107+
npm run platform:detect # Detect git platform
108+
npm run platform:setup # Auto-setup for detected platform
109+
npm run platform:codeberg # Activate Codeberg agents
110+
npm run platform:github # Activate GitHub agents
111+
npm run platform:gitlab # Activate GitLab agents
112+
npm run platform:gitea # Activate Gitea agents
113+
npm run platform:forgejo # Activate Forgejo agents
114+
```
115+
116+
### Agent Management
117+
```bash
118+
npm run agents:list # List active agents
119+
npm run agents:validate # Validate agent dependencies
120+
npm run agents:clean # Remove deactivated agents
121+
```
122+
123+
## Agent Dependencies
124+
125+
The system includes dependency management to ensure proper agent activation:
126+
127+
```json
128+
{
129+
"codeberg-specialist": {
130+
"requires": ["agent-orchestrator"],
131+
"conflicts": ["github-specialist", "gitlab-specialist"],
132+
"platform": "codeberg"
133+
}
134+
}
135+
```
136+
137+
### Validation
138+
```bash
139+
npm run agents:validate
140+
```
141+
142+
This checks:
143+
- Required agents are present and active
144+
- Conflicting agents are not active
145+
- Platform-specific agents match the current platform
146+
147+
## File Organization Rules
148+
149+
### Agent File Naming
150+
- Active agents: `agent-name.md`
151+
- Inactive agents: `agent-name.md.disabled`
152+
153+
### Platform Detection Logic
154+
1. Check for `.codeberg/` directory → Codeberg
155+
2. Check for `.github/workflows/` → GitHub
156+
3. Check for `.gitlab-ci.yml` → GitLab
157+
4. Check for `.gitea/` directory → Gitea
158+
5. Check for `.forgejo/` directory → Forgejo
159+
6. Default to generic
160+
161+
## Migration Guide
162+
163+
### For Existing Projects
164+
165+
1. **Backup current agents**:
166+
```bash
167+
cp -r .opencode/agent .opencode/agent.backup
168+
```
169+
170+
2. **Run platform setup**:
171+
```bash
172+
npm run platform:setup
173+
```
174+
175+
3. **Validate setup**:
176+
```bash
177+
npm run agents:validate
178+
npm run agents:list
179+
```
180+
181+
### For New Projects
182+
183+
1. **Initialize with platform detection**:
184+
```bash
185+
npm run platform:setup
186+
```
187+
188+
2. **Customize as needed**:
189+
```bash
190+
# Edit agent configurations
191+
# Add domain-specific agents
192+
# Modify platform-specific settings
193+
```
194+
195+
## Best Practices
196+
197+
### 1. Platform Consistency
198+
- Use the same platform for all repositories in an organization
199+
- Document platform choice in project README
200+
- Set up platform-specific CI/CD workflows
201+
202+
### 2. Agent Customization
203+
- Start with common agents for all projects
204+
- Add platform-specific agents based on needs
205+
- Create domain-specific agents for complex projects
206+
207+
### 3. Dependency Management
208+
- Always run validation after agent changes
209+
- Check for conflicts before activating new agents
210+
- Keep agent dependencies documented
211+
212+
### 4. Version Control
213+
- Commit active agent configurations
214+
- Use .disabled for inactive agents (they're ignored)
215+
- Document platform-specific customizations
216+
217+
## Troubleshooting
218+
219+
### Platform Not Detected
220+
```bash
221+
# Check repository structure
222+
ls -la | grep -E '\.(github|codeberg|gitlab|gitea|forgejo)'
223+
224+
# Manual platform activation
225+
npm run platform:codeberg # or your platform
226+
```
227+
228+
### Agent Conflicts
229+
```bash
230+
# Validate dependencies
231+
npm run agents:validate
232+
233+
# Check active agents
234+
npm run agents:list
235+
236+
# Clean up deactivated agents
237+
npm run agents:clean
238+
```
239+
240+
### Missing Required Agents
241+
```bash
242+
# Check if required agents exist
243+
find .opencode/agent -name "*required-agent*"
244+
245+
# Re-run platform setup
246+
npm run platform:setup
247+
```
248+
249+
## Integration with CI/CD
250+
251+
### GitHub Actions Example
252+
```yaml
253+
- name: Setup OpenCode Platform
254+
run: npm run platform:setup
255+
256+
- name: Validate Agent Configuration
257+
run: npm run agents:validate
258+
```
259+
260+
### Codeberg Actions Example
261+
```yaml
262+
- name: Setup OpenCode Platform
263+
run: npm run platform:setup
264+
265+
- name: Validate Agent Configuration
266+
run: npm run agents:validate
267+
```
268+
269+
This subfolder structure provides excellent organization, platform flexibility, and maintainability for OpenCode projects.

.opencode/agent-dependencies.json

Lines changed: 128 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
1+
{
2+
"@common/agent-orchestrator": {
3+
"description": "Coordinates complex multi-step tasks across multiple agents",
4+
"requires": [],
5+
"conflicts": [],
6+
"always_active": true
7+
},
8+
"@common/code-reviewer": {
9+
"description": "Analyzes code quality, security, and adherence to best practices",
10+
"requires": [],
11+
"conflicts": [],
12+
"always_active": true
13+
},
14+
"@common/test-engineer": {
15+
"description": "Develops comprehensive test suites and testing strategies",
16+
"requires": [],
17+
"conflicts": [],
18+
"always_active": true
19+
},
20+
"@common/security-auditor": {
21+
"description": "Conducts security assessments and implements security best practices",
22+
"requires": [],
23+
"conflicts": [],
24+
"always_active": true
25+
},
26+
"@common/performance-optimizer": {
27+
"description": "Analyzes and optimizes application performance and resource usage",
28+
"requires": [],
29+
"conflicts": [],
30+
"always_active": true
31+
},
32+
"@common/documentation-maintainer": {
33+
"description": "Creates and maintains comprehensive project documentation",
34+
"requires": [],
35+
"conflicts": [],
36+
"always_active": true
37+
},
38+
"@platforms/codeberg/codeberg-specialist": {
39+
"description": "Codeberg platform specialist for repository management, issues, pull requests, and CI/CD integration",
40+
"requires": ["@common/agent-orchestrator"],
41+
"conflicts": ["@platforms/github/github-specialist", "@platforms/gitlab/gitlab-specialist", "@platforms/gitea/gitea-specialist"],
42+
"platform": "codeberg"
43+
},
44+
"@platforms/codeberg/codeberg-workflow-manager": {
45+
"description": "Manages Codeberg Actions workflows and Woodpecker CI/CD pipelines",
46+
"requires": ["@platforms/codeberg/codeberg-specialist"],
47+
"conflicts": ["@platforms/github/github-workflow-manager", "@platforms/gitlab/gitlab-ci-manager"],
48+
"platform": "codeberg"
49+
},
50+
"@platforms/github/github-specialist": {
51+
"description": "GitHub platform specialist for repository management, issues, pull requests, and CI/CD integration",
52+
"requires": ["@common/agent-orchestrator"],
53+
"conflicts": ["@platforms/codeberg/codeberg-specialist", "@platforms/gitlab/gitlab-specialist", "@platforms/gitea/gitea-specialist"],
54+
"platform": "github"
55+
},
56+
"@platforms/github/github-workflow-manager": {
57+
"description": "Manages GitHub Actions workflows and CI/CD pipelines",
58+
"requires": ["@platforms/github/github-specialist"],
59+
"conflicts": ["@platforms/codeberg/codeberg-workflow-manager", "@platforms/gitlab/gitlab-ci-manager"],
60+
"platform": "github"
61+
},
62+
"@domains/api/api-designer": {
63+
"description": "Creates RESTful and GraphQL APIs with proper design patterns",
64+
"requires": [],
65+
"conflicts": [],
66+
"domain": "api"
67+
},
68+
"@domains/api/database-specialist": {
69+
"description": "Designs database schemas, optimizes queries, and manages data relationships",
70+
"requires": [],
71+
"conflicts": [],
72+
"domain": "api"
73+
},
74+
"@domains/ui/ui-ux-designer": {
75+
"description": "Creates exceptional user interfaces with focus on component design, accessibility, styling, and user experience optimization",
76+
"requires": [],
77+
"conflicts": [],
78+
"domain": "ui"
79+
},
80+
"@general/agent-creator": {
81+
"description": "Designs, creates, and manages OpenCode agents with proper validation and integration",
82+
"requires": [],
83+
"conflicts": [],
84+
"category": "general"
85+
},
86+
"@general/command-creator": {
87+
"description": "Creates OpenCode commands following best practices",
88+
"requires": [],
89+
"conflicts": [],
90+
"category": "general"
91+
},
92+
"@general/code-architect": {
93+
"description": "Designs system architecture, component relationships, and data flow patterns",
94+
"requires": [],
95+
"conflicts": [],
96+
"category": "general"
97+
},
98+
"@general/ci-cd-manager": {
99+
"description": "Manages continuous integration and deployment workflows",
100+
"requires": [],
101+
"conflicts": [],
102+
"category": "general"
103+
},
104+
"@general/deployment-specialist": {
105+
"description": "Manages deployment processes, CI/CD pipelines, and environment configuration",
106+
"requires": [],
107+
"conflicts": [],
108+
"category": "general"
109+
},
110+
"@general/git-commit-specialist": {
111+
"description": "Git commit management specialist for conventional commits and repository operations",
112+
"requires": [],
113+
"conflicts": [],
114+
"category": "general"
115+
},
116+
"@general/opencode-help": {
117+
"description": "Provides assistance and guidance for using the OpenCode framework",
118+
"requires": [],
119+
"conflicts": [],
120+
"category": "general"
121+
},
122+
"@general/validation-specialist": {
123+
"description": "Ensures code meets quality standards and validation rules",
124+
"requires": [],
125+
"conflicts": [],
126+
"category": "general"
127+
}
128+
}

0 commit comments

Comments
 (0)