Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
149 changes: 69 additions & 80 deletions README.md → .github/README.md
Original file line number Diff line number Diff line change
@@ -1,39 +1,63 @@
## Clean Architecture Generator

A CLI and Android Studio plugin for generating Clean Architecture boilerplate including whole projects, features, data sources, use cases, ViewModels, and architecture packages.

### Android Studio plugin
# Clean Architecture Generator ✨

A CLI and Android Studio plugin for generating Clean Architecture boilerplate.

## Table of Contents
<hr />

- [Key features](#key-features)
- [Android Studio plugin](#android-studio-plugin)
- [Usage](#usage)
- [CLI](#cli)
- [Installation](#installation)
- [Usage](#usage-1)
- [Common examples](#common-examples)
- [Manual page (optional)](#manual-page-optional)
- [Configuration (.cagrc)](#configuration-cagrc)
- [Contributing](#contributing)
- [Support](#support)
- [Sponsor](#sponsor)
- [License](#license)

## Key features

| | Android Studio Plugin | CLI |
|--------------------------------|:---------------------:|:---:|
| New Clean Architecture project | ✔️ | ✔️ |
| Generate Architecture package | ✔️ | ✔️ |
| Generate a new feature | ✔️ | ✔️ |
| Generate a use case | ✔️ | ✔️ |
| Generate a ViewModel | ✔️ | ✔️ |
| Generate a data source | ✔️ | ✔️ |
| Automatic git staging | ✔️ | ✔️ |
| Configurable | ✔️ | ✔️ |

**Android Studio Plugin** is available on the IDE Plugins Marketplace.

**Terminal command** is available via Homebrew.

## Android Studio plugin

Adds multiple time-saving code generation shortcuts to Android Studio.

For a working project example, visit [Clean Architecture For Android](https://github.com/EranBoudjnah/CleanArchitectureForAndroid).
### Usage

Key features:
#### New Clean Architecture project
Navigate to `File` > `New` > `New Project...` and select the **Clean Architecture** template.

- **Android Studio Plugin**
- Available on the IDE Plugins Marketplace
- New Clean Architecture project template
- New menu items:
- New architecture package
- New feature
- New use case in domain modules
- New ViewModel in presentation modules
- New data source
#### Plugin shortcuts
Right-click on relevant directories and expand the `New` menu item.

#### Settings
Settings are available under `Tools` > `Clean Architecture`.

- **Terminal command**
- Available via Homebrew
- Generate:
- New Clean Architecture project
- New architecture package
- New feature
- New use case in domain modules
- New ViewModel in presentation modules
- New data source
For a working project example, visit [Clean Architecture For Android](https://github.com/EranBoudjnah/CleanArchitectureForAndroid).

### CLI usage
## CLI

Helps generate Android Clean Architecture code from the terminal.
Generates Clean Architecture Android code from your terminal.

### Installation

- **Install via Homebrew:**

Expand All @@ -42,13 +66,6 @@ brew tap EranBoudjnah/cag
brew install EranBoudjnah/cag/cag
```

- **Run via Gradle (no install):**

```bash
./gradlew :cli:run --args="--new-feature --name=MyFeature"
./gradlew :cli:run --args="--new-view-model --name=MyViewModel"
```

- **Run via installed script:**

```bash
Expand All @@ -57,15 +74,14 @@ brew install EranBoudjnah/cag/cag
"./cli/build/install/cag/bin/cag" --new-view-model --name=MyViewModel
```

- **Run the fat jar:**
- **Run via Gradle (no install):**

```bash
./gradlew :cli:shadowJar
java -jar "cli/build/libs/cag-[version]-all.jar" --new-feature --name=MyFeature
java -jar "cli/build/libs/cag-[version]-all.jar" --new-view-model --name=MyViewModel
./gradlew :cli:run --args="--new-feature --name=MyFeature"
./gradlew :cli:run --args="--new-view-model --name=MyViewModel"
```

#### Usage and help
### Usage

Usage (canonical):

Expand All @@ -75,9 +91,9 @@ cag [--new-project --name=ProjectName --package=PackageName [--no-compose] [--kt

- Full reference: `cag --help`
- Topic help: `cag --help --topic=new-feature` or `cag --help -t new-use-case`
- Man page: `man cag` (see below for generating/installing locally)
- Man page: `man cag` (see [Manual page (optional)](#Manual-page-optional) below for generating/installing locally)

Common examples:
### Common examples

```bash
# Generate a new project
Expand All @@ -99,7 +115,9 @@ cag --new-use-case --name=FetchUser --path=architecture/domain/src/main/kotlin
cag --new-view-model --name=Profile
```

Manual page (optional):
### Manual page (optional)

If you prefer to use `man` to read your documentation, this section is for you.

```bash
# Generate man page (writes cli/build/man/cag.1)
Expand All @@ -112,7 +130,7 @@ Manual page (optional):
man cag
```

### CLI configuration (.cagrc)
### Configuration (.cagrc)

You can configure library and plugin versions used by the CLI via a simple INI-style config file named `.cagrc`.

Expand Down Expand Up @@ -153,43 +171,14 @@ okhttp3=4.12.0

With the above, new projects will use `composeBom=2025.09.01` (from project), `kotlin=2.2.10` (from home). For operations on existing projects, `retrofit=2.11.0` (home) and `okhttp3=4.12.0` (project) will be applied.

### CLI configuration (.cagrc)

You can configure library and plugin versions used by the CLI via a simple INI-style config file named `.cagrc`.

- Locations:
- Project root: `./.cagrc`
- User home: `~/.cagrc`

- Precedence:
- Values in the project `.cagrc` override values in `~/.cagrc`.

- Sections:
- `[new.versions]` — applied when generating new projects (e.g., `--new-project`).
- `[existing.versions]` — applied when generating into an existing project (e.g., new architecture, feature, data source, use case, or view model).

- Keys correspond to version keys used by the generator, for example: `kotlin`, `androidGradlePlugin`, `composeBom`, `composeNavigation`, `retrofit`, `ktor`, `okhttp3`, etc.

Example `~/.cagrc`:

```
[new.versions]
kotlin=2.2.10
composeBom=2025.08.01

[existing.versions]
retrofit=2.11.0
ktor=3.0.3
```
## Contributing
Contributions to this project are welcome. Learn about [contributing](https://github.com/ArmynC/ArminC-AutoExec/blob/master/.github/CONTRIBUTING.md).

Example `./.cagrc` (project overrides):
## Support
Reach out to me via my **[profile page](https://github.com/EranBoudjnah)**.

```
[new.versions]
composeBom=2025.09.01

[existing.versions]
okhttp3=4.12.0
```
## Sponsor
[![Donation](https://img.shields.io/badge/Buy%20Me%20a%20Coffee-%5E%5E-green?style=flat&logo=undertale&logoColor=red&color=white)](https://github.com/sponsors/EranBoudjnah)

With the above, new projects will use `composeBom=2025.09.01` (from project), `kotlin=2.2.10` (from home). For operations on existing projects, `retrofit=2.11.0` (home) and `okhttp3=4.12.0` (project) will be applied.
## License
[![License: MIT](https://img.shields.io/badge/License-MIT-lightgrey.svg)](https://www.tldrlegal.com/license/mit-license)