Initial commit — SvelteKit fleet manager for T5 Plutonium servers

Ports push_scripts.sh (1497 lines of bash) to a SvelteKit + SQLite web app
that manages a fleet of T5 Plutonium servers running on Komodo. Same push
and beta workflow as the shell script, with a live SSE pipeline view, a
!rt-token-gated auth modal that hard-pauses deployments on stale tokens,
per-file audit diffs, and a Komodo-container deployment target.

- Push/beta engines port the exact filter, held-by-beta, conflict, and
  stale-backup rules from the shell script
- SQLite (better-sqlite3) replaces script_metadata.json; a one-shot
  importer moves legacy state over on first boot
- 16 vitest tests cover push add/update/skip, beta open→rollback,
  open→promote, conflict guards, sweep frozen/manual branches, and IW4M
  login/status parsing
- docker/ + komodo/stack.toml deploy as a managed container on the same
  host as the game servers, /root/zombies bind-mounted at the same path
  the shell script used
This commit is contained in:
2026-09-12 00:23:51 -04:00
commit d99711563e
67 changed files with 9415 additions and 0 deletions
+47
View File
@@ -0,0 +1,47 @@
import { subscribe } from '$lib/server/pipeline/bus.js';
import { getAuthState } from '$lib/server/integrations/auth-state.js';
const encoder = new TextEncoder();
const HEARTBEAT_MS = 5_000;
export async function GET() {
let heartbeat: NodeJS.Timeout | null = null;
let unsubscribe: (() => void) | null = null;
const stream = new ReadableStream<Uint8Array>({
start(controller) {
const push = () => {
const s = getAuthState();
const payload = {
type: 'auth-state',
state: s,
msRemaining: s.kind === 'ready' ? Math.max(0, s.expiresAt - Date.now()) : undefined
};
controller.enqueue(encoder.encode(`event: auth-state\ndata: ${JSON.stringify(payload)}\n\n`));
};
unsubscribe = subscribe((event) => {
if (event.type === 'auth-state') {
controller.enqueue(encoder.encode(`event: auth-state\ndata: ${JSON.stringify(event)}\n\n`));
}
});
push();
// The auth stream double-serves as the token-countdown feed; the
// frontend uses the msRemaining to render a per-second ticker,
// so we push every 5s even without a state change.
heartbeat = setInterval(push, HEARTBEAT_MS);
},
cancel() {
if (heartbeat) clearInterval(heartbeat);
if (unsubscribe) unsubscribe();
}
});
return new Response(stream, {
headers: {
'Content-Type': 'text/event-stream',
'Cache-Control': 'no-cache, no-transform',
Connection: 'keep-alive'
}
});
}
+45
View File
@@ -0,0 +1,45 @@
import { subscribe, type PipelineEvent } from '$lib/server/pipeline/bus.js';
// Multiplexed SSE. Every event with a type field goes out. The client filters
// by type (server-state | deployment-opened | sweep-tick | server-changed).
const encoder = new TextEncoder();
const HEARTBEAT_MS = 20_000;
function send(controller: ReadableStreamDefaultController<Uint8Array>, event: PipelineEvent): void {
controller.enqueue(encoder.encode(`event: ${event.type}\ndata: ${JSON.stringify(event)}\n\n`));
}
export async function GET() {
let heartbeat: NodeJS.Timeout | null = null;
let unsubscribe: (() => void) | null = null;
const stream = new ReadableStream<Uint8Array>({
start(controller) {
unsubscribe = subscribe((event) => {
if (
event.type === 'server-state' ||
event.type === 'deployment-opened' ||
event.type === 'server-changed' ||
event.type === 'sweep-tick'
) {
send(controller, event);
}
});
controller.enqueue(encoder.encode(': hello\n\n'));
heartbeat = setInterval(() => controller.enqueue(encoder.encode(': ping\n\n')), HEARTBEAT_MS);
},
cancel() {
if (heartbeat) clearInterval(heartbeat);
if (unsubscribe) unsubscribe();
}
});
return new Response(stream, {
headers: {
'Content-Type': 'text/event-stream',
'Cache-Control': 'no-cache, no-transform',
Connection: 'keep-alive'
}
});
}
+33
View File
@@ -0,0 +1,33 @@
import { subscribe } from '$lib/server/pipeline/bus.js';
const encoder = new TextEncoder();
const HEARTBEAT_MS = 20_000;
export async function GET() {
let heartbeat: NodeJS.Timeout | null = null;
let unsubscribe: (() => void) | null = null;
const stream = new ReadableStream<Uint8Array>({
start(controller) {
unsubscribe = subscribe((event) => {
if (event.type === 'server-status') {
controller.enqueue(encoder.encode(`event: server-status\ndata: ${JSON.stringify(event)}\n\n`));
}
});
controller.enqueue(encoder.encode(': hello\n\n'));
heartbeat = setInterval(() => controller.enqueue(encoder.encode(': ping\n\n')), HEARTBEAT_MS);
},
cancel() {
if (heartbeat) clearInterval(heartbeat);
if (unsubscribe) unsubscribe();
}
});
return new Response(stream, {
headers: {
'Content-Type': 'text/event-stream',
'Cache-Control': 'no-cache, no-transform',
Connection: 'keep-alive'
}
});
}