sudeshi-code-review
v1.2.0
Published
A TypeScript and React code review CLI with security rules and optional Sarvam AI analysis.
Readme
Sudeshi Code Review
A TypeScript and React code-review CLI that scans JavaScript and TypeScript repositories for selected security patterns and produces Markdown or JSON reports. Optional AI-assisted analysis is powered by Sarvam AI.
Features
- Scans JavaScript and TypeScript repositories, including JSX and TSX source files.
- Detects selected dangerous HTML insertion patterns, hardcoded secrets, and JavaScript URLs in JSX links.
- Reports findings with severity and evidence in Markdown or JSON, with support for saving reports to a file.
- Works without an AI API key using deterministic rules.
- Supports optional Sarvam AI analysis using your own API key.
- Includes automated tests for scanning, rules, reporting, and AI-provider behavior.
Requirements
- Node.js 24 or later.
- npm.
Installation
Install globally:
npm install --global sudeshi-code-reviewOr run without a global install:
npx sudeshi-code-review /path/to/repositoryUsage
Scan a local repository:
sudeshi-code-review /path/to/repositoryShow command-line help:
sudeshi-code-review --helpShow the installed version:
sudeshi-code-review --versionChoose a report format and destination
Interactive terminals display a formatted terminal summary by default. When output is redirected or the process is non-interactive, the default report is Markdown.
Generate machine-readable JSON:
sudeshi-code-review /path/to/repository --format jsonSave a Markdown report:
sudeshi-code-review /path/to/repository --output report.mdSave a JSON report:
sudeshi-code-review /path/to/repository --format json --output report.jsonThe repository path comes first; place options after it. Use --help for the complete list of options and examples.
Review findings and validate them before acting on them.
Terminal output
Interactive terminals display a formatted summary with severity-colored findings and confidence details. Color output is automatically disabled when stdout is not an interactive terminal or when the NO_COLOR environment variable is set. JSON selected with --format json remains machine-readable and contains no terminal styling.
Disable terminal colors explicitly:
Git Bash
export NO_COLOR=1
sudeshi-code-review /path/to/repositoryPowerShell
$env:NO_COLOR = "1"
sudeshi-code-review "C:\path\to\repository"Optional AI-assisted review
AI review is optional. Without SARVAM_API_KEY, the CLI uses its deterministic rules.
Git Bash
export SARVAM_API_KEY="your_actual_api_key"
sudeshi-code-review /path/to/repositoryPowerShell
$env:SARVAM_API_KEY = "your_actual_api_key"
sudeshi-code-review "C:\path\to\repository"Never commit API keys or include them in source code.
When AI review is enabled, selected source context is sent to Sarvam AI for analysis. Only enable this feature for repositories whose source you are authorized and comfortable sharing with the configured provider. AI assessments are advisory and must be reviewed by a developer.
Current detection rules
| Rule | Purpose |
| ------------------ | ------------------------------------------------- |
| dangerous-html | Flags selected uses of dangerouslySetInnerHTML. |
| hardcoded-secret | Detects selected hardcoded credential patterns. |
| unsafe-link | Detects JavaScript URLs in JSX link targets. |
These rules cover selected patterns, not every possible instance of these issues. Repository scanning supports .js, .jsx, .ts, and .tsx source files.
Detection scope and interpretation
dangerous-html: Flags selected uses ofdangerouslySetInnerHTML. The rule detects the HTML-insertion sink; it does not establish that the supplied value is attacker-controlled or prove that an exploitable XSS vulnerability exists. A narrowly scoped static JSON-LD case is exempted by the rule.hardcoded-secret: Detects non-empty static strings and static template literals assigned to supported secret-like variable names or object-property keys, including quoted and statically computed property keys. Database URL values are flagged when they contain embedded username and password credentials. Detected secret literals are redacted from finding evidence, but arbitrary secret formats and dynamically constructed values are outside the rule's coverage.unsafe-link: Detects statically identifiablejavascript:URLs in JSXhrefattributes, including direct string expressions, static template expressions, and supported locally resolvable variable values. It does not perform comprehensive data-flow analysis of dynamic values.
Finding severity describes the potential impact of a matched pattern. Rule confidence describes confidence in the pattern match; neither value proves exploitability or attacker control. Review the source context before treating a finding as a confirmed vulnerability.
Limitations and responsible use
Sudeshi Code Review is a focused static-analysis tool—not a complete security scanner or a certification that a repository is secure.
- Findings can include false positives and false negatives.
- Dynamic data flows are not comprehensively analyzed.
- Detection is limited to the currently implemented JavaScript and TypeScript rules.
- A clean report does not establish that a repository is secure.
- AI assessments can be inaccurate and require human review.
- AI-context redaction is best-effort. It attempts to redact recognized secret values in supported code patterns and selected repeated occurrences, but cannot guarantee that every secret will be detected or removed. Dynamically constructed values and syntax the implementation does not recognize may still be sent to the configured AI provider.
- Review the privacy implications before enabling AI review on private or sensitive repositories.
Development
git clone https://github.com/sriram23/sudeshi-code-review.git
cd sudeshi-code-review
npm ci
npm run setup:hooksRun the validation checks:
npm run format:check
npm run lint
npm test
npm run build
npm pack --dry-runnpm run setup:hooks initializes Husky hooks for contributors working in a Git checkout. It is not required by users installing the published CLI.
Contributing
See CONTRIBUTING.md for development and pull-request guidance.
Security
Please see SECURITY.md for vulnerability-reporting guidance. Do not disclose exploitable vulnerabilities or real credentials in public issues.
License
MIT. See LICENSE.
