Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# StreamVault Code Owners
# This file defines individuals or teams that are responsible
# for code in the repository and will be automatically
# requested for review when someone opens a pull request.

# Global owners - will be requested for review on all PRs
* @code-craka

# Core application files
/app/ @code-craka
/components/ @code-craka
/lib/ @code-craka
/hooks/ @code-craka

# Configuration and build files
*.config.js @code-craka
*.config.ts @code-craka
package.json @code-craka
tsconfig.json @code-craka
next.config.js @code-craka

# GitHub workflows and configuration
/.github/ @code-craka

# Security and environment files
/.env* @code-craka
/middleware.ts @code-craka

# Documentation
/README.md @code-craka
/docs/ @code-craka
/.kiro/ @code-craka

# Testing
/tests/ @code-craka
jest.config.js @code-craka
playwright.config.ts @code-craka

# Types and schemas
/types/ @code-craka
134 changes: 134 additions & 0 deletions .github/COPILOT_SETUP.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
# Automatic Code Review Setup Guide

This guide explains how to enable GitHub Copilot's automatic code review feature for the StreamVault repository.

## 🎯 Overview

GitHub Copilot automatic code review provides:
- Automated pull request reviews
- Security vulnerability detection and fixes
- Code quality suggestions
- Performance optimizations
- Best practices enforcement

## βš™οΈ Repository Configuration

### 1. Enable GitHub Copilot
1. Go to repository Settings β†’ General β†’ Features
2. Enable "GitHub Copilot" if not already enabled
3. Ensure your organization has a Copilot subscription

### 2. Configure Repository Rules
1. Navigate to Settings β†’ Rules β†’ Rulesets
2. Create a new ruleset or import `.github/rulesets/main-branch-protection.json`
3. Apply the ruleset to `main` and `staging` branches

### 3. Set Up Branch Protection
1. Go to Settings β†’ Branches
2. Add branch protection rule for `main`:
- Require pull request reviews before merging
- Require status checks to pass before merging
- Required status checks: `test`, `security`, `build`
- Require branches to be up to date before merging
- Require linear history

### 4. Configure Copilot Settings
1. Go to Settings β†’ Code security and analysis
2. Enable "Copilot autofix" for:
- Security vulnerabilities
- Code quality issues
- Dependency vulnerabilities

### 5. Enable Security Features
1. Navigate to Settings β†’ Security β†’ Code scanning
2. Enable CodeQL analysis
3. Set up secret scanning alerts
4. Configure dependency scanning

## πŸ”§ Workflow Configuration

The following workflows are automatically configured:

### CI Pipeline (`ci.yml`)
- Runs on every push and pull request
- Executes linting, testing, and building
- Required for merge approval

### Copilot Autofix (`copilot-autofix.yml`)
- Runs automatically for security fixes
- Creates PRs for vulnerability patches
- Provides automated code reviews

### Dependabot (`dependabot.yml`)
- Weekly dependency updates
- Automatic security updates
- Grouped updates for related packages

## πŸš€ Usage

### For Developers
1. Create feature branches as usual
2. Push changes and create pull requests
3. Copilot will automatically review your PR
4. Address any suggestions before requesting human review
5. All CI checks must pass before merging

### For Reviewers
1. Check Copilot's automated review comments
2. Verify that suggestions have been addressed
3. Focus human review on business logic and architecture
4. Approve when all checks pass

## πŸ“‹ Pull Request Checklist

Use the provided PR template which includes:
- Automatic review status verification
- Security checklist
- Testing requirements
- Documentation updates

## πŸ” Monitoring

### View Automated Reviews
- Check the "Files changed" tab in any PR
- Look for Copilot review comments
- Monitor the Actions tab for workflow results

### Security Alerts
- Go to Security β†’ Code scanning alerts
- Review dependency alerts
- Check secret scanning results

## πŸ› οΈ Troubleshooting

### Common Issues

**Copilot not reviewing PRs:**
- Verify Copilot is enabled for the repository
- Check that the user has Copilot access
- Ensure workflows have proper permissions

**Status checks failing:**
- Review Actions logs for detailed errors
- Check that all required dependencies are installed
- Verify environment variables are properly set

**Autofix not working:**
- Confirm autofix is enabled in repository settings
- Check that the workflow has write permissions
- Verify the target branch allows automated commits

## πŸ“ž Support

For issues with the automatic code review setup:
1. Check the GitHub Actions logs
2. Review the repository settings
3. Contact the repository administrators
4. Refer to GitHub's Copilot documentation

## πŸ”— References

