Skip to content

Latest commit

 

History

History
62 lines (46 loc) · 2.58 KB

File metadata and controls

62 lines (46 loc) · 2.58 KB

This file provides guidance to AI coding assistants working with this repository.

Project Overview

ToolHive Studio is an Electron desktop application for managing MCP (Model Context Protocol) servers. Built with React, TypeScript, Electron, and Vite. Uses pnpm as package manager. Requires Node.js >=24 <25.

Essential Commands

pnpm install                    # Install dependencies
pnpm run start                  # Start dev server with hot reload
pnpm run lint                   # Run ESLint
pnpm run type-check             # TypeScript type checking
pnpm run format                 # Format with Prettier
pnpm run test:nonInteractive    # Run unit tests once
pnpm run test:coverage          # Unit tests with coverage
pnpm run e2e                    # End-to-end tests
pnpm run generate-client        # Regenerate API client from OpenAPI spec
pnpm run knip                   # Detect unused code

Husky/lint-staged automatically run lint + format on staged files. Run pnpm run type-check manually before committing.

Common Gotchas

  • Docker daemon must be running before pnpm run start
  • Node.js version must be >=24 <25 — native modules break otherwise
  • After Node version change, run pnpm run rebuild for native modules
  • If API type errors appear, run pnpm run generate-client to refresh
  • Tests run through Electron (pnpm run vitest:electron), not plain Node
  • Always run commands from the repository root, not from subdirectories

Boundaries

Do not modify or manually edit:

  • common/api/generated/* — regenerate via pnpm run generate-client
  • renderer/src/route-tree.gen.ts — auto-generated by TanStack Router plugin
  • node_modules/, out/, .vite/ — build artifacts

Code Conventions

  • File names: kebab-case always (e.g., card-mcp-server.tsx)
  • Components: PascalCase, functional with hooks
  • Path aliases: @/* (renderer/src), @common/*, @utils/*, @mocks/*
  • Imports: use aliases for cross-directory imports, not relative paths
  • Exports: named exports preferred over default exports

Testing Patterns

  • Tests in __tests__/ directories colocated with source
  • API mocking via auto-generated MSW fixtures from OpenAPI spec
  • See docs/mocks.md for mocking patterns
  • Use .override() / .overrideHandler() for test-specific API responses
  • Use recordRequests() to assert on outgoing API calls

Commit and PR Guidelines

  • Conventional Commits format required
  • PR titles validated against conventional commit spec by CI
  • Keep PRs small and focused
  • See CONTRIBUTING.md for details