|
1 | | -# CLAUDE.md |
| 1 | +# AGENTS.md |
2 | 2 |
|
3 | | -This file provides guidance for using Claude AI with this YDB Embedded UI codebase and documents the Claude code review workflow configuration. |
4 | | - |
5 | | -## Claude Code Review Workflows |
6 | | - |
7 | | -This repository includes two GitHub Actions workflows for Claude AI integration: |
8 | | - |
9 | | -### 1. Claude Code Review (`claude-code-review.yml`) |
10 | | - |
11 | | -- **Trigger**: Comment `/claude_review` on any PR |
12 | | -- **Purpose**: Automated code review focusing on coding standards and best practices |
13 | | -- **Model**: `claude-opus-4-20250514` |
14 | | - |
15 | | -### 2. Claude Code (`claude.yml`) |
16 | | - |
17 | | -- **Trigger**: Comment `@claude` on any PR or assign `claude-bot` to an issue |
18 | | -- **Purpose**: Interactive Claude assistance for development tasks |
19 | | -- **Model**: `claude-opus-4-20250514` |
20 | | - |
21 | | -### Workflow Architecture |
22 | | - |
23 | | -Both workflows use a robust reference resolution system to ensure Claude reviews the latest changes: |
24 | | - |
25 | | -1. **PR Reference Resolution**: When triggered by issue comments on PRs, workflows: |
26 | | - |
27 | | - - Fetch the current PR details via GitHub API |
28 | | - - Extract the head commit SHA (latest changes) |
29 | | - - Checkout the actual PR head instead of the base branch |
30 | | - |
31 | | -2. **Fallback Logic**: For manual workflow dispatches, falls back to the default branch |
32 | | - |
33 | | -3. **Full Git History**: Uses `fetch-depth: 0` to provide complete context for reviews |
34 | | - |
35 | | -### Recent Fix (Issue #2651) |
36 | | - |
37 | | -**Problem**: Claude was reviewing stale data because workflows checked out the base branch instead of PR head. |
38 | | - |
39 | | -**Solution**: Added dynamic reference resolution: |
40 | | - |
41 | | -```yaml |
42 | | -ref: ${{ github.event_name == 'issue_comment' && steps.pr-details.outputs.pr_head_sha || github.ref }} |
43 | | -``` |
44 | | -
|
45 | | -This ensures Claude always reviews the current state of the PR, including any recent commits. |
46 | | -
|
47 | | -### Testing the Workflow Fix |
48 | | -
|
49 | | -To verify the Claude workflows are correctly checking out PR head commits: |
50 | | -
|
51 | | -1. **Automatic Validation**: Both workflows include a validation step that: |
52 | | -
|
53 | | - - Logs the event type and commit SHA being checked out |
54 | | - - Verifies the checked out commit matches the expected PR head |
55 | | - - Fails with a clear error if the wrong commit is checked out |
56 | | -
|
57 | | -2. **Manual Testing**: |
58 | | -
|
59 | | - - Create a test PR with some changes |
60 | | - - Add a comment with `/claude_review` or `@claude` |
61 | | - - Check the workflow logs for "Validate checkout (verification step)" |
62 | | - - Look for `✅ SUCCESS: Checked out correct PR head commit` |
63 | | - |
64 | | -3. **Test Script**: Run `.github/workflows/scripts/test-claude-workflow-fix.sh` to validate the logic locally |
65 | | - |
66 | | -4. **Expected Log Output**: |
67 | | - ``` |
68 | | - === Workflow Checkout Validation === |
69 | | - Event type: issue_comment |
70 | | - PR number: 123 |
71 | | - Expected PR head SHA: abc123def456... |
72 | | - Checked out commit: abc123def456... |
73 | | - ✅ SUCCESS: Checked out correct PR head commit |
74 | | - ``` |
75 | | - |
76 | | ---- |
77 | | - |
78 | | -# Project Development Guide |
| 3 | +This file provides guidance to AI coding assistants when working with this codebase. Designed for OpenAI Codex, GitHub Copilot, Claude, Cursor, and other AI development tools. |
79 | 4 |
|
80 | 5 | ## Project Overview |
81 | 6 |
|
|
0 commit comments