Metadata-Version: 2.4
Name: spring-cli
Version: 0.1.0
Summary: Interactive CLI to scaffold Spring Boot (Java/Kotlin) projects, similar to start.spring.io.
Author: Nikhil Vibhav
License-Expression: MIT
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: questionary>=2.1.1
Requires-Dist: requests>=2.34.2
Requires-Dist: rich>=15.0.0
Dynamic: license-file

# spring-cli

An interactive command-line scaffolder for Spring Boot projects (Java/Kotlin) —
like [start.spring.io](https://start.spring.io), but as a terminal wizard that
also layers in Docker, database/cache configuration, and CI out of the box.

## Install

```powershell
pipx install .
# or, for local development:
pip install -e .
```

## Usage

```powershell
spring-cli
```

You'll be walked through:

1. Language (Java / Kotlin) and build tool (Maven / Gradle)
2. Spring Boot & Java version (fetched live from start.spring.io metadata)
3. Group/Artifact ID and description
4. Web stack: reactive (WebFlux) vs non-reactive (Spring MVC)
5. Database: PostgreSQL, MySQL, MongoDB, H2, or none
6. Caching: Redis, Caffeine, or none
7. Extras: Spring Security, Actuator, Lombok, Docker + docker-compose, GitHub Actions CI

## How it works

- The base project (pom.xml/build.gradle, source tree, wrapper scripts) is
  generated by calling the real `start.spring.io/starter.zip` API, so it always
  reflects current Spring Boot dependency versions.
- `spring_cli/initializr.py` maps your wizard answers to Initializr
  dependency ids (e.g. reactive Postgres -> `postgresql` + `data-r2dbc`).
- `spring_cli/features/` then layers in anything Initializr doesn't provide:
  - `properties.py` appends datasource/cache settings to `application.properties`
  - `caching_overlay.py` injects the Caffeine library: for Gradle projects
    it's declared once in `gradle/libs.versions.toml` and referenced via the
    type-safe `libs.caffeine` accessor in `build.gradle`/`build.gradle.kts`;
    for Maven it's added directly to `pom.xml` (Maven has no version-catalog
    equivalent), resolved from Spring Boot's dependency-management BOM
  - `docker.py` writes a multi-stage `Dockerfile` (Alpine-based
    `eclipse-temurin` JDK/JRE images) that uses Spring Boot's own
    `jarmode=tools` layer extraction — the same mechanism the Spring Boot
    Maven/Gradle plugin's layered-jar packaging relies on — so dependency,
    loader, and application code each land in separate, independently
    cacheable Docker layers, with `JAVA_OPTS` for heap sizing; plus a
    `docker-compose.yml` with matching service definitions for your chosen
    database/cache
  - `ci.py` writes a `.github/workflows/ci.yml`: a `build` job (Maven or
    Gradle, with `actions/setup-java`'s built-in dependency caching) and,
    when Docker is enabled, a `docker` job that builds the image with
    `docker/build-push-action` using GitHub Actions cache (`type=gha`) so
    the layered-jar Docker cache persists across CI runs

## Project layout

```text
spring_cli/
  cli.py           entry point (spring-cli console script)
  wizard.py        questionary-based interactive prompts
  config.py        ProjectConfig dataclass shared across modules
  initializr.py    start.spring.io metadata + starter.zip client
  postprocess.py   runs all feature overlays after extraction
  features/
    properties.py       DB/cache application.properties
    caching_overlay.py  Caffeine dependency injection
    docker.py           Dockerfile + docker-compose.yml
    ci.py               GitHub Actions workflow
```
