-
Notifications
You must be signed in to change notification settings - Fork 0
feat: setup Biome, TypeScript validation, AGENTS.md guidelines, and GitHub CI #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| name: CI | ||
|
|
||
| on: | ||
| push: | ||
| branches: [ main, master ] | ||
| pull_request: | ||
| branches: [ main, master ] | ||
|
|
||
| jobs: | ||
| validate: | ||
| runs-on: ubuntu-latest | ||
|
|
||
| steps: | ||
| - name: Checkout Repository | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Setup Bun | ||
| uses: oven-sh/setup-bun@v2 | ||
| with: | ||
| bun-version: latest | ||
|
|
||
| - name: Install Dependencies | ||
| run: bun install --frozen-lockfile | ||
|
|
||
| - name: Run Validation Suite | ||
| run: bun run validate |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,49 @@ | ||
| # Logs | ||
| logs | ||
| *.log | ||
| npm-debug.log* | ||
| yarn-debug.log* | ||
| yarn-error.log* | ||
| pnpm-debug.log* | ||
| lerna-debug.log* | ||
|
|
||
| # Dependency directories | ||
| node_modules/ | ||
| jspm_packages/ | ||
|
|
||
| # OS Files | ||
| .DS_Store | ||
| .DS_Store? | ||
| ._* | ||
| .Spotlight-V100 | ||
| .Trashes | ||
| ehthumbs.db | ||
| Thumbs.db | ||
|
|
||
| # Build outputs | ||
| dist/ | ||
| dist-ssr/ | ||
| *.local | ||
| out/ | ||
| build/ | ||
|
|
||
| # IDEs and editors | ||
| .idea/ | ||
| .vscode/ | ||
| *.suo | ||
| *.ntvs* | ||
| *.njsproj | ||
| *.sln | ||
| *.sw? | ||
|
|
||
| # Environment local files | ||
| .env | ||
| .env.local | ||
| .env.development.local | ||
| .env.test.local | ||
| .env.production.local | ||
|
|
||
| # TypeScript / Bun / Cache | ||
| .tsc/ | ||
| .tsbuildinfo | ||
| .bun/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,60 @@ | ||
| # Project Guidelines & Rules (`AGENTS.md`) | ||
|
|
||
| This document defines the architecture, design patterns, coding standards, and submission guidelines for all developers and AI agents working on the **shumai-web** repository. | ||
|
|
||
| --- | ||
|
|
||
| ## 🎨 Design & Coding Rules | ||
|
|
||
| ### 1. Technology Stack & Directory Structure | ||
| * **Runtime & Package Manager**: Bun is the standard runtime and package manager. Use `bun` commands instead of `npm`. | ||
| * **Framework**: React 19 (Functional Components, Hooks). | ||
| * **Styling**: Tailwind CSS. Keep styles clean, modern, and aligned with modern web standards (e.g., tailored color palettes, subtle shadows, transition effects, responsive design). | ||
| * **Directory Layout**: | ||
| * `src/components/`: Reusable, modular UI components. | ||
| * `src/App.tsx`: Main page layout and primary React component. | ||
| * `src/main.tsx`: React DOM mounting. | ||
| * `src/types.ts`: Shared TypeScript types. | ||
| * `assets/`: Static image/media files. | ||
|
|
||
| ### 2. TypeScript & Code Standards | ||
| * **Strict Typing**: Avoid using `any`. Explicitly type function parameters, return values, and component props. | ||
| * **Imports**: Use ES Modules. Keep imports clean and organized. Imports are automatically structured and cleaned via Biome (`biome check`). | ||
| * **Linter & Formatter**: Biome is used for code quality, styling, and formatting. Do not use ESLint or Prettier. | ||
| * **Component Patterns**: | ||
| * Prefer functional components with Arrow Functions: `const MyComponent: React.FC<Props> = (...) => { ... }` or standard functions: `export function MyComponent(props: Props) { ... }`. | ||
| * Define props interface/type right above the component. | ||
| * Use proper React hook dependencies (no missing values, no stale closures). | ||
|
|
||
| ### 3. Styling & Aesthetics | ||
| * **Rich UX**: Use smooth hover states (`hover:scale-[1.02]`, `transition-all duration-300`). | ||
| * **Consistent Colors**: Use curated, harmonic Tailwind color schemes. Avoid plain primary colors. | ||
| * **No Placeholders**: Use working assets, actual SVGs, or Lucide icons instead of layout placeholders. | ||
|
|
||
| --- | ||
|
|
||
| ## 🚀 Submit & Git Rules | ||
|
|
||
| ### 1. Pre-Submit Checks | ||
| Before pushing any commit or submitting a pull request, you **MUST** run the validation suite locally. If any check fails, do not commit. | ||
| ```bash | ||
| bun run validate | ||
| ``` | ||
| This script runs: | ||
| 1. **Biome check**: Lints and formats all files (`biome check .`). | ||
| 2. **Typecheck**: Checks TypeScript compilation (`tsc --noEmit`). | ||
| 3. **Build**: Ensures the project builds successfully (`vite build`). | ||
|
|
||
| ### 2. Commit Message Conventions | ||
| Commits must follow the **Conventional Commits** standard: | ||
| * `feat`: A new feature (e.g., `feat: add model selector dropdown`) | ||
| * `fix`: A bug fix (e.g., `fix: resolve mobile navigation overflow`) | ||
| * `chore`: Maintenance tasks (e.g., `chore: update biome dependencies`) | ||
| * `docs`: Documentation updates (e.g., `docs: update agents.md guidelines`) | ||
| * `style`: Styling or formatting changes (e.g., `style: run biome check --write`) | ||
| * `refactor`: Code restructuring without behavior changes | ||
| * `ci`: GitHub Actions configuration changes | ||
|
|
||
| ### 3. Pull Request Requirements | ||
| * Every PR must pass the GitHub CI validation suite. | ||
| * Ensure code is clean, debug `console.log` statements are removed, and unused imports are cleaned up. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,20 +1,28 @@ | ||
| <div align="center"> | ||
| <img width="1200" height="475" alt="GHBanner" src="https://ai.google.dev/static/site-assets/images/share-ais-513315318.png" /> | ||
| </div> | ||
| # shumai-web | ||
|
|
||
| # Run and deploy your AI Studio app | ||
| This is the website of [shumai.one](https://shumai.one). | ||
|
|
||
| This contains everything you need to run your app locally. | ||
| ## Development | ||
|
|
||
| View your app in AI Studio: https://ai.studio/apps/79c24a4f-14a8-454b-ba20-49ac152bb16c | ||
| This project is built using React 19, Vite, Tailwind CSS, and TypeScript, running on the **Bun** runtime. | ||
|
|
||
| ## Run Locally | ||
| ### Setup & Local Run | ||
|
|
||
| **Prerequisites:** Node.js | ||
| 1. **Install dependencies**: | ||
| ```bash | ||
| bun install | ||
| ``` | ||
| 2. **Configure environment**: | ||
| Set `GEMINI_API_KEY` in `.env.local` | ||
| 3. **Start local development server**: | ||
| ```bash | ||
| bun run dev | ||
| ``` | ||
|
|
||
| ### Quality Assurance | ||
|
|
||
| 1. Install dependencies: | ||
| `npm install` | ||
| 2. Set the `GEMINI_API_KEY` in [.env.local](.env.local) to your Gemini API key | ||
| 3. Run the app: | ||
| `npm run dev` | ||
| This repository uses **Biome** for formatting, linting, and import organization. | ||
| Before committing changes, make sure all validations pass: | ||
| ```bash | ||
| bun run validate | ||
| ``` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,50 @@ | ||
| { | ||
| "$schema": "https://biomejs.dev/schemas/2.4.16/schema.json", | ||
| "assist": { "actions": { "source": { "organizeImports": "on" } } }, | ||
| "linter": { | ||
| "enabled": true, | ||
| "rules": { | ||
| "recommended": true, | ||
| "correctness": { | ||
| "noUnusedVariables": "off", | ||
| "noUnusedImports": "off" | ||
| }, | ||
| "style": { | ||
| "noNonNullAssertion": "off" | ||
| }, | ||
| "suspicious": { | ||
| "noArrayIndexKey": "off", | ||
| "noCommentText": "off" | ||
| }, | ||
| "a11y": { | ||
| "noSvgWithoutTitle": "off", | ||
| "useValidAnchor": "off", | ||
| "useButtonType": "off" | ||
| } | ||
| } | ||
| }, | ||
| "formatter": { | ||
| "enabled": true, | ||
| "formatWithErrors": false, | ||
| "indentStyle": "space", | ||
| "indentWidth": 2, | ||
| "lineWidth": 100, | ||
| "lineEnding": "lf" | ||
| }, | ||
| "javascript": { | ||
| "formatter": { | ||
| "quoteStyle": "single", | ||
| "jsxQuoteStyle": "double", | ||
| "trailingCommas": "all", | ||
| "semicolons": "always" | ||
| } | ||
| }, | ||
| "files": { | ||
| "includes": ["**", "!**/dist", "!**/node_modules", "!**/bun.lock"] | ||
| }, | ||
| "css": { | ||
| "parser": { | ||
| "tailwindDirectives": true | ||
| } | ||
| } | ||
| } | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Disabling
noUnusedVariablesandnoUnusedImportsgoes against the goal of standardizing code quality and formatting in a production-ready setup. Unused variables and imports can clutter the codebase and hide potential logic bugs. It is highly recommended to enable these rules.