CLI testing/linting

This commit is contained in:
AndyMik90
2025-12-15 19:31:21 +01:00
parent 7c01638a81
commit d8ad17dbfa
9 changed files with 421 additions and 21 deletions
+103
View File
@@ -0,0 +1,103 @@
name: Bug Report
description: Report a bug or unexpected behavior
labels: ["bug", "triage"]
body:
- type: markdown
attributes:
value: |
Thanks for taking the time to report a bug! Please fill out the sections below.
- type: textarea
id: description
attributes:
label: Bug Description
description: A clear and concise description of the bug.
placeholder: What happened?
validations:
required: true
- type: textarea
id: expected
attributes:
label: Expected Behavior
description: What did you expect to happen?
placeholder: What should have happened?
validations:
required: true
- type: textarea
id: reproduce
attributes:
label: Steps to Reproduce
description: Steps to reproduce the behavior.
placeholder: |
1. Run command '...'
2. Click on '...'
3. See error
validations:
required: true
- type: textarea
id: logs
attributes:
label: Error Messages / Logs
description: If applicable, paste any error messages or logs.
render: shell
- type: textarea
id: screenshots
attributes:
label: Screenshots
description: If applicable, add screenshots to help explain the problem.
- type: dropdown
id: component
attributes:
label: Component
description: Which part of Auto Claude is affected?
options:
- Python Backend (auto-claude/)
- Electron UI (auto-claude-ui/)
- Both
- Not sure
validations:
required: true
- type: input
id: version
attributes:
label: Auto Claude Version
description: What version are you running? (check package.json or git tag)
placeholder: "v2.0.1"
- type: dropdown
id: os
attributes:
label: Operating System
options:
- macOS
- Windows
- Linux
- Other
validations:
required: true
- type: input
id: python-version
attributes:
label: Python Version
description: Output of `python --version`
placeholder: "3.12.0"
- type: input
id: node-version
attributes:
label: Node.js Version (for UI issues)
description: Output of `node --version`
placeholder: "20.10.0"
- type: textarea
id: additional
attributes:
label: Additional Context
description: Any other context about the problem.
+8
View File
@@ -0,0 +1,8 @@
blank_issues_enabled: false
contact_links:
- name: Questions & Discussions
url: https://github.com/AndyMik90/Auto-Claude/discussions
about: Ask questions and discuss ideas with the community
- name: Documentation
url: https://github.com/AndyMik90/Auto-Claude#readme
about: Check the documentation before opening an issue
@@ -0,0 +1,70 @@
name: Feature Request
description: Suggest a new feature or enhancement
labels: ["enhancement", "triage"]
body:
- type: markdown
attributes:
value: |
Thanks for suggesting a feature! Please describe your idea below.
- type: textarea
id: problem
attributes:
label: Problem Statement
description: What problem does this feature solve? Is this related to a frustration?
placeholder: I'm always frustrated when...
validations:
required: true
- type: textarea
id: solution
attributes:
label: Proposed Solution
description: Describe the solution you'd like to see.
placeholder: I would like Auto Claude to...
validations:
required: true
- type: textarea
id: alternatives
attributes:
label: Alternatives Considered
description: Have you considered any alternative solutions or workarounds?
placeholder: I've tried...
- type: dropdown
id: component
attributes:
label: Component
description: Which part of Auto Claude would this affect?
options:
- Python Backend (auto-claude/)
- Electron UI (auto-claude-ui/)
- Both
- New component
- Not sure
validations:
required: true
- type: dropdown
id: priority
attributes:
label: How important is this feature to you?
options:
- Nice to have
- Important for my workflow
- Critical / Blocking my use
- type: checkboxes
id: contribution
attributes:
label: Contribution
description: Would you be willing to help implement this?
options:
- label: I'm willing to submit a PR for this feature
- type: textarea
id: additional
attributes:
label: Additional Context
description: Add any other context, mockups, or screenshots about the feature request.
+44
View File
@@ -0,0 +1,44 @@
## Summary
<!-- Brief description of what this PR does -->
## Type of Change
- [ ] Bug fix (non-breaking change that fixes an issue)
- [ ] New feature (non-breaking change that adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to change)
- [ ] Documentation update
- [ ] Refactoring (no functional changes)
- [ ] Tests (adding or updating tests)
## Related Issues
<!-- Link any related issues: Fixes #123, Closes #456 -->
## Changes Made
<!-- List the main changes in this PR -->
-
-
-
## Screenshots
<!-- If applicable, add screenshots for UI changes -->
## Checklist
- [ ] I have run `pre-commit run --all-files` and fixed any issues
- [ ] I have added tests for my changes (if applicable)
- [ ] All existing tests pass locally
- [ ] I have updated documentation (if applicable)
- [ ] My code follows the project's code style
## Testing
<!-- Describe how you tested these changes -->
## Additional Notes
<!-- Any additional context or notes for reviewers -->
+27 -1
View File
@@ -7,7 +7,8 @@ on:
branches: [main]
jobs:
test:
# Python tests
test-python:
runs-on: ubuntu-latest
strategy:
matrix:
@@ -55,3 +56,28 @@ jobs:
fail_ci_if_error: false
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
# Frontend tests
test-frontend:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: 9
- name: Install dependencies
working-directory: auto-claude-ui
run: pnpm install --frozen-lockfile --ignore-scripts
- name: Run tests
working-directory: auto-claude-ui
run: pnpm test
+19 -19
View File
@@ -7,7 +7,8 @@ on:
branches: [main]
jobs:
ruff:
# Python linting
python:
runs-on: ubuntu-latest
steps:
- name: Checkout
@@ -27,32 +28,31 @@ jobs:
- name: Run ruff format check
run: ruff format auto-claude/ --check --diff
type-check:
# TypeScript/React linting
frontend:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
- name: Setup Node.js
uses: actions/setup-node@v4
with:
python-version: '3.12'
node-version: '20'
- name: Install uv
uses: astral-sh/setup-uv@v4
- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: "latest"
version: 9
- name: Install dependencies
working-directory: auto-claude
run: |
uv venv
uv pip install -r requirements.txt
uv pip install -r ../tests/requirements-test.txt
uv pip install types-requests
working-directory: auto-claude-ui
run: pnpm install --frozen-lockfile --ignore-scripts
- name: Run mypy
working-directory: auto-claude
run: |
source .venv/bin/activate
mypy . --ignore-missing-imports --no-error-summary || true
- name: Run ESLint
working-directory: auto-claude-ui
run: pnpm lint
- name: Run TypeScript check
working-directory: auto-claude-ui
run: pnpm typecheck
+27 -1
View File
@@ -6,7 +6,8 @@ on:
- 'v*'
jobs:
test:
# Python tests
test-python:
runs-on: ubuntu-latest
strategy:
matrix:
@@ -38,3 +39,28 @@ jobs:
run: |
source .venv/bin/activate
pytest ../tests/ -v --tb=short
# Frontend tests
test-frontend:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: 9
- name: Install dependencies
working-directory: auto-claude-ui
run: pnpm install --frozen-lockfile --ignore-scripts
- name: Run tests
working-directory: auto-claude-ui
run: pnpm test
+36
View File
@@ -0,0 +1,36 @@
repos:
# Python linting (auto-claude/)
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.8.3
hooks:
- id: ruff
args: [--fix]
files: ^auto-claude/
- id: ruff-format
files: ^auto-claude/
# Frontend linting (auto-claude-ui/)
- repo: local
hooks:
- id: eslint
name: ESLint
entry: bash -c 'cd auto-claude-ui && pnpm lint'
language: system
files: ^auto-claude-ui/.*\.(ts|tsx|js|jsx)$
pass_filenames: false
- id: typecheck
name: TypeScript Check
entry: bash -c 'cd auto-claude-ui && pnpm typecheck'
language: system
files: ^auto-claude-ui/.*\.(ts|tsx)$
pass_filenames: false
# General checks
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-added-large-files
+87
View File
@@ -8,8 +8,10 @@ Thank you for your interest in contributing to Auto Claude! This document provid
- [Development Setup](#development-setup)
- [Python Backend](#python-backend)
- [Electron Frontend](#electron-frontend)
- [Pre-commit Hooks](#pre-commit-hooks)
- [Code Style](#code-style)
- [Testing](#testing)
- [Continuous Integration](#continuous-integration)
- [Git Workflow](#git-workflow)
- [Branch Naming](#branch-naming)
- [Commit Messages](#commit-messages)
@@ -78,6 +80,54 @@ pnpm build
pnpm package
```
## Pre-commit Hooks
We use [pre-commit](https://pre-commit.com/) to run linting and formatting checks before each commit. This ensures code quality and consistency across the project.
### Setup
```bash
# Install pre-commit
pip install pre-commit
# Install the git hooks (run once after cloning)
pre-commit install
```
### What Runs on Commit
When you commit, the following checks run automatically:
| Check | Scope | Description |
|-------|-------|-------------|
| **ruff** | `auto-claude/` | Python linter with auto-fix |
| **ruff-format** | `auto-claude/` | Python code formatter |
| **eslint** | `auto-claude-ui/` | TypeScript/React linter |
| **typecheck** | `auto-claude-ui/` | TypeScript type checking |
| **trailing-whitespace** | All files | Removes trailing whitespace |
| **end-of-file-fixer** | All files | Ensures files end with newline |
| **check-yaml** | All files | Validates YAML syntax |
| **check-added-large-files** | All files | Prevents large file commits |
### Running Manually
```bash
# Run all checks on all files
pre-commit run --all-files
# Run a specific hook
pre-commit run ruff --all-files
# Skip hooks temporarily (not recommended)
git commit --no-verify -m "message"
```
### If a Check Fails
1. **Ruff auto-fixes**: Some issues are fixed automatically. Stage the changes and commit again.
2. **ESLint errors**: Fix the reported issues in your code.
3. **Type errors**: Resolve TypeScript type issues before committing.
## Code Style
### Python
@@ -192,6 +242,43 @@ Before submitting a PR:
3. **Bug fixes should include a regression test**
4. **Test coverage should not decrease significantly**
## Continuous Integration
All pull requests and pushes to `main` trigger automated CI checks via GitHub Actions.
### Workflows
| Workflow | Trigger | What it checks |
|----------|---------|----------------|
| **CI** | Push to `main`, PRs | Python tests (3.11 & 3.12), Frontend tests |
| **Lint** | Push to `main`, PRs | Ruff (Python), ESLint + TypeScript (Frontend) |
| **Test on Tag** | Version tags (`v*`) | Full test suite before release |
### PR Requirements
Before a PR can be merged:
1. All CI checks must pass (green checkmarks)
2. Python tests pass on both Python 3.11 and 3.12
3. Frontend tests pass
4. Linting passes (no ruff or eslint errors)
5. TypeScript type checking passes
### Running CI Checks Locally
```bash
# Python tests
cd auto-claude
source .venv/bin/activate
pytest ../tests/ -v
# Frontend tests
cd auto-claude-ui
pnpm test
pnpm lint
pnpm typecheck
```
## Git Workflow
### Branch Naming