mirror of
https://github.com/samanhappy/mcphub.git
synced 2025-12-24 02:39:19 -05:00
2.7 KiB
2.7 KiB
Repository Guidelines
These notes align current contributors around the code layout, daily commands, and collaboration habits that keep @samanhappy/mcphub moving quickly.
Project Structure & Module Organization
- Backend services live in
src, grouped by responsibility (controllers/,services/,dao/,routes/,utils/), withserver.tsorchestrating HTTP bootstrap. frontend/srccontains the Vite + React dashboard;frontend/publichosts static assets and translations sit inlocales/.- Jest-aware test code is split between colocated specs (
src/**/*.{test,spec}.ts) and higher-level suites intests/; usetests/utils/helpers when exercising the CLI or SSE flows. - Build artifacts and bundles are generated into
dist/,frontend/dist/, andcoverage/; never edit these manually.
Build, Test, and Development Commands
pnpm devruns backend (tsx watch src/index.ts) and frontend (vite) together for local iteration.pnpm backend:dev,pnpm frontend:dev, andpnpm frontend:previewtarget each surface independently; prefer them when debugging one stack.pnpm buildexecutespnpm backend:build(TypeScript todist/) andpnpm frontend:build; run before release or publishing.pnpm test,pnpm test:watch, andpnpm test:coveragedrive Jest;pnpm lintandpnpm formatenforce style via ESLint and Prettier.
Coding Style & Naming Conventions
- TypeScript everywhere; default to 2-space indentation and single quotes, letting Prettier settle formatting. ESLint configuration assumes ES modules.
- Name services and data access layers with suffixes (
UserService,AuthDao), React components and files inPascalCase, and utility modules incamelCase. - Keep DTOs and shared types in
src/typesto avoid duplication; re-export through index files only when it clarifies imports.
Testing Guidelines
- Use Jest with the
ts-jestESM preset; place shared setup intests/setup.tsand mock helpers undertests/utils/. - Mirror production directory names when adding new suites and end filenames with
.test.tsor.spec.tsfor automatic discovery. - Aim to maintain or raise coverage when touching critical flows (auth, OAuth, SSE); add integration tests under
tests/integration/when touching cross-service logic.
Commit & Pull Request Guidelines
- Follow the existing Conventional Commit pattern (
feat:,fix:,chore:, etc.) with imperative, present-tense summaries and optional multi-line context. - Each PR should describe the behavior change, list testing performed, and link issues; include before/after screenshots or GIFs for frontend tweaks.
- Re-run
pnpm buildandpnpm testbefore requesting review, and ensure generated artifacts stay out of the diff.