github copilot

使用说明

Posted by nomadli on October 16, 2025

说明

  • /.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 fmt before 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 executables
  • internal/: Logic related to interactions with other GitHub services
  • lib/: Core Go packages for billing logic
  • admin/: Admin interface components
  • config/: Configuration files and templates
  • docs/: Documentation
  • proto/: Protocol buffer definitions. Run make proto after 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.rb
  • testing/: Test helpers and fixtures

Key Guidelines

  1. Follow Go best practices and idiomatic patterns
  2. Maintain existing code structure and organization
  3. Use dependency injection patterns where appropriate
  4. Write unit tests for new functionality. Use table-driven unit tests when possible.
  5. 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:

  1. Use stable locators - Prefer getByRole(), getByText(), and getByTestId() over CSS selectors or XPath
  2. Write isolated tests - Each test should be independent and not rely on other tests’ state
  3. Follow naming conventions - Use descriptive test names and *.spec.ts file naming
  4. Implement proper assertions - Use Playwright’s expect() with specific matchers like toHaveText(), toBeVisible()
  5. Leverage auto-wait - Avoid manual setTimeout() and rely on Playwright’s built-in waiting mechanisms
  6. Configure cross-browser testing - Test across Chromium, Firefox, and WebKit browsers
  7. Use Page Object Model - Organize selectors and actions into reusable page classes for maintainability
  8. Handle dynamic content - Properly wait for elements to load and handle loading states
  9. Set up proper test data - Use beforeEach/afterEach hooks for test setup and cleanup
  10. 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 with ls.
    • 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-ts to 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.

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 lint and pnpm test before 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” ] } } }