CLI reference · source audited
Commands.
Nift keeps its command surface deliberately small. This reference is cross-checked against the current command dispatcher, including the options and aliases the executable actually accepts.
General
nift about
Shows a brief description of Nift, the installed version, license and https://nift.dev.
nift version
Prints the installed Nift version. --version and -v are also accepted.
nift commands
Prints the built-in command reference. cmds, --help and -h are aliases.
Initialise a project
nift init [.ext]
Creates a Nift project in the current directory and performs its initial build. The extension defaults to .html. Nift refuses to initialise a directory that is already a Nift project.
nift init
nift init .html
nift init .txt init-html remains as a compatibility spelling.
Minify arbitrary files
nift minify [-i|--in-place] file...
Minifies one or more supported files without requiring a Nift project. The safe default writes a sibling .min file and leaves the source untouched.
nift minify public/index.html
# public/index.html -> public/index.min.html
nift minify assets/app.js assets/site.css
# assets/app.min.js + assets/site.min.css
nift minify --in-place generated/app.js
nift minify -i generated/site.css -i / --in-place is the explicit destructive form. Paths may be relative or absolute and do not need to live inside a Nift project. Supported extensions are HTML/HTM, CSS, JS/MJS/CJS, JSX, JSON, XML and SVG. At least one file is required. Unsupported, missing, malformed or unwritable files produce a non-zero status; other valid arguments in the same invocation are still processed. Minification details →
Build
nift build / nift build-updated
The everyday incremental build. Nift analyses tracked pages in parallel, explains rebuild causes when requested, and only builds pages affected by the current dependency state.
nift build
nift build-updated
nift build-updated -p -p asks for fuller per-page detail when the normal output would otherwise summarise a large change set.
nift build-all [-p]
Builds every tracked page regardless of incremental state.
nift build-names [-p] name...
Builds only the explicitly supplied tracked names. At least one name is required.
nift build-names about docs/getting-started Build and status options
| Option | Where useful | Effect |
|---|---|---|
-p | build-all, build-updated, named builds, status | Requests full per-page detail instead of compact summaries where applicable. |
-n | Legacy compatibility only | Accepted by the shared option parser but currently has no behavioural effect. |
-s | Legacy compatibility only | Accepted by the shared option parser but currently has no behavioural effect. |
There is no hidden build mode behind -n or -s in the current rewrite. They remain accepted so older invocations do not fail solely because those flags are present. New scripts should omit them.
nift build-auto [options]
Continuously runs the incremental build check every 200 ms. In an interactive terminal, press q to stop immediately.
Nift build-auto
watching for changes every 200 ms
build output: .nift/build-auto.log
press q to stop The terminal stays intentionally quiet. The latest meaningful build output is written to .nift/build-auto.log, without terminal colour codes, and the file is only rewritten when that output actually changes. In non-interactive use, stop the process normally from the surrounding shell/service.
Inspect project state
nift status [-p]
A dry-run incremental build: it shows which pages need rebuilding and why, but does not modify generated output or page build metadata. Small change sets show each reason; large fan-out changes are summarised. Use -p for full detail.
nift info [names...]
Shows resolved metadata for requested tracked names. If no names are supplied, it shows all tracked entries.
nift info-all
Shows complete tracked metadata.
nift info-names
Shows the tracked-name list.
nift info-tracking
Shows tracking state, including the tracking file and resolved paths.
nift info-watching
Shows watched directories and their extension/template rules.
info* commands are script-friendly.Interactive terminals get headings and syntax colouring. Redirected/piped output is plain valid JSON, so commands can be consumed by tools such as jq.
Track and manage items
nift track name [title] [template]
Adds a tracked item. The title defaults to the final component of the name and the template defaults to default-template. Tracked names cannot contain a .. path component.
nift untrack name...
Stops tracking items without deleting their content files.
nift rm name...
Removes tracking plus the corresponding content and generated output. del is an alias.
nift cp source destination / nift mv source destination
Copies or moves a tracked item. copy and move are aliases. Destination names cannot escape through a .. path component.
Watch directories
nift watch directory [content-ext] [template] [output-ext]
Adds a watched directory using the supplied rules or the project defaults.
nift unwatch directory
Removes a watched directory.
Aliases and accepted spellings
| Canonical command | Accepted aliases / forms |
|---|---|
version | --version, -v |
commands | cmds, --help, -h |
init | init-html (fixed .html compatibility form) |
build-updated | build with no additional arguments |
build-names | build name... when tracked names are supplied |
rm | del |
cp | copy |
mv | move |
Minify options
| Option | Effect |
|---|---|
-i, --in-place | Overwrite each source file instead of writing the default sibling name.min.ext output. |
There is intentionally no implicit destructive mode: overwrite must be requested on the command line.
Argument and option contract
Commands that do not show optional arguments above reject extras rather than silently ignoring them. track accepts at most a name, title and template; watch accepts a directory plus optional content extension, template and output extension; cp/mv require exactly two names; untrack/rm accept one or more names.
The info* commands emit coloured human-readable headings on an interactive terminal and plain JSON when redirected or piped. The shared parser also tolerates the legacy -n/-s flags on several inspect commands, but they have no effect and are not part of recommended usage.
Built-in summary
The executable is also the quickest authoritative reminder:
nift commands