Files
metapi/CONTRIBUTING.md
T
cita 136a038538 feat(tests): enhance modelTesterSession tests and add proxy logs tests
- Updated modelTesterSession tests to serialize assistant history as output_text and removed mime_type from input_file.
- Introduced new tests for stats proxy logs routes, covering paginated log retrieval and detailed log views with parsed billing details.
- Added server-driven tests for ProxyLogs component to validate API interactions and UI rendering based on server data.
2026-03-09 13:48:39 +08:00

2.3 KiB

Contributing

Thanks for contributing to Metapi.

Local Setup

  1. Install dependencies:
npm install
  1. Create a local environment file:
Copy-Item .env.example .env
cp .env.example .env
  1. Initialize the default SQLite database:
npm run db:migrate

Common Commands

App development

npm run dev
npm run dev:server
restart.bat
  • npm run dev starts the Fastify server and Vite together.
  • npm run dev:server runs only the backend watcher.
  • restart.bat is the Windows-friendly restart entrypoint; it forwards to scripts\dev\restart.bat, clears stale listeners, and starts npm run dev.

Docs

npm run docs:dev
npm run docs:build
npm run docs:preview

Desktop

npm run dev:desktop
npm run build:desktop
npm run dist:desktop
npm run package:desktop

npm run dev:desktop expects the backend on http://127.0.0.1:4000 and the Vite frontend on http://127.0.0.1:5173.

Test, build, and smoke checks

npm test
npm run test:watch
npm run build
npm run build:web
npm run build:server
npm run smoke:db
npm run smoke:db:sqlite
npm run smoke:db:mysql -- --db-url mysql://user:pass@host:3306/db
npm run smoke:db:postgres -- --db-url postgres://user:pass@host:5432/db

Windows Notes

  • Prefer Copy-Item or Explorer copy/paste over cp if you are working in PowerShell or cmd.exe.
  • If a previous dev process keeps ports busy, use restart.bat instead of manually hunting PIDs.
  • If dependencies or .cmd shims look broken after a Node.js upgrade, rerun npm install before assuming the scripts are wrong.

Pull Request Guidelines

  • Keep PRs focused and small.
  • Add or update tests for behavior changes.
  • Update docs when user-facing behavior, commands, ports, or configuration change.
  • Run the checks that match your change set before opening a PR:
    • docs only: npm run docs:build
    • app code: npm test and the relevant npm run build:*
    • runtime DB work: one of the npm run smoke:db* commands
  • Avoid committing runtime data (data/) or temporary files (tmp/).

Commit Messages

Use concise messages with clear scope, for example:

  • feat: add token route health guard
  • fix: handle empty model list in dashboard
  • docs: clarify docker env setup