|
| 1 | +# Codacy Cloud CLI |
| 2 | + |
| 3 | +A command-line tool to interact with [Codacy Cloud](https://app.codacy.com) directly from your terminal. Built with Node.js and TypeScript. |
| 4 | + |
| 5 | +## Setup |
| 6 | + |
| 7 | +```bash |
| 8 | +npm install |
| 9 | +``` |
| 10 | + |
| 11 | +Set your Codacy API token as an environment variable: |
| 12 | + |
| 13 | +```bash |
| 14 | +export CODACY_API_TOKEN=your-token-here |
| 15 | +``` |
| 16 | + |
| 17 | +You can get a token from **Codacy > My Account > Access Management > Account API Tokens**. |
| 18 | + |
| 19 | +## Usage |
| 20 | + |
| 21 | +```bash |
| 22 | +# Run in development mode |
| 23 | +npx ts-node src/index.ts <command> |
| 24 | + |
| 25 | +# Or build and run |
| 26 | +npm run build |
| 27 | +npm start -- <command> |
| 28 | +``` |
| 29 | + |
| 30 | +### Global Options |
| 31 | + |
| 32 | +| Option | Description | Default | |
| 33 | +|---|---|---| |
| 34 | +| `-o, --output <format>` | Output format: `table` or `json` | `table` | |
| 35 | +| `-V, --version` | Show version | | |
| 36 | +| `-h, --help` | Show help | | |
| 37 | + |
| 38 | +### Commands |
| 39 | + |
| 40 | +#### `info` |
| 41 | + |
| 42 | +Show authenticated user information and their organizations. |
| 43 | + |
| 44 | +```bash |
| 45 | +codacy-cloud-cli info |
| 46 | +codacy-cloud-cli info --output json |
| 47 | +``` |
| 48 | + |
| 49 | +Displays: |
| 50 | +- User details (name, email, admin status, active status) |
| 51 | +- Organizations (name, provider, type, join status) |
| 52 | + |
| 53 | +#### `repositories <provider> <organization>` |
| 54 | + |
| 55 | +List repositories for an organization with analysis data. |
| 56 | + |
| 57 | +```bash |
| 58 | +codacy-cloud-cli repositories gh my-org |
| 59 | +codacy-cloud-cli repositories gh my-org --search my-repo |
| 60 | +codacy-cloud-cli repositories gl my-org --output json |
| 61 | +``` |
| 62 | + |
| 63 | +| Argument | Description | |
| 64 | +|---|---| |
| 65 | +| `provider` | Git provider: `gh` (GitHub), `gl` (GitLab), or `bb` (Bitbucket) | |
| 66 | +| `organization` | Organization name on the provider | |
| 67 | + |
| 68 | +| Option | Description | |
| 69 | +|---|---| |
| 70 | +| `-s, --search <query>` | Filter repositories by name | |
| 71 | + |
| 72 | +Displays: name, grade, issues, complexity, duplication, coverage, and last updated. Quality metrics are colored red/green based on repository quality goals. |
| 73 | + |
| 74 | +#### `repository <provider> <organization> <repository>` |
| 75 | + |
| 76 | +Show detailed status and metrics for a specific repository. |
| 77 | + |
| 78 | +```bash |
| 79 | +codacy-cloud-cli repository gh my-org my-repo |
| 80 | +codacy-cloud-cli repository gh my-org my-repo --output json |
| 81 | +``` |
| 82 | + |
| 83 | +Displays a multi-section dashboard: |
| 84 | +- **About** -- repository info, default branch, last analysis |
| 85 | +- **Setup** -- languages, coding standards, quality gate, problems |
| 86 | +- **Metrics** -- issues (count + per kLoC), coverage, complexity, duplication |
| 87 | +- **Open Pull Requests** -- status, issues, coverage, complexity, duplication deltas |
| 88 | +- **Issues Overview** -- totals by category, severity, and language |
| 89 | + |
| 90 | +## Development |
| 91 | + |
| 92 | +```bash |
| 93 | +# Run tests |
| 94 | +npm test |
| 95 | + |
| 96 | +# Type-check without emitting |
| 97 | +npx tsc --noEmit |
| 98 | + |
| 99 | +# Update the auto-generated API client |
| 100 | +npm run update-api |
| 101 | +``` |
| 102 | + |
| 103 | +### Project Structure |
| 104 | + |
| 105 | +``` |
| 106 | +src/ |
| 107 | + index.ts # CLI entry point (Commander.js) |
| 108 | + commands/ # One file per command |
| 109 | + utils/ # Shared utilities (auth, error handling, output formatting) |
| 110 | + api/client/ # Auto-generated API client (do not edit) |
| 111 | +``` |
| 112 | + |
| 113 | +## License |
| 114 | + |
| 115 | +ISC |
0 commit comments