superdario 1.6.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.
@@ -0,0 +1,9 @@
1
+ #!/bin/sh
2
+ # Sourced by the Claude Code hook scripts. Grok Build also runs ~/.claude/settings.json hooks (Claude compat mode)
3
+ # and marks its hook processes with GROK_HOOK_EVENT: hand those over to Grok's own hook file when it exists,
4
+ # otherwise report the event as Grok so the game plays as Grok instead of Claude.
5
+ AGENT="claude"
6
+ if [ -n "$GROK_HOOK_EVENT" ]; then
7
+ if [ -f "${GROK_HOME:-$HOME/.grok}/hooks/dario.json" ]; then exit 0; fi
8
+ AGENT="grok"
9
+ fi
@@ -0,0 +1,9 @@
1
+ #!/bin/sh
2
+ # Shared hook for Codex CLI and Grok Build: `agent_hook.sh <codex|grok> <event>`, event JSON on stdin.
3
+ # Runs in the background so the agent is never delayed; prints nothing and exits 0 so nothing is blocked.
4
+ AGENT="$1"
5
+ EVENT="$2"
6
+ ROOT="$(cd "$(dirname "$0")/.." && pwd)"
7
+ PAYLOAD="$(cat)"
8
+ ( printf '%s' "$PAYLOAD" | "$ROOT/bin/dario" hook "$EVENT" --agent "$AGENT" >/dev/null 2>&1 & )
9
+ exit 0
@@ -0,0 +1,8 @@
1
+ #!/bin/sh
2
+ # Claude Code "Notification" hook: flags permission prompts and idle waits so the game can call you back.
3
+ # Runs in the background so the prompt is never delayed; prints nothing so no context is injected.
4
+ ROOT="$(cd "$(dirname "$0")/.." && pwd)"
5
+ . "$ROOT/hooks/agent_from_env.sh"
6
+ PAYLOAD="$(cat)"
7
+ ( printf '%s' "$PAYLOAD" | "$ROOT/bin/dario" hook notification --agent "$AGENT" >/dev/null 2>&1 & )
8
+ exit 0
@@ -0,0 +1,8 @@
1
+ #!/bin/sh
2
+ # Claude Code "post_tool_use" hook: a tool finished: the HUD goes back to thinking.
3
+ # Runs in the background so the prompt is never delayed; prints nothing so no context is injected.
4
+ ROOT="$(cd "$(dirname "$0")/.." && pwd)"
5
+ . "$ROOT/hooks/agent_from_env.sh"
6
+ PAYLOAD="$(cat)"
7
+ ( printf '%s' "$PAYLOAD" | "$ROOT/bin/dario" hook post_tool_use --agent "$AGENT" >/dev/null 2>&1 & )
8
+ exit 0
@@ -0,0 +1,8 @@
1
+ #!/bin/sh
2
+ # Claude Code "pre_tool_use" hook: a tool is about to run: shows "Bash · npm test" style detail in the game HUD.
3
+ # Runs in the background so the prompt is never delayed; prints nothing so no context is injected.
4
+ ROOT="$(cd "$(dirname "$0")/.." && pwd)"
5
+ . "$ROOT/hooks/agent_from_env.sh"
6
+ PAYLOAD="$(cat)"
7
+ ( printf '%s' "$PAYLOAD" | "$ROOT/bin/dario" hook pre_tool_use --agent "$AGENT" >/dev/null 2>&1 & )
8
+ exit 0
package/hooks/stop.sh ADDED
@@ -0,0 +1,8 @@
1
+ #!/bin/sh
2
+ # Claude Code "Stop" hook: tells the running game that Claude has finished answering.
3
+ # Runs in the background so the prompt is never delayed; prints nothing so no context is injected.
4
+ ROOT="$(cd "$(dirname "$0")/.." && pwd)"
5
+ . "$ROOT/hooks/agent_from_env.sh"
6
+ PAYLOAD="$(cat)"
7
+ ( printf '%s' "$PAYLOAD" | "$ROOT/bin/dario" hook stop --agent "$AGENT" >/dev/null 2>&1 & )
8
+ exit 0
@@ -0,0 +1,8 @@
1
+ #!/bin/sh
2
+ # Claude Code "UserPromptSubmit" hook: marks Claude as working and opens Dario in a new terminal.
3
+ # Runs in the background so the prompt is never delayed; prints nothing so no context is injected.
4
+ ROOT="$(cd "$(dirname "$0")/.." && pwd)"
5
+ . "$ROOT/hooks/agent_from_env.sh"
6
+ PAYLOAD="$(cat)"
7
+ ( printf '%s' "$PAYLOAD" | "$ROOT/bin/dario" hook user_prompt_submit --agent "$AGENT" >/dev/null 2>&1 & )
8
+ exit 0
package/package.json ADDED
@@ -0,0 +1,48 @@
1
+ {
2
+ "name": "superdario",
3
+ "version": "1.6.0",
4
+ "description": "Super Dario: your coding agent's mascot in a terminal endless runner that opens on every Claude Code, Codex or Grok prompt.",
5
+ "keywords": [
6
+ "claude-code",
7
+ "codex",
8
+ "grok",
9
+ "terminal",
10
+ "game",
11
+ "endless-runner",
12
+ "mascot",
13
+ "hooks"
14
+ ],
15
+ "homepage": "https://dario-xxx.web.app",
16
+ "license": "MIT",
17
+ "author": "Eventually Solutions",
18
+ "type": "module",
19
+ "bin": {
20
+ "dario": "bin/dario"
21
+ },
22
+ "files": [
23
+ "bin",
24
+ "dist",
25
+ "hooks",
26
+ "skills",
27
+ "README.md",
28
+ "LICENSE"
29
+ ],
30
+ "engines": {
31
+ "node": ">=22.18"
32
+ },
33
+ "os": [
34
+ "darwin"
35
+ ],
36
+ "scripts": {
37
+ "start": "bin/dario play",
38
+ "test": "node --test 'tests/**/*.test.ts'",
39
+ "typecheck": "tsc --noEmit",
40
+ "build:dist": "scripts/build_dist.sh",
41
+ "prepublishOnly": "npm test && scripts/build_dist.sh"
42
+ },
43
+ "devDependencies": {
44
+ "@types/node": "^24.0.0",
45
+ "esbuild": "^0.28.2",
46
+ "typescript": "^5.9.0"
47
+ }
48
+ }
@@ -0,0 +1,116 @@
1
+ ---
2
+ name: dario
3
+ description: Dario is the Claude-mascot endless runner that lives in the terminal (Chrome dino style). Use for /dario, "play dario", "open the game", Dario scores/high score, turning Dario auto-launch on or off, picking the terminal it opens in, stopping the game, or installing/uninstalling its Claude Code hooks.
4
+ allowed-tools: Bash(dario *), Bash(dario), Bash(~/.local/bin/dario *), Bash(~/.dario/app/bin/dario *)
5
+ ---
6
+
7
+ # Dario
8
+
9
+ Dario ("Super Dario") is a zero-dependency TypeScript terminal game (Node >= 22.18); `dario status`
10
+ prints where it is installed (website installs live in `~/.dario/app`). Claude's orange pixel mascot runs forever
11
+ Mario-style: stomps bugs (+100), bonks ? blocks that pop mushrooms or sponsor logos
12
+ (+200 on pickup), jumps pipes, ducks under ghosts and collects gold tokens. The player is the
13
+ agent the game was launched from (Claude from the Claude Code hook; Codex/Grok detected from env
14
+ or set with `dario character`), and the other two agents are the stompable enemies.
15
+ Score = distance + 25 per coin + bonuses (no token counter in the HUD). Best scores live in `~/.config/dario/scores.json`.
16
+ The run starts with 3 lives: a hit costs one (short blink of invulnerability), some ? blocks pop a heart (1-UP)
17
+ that adds a life (credited to the sponsor whose block it came from). Two modes: VIBE CODER (default, play any
18
+ time) and PRO CODER (the game only runs while the agent is working on a prompt; start/resume are locked otherwise).
19
+ There is a global leaderboard in Firebase (project `dario-xxx`, Firestore `players`
20
+ collection, anonymous auth session in `~/.config/dario/auth.json`). On the first play
21
+ the game proposes the GitHub login (via `gh`), else the git user name, as the player
22
+ name with a `[Y/n]` prompt; `dario name <new>` changes it. Game over shows the global
23
+ top 5 and the player's rank.
24
+
25
+ The CLI is `dario` (symlinked into `~/.local/bin`). If that is not on PATH use
26
+ `~/.local/bin/dario` or `~/.dario/app/bin/dario` instead. `dario update` fetches the newest
27
+ release from https://dario-xxx.web.app (npm installs update with `npm install -g superdario@latest`).
28
+
29
+ ## How Dario connects to Claude Code
30
+
31
+ `dario install` writes three hooks into `~/.claude/settings.json`:
32
+
33
+ | Hook | Effect |
34
+ | ------------------ | -------------------------------------------------------------------------------------- |
35
+ | `UserPromptSubmit` | marks Claude as *working* and opens Dario in a new terminal tab/window (once, pid-locked) |
36
+ | `Stop` | marks Claude as *done*; the game shows a "CLAUDE IS DONE" banner |
37
+ | `Notification` | permission / idle prompts mark *attention*; the game shows "CLAUDE NEEDS YOUR INPUT" |
38
+ | `PreToolUse` / `PostToolUse` | the HUD shows what Claude is doing ("Bash · npm test", "Edit · game.ts") and rotating thinking verbs in between |
39
+
40
+ So while a prompt is executing the user can play, and the HUD tells them when to
41
+ come back. On *done* / *attention* the game auto-pauses and, if `dario focus` is
42
+ on, the hook re-activates the app the prompt was sent from (captured at prompt
43
+ time; from Warp it also sends Cmd+Shift+[ to go to the previous tab). The hook launches in the terminal the user is in (Warp, iTerm, Terminal,
44
+ Ghostty, WezTerm, kitty, Alacritty, Tabby, Rio) or, with the launcher extension, inside the integrated
45
+ terminal of Cursor, VS Code, VS Code Insiders, VSCodium, Windsurf, Kiro or Trae. `dario off` pauses the auto-launch, `dario on` resumes it.
46
+
47
+ The same hooks exist for OpenAI Codex CLI (`~/.codex/hooks.json`) and xAI Grok Build
48
+ (`~/.grok/hooks/dario.json`); `dario install` writes them when those folders exist, `dario agents`
49
+ shows/changes them, and the game then plays as Codex or Grok. Codex users must approve the hooks once
50
+ with `/hooks` inside Codex.
51
+
52
+ ## What to run for `$ARGUMENTS`
53
+
54
+ Never run `dario play` from Claude: it needs an interactive TTY and would hang the tool.
55
+ Always open the game with `dario launch`.
56
+
57
+ | User intent | Command |
58
+ | --------------------------------------------- | ------------------------------ |
59
+ | `/dario`, "play", "open the game", "start" | `dario launch` |
60
+ | "stop", "close the game" | `dario stop` |
61
+ | "scores", "high score", "how am I doing" | `dario scores` (or `--json`) |
62
+ | "ranking", "leaderboard", "who is first" | `dario ranking` (`--pro` for the PRO CODER board, `--json`) |
63
+ | "my name", "change name to X" | `dario name` / `dario name X` |
64
+ | "sponsors", "who sponsors the game" | `dario sponsors` |
65
+ | "play as codex/grok", "character" | `dario character <auto|claude|codex|grok>` (or `dario launch --as grok`) |
66
+ | "pro mode", "vibe mode", "only while working" | `dario mode <vibe|pro>` |
67
+ | "status", "is it running", "are hooks on" | `dario status` |
68
+ | "on", "enable", "auto-launch on" | `dario on` |
69
+ | "off", "disable", "stop opening every prompt" | `dario off` |
70
+ | "focus on/off", "don't switch me back" | `dario focus <on|off>` |
71
+ | "terminal iterm" / "use warp" | `dario terminal <kind>` |
72
+ | "open it in Cursor / VS Code / Windsurf ..." | `dario ide <cursor|vscode|vscode_insiders|vscodium|windsurf|kiro|trae>` (installs the launcher extension; reload the IDE window once) |
73
+ | "hook it into Codex / Grok", "agents" | `dario agents` (status) / `dario agents codex` / `dario agents grok` / `... off` |
74
+ | "install", "set up hooks" | `dario install` then ask where it should open (see below) |
75
+ | "uninstall", "remove hooks" | `dario uninstall` |
76
+ | "help" | `dario help` |
77
+
78
+ ## Installing from the skill
79
+
80
+ `dario install` cannot prompt when Claude runs it (no TTY), so do the wizard yourself:
81
+ 1. Run `dario install`.
82
+ 2. Run `dario terminal --list` and ask the user (AskUserQuestion) which entry they want; mark the
83
+ `(detected)` one as recommended.
84
+ 3. Apply it: `dario terminal <kind>` for a terminal app, or `dario ide <kind>` for an IDE (this
85
+ installs the Dario Launcher extension; tell the user to reload the IDE window once and allow the
86
+ URI the first time).
87
+ 4. If the install output lists Codex hooks as installed, remind the user to approve them once with
88
+ `/hooks` inside Codex.
89
+
90
+ After running a command, relay the output briefly. For scores, summarise the
91
+ high score, last score and token totals in one or two sentences.
92
+
93
+ ## Controls (for when the user asks)
94
+
95
+ hold RIGHT / D = run, release to stop (macOS key-state helper, terminal-independent), LEFT / A = walk back on screen, C = settings panel on the title/pause screen,
96
+ SPACE / UP / W = jump, DOWN / S = duck (also fast-fall mid-air), P = pause, R = restart, Q / ESC = quit.
97
+
98
+ ## Sponsors
99
+
100
+ Sponsors buy a tier on https://dario-xxx.web.app/sponsor (Polar checkout via Cloud
101
+ Functions in `functions/`), then draw or upload a pixel logo. Mystery box sponsors pay what they choose (from $29 / 30 days; the amount is their rank). Banner ($69.90 a day) and ranking ($29.90 a day, name only)
102
+ sponsors book UTC days on a 30-day calendar; the game shows whoever booked today. Active sponsors are read
103
+ from Firestore `sponsors` (status == active) and cached in `~/.config/dario/sponsors.json`
104
+ for an hour. A *mystery* sponsor's logo (16×12 sextant pixel art or a coloured text plate) pops out of the blinking ? blocks and pays +300 points (growing by 100 each pickup) when grabbed;
105
+ mystery sponsors are ranked (priority field, then who paid first): the top one gets the most blocks and the first block of a run.
106
+ the day's *banner* sponsor (66×20, booked per day, the size of the title plate) sits next to the SUPER DARIO plate on the start screen and on top of the pause and game-over screens, with "sponsored by NAME" above it. Logo cells and the "sponsored by" line are OSC 8 hyperlinks.
107
+
108
+ ## Project layout
109
+
110
+ - `src/game/` physics, spawning, collision, the `Game` loop
111
+ - `src/render/` half-block pixel renderer, sprites, HUD, overlays
112
+ - `src/launcher/` terminal detection and "open in new tab" strategies, pid lock
113
+ - `src/claude/` status file watcher/writer, hook service, settings.json installer
114
+ - `src/agents/` Codex / Grok hook-file installers; `src/ide/` the launcher extension for VS Code-style IDEs
115
+ - `src/cli/` commands; `hooks/` the shell scripts Claude Code invokes
116
+ - `npm test` runs the node:test suite, `npm run typecheck` runs tsc