CLI Reference¶
The nlsc command-line interface provides 8 commands for working with NLS files.
Global Options¶
| Option | Description |
|---|---|
--parser |
Parser backend: regex (default) or treesitter |
--version |
Show version number |
--help |
Show help message |
Commands¶
nlsc init¶
Initialize a new NLS project with standard folder structure.
| Argument | Description |
|---|---|
path |
Project directory (default: current directory) |
Example:
Creates:
my-project/
├── nl.config.yaml # Project configuration
├── src/ # Source .nl files
│ └── __init__.py
└── tests/ # Generated tests
└── __init__.py
nlsc compile¶
Compile a .nl file to the target language (currently Python).
| Option | Description |
|---|---|
file |
Path to .nl file |
-t, --target |
Target language (default: python) |
-o, --output |
Output file path |
Examples:
# Basic compile
nlsc compile src/auth.nl
# Compile with tree-sitter parser
nlsc --parser treesitter compile src/auth.nl
# Specify output file
nlsc compile src/auth.nl -o lib/auth.py
Generated files:
<name>.py— Python moduletest_<name>.py— Test file (if@testblocks present)<name>.nl.lock— Lockfile for reproducibility
nlsc verify¶
Validate a .nl file without generating code. Checks syntax and dependencies.
Example:
Output:
Verifying src/order.nl (parser: regex)...
✓ Syntax valid: 5 ANLUs
✓ Dependencies valid
✓ All ANLUs valid
Verification passed!
nlsc test¶
Run @test specifications from a .nl file.
| Option | Description |
|---|---|
file |
Path to .nl file |
-v, --verbose |
Verbose output |
Example:
The command:
- Compiles the
.nlfile to a temp directory - Generates test code from
@testblocks - Runs pytest on the generated tests
nlsc graph¶
Generate dependency and dataflow visualizations.
| Option | Description |
|---|---|
file |
Path to .nl file |
-f, --format |
Output format: mermaid (default), dot, ascii |
-a, --anlu |
Specific ANLU for dataflow visualization |
--dataflow |
Show dataflow instead of FSM states |
-o, --output |
Output file path (default: stdout) |
Examples:
# Module dependency graph
nlsc graph src/order.nl --format mermaid
# Dataflow for specific ANLU
nlsc graph src/order.nl --anlu process-order --dataflow
# Export as DOT for Graphviz
nlsc graph src/order.nl --format dot -o deps.dot
nlsc diff¶
Show changes since last compile by comparing against the lockfile.
| Option | Description |
|---|---|
file |
Path to .nl file |
--stat |
Show summary only |
--full |
Show full unified diff |
Examples:
# Show changed ANLUs
nlsc diff src/api.nl
# Summary statistics
nlsc diff src/api.nl --stat
# Full unified diff
nlsc diff src/api.nl --full
nlsc watch¶
Watch a directory for .nl file changes and automatically recompile.
| Option | Description |
|---|---|
dir |
Directory to watch (default: current) |
-q, --quiet |
Suppress success messages |
-t, --test |
Run tests after successful compile |
-d, --debounce |
Debounce interval in ms (default: 100) |
Examples:
# Watch current directory
nlsc watch
# Watch with tests
nlsc watch src/ --test
# Quiet mode with custom debounce
nlsc watch src/ -q -d 500
Press Ctrl+C to stop watching.
nlsc atomize¶
Extract ANLUs from existing Python source code (reverse compilation).
| Option | Description |
|---|---|
file |
Path to Python file |
-o, --output |
Output .nl file path |
-m, --module |
Module name for generated .nl |
Example:
This extracts functions from Python and generates corresponding ANLU blocks.
Exit Codes¶
| Code | Meaning |
|---|---|
| 0 | Success |
| 1 | Error (parse error, validation failure, etc.) |
Environment Variables¶
| Variable | Description |
|---|---|
NLSC_PARSER |
Default parser backend (regex or treesitter) |
Configuration¶
Project settings are stored in nl.config.yaml: