Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
80 changes: 80 additions & 0 deletions scripts/aidlc-codereview/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
# Python
__pycache__/
*.py[cod]
*$py.class
*.so
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# Virtual environments
.venv/
venv/
ENV/
env/

# Testing
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/
cover/
htmlcov/

# Type checking
.mypy_cache/
.dmypy.json
dmypy.json
.pytype/
.pyre/

# IDEs
.idea/
.vscode/
*.swp
*.swo
*~

# OS
.DS_Store
Thumbs.db

# Logs
logs/
*.log

# Distribution / packaging
*.tar.gz
*.whl

# Environment variables
.env
.env.*
!.env.example

# Output reports
reports/
*.review.md
*.review.json
15 changes: 15 additions & 0 deletions scripts/aidlc-codereview/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Changelog

## [0.2.0] - 2026-05-14

### Added
- Initial release of AIDLC Code Reviewer
- Static analysis of code repositories
- AI-powered critical findings via Amazon Bedrock
- Structure critique for code architecture analysis
- Business logic review
- CLI with Click framework
- Support for Python, JavaScript, TypeScript, Java, Go, Ruby
- Rich terminal output with progress display
- YAML configuration (review-config.yaml, agent-config.yaml)
- Amazon Bedrock integration via Strands Agents
48 changes: 48 additions & 0 deletions scripts/aidlc-codereview/LEGAL_DISCLAIMER.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# Legal Disclaimer

## AI-Generated Content Disclaimer

This tool uses artificial intelligence (AI) services, specifically Amazon Bedrock, to generate
code review findings and recommendations. Users should be aware of the following:

**Nature of AI Output**: The code review findings, recommendations, and analysis produced by
this tool are generated by large language models (LLMs) and represent AI-generated content.
These outputs are probabilistic in nature and may not always be accurate, complete, or
appropriate for your specific use case.

**Not a Substitute for Human Review**: AI-generated code reviews are intended to assist
human reviewers, not replace them. All findings should be evaluated by qualified software
engineers before acting on them. Critical security, compliance, or production decisions should
always involve human expert review.

**No Warranty**: The code review outputs provided by this tool are provided "as-is" without
any warranty of any kind, express or implied. Amazon Web Services, Inc. and its affiliates
make no representations or warranties regarding the accuracy, completeness, or fitness for a
particular purpose of any AI-generated findings.

**Security Findings**: Any security vulnerabilities or issues identified by this tool should
be independently verified by security professionals before remediation. The tool may produce
false positives (reporting issues that are not real) or false negatives (missing actual issues).

**Data Handling**: When using this tool, your code is sent to Amazon Bedrock for analysis.
Ensure you have appropriate authorization to share the code being reviewed and that doing so
complies with your organization's data handling and privacy policies.

**Compliance**: Users are responsible for ensuring their use of this tool complies with all
applicable laws, regulations, and organizational policies.

## Third-Party Dependencies

This tool relies on third-party open-source libraries. Please review the licenses of all
dependencies listed in `pyproject.toml` to ensure compliance with your organizational
requirements.

## AWS Service Usage

This tool uses Amazon Bedrock, an AWS service subject to AWS Service Terms and the AWS
Acceptable Use Policy. Usage of Amazon Bedrock through this tool will incur AWS charges
based on the number of tokens processed. Review Amazon Bedrock pricing before use.

---

*This disclaimer applies to all versions of the AIDLC Code Reviewer tool.*
16 changes: 16 additions & 0 deletions scripts/aidlc-codereview/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
MIT No Attribution

Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.

Permission is hereby granted, free of charge, to any person obtaining a copy of this
software and associated documentation files (the "Software"), to deal in the Software
without restriction, including without limitation the rights to use, copy, modify,
merge, publish, distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
41 changes: 41 additions & 0 deletions scripts/aidlc-codereview/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# AIDLC Code Reviewer

AI-powered code review tool for AIDLC projects using Amazon Bedrock and the Strands Agents SDK.

## Overview

AIDLC Code Reviewer performs three types of analysis on your codebase:

1. **Critical Findings** — Security vulnerabilities, bugs, null pointer risks, and other critical issues
2. **Structure Critique** — Code architecture, design patterns, module organization, and maintainability
3. **Business Logic Review** — Business logic correctness, edge cases, input validation, and error handling

## Quick Start

