From 7e00a58579d4f71f69a86981617949eb0604fd22 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 29 Aug 2025 14:24:56 +0000 Subject: [PATCH 1/5] Initial plan From f2709c098243122342306f7489309c2fda0789b0 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 29 Aug 2025 14:40:35 +0000 Subject: [PATCH 2/5] Create comprehensive GitHub Copilot instructions file Added .github/copilot-instructions.md with complete development guidelines including: - Project setup and requirements (Node.js 20+, PNPM) - Development workflow and validation scenarios - Comprehensive PR review patterns and best practices - React Bootstrap component usage standards - GitHub API integration with mobx-github - Internationalization requirements - Code quality and architecture guidelines - Troubleshooting guide and common issues Incorporates all key patterns from PR review analysis and follows the reference structure from ActivityHub-PWA project. --- .github/copilot-instructions.md | 335 ++++++++++++++++++++++++++++++++ .husky/pre-commit | 2 +- 2 files changed, 336 insertions(+), 1 deletion(-) create mode 100644 .github/copilot-instructions.md diff --git a/.github/copilot-instructions.md b/.github/copilot-instructions.md new file mode 100644 index 0000000..5aeac8f --- /dev/null +++ b/.github/copilot-instructions.md @@ -0,0 +1,335 @@ +# Open Source Bazaar - GitHub Copilot Instructions + +Open Source Bazaar 是一个基于 Next.js 15、TypeScript、React Bootstrap 和 MobX 构建的开源项目展示平台。它包含许可证过滤器、Wiki 知识库、志愿者展示、Lark 集成等功能。 + +Always reference these instructions first and fallback to search or bash commands only when you encounter unexpected information that does not match the info here. + +## Critical Requirements + +⚠️ **MANDATORY NODE.JS VERSION**: This project requires **Node.js >=20**. The build works on Node.js 20+ but may have warnings. + +- Check Node.js version: `node --version` +- Development and linting commands work on Node.js 20+ +- Use **PNPM** as package manager, not npm or yarn + +## Working Effectively + +### Initial Setup (REQUIRED for all development) + +1. **Install global pnpm**: `npm install -g pnpm` +2. **Install dependencies**: `pnpm install` -- takes 1-3 minutes. NEVER CANCEL. Set timeout to 5+ minutes. +3. **Verify setup**: `pnpm --version` (should be 10.x+) + +**Important**: If you see "node_modules missing" error, you MUST run `pnpm install` first before any other commands. + +### Development Workflow (FULLY VALIDATED) + +- **Start development server**: `pnpm dev` -- starts in 5-15 seconds on http://localhost:3000 +- **Run linting**: `pnpm lint` -- takes 15 seconds. NEVER CANCEL. Set timeout to 2+ minutes. +- **Run tests**: `pnpm test` -- runs lint-staged + lint, takes 15 seconds. Set timeout to 2+ minutes. + +### Build Process + +- **Production build**: `pnpm build` -- works on Node.js 20+ (estimated 30s-2 minutes) + - NEVER CANCEL. Set timeout to 5+ minutes. +- **Static export**: Available but not commonly used in development + +## Validation Scenarios + +After making ANY changes, ALWAYS validate by running through these scenarios: + +### Manual Testing Requirements + +1. **Start development server**: `pnpm dev` and verify it starts without errors +2. **Navigate to homepage**: Visit http://localhost:3000 and verify page loads with navigation menu +3. **Test core pages**: + - License filter: http://localhost:3000/license-filter (interactive license selection tool) + - Wiki pages: http://localhost:3000/wiki (policy documents from GitHub) + - Volunteer page: http://localhost:3000/volunteer (contributor showcase) + - Projects: http://localhost:3000/project (GitHub repository listings) +4. **Test API endpoints**: Verify GitHub API integrations work +5. **Check responsive design**: Test mobile/desktop layouts with React Bootstrap components +6. **Verify i18n functionality**: Check Chinese/English language switching works + +### Pre-commit Validation + +ALWAYS run before committing changes: + +```bash +pnpm lint # Fix linting issues automatically +pnpm test # Runs linting + staged file checks +``` + +## Key Project Structure + +### Important Directories + +- `pages/` - Next.js pages and API routes +- `components/` - Reusable React components with Bootstrap styling +- `models/` - MobX stores and data models +- `translation/` - i18n language files (zh-CN, en-US, zh-TW) +- `styles/` - CSS and styling files +- `public/` - Static assets + +### Configuration Files + +- `package.json` - Dependencies and scripts +- `next.config.ts` - Next.js configuration with MDX support +- `tsconfig.json` - TypeScript configuration +- `eslint.config.ts` - ESLint configuration +- `babel.config.js` - Babel configuration + +### Key Dependencies + +- **Next.js 15** - React framework +- **React Bootstrap 2.10** - UI component library +- **MobX 6.13** - State management +- **mobx-github 0.4** - GitHub API integration +- **mobx-i18n 0.7** - Internationalization +- **license-filter 0.2** - License filtering functionality +- **marked 16.2** - Markdown processing + +## Development Standards and Best Practices + +Based on comprehensive PR review analysis, follow these critical development standards: + +### Architecture and Code Organization + +#### Component and Import Standards + +- **ALWAYS use React Bootstrap components** instead of custom HTML elements +- Use ` + +{label} + +// ❌ Wrong - custom HTML elements +Edit +{label} +``` + +#### Semantic HTML Structure + +- Use ordered lists (`
    `) for countable items, unordered lists (`