57 lines
2.2 KiB
Markdown
57 lines
2.2 KiB
Markdown
# Momentry Portal — AGENTS.md
|
||
|
||
## 其他專案(M4mini)
|
||
|
||
- **markbase** — M4mini 上正在開發的重要專案
|
||
|
||
## 開發指令
|
||
|
||
| 用途 | 指令 |
|
||
|------|------|
|
||
| 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`
|
||
|
||
## 跨機器推送與測試(M4mini → M5Max128)
|
||
|
||
Gitea 伺服器在 `m5max128.local:3000`(admin / `AccusysTest!`)。開發在 M4mini 進行,測試在 M5Max128:
|
||
```bash
|
||
# 一鍵推送 + 部署 + 建置
|
||
./deploy.sh [commit message]
|
||
|
||
# 或手動
|
||
git commit -am "..." && git push
|
||
ssh accusys@m5max128.local "cd ~/momentry_portal && git pull && npm run build"
|
||
```
|
||
|
||
## 注意事項
|
||
|
||
- `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 程式碼
|