Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,23 @@ const namespace =
(await rl.question("Namespace (default: default): ")) || "default";
const runnerName = await rl.question("Runner name to delete: ");

rl.close();

if (!runnerName) {
console.error("Error: Runner name is required");
rl.close();
process.exit(1);
}

const confirmDelete = await rl.question(
`Are you sure you want to delete runner "${runnerName}" in namespace "${namespace}"? (yes/no): `,
);

rl.close();

if (confirmDelete.toLowerCase() !== "yes") {
console.log("Deletion cancelled.");
process.exit(0);
}

const response = await fetch(
`${endpoint}/runner-configs/${runnerName}?namespace=${namespace}`,
{
Expand All @@ -44,4 +54,4 @@ if (!response.ok) {
process.exit(1);
}

console.log(`✅ Successfully deleted runner configuration "${runnerName}"!`);
console.log(`✅ Successfully deleted runner configuration "${runnerName}"!`);
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,4 @@ if (!response.ok) {
const data = await response.json();

// Just show the raw formatted JSON
console.log(JSON.stringify(data, null, 2));
console.log(JSON.stringify(data, null, 2));
44 changes: 44 additions & 0 deletions scripts/api/list-runners.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
#!/usr/bin/env tsx

import * as readline from "readline/promises";

const rl = readline.createInterface({
input: process.stdin,
output: process.stdout,
});

const rivetToken = process.env.RIVET_TOKEN;
if (!rivetToken) {
console.error("Error: RIVET_TOKEN environment variable is not set");
process.exit(1);
}

const endpoint =
process.env.RIVET_ENDPOINT ||
(await rl.question("Rivet Endpoint (default: https://api.rivet.gg): ")) ||
"https://api.rivet.gg";
const namespace =
(await rl.question("Namespace (default: default): ")) || "default";

rl.close();

const response = await fetch(
`${endpoint}/runners?namespace=${namespace}`,
{
method: "GET",
headers: {
Authorization: `Bearer ${rivetToken}`,
},
},
);

if (!response.ok) {
console.error(`Error: ${response.status} ${response.statusText}`);
console.error(await response.text());
process.exit(1);
}

const data = await response.json();

// Just show the raw formatted JSON
console.log(JSON.stringify(data, null, 2));
File renamed without changes.
Loading