atxtechbro / atxtechbro/dotfiles

Implement automated PR linting with Claude Code/Amazon Q CLI with cost tracking

Open
#174 0 comments 0 reactions 0 assignees View on GitHub
amazon-q automation ci-cd developer-experience github-actions
Dominant language
Shell
Stars
27
Forks
2
PR merge metrics
No merged PRs in 30d

Description

## Overview

Implement an automated workflow that uses Claude Code or Amazon Q CLI to enforce coding standards on every PR, automatically commit fixes back to the PR, and track usage costs via GitHub metrics.

## Motivation

- Ensure consistent code quality across all contributions
- Reduce manual code review burden for style/formatting issues
- Automate the correction of common linting issues
- Track and optimize AI assistant usage costs
- Provide visibility into AI tool usage patterns

## Implementation Approach

### 1. GitHub Action Setup

- Create a GitHub Action workflow that triggers on PR creation/update
- Configure the action to check out the PR code
- Set up authentication for Claude Code or Amazon Q CLI
- Run the selected AI tool against changed files

### 2. Linting Configuration

- Define coding standards in a configuration file (e.g., `.lintconfig.json`)
- Specify which rules are auto-fixable vs. requiring manual intervention
- Include language-specific standards for different file types
- Allow repository-specific overrides

### 3. Automated Fix Workflow

- Run the AI tool in fix mode on detected issues
- Generate a commit with the fixes
- Push changes back to the PR branch
- Add a comment summarizing the changes made

### 4. Cost and Usage Tracking

- Implement logging for each AI tool invocation
- Track metrics such as:
- Number of files processed
- Number of issues found/fixed
- Token usage per PR
- Estimated cost per PR
- Store metrics in a structured format for analysis

### 5. GitHub Metrics Dashboard

- Create a GitHub metrics dashboard to visualize:
- Cost trends over time
- Most common linting issues
- Cost per repository/team
- ROI in terms of developer time saved

## Technical Requirements

- GitHub Actions workflow configuration
- Authentication mechanism for AI tools (secure token storage)
- Configuration schema for linting rules
- Metrics collection and storage solution
- Dashboard for visualizing metrics

## Tool Selection Considerations

### Claude Code
- Pros: Strong natural language understanding, good at explaining issues
- Cons: May have higher latency, potentially higher cost

### Amazon Q CLI
- Pros: AWS integration, potentially lower cost for AWS customers
- Cons: May have more limited language support

## Next Steps

1. Evaluate and select the AI tool (Claude Code vs Amazon Q CLI)
2. Create proof-of-concept GitHub Action for a single repository
3. Define initial set of coding standards to enforce
4. Implement basic metrics collection
5. Test on a small set of PRs and gather feedback
6. Refine and expand to more repositories
7. Develop metrics dashboard

## Expected Benefits

- **Consistent Code Quality**: Enforce standards automatically across all repositories
- **Developer Time Savings**: Reduce time spent on manual formatting and style fixes
- **Cost Optimization**: Track and optimize AI tool usage
- **Continuous Improvement**: Identify common issues to improve documentation and training

## Alignment with Dotfiles Philosophy

This implementation aligns with our "automation mindset" principle by:
- Automating repetitive code quality tasks
- Creating reproducible linting processes across repositories
- Avoiding manual, one-off commands for code formatting
- Documenting coding standards as code

## Resources Required

- GitHub Actions minutes
- Claude Code or Amazon Q CLI usage costs
- Development time for workflow setup
- Ongoing maintenance for linting rules

Contributor guide

No contributing guide indexed for this repository

Research direction

No existing workflow, tests, or entry points are named. Start by evaluating Claude Code versus Amazon Q CLI, then scope a proof of concept around a GitHub Actions workflow, `.lintconfig.json`, secure authentication, metrics storage, and a dashboard; done means automated PR fixes, comments, and cost metrics work on selected repositories.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, github-actions
Domain
ci-cd, devops, observability, tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.