Skip to content

CLI Reference

The Jac CLI provides commands for running, building, testing, and deploying Jac applications.

💡 Enhanced Output: For beautiful, colorful terminal output with Rich formatting, install the optional jac-super plugin: pip install jac-super. All CLI commands will automatically use enhanced output with themes, panels, and spinners.

CommandDescription
jac runExecute a Jac file
jac startStart REST API server (use --scale for K8s deployment)
jac createCreate new project
jac checkType check code
jac testRun tests
jac formatFormat code
jac cleanClean project build artifacts
jac purgePurge global bytecode cache (works even if corrupted)
jac enterRun specific entrypoint
jac dotGenerate graph visualization
jac debugInteractive debugger
jac pluginsManage plugins
jac configManage project configuration
jac destroyRemove Kubernetes deployment (jac-scale)
jac addAdd packages to project
jac installInstall project dependencies
jac removeRemove packages from project
jac updateUpdate dependencies to latest compatible versions
jac jacpackManage project templates (.jacpack files)
jac grammarExtract and print the Jac grammar
jac scriptRun project scripts
jac py2jacConvert Python to Jac
jac jac2pyConvert Jac to Python
jac toolLanguage tools (IR, AST)
jac lspLanguage server
jac jsJavaScript output
jac buildBuild for target platform (jac-client)
jac setupSetup build target (jac-client)

Execute a Jac file.

Note: jac <file> is shorthand for jac run <file> - both work identically.

jac run [-h] [-m] [--no-main] [-c] [--no-cache] [--profile PROFILE] filename [args ...]
OptionDescriptionDefault
filenameJac file to runRequired
-m, --mainTreat module as __main__True
-c, --cacheEnable compilation cacheTrue
--profileConfiguration profile to load (e.g. prod, staging)""
argsArguments passed to the script (available via sys.argv[1:])

Like Python, everything after the filename is passed to the script. Jac flags must come before the filename.

Examples:

# Run a file
jac run main.jac
# Run without cache (flags before filename)
jac run --no-cache main.jac
# Pass arguments to the script
jac run script.jac arg1 arg2
# Pass flag-like arguments to the script
jac run script.jac --verbose --output result.txt

Passing arguments to scripts:

Arguments after the filename are available in the script via sys.argv:

# greet.jac
import sys;
with entry {
name = sys.argv[1] if len(sys.argv) > 1 else "World";
print(f"Hello, {name}!");
}
jac run greet.jac Alice # Hello, Alice!
jac run greet.jac # Hello, World!

sys.argv[0] is the script filename (like Python). For scripts that accept flags, use Python’s argparse module:

import argparse;
with entry {
parser = argparse.ArgumentParser();
parser.add_argument("--name", default="World");
args = parser.parse_args();
print(f"Hello, {args.name}!");
}
jac run greet.jac --name Alice

Start a Jac application as an HTTP API server. With the jac-scale plugin installed, use --scale to deploy to Kubernetes. Use --dev for Hot Module Replacement (HMR) during development.

jac start [-h] [-p PORT] [-m] [--no-main] [-f] [--no-faux] [-d] [--no-dev] [-a API_PORT] [-n] [--no-no_client] [--scale] [--no-scale] [-b] [--no-build] [filename]
OptionDescriptionDefault
filenameJac file to servemain.jac
-p, --portPort number8000
-m, --mainTreat as __main__True
-f, --fauxPrint docs only (no server)False
-d, --devEnable HMR (Hot Module Replacement) modeFalse
--api_portSeparate API port for HMR mode (0=same as port)0
--no_clientSkip client bundling/serving (API only)False
--scaleDeploy to Kubernetes (requires jac-scale)False
-b, --buildBuild Docker image before deploy (with --scale)False

Examples:

# Start with default main.jac on default port
jac start
# Start on custom port
jac start -p 3000
# Start with Hot Module Replacement (development)
jac start --dev
# HMR mode without client bundling (API only)
jac start --dev --no-client
# Deploy to Kubernetes (requires jac-scale plugin)
jac start --scale
# Build and deploy to Kubernetes
jac start --scale --build

Note:

  • If your project uses a different entry file (e.g., app.jac, server.jac), you can specify it explicitly: jac start app.jac

Initialize a new Jac project with configuration. Creates a project folder with the given name containing the project files.

