mirror of
https://github.com/EKKOLearnAI/hermes-web-ui.git
synced 2026-05-25 21:40:13 +00:00
4.0 KiB
4.0 KiB
Development Guidelines
This document defines project-level development rules for Hermes Web UI. It is tool-agnostic and applies to all contributors and coding agents.
Commands
npm install
npm run dev
npm run test
npm run test:coverage
npm run test:e2e
npm run build
npm run devstarts the Vite client and Koa server together.npm run testruns Vitest unit tests.npm run test:coverageis what the Build workflow runs beforenpm run build.npm run test:e2eruns Playwright browser tests against a mocked BFF API.npm run buildtype-checks and builds both client and server.
Architecture
- Frontend code lives under
packages/client/src. - Server code lives under
packages/server/src. - Hermes-specific client code stays under
hermesnamespaces: API modules, views, stores, and components. - Server routes should stay thin. Put request handling in controllers and reusable behavior in services.
- The chat runtime is Socket.IO based and lives under
packages/server/src/services/hermes/run-chat. - Web UI state lives under
HERMES_WEB_UI_HOMEorHERMES_WEBUI_STATE_DIR, defaulting to~/.hermes-web-ui.
Coding Rules
- Prefer existing local patterns over new abstractions.
- Keep changes scoped to the requested behavior.
- Do not mix unrelated refactors into feature or bugfix commits.
- Do not reintroduce deprecated compatibility switches without a current caller.
- Use structured APIs and parsers for structured data instead of ad hoc string edits when possible.
- Add comments only where they explain non-obvious behavior or constraints.
Frontend Rules
- Use Vue 3 Composition API with
<script setup lang="ts">. - Use Pinia setup stores.
- Use the shared API request helper in
packages/client/src/api/client.ts. - Add user-facing strings to all locale files.
- Keep component styles scoped with SCSS unless the style is intentionally global.
- Match existing Naive UI patterns and avoid adding a new UI library.
Server Rules
- Register local API routes before proxy catch-all routes.
- Keep auth behavior centralized in
packages/server/src/services/auth.ts. - Use
config.appHomefor Web UI state paths. - Keep Hermes home paths separate from Web UI home paths.
- Use
getActiveProfileDir()or related profile helpers for Hermes profile files. - Avoid shell string construction for CLI calls; prefer
execFile/spawnwith argument arrays.
Testing Rules
- Add focused Vitest coverage for server and store logic changes.
- Add Playwright coverage for browser-visible flows and routing/auth regressions.
- For frontend browser tests, prefer API/socket mocks over real external services.
- Before opening a PR, run the smallest relevant tests plus
npm run build. - For broad changes, run:
npm run test:coverage
npm run test:e2e
npm run build
Commit And PR Rules
- Branch from
mainfor new work. - Use short, descriptive branch names such as
codex/fix-login-tokenorfeat/group-chat-copy. - Commit only files that belong to the change.
- Use concise commit messages that describe the change, for example
fix login token storageoradd group chat clone naming. - Keep commits focused. Do not bundle unrelated cleanup with feature work unless the cleanup is required.
- Push the branch and open a PR against
mainunless the issue explicitly targets another base. - Prefer draft PRs while validation is still running or when the change needs review before merge.
- Mark a PR ready only after the relevant tests and build pass.
- Keep PR titles concrete and scoped, for example
[codex] make Web UI state directory configurable. - Link issues in the PR body with
Closes #123,Fixes #123, orRefs #123as appropriate. - PR descriptions should include:
- what changed
- why it changed
- user or developer impact
- validation commands run
- known limitations or follow-up work, if any
- Do not overwrite or revert unrelated user changes.
Use this PR body shape by default:
## Summary
- ...
- ...
Closes #123
## Validation
- `npm run test:coverage`
- `npm run build`