|
| 1 | +# AGENTS.md |
| 2 | + |
| 3 | +VitePress 2.0.0-alpha static site for the MicYou Android microphone app. Vue 3 + pnpm + Biome. |
| 4 | + |
| 5 | +## Commands |
| 6 | + |
| 7 | +```bash |
| 8 | +pnpm dev # Dev server at localhost:5173 |
| 9 | +pnpm build # Production build → .vitepress/dist/ |
| 10 | +pnpm preview # Preview production build |
| 11 | +pnpm lint # Biome linter check |
| 12 | +pnpm format # Biome auto-fix formatting |
| 13 | +pnpm fetch:ghdata # Fetch GitHub release/contributor data (needs GH_TOKEN or GITHUB_TOKEN) |
| 14 | +pnpm llms:generate # Generate llms.txt and llms-full.txt |
| 15 | +``` |
| 16 | + |
| 17 | +No test framework is configured. There are no tests to run. |
| 18 | + |
| 19 | +## Architecture |
| 20 | + |
| 21 | +- `src/` is the VitePress source directory (`srcDir: "./src"` in config) |
| 22 | +- `.vitepress/config.mts` — Main config: locales, SEO, head tags, markdown plugins |
| 23 | +- `.vitepress/data/i18n.ts` — Central i18n exports (nav, footer, component translations) |
| 24 | +- `.vitepress/data/lang/zh.ts`, `en.ts`, `zh_tw.ts` — Per-language UI translations |
| 25 | +- `.vitepress/theme/index.ts` — Custom theme entry: registers global components, Umami analytics |
| 26 | +- `scripts/fetch-gh-data.ts` — GitHub GraphQL API fetcher for release/contributor data |
| 27 | +- `scripts/generate-llms-txt.ts` — Generates LLM-friendly text files |
| 28 | + |
| 29 | +### Key Content Structure |
| 30 | + |
| 31 | +``` |
| 32 | +src/ |
| 33 | +├── index.md, download.md, video.md, changelog.md ← Top-level pages (zh-CN default) |
| 34 | +├── docs/ ← Documentation pages with sidebar config in sidebar.ts |
| 35 | +├── en/ ← English translations (mirror src/ structure) |
| 36 | +├── zh-TW/ ← Traditional Chinese translations |
| 37 | +└── public/ ← Static assets (images, ghdata.json, favicon) |
| 38 | +``` |
| 39 | + |
| 40 | +## i18n — Three Locales Required |
| 41 | + |
| 42 | +Every content change must exist in all three locations: |
| 43 | +- `src/<page>.md` → `src/en/<page>.md` → `src/zh-TW/<page>.md` |
| 44 | + |
| 45 | +UI translations live in `.vitepress/data/lang/` and are re-exported through `.vitepress/data/i18n.ts`. |
| 46 | + |
| 47 | +Sidebar config uses `sidebarTranslations` in `src/docs/sidebar.ts` — update all three language blocks. |
| 48 | + |
| 49 | +## Biome Formatting |
| 50 | + |
| 51 | +- Tabs for indentation, double quotes for JS/TS strings |
| 52 | +- Vue files: `noUnusedImports`, `noUnusedVariables`, and `organizeImports` are disabled (auto-reordering can break template refs) |
| 53 | +- Pre-commit hook: Husky runs `lint-staged` which auto-formats staged `*.{js,ts,vue,json,mts,mjs,cjs,cts}` files |
| 54 | + |
| 55 | +## Frontmatter Required |
| 56 | + |
| 57 | +All doc pages need `title` and `description` in frontmatter for SEO. Homepage uses `layout: home` instead. |
| 58 | + |
| 59 | +## Images |
| 60 | + |
| 61 | +Place in `src/public/`, reference with root-relative paths (`/image.png`). Never use external image links (GitHub attachments, external URLs). |
| 62 | + |
| 63 | +## Data Pipeline |
| 64 | + |
| 65 | +`ghdata.json` at `src/public/ghdata.json` is generated by `scripts/fetch-gh-data.ts` (runs via GitHub Actions every 6 hours). Components fetch it at runtime with cache-busting — do NOT static-import it. |
| 66 | + |
| 67 | +The fetch script uses GitHub GraphQL API to count non-merge commits on master (matching GitHub `/graphs/contributors` counting). It excludes bots and core maintainers defined in `EXCLUDE_USERS`. |
| 68 | + |
| 69 | +## Dependencies |
| 70 | + |
| 71 | +- `@theojs/lumen` — Theme component library (BoxCube, Card, Links, Pill, Footer, CopyText, umamiAnalytics) |
| 72 | +- `@mdit/plugin-figure` — Markdown figure plugin for images |
| 73 | +- `marked` — Markdown parsing (used in ChangelogViewer for runtime rendering) |
| 74 | +- `iconify-icon` — Icon component (registered as custom element in VitePress config) |
| 75 | + |
| 76 | +## Deployment |
| 77 | + |
| 78 | +Auto-deploys to GitHub Pages via GitHub Actions on push to `main`. Build output in `.vitepress/dist/`. |
| 79 | + |
| 80 | +## Commits |
| 81 | + |
| 82 | +Conventional commits format: `feat:`, `fix:`, `docs:`, `chore:`, etc. |
0 commit comments