Skip to content

Commit 8ee0d49

Browse files
vinokurigclaude
andauthored
docs: Add CLAUDE.md and enhance README with comprehensive documentation (#1032)
Add CLAUDE.md to provide guidance for AI-assisted development with detailed project structure, build commands, and architectural patterns. Enhance README with complete usage examples, API documentation, and improved project overview. Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>
1 parent 238d626 commit 8ee0d49

2 files changed

Lines changed: 358 additions & 32 deletions

File tree

CLAUDE.md

Lines changed: 146 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,146 @@
1+
# CLAUDE.md
2+
3+
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
4+
5+
## Project Overview
6+
7+
Che Server is the backend component of Eclipse Che - a Kubernetes-native IDE platform. It provides REST APIs for managing Kubernetes namespaces and retrieving devfile content from various Git hosting services (GitHub, GitLab, Bitbucket, Azure DevOps).
8+
9+
**Tech Stack:** Java 11, Apache Maven, Jakarta EE, Google Guice (dependency injection), Fabric8 Kubernetes Client, deployed as a WAR on Apache Tomcat.
10+
11+
## Build Commands
12+
13+
### Standard Build (with tests)
14+
```bash
15+
mvn clean install
16+
```
17+
18+
### Fast Build (skip tests and validation)
19+
```bash
20+
mvn clean install -V -e -Pfast -DskipTests -Dskip-validate-sources -Denforcer.skip=true
21+
```
22+
23+
### Run Specific Test
24+
```bash
25+
# Run a single test class
26+
mvn test -Dtest=ClassName
27+
28+
# Run a single test method
29+
mvn test -Dtest=ClassName#methodName
30+
```
31+
32+
### Build Container Image
33+
```bash
34+
./build/build.sh
35+
```
36+
37+
### Run Integration Tests
38+
Integration tests require Podman or Docker to be running. They use TestNG framework.
39+
40+
```bash
41+
mvn verify -Pintegration
42+
```
43+
44+
## Architecture
45+
46+
### Module Structure
47+
48+
The project is organized into five main Maven modules:
49+
50+
#### 1. **core/** - Foundation Layer
51+
- `che-core-api-core`: Core APIs, DTOs, REST framework, WebSocket support
52+
- `che-core-api-dto`: DTO serialization/deserialization framework
53+
- `che-core-api-model`: Shared data models
54+
- `commons/`: Common utilities (JSON, logging, dependency injection, tracing)
55+
- `che-core-metrics-core`: Metrics collection (Micrometer/Prometheus)
56+
- `che-core-tracing-*`: Distributed tracing (OpenTracing/Jaeger)
57+
58+
#### 2. **wsmaster/** - Business Logic Layer
59+
Contains all REST API implementations organized by feature domain:
60+
61+
**OAuth/Authentication Modules** (pattern: `che-core-api-auth-<provider>`):
62+
- `che-core-api-auth`: Base OAuth framework
63+
- `che-core-api-auth-github`, `che-core-api-auth-gitlab`, `che-core-api-auth-bitbucket`, `che-core-api-auth-azure-devops`: Provider-specific OAuth implementations
64+
- Each contains an `OAuthAuthenticator` and `OAuthAuthenticatorProvider`
65+
66+
**Factory Modules** (pattern: `che-core-api-factory-<provider>`):
67+
- `che-core-api-factory-shared`: Common factory interfaces
68+
- `che-core-api-factory-github`, `che-core-api-factory-gitlab`, `che-core-api-factory-bitbucket*`, `che-core-api-factory-azure-devops`: Provider-specific factory resolvers
69+
- Each implements: `ApiClient`, `FactoryParametersResolver`, `PersonalAccessTokenFetcher`, `ScmFileResolver`, `URLParser`, `UserDataFetcher`
70+
71+
**Other wsmaster Modules**:
72+
- `che-core-api-devfile`: Devfile parsing and validation
73+
- `che-core-api-workspace`: Workspace lifecycle management
74+
- `che-core-api-user`: User management APIs
75+
- `che-core-api-ssh`: SSH key management
76+
- `che-core-sql-schema`: Database schema definitions
77+
78+
#### 3. **infrastructures/** - Kubernetes Orchestration
79+
- `kubernetes/`: Base Kubernetes infrastructure implementation (uses Fabric8 client)
80+
- `openshift/`: OpenShift-specific extensions
81+
- `infrastructure-factory`: Infrastructure abstraction layer
82+
- `infrastructure-metrics`: Infrastructure-specific metrics
83+
84+
#### 4. **multiuser/** - Multi-tenancy
85+
Permission and authentication modules for multi-user deployments.
86+
87+
#### 5. **assembly/** - Packaging
88+
Assembles all modules into deployable WAR files.
89+
90+
### Key Architectural Patterns
91+
92+
**Dependency Injection**: Google Guice is used throughout. Each module defines a `*Module.java` class that binds interfaces to implementations.
93+
94+
**SCM Provider Pattern**: To add support for a new Git hosting provider, you must implement TWO modules:
95+
1. `che-core-api-auth-<provider>` for OAuth authentication
96+
2. `che-core-api-factory-<provider>` for devfile resolution and API operations
97+
98+
**Shared vs Provider-Specific**: Some providers have `-common` modules (e.g., `che-core-api-auth-github-common`) that contain shared logic between multiple instances of the same provider (e.g., github.com vs GitHub Enterprise).
99+
100+
## Development Workflow
101+
102+
### Running Tests
103+
The project uses TestNG (not JUnit). Test classes follow the pattern `*Test.java`.
104+
105+
### Code Style
106+
- Enforcer plugin validates dependencies and versions
107+
- Source validation can be skipped with `-Dskip-validate-sources`
108+
109+
### Container Image Development
110+
1. Build sources with fast profile
111+
2. Run `./build/build.sh` to create container image `quay.io/eclipse/che-server:next`
112+
3. Tag and push to your registry
113+
4. Deploy with `chectl server:deploy --platform=<openshift|minikube> --cheimage=<your-image> --debug`
114+
115+
### Debugging
116+
1. Deploy Che with `--debug` flag
117+
2. Run `chectl server:debug` to enable remote debugging
118+
3. Attach debugger to port exposed by chectl (default: 8000)
119+
120+
## Project-Specific Conventions
121+
122+
### Adding a New SCM Provider
123+
Follow the established pattern in wsmaster/:
124+
- Create `che-core-api-auth-<provider>` with `<Provider>OAuthAuthenticator` and `<Provider>OAuthAuthenticatorProvider`
125+
- Create `che-core-api-factory-<provider>` with the six required classes: `ApiClient`, `FactoryParametersResolver`, `PersonalAccessTokenFetcher`, `ScmFileResolver`, `URLParser`, `UserDataFetcher`
126+
- Each module needs a Guice `Module` class to register bindings
127+
128+
### Working with Kubernetes Resources
129+
The `infrastructures/kubernetes` module uses the Fabric8 Kubernetes Java client. Infrastructure provisioning is abstracted through factory interfaces in `infrastructure-factory`.
130+
131+
### Database Schema Changes
132+
Schema definitions are in `wsmaster/che-core-sql-schema`. Liquibase is used for migrations.
133+
134+
## CI/CD
135+
136+
GitHub Actions workflows handle:
137+
- PR builds: `.github/workflows/build-pr-check.yml`
138+
- Main branch builds: `.github/workflows/next-build.yml` (pushes to quay.io)
139+
- Releases: `.github/workflows/release.yml`
140+
- Sonar analysis: `.github/workflows/sonar.yaml`
141+
142+
## Resources
143+
144+
- **Issues**: https://github.com/eclipse/che/issues
145+
- **Documentation**: https://www.eclipse.org/che/docs/
146+
- **Devfile**: `devfile.yaml` in project root defines development container with Maven, JDK 17, and Podman

0 commit comments

Comments
 (0)