Convert build-healthchat workflow from branch-push to tag-push trigger (healthchat-v*), add version/workspace-ref/release-notes resolution, and create a GitHub Release on tag push. Pin healthchat-workspace to v0.5.0-rc.4 via .healthchat-workspace-version, seed the changelog with 1.0.0, and document the runbook in the releasing-healthchat skill.
4.6 KiB
CLAUDE.md
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
Prerequisites
- Node.js >= 22.18
- Yarn 1.x (classic)
Commands
Setup
yarn install- Install dependencies- Copy
config.sample.jsontoconfig.jsonand configure (see docs/config.md)
Development
yarn start- Run development server on http://localhost:8080yarn start:https- Run development server with HTTPSyarn build- Production build (outputs to webapp/)yarn dist- Create distribution tarball
Linux note: If builds fail silently or with EMFILE: too many open files, increase inotify limits:
sudo sysctl fs.inotify.max_user_watches=131072
sudo sysctl fs.inotify.max_user_instances=512
Testing
yarn test- Run Jest unit testsyarn test:playwright- Run Playwright e2e testsyarn test:playwright:open- Open Playwright test UIyarn coverage- Run tests with coverage reporting
To run a single test file:
yarn test path/to/test-file.test.tsyarn test:playwright path/to/e2e-test.ts
Code Quality
yarn lint- Run all linters (TypeScript, ESLint, Stylelint)yarn lint:js-fix- Auto-fix ESLint issuesyarn lint:types- TypeScript type checking onlyyarn lint:style- Check CSS/PostCSS styles
Utilities
yarn make-component- Scaffold new React componentyarn i18n- Manage translationsyarn storybook- Run Storybook on port 6007
Architecture
This is Element Web, a Matrix client built with React and TypeScript, customized as "HealthChat". Key architectural patterns:
Component Structure
The application follows a hierarchical component structure:
MatrixChat- Root component managing the entire application stateLeftPanel- Room list, spaces, and navigationMainSplit- Central room view with messages and inputRightPanel- Member list, room info, and contextual panels
Components are organized in /src/components/:
/structures/- Major layout components/views/- Reusable UI components grouped by function (auth, dialogs, messages, rooms, settings)
State Management
Uses Flux architecture with:
- Centralized dispatcher in
/src/dispatcher/ - Stores in
/src/stores/as singletons (access viaFooStore.instance) - Dispatch actions:
dis.dispatch({ action: Action.FOO, ...payload })ordis.fire(Action.FOO)for action-only
Styling
- PostCSS files with
.pcssextension - BEM-like naming:
mx_ComponentName_element - Component styles co-located with components (e.g.,
_MessageTile.pcss) - Theming via CSS custom properties
Matrix Integration
- Uses
matrix-js-sdkfor all Matrix protocol operations - Client instance accessed via
MatrixClientPeg - Room and event handling through SDK abstractions
Module System
Plugin architecture in /src/modules/:
- Allows runtime extension of functionality
- Module API for registering custom components and handlers
Testing Patterns
- Unit tests in
/test/unit-tests/using Jest - E2E tests in
/playwright/e2e/using Playwright - Mock Matrix client and SDK extensively in tests
- Component tests via Storybook
Important Conventions
- TypeScript strict mode - always use explicit types
- Functional components with hooks preferred over class components (except "structures" which use classes)
- Translations use
_t()function with hierarchical keys - 4-space indentation, 120 character line limit
- Component files: UpperCamelCase, utilities: kebab-case
- Use
Optional<T>type instead of truly optional parameters when callers should explicitly acknowledge missing values - CSS class names must be prefixed with
mx_and match component name (e.g.,mx_RoomTile) - Import matrix-js-sdk via
matrix-js-sdk/src/matrixonly (notmatrix-js-sdkormatrix-js-sdk/src) - Use
jest-matrix-reactinstead of@testing-library/reactfor component tests - No
React.forwardRef- use ref props directly instead - Use UIStore for window dimensions instead of
window.innerHeight/window.innerWidth - Use Media helper for MXC URL handling instead of direct
mxcUrlToHttpcalls
Linked Development with matrix-js-sdk
For developing against local SDK changes:
# In matrix-js-sdk directory
yarn link && yarn install
# In element-web directory
yarn link matrix-js-sdk && yarn install && yarn start
Releasing HealthChat
Releases are cut by pushing a healthchat-v<semver> tag against release/healthchat, which triggers .github/workflows/build-healthchat.yaml. Release notes come from HEALTHCHAT_CHANGES.md; the plugin ref is pinned in .healthchat-workspace-version. Full runbook: releasing-healthchat skill.