Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: improve nargo check cli with --override flag and feedback for e…
…xisting files (#4575) Recently, while working with `nargo check`, I noticed when Prover.toml and Verifier.toml files already existed, running `nargo check` would not update these files unless they were manually deleted and the command was rerun. This was a bit frustrating, as there was no indication of why changes weren't being applied and a success message was still output. To address this, I've made an enhancement that improves t he user experience in two ways: 1. If Prover.toml and Verifier.toml exist and `--override` is not used, `nargo check` will no longer show a success message misleadingly. This clarifies that no changes were made due to the presence of these files. 2. It introduces guidance to use the `--override` flag if the intention is to update these existing files, making it clear how to proceed to apply the desired changes. This makes it more intuitive by removing the need to manually delete files Prover.toml and Verifier.toml ### Changes: - **When both files exist without using --override**: The tool will alert you that Prover.toml and Verifier.toml already exist and suggest using `--override` to update them. ```sh sh-5.2# nargo check Warning: Prover.toml already exists. Use --override to force overwrite. Warning: Verifier.toml already exists. Use --override to force overwrite. ``` - **When no file exists**: It proceeds as expected, building the constraint system successfully. ```sh sh-5.2# nargo check [simple_range] Constraint system successfully built! ``` - **When files exist and --override is used**: It overwrites the existing files and rebuilds the constraint system. ```sh sh-5.2# nargo check --override [simple_range] Constraint system successfully built! ``` - **When only one of the files exists**: It creates or overwrites the missing file, as needed, without the need for `--override` for the missing one, but warns about the existing file. ```sh sh-5.2# nargo check Warning: Prover.toml already exists. Use --override to force overwrite. [simple_range] Constraint system successfully built! ``` ```sh sh-5.2# nargo check Warning: Verifier.toml already exists. Use --override to force overwrite. [simple_range] Constraint system successfully built! ``` - **With --override, even if only one file exists**: Both files are re/created. ```sh sh-5.2# nargo check --override [simple_range] Constraint system successfully built! ``` **override flag in --help:** ```sh sh-5.2# nargo check --help Checks the constraint system for errors Usage: nargo check [OPTIONS] Options: --package <PACKAGE> The name of the package to check --workspace Check all packages in the workspace --override Force overwrite of existing files --expression-width <EXPRESSION_WIDTH> Override the expression width requested by the backend --force Force a full recompilation --print-acir Display the ACIR for compiled circuit --deny-warnings Treat all warnings as errors --silence-warnings Suppress warnings -h, --help Print help ``` --------- Co-authored-by: jfecher <[email protected]>
- Loading branch information