From 61b5c4a8aa463fb598d2e5052794774478ad8e41 Mon Sep 17 00:00:00 2001 From: Tony Giorgio Date: Mon, 26 May 2025 11:22:40 -0500 Subject: [PATCH] Claude enhancements --- .githooks/pre-commit | 24 ++++++++++++++++ .github/workflows/claude.yml | 53 +++++++++++++++++++++++++++++++++--- README.md | 9 ++++++ setup-hooks.sh | 17 ++++++++++++ 4 files changed, 99 insertions(+), 4 deletions(-) create mode 100755 .githooks/pre-commit create mode 100755 setup-hooks.sh diff --git a/.githooks/pre-commit b/.githooks/pre-commit new file mode 100755 index 00000000..263ed47b --- /dev/null +++ b/.githooks/pre-commit @@ -0,0 +1,24 @@ +#!/bin/sh + +echo "Running pre-commit hook..." + +# Navigate to frontend directory +cd frontend || exit 1 + +# Check if bun is installed +if ! command -v bun &> /dev/null; then + echo "Error: bun is not installed. Please install bun before committing." + exit 1 +fi + +# Run the build command +echo "Running bun build..." +if ! bun run build; then + echo "" + echo "Error: Build failed! Please fix the build errors before committing." + echo "Run 'cd frontend && bun run build' to see the errors." + exit 1 +fi + +echo "Build successful! Proceeding with commit..." +exit 0 \ No newline at end of file diff --git a/.github/workflows/claude.yml b/.github/workflows/claude.yml index bcd8ef59..a3a0ea02 100644 --- a/.github/workflows/claude.yml +++ b/.github/workflows/claude.yml @@ -19,19 +19,64 @@ jobs: (github.event_name == 'issues' && (contains(github.event.issue.body, '@claude') || contains(github.event.issue.title, '@claude'))) runs-on: ubuntu-latest permissions: - contents: read - pull-requests: read - issues: read + contents: write + pull-requests: write + issues: write id-token: write + actions: read + checks: write + statuses: write steps: - name: Checkout repository uses: actions/checkout@v4 with: - fetch-depth: 1 + fetch-depth: 0 + + - name: Setup git hooks + run: | + chmod +x ./setup-hooks.sh + ./setup-hooks.sh + + - name: Setup Bun + uses: oven-sh/setup-bun@v1 + with: + bun-version: 1.2.2 + + - name: Install Rust + uses: dtolnay/rust-toolchain@stable + with: + targets: aarch64-apple-darwin,x86_64-apple-darwin,aarch64-apple-ios + + - name: Rust Cache + uses: Swatinem/rust-cache@v2 + with: + workspaces: "frontend/src-tauri -> target" + cache-on-failure: true + + - name: Install Linux dependencies + run: | + sudo apt-get update + sudo apt-get install -y libwebkit2gtk-4.1-dev \ + build-essential \ + curl \ + wget \ + file \ + libssl-dev \ + libgtk-3-dev \ + libayatana-appindicator3-dev \ + librsvg2-dev + + - name: Install frontend dependencies + working-directory: ./frontend + run: bun install + + - name: Install Tauri CLI + run: cargo install tauri-cli - name: Run Claude Code id: claude uses: anthropics/claude-code-action@beta with: anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }} + allowed_tools: "Bash(bun install),Bash(bun run build),Bash(bun run lint),Bash(bun run format),Bash(bun run format:check),Bash(bun run dev),Bash(bun run preview),Bash(bun add),Bash(bun remove),Bash(bun update),Bash(bun test),Bash(cargo build),Bash(cargo test),Bash(cargo tauri build),Bash(bun tauri build),Bash(bun tauri dev),Bash(bun tauri ios build),Bash(bun tauri ios dev),Bash(bun tauri android build),Bash(bun tauri android dev),Bash(git status),Bash(git diff),Bash(git log),Bash(git branch),Bash(git checkout),Bash(git pull),Bash(git push),Bash(git add),Bash(git commit),Bash(git rebase),Bash(git merge),Bash(ls),Bash(cat),Bash(mkdir),Bash(rm),Bash(mv),Bash(cp),Bash(pwd),Bash(cd),Bash(echo),Bash(grep),Bash(find),Bash(sed),Bash(awk),Bash(curl),Bash(wget),Edit,Replace,NotebookEditCell" diff --git a/README.md b/README.md index f70cd149..de0f554f 100644 --- a/README.md +++ b/README.md @@ -44,6 +44,15 @@ sudo apt install libwebkit2gtk-4.1-dev \ rustup target add aarch64-apple-darwin x86_64-apple-darwin ``` +## Setup + +1. Clone the repository and run the setup script: +```bash +./setup-hooks.sh +``` + +This will configure git to use the project's pre-commit hooks, which run `bun run build` before each commit. + ## Development 1. Install dependencies: diff --git a/setup-hooks.sh b/setup-hooks.sh new file mode 100755 index 00000000..6c3ee745 --- /dev/null +++ b/setup-hooks.sh @@ -0,0 +1,17 @@ +#!/bin/sh + +echo "Setting up git hooks..." + +# Get the root directory of the git repository +GIT_ROOT=$(git rev-parse --show-toplevel 2>/dev/null) + +if [ -z "$GIT_ROOT" ]; then + echo "Error: Not in a git repository" + exit 1 +fi + +# Set git to use our hooks directory +git config core.hooksPath .githooks + +echo "✅ Git hooks configured successfully!" +echo "The pre-commit hook will now run 'bun run build' before each commit." \ No newline at end of file