Package System

TLang has a built-in package market for sharing template libraries. Publish your generators once; install them anywhere with a single command. The market enables the full value loop: discover a template library, install it, generate your entire application stack, extend and publish your own.

Installing Packages

Search the market for available packages:

      tlang search quarkus
      tlang search kotlin-crud
    

Install a package by its slug:

      tlang install TLangGen/KotlinGen
    

Packages are downloaded to ~/.tlang/tbox/ and made available for use in your project. Reference them in your manifest.yml:

      dependencies:
        - TLangGen/KotlinGen/Kotlin 1.0.0:alpha:1 KotlinGen
    

Then import in your .tlang files:

      use KotlinGen as kotlin

      lang [kotlin] entity(pkg: String, name: String) {
          pkg ${pkg}
          impl[data class] ${name}(
              val id: Long,
              val name: String
          )
      }
    

Manifest Dependencies

The manifest.yml file declares project metadata and dependencies. TLang resolves dependencies automatically on the first compile or run.

      name: MyProject
      project: MyApp
      organisation: MyOrg
      version: 1.0.0
      stability: stable
      releaseNumber: 1
      main: Main

      author: Your Name
      website: https://your-site.com
      license: Apache-2.0

      dependencies:
        - TLangGen/KotlinGen/Kotlin 1.0.0:alpha:1 KotlinGen
        - TLangGen/QuarkusImpl/QuarkusImpl 1.0.0:alpha:1 QuarkusImpl
        - file://../../local-lib LocalLib
    

Dependency formats:

Run tlang both to compile, resolve dependencies, and execute in one step.

Publishing a Package

Log in to the market:

      tlang login
    

This prompts for your username and password and saves a JWT to ~/.tlang/market_token. For automated workflows, use an API key instead:

      tlang login --api-key YOUR_API_KEY
    

Package your project:

      tlang package
    

This compiles the project, bundles all source files and bytecode into a .tbag archive, and saves it locally. The archive includes the manifest, all .tlang source files, and the compiled bytecode. Publish to the market:

      tlang push
    

The package is uploaded to the market and immediately available for installation by anyone who runs tlang install with your package slug.

Versioning

Packages are versioned using four fields in the manifest:

When installing, you can pin to a specific version and stability:

      tlang install TLangGen/KotlinGen 1.0.0:stable
    

Or install the latest regardless of stability:

      tlang install TLangGen/KotlinGen
    

Pulling Without Installing

To download a package without installing it into your tbox:

      tlang pull TLangGen/KotlinGen
    

This downloads the .tbag archive to the current directory. Useful for inspecting a package or vendoring it into your project.

Local Packages and CLI Tools

TLang packages can also be installed as CLI tools. If a package exposes a main function or named commands, it becomes available as:

      tlang install MyOrg/MyCLITool
      tlang exec my-cli-tool
    

CLI packages are stored in ~/.tlang/cli/ and can be listed with:

      tlang exec --list
    

This enables distributing TLang-based code generation tools as self-contained packages that users install once and run anywhere.

The Full Value Loop

Here is the complete flow from zero to a working code generator:

  1. tlang search kotlin — find relevant template libraries on the market
  2. tlang install TLangGen/KotlinGen — install the Kotlin generator
  3. Create manifest.yml and Main.tlang — reference the installed package
  4. Add set declarations for your domain entities
  5. tlang both — generate your entire application stack
  6. Extend the templates for your specific needs
  7. tlang package && tlang push — publish your extended templates

The market creates a compound effect: each published package builds on others. A QuarkusImpl package imports KotlinGen and adds Panache/JAX-RS conventions. A MicroserviceStack imports QuarkusImpl and adds Kafka, OpenTelemetry, and observability boilerplate. Your team installs MicroserviceStack and gets the entire stack generated in one command.