```bash
# Install with uv
uv pip install .

# Run a review
code-reviewer --repo-path /path/to/your/project

# Save report to file
code-reviewer --repo-path /path/to/your/project --output report.md

# Output as JSON
code-reviewer --repo-path /path/to/your/project --format json --output report.json
```

## Documentation

See [docs/SETUP.md](docs/SETUP.md) for full setup and configuration instructions.

## Requirements

- Python 3.12+
- AWS credentials configured with Amazon Bedrock access
- Access to Claude models in Amazon Bedrock (us-east-1 by default)

## License

MIT-0. See [LICENSE](LICENSE) for details.
162 changes: 162 additions & 0 deletions scripts/aidlc-codereview/docs/SETUP.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,162 @@
# Setup Guide — AIDLC Code Reviewer

## Prerequisites

- **Python 3.12+** — The tool requires Python 3.12 or newer.
- **uv** — Recommended package manager. Install from [https://docs.astral.sh/uv/](https://docs.astral.sh/uv/).
- **AWS Account** — With access to Amazon Bedrock and the Claude model family.
- **AWS CLI** — Configured with credentials that have Bedrock access.

## Installation

### Using uv (recommended)

```bash
cd scripts/aidlc-codereview
uv pip install .
```

### Using pip

```bash
cd scripts/aidlc-codereview
pip install .
```

### Development install

```bash
cd scripts/aidlc-codereview
uv pip install -e ".[dev]"
```

## AWS Bedrock Configuration

### 1. Enable Model Access

In the AWS Console, navigate to **Amazon Bedrock → Model access** and request access to:

- `anthropic.claude-sonnet-4-6` (or your preferred Claude model)

### 2. Configure AWS Credentials

The tool uses the standard AWS credential chain. Configure using one of:

**AWS CLI profile:**
```bash
aws configure --profile my-profile
```

**Environment variables:**
```bash
export AWS_ACCESS_KEY_ID=your-key-id
export AWS_SECRET_ACCESS_KEY=your-secret-key
export AWS_DEFAULT_REGION=us-east-1
```

**IAM role** (recommended for EC2/ECS/Lambda environments): Attach a role with the following policy:

```json
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"bedrock:InvokeModel",
"bedrock:InvokeModelWithResponseStream"
],
"Resource": "arn:aws:bedrock:us-east-1::foundation-model/anthropic.claude*"
}
]
}
```

### 3. Configuration File

The tool ships with a default `review-config.yaml` in `src/code_reviewer/`. To customize:

```bash
cp src/code_reviewer/review-config.yaml my-review-config.yaml
# Edit as needed
code-reviewer --repo-path /path/to/project --config my-review-config.yaml
```

Key configuration options:

```yaml
aws:
region: us-east-1 # AWS region for Bedrock
profile_name: default # AWS profile name

models:
default_model: claude-sonnet-4-6 # Default Bedrock model

review:
severity_threshold: medium # Minimum severity to report (critical/high/medium/low/info)
max_files_per_review: 50 # Limit files sent to agents
```

## Usage Examples

### Basic Review

```bash
code-reviewer --repo-path /path/to/my-project
```

### Save Markdown Report

```bash
code-reviewer --repo-path /path/to/my-project --output review-report.md
```

### JSON Output (for CI/CD integration)

```bash
code-reviewer --repo-path /path/to/my-project --format json --output review.json
```

### Use a Custom Model

```bash
code-reviewer --repo-path /path/to/my-project --model anthropic.claude-3-5-sonnet-20241022-v2:0
```

### Use a Custom Config

```bash
code-reviewer --repo-path /path/to/my-project --config /path/to/custom-config.yaml
```

### Use a Specific AWS Profile

Set the profile in `review-config.yaml` or use environment variables:

```bash
AWS_PROFILE=my-profile code-reviewer --repo-path /path/to/my-project
```

## Running Tests

```bash
cd scripts/aidlc-codereview
uv pip install -e ".[dev]"
pytest tests/ -v
```

## Troubleshooting

### `AccessDeniedException` from Bedrock

- Ensure your AWS credentials are valid and have Bedrock `InvokeModel` permissions.
- Confirm model access is enabled in the Bedrock console for your region.

### `ResourceNotFoundException`

- The model ID may be incorrect or unavailable in your region. Check `review-config.yaml` and the Bedrock console.

### `No files found to review`

- Check that the `--repo-path` points to a directory containing supported file types (`.py`, `.js`, `.ts`, `.java`, `.go`, `.rb`).
- Review the `file_extensions` list in `review-config.yaml`.
Loading