Skip to content

Commit 3b3a7a9

Browse files
authored
Merge pull request #31 from mikndotdev/refactor
Refactor
2 parents e92d440 + b4fc263 commit 3b3a7a9

96 files changed

Lines changed: 11151 additions & 2643 deletions

File tree

Some content is hidden

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

.dockerignore

Lines changed: 0 additions & 35 deletions
This file was deleted.
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: opencode-review
2+
3+
on:
4+
pull_request:
5+
types: [opened, synchronize, reopened, ready_for_review]
6+
7+
jobs:
8+
review:
9+
runs-on: ubuntu-latest
10+
permissions:
11+
id-token: write
12+
contents: write
13+
pull-requests: write
14+
issues: write
15+
steps:
16+
- uses: actions/checkout@v6
17+
- uses: anomalyco/opencode/github@latest
18+
env:
19+
ZHIPU_API_KEY: ${{ secrets.ZHIPU_API_KEY }}
20+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
21+
with:
22+
use_github_token: 'true'
23+
model: zai-coding-plan/glm-4.7
24+
prompt: |
25+
Review this pull request:
26+
- Check for code quality issues
27+
- Look for potential bugs
28+
- Suggest improvements
29+
- ${{ secrets.CUSTOM_REVIEW_INSTRUCTIONS || '' }}

.github/workflows/opencode.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: opencode
2+
3+
on:
4+
issue_comment:
5+
types: [created]
6+
pull_request_review_comment:
7+
types: [created]
8+
9+
jobs:
10+
opencode:
11+
if: |
12+
contains(github.event.comment.body, ' /oc') ||
13+
startsWith(github.event.comment.body, '/oc') ||
14+
contains(github.event.comment.body, ' /opencode') ||
15+
startsWith(github.event.comment.body, '/opencode')
16+
runs-on: ubuntu-latest
17+
permissions:
18+
id-token: write
19+
contents: write
20+
pull-requests: write
21+
issues: write
22+
steps:
23+
- name: Checkout repository
24+
uses: actions/checkout@v6
25+
26+
- name: Run opencode
27+
uses: anomalyco/opencode/github@latest
28+
env:
29+
ZHIPU_API_KEY: ${{ secrets.ZHIPU_API_KEY }}
30+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
31+
with:
32+
use_github_token: 'true'
33+
model: zai-coding-plan/glm-4.7

