Add first-run hints, init --config, and verbose flag support#6
Merged
Merged
Conversation
- Default log level drops to WARN so `anvil env <pkg> --export | eval` doesn't dump "Loaded N packages" and similar info logs to stderr. Add a global `-v` (info) / `-vv` (debug) flag; `RUST_LOG` still wins. - `anvil list` now prints a hint when no packages are visible, telling the user whether the config is missing, has no `package_paths`, or whether the configured paths don't exist on disk. - New `anvil init --config` scaffolds a commented `~/.anvil.yaml` template so first-time users have something to edit. - `anvil info <name>` surfaces all available versions when there's more than one on disk — covers the resolver-1.yaml / resolver-2.yaml case where filenames diverge from the package name. - README: install hint about `~/.cargo/bin` on PATH, expanded section on multi-token command aliases, mention of `anvil init --config`, and a note that anvil is quiet by default with `-v` for verbose. https://claude.ai/code/session_0147nsxp1EPFDBeeT3rCyTNc
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR improves the first-time user experience by adding helpful diagnostics when packages aren't found, scaffolding a starter global config file, and implementing a verbose flag for controlling log output.
Key Changes
First-run hints: When
anvil listfinds no packages, emit contextual hints to stderr suggestinganvil init --configor checkingANVIL_PACKAGESenvironment variable. AddedConfig::first_run_hint()to diagnose common configuration issues.anvil init --config: New subcommand to scaffold~/.anvil.yamlwith a commented template including examplepackage_paths, aliases, and filters. Refuses to overwrite existing config files.Verbose flag (
-v,-vv): Global-v/--verboseflag that steps up log levels from warn (default) → info → debug.RUST_LOGenvironment variable still takes precedence. Default quiet behavior prevents info logs from polluting stderr in piped contexts likeeval "$(anvil env ...)".anvil infoimprovements: When multiple versions of a package exist (e.g.,resolver-1.yaml,resolver-2.yaml), display all available versions so users aren't surprised by silent version selection.CLI updates: Made
Initcommand'snameparameter optional (required only when not using--config), added--configflag with proper conflict handling.Documentation: Updated README with quick-start instructions for
anvil init --config, clarifiedcommandsmap behavior with examples, and documented environment variables and log verbosity control.Implementation Details
RUST_LOG.Config::first_run_hint()returnsNonewhen at least one package path exists, avoiding noise in normal operation.init --configtemplate includes helpful comments and examples for common use cases (aliases, filters, shell selection).https://claude.ai/code/session_0147nsxp1EPFDBeeT3rCyTNc