mirror of
https://github.com/hanzoai/team.git
synced 2026-09-30 01:57:35 +00:00
compass-icons is published by Mattermost and consumed from the registry; this tree contains no source for it and webapp/platform has no such workspace. Under our scope npm has nothing to fetch: 404 Not Found - GET https://registry.npmjs.org/@hanzoteam/compass-icons/-/compass-icons-0.1.61.tgz The lockfile is the proof of what it is. Its integrity for the renamed entry is sha512-Xq7QHyxq7NPljgqlzwRp6tWGe5s…, byte for byte the integrity npm publishes for @mattermost/[email protected] — one tarball, filed under a name nobody serves. The install then succeeds on any machine whose npm cache already holds that tarball, because a cache hit by integrity never asks the registry, and fails on every clean one. That is the whole distance between a developer's box and a build node: `npm ci --cache <fresh dir>` fails on master and passes here. Same rule the scope change already applied to calls-common and desktop-api: a package we merely consume keeps the name its publisher gave it. Co-authored-by: Hanzo Dev <[email protected]>
5.9 KiB
5.9 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 - @hanzoteam/types (
platform/types/): TypeScript type definitions - @hanzoteam/client (
platform/client/): REST and WebSocket client for the Mattermost API - @hanzoteam/components (
platform/components/): Shared React components - @hanzoteam/shared (
platform/shared/): Cross-product components and utilities used by the web app and plugins (e.g.Button,WithTooltip). Prefer these over hand-rolled equivalents. - @hanzoteam/eslint-plugin (
platform/eslint-plugin/): Custom ESLint rules
Importing Packages
Always import packages using their full name, never relative paths:
// Correct
import {Client4} from '@hanzoteam/client';
import {UserProfile} from '@hanzoteam/types/users';
import {Button} from '@hanzoteam/shared/components/button';
import {WithTooltip} from '@hanzoteam/shared/components/tooltip';
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
WithTooltipfrom@hanzoteam/shared/components/tooltip) - @hanzoteam/shared: Shared components and utilities (
Button,WithTooltip, etc.) — prefer these over rolling your own - @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. When adding or modifying a new translatable string, add or modify ONLY the English main fileen.json. DO NOT update the other languages. - 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/shared/,platform/types/. - Tooling:
scripts/CLAUDE.md.
Use these nested guides for focused, actionable instructions when working within each directory.