AGENTS.md

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
# Agent Operational Guide
2+
3+
This document provides instructions and standards for AI agents operating within this codebase.
4+
5+
## 1. Project Overview
6+
7+
- **Framework:** Next.js 16 (App Router)
8+
- **Language:** TypeScript
9+
- **Styling:** Tailwind CSS 4, Framer Motion, GSAP
10+
- **3D/Graphics:** Three.js, React Three Fiber, React Three Drei, Pixiv Three VRM
11+
- **Internationalization:** `next-intl`
12+
- **Package Manager:** npm (with `bun.lock` present)
13+
14+
## 2. Build, Lint, and Test Commands
15+
16+
### Build & Run
17+
Always use Bun to run scripts to ensure compatibility with the lockfile.
18+
- **Development Server:** `bun run dev`
19+
- **Production Build:** `bun run build`
20+
- **Start Production:** `bun run start`
21+
22+
### Linting & Formatting
23+
This project uses **Biome** for formatting and linting, alongside Next.js's built-in linter.
24+
- **Format & Fix:** `bun run format` (Runs `biome format --write .`)
25+
- **Lint:** `bun run lint` (Runs `next lint`)
26+
27+
**Note to Agents:** Always run `bun run format` after making changes to ensure code complies with project standards.
28+
29+
### Testing
30+
- **Status:** No testing framework or test files were detected in the initial scan.
31+
- **Instruction:** If asked to write tests, verify if a framework (like Vitest or Jest) has been added since this file was created. If not, ask the user for their preference or propose installing **Vitest** for a modern, fast testing experience compatible with Next.js and Vite.
32+
- **Command (Placeholder):** `npm test` (if configured)
33+
34+
## 3. Code Style & Conventions
35+
36+
### General
37+
- **Structure:** Follow the Next.js App Router structure (`src/app`).
38+
- **Imports:** Use absolute imports with the `@/` alias (e.g., `import { Button } from "@/components/ui/button"`).
39+
- **Sorting:** Imports are sorted automatically by Biome. Run `npm run format` to enforce this.
40+
41+
### TypeScript
42+
- **Strictness:** `tsconfig.json` has `"strict": false`. Be mindful of potential null/undefined values, but do not aggressively enforce strict null checks unless refactoring specific modules to be stricter.
43+
- **Types:** Prefer interfaces over types for object definitions. Explicitly type component props.
44+
45+
### Naming
46+
- **Components:** PascalCase (e.g., `ContactPage`, `SubmitButton`).
47+
- **Files:**
48+
- Components: PascalCase (e.g., `Button.tsx`).
49+
- Utilities/Hooks: camelCase (e.g., `useWindowSize.ts`, `utils.ts`).
50+
- App Router: kebab-case/standard Next.js conventions (e.g., `page.tsx`, `layout.tsx`, `loading.tsx`).
51+
52+
### Styling (Tailwind CSS & Components)
53+
- **Utility Classes:** Use Tailwind CSS classes for styling.
54+
- **Components:**
55+
- Use **Shadcn UI** components from `@/components/ui` when available.
56+
- Use **Animate UI** components from `@/components/animate-ui` for animations.
57+
- Use **Lucide React** for icons (`import { Mail } from "lucide-react"`).
58+
- **Icons:** Do **not** use `react-icons` if Lucide equivalents are available.
59+
- **Responsive Design:** Use Tailwind's md: class for styles for desktop views. Don't use any other responsive classes such as sm:, lg:, xl:, etc.
60+
61+
### Internationalization (i18n)
62+
- Use `next-intl` for translations.
63+
- access translations via `const t = useTranslations("namespace")`.
64+
- keys should be kebab-case (e.g., `contact.general-support`).
65+
66+
## 4. Error Handling
67+
- Use standard `try/catch` blocks for async operations.
68+
- Ensure user-facing errors are localized using `next-intl`.
69+
- For API routes, return standard HTTP status codes and JSON error responses.
70+
71+
## 5. Agent Behavior
72+
- **Proactive Formatting:** Always format code before finishing a task.
73+
- **Safety:** Do not delete production configurations or large chunks of code without verification.
74+
- **Context:** Read `package.json` and `tsconfig.json` if you are unsure about dependencies or paths.
75+
- **Cleanliness:** No comments are required unless asked for by the user. Keep code clean and concise.
76+
- **Edits:** If a file has been edited since the last read, retain any new code or changes made by the user.
77+

biome.json

Lines changed: 40 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,42 @@
11
{
2-
"$schema": "https://biomejs.dev/schemas/1.5.1/schema.json",
3-
"organizeImports": {
4-
"enabled": true
5-
},
6-
"linter": {
7-
"enabled": true,
8-
"rules": {
9-
"recommended": true
10-
},
11-
"ignore": [".next/", "out/", ".wrangler/", ".open-next/"]
12-
},
13-
"formatter": {
14-
"enabled": true,
15-
"indentWidth": 4,
16-
"indentStyle": "tab",
17-
"ignore": [".next/", "out/", ".wrangler/", ".open-next/"],
18-
},
19-
"javascript": {
20-
"formatter": {
21-
"bracketSpacing": true
22-
}
23-
}
2+
"$schema": "https://biomejs.dev/schemas/2.2.0/schema.json",
3+
"vcs": {
4+
"enabled": true,
5+
"clientKind": "git",
6+
"useIgnoreFile": true
7+
},
8+
"files": {
9+
"ignoreUnknown": true,
10+
"includes": ["**", "!node_modules", "!.next", "!dist", "!build"]
11+
},
12+
"formatter": {
13+
"enabled": true,
14+
"indentStyle": "space",
15+
"indentWidth": 2
16+
},
17+
"css": {
18+
"parser": {
19+
"tailwindDirectives": true
20+
}
21+
},
22+
"linter": {
23+
"enabled": true,
24+
"rules": {
25+
"recommended": true,
26+
"suspicious": {
27+
"noUnknownAtRules": "off"
28+
}
29+
},
30+
"domains": {
31+
"next": "recommended",
32+
"react": "recommended"
33+
}
34+
},
35+
"assist": {
36+
"actions": {
37+
"source": {
38+
"organizeImports": "on"
39+
}
40+
}
41+
}
2442
}

0 commit comments

Comments
 (0)