- Bun 1.3.9+ — required for running tests and building binaries
bun installbun run buildOutput goes to dist/.
bun run build:binaryProduces dist/sonarqube-cli using Bun's single-file compiler. To install it locally:
bun run setupRun these before opening a pull request:
# Lint (ESLint + TypeScript-aware rules)
bun run lint
# Auto-fix safe lint issues
bun run lint:fix
# TypeScript type checking
bun run typecheck# Unit tests
bun test
# Unit tests with coverage
bun run test:coverage
# Script tests
bun run test:scripts
# Integration tests (require env vars — see below)
bun run test:integration
# All tests
bun run test:allIntegration tests hit real external services and require environment variables:
export SONAR_SECRETS_TOKEN="sqp_xxxxx" # SonarQube (Server, Cloud) token for secret scanning
export SONAR_SECRETS_AUTH_URL="https://sonarcloud.io" # SonarQube (Server, Cloud) URL for onboard-agent testsObtain a token from sonarcloud.io → Account → Security → Generate token.
If the variables are not set, the relevant tests are skipped automatically — this is expected for local development.
On macOS, the CLI stores authentication tokens in the system Keychain. macOS ties Keychain ACL entries to the identity of the binary that created them. For unsigned binaries, this identity is derived from the file hash — so every bun run build:binary produces a new identity, and macOS will prompt for the Keychain password on the first sonar invocation after each rebuild.
To avoid this, install the SonarSource Developer ID certificate locally. Once installed, the post-build hook signs the binary automatically — no prompt on subsequent runs.
- Obtain the
certificate.p12file and the Apple Team ID from Vault (development/kv/data/sign/sonarqube-cli). - Set the Team ID in your shell profile (e.g.
~/.zshrc):export APPLE_TEAM_ID="<team-id-from-vault>"
- Import the certificate into your login Keychain:
security import certificate.p12 -k ~/Library/Keychains/login.keychain-db - In Keychain Access, find the private key named Developer ID Application: SonarSource SA, open Get Info → Access Control, and select Allow all applications to access this item.
After this, every build signs the binary automatically. On machines without the certificate or without APPLE_TEAM_ID set the step is silently skipped.
The README.md file is generated from the source code. When adding or modifying a command, please call:
bun run gen:docs