terminull-arcade 1.0.0 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +33 -15
- package/dist/{chunk-5CMAXV4B.js → chunk-BIOTUQT7.js} +1589 -1189
- package/dist/chunk-BIOTUQT7.js.map +1 -0
- package/dist/cli.js +64 -18
- package/dist/cli.js.map +1 -1
- package/dist/index.d.ts +182 -5
- package/dist/index.js +971 -7
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-5CMAXV4B.js.map +0 -1
package/dist/cli.js
CHANGED
|
@@ -5,26 +5,67 @@ import {
|
|
|
5
5
|
APP_TAGLINE,
|
|
6
6
|
APP_VERSION,
|
|
7
7
|
ArcadeMenu,
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
CyberViperGame,
|
|
9
|
+
HashMatrixGame,
|
|
10
10
|
PacketManGame,
|
|
11
|
+
VoidInvadersGame,
|
|
11
12
|
defaultAchievements,
|
|
12
13
|
defaultEngine,
|
|
14
|
+
defaultRenderer,
|
|
13
15
|
defaultStorage,
|
|
14
|
-
formatTime
|
|
15
|
-
|
|
16
|
+
formatTime,
|
|
17
|
+
playArcadeLoadingScreen
|
|
18
|
+
} from "./chunk-BIOTUQT7.js";
|
|
16
19
|
|
|
17
20
|
// src/cli.ts
|
|
18
21
|
import { Command } from "commander";
|
|
19
22
|
import chalk from "chalk";
|
|
23
|
+
import readline from "readline";
|
|
20
24
|
defaultEngine.registerGame("packet-man", () => new PacketManGame());
|
|
21
|
-
defaultEngine.registerGame("
|
|
22
|
-
defaultEngine.registerGame("
|
|
25
|
+
defaultEngine.registerGame("cyber-viper", () => new CyberViperGame());
|
|
26
|
+
defaultEngine.registerGame("void-invaders", () => new VoidInvadersGame());
|
|
27
|
+
defaultEngine.registerGame("hash-matrix", () => new HashMatrixGame());
|
|
23
28
|
var program = new Command();
|
|
24
29
|
program.name("terminull-arcade").description(`${chalk.cyanBright.bold(APP_NAME)} - ${APP_TAGLINE}`).version(APP_VERSION);
|
|
25
|
-
program.action(() => {
|
|
26
|
-
|
|
30
|
+
program.option("-y, --yes", "Skip entry confirmation prompt").action((options) => {
|
|
31
|
+
if (options.yes) {
|
|
32
|
+
launchInteractiveMenu();
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
promptToEnterArcade();
|
|
27
36
|
});
|
|
37
|
+
function promptToEnterArcade() {
|
|
38
|
+
const nodeVersion = process.version;
|
|
39
|
+
console.log(`
|
|
40
|
+
${chalk.cyanBright.bold(" \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2557\u2588\u2588\u2557\u2588\u2588\u2588\u2557 \u2588\u2588\u2557\u2588\u2588\u2557 \u2588\u2588\u2557\u2588\u2588\u2557 \u2588\u2588\u2557 ")}`);
|
|
41
|
+
console.log(chalk.cyanBright.bold(" \u255A\u2550\u2550\u2588\u2588\u2554\u2550\u2550\u255D\u2588\u2588\u2554\u2550\u2550\u2550\u2550\u255D\u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2557\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2551\u2588\u2588\u2551\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2551\u2588\u2588\u2551 \u2588\u2588\u2551\u2588\u2588\u2551 \u2588\u2588\u2551 "));
|
|
42
|
+
console.log(chalk.magentaBright(" \u2588\u2588\u2551 \u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2588\u2554\u255D\u2588\u2588\u2554\u2588\u2588\u2588\u2588\u2554\u2588\u2588\u2551\u2588\u2588\u2551\u2588\u2588\u2554\u2588\u2588\u2557 \u2588\u2588\u2551\u2588\u2588\u2551 \u2588\u2588\u2551\u2588\u2588\u2551 \u2588\u2588\u2551 "));
|
|
43
|
+
console.log(chalk.magentaBright(" \u2588\u2588\u2551 \u2588\u2588\u2554\u2550\u2550\u255D \u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2557\u2588\u2588\u2551\u255A\u2588\u2588\u2554\u255D\u2588\u2588\u2551\u2588\u2588\u2551\u2588\u2588\u2551\u255A\u2588\u2588\u2557\u2588\u2588\u2551\u2588\u2588\u2551 \u2588\u2588\u2551\u2588\u2588\u2551 \u2588\u2588\u2551 "));
|
|
44
|
+
console.log(chalk.gray(" \u2588\u2588\u2551 \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2551 \u2588\u2588\u2551\u2588\u2588\u2551 \u255A\u2550\u255D \u2588\u2588\u2551\u2588\u2588\u2551\u2588\u2588\u2551 \u255A\u2588\u2588\u2588\u2588\u2551\u255A\u2588\u2588\u2588\u2588\u2588\u2588\u2554\u255D\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557"));
|
|
45
|
+
console.log(chalk.gray(" \u255A\u2550\u255D \u255A\u2550\u2550\u2550\u2550\u2550\u2550\u255D\u255A\u2550\u255D \u255A\u2550\u255D\u255A\u2550\u255D \u255A\u2550\u255D\u255A\u2550\u255D\u255A\u2550\u255D \u255A\u2550\u2550\u2550\u255D \u255A\u2550\u2550\u2550\u2550\u2550\u255D \u255A\u2550\u2550\u2550\u2550\u2550\u2550\u255D\u255A\u2550\u2550\u2550\u2550\u2550\u2550\u255D"));
|
|
46
|
+
console.log(`
|
|
47
|
+
${chalk.yellowBright(APP_TAGLINE)}`);
|
|
48
|
+
console.log(` ${chalk.greenBright("\u2713")} Node.js Runtime Verified: ${chalk.whiteBright(nodeVersion)} (Node.js 18+ required)`);
|
|
49
|
+
console.log(` ${chalk.gray("All arcade games run 100% locally with zero external network access.")}
|
|
50
|
+
`);
|
|
51
|
+
const rl = readline.createInterface({
|
|
52
|
+
input: process.stdin,
|
|
53
|
+
output: process.stdout
|
|
54
|
+
});
|
|
55
|
+
rl.question(` ${chalk.cyanBright.bold("Enter Terminull Arcade?")} ${chalk.gray("(y/n) [default: y]: ")}`, (answer) => {
|
|
56
|
+
rl.close();
|
|
57
|
+
const trimmed = answer.trim().toLowerCase();
|
|
58
|
+
if (!trimmed || trimmed === "y" || trimmed === "yes") {
|
|
59
|
+
launchInteractiveMenu();
|
|
60
|
+
} else {
|
|
61
|
+
console.log(`
|
|
62
|
+
${chalk.gray("Arcade launch aborted.")}`);
|
|
63
|
+
console.log(` ${chalk.gray("Whenever you are ready, run:")} ${chalk.cyan("npx terminull-arcade")}
|
|
64
|
+
`);
|
|
65
|
+
process.exit(0);
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
}
|
|
28
69
|
program.command("list").description("List all available games in the Terminull arcade").action(() => {
|
|
29
70
|
const profile = defaultStorage.getProfile();
|
|
30
71
|
console.log(`
|
|
@@ -34,34 +75,39 @@ ${chalk.cyanBright.bold("=== TERMINULL ARCADE ROSTER ===")}
|
|
|
34
75
|
console.log(chalk.gray("\u2500".repeat(65)));
|
|
35
76
|
for (const game of Object.values(ALL_GAMES_METADATA)) {
|
|
36
77
|
const high = profile.highScores[game.id] || 0;
|
|
37
|
-
const isImplemented = defaultEngine.getRegisteredGames().includes(game.id);
|
|
38
|
-
const nameStr = isImplemented ? chalk.whiteBright(game.name) : chalk.gray(`${game.name} *`);
|
|
39
78
|
console.log(
|
|
40
|
-
chalk.cyan(game.id.padEnd(18)) +
|
|
79
|
+
chalk.cyan(game.id.padEnd(18)) + chalk.whiteBright(game.name.padEnd(20)) + chalk.magenta(game.category.padEnd(14)) + chalk.yellow(high.toString())
|
|
41
80
|
);
|
|
42
81
|
}
|
|
43
82
|
console.log(`
|
|
44
|
-
${chalk.gray("
|
|
45
|
-
console.log(`${chalk.gray("Run")} ${chalk.cyan("npx terminull-arcade play <game-id>")} ${chalk.gray("to launch directly.")}
|
|
83
|
+
${chalk.gray("Run")} ${chalk.cyan("npx terminull-arcade play <game-id>")} ${chalk.gray("to launch directly.")}
|
|
46
84
|
`);
|
|
47
85
|
});
|
|
48
|
-
program.command("play <game-id>").description("Launch a game directly by ID").option("-d, --difficulty <level>", "Difficulty: easy, normal, hard, insane", "normal").action((gameId, options) => {
|
|
86
|
+
program.command("play <game-id>").description("Launch a game directly by ID").option("-d, --difficulty <level>", "Difficulty: easy, normal, hard, insane", "normal").action(async (gameId, options) => {
|
|
49
87
|
const validDiff = ["easy", "normal", "hard", "insane"].includes(options.difficulty) ? options.difficulty : "normal";
|
|
50
|
-
|
|
88
|
+
let targetGameId = gameId;
|
|
89
|
+
if (gameId === "space-invaders") {
|
|
90
|
+
targetGameId = "void-invaders";
|
|
91
|
+
} else if (gameId === "matrix" || gameId === "hacker" || gameId === "hash") {
|
|
92
|
+
targetGameId = "hash-matrix";
|
|
93
|
+
}
|
|
94
|
+
if (!ALL_GAMES_METADATA[targetGameId]) {
|
|
51
95
|
console.error(chalk.redBright(`
|
|
52
96
|
Error: Unknown game ID "${gameId}".`));
|
|
53
|
-
console.log(`Run ${chalk.cyan("npx terminull list")} to view valid game IDs.
|
|
97
|
+
console.log(`Run ${chalk.cyan("npx terminull-arcade list")} to view valid game IDs.
|
|
54
98
|
`);
|
|
55
99
|
process.exit(1);
|
|
56
100
|
}
|
|
57
|
-
if (!defaultEngine.getRegisteredGames().includes(
|
|
101
|
+
if (!defaultEngine.getRegisteredGames().includes(targetGameId)) {
|
|
58
102
|
console.error(chalk.yellowBright(`
|
|
59
103
|
Notice: "${gameId}" implementation is staged in pipeline.`));
|
|
60
104
|
console.log(`Currently playable games: ${chalk.cyan(defaultEngine.getRegisteredGames().join(", "))}
|
|
61
105
|
`);
|
|
62
106
|
process.exit(0);
|
|
63
107
|
}
|
|
64
|
-
|
|
108
|
+
const meta = ALL_GAMES_METADATA[targetGameId];
|
|
109
|
+
await playArcadeLoadingScreen(meta, defaultRenderer, defaultStorage);
|
|
110
|
+
defaultEngine.launchGame(targetGameId, validDiff, {
|
|
65
111
|
onQuitToMenu: () => {
|
|
66
112
|
launchInteractiveMenu();
|
|
67
113
|
}
|
package/dist/cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/cli.ts"],"sourcesContent":["import { Command } from 'commander';\nimport chalk from 'chalk';\nimport { APP_NAME, APP_TAGLINE, APP_VERSION, ALL_GAMES_METADATA } from './shared/constants.js';\nimport { GameId, DifficultyLevel } from './shared/types.js';\nimport { defaultStorage } from './core/storage.js';\nimport { defaultAchievements } from './core/achievements.js';\nimport { defaultEngine } from './core/engine.js';\nimport { ArcadeMenu } from './core/menu.js';\nimport { formatTime } from './shared/utils.js';\nimport { NeonCircuitGame } from './games/neon-circuit/index.js';\nimport { ByteRunnerGame } from './games/byte-runner/index.js';\nimport { PacketManGame } from './games/packet-man/index.js';\n\n// Register implemented games\ndefaultEngine.registerGame('packet-man', () => new PacketManGame());\ndefaultEngine.registerGame('neon-circuit', () => new NeonCircuitGame());\ndefaultEngine.registerGame('byte-runner', () => new ByteRunnerGame());\n\nconst program = new Command();\n\nprogram\n .name('terminull-arcade')\n .description(`${chalk.cyanBright.bold(APP_NAME)} - ${APP_TAGLINE}`)\n .version(APP_VERSION);\n\n// Default action: launch interactive arcade menu\nprogram\n .action(() => {\n launchInteractiveMenu();\n });\n\nprogram\n .command('list')\n .description('List all available games in the Terminull arcade')\n .action(() => {\n const profile = defaultStorage.getProfile();\n console.log(`\\n${chalk.cyanBright.bold('=== TERMINULL ARCADE ROSTER ===')}\\n`);\n console.log(chalk.gray(`ID`.padEnd(18) + `NAME`.padEnd(20) + `CATEGORY`.padEnd(14) + `HIGH SCORE`));\n console.log(chalk.gray('─'.repeat(65)));\n\n for (const game of Object.values(ALL_GAMES_METADATA)) {\n const high = profile.highScores[game.id] || 0;\n const isImplemented = defaultEngine.getRegisteredGames().includes(game.id);\n const nameStr = isImplemented ? chalk.whiteBright(game.name) : chalk.gray(`${game.name} *`);\n console.log(\n chalk.cyan(game.id.padEnd(18)) +\n nameStr.padEnd(20) +\n chalk.magenta(game.category.padEnd(14)) +\n chalk.yellow(high.toString())\n );\n }\n console.log(`\\n${chalk.gray('* Games marked with * are queued in the core pipeline.')}`);\n console.log(`${chalk.gray('Run')} ${chalk.cyan('npx terminull-arcade play <game-id>')} ${chalk.gray('to launch directly.')}\\n`);\n });\n\nprogram\n .command('play <game-id>')\n .description('Launch a game directly by ID')\n .option('-d, --difficulty <level>', 'Difficulty: easy, normal, hard, insane', 'normal')\n .action((gameId: string, options: { difficulty: string }) => {\n const validDiff: DifficultyLevel = ['easy', 'normal', 'hard', 'insane'].includes(options.difficulty)\n ? (options.difficulty as DifficultyLevel)\n : 'normal';\n\n if (!ALL_GAMES_METADATA[gameId as GameId]) {\n console.error(chalk.redBright(`\\nError: Unknown game ID \"${gameId}\".`));\n console.log(`Run ${chalk.cyan('npx terminull list')} to view valid game IDs.\\n`);\n process.exit(1);\n }\n\n if (!defaultEngine.getRegisteredGames().includes(gameId as GameId)) {\n console.error(chalk.yellowBright(`\\nNotice: \"${gameId}\" implementation is staged in pipeline.`));\n console.log(`Currently playable games: ${chalk.cyan(defaultEngine.getRegisteredGames().join(', '))}\\n`);\n process.exit(0);\n }\n\n defaultEngine.launchGame(gameId as GameId, validDiff, {\n onQuitToMenu: () => {\n launchInteractiveMenu();\n },\n });\n });\n\nprogram\n .command('stats')\n .description('Display career statistics and achievements')\n .action(() => {\n const profile = defaultStorage.getProfile();\n const stats = defaultAchievements.getTotalStats();\n\n let totalScore = 0;\n let totalPlays = 0;\n let totalSec = 0;\n\n for (const id of Object.keys(ALL_GAMES_METADATA)) {\n totalScore += profile.highScores[id] || 0;\n totalPlays += profile.playCounts[id] || 0;\n totalSec += profile.totalTimePlayedSec[id] || 0;\n }\n\n console.log(`\\n${chalk.cyanBright.bold('=== TERMINULL PILOT TELEMETRY ===')}\\n`);\n console.log(`${chalk.gray('Cumulative High Score:')} ${chalk.yellowBright(totalScore.toLocaleString())}`);\n console.log(`${chalk.gray('Total Play Sessions:')} ${chalk.cyanBright(totalPlays)}`);\n console.log(`${chalk.gray('Total Time in Engine:')} ${chalk.magentaBright(formatTime(totalSec))}`);\n console.log(`${chalk.gray('Achievements Unlocked:')} ${chalk.greenBright(`${stats.unlockedCount} / ${stats.totalCount} (${stats.percentage}%)`)}`);\n console.log(`${chalk.gray('Current Active Theme:')} ${chalk.whiteBright(profile.settings.theme)}`);\n console.log(`${chalk.gray('Profile Path:')} ${chalk.gray(defaultStorage.getProfilePath())}\\n`);\n });\n\nprogram\n .command('reset')\n .description('Reset local high scores, achievements, and stats')\n .option('-f, --force', 'Force reset without confirmation prompt')\n .action(() => {\n defaultStorage.resetProfile();\n console.log(chalk.greenBright('\\n✓ Terminull local profile, high scores, and achievements have been reset.\\n'));\n });\n\nfunction launchInteractiveMenu(): void {\n const menu = new ArcadeMenu();\n menu.open((selection) => {\n if (selection.action === 'play' && selection.gameId) {\n if (!defaultEngine.getRegisteredGames().includes(selection.gameId)) {\n console.log(chalk.yellowBright(`\\nGame \"${selection.gameId}\" is staged in the pipeline.\\n`));\n process.exit(0);\n }\n defaultEngine.launchGame(selection.gameId, selection.difficulty, {\n onQuitToMenu: () => launchInteractiveMenu(),\n });\n } else {\n process.exit(0);\n }\n });\n}\n\nprogram.parse(process.argv);\n"],"mappings":";;;;;;;;;;;;;;;;;AAAA,SAAS,eAAe;AACxB,OAAO,WAAW;AAalB,cAAc,aAAa,cAAc,MAAM,IAAI,cAAc,CAAC;AAClE,cAAc,aAAa,gBAAgB,MAAM,IAAI,gBAAgB,CAAC;AACtE,cAAc,aAAa,eAAe,MAAM,IAAI,eAAe,CAAC;AAEpE,IAAM,UAAU,IAAI,QAAQ;AAE5B,QACG,KAAK,kBAAkB,EACvB,YAAY,GAAG,MAAM,WAAW,KAAK,QAAQ,CAAC,MAAM,WAAW,EAAE,EACjE,QAAQ,WAAW;AAGtB,QACG,OAAO,MAAM;AACZ,wBAAsB;AACxB,CAAC;AAEH,QACG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AAM,cAAc,WAAW,QAAQ,CAAC,CAAC,EAAE;AACpG,UAAQ,IAAI,GAAG,MAAM,KAAK,wBAAwB,CAAC,MAAM,MAAM,YAAY,GAAG,MAAM,aAAa,MAAM,MAAM,UAAU,KAAK,MAAM,UAAU,IAAI,CAAC,EAAE;AACnJ,UAAQ,IAAI,GAAG,MAAM,KAAK,uBAAuB,CAAC,OAAO,MAAM,YAAY,QAAQ,SAAS,KAAK,CAAC,EAAE;AACpG,UAAQ,IAAI,GAAG,MAAM,KAAK,eAAe,CAAC,eAAe,MAAM,KAAK,eAAe,eAAe,CAAC,CAAC;AAAA,CAAI;AAC1G,CAAC;AAEH,QACG,QAAQ,OAAO,EACf,YAAY,kDAAkD,EAC9D,OAAO,eAAe,yCAAyC,EAC/D,OAAO,MAAM;AACZ,iBAAe,aAAa;AAC5B,UAAQ,IAAI,MAAM,YAAY,oFAA+E,CAAC;AAChH,CAAC;AAEH,SAAS,wBAA8B;AACrC,QAAM,OAAO,IAAI,WAAW;AAC5B,OAAK,KAAK,CAAC,cAAc;AACvB,QAAI,UAAU,WAAW,UAAU,UAAU,QAAQ;AACnD,UAAI,CAAC,cAAc,mBAAmB,EAAE,SAAS,UAAU,MAAM,GAAG;AAClE,gBAAQ,IAAI,MAAM,aAAa;AAAA,QAAW,UAAU,MAAM;AAAA,CAAgC,CAAC;AAC3F,gBAAQ,KAAK,CAAC;AAAA,MAChB;AACA,oBAAc,WAAW,UAAU,QAAQ,UAAU,YAAY;AAAA,QAC/D,cAAc,MAAM,sBAAsB;AAAA,MAC5C,CAAC;AAAA,IACH,OAAO;AACL,cAAQ,KAAK,CAAC;AAAA,IAChB;AAAA,EACF,CAAC;AACH;AAEA,QAAQ,MAAM,QAAQ,IAAI;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../src/cli.ts"],"sourcesContent":["import { Command } from 'commander';\nimport chalk from 'chalk';\nimport { APP_NAME, APP_TAGLINE, APP_VERSION, ALL_GAMES_METADATA } from './shared/constants.js';\nimport { GameId, DifficultyLevel } from './shared/types.js';\nimport { defaultStorage } from './core/storage.js';\nimport { defaultAchievements } from './core/achievements.js';\nimport { defaultEngine } from './core/engine.js';\nimport { ArcadeMenu, playArcadeLoadingScreen } from './core/menu.js';\nimport { defaultRenderer } from './core/renderer.js';\nimport { formatTime } from './shared/utils.js';\nimport { PacketManGame } from './games/packet-man/index.js';\nimport { CyberViperGame } from './games/cyber-viper/index.js';\nimport { VoidInvadersGame } from './games/void-invaders/index.js';\nimport { HashMatrixGame } from './games/hash-matrix/index.js';\n\n// Register active games\ndefaultEngine.registerGame('packet-man', () => new PacketManGame());\ndefaultEngine.registerGame('cyber-viper', () => new CyberViperGame());\ndefaultEngine.registerGame('void-invaders', () => new VoidInvadersGame());\ndefaultEngine.registerGame('hash-matrix', () => new HashMatrixGame());\n\nconst program = new Command();\n\nprogram\n .name('terminull-arcade')\n .description(`${chalk.cyanBright.bold(APP_NAME)} - ${APP_TAGLINE}`)\n .version(APP_VERSION);\n\nimport readline from 'node:readline';\n\n// Default action: prompt to enter arcade with (y) confirmation\nprogram\n .option('-y, --yes', 'Skip entry confirmation prompt')\n .action((options: { yes?: boolean }) => {\n if (options.yes) {\n launchInteractiveMenu();\n return;\n }\n\n promptToEnterArcade();\n });\n\nfunction promptToEnterArcade(): void {\n const nodeVersion = process.version;\n console.log(`\\n${chalk.cyanBright.bold(' ████████╗███████╗██████╗ ███╗ ███╗██╗███╗ ██╗██╗ ██╗██╗ ██╗ ')}`);\n console.log(chalk.cyanBright.bold(' ╚══██╔══╝██╔════╝██╔══██╗████╗ ████║██║████╗ ██║██║ ██║██║ ██║ '));\n console.log(chalk.magentaBright(' ██║ █████╗ ██████╔╝██╔████╔██║██║██╔██╗ ██║██║ ██║██║ ██║ '));\n console.log(chalk.magentaBright(' ██║ ██╔══╝ ██╔══██╗██║╚██╔╝██║██║██║╚██╗██║██║ ██║██║ ██║ '));\n console.log(chalk.gray(' ██║ ███████╗██║ ██║██║ ╚═╝ ██║██║██║ ╚████║╚██████╔╝███████╗███████╗'));\n console.log(chalk.gray(' ╚═╝ ╚══════╝╚═╝ ╚═╝╚═╝ ╚═╝╚═╝╚═╝ ╚═══╝ ╚═════╝ ╚══════╝╚══════╝'));\n console.log(`\\n ${chalk.yellowBright(APP_TAGLINE)}`);\n console.log(` ${chalk.greenBright('✓')} Node.js Runtime Verified: ${chalk.whiteBright(nodeVersion)} (Node.js 18+ required)`);\n console.log(` ${chalk.gray('All arcade games run 100% locally with zero external network access.')}\\n`);\n\n const rl = readline.createInterface({\n input: process.stdin,\n output: process.stdout,\n });\n\n rl.question(` ${chalk.cyanBright.bold('Enter Terminull Arcade?')} ${chalk.gray('(y/n) [default: y]: ')}`, (answer) => {\n rl.close();\n const trimmed = answer.trim().toLowerCase();\n if (!trimmed || trimmed === 'y' || trimmed === 'yes') {\n launchInteractiveMenu();\n } else {\n console.log(`\\n ${chalk.gray('Arcade launch aborted.')}`);\n console.log(` ${chalk.gray('Whenever you are ready, run:')} ${chalk.cyan('npx terminull-arcade')}\\n`);\n process.exit(0);\n }\n });\n}\n\nprogram\n .command('list')\n .description('List all available games in the Terminull arcade')\n .action(() => {\n const profile = defaultStorage.getProfile();\n console.log(`\\n${chalk.cyanBright.bold('=== TERMINULL ARCADE ROSTER ===')}\\n`);\n console.log(chalk.gray(`ID`.padEnd(18) + `NAME`.padEnd(20) + `CATEGORY`.padEnd(14) + `HIGH SCORE`));\n console.log(chalk.gray('─'.repeat(65)));\n\n for (const game of Object.values(ALL_GAMES_METADATA)) {\n const high = profile.highScores[game.id] || 0;\n console.log(\n chalk.cyan(game.id.padEnd(18)) +\n chalk.whiteBright(game.name.padEnd(20)) +\n chalk.magenta(game.category.padEnd(14)) +\n chalk.yellow(high.toString())\n );\n }\n console.log(`\\n${chalk.gray('Run')} ${chalk.cyan('npx terminull-arcade play <game-id>')} ${chalk.gray('to launch directly.')}\\n`);\n });\n\nprogram\n .command('play <game-id>')\n .description('Launch a game directly by ID')\n .option('-d, --difficulty <level>', 'Difficulty: easy, normal, hard, insane', 'normal')\n .action(async (gameId: string, options: { difficulty: string }) => {\n const validDiff: DifficultyLevel = ['easy', 'normal', 'hard', 'insane'].includes(options.difficulty)\n ? (options.difficulty as DifficultyLevel)\n : 'normal';\n\n let targetGameId = gameId as GameId;\n if (gameId === 'space-invaders') {\n targetGameId = 'void-invaders';\n } else if (gameId === 'matrix' || gameId === 'hacker' || gameId === 'hash') {\n targetGameId = 'hash-matrix';\n }\n\n if (!ALL_GAMES_METADATA[targetGameId]) {\n console.error(chalk.redBright(`\\nError: Unknown game ID \"${gameId}\".`));\n console.log(`Run ${chalk.cyan('npx terminull-arcade list')} to view valid game IDs.\\n`);\n process.exit(1);\n }\n\n if (!defaultEngine.getRegisteredGames().includes(targetGameId)) {\n console.error(chalk.yellowBright(`\\nNotice: \"${gameId}\" implementation is staged in pipeline.`));\n console.log(`Currently playable games: ${chalk.cyan(defaultEngine.getRegisteredGames().join(', '))}\\n`);\n process.exit(0);\n }\n\n const meta = ALL_GAMES_METADATA[targetGameId]!;\n await playArcadeLoadingScreen(meta, defaultRenderer, defaultStorage);\n\n defaultEngine.launchGame(targetGameId, validDiff, {\n onQuitToMenu: () => {\n launchInteractiveMenu();\n },\n });\n });\n\nprogram\n .command('stats')\n .description('Display career statistics and achievements')\n .action(() => {\n const profile = defaultStorage.getProfile();\n const stats = defaultAchievements.getTotalStats();\n\n let totalScore = 0;\n let totalPlays = 0;\n let totalSec = 0;\n\n for (const id of Object.keys(ALL_GAMES_METADATA)) {\n totalScore += profile.highScores[id] || 0;\n totalPlays += profile.playCounts[id] || 0;\n totalSec += profile.totalTimePlayedSec[id] || 0;\n }\n\n console.log(`\\n${chalk.cyanBright.bold('=== TERMINULL PILOT TELEMETRY ===')}\\n`);\n console.log(`${chalk.gray('Cumulative High Score:')} ${chalk.yellowBright(totalScore.toLocaleString())}`);\n console.log(`${chalk.gray('Total Play Sessions:')} ${chalk.cyanBright(totalPlays)}`);\n console.log(`${chalk.gray('Total Time in Engine:')} ${chalk.magentaBright(formatTime(totalSec))}`);\n console.log(`${chalk.gray('Achievements Unlocked:')} ${chalk.greenBright(`${stats.unlockedCount} / ${stats.totalCount} (${stats.percentage}%)`)}`);\n console.log(`${chalk.gray('Current Active Theme:')} ${chalk.whiteBright(profile.settings.theme)}`);\n console.log(`${chalk.gray('Profile Path:')} ${chalk.gray(defaultStorage.getProfilePath())}\\n`);\n });\n\nprogram\n .command('reset')\n .description('Reset local high scores, achievements, and stats')\n .option('-f, --force', 'Force reset without confirmation prompt')\n .action(() => {\n defaultStorage.resetProfile();\n console.log(chalk.greenBright('\\n✓ Terminull local profile, high scores, and achievements have been reset.\\n'));\n });\n\nfunction launchInteractiveMenu(): void {\n const menu = new ArcadeMenu();\n menu.open((selection) => {\n if (selection.action === 'play' && selection.gameId) {\n if (!defaultEngine.getRegisteredGames().includes(selection.gameId)) {\n console.log(chalk.yellowBright(`\\nGame \"${selection.gameId}\" is staged in the pipeline.\\n`));\n process.exit(0);\n }\n defaultEngine.launchGame(selection.gameId, selection.difficulty, {\n onQuitToMenu: () => launchInteractiveMenu(),\n });\n } else {\n process.exit(0);\n }\n });\n}\n\nprogram.parse(process.argv);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA,SAAS,eAAe;AACxB,OAAO,WAAW;AA2BlB,OAAO,cAAc;AAZrB,cAAc,aAAa,cAAc,MAAM,IAAI,cAAc,CAAC;AAClE,cAAc,aAAa,eAAe,MAAM,IAAI,eAAe,CAAC;AACpE,cAAc,aAAa,iBAAiB,MAAM,IAAI,iBAAiB,CAAC;AACxE,cAAc,aAAa,eAAe,MAAM,IAAI,eAAe,CAAC;AAEpE,IAAM,UAAU,IAAI,QAAQ;AAE5B,QACG,KAAK,kBAAkB,EACvB,YAAY,GAAG,MAAM,WAAW,KAAK,QAAQ,CAAC,MAAM,WAAW,EAAE,EACjE,QAAQ,WAAW;AAKtB,QACG,OAAO,aAAa,gCAAgC,EACpD,OAAO,CAAC,YAA+B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
+
type GameId = 'packet-man' | 'cyber-viper' | 'void-invaders' | 'hash-matrix';
|
|
4
4
|
type DifficultyLevel = 'easy' | 'normal' | 'hard' | 'insane';
|
|
5
|
-
type GameCategory = '
|
|
5
|
+
type GameCategory = 'arcade' | 'puzzle' | 'strategy' | 'action';
|
|
6
6
|
type ThemeName = 'default' | 'retro-green' | 'neon' | 'minimal' | 'high-contrast';
|
|
7
7
|
interface KeyBinding {
|
|
8
8
|
key: string;
|
|
@@ -104,7 +104,10 @@ declare function checkTerminalDimensions(): {
|
|
|
104
104
|
declare function playTerminalBell(enabled?: boolean): void;
|
|
105
105
|
declare function formatTime(seconds: number): string;
|
|
106
106
|
declare function clamp(val: number, min: number, max: number): number;
|
|
107
|
-
declare function
|
|
107
|
+
declare function stripAnsi(str: string): string;
|
|
108
|
+
declare function visibleLength(str: string): number;
|
|
109
|
+
declare function padRightVisible(str: string, targetWidth: number): string;
|
|
110
|
+
declare function wordWrap(text: string, maxWidth: number): string[];
|
|
108
111
|
|
|
109
112
|
/**
|
|
110
113
|
* Deterministic Pseudo-Random Number Generator using Mulberry32.
|
|
@@ -211,10 +214,27 @@ declare class TerminalRenderer {
|
|
|
211
214
|
private currentTheme;
|
|
212
215
|
setTheme(themeName: ThemeName): void;
|
|
213
216
|
getTheme(): ColorPalette;
|
|
217
|
+
private previousLineCount;
|
|
214
218
|
enterScreen(): void;
|
|
215
219
|
exitScreen(): void;
|
|
216
|
-
|
|
220
|
+
/**
|
|
221
|
+
* Safe frame render with zero flickering.
|
|
222
|
+
* Repaints lines in place with cursor hidden and atomic buffer write,
|
|
223
|
+
* avoiding full-screen blanking clears.
|
|
224
|
+
*/
|
|
225
|
+
renderFrame(content: string): void;
|
|
226
|
+
/**
|
|
227
|
+
* Retained for compatibility. Forwards to flicker-free renderFrame.
|
|
228
|
+
*/
|
|
217
229
|
draw(content: string): void;
|
|
230
|
+
/**
|
|
231
|
+
* Intentionally no-op during active game loop to prevent blank-frame visual strobing.
|
|
232
|
+
*/
|
|
233
|
+
clear(): void;
|
|
234
|
+
/**
|
|
235
|
+
* Explicit full screen wipe when transitioning between major modes.
|
|
236
|
+
*/
|
|
237
|
+
forceClear(): void;
|
|
218
238
|
isWindowAdequate(): {
|
|
219
239
|
adequate: boolean;
|
|
220
240
|
width: number;
|
|
@@ -277,6 +297,7 @@ interface MenuSelection {
|
|
|
277
297
|
gameId?: GameId;
|
|
278
298
|
difficulty?: DifficultyLevel;
|
|
279
299
|
}
|
|
300
|
+
declare function playArcadeLoadingScreen(game: GameMetadata, renderer?: TerminalRenderer, storage?: StorageManager): Promise<void>;
|
|
280
301
|
declare class ArcadeMenu {
|
|
281
302
|
private storage;
|
|
282
303
|
private achievements;
|
|
@@ -288,12 +309,18 @@ declare class ArcadeMenu {
|
|
|
288
309
|
private currentTab;
|
|
289
310
|
private selectedDifficulty;
|
|
290
311
|
private onSelectCallback;
|
|
312
|
+
private animTimer;
|
|
313
|
+
private animFrame;
|
|
291
314
|
constructor(storage?: StorageManager, achievements?: AchievementManager, renderer?: TerminalRenderer);
|
|
292
315
|
open(onSelect: (selection: MenuSelection) => void): void;
|
|
293
316
|
close(): void;
|
|
317
|
+
private ringBell;
|
|
294
318
|
private getFilteredGames;
|
|
319
|
+
private triggerLaunch;
|
|
295
320
|
private handleInput;
|
|
296
321
|
render(): void;
|
|
322
|
+
private renderFunkyBanner;
|
|
323
|
+
private renderDifficultyBadge;
|
|
297
324
|
private renderArcadeTab;
|
|
298
325
|
private renderStatsTab;
|
|
299
326
|
private renderSettingsTab;
|
|
@@ -463,5 +490,155 @@ declare class PacketManGame implements GameModule {
|
|
|
463
490
|
getState(): PacketManState;
|
|
464
491
|
}
|
|
465
492
|
|
|
466
|
-
|
|
493
|
+
interface Point {
|
|
494
|
+
x: number;
|
|
495
|
+
y: number;
|
|
496
|
+
}
|
|
497
|
+
interface CyberViperState {
|
|
498
|
+
snake: Point[];
|
|
499
|
+
dx: number;
|
|
500
|
+
dy: number;
|
|
501
|
+
desiredDx: number;
|
|
502
|
+
desiredDy: number;
|
|
503
|
+
food: Point;
|
|
504
|
+
goldenFood: Point | null;
|
|
505
|
+
goldenFoodTicks: number;
|
|
506
|
+
score: number;
|
|
507
|
+
highScore: number;
|
|
508
|
+
applesEaten: number;
|
|
509
|
+
isGameOver: boolean;
|
|
510
|
+
isWon: boolean;
|
|
511
|
+
}
|
|
512
|
+
|
|
513
|
+
declare class CyberViperGame implements GameModule {
|
|
514
|
+
readonly id = "cyber-viper";
|
|
515
|
+
readonly metadata: GameMetadata;
|
|
516
|
+
private config;
|
|
517
|
+
private renderer;
|
|
518
|
+
private input;
|
|
519
|
+
private rng;
|
|
520
|
+
private gameLoopTimer;
|
|
521
|
+
private state;
|
|
522
|
+
private isPaused;
|
|
523
|
+
private pauseMenuIndex;
|
|
524
|
+
private showTutorial;
|
|
525
|
+
private tickIntervalMs;
|
|
526
|
+
init(config: GameInitConfig): void;
|
|
527
|
+
start(): void;
|
|
528
|
+
pause(): void;
|
|
529
|
+
resume(): void;
|
|
530
|
+
restart(): void;
|
|
531
|
+
saveState(): Record<string, unknown>;
|
|
532
|
+
loadState(saved: Record<string, unknown>): void;
|
|
533
|
+
destroy(): void;
|
|
534
|
+
private resetState;
|
|
535
|
+
private scheduleNextTick;
|
|
536
|
+
tick(): void;
|
|
537
|
+
private spawnFood;
|
|
538
|
+
private spawnGoldenFood;
|
|
539
|
+
private handleInput;
|
|
540
|
+
render(): void;
|
|
541
|
+
getState(): CyberViperState;
|
|
542
|
+
}
|
|
543
|
+
|
|
544
|
+
type InvaderType = 'scout' | 'fighter' | 'bomber' | 'mothership';
|
|
545
|
+
interface ActiveInvader {
|
|
546
|
+
id: number;
|
|
547
|
+
type: InvaderType;
|
|
548
|
+
x: number;
|
|
549
|
+
y: number;
|
|
550
|
+
glyph: string;
|
|
551
|
+
points: number;
|
|
552
|
+
alive: boolean;
|
|
553
|
+
}
|
|
554
|
+
interface Bullet {
|
|
555
|
+
x: number;
|
|
556
|
+
y: number;
|
|
557
|
+
}
|
|
558
|
+
interface VoidInvadersState {
|
|
559
|
+
playerX: number;
|
|
560
|
+
playerY: number;
|
|
561
|
+
lives: number;
|
|
562
|
+
score: number;
|
|
563
|
+
invadersDestroyed: number;
|
|
564
|
+
wave: number;
|
|
565
|
+
descentSpeedTicks: number;
|
|
566
|
+
descentTickCounter: number;
|
|
567
|
+
currentInvader: ActiveInvader | null;
|
|
568
|
+
bullets: Bullet[];
|
|
569
|
+
isGameOver: boolean;
|
|
570
|
+
isWon: boolean;
|
|
571
|
+
}
|
|
572
|
+
|
|
573
|
+
declare class VoidInvadersGame implements GameModule {
|
|
574
|
+
readonly id = "void-invaders";
|
|
575
|
+
readonly metadata: GameMetadata;
|
|
576
|
+
private config;
|
|
577
|
+
private renderer;
|
|
578
|
+
private input;
|
|
579
|
+
private rng;
|
|
580
|
+
private gameLoopTimer;
|
|
581
|
+
private invaderIdCounter;
|
|
582
|
+
private baseSpeedTicks;
|
|
583
|
+
private state;
|
|
584
|
+
private isPaused;
|
|
585
|
+
private pauseMenuIndex;
|
|
586
|
+
private showTutorial;
|
|
587
|
+
private tickIntervalMs;
|
|
588
|
+
init(config: GameInitConfig): void;
|
|
589
|
+
start(): void;
|
|
590
|
+
pause(): void;
|
|
591
|
+
resume(): void;
|
|
592
|
+
restart(): void;
|
|
593
|
+
saveState(): Record<string, unknown>;
|
|
594
|
+
loadState(saved: Record<string, unknown>): void;
|
|
595
|
+
destroy(): void;
|
|
596
|
+
private resetGame;
|
|
597
|
+
private spawnNextInvader;
|
|
598
|
+
private scheduleNextTick;
|
|
599
|
+
tick(): void;
|
|
600
|
+
private updateBullets;
|
|
601
|
+
private advanceInvaderDescent;
|
|
602
|
+
private checkCollisions;
|
|
603
|
+
private handleInput;
|
|
604
|
+
render(): void;
|
|
605
|
+
getState(): VoidInvadersState;
|
|
606
|
+
}
|
|
607
|
+
|
|
608
|
+
declare class HashMatrixGame implements GameModule {
|
|
609
|
+
readonly id = "hash-matrix";
|
|
610
|
+
readonly metadata: GameMetadata;
|
|
611
|
+
private config;
|
|
612
|
+
private renderer;
|
|
613
|
+
private input;
|
|
614
|
+
private rng;
|
|
615
|
+
private loopTimer;
|
|
616
|
+
private resizeHandler;
|
|
617
|
+
private rainDrops;
|
|
618
|
+
private memoryAddress;
|
|
619
|
+
private state;
|
|
620
|
+
private getDimensions;
|
|
621
|
+
init(config: GameInitConfig): void;
|
|
622
|
+
private initRain;
|
|
623
|
+
start(): void;
|
|
624
|
+
pause(): void;
|
|
625
|
+
resume(): void;
|
|
626
|
+
restart(): void;
|
|
627
|
+
saveState(): Record<string, unknown>;
|
|
628
|
+
loadState(saved: Record<string, unknown>): void;
|
|
629
|
+
destroy(): void;
|
|
630
|
+
private stopAndExit;
|
|
631
|
+
private handleInput;
|
|
632
|
+
private scheduleTick;
|
|
633
|
+
private tick;
|
|
634
|
+
private colorize;
|
|
635
|
+
private generateRandomHash;
|
|
636
|
+
private renderHashCascade;
|
|
637
|
+
private renderHexDump;
|
|
638
|
+
private renderMatrixRain;
|
|
639
|
+
private renderCipherBreach;
|
|
640
|
+
render(): void;
|
|
641
|
+
}
|
|
642
|
+
|
|
643
|
+
export { ALL_GAMES_METADATA, APP_NAME, APP_TAGLINE, APP_VERSION, AchievementManager, ArcadeMenu, ByteRunnerGame, CyberViperGame, DeterministicRNG, HashMatrixGame, MIN_TERMINAL_COLUMNS, MIN_TERMINAL_ROWS, NeonCircuitGame, PacketManGame, StorageManager, THEMES, TerminalInputHandler, TerminalRenderer, TerminullEngine, UserProfileSchema, UserSettingsSchema, VoidInvadersGame, checkTerminalDimensions, clamp, defaultAchievements, defaultEngine, defaultRenderer, defaultStorage, formatTime, getTheme, padRightVisible, playArcadeLoadingScreen, playTerminalBell, stripAnsi, visibleLength, wordWrap };
|
|
467
644
|
export type { Achievement, ColorPalette, DifficultyLevel, EngineEvents, GameCategory, GameId, GameInitConfig, GameMetadata, GameModule, KeyBinding, KeyPressHandler, MenuSelection, RenderHeaderOptions, ThemeName, UnlockedEvent, UserProfile, UserSettings };
|