jac create [-h] [-f] [-u USE] [-l] [name]
OptionDescriptionDefault
nameProject name (creates folder with this name)Current directory name
-f, --forceOverwrite existing projectFalse
-u, --useJacpac template: registered name, file path, or URLdefault
-l, --list-jacpacksList available jacpack templatesFalse

Examples:

# Create basic project (creates myapp/ folder)
jac create myapp
cd myapp
# Create full-stack project with client template (requires jac-client)
jac create myapp --use client
# Create from a local .jacpack file
jac create myapp --use ./my-template.jacpack
# Create from a local template directory
jac create myapp --use ./my-template/
# Create from a URL
jac create myapp --use https://example.com/template.jacpack
# List available jacpack templates
jac create --list-jacpacks
# Force overwrite existing
jac create myapp --force
# Create in current directory
jac create

See Also: Use jac jacpack to create and bundle custom templates.


Type check Jac code for errors.

jac check [-h] [-e] [-w] [--ignore PATTERNS] [-p] [--nowarn] paths [paths ...]
OptionDescriptionDefault
pathsFiles/directories to checkRequired
-e, --print_errsPrint detailed error messagesTrue
-w, --warnonlyTreat errors as warningsFalse
--ignoreComma-separated list of files/folders to ignoreNone
-p, --parse_onlyOnly check syntax (skip type checking)False
--nowarnSuppress warning outputFalse

Examples:

# Check a file
jac check main.jac
# Check a directory
jac check src/
# Warnings only mode
jac check main.jac -w
# Check directory excluding specific folders/files
jac check myproject/ --ignore fixtures tests
# Check excluding multiple patterns
jac check . --ignore node_modules dist __pycache__

Run tests in Jac files.

jac test [-h] [-t TEST_NAME] [-f FILTER] [-x] [-m MAXFAIL] [-d DIRECTORY] [-v] [filepath]
OptionDescriptionDefault
filepathTest file to runNone
-t, --test_nameSpecific test nameNone
-f, --filterFilter tests by patternNone
-x, --xitExit on first failureFalse
-m, --maxfailMax failures before stopNone
-d, --directoryTest directoryNone
-v, --verboseVerbose outputFalse

Examples:

# Run all tests in a file
jac test main.jac
# Run tests in directory
jac test -d tests/
# Run specific test
jac test main.jac -t my_test
# Stop on first failure
jac test main.jac -x
# Verbose output
jac test main.jac -v

Format Jac code according to style guidelines. For auto-linting (code corrections like combining consecutive has statements, converting @staticmethod to static), use jac lint --fix instead.

jac format [-h] [-s] [-l] paths [paths ...]
OptionDescriptionDefault
pathsFiles/directories to formatRequired
-s, --to_screenPrint to stdout instead of writingFalse
-l, --lintfixAlso apply auto-lint fixes in the same passFalse

Examples:

# Preview formatting
jac format main.jac -t
# Apply formatting
jac format main.jac
# Format entire directory
jac format .

Note: For auto-linting (code corrections), use jac lint --fix instead. See jac lint below.


Lint Jac files and report violations. Use --fix to auto-fix violations.

jac lint [-h] [-f] [--ignore IGNORE] paths [paths ...]
OptionDescriptionDefault
pathsFiles/directories to lintRequired
-f, --fixAuto-fix lint violationsFalse
--ignoreComma-separated files/folders to ignore""

Examples:

# Report lint violations
jac lint main.jac
# Auto-fix violations
jac lint main.jac --fix
# Lint entire directory
jac lint .
# Lint excluding folders
jac lint . --ignore fixtures

Lint Rules: Configure rules via [check.lint] in jac.toml. All enabled rules are treated as errors.


Run a specific entrypoint in a Jac file.

jac enter [-h] [-m] [-r ROOT] [-n NODE] filename entrypoint [args ...]
OptionDescriptionDefault
filenameJac fileRequired
entrypointFunction/walker to invoke (positional)Required
argsArguments to passNone
-m, --mainTreat as __main__True
-r, --rootRoot executor IDNone
-n, --nodeStarting node IDNone

Examples:

# Run specific entrypoint
jac enter main.jac my_walker
# With arguments
jac enter main.jac process_data arg1 arg2
# With root and node
jac enter main.jac my_walker -r root_id -n node_id

Generate DOT graph visualization.

