diff --git a/.claude/agents/deep-thinker.md b/.claude/agents/deep-thinker.md new file mode 100644 index 000000000..b0c501350 --- /dev/null +++ b/.claude/agents/deep-thinker.md @@ -0,0 +1,31 @@ +--- +name: deep-thinker +description: A subagent that performs deep analysis with extended thinking +tools: + - "*" +proactive: false +--- + +# Deep Thinker Subagent + +You are a specialized subagent designed to perform deep, thorough analysis of complex problems using extended thinking capabilities. + +## Your Purpose + +You excel at: +- Breaking down complex problems into smaller components +- Analyzing trade-offs and implications +- Providing comprehensive, well-reasoned solutions +- Exploring edge cases and potential issues + +## Instructions + +When given a task: +1. Use extended thinking to thoroughly analyze the problem +2. Consider multiple approaches and their trade-offs +3. Identify potential issues or edge cases +4. Provide a detailed, well-structured response + +## Important + +Always think deeply before responding. Take your time to ensure thoroughness and accuracy in your analysis. \ No newline at end of file diff --git a/.claude/commands/fix-ci-commit.md b/.claude/commands/fix-ci-commit.md new file mode 100644 index 000000000..55bf47a25 --- /dev/null +++ b/.claude/commands/fix-ci-commit.md @@ -0,0 +1,55 @@ +--- +description: Fix CI failures and commit changes (for use when branch already exists) +--- + +# Fix CI Failures and Commit + +You are on a branch that was created to fix CI failures. Your task is to fix the issues and commit the changes. + +## CI Failure Information + +$ARGUMENTS + +## Your Tasks + +1. **Analyze the failures** - Understand what went wrong from the logs +2. **Fix the issues** - Make the necessary code changes +3. **Commit your fixes** - Use git to commit all changes + +## Step-by-Step Instructions + +### 1. Fix the Issues + +Based on the error logs: +- Fix syntax errors +- Fix formatting issues +- Fix test failures +- Fix any other CI problems + +### 2. Commit Your Changes (REQUIRED) + +After fixing ALL issues, you MUST: + +```bash +# Stage all changes +git add -A + +# Commit with descriptive message +git commit -m "Fix CI failures + +- Fixed syntax errors +- Fixed formatting issues +- Fixed test failures +[List actual fixes made]" +``` + +**IMPORTANT**: You MUST use the Bash tool to run the git add and git commit commands above. The workflow expects you to commit your changes. + +### 3. Verify (Optional) + +If possible, run verification commands: +- `bun run format:check` for formatting +- `bun test` for tests +- `bun run typecheck` for TypeScript + +Begin by analyzing the failure logs and then fix the issues. \ No newline at end of file diff --git a/.claude/commands/fix-ci.md b/.claude/commands/fix-ci.md new file mode 100644 index 000000000..83b21bc4e --- /dev/null +++ b/.claude/commands/fix-ci.md @@ -0,0 +1,66 @@ +--- +description: Analyze and fix CI failures by examining logs and making targeted fixes +--- + +# Fix CI Failures + +You are tasked with analyzing CI failure logs and fixing the issues. Follow these steps: + +## Context Provided + +$ARGUMENTS + +## Step 1: Analyze the Failure + +Parse the provided CI failure information to understand: +- Which jobs failed and why +- The specific error messages and stack traces +- Whether failures are test-related, build-related, or linting issues + +## Step 2: Search and Understand the Codebase + +Use search tools to locate the failing code: +- Search for the failing test names or functions +- Find the source files mentioned in error messages +- Review related configuration files (package.json, tsconfig.json, etc.) + +## Step 3: Apply Targeted Fixes + +Make minimal, focused changes: +- **For test failures**: Determine if the test or implementation needs fixing +- **For type errors**: Fix type definitions or correct the code logic +- **For linting issues**: Apply formatting using the project's tools +- **For build errors**: Resolve dependency or configuration issues +- **For missing imports**: Add the necessary imports or install packages + +Requirements: +- Only fix the actual CI failures, avoid unrelated changes +- Follow existing code patterns and conventions +- Ensure changes are production-ready, not temporary hacks +- Preserve existing functionality while fixing issues + +## Step 4: Commit Changes + +After applying ALL fixes, use the Bash tool to: +1. Run: `git add -A` to stage all modified files +2. Run: `git commit -m "Fix CI failures: "` to commit the changes +3. Include details about which CI jobs/tests were fixed in the commit message +4. Important: You MUST use the Bash tool to run these git commands to commit your changes + +## Step 5: Verify Fixes Locally + +Run available verification commands: +- Execute the failing tests locally to confirm they pass +- Run the project's lint command (check package.json for scripts) +- Run type checking if available +- Execute any build commands to ensure compilation succeeds + +## Important Guidelines + +- Focus exclusively on fixing the reported CI failures +- Maintain code quality and follow the project's established patterns +- If a fix requires significant refactoring, document why it's necessary +- When multiple solutions exist, choose the simplest one that maintains code quality +- Add clear comments only if the fix is non-obvious + +Begin by analyzing the failure details provided above. \ No newline at end of file diff --git a/.claude/commands/review.md b/.claude/commands/review.md new file mode 100644 index 000000000..0d15884fc --- /dev/null +++ b/.claude/commands/review.md @@ -0,0 +1,22 @@ +--- +allowed-tools: Bash(gh pr comment:*), Bash(gh pr diff:*), Bash(gh pr view:*), Read, Glob, Grep +description: Code review a pull request +--- + +Review the current pull request and provide feedback. + +1. Use `gh pr view` to get the PR details and `gh pr diff` to see the changes +2. Look for potential bugs, issues, or improvements +3. Always post a comment with your findings using `gh pr comment` + +Format your comment like this: + +## Code Review + +[Your feedback here - be specific and constructive] + +- If you find issues, describe them clearly +- If everything looks good, say so +- Link to specific lines when relevant + +🤖 Generated with [Claude Code](https://claude.ai/code) \ No newline at end of file diff --git a/.github/workflows/auto-fix-ci-inline.yml b/.github/workflows/auto-fix-ci-inline.yml new file mode 100644 index 000000000..913d86e8c --- /dev/null +++ b/.github/workflows/auto-fix-ci-inline.yml @@ -0,0 +1,175 @@ +name: Auto Fix CI Failures (Inline) + +on: + workflow_run: + workflows: ["CI"] + types: + - completed + +permissions: + contents: write + pull-requests: write + actions: read + issues: write + +jobs: + auto-fix: + if: | + github.event.workflow_run.conclusion == 'failure' && + github.event.workflow_run.name != 'Auto Fix CI Failures' && + github.event.workflow_run.name != 'Auto Fix CI Failures (Inline)' + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + with: + ref: ${{ github.event.workflow_run.head_branch }} + fetch-depth: 0 + token: ${{ secrets.GITHUB_TOKEN }} + + - name: Setup git + run: | + git config --global user.name "claude[bot]" + git config --global user.email "198276+claude[bot]@users.noreply.github.com" + + - name: Create fix branch + id: branch + run: | + BRANCH_NAME="claude-auto-fix-ci-${{ github.event.workflow_run.head_branch }}-${{ github.run_id }}" + git checkout -b "$BRANCH_NAME" + echo "branch_name=$BRANCH_NAME" >> $GITHUB_OUTPUT + + - name: Get CI failure details + id: failure_details + uses: actions/github-script@v7 + with: + script: | + const run = await github.rest.actions.getWorkflowRun({ + owner: context.repo.owner, + repo: context.repo.repo, + run_id: ${{ github.event.workflow_run.id }} + }); + + const jobs = await github.rest.actions.listJobsForWorkflowRun({ + owner: context.repo.owner, + repo: context.repo.repo, + run_id: ${{ github.event.workflow_run.id }} + }); + + const failedJobs = jobs.data.jobs.filter(job => job.conclusion === 'failure'); + + let errorLogs = []; + for (const job of failedJobs) { + const logs = await github.rest.actions.downloadJobLogsForWorkflowRun({ + owner: context.repo.owner, + repo: context.repo.repo, + job_id: job.id + }); + errorLogs.push({ + jobName: job.name, + logs: logs.data + }); + } + + return { + runUrl: run.data.html_url, + failedJobs: failedJobs.map(j => j.name), + errorLogs: errorLogs + }; + + - name: Fix CI failures with Claude + uses: km-anthropic/claude-code-action@v1-dev + with: + prompt: | + You are tasked with analyzing CI failure logs and fixing the issues. Follow these steps: + + ## Context Provided + + Failed CI Run: ${{ fromJSON(steps.failure_details.outputs.result).runUrl }} + Failed Jobs: ${{ join(fromJSON(steps.failure_details.outputs.result).failedJobs, ', ') }} + + Error logs: + ${{ toJSON(fromJSON(steps.failure_details.outputs.result).errorLogs) }} + + ## Step 1: Analyze the Failure + + Parse the provided CI failure information to understand: + - Which jobs failed and why + - The specific error messages and stack traces + - Whether failures are test-related, build-related, or linting issues + + ## Step 2: Search and Understand the Codebase + + Use search tools to locate the failing code: + - Search for the failing test names or functions + - Find the source files mentioned in error messages + - Review related configuration files (package.json, tsconfig.json, etc.) + + ## Step 3: Apply Targeted Fixes + + Make minimal, focused changes: + - **For test failures**: Determine if the test or implementation needs fixing + - **For type errors**: Fix type definitions or correct the code logic + - **For linting issues**: Apply formatting using the project's tools + - **For build errors**: Resolve dependency or configuration issues + - **For missing imports**: Add the necessary imports or install packages + + Requirements: + - Only fix the actual CI failures, avoid unrelated changes + - Follow existing code patterns and conventions + - Ensure changes are production-ready, not temporary hacks + - Preserve existing functionality while fixing issues + + ## Step 4: Commit Changes + + After applying ALL fixes: + 1. Stage all modified files with `git add -A` + 2. Commit with: `git commit -m "Fix CI failures: prettier formatting and syntax errors"` + 3. Important: You MUST commit your changes - the branch already exists + + ## Step 5: Verify Fixes Locally + + Run available verification commands: + - Execute the failing tests locally to confirm they pass + - Run the project's lint command (check package.json for scripts) + - Run type checking if available + - Execute any build commands to ensure compilation succeeds + + ## Important Guidelines + + - Focus exclusively on fixing the reported CI failures + - Maintain code quality and follow the project's established patterns + - If a fix requires significant refactoring, document why it's necessary + - When multiple solutions exist, choose the simplest one that maintains code quality + + Begin by analyzing the failure details provided above. + anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }} + github_token: ${{ secrets.GITHUB_TOKEN }} + timeout_minutes: "30" + use_sticky_comment: "true" + claude_args: "--max-turns 15" + + - name: Push fix branch + if: success() + run: | + git push origin ${{ steps.branch.outputs.branch_name }} + + - name: Create pull request comment + if: success() + uses: actions/github-script@v7 + with: + script: | + const branchName = '${{ steps.branch.outputs.branch_name }}'; + const baseBranch = '${{ github.event.workflow_run.head_branch }}'; + const prUrl = `https://github.com/${context.repo.owner}/${context.repo.repo}/compare/${baseBranch}...${branchName}?quick_pull=1`; + + const issueNumber = ${{ github.event.workflow_run.pull_requests[0]?.number || 'null' }}; + + if (issueNumber) { + await github.rest.issues.createComment({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: issueNumber, + body: `## 🤖 CI Auto-Fix Available\n\nClaude has analyzed the CI failures and prepared fixes.\n\n[**→ Create pull request to fix CI**](${prUrl})\n\n_This fix was generated automatically based on the [failed CI run](${{ fromJSON(steps.failure_details.outputs.result).runUrl }})._` + }); + } \ No newline at end of file diff --git a/.github/workflows/auto-fix-ci.yml b/.github/workflows/auto-fix-ci.yml new file mode 100644 index 000000000..465234ea6 --- /dev/null +++ b/.github/workflows/auto-fix-ci.yml @@ -0,0 +1,117 @@ +name: Auto Fix CI Failures + +on: + workflow_run: + workflows: ["CI"] + types: + - completed + +permissions: + contents: write + pull-requests: write + actions: read + issues: write + +jobs: + auto-fix: + if: | + github.event.workflow_run.conclusion == 'failure' && + github.event.workflow_run.name != 'Auto Fix CI Failures' + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + with: + ref: ${{ github.event.workflow_run.head_branch }} + fetch-depth: 0 + token: ${{ secrets.GITHUB_TOKEN }} + + - name: Setup git + run: | + git config --global user.name "claude[bot]" + git config --global user.email "198276+claude[bot]@users.noreply.github.com" + + - name: Create fix branch + id: branch + run: | + BRANCH_NAME="claude-auto-fix-ci-${{ github.event.workflow_run.head_branch }}-${{ github.run_id }}" + git checkout -b "$BRANCH_NAME" + echo "branch_name=$BRANCH_NAME" >> $GITHUB_OUTPUT + + - name: Get CI failure details + id: failure_details + uses: actions/github-script@v7 + with: + script: | + const run = await github.rest.actions.getWorkflowRun({ + owner: context.repo.owner, + repo: context.repo.repo, + run_id: ${{ github.event.workflow_run.id }} + }); + + const jobs = await github.rest.actions.listJobsForWorkflowRun({ + owner: context.repo.owner, + repo: context.repo.repo, + run_id: ${{ github.event.workflow_run.id }} + }); + + const failedJobs = jobs.data.jobs.filter(job => job.conclusion === 'failure'); + + let errorLogs = []; + for (const job of failedJobs) { + const logs = await github.rest.actions.downloadJobLogsForWorkflowRun({ + owner: context.repo.owner, + repo: context.repo.repo, + job_id: job.id + }); + errorLogs.push({ + jobName: job.name, + logs: logs.data + }); + } + + return { + runUrl: run.data.html_url, + failedJobs: failedJobs.map(j => j.name), + errorLogs: errorLogs + }; + + - name: Fix CI failures with Claude + uses: km-anthropic/claude-code-action@v1-dev + with: + prompt: | + /fix-ci-commit Failed CI Run: ${{ fromJSON(steps.failure_details.outputs.result).runUrl }} + Failed Jobs: ${{ join(fromJSON(steps.failure_details.outputs.result).failedJobs, ', ') }} + + Error logs: + ${{ toJSON(fromJSON(steps.failure_details.outputs.result).errorLogs) }} + anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }} + github_token: ${{ secrets.GITHUB_TOKEN }} + timeout_minutes: "30" + use_sticky_comment: "true" + claude_args: "--max-turns 15" + + - name: Push fix branch + if: success() + run: | + git push origin ${{ steps.branch.outputs.branch_name }} + + - name: Create pull request comment + if: success() + uses: actions/github-script@v7 + with: + script: | + const branchName = '${{ steps.branch.outputs.branch_name }}'; + const baseBranch = '${{ github.event.workflow_run.head_branch }}'; + const prUrl = `https://github.com/${context.repo.owner}/${context.repo.repo}/compare/${baseBranch}...${branchName}?quick_pull=1`; + + const issueNumber = ${{ github.event.workflow_run.pull_requests[0]?.number || 'null' }}; + + if (issueNumber) { + await github.rest.issues.createComment({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: issueNumber, + body: `## 🤖 CI Auto-Fix Available\n\nClaude has analyzed the CI failures and prepared fixes.\n\n[**→ Create pull request to fix CI**](${prUrl})\n\n_This fix was generated automatically based on the [failed CI run](${{ fromJSON(steps.failure_details.outputs.result).runUrl }})._` + }); + } \ No newline at end of file diff --git a/.github/workflows/claude-auto-review-test.yml b/.github/workflows/claude-auto-review-test.yml index 87f4c0087..98ae27eeb 100644 --- a/.github/workflows/claude-auto-review-test.yml +++ b/.github/workflows/claude-auto-review-test.yml @@ -1,49 +1,33 @@ -name: Claude PR Review (Fixed) +name: Auto review PRs on: pull_request: - types: [opened, synchronize] - workflow_dispatch: - inputs: - pr_number: - description: "PR number to review" - required: false - type: string + types: [opened] jobs: auto-review: - runs-on: ubuntu-latest permissions: contents: read - pull-requests: write - issues: write id-token: write + runs-on: ubuntu-latest + steps: - name: Checkout repository uses: actions/checkout@v4 with: - fetch-depth: 0 + fetch-depth: 1 - - name: Automatic PR Review + - name: Auto review PR uses: anthropics/claude-code-action@v1-dev with: - anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }} - timeout_minutes: "60" prompt: | - Please review this pull request and provide comprehensive feedback. - - Focus on: + Please review this PR. Look at the changes and provide thoughtful feedback on: - Code quality and best practices - Potential bugs or issues - - Performance considerations - - Security implications - - Test coverage - - Documentation updates if needed - - Provide constructive feedback with specific suggestions for improvement. - Use inline comments to highlight specific areas of concern. + - Suggestions for improvements + - Overall architecture and design decisions + - Documentation consistency: Verify that README.md and other documentation files are updated to reflect any code changes (especially new inputs, features, or configuration options) - After your review, submit a proper GitHub review with your findings. - # Only include essential tools for reviewing (no submitting) - # This prevents multiple review submissions - claude_args: "--allowedTools Bash,Read,Grep,mcp__github-comment-server__get_pull_request_diff,mcp__github-comment-server__get_pull_request_files,mcp__github-comment-server__get_pull_request" + Be constructive and specific in your feedback. Give inline comments where applicable. + anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }} + claude_args: "--allowedTools mcp__github-comment-server__create_pending_pull_request_review,mcp__github-comment-server__add_comment_to_pending_review,mcp__github-comment-server__submit_pending_pull_request_review,mcp__github-comment-server__get_pull_request_diff" diff --git a/.github/workflows/claude-auto-review.yml b/.github/workflows/claude-auto-review.yml new file mode 100644 index 000000000..67d5778aa --- /dev/null +++ b/.github/workflows/claude-auto-review.yml @@ -0,0 +1,26 @@ +name: Auto Review PRs + +on: + pull_request: + types: [opened, synchronize] + +jobs: + auto-review: + runs-on: ubuntu-latest + permissions: + contents: read + pull-requests: write + issues: write + id-token: write + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Auto review PR + uses: anthropics/claude-code-action@v1-dev + with: + anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }} + prompt: /review \ No newline at end of file diff --git a/.github/workflows/claude-review.yml b/.github/workflows/claude-review.yml deleted file mode 100644 index 10706cc20..000000000 --- a/.github/workflows/claude-review.yml +++ /dev/null @@ -1,33 +0,0 @@ -name: Auto review PRs - -on: - pull_request: - types: [opened] - -jobs: - auto-review: - permissions: - contents: read - id-token: write - runs-on: ubuntu-latest - - steps: - - name: Checkout repository - uses: actions/checkout@v4 - with: - fetch-depth: 1 - - - name: Auto review PR - uses: anthropics/claude-code-action@main - with: - direct_prompt: | - Please review this PR. Look at the changes and provide thoughtful feedback on: - - Code quality and best practices - - Potential bugs or issues - - Suggestions for improvements - - Overall architecture and design decisions - - Documentation consistency: Verify that README.md and other documentation files are updated to reflect any code changes (especially new inputs, features, or configuration options) - - Be constructive and specific in your feedback. Give inline comments where applicable. - anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }} - allowed_tools: "mcp__github__create_pending_pull_request_review,mcp__github__add_comment_to_pending_review,mcp__github__submit_pending_pull_request_review,mcp__github__get_pull_request_diff" diff --git a/.github/workflows/claude.yml b/.github/workflows/claude.yml index 99407a33b..8a64f53c7 100644 --- a/.github/workflows/claude.yml +++ b/.github/workflows/claude.yml @@ -31,9 +31,13 @@ jobs: - name: Run Claude Code id: claude - uses: anthropics/claude-code-action@beta + uses: janeapp/claude-code-action@main with: anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }} allowed_tools: "Bash(bun install),Bash(bun test:*),Bash(bun run format),Bash(bun typecheck)" custom_instructions: "You have also been granted tools for editing files and running bun commands (install, run, test, typecheck) for testing your changes: bun install, bun test, bun run format, bun typecheck." model: "claude-opus-4-1-20250805" + # Testing PR 411 - sticky comment customization + use_sticky_comment: true + sticky_comment_app_bot_id: "209825114" + sticky_comment_app_bot_name: "claude" diff --git a/README.md b/README.md index ce976ef08..b7c3decc2 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ ![Claude Code Action responding to a comment](https://github.com/user-attachments/assets/1d60c2e9-82ed-4ee5-b749-f9e021c85f4d) -# Claude Code Action +# Claude Code Action (Final Test) A general-purpose [Claude Code](https://claude.ai/code) action for GitHub PRs and issues that can answer questions and implement code changes. This action listens for a trigger phrase in comments and activates Claude act on the request. It supports multiple authentication methods including Anthropic direct API, Amazon Bedrock, and Google Vertex AI. diff --git a/base-action/src/setup-claude-code-settings.ts b/base-action/src/setup-claude-code-settings.ts index 6c40cfe25..74acef70d 100644 --- a/base-action/src/setup-claude-code-settings.ts +++ b/base-action/src/setup-claude-code-settings.ts @@ -79,4 +79,37 @@ export async function setupClaudeCodeSettings( console.log(`Slash commands directory not found or error copying: ${e}`); } } + + // Copy subagent files from repository to Claude's agents directory + // CLAUDE_WORKING_DIR is set by the action to point to the repo being processed + const workingDir = process.env.CLAUDE_WORKING_DIR || process.cwd(); + const repoAgentsDir = `${workingDir}/.claude/agents`; + const targetAgentsDir = `${home}/.claude/agents`; + + try { + const agentsDirExists = await $`test -d ${repoAgentsDir}`.quiet().nothrow(); + if (agentsDirExists.exitCode === 0) { + console.log(`Found subagents directory at ${repoAgentsDir}`); + + // Create target agents directory if it doesn't exist + await $`mkdir -p ${targetAgentsDir}`.quiet(); + console.log(`Created target agents directory at ${targetAgentsDir}`); + + // Copy all .md files from repo agents to Claude's agents directory + const copyResult = await $`cp -r ${repoAgentsDir}/*.md ${targetAgentsDir}/ 2>/dev/null`.quiet().nothrow(); + + if (copyResult.exitCode === 0) { + // List copied agents for logging + const agents = await $`ls -la ${targetAgentsDir}/*.md 2>/dev/null | wc -l`.quiet().text(); + const agentCount = parseInt(agents.trim()) || 0; + console.log(`Successfully copied ${agentCount} subagent(s) to ${targetAgentsDir}`); + } else { + console.log(`No subagent files found in ${repoAgentsDir}`); + } + } else { + console.log(`No subagents directory found at ${repoAgentsDir}`); + } + } catch (e) { + console.log(`Error handling subagents: ${e}`); + } } diff --git a/slash-commands/fix-ci-commit.md b/slash-commands/fix-ci-commit.md new file mode 100644 index 000000000..55bf47a25 --- /dev/null +++ b/slash-commands/fix-ci-commit.md @@ -0,0 +1,55 @@ +--- +description: Fix CI failures and commit changes (for use when branch already exists) +--- + +# Fix CI Failures and Commit + +You are on a branch that was created to fix CI failures. Your task is to fix the issues and commit the changes. + +## CI Failure Information + +$ARGUMENTS + +## Your Tasks + +1. **Analyze the failures** - Understand what went wrong from the logs +2. **Fix the issues** - Make the necessary code changes +3. **Commit your fixes** - Use git to commit all changes + +## Step-by-Step Instructions + +### 1. Fix the Issues + +Based on the error logs: +- Fix syntax errors +- Fix formatting issues +- Fix test failures +- Fix any other CI problems + +### 2. Commit Your Changes (REQUIRED) + +After fixing ALL issues, you MUST: + +```bash +# Stage all changes +git add -A + +# Commit with descriptive message +git commit -m "Fix CI failures + +- Fixed syntax errors +- Fixed formatting issues +- Fixed test failures +[List actual fixes made]" +``` + +**IMPORTANT**: You MUST use the Bash tool to run the git add and git commit commands above. The workflow expects you to commit your changes. + +### 3. Verify (Optional) + +If possible, run verification commands: +- `bun run format:check` for formatting +- `bun test` for tests +- `bun run typecheck` for TypeScript + +Begin by analyzing the failure logs and then fix the issues. \ No newline at end of file diff --git a/slash-commands/fix-ci.md b/slash-commands/fix-ci.md new file mode 100644 index 000000000..f178147a4 --- /dev/null +++ b/slash-commands/fix-ci.md @@ -0,0 +1,66 @@ +--- +description: Analyze and fix CI failures by examining logs and making targeted fixes +--- + +# Fix CI Failures + +You are tasked with analyzing CI failure logs and fixing the issues. Follow these steps: + +## Context Provided + +$ARGUMENTS + +## Step 1: Analyze the Failure + +Parse the provided CI failure information to understand: +- Which jobs failed and why +- The specific error messages and stack traces +- Whether failures are test-related, build-related, or linting issues + +## Step 2: Search and Understand the Codebase + +Use search tools to locate the failing code: +- Search for the failing test names or functions +- Find the source files mentioned in error messages +- Review related configuration files (package.json, tsconfig.json, etc.) + +## Step 3: Apply Targeted Fixes + +Make minimal, focused changes: +- **For test failures**: Determine if the test or implementation needs fixing +- **For type errors**: Fix type definitions or correct the code logic +- **For linting issues**: Apply formatting using the project's tools +- **For build errors**: Resolve dependency or configuration issues +- **For missing imports**: Add the necessary imports or install packages + +Requirements: +- Only fix the actual CI failures, avoid unrelated changes +- Follow existing code patterns and conventions +- Ensure changes are production-ready, not temporary hacks +- Preserve existing functionality while fixing issues + +## Step 4: Commit Changes + +After applying fixes: +1. Stage all modified files with `git add -A` or `git add .` +2. Commit with a descriptive message using `git commit -m "Fix CI failures: "` +3. Include details about which CI jobs/tests were fixed in the commit message +4. Important: Always commit your changes even if you're already on a branch + +## Step 5: Verify Fixes Locally + +Run available verification commands: +- Execute the failing tests locally to confirm they pass +- Run the project's lint command (check package.json for scripts) +- Run type checking if available +- Execute any build commands to ensure compilation succeeds + +## Important Guidelines + +- Focus exclusively on fixing the reported CI failures +- Maintain code quality and follow the project's established patterns +- If a fix requires significant refactoring, document why it's necessary +- When multiple solutions exist, choose the simplest one that maintains code quality +- Add clear comments only if the fix is non-obvious + +Begin by analyzing the failure details provided above. \ No newline at end of file diff --git a/test-failure.ts b/test-failure.ts new file mode 100644 index 000000000..3b13016ca --- /dev/null +++ b/test-failure.ts @@ -0,0 +1,13 @@ +// This file intentionally has TypeScript errors to trigger CI failure +// Updated to trigger new workflow run +const testFunction = (param: string): number => { + // Type error: returning string instead of number + return "this should be a number"; +} + +// Syntax error: missing closing brace +function brokenFunction() { + console.log("missing closing brace" +} + +export { testFunction, brokenFunction }; \ No newline at end of file diff --git a/undefined/claude-prompts/claude-prompt.txt b/undefined/claude-prompts/claude-prompt.txt new file mode 100644 index 000000000..8e2256454 --- /dev/null +++ b/undefined/claude-prompts/claude-prompt.txt @@ -0,0 +1 @@ +Custom prompt content \ No newline at end of file