- [GitHub Copilot Documentation](https://docs.github.com/en/copilot)
- [Repository Rules](https://docs.github.com/en/repositories/configuring-branches-and-merges-in-your-repository/managing-rulesets)
- [GitHub Actions](https://docs.github.com/en/actions)
- [Dependabot](https://docs.github.com/en/code-security/dependabot)
108 changes: 108 additions & 0 deletions .github/GITHUB_SETTINGS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
# GitHub Repository Settings Configuration

This document provides step-by-step instructions for enabling automatic code review features through the GitHub web interface.

## πŸ”§ Required GitHub Settings

### 1. Enable GitHub Copilot (Organization/Repository Level)

1. Go to **GitHub.com β†’ Your Organization β†’ Settings**
2. Navigate to **Code security and analysis**
3. Find **GitHub Copilot** section
4. Enable **Copilot autofix** for:
- βœ… Security vulnerabilities
- βœ… Code quality issues
- βœ… Dependency vulnerabilities

### 2. Configure Repository Rules

1. Go to **Repository β†’ Settings β†’ Rules β†’ Rulesets**
2. Click **New ruleset**
3. Choose **Branch ruleset**
4. Use these settings:
- **Name**: `Main Branch Protection`
- **Enforcement status**: `Active`
- **Target branches**: `main`, `staging`

#### Required Rules to Enable:
- βœ… **Restrict pushes that create files**
- βœ… **Restrict force pushes**
- βœ… **Require a pull request before merging**
- Require approvals: `1`
- Dismiss stale reviews when new commits are pushed: `Yes`
- Require review from code owners: `No` (optional)
- Require approval of the most recent reviewable push: `Yes`
- βœ… **Require status checks to pass**
- Status checks: `test`, `security`, `build`
- Require branches to be up to date before merging: `Yes`
- βœ… **Require linear history**
- βœ… **Block force pushes**

### 3. Enable Code Scanning

1. Go to **Repository β†’ Security β†’ Code scanning**
2. Set up **CodeQL analysis**:
- Click **Set up CodeQL analysis**
- Choose **Default setup** or **Advanced setup**
- Languages: `JavaScript/TypeScript`
- Query suite: `Default` + `Security-extended`

### 4. Configure Secret Scanning

1. Go to **Repository β†’ Security β†’ Secrets and variables β†’ Secrets**
2. Enable **Secret scanning alerts**
3. Enable **Push protection** (prevents committing secrets)

### 5. Enable Dependency Management

1. Go to **Repository β†’ Security β†’ Dependabot**
2. Enable **Dependabot alerts**
3. Enable **Dependabot security updates**
4. Confirm **Dependabot version updates** (configured via `.github/dependabot.yml`)

### 6. Configure Branch Protection (Backup Method)

If rulesets are not available, use branch protection rules:

1. Go to **Repository β†’ Settings β†’ Branches**
2. Add rule for `main` branch:
- βœ… Require pull request reviews before merging
- βœ… Require status checks to pass before merging
- βœ… Require branches to be up to date before merging
- βœ… Require linear history
- βœ… Include administrators

## πŸ€– Verify Copilot Integration

### Test Automatic Reviews:
1. Create a test branch
2. Make a small code change
3. Open a pull request
4. Verify Copilot provides automated review comments

### Check Status Checks:
1. Confirm CI workflows run automatically
2. Verify all checks appear in PR status
3. Test that merging is blocked until checks pass

## πŸ” Monitoring and Maintenance

### Regular Checks:
- Review **Actions** tab for workflow runs
- Monitor **Security** tab for alerts
- Check **Insights β†’ Dependency graph** for vulnerabilities
- Review Copilot suggestions and adoption

### Troubleshooting:
- If Copilot reviews don't appear: Check organization Copilot settings
- If status checks fail: Review Actions logs for errors
- If rulesets don't work: Fall back to branch protection rules

## πŸ“ž Support Resources

- **GitHub Copilot**: [docs.github.com/copilot](https://docs.github.com/copilot)
- **Repository Rules**: [docs.github.com/repositories/configuring-branches-and-merges-in-your-repository/managing-rulesets](https://docs.github.com/repositories/configuring-branches-and-merges-in-your-repository/managing-rulesets)
- **Code Security**: [docs.github.com/code-security](https://docs.github.com/code-security)

---
*This configuration enables comprehensive automatic code review with GitHub Copilot for the StreamVault repository.*
62 changes: 62 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
version: 2
updates:
# Enable version updates for npm
- package-ecosystem: "npm"
directory: "/"
schedule:
interval: "weekly"
day: "monday"
time: "09:00"
open-pull-requests-limit: 10
reviewers:
- "code-craka"
assignees:
- "code-craka"
commit-message:
prefix: "chore"
prefix-development: "chore"
include: "scope"
labels:
- "dependencies"
- "automated"
# Group related updates
groups:
development-dependencies:
dependency-type: "development"
patterns:
- "@types/*"
- "@typescript-eslint/*"
- "eslint*"
- "prettier*"
- "@testing-library/*"
- "jest*"
- "@playwright/*"
react-ecosystem:
patterns:
- "react*"
- "@radix-ui/*"
- "next*"
build-tools:
patterns:
- "tailwindcss*"
- "postcss*"
- "webpack*"
- "vite*"

# Enable version updates for GitHub Actions
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
day: "monday"
time: "09:00"
reviewers:
- "code-craka"
assignees:
- "code-craka"
commit-message:
prefix: "ci"
include: "scope"
labels:
- "github-actions"
- "automated"
Loading
Loading