- 说明
- Code Standards
- Repository Structure
- Key Guidelines
- Playwright test requirements
- Dev environment tips
- Testing instructions
- PR instructions
- mcp
说明
- /.github/copilot-instructions.md 包含项目相关信息,如如何生成和测试项目,编码标准用于编码、对话、代码评审 ```md This is a Go based repository with a Ruby client for certain API endpoints. It is primarily responsible for ingesting metered usage for GitHub and recording that usage. Please follow these guidelines when contributing:
Code Standards
Required Before Each Commit
- Run
make fmtbefore committing any changes to ensure proper code formatting - This will run gofmt on all Go files to maintain consistent style
Development Flow
- Build:
make build - Test:
make test - Full CI check:
make ci(includes build, fmt, lint, test)
Repository Structure
cmd/: Main service entry points and executablesinternal/: Logic related to interactions with other GitHub serviceslib/: Core Go packages for billing logicadmin/: Admin interface componentsconfig/: Configuration files and templatesdocs/: Documentationproto/: Protocol buffer definitions. Runmake protoafter making updates here.ruby/: Ruby implementation components. Updates to this folder should include incrementing this version file using semantic versioning:ruby/lib/billing-platform/version.rbtesting/: Test helpers and fixtures
Key Guidelines
- Follow Go best practices and idiomatic patterns
- Maintain existing code structure and organization
- Use dependency injection patterns where appropriate
- Write unit tests for new functionality. Use table-driven unit tests when possible.
- Document public APIs and complex logic. Suggest changes to the
docs/folder when appropriate ```- /.github/instructions/*/.instructions.md 适用于处理的特定类型的文件,包含如如何生成和测试文件编码标准 ```md .github/instructions/playwright-tests.instructions.md — applyTo: “*/tests/.spec.ts” —
Playwright test requirements
When writing Playwright tests, please follow these guidelines to ensure consistency and maintainability:
- Use stable locators - Prefer
getByRole(),getByText(), andgetByTestId()over CSS selectors or XPath - Write isolated tests - Each test should be independent and not rely on other tests’ state
- Follow naming conventions - Use descriptive test names and
*.spec.tsfile naming - Implement proper assertions - Use Playwright’s
expect()with specific matchers liketoHaveText(),toBeVisible() - Leverage auto-wait - Avoid manual
setTimeout()and rely on Playwright’s built-in waiting mechanisms - Configure cross-browser testing - Test across Chromium, Firefox, and WebKit browsers
- Use Page Object Model - Organize selectors and actions into reusable page classes for maintainability
- Handle dynamic content - Properly wait for elements to load and handle loading states
- Set up proper test data - Use beforeEach/afterEach hooks for test setup and cleanup
- Configure CI/CD integration - Set up headless mode, screenshots on failure, and parallel execution
```
- **/AGENTS.md 智能体文件 寻找最接近当前任务文件的 智能体文件
```md
Dev environment tips
- Use
pnpm dlx turbo run where <project_name>to jump to a package instead of scanning withls. - Run
pnpm install --filter <project_name>to add the package to your workspace so Vite, ESLint, and TypeScript can see it. - Use
pnpm create vite@latest <project_name> -- --template react-tsto spin up a new React + Vite package with TypeScript checks ready. - Check the name field inside each package’s package.json to confirm the right name—skip the top-level one.
- **/AGENTS.md 智能体文件 寻找最接近当前任务文件的 智能体文件
```md
Testing instructions
- Find the CI plan in the .github/workflows folder.
- Run
pnpm turbo run test --filter <project_name>to run every check defined for that package. - From the package root you can just call
pnpm test. The commit should pass all tests before you merge. - To focus on one step, add the Vitest pattern:
pnpm vitest run -t "<test name>". - Fix any test or type errors until the whole suite is green.
- After moving files or changing imports, run
pnpm lint --filter <project_name>to be sure ESLint and TypeScript rules still pass. - Add or update tests for the code you change, even if nobody asked.
PR instructions
- Title format: [
] - Always run
pnpm lintandpnpm testbefore committing. ``` - /CLAUDE.md /GEMINI.md 两个是二选一的, 智能体文件
mcp
- .vscode/mcp.json { “servers”: { “github-mcp”: { “type”: “http”, “url”: “https://api.githubcopilot.com/mcp” }, “playwright”: { “type”: “stdio”, “command”: “npx”, “args”: [ “@playwright/mcp@latest” ] } } }