File tree Expand file tree Collapse file tree 5 files changed +58
-4
lines changed Expand file tree Collapse file tree 5 files changed +58
-4
lines changed File renamed without changes.
Original file line number Diff line number Diff line change @@ -21,13 +21,23 @@ const namespace =
2121 ( await rl . question ( "Namespace (default: default): " ) ) || "default" ;
2222const runnerName = await rl . question ( "Runner name to delete: " ) ;
2323
24- rl . close ( ) ;
25-
2624if ( ! runnerName ) {
2725 console . error ( "Error: Runner name is required" ) ;
26+ rl . close ( ) ;
2827 process . exit ( 1 ) ;
2928}
3029
30+ const confirmDelete = await rl . question (
31+ `Are you sure you want to delete runner "${ runnerName } " in namespace "${ namespace } "? (yes/no): ` ,
32+ ) ;
33+
34+ rl . close ( ) ;
35+
36+ if ( confirmDelete . toLowerCase ( ) !== "yes" ) {
37+ console . log ( "Deletion cancelled." ) ;
38+ process . exit ( 0 ) ;
39+ }
40+
3141const response = await fetch (
3242 `${ endpoint } /runner-configs/${ runnerName } ?namespace=${ namespace } ` ,
3343 {
@@ -44,4 +54,4 @@ if (!response.ok) {
4454 process . exit ( 1 ) ;
4555}
4656
47- console . log ( `✅ Successfully deleted runner configuration "${ runnerName } "!` ) ;
57+ console . log ( `✅ Successfully deleted runner configuration "${ runnerName } "!` ) ;
Original file line number Diff line number Diff line change @@ -41,4 +41,4 @@ if (!response.ok) {
4141const data = await response . json ( ) ;
4242
4343// Just show the raw formatted JSON
44- console . log ( JSON . stringify ( data , null , 2 ) ) ;
44+ console . log ( JSON . stringify ( data , null , 2 ) ) ;
Original file line number Diff line number Diff line change 1+ #!/usr/bin/env tsx
2+
3+ import * as readline from "readline/promises" ;
4+
5+ const rl = readline . createInterface ( {
6+ input : process . stdin ,
7+ output : process . stdout ,
8+ } ) ;
9+
10+ const rivetToken = process . env . RIVET_TOKEN ;
11+ if ( ! rivetToken ) {
12+ console . error ( "Error: RIVET_TOKEN environment variable is not set" ) ;
13+ process . exit ( 1 ) ;
14+ }
15+
16+ const endpoint =
17+ process . env . RIVET_ENDPOINT ||
18+ ( await rl . question ( "Rivet Endpoint (default: https://api.rivet.gg): " ) ) ||
19+ "https://api.rivet.gg" ;
20+ const namespace =
21+ ( await rl . question ( "Namespace (default: default): " ) ) || "default" ;
22+
23+ rl . close ( ) ;
24+
25+ const response = await fetch (
26+ `${ endpoint } /runners?namespace=${ namespace } ` ,
27+ {
28+ method : "GET" ,
29+ headers : {
30+ Authorization : `Bearer ${ rivetToken } ` ,
31+ } ,
32+ } ,
33+ ) ;
34+
35+ if ( ! response . ok ) {
36+ console . error ( `Error: ${ response . status } ${ response . statusText } ` ) ;
37+ console . error ( await response . text ( ) ) ;
38+ process . exit ( 1 ) ;
39+ }
40+
41+ const data = await response . json ( ) ;
42+
43+ // Just show the raw formatted JSON
44+ console . log ( JSON . stringify ( data , null , 2 ) ) ;
File renamed without changes.
You can’t perform that action at this time.
0 commit comments