|
| 1 | +# CodeQual CLI |
| 2 | + |
| 3 | +Command-line interface for the CodeQual PR review tool. |
| 4 | + |
| 5 | +## Installation |
| 6 | + |
| 7 | +For local development: |
| 8 | + |
| 9 | +```bash |
| 10 | +# Build the package |
| 11 | +npm run build |
| 12 | + |
| 13 | +# Link it globally |
| 14 | +npm link |
| 15 | +``` |
| 16 | + |
| 17 | +## Available Commands |
| 18 | + |
| 19 | +### PR Review |
| 20 | + |
| 21 | +Analyze a pull request for code quality, security issues, and best practices. |
| 22 | + |
| 23 | +```bash |
| 24 | +codequal review --repo <owner/repo> --pr <number> --token <github-token> [--snyk-token <token>] |
| 25 | +``` |
| 26 | + |
| 27 | +Options: |
| 28 | +- `--repo, -r`: Repository name in format "owner/repo" |
| 29 | +- `--pr, -p`: Pull request number |
| 30 | +- `--token, -t`: GitHub token with repo access |
| 31 | +- `--snyk-token`: Optional Snyk API token for security scanning |
| 32 | + |
| 33 | +#### Example |
| 34 | + |
| 35 | +```bash |
| 36 | +# Analyze PR #1 in the CodeQual repository |
| 37 | +codequal review --repo alpsla/codequal --pr 1 --token ghp_yourgithubtoken123456789 |
| 38 | + |
| 39 | +# Output |
| 40 | +Starting PR review for alpsla/codequal#1 |
| 41 | +Initializing analysis services |
| 42 | +Analyzing PR #1 in repository alpsla/codequal |
| 43 | +Storing analysis results |
| 44 | +PR review completed successfully |
| 45 | + |
| 46 | +CodeQual Analysis Results for alpsla/codequal#1: |
| 47 | +Total issues found: 0 |
| 48 | +View detailed results: http://localhost:3000/analysis/1682688421234 |
| 49 | +``` |
| 50 | + |
| 51 | +When adding the Snyk token for security scanning: |
| 52 | + |
| 53 | +```bash |
| 54 | +codequal review --repo alpsla/codequal --pr 1 --token ghp_yourgithubtoken123456789 --snyk-token snyk_yoursnykapitoken123456789 |
| 55 | + |
| 56 | +# Output will include additional security scanning |
| 57 | +Starting PR review for alpsla/codequal#1 |
| 58 | +Initializing analysis services |
| 59 | +Configuring Snyk agent with provided token |
| 60 | +Analyzing PR #1 in repository alpsla/codequal |
| 61 | +Storing analysis results |
| 62 | +PR review completed successfully |
| 63 | + |
| 64 | +CodeQual Analysis Results for alpsla/codequal#1: |
| 65 | +Total issues found: 0 |
| 66 | +View detailed results: http://localhost:3000/analysis/1682688421234 |
| 67 | +``` |
| 68 | + |
| 69 | +### Version |
| 70 | + |
| 71 | +Display the current version of the CLI. |
| 72 | + |
| 73 | +```bash |
| 74 | +codequal --version |
| 75 | +``` |
| 76 | + |
| 77 | +## Future Commands |
| 78 | + |
| 79 | +The following commands are planned for future releases: |
| 80 | + |
| 81 | +### Analysis Report |
| 82 | + |
| 83 | +Get a detailed report of a previously run analysis. |
| 84 | + |
| 85 | +```bash |
| 86 | +codequal report <analysis-id> |
| 87 | +``` |
| 88 | + |
| 89 | +### User Skills |
| 90 | + |
| 91 | +Display developer skill analytics based on PR review history. |
| 92 | + |
| 93 | +```bash |
| 94 | +codequal skills <user-id> [--timeframe <week|month|year>] |
| 95 | +``` |
| 96 | + |
| 97 | +### Agent Management |
| 98 | + |
| 99 | +Manage and configure analysis agents. |
| 100 | + |
| 101 | +```bash |
| 102 | +codequal agents list |
| 103 | +codequal agents enable <agent-name> |
| 104 | +codequal agents disable <agent-name> |
| 105 | +codequal agents configure <agent-name> |
| 106 | +``` |
| 107 | + |
| 108 | +## Development |
| 109 | + |
| 110 | +To add a new command: |
| 111 | + |
| 112 | +1. Create a new file in `src/commands/<command-name>.ts` |
| 113 | +2. Implement the command logic |
| 114 | +3. Register the command in `src/index.ts` |
| 115 | +4. Build and test the CLI |
| 116 | + |
| 117 | +## Configuration |
| 118 | + |
| 119 | +The CLI uses the following configuration sources: |
| 120 | + |
| 121 | +1. Command-line arguments (highest priority) |
| 122 | +2. Environment variables (e.g., `GITHUB_TOKEN`, `SNYK_TOKEN`) |
| 123 | +3. Configuration file (`.codequalrc` in user's home directory) |
| 124 | + |
| 125 | +## Integration |
| 126 | + |
| 127 | +The CLI integrates with: |
| 128 | + |
| 129 | +- GitHub/GitLab API for PR data |
| 130 | +- Multiple AI-powered code analysis agents |
| 131 | +- Snyk API for security scanning |
| 132 | +- CodeQual database for storing analysis results |
0 commit comments