jac dot [-h] [-s SESSION] [-i INITIAL] [-d DEPTH] [-t] [-b] [-e EDGE_LIMIT] [-n NODE_LIMIT] [-o SAVETO] [-p] [-f FORMAT] filename [connection ...]
OptionDescriptionDefault
filenameJac fileRequired
-s, --sessionSession identifierNone
-i, --initialInitial node IDNone
-d, --depthMax traversal depth-1 (unlimited)
-t, --traverseEnable traversal modeFalse
-c, --connectionConnection filtersNone
-b, --bfsUse BFS traversalFalse
-e, --edge_limitMax edges512
-n, --node_limitMax nodes512
-o, --savetoOutput file pathNone
-p, --to_screenPrint to stdoutFalse
-f, --formatOutput formatdot

Examples:

# Generate DOT output
jac dot main.jac -s my_session --to_screen
# Save to file
jac dot main.jac -s my_session --saveto graph.dot
# Limit depth
jac dot main.jac -s my_session -d 3

Start interactive debugger.

jac debug [-h] [-m] [-c] filename
OptionDescriptionDefault
filenameJac file to debugRequired
-m, --mainRun main entryTrue
-c, --cacheUse cacheFalse

Examples:

# Start debugger
jac debug main.jac

Manage Jac plugins.

jac plugins [-h] [-v] [action] [names ...]
ActionDescription
listList installed plugins (default)
infoShow plugin information
enableEnable plugins
disableDisable plugins
disabledList disabled plugins
OptionDescriptionDefault
-v, --verboseVerbose outputFalse

Examples:

# List plugins (action defaults to 'list')
jac plugins
# Explicitly list plugins
jac plugins list
# Show info about a plugin
jac plugins info byllm
# Disable a plugin
jac plugins disable byllm
# Enable a plugin
jac plugins enable byllm
# List disabled plugins
jac plugins disabled

Note: To install or uninstall plugins, use pip install / pip uninstall directly. The jac plugins command manages enabled/disabled state for already-installed plugins.

💡 Popular Plugins:

  • jac-super: Enhanced console output with Rich formatting, colors, and spinners (pip install jac-super)
  • jac-client: Full-stack web development with client-side rendering (pip install jac-client)
  • jac-scale: Kubernetes deployment and scaling (pip install jac-scale)

View and modify project configuration settings in jac.toml.

jac config [action] [key] [value] [-g GROUP] [-o FORMAT]
ActionDescription
showDisplay explicitly set configuration values (default)
listDisplay all settings including defaults
getGet a specific setting value
setSet a configuration value
unsetRemove a configuration value (revert to default)
pathShow path to config file
groupsList available configuration groups
OptionDescriptionDefault
keyConfiguration key (positional, e.g., project.name)None
valueValue to set (positional)None
-g, --groupFilter by configuration groupNone
-o, --outputOutput format (table, json, toml)table

Configuration Groups:

  • project - Project metadata (name, version, description)
  • run - Runtime settings (cache, session)
  • build - Build settings (typecheck, output directory)
  • test - Test settings (verbose, filters)
  • serve - Server settings (port, host)
  • format - Formatting options
  • check - Type checking options
  • dot - Graph visualization settings
  • cache - Cache configuration
  • plugins - Plugin management
  • environment - Environment variables

Examples:

# Show explicitly set configuration
jac config show
# Show all settings including defaults
jac config list
# Show settings for a specific group
jac config show -g project
# Get a specific value
jac config get project.name
# Set a value
jac config set project.version "2.0.0"
# Remove a value (revert to default)
jac config unset run.cache
# Show config file path
jac config path
# List available groups
jac config groups
# Output as JSON
jac config show -o json
# Output as TOML
jac config list -o toml

Deploy to Kubernetes using the jac-scale plugin. See the jac start command above for full options.

jac start --scale # Deploy without building
jac start --scale --build # Build and deploy

Remove a deployment.

jac destroy [-h] file_path
OptionDescriptionDefault
file_pathJac file to undeployRequired

Examples:

jac destroy main.jac

Add packages to your project’s dependencies. Requires at least one package argument (use jac install to install all existing dependencies). When no version is specified, the package is installed unconstrained and then the installed version is queried to record a ~=X.Y compatible-release spec in jac.toml.

jac add [-h] [-d] [-g GIT] [-v] [packages ...]
OptionDescriptionDefault
packagesPackage specifications (required)None
-d, --devAdd as dev dependencyFalse
-g, --gitGit repository URLNone
-v, --verboseShow detailed outputFalse

With jac-client plugin:

