Skip to content

Commit 2db6a5d

Browse files
authored
Merge branch 'main' into copilot/fix-2614
2 parents ad30a3e + 1c65975 commit 2db6a5d

File tree

96 files changed

+2890
-518
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

96 files changed

+2890
-518
lines changed

.github/copilot-instructions.md

Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
# GitHub Copilot Instructions for YDB Embedded UI
2+
3+
> **Note**: This file contains project-specific instructions for GitHub Copilot code review and assistance.
4+
> These instructions are derived from AGENTS.md but formatted specifically for Copilot's consumption.
5+
> When updating project conventions, update both AGENTS.md (for human developers) and this file (for Copilot).
6+
7+
## Project Overview
8+
9+
This is a React-based monitoring and management interface for YDB clusters. The codebase follows specific patterns and conventions that must be maintained.
10+
11+
## Tech Stack Requirements
12+
13+
- Use React 18.3 with TypeScript 5.x
14+
- Use Redux Toolkit 2.x with RTK Query for state management
15+
- Use Gravity UI (@gravity-ui/uikit) 7.x for UI components
16+
- Use React Router v5 (NOT v6) for routing
17+
- Use Monaco Editor 0.52 for code editing features
18+
19+
## Critical Coding Rules
20+
21+
### API Architecture
22+
23+
- NEVER call APIs directly - always use `window.api.module.method()` pattern
24+
- Use RTK Query's `injectEndpoints` pattern for API endpoints
25+
- Wrap `window.api` calls in RTK Query for proper state management
26+
27+
### Component Patterns
28+
29+
- Use BEM naming with `cn()` utility: `const b = cn('component-name')`
30+
- Use `PaginatedTable` component for all data tables
31+
- Tables require: columns, fetchData function, and unique tableName
32+
- Use virtual scrolling for large datasets
33+
34+
### Internationalization (MANDATORY)
35+
36+
- NEVER hardcode user-facing strings
37+
- ALWAYS create i18n entries in component's `i18n/` folder
38+
- Follow key format: `<context>_<content>` (e.g., `action_save`, `field_name`)
39+
- Register keysets with `registerKeysets()` using unique component name
40+
41+
### State Management
42+
43+
- Use Redux Toolkit with domain-based organization
44+
- NEVER mutate state in RTK Query - return new objects/arrays
45+
- Clear errors on user input in forms
46+
- Always handle loading states in UI
47+
48+
### UI Components
49+
50+
- Prefer Gravity UI components over custom implementations
51+
- Use `createToast` for notifications
52+
- Use `ResponseError` component for API errors
53+
- Use `Loader` and `TableSkeleton` for loading states
54+
55+
### Form Handling
56+
57+
- Always use controlled components with validation
58+
- Clear errors on user input
59+
- Validate before submission
60+
- Use Gravity UI form components with error states
61+
62+
### Dialog/Modal Patterns
63+
64+
- Use `@ebay/nice-modal-react` for complex modals
65+
- Use Gravity UI `Dialog` for simple dialogs
66+
- Always include loading states
67+
68+
### Type Conventions
69+
70+
- API types prefixed with 'T' (e.g., `TTenantInfo`, `TClusterInfo`)
71+
- Types located in `src/types/api/` directory
72+
73+
### Performance Requirements
74+
75+
- Use React.memo for expensive renders
76+
- Lazy load Monaco Editor
77+
- Batch API requests when possible
78+
- Use virtual scrolling for tables
79+
80+
### Testing Patterns
81+
82+
- Unit tests colocated in `__test__` directories
83+
- E2E tests use Playwright with page objects pattern
84+
- Use CSS class selectors for E2E element selection
85+
86+
### Navigation (React Router v5)
87+
88+
- Use React Router v5 hooks (`useHistory`, `useParams`)
89+
- Always validate route params exist before use
90+
91+
## Common Utilities
92+
93+
- Formatters: `formatBytes()`, `formatDateTime()` from `src/utils/dataFormatters/`
94+
- Time parsing: utilities in `src/utils/timeParsers/`
95+
- Query utilities: `src/utils/query.ts` for SQL/YQL helpers
96+
97+
## Before Making Changes
98+
99+
- Run `npm run lint` and `npm run typecheck` before committing
100+
- Follow conventional commit message format
101+
- Ensure all user-facing text is internationalized
102+
- Test with a local YDB instance when possible
103+
104+
## Debugging Helpers
105+
106+
- `window.api` - Access API methods in browser console
107+
- `window.ydbEditor` - Monaco editor instance
108+
- Enable request tracing with `DEV_ENABLE_TRACING_FOR_ALL_REQUESTS`
Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
name: Claude Code Review
2+
3+
on:
4+
pull_request:
5+
types: [opened, synchronize]
6+
# Optional: Only run on specific file changes
7+
paths:
8+
- 'src/**/*.ts'
9+
- 'src/**/*.tsx'
10+
- 'src/**/*.js'
11+
- 'src/**/*.jsx'
12+
- 'package.json'
13+
- 'package-lock.json'
14+
15+
jobs:
16+
claude-review:
17+
# Optional: Skip review for specific conditions
18+
if: |
19+
!contains(github.event.pull_request.title, '[skip-review]') &&
20+
!contains(github.event.pull_request.title, '[WIP]')
21+
22+
runs-on: ubuntu-latest
23+
permissions:
24+
contents: read
25+
pull-requests: read
26+
issues: read
27+
id-token: write
28+
29+
steps:
30+
- name: Checkout repository
31+
uses: actions/checkout@v4
32+
with:
33+
fetch-depth: 1
34+
35+
- name: Run Claude Code Review
36+
id: claude-review
37+
uses: anthropics/claude-code-action@beta
38+
with:
39+
claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
40+
41+
# Specify model for consistency with main workflow
42+
model: 'claude-opus-4-20250514'
43+
44+
# Direct prompt for automated review (no @claude mention needed)
45+
direct_prompt: |
46+
Review this YDB Embedded UI pull request focusing on:
47+
48+
1. **Code Standards**:
49+
- TypeScript type safety and proper interface usage (prefixed with 'T')
50+
- React best practices and Gravity UI component usage
51+
- Redux Toolkit patterns with RTK Query
52+
- BEM naming convention with cn() utility
53+
54+
2. **Critical Requirements**:
55+
- All user-facing text must use i18n (no hardcoded strings)
56+
- API calls must go through window.api, never direct calls
57+
- No state mutations in RTK Query
58+
- Route params validation (React Router v5)
59+
60+
3. **Performance & Security**:
61+
- Virtual scrolling for large tables (PaginatedTable)
62+
- React.memo for expensive renders
63+
- No exposed secrets or keys
64+
- Proper error handling and loading states
65+
66+
4. **Testing**:
67+
- Unit tests in __test__ directories
68+
- E2E tests follow page object pattern
69+
70+
Be constructive and reference specific files with file_path:line_number format.
71+
72+
# Use sticky comments to make Claude reuse the same comment on subsequent pushes to the same PR
73+
use_sticky_comment: true
74+
75+
# Optional: Customize review based on file types
76+
# direct_prompt: |
77+
# Review this PR focusing on:
78+
# - For TypeScript files: Type safety and proper interface usage
79+
# - For API endpoints: Security, input validation, and error handling
80+
# - For React components: Performance, accessibility, and best practices
81+
# - For tests: Coverage, edge cases, and test quality
82+
83+
# Optional: Different prompts for different authors
84+
# direct_prompt: |
85+
# ${{ github.event.pull_request.author_association == 'FIRST_TIME_CONTRIBUTOR' &&
86+
# 'Welcome! Please review this PR from a first-time contributor. Be encouraging and provide detailed explanations for any suggestions.' ||
87+
# 'Please provide a thorough code review focusing on our coding standards and best practices.' }}
88+
89+
# Add specific tools for running tests or linting
90+
allowed_tools: |
91+
Bash(npm run lint)
92+
Bash(npm run typecheck)
93+
Bash(npm test -- --no-watch)
94+
Bash(npm run unused)
95+
Bash(git diff)
96+
Bash(git log)
97+
98+
# Optional: Skip review for certain conditions
99+
# if: |
100+
# !contains(github.event.pull_request.title, '[skip-review]') &&
101+
# !contains(github.event.pull_request.title, '[WIP]')

