-
-
Notifications
You must be signed in to change notification settings - Fork 0
Add cross-channel install guard for cargo, winget, and Homebrew #93
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 3 commits
4e0aa50
e9cc9c6
a620eaa
9113a7c
5c8d2db
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| fn main() { | ||
| if std::env::var("CARGO_INSTALL_ROOT").is_ok() | ||
|
greptile-apps[bot] marked this conversation as resolved.
Outdated
|
||
| && numan_install_guard::run_cargo_install_guard() != std::process::ExitCode::SUCCESS | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
For normal AGENTS.md reference: AGENTS.md:L37-L38 Useful? React with 👍 / 👎.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win 🧩 Analysis chain🏁 Script executed: #!/bin/bash
set -euo pipefail
echo "== repo files relevant =="
git ls-files | rg '(^build\.rs$|AGENTS\.md$|README\.md$|docs/PACKAGING\.md$|packaging/winget/README\.md$|^Cargo\.toml$|install-guard|numan_install_guard)' || true
echo
echo "== build.rs =="
cat -n build.rs
echo
echo "== relevant docs snippets =="
for f in AGENTS.md README.md docs/PACKAGING.md packaging/winget/README.md Cargo.toml; do
if [ -f "$f" ]; then
echo "--- $f ---"
cat -n "$f" | sed -n '1,220p'
fi
done
echo
echo "== references to CARGO_INSTALL_ROOT / cargo install guard =="
rg -n "CARGO_INSTALL_ROOT|cargo install|install-guard|guard|uninstall|winget|Homebrew" .Repository: tonythethompson/numan Length of output: 50379 🏁 Script executed (no clone): Length of output: 348 🏁 Script executed: #!/bin/bash
set -euo pipefail
echo "== install-guard public API =="
cat -n install-guard/src/lib.rs | sed -n '1,260p'
echo
echo "== install-guard CLI behavior =="
cat -n install-guard/src/main.rs | sed -n '1,260p'
echo
echo "== cargo wrapper scripts =="
for f in scripts/install-cargo.ps1 scripts/install-homebrew.sh scripts/install-winget.ps1; do
if [ -f "$f" ]; then
echo "--- $f ---"
cat -n "$f" | sed -n '1,220p'
fi
doneRepository: tonythethompson/numan Length of output: 14109 🌐 Web query:
💡 Result: The CARGO_INSTALL_ROOT environment variable is used to define the root directory where the cargo install command places installed binary crates [1][2]. Executables are specifically placed into a bin subdirectory under this root path [1][2]. Additionally, metadata files used to track installed packages, such as.crates.toml and.crates2.json, are stored within this root directory [1][2]. If not specified, the default installation root is Cargo's home directory, which typically defaults to.cargo in the user's home directory [1][2]. The precedence for determining the installation root, from highest to lowest, is as follows [3][4]: 1. The --root command-line option [3][1] 2. The CARGO_INSTALL_ROOT environment variable [3][1] 3. The install.root Cargo configuration value [3][1] 4. The CARGO_HOME environment variable [3][4] 5. The default location ($HOME/.cargo) [3][4] The install.root configuration value mentioned in Cargo's TOML configuration is equivalent to the CARGO_INSTALL_ROOT environment variable [1][2]. Cargo configuration keys formatted as foo.bar can generally be defined by setting an environment variable of the form CARGO_FOO_BAR [1][2]. In this case, the install.root key corresponds to CARGO_INSTALL_ROOT [1][2]. Citations:
Use an install-only guard boundary.
Update the docs that describe plain 📍 Affects 5 files
🤖 Prompt for AI Agents |
||
| { | ||
| std::process::exit(1); | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -129,6 +129,7 @@ Checks run in order below. Implementation should call existing validators (`NuPa | |||||
| |----|----------|-----------| | ||||||
| | `nu.binary.missing_on_path` | `error` | Nu not on PATH and not under `$NUMAN_ROOT/tools/nushell/` → fix: `numan setup nu` | | ||||||
| | `nu.binary.found_off_path` | `warn` | Nu exists in a known install root (e.g. `~/.cargo/bin`, `%LOCALAPPDATA%\Programs\nushell`) but not on PATH → fix: `numan setup nu use <path>` | | ||||||
| | `install.multiple_channels` | `warn` | More than one `numan` binary from different install channels (cargo, winget, homebrew, release archive) → fix: uninstall the other channel(s) before reinstalling | | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nitpick (typo): Capitalize "Homebrew" to match its usage elsewhere and maintain consistency in tool names. Update "homebrew" here to "Homebrew" so it matches the capitalization used elsewhere in the docs.
Suggested change
|
||||||
| | `nu.path.version` | `info` | PATH-only Nu version (`PATH Nu: 0.114.1`), `PATH Nu: not found`, or `PATH Nu: found at '<path>' but version probe failed (<error>)` when the binary exists but `--version` fails. Does not treat managed Nu as PATH. Report-only (no automatic repair). | | ||||||
| | `nu.managed.version` | `info` | Managed binary under `$NUMAN_ROOT/tools/nushell/` with version, `Managed Nu: not installed`, or `Managed Nu: present at '<path>' but version probe failed (<error>)` when the binary exists but `--version` fails. Report-only (no automatic repair). | | ||||||
| | `nu.active_version.invalid` | `error` | `nu_state/active-version.json` is present but unreadable/invalid JSON. Lookup would otherwise soft-miss the marker and fall back to PATH. **auto:** copy raw bytes to `active-version.json.corrupt` (best-effort, recoverable `binary_path`), then clear via `clear_active_version` so resolution recovers cleanly. | | ||||||
|
|
||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| [package] | ||
| name = "numan-install-guard" | ||
| version = "0.1.0" | ||
| edition = "2021" | ||
| publish = true | ||
|
|
||
| [[bin]] | ||
| name = "numan-install-guard" | ||
| path = "src/main.rs" | ||
|
|
||
| [dependencies] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🗄️ Data Integrity & Integration | 🔵 Trivial
Publish the guard before packaging
numan-cli.The path-plus-version dependency is suitable for local development, but a packaged
numan-cliartifact requiresnuman-install-guard = 0.1.0from the registry. Verify that the release pipeline publishes that exact guard version before the CLI package and publish stages. Otherwise the release pipeline can fail before producing the CLI artifact.🤖 Prompt for AI Agents