OptionDescriptionDefault
--npmAdd as client-side (npm) packageFalse

Examples:

# Add a package (records ~=2.32 based on installed version)
jac add requests
# Add with explicit version constraint
jac add "numpy>=1.24"
# Add multiple packages
jac add numpy pandas scipy
# Add as dev dependency
jac add pytest --dev
# Add from git repository
jac add --git https://github.com/user/package.git
# Add npm package (requires jac-client)
jac add react --npm

Sync the project environment to jac.toml. Installs all Python (pip), git, and plugin-provided (npm, etc.) dependencies in one command. Creates or validates the project virtual environment at .jac/venv/.

jac install [-h] [-d] [-v]
OptionDescriptionDefault
-d, --devInclude dev dependenciesFalse
-v, --verboseShow detailed outputFalse

Examples:

# Install all dependencies
jac install
# Install including dev dependencies
jac install --dev
# Install with verbose output
jac install -v

Remove packages from your project’s dependencies.

jac remove [-h] [-d] [packages ...]
OptionDescriptionDefault
packagesPackage names to removeNone
-d, --devRemove from dev dependenciesFalse

With jac-client plugin:

OptionDescriptionDefault
--npmRemove client-side (npm) packageFalse

Examples:

# Remove a package
jac remove requests
# Remove multiple packages
jac remove numpy pandas
# Remove dev dependency
jac remove pytest --dev
# Remove npm package (requires jac-client)
jac remove react --npm

Update dependencies to their latest compatible versions. For each updated package, the installed version is queried and a ~=X.Y compatible-release spec is written back to jac.toml.

jac update [-h] [-d] [-v] [packages ...]
OptionDescriptionDefault
packagesSpecific packages to update (all if empty)None
-d, --devInclude dev dependenciesFalse
-v, --verboseShow detailed outputFalse

Examples:

# Update all dependencies to latest compatible versions
jac update
# Update a specific package
jac update requests
# Update all including dev dependencies
jac update --dev

Clean project build artifacts from the .jac/ directory.

jac clean [-h] [-a] [-d] [-c] [-p] [-f]
OptionDescriptionDefault
-a, --allClean all .jac artifacts (data, cache, packages, client)False
-d, --dataClean data directory (.jac/data)False
-c, --cacheClean cache directory (.jac/cache)False
-p, --packagesClean virtual environment (.jac/venv)False
-f, --forceForce clean without confirmation promptFalse

By default (no flags), jac clean removes only the data directory (.jac/data).

Examples:

# Clean data directory (default)
jac clean
# Clean all build artifacts
jac clean --all
# Clean only cache
jac clean --cache
# Clean data and cache directories
jac clean --data --cache
# Force clean without confirmation
jac clean --all --force

💡 Troubleshooting Tip: If you encounter unexpected syntax errors, “NodeAnchor is not a valid reference” errors, or other strange behavior after modifying your code, try clearing the cache with jac clean --cache (rm -rf .jac) or jac purge. Stale bytecode can cause issues when source files change.


Purge the global bytecode cache. Works even when the cache is corrupted.

jac purge

When to use:

  • After upgrading Jaseci packages
  • When encountering cache-related errors (jaclang.pycore, NodeAnchor, etc.)
  • When setup stalls during first-time compilation
CommandScope
jac clean --cacheLocal project (.jac/cache/)
jac purgeGlobal system cache

Manage project templates. Bundle template directories into distributable .jacpack files or list available templates.

jac jacpack [action] [path] [-o OUTPUT]
ActionDescription
packBundle a template directory into a .jacpack file
listList available templates (default)
infoShow information about a template
OptionDescriptionDefault
pathTemplate directory (for pack) or .jacpack file (for info)None
-o, --outputOutput file path for bundled template<name>.jacpack

Template Directory Structure:

A template directory should contain:

  • jac.toml - Project config with a [jacpack] section for metadata
  • Template files (.jac, .md, etc.) with {{name}} placeholders

To make any Jac project packable as a template, simply add a [jacpack] section to your jac.toml. All other sections become the config for created projects.

Example jac.toml for a template:

# Standard project config (becomes the created project's jac.toml)
[project]
name = "{{name}}"
version = "0.1.0"
entry-point = "main.jac"
[dependencies]
# Jacpac metadata - used when packing, stripped from created projects
[jacpack]
name = "mytemplate"
description = "My custom project template"
jaclang = "0.9.0"
[[jacpack.plugins]]
name = "jac-client"
version = "0.1.0"
[jacpack.options]
directories = [".jac"]
root_gitignore_entries = [".jac/"]