.github/workflows/claude.yml

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
name: Claude Code
2+
3+
on:
4+
issue_comment:
5+
types: [created]
6+
pull_request_review_comment:
7+
types: [created]
8+
issues:
9+
types: [opened, assigned]
10+
pull_request_review:
11+
types: [submitted]
12+
13+
jobs:
14+
claude:
15+
if: |
16+
(github.event_name == 'issue_comment' && contains(github.event.comment.body, '@claude')) ||
17+
(github.event_name == 'pull_request_review_comment' && contains(github.event.comment.body, '@claude')) ||
18+
(github.event_name == 'pull_request_review' && contains(github.event.review.body, '@claude')) ||
19+
(github.event_name == 'issues' && (contains(github.event.issue.body, '@claude') || contains(github.event.issue.title, '@claude')))
20+
runs-on: ubuntu-latest
21+
permissions:
22+
contents: read
23+
pull-requests: read
24+
issues: read
25+
id-token: write
26+
actions: read # Required for Claude to read CI results on PRs
27+
steps:
28+
- name: Checkout repository
29+
uses: actions/checkout@v4
30+
with:
31+
fetch-depth: 1
32+
33+
- name: Run Claude Code
34+
id: claude
35+
uses: anthropics/claude-code-action@beta
36+
with:
37+
claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
38+
39+
# This is an optional setting that allows Claude to read CI results on PRs
40+
additional_permissions: |
41+
actions: read
42+
43+
# Optional: Specify model (defaults to Claude Sonnet 4, uncomment for Claude Opus 4)
44+
model: 'claude-opus-4-20250514'
45+
46+
# Optional: Customize the trigger phrase (default: @claude)
47+
# trigger_phrase: "/claude"
48+
49+
# Optional: Trigger when specific user is assigned to an issue
50+
assignee_trigger: 'claude-bot'
51+
52+
# Optional: Allow Claude to run specific commands
53+
allowed_tools: |
54+
Bash(npm ci)
55+
Bash(npm run dev)
56+
Bash(npm run build:*)
57+
Bash(npm run lint)
58+
Bash(npm run typecheck)
59+
Bash(npm run unused)
60+
Bash(npm test)
61+
Bash(npm run test:*)
62+
Bash(docker run*)
63+
Bash(git log*)
64+
Bash(git diff*)
65+
Bash(git status)
66+
67+
# Optional: Add custom instructions for Claude to customize its behavior for your project
68+
custom_instructions: |
69+
Follow the CLAUDE.md guidelines in the repository
70+
Use Gravity UI components for any UI changes
71+
Always use i18n for user-facing strings following i18n-naming-ruleset.md
72+
Run npm run lint and npm run typecheck before committing
73+
Use RTK Query for API calls, never call APIs directly
74+
Follow BEM naming convention with cn() utility
75+
Use PaginatedTable for large datasets
76+
TypeScript types should be prefixed with 'T' (e.g., TTenantInfo)
77+
78+
# Optional: Custom environment variables for Claude
79+
claude_env: |
80+
NODE_VERSION: 18
81+
REACT_APP_BACKEND: http://localhost:8765

0 commit comments

Comments
 (0)