Initiate OpenCode repo

This commit is contained in:
Wesam Abousaid
2026-02-26 22:00:58 +01:00
commit b63f1c7f57
11 changed files with 4298 additions and 0 deletions
Vendored
BIN
View File
Binary file not shown.
+53
View File
@@ -0,0 +1,53 @@
name: Code Reviewer
description: Specialized agent for thorough code reviews
model: claude-sonnet-4.6
temperature: 0.1
verbosity: high
## Instructions
You are a senior code reviewer. Your job is to:
1. Review code for bugs, security issues, and performance problems
2. Suggest improvements following best practices
3. Focus on readability, maintainability, and scalability
4. Provide specific, actionable feedback
## Tools
- read: true
- ask: true
- write: false # Reviewer doesn't make changes
- edit: false
- bash: false
## Examples
When reviewing authentication code, check for:
- Input validation
- Password hashing
- Session management
- Error handling
When reviewing API code, check for:
- Proper HTTP status codes
- Request/response validation
- Error handling and logging
- Rate limiting considerations
When reviewing database code, check for:
- SQL injection prevention
- Proper indexing
- Transaction management
- Connection pooling
## Review Process
1. **Security First**: Identify security vulnerabilities
2. **Performance**: Check for bottlenecks and inefficiencies
3. **Maintainability**: Assess code organization and clarity
4. **Testing**: Verify adequate test coverage
5. **Documentation**: Check for proper comments and docs
## Output Format
For each issue found:
- **Severity**: Critical/High/Medium/Low
- **Location**: File and line number
- **Issue**: Description of the problem
- **Suggestion**: Specific fix with code example
- **Rationale**: Why this change improves the code
+43
View File
@@ -0,0 +1,43 @@
---
name: "Create Pull Request"
description: "Automated PR creation with branch management and commit splitting"
version: "1.0.0"
tools: ["read", "write", "edit", "bash"]
permissions: ["project"]
---
# Create Pull Request
Automatically creates a pull request from current changes with proper commit hygiene.
## Behavior
1. Check for uncommitted changes
2. Create feature branch based on current changes
3. Format code using project formatter (Biome/Prettier/ESLint)
4. Analyze changes and split into logical commits
5. Create descriptive commit messages
6. Push branch to remote
7. Create pull request with summary and test plan
## Guidelines for Commit Splitting
- Split by feature, component, or concern
- Keep related changes together
- Separate refactoring from feature work
- Ensure each commit stands alone
- Follow conventional commit format
## Examples
### Basic PR creation
```bash
/pr
```
### PR with specific branch name
```bash
/pr feature/user-authentication
```
### PR with custom description
```bash
/pr --description "Add user authentication with JWT"
```
+41
View File
@@ -0,0 +1,41 @@
---
name: "Code Review"
description: "Comprehensive code review with security, performance, and style checks"
version: "1.0.0"
tools: ["read", "ask"]
permissions: ["project"]
---
# Code Review
Perform thorough code review focusing on security, performance, and maintainability.
## Behavior
1. Analyze the specified file or directory
2. Check for security vulnerabilities (OWASP Top 10)
3. Review performance implications and bottlenecks
4. Assess code style and consistency
5. Suggest specific improvements with examples
6. Provide actionable recommendations
## Guidelines
- Focus on critical issues first
- Provide code examples for fixes
- Consider project-specific conventions
- Balance perfection with practicality
## Examples
### Review a specific file
```bash
/review @src/auth/index.ts
```
### Review changed files
```bash
/review changed
```
### Review with specific focus
```bash
/review @src/ --focus security
```
+172
View File
@@ -0,0 +1,172 @@
# OpenCode Agent Guidelines
This document helps OpenCode understand your project's structure, conventions, and requirements.
## Project Overview
**Project Type**: [Describe your project type, e.g., React/TypeScript web application]
**Purpose**: [Brief description of what the project does]
**Key Technologies**: [List main technologies and frameworks]
## Code Conventions
### File Structure
```
src/
├── components/ # React components
├── pages/ # Page components
├── utils/ # Utility functions
├── hooks/ # Custom React hooks
├── types/ # TypeScript type definitions
└── styles/ # CSS/SCSS files
```
### Naming Conventions
- **Files**: kebab-case (e.g., `user-profile.tsx`)
- **Components**: PascalCase (e.g., `UserProfile`)
- **Functions**: camelCase (e.g., `formatUserName`)
- **Constants**: UPPER_SNAKE_CASE (e.g., `MAX_RETRY_COUNT`)
- **Types**: PascalCase with `Type` suffix (e.g., `UserProfileType`)
### Code Style
- **Indentation**: 2 spaces
- **Semicolons**: Yes
- **Quotes**: Single quotes for strings
- **Line length**: 100 characters max
- **Trailing commas**: Yes in objects and arrays
## Development Guidelines
### Testing
- Write unit tests for all utility functions
- Use Jest and React Testing Library
- Test files should be next to source files (e.g., `component.tsx` and `component.test.tsx`)
- Aim for 80%+ test coverage
### Error Handling
- Use try/catch for async operations
- Log errors to console in development
- Show user-friendly error messages in production
- Validate all external inputs
### Security
- Never commit secrets or API keys
- Validate and sanitize all user inputs
- Use environment variables for configuration
- Implement proper authentication and authorization
### Performance
- Use React.memo() for expensive components
- Implement code splitting for large bundles
- Optimize images and assets
- Monitor bundle size
## Project-Specific Rules
### Do's
- Use TypeScript strict mode
- Follow the existing component patterns
- Add comments for complex logic
- Update documentation when changing APIs
- Run tests before committing
### Don'ts
- Don't use `any` type in TypeScript
- Don't commit console.log statements
- Don't modify multiple concerns in one commit
- Don't ignore TypeScript/ESLint warnings
- Don't add dependencies without team approval
## Common Patterns
### API Calls
```typescript
// Use this pattern for API calls
async function fetchUser(id: string): Promise<User> {
try {
const response = await api.get(`/users/${id}`);
return response.data;
} catch (error) {
console.error('Failed to fetch user:', error);
throw new Error('User not found');
}
}
```
### Component Structure
```typescript
// Use this component structure
interface UserProfileProps {
userId: string;
onUpdate?: () => void;
}
export function UserProfile({ userId, onUpdate }: UserProfileProps) {
const [user, setUser] = useState<User | null>(null);
useEffect(() => {
loadUser();
}, [userId]);
async function loadUser() {
const data = await fetchUser(userId);
setUser(data);
}
if (!user) return <LoadingSpinner />;
return (
<div className="user-profile">
<h2>{user.name}</h2>
{/* ... */}
</div>
);
}
```
## Tool Configuration
### Formatters
- **Prettier**: Use project prettier config
- **ESLint**: Follow Airbnb style guide with custom rules
- **TypeScript**: Strict mode enabled
### Build Tools
- **Bundler**: Vite
- **Package Manager**: npm
- **CI/CD**: GitHub Actions
## Getting Started
1. **Install dependencies**: `npm install`
2. **Start development server**: `npm run dev`
3. **Run tests**: `npm test`
4. **Build for production**: `npm run build`
5. **Check code quality**: `npm run lint`
## Helpful Commands
```bash
# Format code
npm run format
# Type check
npm run type-check
# Run all checks
npm run check
# Update dependencies
npm run update-deps
```
## Contact & Support
- **Team**: [Your team name]
- **Repository**: [GitHub repo URL]
- **Documentation**: [Docs URL]
- **Slack**: [Slack channel]
---
*This document is automatically generated and should be updated as the project evolves.*
BIN
View File
Binary file not shown.
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 195 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 205 KiB

+21
View File
@@ -0,0 +1,21 @@
MIT License
Copyright (c) 2026 OpenCode Everything You Need to Know
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:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
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.
+3968
View File
File diff suppressed because it is too large Load Diff