gh-devlake

March 17, 2026 · View on GitHub

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.


Prerequisites

RequirementWhen needed
GitHub CLI (gh)Always — this is a gh extension
Dockerdeploy local, cleanup --local
Azure CLI (az)deploy azure only
GitHub PATRequired 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
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.

ServiceURL
Grafanahttp://localhost:3002 (admin/admin)
Config UIhttp://localhost:4000
Backend APIhttp://localhost:8080

How DevLake Works

Four concepts to understand — then every command makes sense:

ConceptWhat It Is
ConnectionAn authenticated link to a data source (GitHub, Copilot, Jenkins). Each gets its own PAT/credentials.
ScopeWhat to collect — specific repos for GitHub, an org/enterprise for Copilot, jobs for Jenkins.
ProjectGroups connections + scopes into a single view with DORA metrics enabled.
BlueprintThe 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

Downloads Docker Compose files, generates secrets, starts the stack, and waits until DevLake is healthy. 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

PluginStatusWhat It CollectsRequired PAT scopes
GitHub✅ AvailableRepos, PRs, issues, workflows, deployments (DORA)repo, read:org, read:user
GitHub Copilot✅ AvailableUsage metrics, seats, acceptance ratesmanage_billing:copilot, read:org (+ read:enterprise for enterprise metrics)
Jenkins✅ AvailableJobs, builds, deployments (DORA)Username + API token/password
Jira✅ AvailableBoards, issues, sprints (change lead time, cycle time)API token (permissions from user account)
GitLab✅ AvailableRepos, MRs, pipelines, deployments (DORA)read_api, read_repository
Bitbucket Cloud✅ AvailableRepos, PRs, commitsBitbucket username + app password
SonarQube✅ AvailableCode quality, coverage, code smells (quality gates)API token (permissions from user account)
Azure DevOps✅ AvailableRepos, pipelines, deployments (DORA)PAT with repo and pipeline access
ArgoCD✅ AvailableGitOps deployments, deployment frequency (DORA)ArgoCD auth token

See Token Handling for env key names and multi-plugin .devlake.env examples.


Command Reference

CommandDescriptionDocs
gh devlake initGuided 4-phase setup wizardinit.md
gh devlake statusHealth check and connection summarystatus.md
gh devlake deploy localLocal Docker Compose deploydeploy.md
gh devlake deploy azureAzure Container Instance deploydeploy.md
gh devlake configure connectionManage plugin connections (subcommands below)configure-connection.md
gh devlake configure connection addCreate a new plugin connectionconfigure-connection.md
gh devlake configure connection listList all connectionsconfigure-connection.md
gh devlake configure connection testTest a saved connectionconfigure-connection.md
gh devlake configure connection updateRotate token or update settingsconfigure-connection.md
gh devlake configure connection deleteRemove a connectionconfigure-connection.md
gh devlake configure scopeManage scopes on connections (subcommands below)configure-scope.md
gh devlake configure scope addAdd repo/org scopes to a connectionconfigure-scope.md
gh devlake configure scope listList scopes on a connectionconfigure-scope.md
gh devlake configure scope deleteRemove a scope from a connectionconfigure-scope.md
gh devlake configure projectManage DevLake projects (subcommands below)configure-project.md
gh devlake configure project addCreate a project + blueprint + first syncconfigure-project.md
gh devlake configure project listList all projectsconfigure-project.md
gh devlake configure project deleteDelete a projectconfigure-project.md
gh devlake configure fullConnections + scopes + project in one stepconfigure-full.md
gh devlake query pipelinesQuery recent pipeline runsquery.md
gh devlake query doraQuery DORA metadata now; full metrics remain API/DB limitedquery.md
gh devlake query copilotQuery Copilot metadata now; full metrics remain API/DB limitedquery.md
gh devlake startStart stopped or exited DevLake servicesstart.md
gh devlake stopStop running services (preserves containers and data)stop.md
gh devlake cleanupTear down local or Azure resourcescleanup.md

Global Flags

FlagDescription
--url <url>DevLake API base URL (auto-discovered if omitted)
--jsonOutput 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:

CommandJSON 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.