Last updated: 2026-09-07

CLI & Entrypoints

ZINC CLI

All API Sections

CLI entrypoints for configuring ZINC and starting local inference.

This module wires together GPU initialization, model loading, tokenization, and the single-process decode loop used for prompt-mode execution.

7 exports 0 methods src/main.zig

7 exports shown

variable

is_debug_mode

#
pub var is_debug_mode: bool = false

Global flag enabling verbose debug log output when `--debug` is passed or the `ZINC_DEBUG` env var is set.

src/main.zig:71

constant

std_options

#
pub const std_options = std.Options{

Zig standard library options — sets log level to debug and wires the custom log function.

src/main.zig:74

function

myLogFn

#
pub fn myLogFn( comptime level: std.log.Level, comptime scope: @TypeOf(.enum_literal), comptime format: []const u8, args: anytype, ) void

Custom log handler that filters debug messages unless `is_debug_mode` is set.

Parameters

level
Severity level; debug messages are suppressed when `is_debug_mode` is false.
scope
Call-site scope tag; displayed as `(<scope>):` or `: ` for the default scope.
format
Comptime format string passed through to `std.debug.print`.
args
Runtime arguments matched to `format`.

src/main.zig:84

struct

Config

#
pub const Config = struct

Runtime configuration built from CLI flags and default values.

src/main.zig:166

enum

Command

#
pub const Command = enum

Top-level CLI subcommands parsed from argv.

src/main.zig:231

function

parseArgs

#
pub fn parseArgs(args: []const [:0]const u8) !Config

Parse the process argument vector into a validated runtime configuration.

Parameters

args
Raw argv slice, including argv[0].

Returns

A populated Config value or a validation error describing the first invalid flag.

src/main.zig:558

function

main

#
pub fn main() !void

Parse arguments, dispatch model-management commands, run diagnostics, or start inference.

In prompt mode the engine runs up to `max_tokens` forward passes and prints the decoded output. In server mode an HTTP listener is started and requests are handled until SIGINT/SIGTERM.

Notes

Fatal startup errors are logged and the process exits rather than returning an error.

src/main.zig:2600