@hypersocial/cli-games 0.1.0
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/LICENSE +661 -0
- package/README.md +100 -0
- package/dist/chunk-AVGB32MC.js +697 -0
- package/dist/chunk-AVGB32MC.js.map +1 -0
- package/dist/cli.js +13694 -0
- package/dist/cli.js.map +1 -0
- package/dist/index.d.ts +695 -0
- package/dist/index.js +13764 -0
- package/dist/index.js.map +1 -0
- package/dist/themes.d.ts +125 -0
- package/dist/themes.js +27 -0
- package/dist/themes.js.map +1 -0
- package/package.json +65 -0
package/README.md
ADDED
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
# @hypersocial/cli-games
|
|
2
|
+
|
|
3
|
+
18 terminal games that run in any xterm.js terminal or directly in your CLI.
|
|
4
|
+
|
|
5
|
+
**Snake, Tetris, 2048, Pong, Asteroids, Space Invaders, Breakout, Frogger, Tron, Minesweeper, Wordle, Hangman, Simon, Runner, Tower, Typing Test, Crack, Chopper.**
|
|
6
|
+
|
|
7
|
+
## CLI Usage
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
# Interactive menu
|
|
11
|
+
npx @hypersocial/cli-games
|
|
12
|
+
|
|
13
|
+
# Launch a specific game
|
|
14
|
+
npx @hypersocial/cli-games snake
|
|
15
|
+
npx @hypersocial/cli-games tetris
|
|
16
|
+
|
|
17
|
+
# Choose a color theme
|
|
18
|
+
npx @hypersocial/cli-games --theme green
|
|
19
|
+
npx @hypersocial/cli-games --theme amber snake
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
### Available Themes
|
|
23
|
+
|
|
24
|
+
`cyan` (default), `amber`, `green`, `white`, `hotpink`, `blood`, `ice`, `bladerunner`, `tron`, `kawaii`, `oled`, `solarized`, `nord`, `highcontrast`, `banana`, `cream`, and their light variants.
|
|
25
|
+
|
|
26
|
+
## Library Usage (xterm.js)
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
npm install @hypersocial/cli-games
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
```typescript
|
|
33
|
+
import { games, setTheme, runGame } from '@hypersocial/cli-games';
|
|
34
|
+
|
|
35
|
+
// Set the color theme
|
|
36
|
+
setTheme('cyan');
|
|
37
|
+
|
|
38
|
+
// Run a game in an xterm.js Terminal instance
|
|
39
|
+
const controller = runGame('snake', terminal);
|
|
40
|
+
|
|
41
|
+
// Stop the game
|
|
42
|
+
controller?.stop();
|
|
43
|
+
|
|
44
|
+
// Or use the games registry
|
|
45
|
+
for (const game of games) {
|
|
46
|
+
console.log(`${game.id}: ${game.name} - ${game.description}`);
|
|
47
|
+
}
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
### Themes
|
|
51
|
+
|
|
52
|
+
```typescript
|
|
53
|
+
import {
|
|
54
|
+
themes,
|
|
55
|
+
getTheme,
|
|
56
|
+
getAnsiColor,
|
|
57
|
+
getTerminalTheme,
|
|
58
|
+
type PhosphorMode,
|
|
59
|
+
} from '@hypersocial/cli-games/themes';
|
|
60
|
+
|
|
61
|
+
// Get a full xterm.js theme object
|
|
62
|
+
const xtermTheme = getTerminalTheme('cyan');
|
|
63
|
+
terminal.options.theme = xtermTheme;
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
## Games
|
|
67
|
+
|
|
68
|
+
| Game | Description |
|
|
69
|
+
|------|-------------|
|
|
70
|
+
| Tetris | Stack the blocks |
|
|
71
|
+
| Snake | Eat and grow |
|
|
72
|
+
| 2048 | Slide and combine tiles |
|
|
73
|
+
| Runner | Jump and duck |
|
|
74
|
+
| Pong | Classic paddle game |
|
|
75
|
+
| Wordle | Guess the word |
|
|
76
|
+
| Minesweeper | Clear the mines |
|
|
77
|
+
| Hangman | Guess the word |
|
|
78
|
+
| Space Invaders | Defend Earth |
|
|
79
|
+
| Tower | Build a tower |
|
|
80
|
+
| Simon | Memory game |
|
|
81
|
+
| Frogger | Cross the road |
|
|
82
|
+
| Breakout | Break all the bricks |
|
|
83
|
+
| Asteroids | Shoot the rocks |
|
|
84
|
+
| Typing Test | Test your speed |
|
|
85
|
+
| Tron | Light cycle battle |
|
|
86
|
+
| Crack | Hack the system |
|
|
87
|
+
| Chopper | Deliver passengers |
|
|
88
|
+
|
|
89
|
+
## Controls
|
|
90
|
+
|
|
91
|
+
- **Arrow keys** or **WASD** — Move/navigate
|
|
92
|
+
- **Enter** — Confirm/select
|
|
93
|
+
- **ESC** — Pause menu
|
|
94
|
+
- **Q** — Quit
|
|
95
|
+
|
|
96
|
+
## License
|
|
97
|
+
|
|
98
|
+
AGPL-3.0 — see [LICENSE](LICENSE) for details.
|
|
99
|
+
|
|
100
|
+
Contributions welcome via pull requests.
|