Initial commit: Momentry Portal v0.1.0

This commit is contained in:
Warren
2026-05-20 08:29:37 +08:00
commit 0da7dd17af
62 changed files with 16788 additions and 0 deletions

40
AGENTS.md Normal file
View File

@@ -0,0 +1,40 @@
# Momentry Portal — AGENTS.md
## 開發指令
| 用途 | 指令 |
|------|------|
| Vue dev server (port 1420) | `npm run dev` |
| Tauri 桌面應用 | `npm run tauri dev` |
| 完整建置typecheck → build | `npm run build` |
| 純 Vite preview | `npm run preview` |
`npm run build` 會先執行 `vue-tsc --noEmit`(型別檢查),成功後才執行 `vite build`
## 專案架構
- `src/` — Vue 前端,`@/` 別名指向 `./src/`
- `src-tauri/` — Rust 後端Tauri v2`src/api/` 有七個模組:`health``search``identity``video``person``translation`
- `src-tauri/config.rs` — 從環境變數 `MOMENTRY_API_URL` / `MOMENTRY_API_KEY` 讀取設定
- 無測試、無 lint/formatter 設定檔、無 CI
## API 雙模式
`src/api/client.ts` 根據執行環境自動切換:
- **Tauri 模式**:透過 `@tauri-apps/api/core``invoke` 呼叫 Rust commands
- **瀏覽器模式**:直接 HTTP fetch 到后端 API
## 環境與認證
- `.env.development` 提供 `VITE_API_BASE_URL``VITE_API_KEY`(僅瀏覽器模式使用)
- 登入狀態存於 `localStorage('momentry_user')`
- API 設定存於 `localStorage('portal_config')`
- 401 回應會自動清除登入狀態並跳回 `/login`
## 注意事項
- `tsconfig.json` 啟用 `strict` + `noUnusedLocals` + `noUnusedParameters` — 未使用的變數/參數會造成 `vue-tsc` 建置錯誤
- Tauri v2 使用 plugins 架構:`shell``http``unsafe-headers`)、`fs``global-shortcut`
- 視窗 Zoom 快捷鍵:`Cmd+=` / `Cmd+-` / `Cmd+0`
- Dev server port **1420**strictPort: true`tauri.conf.json``devUrl``vite.config.ts` 一致
- 此專案從 `momentry_core` 分離出來,前端不包含後端 Rust 程式碼