gh-devlake
A GitHub CLI extension that deploys, configures, and monitors Apache DevLake from the terminal.
Deploy DevLake locally or on Azure, create connections to GitHub and Copilot, configure DORA project scopes, and trigger data syncs — all without touching the Config UI.
DevLake is an open-source dev data platform that normalizes data from DevOps tools so you can compute consistent engineering metrics like DORA.
This CLI makes that setup fast and repeatable from the terminal (instead of clicking through the Config UI) — especially when you want to re-run the same configuration across teams.
Blog post: Beyond Copilot Dashboards: Measuring What AI Actually Changes — why DORA + Copilot correlation matters and what this tool enables.
[!NOTE]
GitHub Copilot plugin: The Copilot metrics plugin is currently available in the DevExpGBB/incubator-devlake fork while the upstream PR (apache/incubator-devlake#8728) is under review. The deploy local and deploy azure commands handle custom images automatically — no manual image builds needed. Once the PR merges, the official Apache images will include it.
Prerequisites
| Requirement |
When needed |
GitHub CLI (gh) |
Always — this is a gh extension |
| Docker |
deploy local, cleanup --local |
Azure CLI (az) |
deploy azure only |
| GitHub PAT |
Required when creating connections (see Supported Plugins) |
Building from source
Requires Go 1.22+.
git clone https://github.com/DevExpGBB/gh-devlake.git
cd gh-devlake
go build -o gh-devlake.exe . # Windows
go build -o gh-devlake . # Linux/macOS
gh extension install .
Quick Start
gh extension install DevExpGBB/gh-devlake
# Option 1: Fully guided wizard (deploy → connect → scope → project)
gh devlake init
# Option 2: Step-by-step
gh devlake deploy local --dir ./devlake
cd devlake && docker compose up -d
# wait ~2 minutes, then:
gh devlake configure full
After setup, open Grafana at http://localhost:3002 (admin / admin). DORA and Copilot dashboards will populate after the first sync completes.
How DevLake Works
Four concepts to understand — then every command makes sense:
| Concept |
What It Is |
| Connection |
An authenticated link to a data source (GitHub, Copilot, Jenkins). Each gets its own PAT/credentials. |
| Scope |
What to collect — specific repos for GitHub, an org/enterprise for Copilot, jobs for Jenkins. |
| Project |
Groups connections + scopes into a single view with DORA metrics enabled. |
| Blueprint |
The sync schedule (cron). Created automatically with the project. |
For a deeper explanation with diagrams, see DevLake Concepts.
Getting Started Step by Step
Step 1: Deploy
gh devlake deploy local --dir ./devlake
cd devlake && docker compose up -d
Downloads Docker Compose files, generates secrets, and prepares the stack. Give it ~2 minutes after docker compose up. See docs/deploy.md for flags and details.
Deploying to Azure instead
gh devlake deploy azure --resource-group devlake-rg --location eastus --official
Creates Container Instances, MySQL Flexible Server, and Key Vault via Bicep (~$30–50/month with --official). Omit flags to be prompted interactively.
See docs/deploy.md for all Azure options, custom image builds, and tear-down.
Step 2: Create Connections
The CLI will prompt you for your PAT. You can also pass --token, use an --env-file, or set GITHUB_TOKEN in your environment. See Token Handling for the full resolution chain.
# GitHub (repos, PRs, workflows, deployments)
gh devlake configure connection add --plugin github --org my-org
# Copilot (usage metrics, seats, acceptance rates)
gh devlake configure connection add --plugin gh-copilot --org my-org
# Jenkins (jobs and build data for DORA)
gh devlake configure connection add --plugin jenkins --endpoint https://jenkins.example.com --username admin --token myapitoken
The CLI tests each connection before saving. On success:
🔑 Testing connection...
✅ Connection test passed
✅ Created GitHub connection (ID=1)
See docs/configure-connection.md for all flags.
Step 3: Add Scopes
Tell DevLake which repos or orgs to collect from:
# GitHub — pick repos interactively, or pass --repos explicitly
gh devlake configure scope add --plugin github --org my-org
# Copilot — org-level metrics
gh devlake configure scope add --plugin gh-copilot --org my-org
# Jenkins — pick jobs interactively (or pass --jobs)
gh devlake configure scope add --plugin jenkins --org my-org
DORA patterns (deployment workflow, production environment, incident label) use sensible defaults. See docs/configure-scope.md for overrides.
Step 4: Create a Project and Sync
gh devlake configure project add
Discovers your connections and scopes, creates a DevLake project with DORA metrics enabled, sets up a daily sync blueprint, and triggers the first data collection.
See docs/configure-project.md for flags (--project-name, --cron, --time-after, --skip-sync).
Shortcut: gh devlake configure full chains Steps 2–4 interactively. See docs/configure-full.md.
Day-2 Operations
Status checks, token rotation, adding repos, and tear-down
gh devlake status # health + summary
gh devlake configure connection list # list connections
gh devlake configure connection update --plugin github --id 1 --token ghp_new # rotate token
gh devlake configure scope add --plugin github --org my-org # add more repos
gh devlake cleanup --local # tear down Docker
For the full guide, see Day-2 Operations.
Supported Plugins
| Plugin |
Status |
What It Collects |
Required PAT scopes |
| GitHub |
✅ Available |
Repos, PRs, issues, workflows, deployments (DORA) |
repo, read:org, read:user |
| GitHub Copilot |
✅ Available |
Usage metrics, seats, acceptance rates |
manage_billing:copilot, read:org (+ read:enterprise for enterprise metrics) |
| Jenkins |
✅ Available |
Jobs, builds, deployments (DORA) |
Username + API token/password |
| Jira |
✅ Available |
Boards, issues, sprints (change lead time, cycle time) |
API token (permissions from user account) |
| GitLab |
✅ Available |
Repos, MRs, pipelines, deployments (DORA) |
read_api, read_repository |
| Bitbucket Cloud |
✅ Available |
Repos, PRs, commits |
Bitbucket username + app password |
| SonarQube |
✅ Available |
Code quality, coverage, code smells (quality gates) |
API token (permissions from user account) |
| Azure DevOps |
✅ Available |
Repos, pipelines, deployments (DORA) |
PAT with repo and pipeline access |
| ArgoCD |
✅ Available |
GitOps deployments, deployment frequency (DORA) |
ArgoCD auth token |
See Token Handling for env key names and multi-plugin .devlake.env examples.
Command Reference
Global Flags
| Flag |
Description |
--url <url> |
DevLake API base URL (auto-discovered if omitted) |
--json |
Output as JSON — suppresses banners and interactive prompts. Useful for scripting and agent consumption. |
--json output
Read commands emit a single compact JSON line on success, or {"error":"<message>"} on failure. No emoji, banners, or interactive prompts are printed.
# Human (default)
$ gh devlake status
════════════════════════════════════════
DevLake Status
════════════════════════════════════════
...
# Machine-readable
$ gh devlake status --json
{"deployment":{"method":"local","stateFile":".devlake-local.json"},"endpoints":[{"name":"backend","url":"http://localhost:8080","healthy":true}],"connections":[{"plugin":"github","id":1,"name":"GitHub - my-org","organization":"my-org"}],"project":{"name":"my-project","blueprintId":1}}
# Pipe into jq
$ gh devlake configure connection list --json | jq '.[].name'
"GitHub - my-org"
Commands that support --json:
| Command |
JSON shape |
gh devlake status |
{deployment, endpoints[], connections[], project} |
gh devlake configure connection list |
[{id, plugin, name, endpoint, organization, enterprise}] |
gh devlake configure scope list |
[{id, name, fullName}] |
gh devlake configure project list |
[{name, description, blueprintId}] |
Additional references: Token Handling · State Files · DevLake Concepts · Day-2 Operations
Development
go build -o gh-devlake.exe . # Build (Windows)
go build -o gh-devlake . # Build (Linux/macOS)
go test ./... -v # Run tests
gh extension install . # Install locally for testing
License
MIT — see LICENSE.