Add desktop games, robot pet and TCG app

This commit is contained in:
SirBlob committed 2026-11-01 18:42:28 -05:00
1 parent 812503251b
commit c664f573b8
55 files changed
+5090 -15

No files matched your search

+37
View File
@@ -0,0 +1,37 @@
import type { GameName } from '#lib/content';
import { line, span } from '../output';
import type { Command } from './types';
const gameDescriptions: Record<GameName, string> = {
snake: 'Eat the food and avoid your own tail',
breakout: 'Bounce the ball and clear every brick'
};
const gameNames = Object.keys(gameDescriptions) as GameName[];
const launchCommands: Command[] = gameNames.map((game) => ({
name: game,
description: gameDescriptions[game],
hidden: true,
run: (_args, context) => context.openApp(game)
}));
const gamesCommand: Command = {
name: 'games',
description: 'List or launch the games',
usage: 'games [name]',
argumentOptions: () => gameNames,
run: (args, context) => {
const requestedGame = gameNames.find((game) => game === args[0]?.toLowerCase());
if (requestedGame) {
context.openApp(requestedGame);
return;
}
gameNames.forEach((game) =>
context.print(line(span(game.padEnd(12), 'accent', { bold: true }), gameDescriptions[game]))
);
context.print(line(span('Run ', 'muted'), span('games <name>', 'accent'), span(' to play', 'muted')));
}
};
export const gameCommands: Command[] = [gamesCommand, ...launchCommands];
+4
View File
@@ -4,6 +4,8 @@ import { blankLine, errorLine, line, span } from '../output';
import { infoCommands } from './info';
import { systemCommands } from './system';
import { pacmanCommand } from './pacman';
import { gameCommands } from './games';
import { petCommand } from './pet';
import type { Command, CommandContext } from './types';
export type { Command, CommandContext } from './types';
@@ -44,6 +46,8 @@ export const commands: Command[] = [
...infoCommands,
...systemCommands,
pacmanCommand,
...gameCommands,
petCommand,
...pageShortcuts,
...socialShortcuts
];
+19
View File
@@ -0,0 +1,19 @@
import { petState } from '#lib/pet/petState.svelte';
import { line, span } from '../output';
import type { Command } from './types';
export const petCommand: Command = {
name: 'pet',
aliases: ['robot'],
description: 'Show or hide the desktop robot',
usage: 'pet [on|off]',
argumentOptions: () => ['on', 'off'],
run: (args, context) => {
const choice = args[0]?.toLowerCase();
if (choice === 'on' || choice === 'off') petState.setEnabled(choice === 'on');
else petState.toggle();
const status = petState.enabled ? 'robot booted up' : 'robot powered down';
context.print(line(span('pet: ', 'muted'), span(status, 'accent')));
}
};
+6
View File
@@ -134,6 +134,12 @@ export const systemCommands: Command[] = [
description: 'Open the system monitor',
run: (_args, context) => context.openApp('btop')
},
{
name: 'tcg',
aliases: ['cards', 'pokemon'],
description: 'Open the Pokemon TCG card browser',
run: (_args, context) => context.openApp('tcg')
},
{
name: 'pwd',
hidden: true,