Examples:

# List available templates
jac jacpack list
# Bundle a template directory
jac jacpack pack ./my-template
# Bundle with custom output path
jac jacpack pack ./my-template -o custom-name.jacpack
# Show template info
jac jacpack info ./my-template
jac jacpack info mytemplate.jacpack

Using Templates with jac create:

Once a template is registered, use it with the --use flag:

jac create myproject --use mytemplate

Generate JavaScript output from Jac code (used for jac-client frontend compilation).

jac js [-h] filename
OptionDescriptionDefault
filenameJac file to compile to JSRequired

Examples:

# Generate JS from Jac file
jac js app.jac

Extract and print the Jac grammar.

jac grammar [-h] [--lark] [-o OUTPUT]
OptionDescriptionDefault
--larkOutput in Lark format instead of EBNFFalse
-o, --outputWrite output to file instead of stdoutNone

Examples:

# Print grammar in EBNF format
jac grammar
# Print in Lark format
jac grammar --lark
# Save to file
jac grammar -o grammar.ebnf

Run custom scripts defined in the [scripts] section of jac.toml.

jac script [-h] [-l] [name]
OptionDescriptionDefault
nameScript name to runNone
-l, --list_scriptsList available scriptsFalse

Examples:

# Run a script
jac script dev
# List available scripts
jac script --list

See Configuration: Scripts for defining scripts in jac.toml.


Convert Python code to Jac.

jac py2jac filename

Examples:

jac py2jac script.py

Convert Jac code to Python.

jac jac2py filename

Examples:

jac jac2py main.jac

Access language tools (IR, AST, etc.).

jac tool tool [args ...]

Available tools:

# View IR options
jac tool ir
# View AST
jac tool ir ast main.jac
# View symbol table
jac tool ir sym main.jac
# View generated Python
jac tool ir py main.jac

Generate and install shell completion scripts for the jac CLI.

jac completions [-h] [-s SHELL] [-i] [--no-install]
OptionDescriptionDefault
-s, --shellShell type (bash, zsh, fish)bash
-i, --installAuto-install completion to shell configFalse

When --install is used, the completion script is written to ~/.jac/completions.<shell> (e.g. ~/.jac/completions.bash) and a source line is added to your shell config file (~/.bashrc, ~/.zshrc, or ~/.config/fish/config.fish).

Installed files:

ShellCompletion scriptConfig modified
bash~/.jac/completions.bash~/.bashrc
zsh~/.jac/completions.zsh~/.zshrc
fish~/.jac/completions.fish~/.config/fish/config.fish

Examples:

# Print bash completion script to stdout
jac completions
# Auto-install for bash (writes to ~/.jac/completions.bash)
jac completions --install
# Generate zsh completions
jac completions --shell zsh
# Auto-install for fish
jac completions --shell fish --install

Note: After installing, run source ~/.bashrc (or restart your shell) to activate completions. Completions cover subcommands, options, and file paths.


Start the Language Server Protocol server (for IDE integration).

jac lsp

Plugins can add new commands and extend existing ones. These commands are available when the corresponding plugin is installed.

Requires: pip install jac-client

Build a Jac application for a specific target.

jac build [filename] [--client TARGET] [-p PLATFORM]
OptionDescriptionDefault
filenamePath to .jac filemain.jac
--clientBuild target (web, desktop)web
-p, --platformDesktop platform (windows, macos, linux, all)Current platform

Examples:

# Build web target (default)
jac build
# Build desktop app
jac build --client desktop
# Build for Windows
jac build --client desktop --platform windows

One-time initialization for a build target.

jac setup <target>

Examples:

# Setup Tauri for desktop builds
jac setup desktop
Base CommandAdded FlagDescription
jac create--use clientCreate full-stack project template
jac create--skipSkip npm package installation
jac start--client <target>Client build target for dev server
jac add--npmAdd npm (client-side) dependency
jac remove--npmRemove npm (client-side) dependency

# Create project
jac create myapp
cd myapp
# Run
jac run main.jac
# Test
jac test -v
# Lint and fix
jac lint . --fix
# Start locally
jac start -p 8000
# Deploy to Kubernetes
jac start main.jac --scale
# Remove deployment
jac destroy main.jac