Skip to content

Commit 790e8ff

Browse files
CSResselclaude
andauthored
fix(update): Fix update prompt for Nori package manager (#151)
Co-authored-by: Claude <noreply@anthropic.com>
1 parent 784b2db commit 790e8ff

3 files changed

Lines changed: 18 additions & 7 deletions

File tree

codex-rs/cli/src/main.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,7 @@ fn handle_app_exit(exit_info: AppExitInfo) -> anyhow::Result<()> {
350350
fn run_update_action(action: UpdateAction) -> anyhow::Result<()> {
351351
println!();
352352
let cmd_str = action.command_str();
353-
println!("Updating Codex via `{cmd_str}`...");
353+
println!("Updating Nori via `{cmd_str}`...");
354354

355355
let status = {
356356
#[cfg(windows)]
@@ -377,7 +377,7 @@ fn run_update_action(action: UpdateAction) -> anyhow::Result<()> {
377377
anyhow::bail!("`{cmd_str}` failed with status {status}");
378378
}
379379
println!();
380-
println!("🎉 Update ran successfully! Please restart Codex.");
380+
println!("🎉 Update ran successfully! Please restart Nori.");
381381
Ok(())
382382
}
383383

codex-rs/tui/src/nori/docs.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,9 @@ Compiled only when `feedback` feature is disabled (`#[cfg(not(feature = "feedbac
6767
Compiled only when `upstream-updates` feature is disabled. Provides Nori-specific update checking:
6868

6969
`update_action.rs`:
70-
- `UpdateAction` enum with `NpmGlobalLatest` and `Manual` variants
70+
- `UpdateAction` enum with `NpmGlobalLatest`, `BunGlobalLatest`, and `Manual` variants
7171
- `command_args()` returns the shell command to execute the update
72-
- `get_update_action()` (release builds only) checks `NORI_MANAGED_BY_NPM` env var to determine update method
72+
- `get_update_action()` (release builds only) checks `NORI_MANAGED_BY_BUN` then `NORI_MANAGED_BY_NPM` env vars to determine update method
7373

7474
`updates.rs` (release builds only):
7575
- Queries `https://api.github.com/repos/tilework-tech/nori-cli/releases/latest` for version info

codex-rs/tui/src/nori/update_action.rs

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
pub enum UpdateAction {
66
/// Update via `npm install -g nori-ai-cli@latest`
77
NpmGlobalLatest,
8+
/// Update via `bun install -g nori-ai-cli@latest`
9+
BunGlobalLatest,
810
/// Manual update (show instructions)
911
Manual,
1012
}
@@ -14,6 +16,7 @@ impl UpdateAction {
1416
pub fn command_args(self) -> (&'static str, &'static [&'static str]) {
1517
match self {
1618
UpdateAction::NpmGlobalLatest => ("npm", &["install", "-g", "nori-ai-cli@latest"]),
19+
UpdateAction::BunGlobalLatest => ("bun", &["install", "-g", "nori-ai-cli@latest"]),
1720
UpdateAction::Manual => (
1821
"echo",
1922
&["Please visit https://github.com/tilework-tech/nori-cli/releases"],
@@ -36,9 +39,9 @@ impl UpdateAction {
3639
/// that directs users to GitHub releases.
3740
#[cfg(not(debug_assertions))]
3841
pub(crate) fn get_update_action() -> Option<UpdateAction> {
39-
let managed_by_npm = std::env::var_os("NORI_MANAGED_BY_NPM").is_some();
40-
41-
if managed_by_npm {
42+
if std::env::var_os("NORI_MANAGED_BY_BUN").is_some() {
43+
Some(UpdateAction::BunGlobalLatest)
44+
} else if std::env::var_os("NORI_MANAGED_BY_NPM").is_some() {
4245
Some(UpdateAction::NpmGlobalLatest)
4346
} else {
4447
// For other installations, show manual update option
@@ -65,4 +68,12 @@ mod tests {
6568
assert_eq!(cmd, "echo");
6669
assert!(args[0].contains("tilework-tech/nori-cli"));
6770
}
71+
72+
#[test]
73+
fn bun_update_command_is_correct() {
74+
let action = UpdateAction::BunGlobalLatest;
75+
let (cmd, args) = action.command_args();
76+
assert_eq!(cmd, "bun");
77+
assert_eq!(args, &["install", "-g", "nori-ai-cli@latest"]);
78+
}
6879
}

0 commit comments

Comments
 (0)