noirnia-cli
v0.1.10
Published
CLI Development Toolkit for Noir
Downloads
5
Readme
noirnia-cli
Getting started
Ensure you have the latest version of bun:
bun upgradeInstall dependencies:
bun installTo run:
bun run main.tsbun run main.ts
Usage: noirnia [options] [command]
CLI Development Toolkit for Noir
Options:
-V, --version output the version number
-h, --help display help for command
Commands:
codegen [options] Generate contract interface for a given artifact
codegen-contract [options] <n> Generate contract interface for a contract by name
batch-codegen [options] <dir> Batch generate contract interfaces for Noir contracts
build [options] Compile Noir contracts and copy target files to output directory
help [command] display help for commandCurrent version: aztec-nargo 0.87.2
Installation Options
There are multiple ways to install and use noirnia-cli:
1. Local Installation (Recommended)
Install as a dependency in your project:
npm install noirnia-cliThen add scripts to your package.json:
"scripts": {
"noirnia": "node node_modules/noirnia-cli/dist/main.js",
"batch-codegen": "node node_modules/noirnia-cli/dist/main.js batch-codegen",
"codegen": "node node_modules/noirnia-cli/dist/main.js codegen",
"build": "node node_modules/noirnia-cli/dist/main.js build"
}This ensures everyone working on your project uses the same version of the CLI.
2. Using npx
You can use npx to run the tool without installing it:
npx noirnia-cli codegen your-artifact.json3. Global Installation
Install globally to make the command available system-wide:
npm install -g noirnia-cliThen you can use it from anywhere:
noirnia-cli codegen your-artifact.jsonGenerate contract interface
# Using local project scripts
npm run codegen artifacts/webauthn_authenticator-WebauthnModule.json
npm run codegen-contract identity -- --output ./src/generated
npm run batch-codegen ./contracts -- --output ./src/generated
# Or using direct run with bun
bun run main.ts codegen artifacts/webauthn_authenticator-WebauthnModule.json
bun run main.ts codegen-contract identity --output ./src/generated
bun run main.ts batch-codegen ./contracts --output ./src/generatedUsing noirnia-codegen
The noirnia-codegen script provides a simplified interface:
# Generate for a specific contract
noirnia-codegen -identity
# Generate for all contracts with a custom output directory
noirnia-codegen -all -output ./src/artifactsCompile Noir Contracts
The noirnia build command compiles Noir contracts and organizes the compiled artifacts:
# Compile all contracts
noirnia build
# Compile only contracts containing "identity"
noirnia build --contract identity
# Specify output directory for target files
noirnia build --output ./my-artifacts/target
# Enable debug output
noirnia build --debugYou can also use the direct noirnia-build script:
# Compile specific contract
noirnia-build -c identity
# Compile all contracts with custom output
noirnia-build -o ./my-artifacts/targetFor more details, see the noirnia-build documentation.
Update Aztec Package Versions
The noirnia bump tool helps you update Aztec package dependencies across your project:
# Update from version 0.85.0-alpha-testnet.2 to 0.86.0-alpha-testnet.1
noirnia bump --oldVersion 0.85.0-alpha-testnet.2 --newVersion 0.86.0-alpha-testnet.1
# Check what would be updated without making changes
noirnia bump --oldVersion 0.85.0-alpha-testnet.2 --newVersion 0.86.0-alpha-testnet.1 --check
# Only update Nargo.toml files
noirnia bump --oldVersion 0.85.0-alpha-testnet.2 --newVersion 0.86.0-alpha-testnet.1 --onlyNargo
# Only update package.json files
noirnia bump --oldVersion 0.85.0-alpha-testnet.2 --newVersion 0.86.0-alpha-testnet.1 --onlyPackages
# Exclude specific packages from the update
noirnia bump --oldVersion 0.85.0-alpha-testnet.2 --newVersion 0.86.0-alpha-testnet.1 --excludePackages @aztec/test-pkg,@aztec/some-other-pkgFor more details, see the noirnia-bump documentation.
Publishing
To publish this package to npm:
# Login to npm
npm login
# Build and publish
npm publishTroubleshooting
"var: command not found" or syntax errors when running globally installed package
If you see errors like these when running the globally installed binary:
/path/to/node_modules/.bin/noirnia: line 2: var: command not found
/path/to/node_modules/.bin/noirnia: line 3: var: command not found
...
/path/to/node_modules/.bin/noirnia: line 7: syntax error near unexpected token `('This happens because the JavaScript file is being interpreted as a shell script. To fix this:
Use the
nodeprefix explicitly:node $(which noirnia) batch-codegenOr use npm scripts as shown above (recommended):
"scripts": { "noirnia": "node node_modules/noirnia-cli/dist/main.js", "batch-codegen": "node node_modules/noirnia-cli/dist/main.js batch-codegen", "codegen": "node node_modules/noirnia-cli/dist/main.js codegen" }Or use npx to ensure proper invocation:
npx noirnia-cli batch-codegen
This project was created using bun init in bun v1.2.12. Bun is a fast all-in-one
JavaScript runtime.
