|
| 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 | +SDKMAN! CLI is a bash-based command-line tool for managing parallel versions of multiple Software Development Kits on Unix-based systems. The project is primarily written in bash scripts with Groovy/Spock for testing using Cucumber BDD tests. |
| 8 | + |
| 9 | +**Important**: This project is in maintenance mode. Only bug fixes are accepted as the project is being rewritten in Rust under a new project. No new enhancements to existing commands will be accepted. |
| 10 | + |
| 11 | +## Development Environment |
| 12 | + |
| 13 | +- Requires JDK 11 (specified in `.sdkmanrc`) |
| 14 | +- Uses Gradle 8.0.1 for build management |
| 15 | +- Run `sdk env install` to install the correct JDK version |
| 16 | +- Run `sdk env` to switch to the appropriate SDK versions |
| 17 | + |
| 18 | +## Build and Test Commands |
| 19 | + |
| 20 | +### Core Commands |
| 21 | +- `./gradlew test` - Run all Cucumber BDD tests |
| 22 | +- `./gradlew clean` - Clean build artifacts |
| 23 | +- `./gradlew build` - Build the project |
| 24 | + |
| 25 | +### Development Setup |
| 26 | +Before starting development, ensure the correct Java version: |
| 27 | +```bash |
| 28 | +sdk env install # Install JDK from .sdkmanrc |
| 29 | +sdk env # Switch to correct SDK versions |
| 30 | +``` |
| 31 | + |
| 32 | +## Architecture |
| 33 | + |
| 34 | +### Code Structure |
| 35 | +- `src/main/bash/` - Core bash scripts implementing SDKMAN commands |
| 36 | + - `sdkman-main.sh` - Main entry point and command routing |
| 37 | + - `sdkman-init.sh` - Environment initialization and platform detection |
| 38 | + - Individual command scripts (e.g., `sdkman-install.sh`, `sdkman-list.sh`) |
| 39 | +- `src/test/groovy/` - Groovy test code using Spock framework |
| 40 | +- `src/test/resources/features/` - Cucumber feature files (BDD tests) |
| 41 | + |
| 42 | +### Core Components |
| 43 | +- **Command Router**: `sdkman-main.sh` handles command aliases and routing |
| 44 | +- **Environment Setup**: `sdkman-init.sh` manages platform detection and configuration |
| 45 | +- **Modular Commands**: Each SDKMAN command is implemented in its own bash script |
| 46 | +- **API Integration**: Commands interact with SDKMAN API for candidate information |
| 47 | + |
| 48 | +### Testing Strategy |
| 49 | +- **Cucumber BDD Tests**: Primary testing approach using Gherkin feature files |
| 50 | +- **Spock Unit Tests**: Some Groovy unit tests for specific components |
| 51 | +- Tests cover both happy path and edge cases |
| 52 | +- Mock external dependencies using WireMock |
| 53 | +- Test environment uses bash process execution |
| 54 | + |
| 55 | +### Configuration |
| 56 | +- `.sdkmanrc` file specifies required Java version (11.0.17-tem) |
| 57 | +- Environment-specific API endpoints configured in `build.gradle` |
| 58 | +- Supports local, beta, and stable environments |
| 59 | + |
| 60 | +## Key Files |
| 61 | +- `build.gradle` - Main build configuration with test dependencies |
| 62 | +- `src/main/bash/sdkman-main.sh` - Command entry point and routing |
| 63 | +- `src/test/groovy/sdkman/cucumber/RunCukeTests.groovy` - Cucumber test runner |
| 64 | +- `src/test/resources/features/` - BDD feature specifications |
| 65 | + |
| 66 | +## Testing Guidelines |
| 67 | +- All features should have Cucumber tests covering happy and unhappy paths |
| 68 | +- Tests should be written before implementation (TDD approach) |
| 69 | +- Use `@manual` and `@review` tags to exclude certain tests from automation |
| 70 | +- Mock external API calls using WireMock stubs |
0 commit comments