From 98d6ca3601b46db17ea3c8f55440a7ec5a894890 Mon Sep 17 00:00:00 2001 From: Konstantin Wohlwend Date: Thu, 7 Aug 2025 10:09:32 -0700 Subject: [PATCH 1/3] Even more resilient tests --- .../v1/contact-channels/legacy-send-verification-code.test.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/apps/e2e/tests/backend/endpoints/api/v1/contact-channels/legacy-send-verification-code.test.ts b/apps/e2e/tests/backend/endpoints/api/v1/contact-channels/legacy-send-verification-code.test.ts index ee3fe395e..d8d135a17 100644 --- a/apps/e2e/tests/backend/endpoints/api/v1/contact-channels/legacy-send-verification-code.test.ts +++ b/apps/e2e/tests/backend/endpoints/api/v1/contact-channels/legacy-send-verification-code.test.ts @@ -1,3 +1,4 @@ +import { wait } from "@stackframe/stack-shared/dist/utils/promises"; import { it } from "../../../../../helpers"; import { Auth, backendContext, niceBackendFetch } from "../../../../backend-helpers"; @@ -48,6 +49,7 @@ it("should send a verification code per e-mail", async ({ expect }) => { callback_url: "http://localhost:12345/some-callback-url", }, }); + await wait(1000); expect(await backendContext.value.mailbox.fetchMessages({ noBody: true })).toMatchInlineSnapshot(` [ MailboxMessage { From edeb3c8d411628945ad5a0bece304065033a1ae9 Mon Sep 17 00:00:00 2001 From: Konstantin Wohlwend Date: Thu, 7 Aug 2025 10:59:24 -0700 Subject: [PATCH 2/3] Add React example to dev launchpad --- apps/dev-launchpad/public/index.html | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/apps/dev-launchpad/public/index.html b/apps/dev-launchpad/public/index.html index 37e69a11e..62a58fb17 100644 --- a/apps/dev-launchpad/public/index.html +++ b/apps/dev-launchpad/public/index.html @@ -281,6 +281,13 @@ "JavaScript example", ], }, + { + name: "React example", + port: 8120, + description: [ + "React example", + ], + }, ]; const appsContainers = document.querySelectorAll(".apps-container"); From acd03b7af51578f87555e624e80a52aeddc6e045 Mon Sep 17 00:00:00 2001 From: Konsti Wohlwend Date: Thu, 7 Aug 2025 18:44:49 -0700 Subject: [PATCH 3/3] Add Claude Code GitHub Workflow (#833) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## 🤖 Installing Claude Code GitHub App This PR adds a GitHub Actions workflow that enables Claude Code integration in our repository. ### What is Claude Code? [Claude Code](https://claude.ai/code) is an AI coding agent that can help with: - Bug fixes and improvements - Documentation updates - Implementing new features - Code reviews and suggestions - Writing tests - And more! ### How it works Once this PR is merged, we'll be able to interact with Claude by mentioning @claude in a pull request or issue comment. Once the workflow is triggered, Claude will analyze the comment and surrounding context, and execute on the request in a GitHub action. ### Important Notes - **This workflow won't take effect until this PR is merged** - **@claude mentions won't work until after the merge is complete** - The workflow runs automatically whenever Claude is mentioned in PR or issue comments - Claude gets access to the entire PR or issue context including files, diffs, and previous comments ### Security - Our Anthropic API key is securely stored as a GitHub Actions secret - Only users with write access to the repository can trigger the workflow - All Claude runs are stored in the GitHub Actions run history - Claude's default tools are limited to reading/writing files and interacting with our repo by creating comments, branches, and commits. - We can add more allowed tools by adding them to the workflow file like: ``` allowed_tools: Bash(npm install),Bash(npm run build),Bash(npm run lint),Bash(npm run test) ``` There's more information in the [Claude Code action repo](https://github.com/anthropics/claude-code-action). After merging this PR, let's try mentioning @claude in a comment on any PR to get started! --- .github/workflows/all-good.yaml | 12 ++-- .github/workflows/claude-code-review.yml | 78 ++++++++++++++++++++++++ .github/workflows/claude.yml | 64 +++++++++++++++++++ 3 files changed, 148 insertions(+), 6 deletions(-) create mode 100644 .github/workflows/claude-code-review.yml create mode 100644 .github/workflows/claude.yml diff --git a/.github/workflows/all-good.yaml b/.github/workflows/all-good.yaml index 4cca09871..1126137c7 100644 --- a/.github/workflows/all-good.yaml +++ b/.github/workflows/all-good.yaml @@ -42,12 +42,12 @@ jobs: function count_pending_checks() { local response=$1 - echo "$response" | jq '([.check_runs[]? | select(.status != "completed" and .name != "all-good")] | length) // 0' + echo "$response" | jq '([.check_runs[]? | select(.status != "completed" and .name != "all-good" and .name != "claude-review")] | length) // 0' } function count_failed_checks() { local response=$1 - echo "$response" | jq '([.check_runs[]? | select(.conclusion != "success" and .conclusion != "skipped" and .conclusion != "neutral" and .name != "all-good")] | length) // 0' + echo "$response" | jq '([.check_runs[]? | select(.conclusion != "success" and .conclusion != "skipped" and .conclusion != "neutral" and .name != "all-good" and .name != "claude-review")] | length) // 0' } while true; do @@ -99,11 +99,11 @@ jobs: exit 0 else echo "The following check run(s) failed:" - # Failed checks on the current commit - echo "$commit_response" | jq -r '.check_runs[] | select(.conclusion != "success") | .name' | sed 's/^/ - /' - # Failed checks on the PR head commit (if different) + # Failed checks on the current commit (excluding claude-review) + echo "$commit_response" | jq -r '.check_runs[] | select(.conclusion != "success" and .conclusion != "skipped" and .conclusion != "neutral" and .name != "claude-review") | .name' | sed 's/^/ - /' + # Failed checks on the PR head commit (if different, excluding claude-review) if [ -n "$PR_HEAD_SHA" ] && [ "$PR_HEAD_SHA" != "$COMMIT" ]; then - echo "$pr_response" | jq -r '.check_runs[] | select(.conclusion != "success") | .name' | sed 's/^/ - /' + echo "$pr_response" | jq -r '.check_runs[] | select(.conclusion != "success" and .conclusion != "skipped" and .conclusion != "neutral" and .name != "claude-review") | .name' | sed 's/^/ - /' fi echo "$commit_response" echo "$pr_response" diff --git a/.github/workflows/claude-code-review.yml b/.github/workflows/claude-code-review.yml new file mode 100644 index 000000000..82e06e2e2 --- /dev/null +++ b/.github/workflows/claude-code-review.yml @@ -0,0 +1,78 @@ +name: Claude Code Review + +on: + pull_request: + types: [opened, synchronize] + # Optional: Only run on specific file changes + # paths: + # - "src/**/*.ts" + # - "src/**/*.tsx" + # - "src/**/*.js" + # - "src/**/*.jsx" + +jobs: + claude-review: + # Optional: Filter by PR author + # if: | + # github.event.pull_request.user.login == 'external-contributor' || + # github.event.pull_request.user.login == 'new-developer' || + # github.event.pull_request.author_association == 'FIRST_TIME_CONTRIBUTOR' + + runs-on: ubuntu-latest + permissions: + contents: read + pull-requests: read + issues: read + id-token: write + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + fetch-depth: 1 + + - name: Run Claude Code Review + id: claude-review + uses: anthropics/claude-code-action@beta + with: + anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }} + + # Optional: Specify model (defaults to Claude Sonnet 4, uncomment for Claude Opus 4) + # model: "claude-opus-4-20250514" + + # Direct prompt for automated review (no @claude mention needed) + direct_prompt: | + Please review this pull request and provide feedback on: + - Code quality and best practices + - Potential bugs or issues + - Performance considerations + - Security concerns + - Test coverage + + Be constructive and helpful in your feedback. + + # Optional: Use sticky comments to make Claude reuse the same comment on subsequent pushes to the same PR + # use_sticky_comment: true + + # Optional: Customize review based on file types + # direct_prompt: | + # Review this PR focusing on: + # - For TypeScript files: Type safety and proper interface usage + # - For API endpoints: Security, input validation, and error handling + # - For React components: Performance, accessibility, and best practices + # - For tests: Coverage, edge cases, and test quality + + # Optional: Different prompts for different authors + # direct_prompt: | + # ${{ github.event.pull_request.author_association == 'FIRST_TIME_CONTRIBUTOR' && + # 'Welcome! Please review this PR from a first-time contributor. Be encouraging and provide detailed explanations for any suggestions.' || + # 'Please provide a thorough code review focusing on our coding standards and best practices.' }} + + # Optional: Add specific tools for running tests or linting + # allowed_tools: "Bash(npm run test),Bash(npm run lint),Bash(npm run typecheck)" + + # Optional: Skip review for certain conditions + # if: | + # !contains(github.event.pull_request.title, '[skip-review]') && + # !contains(github.event.pull_request.title, '[WIP]') + diff --git a/.github/workflows/claude.yml b/.github/workflows/claude.yml new file mode 100644 index 000000000..e75d6765f --- /dev/null +++ b/.github/workflows/claude.yml @@ -0,0 +1,64 @@ +name: Claude Code + +on: + issue_comment: + types: [created] + pull_request_review_comment: + types: [created] + issues: + types: [opened, assigned] + pull_request_review: + types: [submitted] + +jobs: + claude: + if: | + (github.event_name == 'issue_comment' && contains(github.event.comment.body, '@claude')) || + (github.event_name == 'pull_request_review_comment' && contains(github.event.comment.body, '@claude')) || + (github.event_name == 'pull_request_review' && contains(github.event.review.body, '@claude')) || + (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 + id-token: write + actions: read # Required for Claude to read CI results on PRs + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + fetch-depth: 1 + + - name: Run Claude Code + id: claude + uses: anthropics/claude-code-action@beta + with: + anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }} + + # This is an optional setting that allows Claude to read CI results on PRs + additional_permissions: | + actions: read + + # Optional: Specify model (defaults to Claude Sonnet 4, uncomment for Claude Opus 4) + # model: "claude-opus-4-20250514" + + # Optional: Customize the trigger phrase (default: @claude) + # trigger_phrase: "/claude" + + # Optional: Trigger when specific user is assigned to an issue + # assignee_trigger: "claude-bot" + + # Optional: Allow Claude to run specific commands + # allowed_tools: "Bash(npm install),Bash(npm run build),Bash(npm run test:*),Bash(npm run lint:*)" + + # Optional: Add custom instructions for Claude to customize its behavior for your project + # custom_instructions: | + # Follow our coding standards + # Ensure all new code has tests + # Use TypeScript for new files + + # Optional: Custom environment variables for Claude + # claude_env: | + # NODE_ENV: test +