← ClaudeAtlas

boxlang-runtime-cli-scriptinglisted

Use this skill when writing BoxLang CLI scripts and classes, handling command-line arguments, using the BoxLang REPL, running action commands (compile, cftranspile, featureaudit), detecting runtime context, and leveraging CLI-specific built-in functions.
ortus-boxlang/skills · ★ 0 · AI & Automation · score 58
Install: claude install-skill ortus-boxlang/skills
# BoxLang CLI Scripting ## Overview The `boxlang` binary can run scripts, classes, templates, and inline code directly from the command line. It supports multiple file types, shebang lines, structured argument parsing, and a built-in REPL. --- ## Supported File Types | Extension | Type | Entry Point | |-----------|------|-------------| | `.bx` | BoxLang class | `main(args=[])` method | | `.bxs` | BoxLang script | top-level code | | `.bxm` | BoxLang template | top-level markup/code | | `.cfs` / `.cfm` | CFML (via bx-compat-cfml) | top-level code | | `.sh` | Shell script with shebang | shebang `#!/usr/bin/env boxlang` | --- ## Running Files ```bash # Class with main() method boxlang MyApp.bx # Script file boxlang process.bxs --config=prod.json --debug # Template file boxlang render.bxm # Inline code boxlang --bx-code "println( 'Hello!' )" # From stdin echo "println( 'piped!' )" | boxlang # REPL (no arguments) boxlang ``` --- ## Class Entry Point (`main`) Use `.bx` files with a `main()` method for structured CLI applications: ```js class MyApp { static function main( args = [] ) { var parsed = CLIGetArgs() println( "Options: " & parsed.options.toString() ) println( "Positionals: " & parsed.positionals.toString() ) } } ``` --- ## Argument Parsing BoxLang parses CLI arguments automatically. Access them via `CLIGetArgs()` or `server.cli.parsed`: ```js // In a .bxs script var args = CLIGetArgs() // args = { options: { debug: true,