- Java 17+
- Docker
- Gradle (You can use Gradle Wrapper)
- Clone the repository:
git clone <repository-URL> cd <repository-name>
- add your deepl api-key to translate/src/main/resources/application.yml in key section
- Inside /gen with git bash write command
./build.sh(sometimes need before usedchmod +x build.sh)
-
Clone the repository:
git clone <repository-URL> cd <repository-name>
-
Build the project using Gradle:
./gradlew build
-
If you want to build the Docker image, use the following command:
docker build -t commmit-craft . -
Run the Docker container:
docker run -d -p 8090:8090 --name commmit-craft commmit-craft
-
The application will be available at
http://localhost:8090.
The translate module integrates with DeepL for machine translation. To use this feature, you need to provide your DeepL API key.
-
Go to the
translatemodule’sapplication.properties(orapplication.yml) file. -
Add your DeepL API key in the configuration:
deepl.api.key=YOUR_DEEPL_API_KEY -
Replace
YOUR_DEEPL_API_KEYwith your actual API key obtained from DeepL.
You can specify different profiles for the application. For example, to use the dev profile:
-
In
application.yml:spring.profiles.active=dev -
Alternatively, you can pass the active profile as a Docker environment variable:
docker run -d -p 8090:8090 -e SPRING_PROFILES_ACTIVE=kam --name commmit-craft commmit-craft
The Docker image uses Eclipse Temurin 17 and builds the application inside a Docker container. You can configure the profile or other settings when running the Docker container.
By default, the application will run on port 8090. To change this, modify the application.properties:
server.port=8090To run the tests for the application, use Gradle:
./gradlew testhttp://localhost:8090/swagger-ui/index.html
Besides the built-in templates (conventional, detailed, markdown, quickly), you can register your own via the API.
POST http://localhost:8090/api/v1/craft-template/dedicated
{
"name": "apilia-project-1",
"description": "Dedykowany dla projektu coś tam",
"pattern": "{ticket_id} {type}({scope}):{message}-{details}",
"model": {
"ticket_id": "Numer powiązanego zadania w JIRA",
"type": ["feat", "fix", "junk", "chore", "test"],
"scope": "[moduł lub komponent]",
"message": "Krótki opis zmiany",
"details": "Szczegóły zmian w treści commit message"
}
}Rules:
namemust be unique — creating a template with an existing name returns400.- Every placeholder used in
pattern({like_this}) must have a matching key inmodel, and everymodelkey must appear inpattern— otherwise the request is rejected with400and a message listing the mismatched keys. - On success you get
201with a confirmation message. The template then shows up inGET /api/v1/craft-template/alland can be removed withDELETE /api/v1/craft-template/removed/{name}.
Once a template exists (built-in or dedicated), fill it in with real values to get the final commit message:
POST http://localhost:8090/api/v1/craft-template/generate?templateName=conventional— built-in templatesPOST http://localhost:8090/api/v1/craft-template/generate-dedicated?templateName=apilia-project-1— dedicated templates
Body is the commit data matching the template's model keys, e.g.:
{
"ticket_id": "TEET-3455",
"type": "feat",
"scope": "auth",
"message": "Zrobiłem te funkcje na sztos",
"details": "Dodałem wiele różnych rzeczy i to jest fajne że mozna tak robić",
"language": "EN"
}Add an optional language field (e.g. "EN") to have every free-text model field (any key whose model value is a plain string, like message/details/scope above) translated via DeepL before the pattern is filled in. Fields whose model value is an array of allowed options (like type) are treated as fixed codes and are never translated. Omit language to keep the values exactly as sent, untranslated.
Persistence note: dedicated templates are stored in src/main/resources/templates/dedicated-meta-schema.json, resolved relative to the app's working directory — not read from the packaged jar's classpath. The Docker image copies this file in at build time so the endpoint works out of the box, but any template you add while the container is running is only written to that container's writable layer: it disappears once the container is removed/rebuilt. If you need dedicated templates to survive rebuilds, mount the folder as a volume, e.g.:
docker run -d -p 8090:8090 -v "$(pwd)/src/main/resources/templates:/commit-craft/src/main/resources/templates" --name commmit-craft commmit-craftThis project is licensed under the MIT License.
