Logo

index : jinit

---

  • summary
  • about
  • tree
  • log
  • branches
https://git.ptrace.dev/public/jinit.git
ssh://git@git.ptrace.dev/public/jinit.git
JAI: 93%
MD: 7%

Jai Init

This program creates files and directories based on templates for Jai development.

[!WARNING] Jai version: beta 0.2.022 (15. Dec. 2025) cleaned up some syntax. The dot notation for implicitly calling structs can be omitted from now on.

Templates in this project will adapt to it in the future - probably in Q3 2026. I'm awaiting more syntax changes.

Build / Install

$ jai -version
Version: beta 0.2.024, built on 31 December 2025.
$ jai build.jai - silent release
  • The executable is stored as bin/jinit.
  • Add the binary to your $PATH or symlink it where appropriate

Usage

Init a minimal project:
$ jinit -t min

Init a library project:
$ jinit -t lib -r my_lib_name

Don't create a scm repo:
$ jinit -t min -g

Overview

$ init -help
    -g: If provided, no SCM repository will be created
    -l: List available template types
    -r: Replace the replace marker with a given string
    -t: Pass a template type

    -help, -HELP, -?: Show the list of commands.

Arg: -g

The default SCM is Git. But you can change it inside the build.jai.

Arg: -r <string>

Some templates support "replace markers". If they're present, you can pass a string via -r <string> and those markers get replaced with your string.

More informations inside templates/lib/rules_lib.jai.

Arg: -t <template type>

You can specify the exact template that should be used here. Use -l to list all available templates.

You can omit this argument, then it will use the default template, which you can configure in build.jai.

Templates

A template consists of two files: rules_*.jai and template.jai.

The template.jai can be named however you want. It contains the build script, which will be known as build.jai if you initialize your project.

The rules_*.jai has a strict naming, otherwise this program cannot find it.
In this file we declare which files and directories should be created upfront.

Examples

For example the templates/minimal creates this structure:

.
├── .git
├── .gitignore
├── build.jai
├── README.md
└── src
    └── main.jai

Where the templates/lib creates this:

.
├── .git
├── .gitignore
├── build.jai
├── my_lib
│   ├── lib.jai
│   └── module.jai
├── README.md
└── test
    └── test.jai

Create a Template

You can create a new template with those steps:

  1. create a new template directory in templates/<your dir>
  2. copy the empty (or any) template as starting point $ cp -r empty <your dir>
  3. start creating your build script in template.jai
  4. adapt the configuration in rules_*.jai
  5. recompile jinit via $ jai build.jai

Note: Inside the src/main.jai you can enable the DRY_RUN flag, which won't create any files and directories. It just logs the actions instead.

How does it Work

All templates get baked into the binary. So the final executable does not depend on any template files at runtime.

Basically, the build.jai collects all rules_*.jai files and creates the necessary data structures, which get baked into the src/main.jai file.

The main.jai file evaluates at compile time all rules and creates the final template as static [N]Rules array.

Credits

Procs build_release and build_debug are adapted from the Jai Wiki

Copyright 2026  E766CB298A6D1E64 | Git-Thing heavily inspired by cgit