Skip to content

sultannaufal/bitbucket-server-assistant

Repository files navigation

Bitbucket Server Assistant

A Telegram Mini App for reviewing Bitbucket Server pull requests with AI-powered code analysis. Built with React, Hono, and Cloudflare Workers.

Deploy to Cloudflare

Features

  • PR Browser — View and search pull requests from your Bitbucket Server instance
  • Diff Viewer — Inspect file-level diffs with syntax-highlighted hunks
  • AI Code Review — Analyze diffs using Google Gemini (default), Anthropic Claude, or OpenAI GPT
  • Telegram Integration — Runs as a Telegram Mini App with native auth validation
  • Edge Deployment — Runs on Cloudflare Workers for low-latency, globally distributed access

Tech Stack

Layer Technology
Frontend React 19, Vite, Telegram Mini App SDK
Backend Hono on Cloudflare Workers
AI Google Gemini, Anthropic Claude, OpenAI GPT (raw fetch, no SDKs)
Validation Zod for runtime schema validation of AI responses

Getting Started

Prerequisites

  • Node.js 18+
  • A Cloudflare account
  • A Bitbucket Server instance
  • (Optional) A Telegram Bot for Mini App auth

Install

npm install

Configure Environment

Create a .dev.vars file in the project root for local development:

BITBUCKET_BASE_URL=https://bitbucket.yourcompany.com
BITBUCKET_TOKEN=your-bitbucket-pat

# At least one AI provider key
GOOGLE_API_KEY=your-google-api-key
# ANTHROPIC_API_KEY=your-anthropic-api-key
# OPENAI_API_KEY=your-openai-api-key

# Telegram bot token (for auth validation)
# TELEGRAM_BOT_TOKEN=your-bot-token

Development

npm run dev

The app will be available at http://localhost:5173.

Production

Build and deploy to Cloudflare Workers:

npm run build
npm run deploy

Set secrets for production (each command prompts for the value):

npx wrangler secret put BITBUCKET_BASE_URL
npx wrangler secret put BITBUCKET_TOKEN
npx wrangler secret put GOOGLE_API_KEY

Monitor your worker:

npx wrangler tail

AI Code Review Setup

The app ships with a multi-provider AI code review service. Google Gemini is the default.

Provider Default Model Secret
Google gemini-2.0-flash GOOGLE_API_KEY
Anthropic claude-sonnet-4-5 ANTHROPIC_API_KEY
OpenAI gpt-4o OPENAI_API_KEY

To change the default provider, set the DEFAULT_AI_PROVIDER var in wrangler.json:

"vars": {
  "DEFAULT_AI_PROVIDER": "google" // or "anthropic" or "openai"
}

You can also override per-request via query params:

POST /api/analyze?provider=anthropic&model=claude-sonnet-4-5

For the full setup guide, see docs/AI_SETUP.md.

Project Structure

src/
  react-app/          # React frontend
    components/       # UI components (PRRow, DiffViewer, AIAnalyzer, etc.)
    lib/              # API client helpers (bitbucket, analyze, telegram)
  worker/             # Cloudflare Worker backend
    index.ts          # Hono app entrypoint
    routes/           # API route handlers (bitbucket, analyze)
    middlewares/       # Telegram auth middleware
    code-review/      # AI code review module
      providers/      # Anthropic, Google, OpenAI provider implementations
      code-review.service.ts
      prompts.ts
      types.ts
docs/
  AI_SETUP.md         # Detailed AI setup guide

Resources

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages