Skip to content
Merged
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
73 changes: 73 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
# OPS-Agent-Desktop Environment Configuration
# Copy this file to .env and fill in your values

# Server Configuration
NODE_ENV=development
PORT=3001
FRONTEND_URL=http://localhost:5173

# Database Configuration
DATABASE_URL=postgresql://postgres:postgres@localhost:5432/ops_agent_desktop

# Authentication & Security
JWT_SECRET=your-secret-key-change-this-in-production
JWT_EXPIRATION=24h
REFRESH_TOKEN_SECRET=your-refresh-token-secret
REFRESH_TOKEN_EXPIRATION=7d

# CORS Configuration
ALLOWED_ORIGINS=http://localhost:5173,http://localhost:5174

# Screenshot Storage
STORAGE_TYPE=local # Options: local, s3, minio
S3_BUCKET=ops-agent-screenshots
S3_REGION=us-east-1
S3_ACCESS_KEY_ID=
S3_SECRET_ACCESS_KEY=
S3_ENDPOINT= # For MinIO or custom S3 endpoint
SCREENSHOT_RETENTION_DAYS=30

# Redis Configuration (for caching and queues)
REDIS_URL=redis://localhost:6379
REDIS_PASSWORD=

# Browser Agent Configuration
BROWSER_HEADLESS=true
BROWSER_POOL_SIZE=5
MAX_CONCURRENT_MISSIONS=3
MISSION_TIMEOUT_MS=300000

# Dashboard Configuration
ALLOWED_DASHBOARD_DOMAINS=localhost:5174,grafana.example.com,kibana.example.com

# External Integrations
AUTORKA_CORE_URL=http://localhost:8000
SECURE_MCP_GATEWAY_URL=http://localhost:8080

# LLM Configuration
ANTHROPIC_API_KEY=
OPENAI_API_KEY=
LLM_PROVIDER=anthropic # Options: anthropic, openai
LLM_MODEL=claude-3-5-sonnet-20241022
LLM_MAX_TOKENS=4096

# Observability
LOG_LEVEL=info # Options: error, warn, info, debug
ENABLE_TELEMETRY=true
OTEL_EXPORTER_OTLP_ENDPOINT=http://localhost:4318

# Rate Limiting
RATE_LIMIT_WINDOW_MS=60000
RATE_LIMIT_MAX_REQUESTS=100
MISSION_RATE_LIMIT_PER_HOUR=10

# Secrets Management (Production)
VAULT_ADDR=
VAULT_TOKEN=
VAULT_NAMESPACE=

# Feature Flags
ENABLE_WEBSOCKET=true
ENABLE_MULTI_MISSION=true
ENABLE_LLM_PLANNING=false
ENABLE_AUTO_APPROVAL=false
34 changes: 34 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{
"root": true,
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": 2022,
"sourceType": "module",
"project": ["./backend/tsconfig.json", "./frontend/tsconfig.json"]
},
"plugins": ["@typescript-eslint"],
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"plugin:@typescript-eslint/recommended-requiring-type-checking"
],
"rules": {
"@typescript-eslint/no-unused-vars": [
"error",
{
"argsIgnorePattern": "^_",
"varsIgnorePattern": "^_"
}
],
"@typescript-eslint/no-explicit-any": "warn",
"@typescript-eslint/explicit-function-return-type": "off",
"@typescript-eslint/explicit-module-boundary-types": "off",
"@typescript-eslint/no-non-null-assertion": "warn",
"no-console": ["warn", { "allow": ["warn", "error"] }],
"prefer-const": "error",
"no-var": "error",
"eqeqeq": ["error", "always"],
"curly": ["error", "all"]
},
"ignorePatterns": ["dist", "build", "node_modules", "coverage", "*.config.ts", "*.config.js"]
}
225 changes: 225 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,225 @@
name: CI Pipeline

on:
push:
branches: [main, develop, 'claude/**']
pull_request:
branches: [main, develop]

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
# Lint and type-check
lint:
name: Lint & Type Check
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '18'
cache: 'npm'

- name: Install dependencies
run: npm ci

- name: Run ESLint
run: npm run lint

- name: Run TypeScript type check
run: npm run type-check

- name: Check formatting
run: npx prettier --check "**/*.{ts,tsx,json,md}"

# Backend tests
test-backend:
name: Backend Tests
runs-on: ubuntu-latest
services:
postgres:
image: postgres:16-alpine
env:
POSTGRES_DB: test_db
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432

redis:
image: redis:7-alpine
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 6379:6379

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '18'
cache: 'npm'

- name: Install dependencies
run: npm ci

- name: Install Playwright browsers
run: npx playwright install chromium --with-deps

- name: Setup test environment
working-directory: backend
env:
DATABASE_URL: postgresql://postgres:postgres@localhost:5432/test_db
run: npx prisma migrate deploy

- name: Run backend tests
working-directory: backend
env:
NODE_ENV: test
DATABASE_URL: postgresql://postgres:postgres@localhost:5432/test_db
REDIS_URL: redis://localhost:6379
JWT_SECRET: test-jwt-secret-minimum-32-characters-long
REFRESH_TOKEN_SECRET: test-refresh-secret-minimum-32-characters
ALLOWED_ORIGINS: http://localhost:5173
run: npm run test -- --coverage

- name: Upload coverage
uses: codecov/codecov-action@v3
with:
files: ./backend/coverage/lcov.info
flags: backend

# Frontend tests
test-frontend:
name: Frontend Tests
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '18'
cache: 'npm'

- name: Install dependencies
run: npm ci

- name: Run frontend tests
working-directory: frontend
run: npm run test -- --coverage

- name: Upload coverage
uses: codecov/codecov-action@v3
with:
files: ./frontend/coverage/lcov.info
flags: frontend

# Build check
build:
name: Build Check
runs-on: ubuntu-latest
needs: [lint, test-backend, test-frontend]
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '18'
cache: 'npm'

- name: Install dependencies
run: npm ci

- name: Build all packages
run: npm run build

- name: Upload build artifacts
uses: actions/upload-artifact@v3
with:
name: build-artifacts
path: |
backend/dist
frontend/dist
mock-app/dist
retention-days: 7

# Security scanning
security:
name: Security Scan
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '18'
cache: 'npm'

- name: Install dependencies
run: npm ci

- name: Run npm audit
run: npm audit --audit-level=moderate

- name: Run Snyk security scan
uses: snyk/actions/node@master
continue-on-error: true
env:
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
with:
args: --severity-threshold=high

# Docker build (on main branch only)
docker-build:
name: Docker Build
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main'
needs: [build]
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Build backend image
uses: docker/build-push-action@v5
with:
context: .
file: backend/Dockerfile
push: false
tags: ops-agent-backend:latest
cache-from: type=gha
cache-to: type=gha,mode=max

- name: Build frontend image
uses: docker/build-push-action@v5
with:
context: .
file: frontend/Dockerfile
push: false
tags: ops-agent-frontend:latest
cache-from: type=gha
cache-to: type=gha,mode=max
24 changes: 24 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,27 @@ coverage/
test-results/
playwright-report/
playwright/.cache/

# Database
*.db
*.sqlite
*.sqlite3
prisma/migrations/

# Secrets and credentials
*.pem
*.key
*.cert
secrets/

# Docker
docker-compose.override.yml

# Logs
logs/
*.log

# Temporary files
tmp/
temp/
.cache/
10 changes: 10 additions & 0 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"semi": true,
"trailingComma": "es5",
"singleQuote": true,
"printWidth": 100,
"tabWidth": 2,
"useTabs": false,
"arrowParens": "always",
"endOfLine": "lf"
}
Loading
Loading