Valdi Command Line References
The Valdi command line tools serve as the primary interface for setting up your environment, creating projects, building applications, and managing your Valdi workflow.
Installation
npm install -g @snap/valdi
valdi dev_setup # Sets up your entire development environment
For detailed installation instructions, see the Installation Guide.
If you're contributing to Valdi itself, install from source instead:
git clone git@github.com:Snapchat/Valdi.git
cd Valdi/npm_modules/cli/
npm run cli:install
Basic Usage
A list of available commands can be displayed with valdi --help.
The --help option is also available within each individual command to display additional details.
valdi <command>
Commands:
valdi completion Generates completion script
valdi bootstrap Prepares and initializes a project to build and run in Valdi
valdi dev_setup Sets up the development environment for Valdi
valdi projectsync [--target target] Synchronize VSCode project for the given targets
valdi new_module [module-name] Create a new Valdi module with boilerplate structure
valdi build <platform> Build the application
valdi install <platform> Build and install the application to the connected device
valdi package <platform> Build and package a Valdi application
valdi export <platform> Build and export a Valdi library
valdi hotreload [--module module_name] [--target Starts the hotreloader for the application
target_name]
valdi debugger Starts the Valdi debugger web interface
valdi test [--module module_name] [--target target_name] Runs tests for given module(s) or target(s). Runs all
tests if no module or target is specified.
valdi lint <command> Checks and formats the code
valdi skills <command> Manage AI assistant skills for Valdi development
valdi doctor Check your Valdi development environment for common issues
valdi log Streams Valdi logs from the connected device to console
valdi inspect <command> Inspect a running Valdi app — component trees, contexts,
screenshots, heap
valdi agent-check [--module module_name] [--target (experimental) Validate a Valdi module: resolve
target_name] [--quick] targets, build, lint, and test in one command
valdi analyze <command> Analyze Valdi modules — component duplication, patterns,
health
valdi preview <component> Preview a Valdi component in a macOS window
valdi profile <command> Capture a CPU profile from the Hermes JS runtime
valdi web-hotreload --target <bazel-target> (experimental) Start a Valdi web playground with hot
module reload
Options:
--debug Run with debug logging [boolean] [default: false]
--version Show version number [boolean]
--help Show help [boolean]
Available CLI Commands
This section aims to cover each command more in-depth and will only provide some barebones usage patterns and descriptions since they are already available via the --help option.
valdi completion
Prints a code snippet and instructions to enable auto completion of available Valdi CLI commands. Optional and not required to use the CLI.
valdi bootstrap [-y --confirm-bootstrap] [-n --project-name]
Sets up a basic Valdi project in the current path by creating all required files to initially build and run the project.
Options:
-y, --confirm-bootstrap: Skip confirmation prompt and start bootstrap process-n, --project-name: Name of the project-t, --application-type: Type of application to create:ui_applicationorcli_application--valdiVersion: Valdi release tag or branch to use.latestuses the newest GitHub release andmainthe bleeding edge. Defaults to the release this CLI was built with--valdiWidgetsVersion: Valdi_Widgets release tag or branch to use, with the same values as--valdiVersion-l, --local-valdi-path: Full path to a local checkout of the Valdi repo-p, --skipProjectsync: Skipprojectsync(for testing purposes)-c, --with-cleanup: Deletes all existing files in the current directory before initiating bootstrap
The project name becomes the Bazel module name, so it must also start with a lowercase letter and end with a lowercase letter or digit.
valdi dev_setup
Runs the automated environment setup script to install dependencies and configure the development environment. This command is typically run once during initial setup.
valdi projectsync [--target target]
Run this command to enable VS Code syntax highlighting for the current workspace project. This regenerates native bindings and updates VS Code project files.
- If
--targetis specified, synchronizes only the specified Bazel target.
valdi new_module [module-name]
Create a new Valdi module with boilerplate structure including BUILD.bazel and basic source files.
Options:
module-name(positional): Name of the Valdi module--template: Module template to use, will skip the prompt--skip-checks: Skips confirmation prompts
Module naming requirements:
- May contain: A-Z, a-z, 0-9, '-' and ''. A '-' is converted to ''. Any other character, including '.', is rejected
- Must not start with a digit
- Must not be a reserved word, such as
test,build,module,main,src,lib,dataorconfig(case-insensitive)
Example:
# Interactive mode
valdi new_module
# Create module with options
valdi new_module my_module --skip-checks
valdi build <platform> [--application] [--bazel_args]
Build the application without installing it to a device. Useful for CI/CD pipelines or when you just want to verify the build succeeds.
- Supported platforms:
android,ios,macos,linux,cli,web - If no
--applicationis specified, command will query for valid targets in the current workspace. - Additional Bazel arguments can be passed in via
--bazel_argsoption.
valdi install <platform> [--application] [--bazel_args]
Build and install a Valdi application on the given platform to a connected device or emulator, or serve a web app locally.
- Supported platforms:
android,ios,macos,linux,cli,web - If no
--applicationis specified, command will query for valid targets in the current workspace. - Additional Bazel arguments can be passed in via
--bazel_argsoption. - Web options:
--host,--port, and--no-opento prevent opening the default browser.--portdefaults to0, which lets the operating system select an available port.
valdi package <platform> [--application] --output_path <path>
Build and package a Valdi application into a distributable format.
- Supported platforms:
android,ios,macos,web --output_path(required): The path where to store the built application package--application: Name of the application to build
Example:
valdi package android --output_path ./dist/app.apk
valdi package ios --output_path ./dist/app.ipa
valdi export <platform> [--library] --output_path <path> [--output_format archive|directory]
Build and export a Valdi library for integration into native applications, or a runnable static web app zip.
- Supported platforms:
android,ios,web --output_path(required): The path where to store the exported library- iOS: Must end with
.xcframework - Android: Must end with
.aar - Web archive: Must end with
.zip - Web directory: Directory synchronized with the built package
- iOS: Must end with
--output_format:archive(default) ordirectory. Directory output is supported for web exports and leaves unchanged files untouched.--library: Name of the library to export. If omitted, the CLI queries available export targets.
Example:
valdi export ios --output_path ./output/MyLibrary.xcframework
valdi export android --output_path ./output/mylibrary.aar
valdi export web --library //:hello_world_web --output_path ./output/hello_world_web.zip
valdi export web --library //:hello_world_web --output_path ./output/hello_world_web --output_format directory
valdi hotreload [--module module_name] [--target target_name] [--port port] [--json-events]
Starts the Valdi hotreloader for the application target.
- When
--moduleand--targetis omitted, it will attempt to run the application target of the current workspace. If there is more than one defined application, the specific target will need to be specified. - The
--targetoption should be a valid Bazel target (ex://:hello_world_hotreload). - The
--moduleoption will query and run targets in the current workspace which match the module_name. - The
--portoption scopes the hotreload service and cleanup to a specific port. - The
--json-eventsoption emits JSON lifecycle records for target resolution, build completion, hotreload startup, target connection, resource delivery, successful recompilation, and shutdown while retaining normal compiler and runtime output. resources_sentmeans that the compiler handed a resource batch to a connected target; it is not a render-completion guarantee.
valdi debugger [--host host] [--port port] [--strict-port] [--json] [--web-preview-url url] [--chromium-debugging-port port]
Starts a local browser-based Valdi debugger web interface. The debugger attaches
to running Valdi daemon targets and exposes live view hierarchy, preview,
inspector data, element snapshots, heap dumps, input dispatch, and runtime logs. CPU profiling
uses a separate Hermes debugger connection.
- The default host is
127.0.0.1; the debugger rejects non-loopback bind addresses because snapshots can contain application data. - The preferred port is
8765; if it is busy, the command selects the next available port so multiple local debugger sessions can run at once. - Use
--strict-portto fail instead of auto-selecting another port. - Use
--jsonto print one machine-readable startup object with the selectedurl,port,requestedPort, andportWasAutoSelectedfields. - Use
--web-preview-urlto attach the integrated Elements and Console panel to one exact loopback web/Owl page. The command prints a temporary unpacked extension directory, adds the explicit Valdi debugger query parameters to the preview URL, and defaults Chromium CDP discovery to port9222. - Use
--chromium-debugging-portwhen Owl/Chromium was launched with a different loopback--remote-debugging-port. The target page must provide the opt-inwindow.__VALDI_WEB_DEBUGGER__snapshot/highlight contract.
valdi inspect input <capabilities|query|tap|focus|text|key|scroll> [contextId]
Queries or controls a running debug valdi_application through the default,
cross-platform debugger input contract.
- Target an element with
--element-id,--accessibility-id, or--selector. - Use
--clientto choose a connected target and--port 13591for a standalone macOS app; the default port13592targets in-app mobile clients. - Action-specific values include
--text,--key,--focused/--no-focused,--selection-start,--selection-end,--x,--y,--delta-x, and--delta-y. - Each successful command writes exactly one JSON object to standard output.
- Start with
capabilities, then usequeryto discover stableaccessibilityIdselectors and available actions.
valdi test [--module module_name] [--target target_name]
Executes the test(s) for the provided targets. Note that multiple modules OR targets can be provided to execute all tests simultaneously. If no modules or targets are provided, ALL tests within the current workspace will be ran.
valdi lint check [files...]
valdi lint format [files...]
Runs the prettier linter on the provided files. The files given can be passed via wildcards. If a prettier config does not exist, a basic one will be created. Further customizations can be done via manually editing the created .prettierrc.json.
valdi skills list [--category=framework|client]
valdi skills install [name] [--for=claude|cursor|copilot|all] [--category=framework|client]
valdi skills update
valdi skills remove <name>
valdi skills create
Manage Valdi AI skills — context files that teach AI coding assistants (Claude Code, Cursor, GitHub Copilot) about Valdi-specific patterns so they generate correct code instead of React patterns. Skills are bundled in the npm package and work offline.
list: Shows all available skills with per-agent install status. Use--categoryto filter byframework(Valdi repo internals) orclient(module development)install [name]: Installs one skill or all skills. Without--for, auto-detects which AI tools are installed. Use--categoryto install only framework or client skillsupdate: Re-installs all already-installed skills from the bundled packageremove <name>: Removes a skill from all agents where it is installedcreate: Interactive scaffold — must be run from within a Valdi framework checkout. Prompts for name, description, and category; createsskill.mdin the correct location and registers it inregistry.json
Example:
# See all available skills and which are installed
valdi skills list
# Install all skills for all detected AI tools
valdi skills install
# Install only module-development skills for Cursor
valdi skills install --category=client --for=cursor
# Contribute a new skill (run from Valdi repo root)
valdi skills create
Skills are stored in ai-skills/ in the Valdi repository. See Working with AI Assistants for more information.
valdi doctor [--verbose] [--fix] [--json] [--framework] [--project]
Check your Valdi development environment for common issues. Performs comprehensive health checks on system requirements, tool installations, and workspace configuration.
Options:
--verbose, -v: Show detailed diagnostic information--fix, -f: Attempt to automatically fix issues where possible--json, -j: Output results in JSON format (useful for CI/CD)--framework, -F: Include framework development checks (temurin, etc.)--project, -p: Include project-specific checks (workspace structure, etc.)
Example:
# Basic health check
valdi doctor
# With verbose output and automatic fixes
valdi doctor --verbose --fix
# Include all checks with JSON output
valdi doctor --project --framework --json
Run valdi doctor if you encounter setup issues or build failures. It will identify common problems and suggest solutions.
valdi agent-check [--module module_name] [--target target_name] [--quick] [--json]
Experimental. Validate a Valdi module in one command: resolves the module's targets, then builds, lints, and runs its tests. Designed for AI coding agents and quick pre-commit checks.
Options:
--module: Name of the Valdi module to validate--target: Bazel target path to validate--quick: Skip the build step (use when the hot reloader is already compiling your changes). Runs only lint + test--json: Output results as machine-readable JSON
Example:
valdi agent-check --module hello_world
valdi agent-check --module hello_world --quick --json
valdi analyze duplicates [--module module_name] [--pattern pattern] [--json]
Find duplicated component patterns across Valdi modules, clustering similar components so they can be extracted into a shared library.
Options:
--module: Scope the scan to a single module--threshold, -t: Similarity threshold for clustering (0-1, default0.6)--pattern: Only detect a specific known pattern:async,button, orshimmer--scan-root: Root directory to scan (repeatable). Auto-detected if omitted--shared-lib: Shared component library name (repeatable). Defaults tovaldi_widgets--json, -j: Machine-readable JSON output--output, -o: Write the JSON report to a file--verbose, -v: Show per-file detail in the output
valdi preview <component>
Preview a Valdi component in a macOS window. <component> is either a component import path (e.g. widgets/src/components/button/Checkbox) or a file path (e.g. ./valdi_modules/widgets/src/components/button/Checkbox.tsx).
valdi profile capture [--duration seconds] [--output file]
Capture a CPU profile from the Hermes JS runtime of a running app and write it as a .cpuprofile file you can open in Chrome DevTools. Requires the Hermes engine; see the Hermes Debugger guide.
Options:
--duration, -d: Profile for N seconds then stop automatically (omit to stop with Ctrl+C)--output, -o: Output.cpuprofilefile path (default:/tmp/valdi-profile-<timestamp>.cpuprofile)--port: Hermes debug socket port (default13595)--context: JS context ID to profile; auto-selected if only one
valdi web-hotreload --target <bazel-target>
Experimental. Start a Valdi web playground with hot module reload (webpack-dev-server). Pass the Bazel label of the playground :dev target created by valdi_web_playground(hmr_config = ...) (defined in tools/valdi_web_devtools/valdi_web_playground.bzl), for example //experiments/helloworld_playground:dev.
valdi log
Displays and streams the Valdi logs. Will prompt user for selection if multiple logs are detected. The list of logs are ordered by descending modification time, with newest entries on the top.
Valdi logs are additionally printed to Logcat as well as the XCode console.