55pub 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) ) ]
3841pub ( 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