Package commands
Wrap an existing executable or turn a native add-on into a loopback tool.
Wrap an existing CLI
A Rune package can declare one terminal command in [command]. Its installed alias is the command name. Each args entry is a literal argument or an option value passed as one argument. The program name describes the expected CLI. The operator chooses its absolute executable path.
[package]
name = "print-message"
version = "0.1.0"
description = "Wrap the local printf executable as a package command"
[command]
program = "printf"
description = "Print one message as plain text"
args = ["%s\n", { option = "message" }]
timeout_ms = 2000
max_output_bytes = 4096
Save the manifest as print-message/vectrune.toml beside your consuming project. From the consuming project on macOS or Linux, install the package and approve /usr/bin/printf. The approval prompt shows the executable digest, argument layout, and budgets.
vectrune deps install ../print-messagevectrune command approve print-message /usr/bin/printfvectrune print-message --message "Hello from an add-on"Vectrune launches the executable directly. Option values are required, and their first character cannot be a dash. The command uses the caller’s working directory, closes stdin, and starts with a minimal PATH. The timeout covers the subprocess and both streams. The output limit applies to stdout and stderr together.
Use --global for both installation and approval to run the command from other directories. Check or revoke the approval in the same scope. An executable or command declaration change requires fresh approval. For automation, pass the reviewed executable digest with --sha256.
vectrune command status print-messagevectrune command revoke print-messageExpose a package command
The [native.tool] table in the Echo manifest registers a local REST tool. Its entrypoint points to a package-relative .rune file. The section field selects a contributed section instance, and options map CLI flag names to settings on that instance.
@App
type = REST
@Echo/local
@Route/GET/echo
run:
input = { message: "Vectrune" }
result = echo.message local input
respond 200 result
From the consumer directory, stop the sample app and run these commands. Flags declared in options are required and their values arrive as strings. The tool prints a loopback URL and normally opens a browser. With --no-browser, open /echo on the printed URL yourself to see Hi Vectrune.
vectrune echo --help
vectrune echo --prefix Hi --no-browserInstall with --global to invoke the tool from other directories. Here the shared library is the positional argument, and --manifest locates the package. Use .so on Linux.
vectrune deps install ../target/debug/libvectrune_native_echo.dylib --manifest ../vectrune.toml --globalvectrune deps global listvectrune deps global remove echoThe installed alias becomes the CLI command. Core commands, existing files, and project aliases take precedence over global tools. Rune source imports remain project scoped.
Integrate another language or CLI
Rune has no general-purpose subprocess builtin. Use the native ABI for an in-process connector. For a separate Python, Node.js, or Go service, expose a GET endpoint and call it from Rune with fetch or fetch-json. A connector can also adapt a specific executable under operator control.
For a terminal command that launches a Rune app, put a shell launcher on PATH alongside the app or point it to the installed file. This launcher forwards Vectrune options to app.rune.
#!/bin/sh
exec vectrune "$(dirname "$0")/app.rune" "$@"