runx is a repo command runner for .NET projects, currently in beta. It is meant to
be the command palette/front door for a repo, not a replacement for NUKE, Cake,
FAKE, MSBuild, or other heavier build systems.
Requires the .NET 10 SDK. PowerShell tasks also require PowerShell 7.
Install the beta from NuGet:
dotnet tool install --global MysterNybble.Runx --version 1.0.0-beta.2Update to the latest version, including betas:
dotnet tool update --global MysterNybble.Runx --prereleaseRemove it with dotnet tool uninstall --global MysterNybble.Runx.
From a repo that does not yet have a runx.json, create and run a starter task:
runx --init
runx dotnet-version
runx --listThe starter task prints your .NET SDK version. Edit runx.json to add your
repo's build and test commands, or add scripts under eng/tasks/ as described
below. Run runx to choose a task interactively, or runx --guide for the
built-in task authoring guide.
runx reads runx.json:
{
"$schema": "https://raw.githubusercontent.com/joshucar/runx/master/schemas/v1/runx.schema.json",
"version": 1,
"tasks": {
"build": {
"description": "Build the repo.",
"command": "dotnet",
"args": ["build"]
},
"test": {
"description": "Build, then run the tests.",
"command": "dotnet",
"args": ["test", "--no-build"],
"dependsOn": ["build"]
},
"smoke": {
"description": "Run a PowerShell smoke check.",
"script": "Write-Output smoke",
"shell": "pwsh"
},
"ci": {
"description": "Test and smoke check.",
"dependsOn": ["test", "smoke"]
}
}
}Each task defines one of:
commandplus optionalargs: launches the executable directly, without a shell. Bare names are looked up only onPATH, including aPATHset in the task'senv(on Windows this includes.cmdand.batshims such asnpm). Relative paths such as./build.shresolve from the task'scwd.scriptplusshell: runs the script text withcmd,pwsh, orsh. A one-linecmdscript runs likecmd /c; a multi-line one runs as a temporary batch file, soforloops need%%i. As in a batch file orshscript, a failing line does not stop the script; add|| exit /b(cmd) orset -e(sh) where that matters.- only
dependsOn: runs its dependencies and nothing else.
Optional task properties:
description: shown byrunx --listand the picker.dependsOn: tasks to run first, in the order listed. Dependencies of dependencies run first too, and each task runs at most once. The run stops at the first task that fails, and Ctrl+C stops it even if the interrupted task exits cleanly. Cycles and unknown task names are config errors. Entries can be task names or objects withtaskand fixedargs, as below.cwd: working directory, relative to the directory containingrunx.json. Defaults to that directory.env: environment variables added to the task's process.
Unknown properties are errors. The JSON schema lives in
schemas/v1/runx.schema.json.
To invoke a dependency with fixed arguments, use an object in dependsOn:
"prod:release": {
"dependsOn": [
"prod:build",
{ "task": "prod:deploy", "args": ["--standby"] }
]
}The arguments are appended to prod:deploy's configured arguments, just as
with runx prod:deploy -- --standby. They apply only to this dependency call,
not to its dependencies or to other callers. runx passes the strings through
without interpreting options. This works for command tasks and discovered
script tasks; inline shell tasks and dependency-only tasks do not accept
arguments. Calls to the same task with identical arguments run once. Conflicting
arguments in a dependency graph are rejected before any task runs; use distinct
task names when separate invocations are needed.
Tasks run attached to the current console, so colors, progress output, and
prompts behave as if the command were run directly. runx exits with the task's
exit code. On Windows, .cmd and .bat commands receive their arguments
escaped for cmd.exe, so characters such as &, |, %, and " arrive
intact instead of being interpreted.
For a task with dependencies, runx prints numbered step headers and a final
summary with each step's elapsed time and status (OK, FAILED, INTERRUPTED,
or SKIPPED), plus the total elapsed time. These messages go to stderr, leaving
the tasks' stdout available for piping. A task without dependencies runs without
these extra messages.
runx --guide # how to add tasks, plus where they go in this repo
runx --check # validate everything without running anything
runx --info <task> # what a task runs, where it comes from, its plan
runx --list --json # every task, including hidden ones, as JSON
runx --install-skill # install the runx skill for Claude Code--guide is built into the tool, so it always matches the installed version,
and it ends with details for the current repo, such as where new scripts go.
--check also warns about scripts that were skipped and header mistakes such
as a misspelled key, and --check --json and --info <task> --json give the
same information as JSON.
runx --install-skill writes ~/.claude/skills/runx/SKILL.md (or under
CLAUDE_CONFIG_DIR). Claude Code then uses it whenever it is asked to add or
run tasks, and the skill tells it to start with runx --guide, so a fresh
session can handle "add a runx task that does X" without further
instructions. Run it again after updating runx; it reports when the skill is
already up to date.
runx
runx --list
runx build
runx build -- --configuration Release
runx --dry-run build
runx --initRunning runx with no task opens a picker: use the arrow keys or type to
filter by name or description, press Enter to run the task, or Esc to clear the
filter and then cancel. A status bar under the list shows what the highlighted
task runs: its command line or script, plus its dependencies, cwd, and env
names. When input or output is redirected (CI, pipes), runx prints the task
list instead. runx --list always prints the list, and runx --dry-run picks a
task and shows what would run, including the full dependency plan.
Arguments after -- are appended to the requested command task's args, not
to its dependencies. Shell tasks and dependsOn-only tasks do not accept extra
arguments.
By default, config discovery stays inside the current Git repo. Outside a Git
repo, only the current directory is checked. Use --file <path> for an explicit
config file or --allow-parent-search to permit walking beyond that boundary.
Scripts in a repo's eng/tasks/ folder are tasks without any config. The
quickest way to add one is runx --new, which creates the script with its
header filled in and a TODO body that fails until you replace it:
runx --new db:seed --type cs --description "Seed the local database" --depends build--type is ps1 (the default), cs, sh, or cmd, and --hide marks a
helper task. runx --new refuses names that would not be discovered, names
runx.json already uses, and dependencies that do not exist. Creating
build.sh next to an existing build.ps1 makes one task that runs the right
script on each operating system.
eng/tasks/
build.ps1 -> build
build.sh -> build (used on Linux and macOS)
hello.cs -> hello (run with 'dotnet run --file')
release/
pack.ps1 -> release:pack
db/
_default.cmd -> db
lib/
_helpers.ps1 (names starting with '_' or '.' are helpers, not tasks)
-
Subfolders become name prefixes separated by
:, and a file named_defaultis its folder's task. -
.ps1runs withpwsh -File,.cswithdotnet run --file(a .NET 10 file-based app),.cmdand.batwithcmdon Windows, and.shwithsh. Other files run through their#!line, or directly when executable on Linux and macOS. Files that are none of these, such as a README, are ignored. -
When several scripts share a name, Windows prefers
.ps1,.cmd,.bat,.cs, then.sh; Linux and macOS prefer.sh, then.ps1and.cs. -
Scripts run from the repo root, and arguments after
--go to the script:runx release:pack -- -Configuration Debug. -
Header comments near the top of a script start with the comment marker for its language (
#,//,::, orREM), thenrunxand akey=value:# runx description="Pack the NuGet packages" # runx depends=["build", { task: "test", args: ["--filter", "Smoke"] }] # runx hide=true
descriptionshows in the picker,dependsworks likedependsOn, andhidekeeps the task out of the picker and--listwhile it still runs by name and as a dependency. Values are quoted strings,trueorfalse, or lists. Dependency lists accept task names and objects withtaskand optionalargs, with the same behavior asdependsOn. Object keys may be quoted, as in JSON, or unquoted as above. -
Script tasks are marked
(script). A task inrunx.jsonwith the same name wins, which letsrunx.jsonwrap a script.
To look somewhere else, set taskFolders in runx.json or in a personal tasks
file. The most specific file that sets it wins (the repo's personal file, then
runx.json, then broader personal files), and it replaces eng/tasks. When it
lists several folders, the first one that defines a name wins:
{
"version": 1,
"taskFolders": ["build/tasks"],
"tasks": {}
}Folders in runx.json are relative to it; folders in personal files are
relative to the repo root. "taskFolders": [] turns script discovery off.
runx --where shows the folders in use. --file uses exactly the file given,
without script tasks.
Any task in runx.json can also set "hide": true.
Personal tasks are tasks for a repo that live outside it, so you can use runx
in repos where you can't or don't want to commit a runx.json.
runx --init --personal # tasks for this repo, in every worktree
runx --init --personal --scope origin # tasks for every repo on origin's host
runx --init --personal --scope global # tasks for every repo
runx --where # show which task files apply herePersonal files live under %USERPROFILE%\.runx\ (~/.runx/ on Linux and
macOS). Set RUNX_HOME to keep them somewhere else, such as a dotfiles
checkout. For a repo whose origin is git@github.com:acme/api.git, these
files apply, broadest first:
| Scope | File | Applies to |
|---|---|---|
global |
global.json |
every repo |
origin |
repos\github.com.json |
every repo on GitHub |
origin/acme |
repos\github.com\acme.json |
every repo under acme |
repo |
repos\github.com\acme\api.json |
this repo, in every worktree |
Scopes are named after the remote, so they read the same in every repo; the
files are named after the remote's address, so https://github.com/acme/api
finds the same ones. A repo without a remote is keyed by the folder of its main
checkout. runx --where lists the files for the current repo and which exist.
The files use the same format as runx.json. Their tasks:
- are added to the repo's
runx.jsontasks, or used on their own when the repo has none; - run from the root of the worktree you are in, with
cwdrelative to it; - override tasks of the same name from broader personal files;
- give way to the repo's own tasks and script tasks of the same name, except
that the
reposcope file must not reuse one of those names; - can depend on the repo's tasks, but repo tasks cannot depend on them. A task
from a broader file whose dependencies a repo lacks is hidden in that repo, so
a global
shipthat depends onbuildandtestonly appears where both exist; - are marked with their scope in the picker and in
runx --list, such as(global),(origin), or(personal)for the repo's own file.
Personal tasks apply only inside Git repos. --file uses exactly the file
given, without personal tasks.
Clone this repo and, from its root, run:
dotnet run --project src/MysterNybble.Runx -- tool:install
runx --listtool:install is the PowerShell 7 script eng/tasks/tool/install.ps1. It
packs the tool into artifacts/packages and reinstalls it as a global tool.
Run it through dotnet run rather than an installed runx, because Windows
locks the installed tool while it runs. This also supports replacing a local
1.0.0 development build with the beta.
This repo uses its own runx.json. Build and test tasks use Release configuration;
ci builds once, runs the tests, packs the tool, and smoke tests the package:
runx build
runx test
runx ciWithout runx installed, use dotnet build, dotnet test, or
dotnet run --project src/MysterNybble.Runx -- <task>. Tests run on
Microsoft.Testing.Platform, which global.json opts dotnet test into.
GitHub Actions bootstraps runx from the checkout into artifacts/bootstrap,
then uses that build to validate the repo tasks with --check and run ci on
Windows, Linux, and macOS. The separate bootstrap output lets runx rebuild
itself without replacing its running assemblies on Windows. Successful jobs
retain their NuGet packages as workflow artifacts for 14 days. To run the same
tasks locally without installing runx (requires PowerShell 7):
dotnet build src/MysterNybble.Runx --configuration Release --output artifacts/bootstrap
dotnet artifacts/bootstrap/MysterNybble.Runx.dll --check
dotnet artifacts/bootstrap/MysterNybble.Runx.dll ciThe smoke test expects exactly one runx package in artifacts/packages;
move any older packages out before packing. It installs into an isolated
folder under artifacts/smoke and leaves your global tool installation alone.
The Release workflow reuses CI to build, test, and install the package on all
three operating systems. A manual run is a dry run: it also downloads the
Linux package and checks its version and source commit, without publishing.
Publishing uses NuGet Trusted Publishing.
Sign in as joshucar and configure the policy with:
| Setting | Value |
|---|---|
| NuGet package owner | mysternybble (organization) |
| GitHub repository owner | joshucar |
| GitHub repository | runx |
| Workflow file | release.yml |
| GitHub environment | nuget |
| Package glob | MysterNybble.Runx |
| Scope | Push new packages and package versions |
The workflow authenticates as joshucar; the policy selects mysternybble
as the package owner. No long-lived NuGet API key is required. The GitHub
nuget environment allows deployment from v* tags.
Once the policy is configured and the release commit is tested, push a tag matching the version in the project file:
git tag v1.0.0-beta.2
git push origin v1.0.0-beta.2The tag run checks that the version and tag match, publishes the verified Linux-built package to NuGet, then creates a GitHub release with that package attached. Versions containing a prerelease suffix produce a GitHub prerelease. For later releases, update the project version and use the corresponding tag. Published versions are immutable; use a new version and tag for any changes.