mirror of
https://github.com/mattermost/mattermost.git
synced 2026-02-03 20:40:00 -05:00
Some checks are pending
API / build (push) Waiting to run
Server CI / Compute Go Version (push) Waiting to run
Server CI / Check mocks (push) Blocked by required conditions
Server CI / Check go mod tidy (push) Blocked by required conditions
Server CI / check-style (push) Blocked by required conditions
Server CI / Check serialization methods for hot structs (push) Blocked by required conditions
Server CI / Vet API (push) Blocked by required conditions
Server CI / Check migration files (push) Blocked by required conditions
Server CI / Generate email templates (push) Blocked by required conditions
Server CI / Check store layers (push) Blocked by required conditions
Server CI / Check mmctl docs (push) Blocked by required conditions
Server CI / Postgres with binary parameters (push) Blocked by required conditions
Server CI / Postgres (push) Blocked by required conditions
Server CI / Postgres (FIPS) (push) Blocked by required conditions
Server CI / Generate Test Coverage (push) Blocked by required conditions
Server CI / Run mmctl tests (push) Blocked by required conditions
Server CI / Run mmctl tests (FIPS) (push) Blocked by required conditions
Server CI / Build mattermost server app (push) Blocked by required conditions
Web App CI / check-lint (push) Waiting to run
Web App CI / check-i18n (push) Blocked by required conditions
Web App CI / check-types (push) Blocked by required conditions
Web App CI / test (platform) (push) Blocked by required conditions
Web App CI / test (mattermost-redux) (push) Blocked by required conditions
Web App CI / test (channels shard 1/4) (push) Blocked by required conditions
Web App CI / test (channels shard 2/4) (push) Blocked by required conditions
Web App CI / test (channels shard 3/4) (push) Blocked by required conditions
Web App CI / test (channels shard 4/4) (push) Blocked by required conditions
Web App CI / upload-coverage (push) Blocked by required conditions
Web App CI / build (push) Blocked by required conditions
* Add CLAUDE.md documentation files for webapp directories - Add root webapp CLAUDE.md with overview and build commands - Add channels CLAUDE.md with architecture and testing info - Add documentation for actions, components, selectors, utils - Add documentation for sass, tests, and mattermost-redux - Add platform documentation for client and types - Update .gitignore * Add CLAUDE docs and allow tracking * Clarify CLAUDE instructions for i18n workflow * Refactor webapp/CLAUDE.md into a nested hierarchy Decomposed the monolithic webapp/CLAUDE.md into focused, context-aware files distributed across the directory structure: - webapp/CLAUDE.md (Root overview) - webapp/channels/CLAUDE.md (Channels workspace) - webapp/channels/src/components/CLAUDE.md - webapp/channels/src/actions/CLAUDE.md - webapp/channels/src/selectors/CLAUDE.md - webapp/channels/src/packages/mattermost-redux/CLAUDE.md - webapp/platform/CLAUDE.md (Platform workspace) - webapp/platform/client/CLAUDE.md * Move files to optional, then add script to move them to proper claud.md
5.3 KiB
5.3 KiB
CLAUDE.md
Guidance for Claude Code when working inside webapp/.
Project Overview
This is the Mattermost web app codebase, a React-based frontend application for the Mattermost collaboration platform. The repository is structured as an npm workspace monorepo with multiple packages, with the main application code in the channels package and shared platform code in platform/* packages.
- Primary workspace:
channels/(UI, Redux, routing). - Shared packages:
platform/*. - Scripts:
webapp/scripts/power dev server, builds, and localization flows. - Coding Standards: Read
webapp/STYLE_GUIDE.mdfor canonical standards; nestedCLAUDE.mdfiles cover directory-specific rules.
Core Commands
| Task | Command |
|---|---|
| Install deps | npm install (includes postinstall build of platform packages) |
| Dev server (prod build watch) | make run |
| Dev server (webpack-dev-server) | make dev or npm run dev-server --workspace=channels |
| Build all workspaces | make dist or npm run build |
| Build Channels only | npm run build --workspace=channels |
| Tests | make test or npm run test --workspace=channels (use test:watch, test:updatesnapshot as needed) |
| Lint / Style | make check-style, make fix-style, npm run check --workspace=channels, npm run fix --workspace=channels |
| Type check | make check-types |
| Clean artifacts | make clean or npm run clean --workspaces --if-present |
Top-Level Directory Map
channels/– Channels workspace. Seechannels/CLAUDE.md.src/– App source with further scoped guides (components, actions, selectors, reducers, store, sass, i18n, tests, utils, types, plugins, packages/mattermost-redux).
platform/– Shared packages (client,components,types,eslint-plugin). Seeplatform/CLAUDE.mdplus sub-guides.scripts/– Build/dev automation. Seescripts/CLAUDE.md.STYLE_GUIDE.md– Authoritative style + accessibility + testing reference.README.md,config.mk,Makefile– onboarding, env config, and command wiring.
Workspace Architecture
This repository uses npm workspaces:
- channels (
channels/): Main Mattermost web app containing all UI components, Redux logic, and application code - @mattermost/types (
platform/types/): TypeScript type definitions - @mattermost/client (
platform/client/): REST and WebSocket client for the Mattermost API - @mattermost/components (
platform/components/): Shared React components - @mattermost/eslint-plugin (
platform/eslint-plugin/): Custom ESLint rules
Importing Packages
Always import packages using their full name, never relative paths:
// Correct
import {Client4} from '@mattermost/client';
import {UserProfile} from '@mattermost/types/users';
import {getUser} from 'mattermost-redux/selectors/entities/users';
// Incorrect
import Client4 from '../platform/client/src/client4.ts';
Key Dependencies
- React 18.2: Main UI framework
- Redux 5.0: State management
- React Router 5.3: Client-side routing
- React Intl: Internationalization
- Floating UI: Tooltips and popovers (prefer
WithTooltipcomponent) - @mattermost/compass-icons: Icon library (prefer over font-awesome)
- Monaco Editor: Code editor integration
- Styled Components: Limited use (for MUI and some legacy components)
Important Configuration Files
channels/webpack.config.js: Webpack configuration with module federationchannels/jest.config.js: Jest test configurationchannels/tsconfig.json: TypeScript configuration with workspace referenceschannels/.eslintrc.json: ESLint configuration
Cross-Cutting Standards & Common Gotchas
- Functional Components: Prefer functional React components with hooks; memoize expensive logic.
- Data Access: Client4/WebSocket access happens via Redux actions only—never directly from components.
- Internationalization: All UI strings must be translatable via React Intl. Use
FormattedMessageunless a raw string is required. - Styling: Uses SCSS + CSS variables with BEM naming; avoid
!importantunless migrating legacy code. - Testing: RTL +
userEventfor tests; no snapshots. Use helpers underchannels/src/tests/. - Accessibility: Follow guidance in
STYLE_GUIDE.md(semantic elements, keyboard support, focus management). - Platform Packages: Rebuild automatically on
npm install; re-run if types appear stale. - Adding Dependencies: Always add dependencies with
npm add <pkg> --workspace=channels(or the relevant workspace). - Redux State Split:
state.entities.*(server data via mattermost-redux) vsstate.views.*(UI/persisted). Store new server entities in mattermost-redux first. - Client4 Returns: Methods return
{response, headers, data}– unwrap accordingly in actions.
Nested CLAUDE Files
- Channels workspace:
channels/CLAUDE.md,channels/src/CLAUDE.md. - Channels source subfolders:
components/,actions/,selectors/,reducers/,store/,sass/,i18n/,tests/,utils/,types/,plugins/,packages/mattermost-redux/. - Platform packages:
platform/CLAUDE.md, plusplatform/client/,platform/components/,platform/types/. - Tooling:
scripts/CLAUDE.md.
Use these nested guides for focused, actionable instructions when working within each directory.