|
| 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 | +HAL Foundation is the codebase for the next major version of the HAL management console for WildFly/JBoss. It produces two editions: |
| 8 | + |
| 9 | +- **halOP** (HAL On Premise) — successor to the current HAL console, ships with WildFly or runs standalone |
| 10 | +- **halOS** (HAL On OpenShift) — not yet implemented |
| 11 | + |
| 12 | +Java source is compiled to JavaScript via J2CL, bundled with Parcel, and optionally packaged in a Quarkus HTTP server for standalone deployment. |
| 13 | + |
| 14 | +## Build Commands |
| 15 | + |
| 16 | +```bash |
| 17 | +# Full build with tests and checks |
| 18 | +mvn clean verify |
| 19 | + |
| 20 | +# Build halOP (most common during development) |
| 21 | +mvn clean verify -P op |
| 22 | + |
| 23 | +# Production build |
| 24 | +mvn install -P op,prod |
| 25 | + |
| 26 | +# Quick build (skip tests and checks) |
| 27 | +mvn install -P quick-build |
| 28 | + |
| 29 | +# Native binary (requires GraalVM) |
| 30 | +mvn install -P op,prod,native -Dquarkus.native.container-build=false |
| 31 | + |
| 32 | +# Run a single test class |
| 33 | +mvn test -pl <module> -Dtest=<TestClassName> |
| 34 | + |
| 35 | +# Run a single test method |
| 36 | +mvn test -pl <module> -Dtest=<TestClassName>#<methodName> |
| 37 | +``` |
| 38 | + |
| 39 | +## Development Mode |
| 40 | + |
| 41 | +Two processes are needed simultaneously: |
| 42 | + |
| 43 | +1. **J2CL watch** (Java → JS compilation): `mvn j2cl:watch -P op` |
| 44 | + Wait for `Build Complete: ready for browser refresh` |
| 45 | +2. **Parcel watch** (HTML/CSS bundling): `cd op/console && npm run watch` |
| 46 | + Opens browser at http://localhost:1234 |
| 47 | + |
| 48 | +Java changes require manual browser refresh. HTML/CSS changes auto-reload via Parcel. |
| 49 | + |
| 50 | +## Code Formatting & Validation |
| 51 | + |
| 52 | +```bash |
| 53 | +./format.sh # Auto-format (license headers, editorconfig, imports) |
| 54 | +./validate.sh # Check formatting without modifying |
| 55 | +``` |
| 56 | + |
| 57 | +Enforced by: Checkstyle (WildFly ruleset), license-maven-plugin (Apache 2.0 headers), impsort-maven-plugin (import ordering). |
| 58 | + |
| 59 | +Style: 4-space indent, UTF-8, max line length 128, LF line endings. |
| 60 | + |
| 61 | +## Module Structure |
| 62 | + |
| 63 | +All code modules live under `code-parent` for shared dependency management: |
| 64 | + |
| 65 | +| Module | Purpose | |
| 66 | +|---|---| |
| 67 | +| `core` | Notifications, CRUD operations, label building | |
| 68 | +| `db` | Local database (PouchDB-based) | |
| 69 | +| `dmr` | DMR protocol communication with WildFly domain controller | |
| 70 | +| `environment` | Environment info and configuration | |
| 71 | +| `event` | Event system base classes | |
| 72 | +| `meta` | Metadata registry, statement context, resource address resolution | |
| 73 | +| `model` | Domain-driven model classes | |
| 74 | +| `resources` | Constants, string IDs, resource definitions | |
| 75 | +| `task` | Task interface and repository | |
| 76 | +| `ui` | UI formatters, model browser, filters | |
| 77 | + |
| 78 | +Application modules: |
| 79 | +- `op/console` — J2CL-compiled SPA (Parcel bundler, PatternFly 6) |
| 80 | +- `op/standalone` — Quarkus HTTP server wrapping the SPA |
| 81 | + |
| 82 | +Supporting modules: `bom` (dependency versions), `build-config` (checkstyle/license rules). |
| 83 | + |
| 84 | +## Architecture |
| 85 | + |
| 86 | +**Dependency Injection**: Crysknife CDI (Jakarta CDI-compatible, works with J2CL). Uses `@ApplicationScoped`, `@Inject` annotations. |
| 87 | + |
| 88 | +**Bootstrap Flow** (`op/console`): Sequential initialization via Elemento Flow — SetLogLevel → SelectEndpoint → SingleSignOnSupport → ReadEnvironment → ReadHostNames → FindDomainController → ReadStability → LoadSettings → SetTitle. |
| 89 | + |
| 90 | +**UI Framework**: PatternFly Java bindings over PatternFly 6 components, with Elemento for DOM abstraction. |
| 91 | + |
| 92 | +**Data Layer**: DMR operations for WildFly management API communication. PouchDB-based local database for caching. Async/Promise-based API pattern throughout. |
| 93 | + |
| 94 | +**Key Services**: |
| 95 | +- `Dispatcher` — executes DMR operations against WildFly |
| 96 | +- `MetadataRepository` — stores WildFly management model metadata |
| 97 | +- `StatementContext` — resolves placeholders in resource addresses |
| 98 | +- `CrudOperations` — abstract CRUD layer over DMR |
| 99 | +- `Notifications` — event-driven notification system |
| 100 | + |
| 101 | +## Tech Stack |
| 102 | + |
| 103 | +- Java 21, Maven 3.9.9+ (use `./mvnw` wrapper) |
| 104 | +- J2CL v0.23 (Java → JavaScript transpilation) |
| 105 | +- Crysknife CDI, Elemento, PatternFly Java |
| 106 | +- Parcel, Node.js, pnpm (frontend tooling) |
| 107 | +- Quarkus (standalone server) |
| 108 | +- JUnit 5 + Mockito (testing) |
| 109 | + |
| 110 | +## Issue Tracker |
| 111 | + |
| 112 | +Issues are tracked in JIRA: https://issues.redhat.com/projects/HAL |
0 commit comments