You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/CLAUDE.md
+35-8Lines changed: 35 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -16,18 +16,20 @@ This file provides guidance to Claude Code (claude.ai/code) and also Gemini CLI
16
16
- Run `pretter -w [filename]` after modifying a file (ts, tsx, md, json, ...) to format it correctly.
17
17
- All .js and .ts files are formatted by the tool prettier
18
18
- Add suitable types when you write code
19
-
- Variable name styles are "camelCase" for local and "FOO_BAR" for global variables. If you edit older code not following these guidlines, adjust this rule to fit the files style.
19
+
- Follow DRY principles!
20
+
- Variable name styles are `camelCase` for local and `FOO_BAR` for global variables. React Components and Classes are `FooBar`. If you edit older code not following these guidlines, adjust this rule to fit the files style.
20
21
- Some older code is JavaScript or CoffeeScript, which will be translated to TypeScript
21
22
- Use ES modules (import/export) syntax, not CommonJS (require)
22
23
- Organize the list of imports in such a way: installed npm packages are on top, newline, then are imports from @cocalc's code base. Sorted alphabetically.
24
+
-**Colors**: Always use the `COLORS` dictionary from `@cocalc/util/theme` for all color values. Never hardcode colors like `#f0f0f0` or `rgb(...)`. Import with `import { COLORS } from "@cocalc/util/theme";` and use predefined constants like `COLORS.GRAY_M`, `COLORS.GRAY_L`, `COLORS.GRAY_LL`, etc.
23
25
-**Backend Logging**: Use `getLogger` from `@cocalc/project/logger` for logging in backend code. Do NOT use `console.log`. Example: `const L = getLogger("module:name").debug;`
24
26
25
27
## Development Commands
26
28
27
29
### Essential Commands
28
30
29
31
-`pnpm build-dev` - Build all packages for development
30
-
-`pnpm clean` - Clean all node_modules and dist directories
32
+
-`pnpm clean` - Clean all `node_modules` and `dist` directories
31
33
-`pnpm test` - Run full test suite
32
34
-`pnpm depcheck` - Check for dependency issues
33
35
-`python3 ./scripts/check_npm_packages.py` - Check npm package consistency across packages
@@ -38,15 +40,16 @@ This file provides guidance to Claude Code (claude.ai/code) and also Gemini CLI
38
40
39
41
-`cd packages/[package] && pnpm build` - Build and compile a specific package
40
42
- for packages/next and packages/static, run `cd packages/[package] && pnpm build-dev`
41
-
-`cd packages/[package] && pnpm tsc:watch` - TypeScript compilation in watch mode for a specific package
42
43
-`cd packages/[package] && pnpm test` - Run tests for a specific package
43
44
-`cd packages/[package] && pnpm build` - Build a specific package
45
+
- To typecheck the frontend, it is best to run `cd packages/static && pnpm build` - this implicitly compiles the frontend and reports typescript errors
44
46
-**IMPORTANT**: When modifying packages like `util` that other packages depend on, you must run `pnpm build` in the modified package before typechecking dependent packages
45
47
46
48
### Development
47
49
48
50
-**IMPORTANT**: Always run `prettier -w [filename]` immediately after editing any .ts, .tsx, .md, or .json file to ensure consistent styling
49
51
- After TypeScript or `*.tsx` changes, run `pnpm build` in the relevant package directory
52
+
- When editing the frontend, run `pnpm build-dev` in `packages/static`. This implicitly builds the frontend!
50
53
51
54
## Architecture Overview
52
55
@@ -166,18 +169,34 @@ CoCalc is organized as a monorepo with key packages:
166
169
167
170
CoCalc uses react-intl for internationalization with SimpleLocalize as the translation platform.
168
171
172
+
### Architecture Overview
173
+
174
+
-**Library**: Uses `react-intl` library with `defineMessages()` and `defineMessage()`
175
+
-**Default Language**: English uses `defaultMessage` directly - no separate English translation files
176
+
-**Supported Languages**: 19+ languages including German, Chinese, Spanish, French, Italian, Dutch, Russian, Japanese, Portuguese, Korean, Polish, Turkish, Hebrew, Hindi, Hungarian, Arabic, and Basque
177
+
-**Translation Platform**: SimpleLocalize with OpenAI GPT-4o for automatic translations
178
+
169
179
### Translation ID Naming Convention
170
180
171
181
Translation IDs follow a hierarchical pattern: `[directory].[subdir].[filename].[aspect].[label|title|tooltip|...]`
172
182
173
183
Examples:
184
+
174
185
-`labels.masked_files` - for common UI labels
175
186
-`account.sign-out.button.title` - for account sign-out dialog
176
187
-`command.generic.force_build.label` - for command labels
0 commit comments