ClaudeMods
☰
ZH-CN
● 0 人在线 · 浏览 0 次
赞助提交作品
GitHub 仓库 · 发布者 TravisBumgarner

dino-break

一个 ASCII 恐龙跑酷游戏插件,在 Claude 处理耗时任务时于提示框上方的横条中打开

TravisBumgarner@TravisBumgarner

TravisBumgarner/claude-mods/tree/main/dino

已翻译

关于这个 mod

dino

这是一个 ASCII 版的 Chrome 离线恐龙游戏。Claude 处理耗时较长的任务时,它会在 Claude Code 提示框上方的横条中运行。插件名称为 dino-break。

HI 00412  00087   Claude is working...
      .--.
     (____)
    __
   / o)
__/ /         \|/
  /\           |
_____._______._______._______._______.
Space/Up: jump   P: pause   X: close

加载插件

Mod 需要 Claude Code v2.1.287 或更高版本(claude --version)。

仅用于一个会话:

claude --plugin-dir ~/Programming/mods/dino

用于所有会话:将该文件夹加入 ~/.claude/settings.json 的 env 区块:

{
  "env": {
    "CLAUDE_CODE_PLUGIN_DIRS": "~/Programming/mods/dino"
  }
}

要加载多个 mod,请用 : 分隔路径。交互式会话会监视该文件夹,因此保存后编辑会重新加载。

运行 /plugin 检查是否加载成功:标签页下方的暗色行应显示 dino-break。

玩法

| 按键 | 作用 | | --- | --- | | 点击游戏 | 将键盘焦点交给游戏(Esc 会把焦点还给提示框) | | D | 开始,或在 3-2-1 倒计时后继续暂停的游戏 | | Space / Up / W | 跳跃 | | P | 暂停并保存分数 | | X | 保存并关闭 |

/dino 可手动打开或关闭游戏。

自动打开方式

该 mod 提供 start_break 工具,并在系统提示中加入一行指示:当任务看起来会花费超过大约 1 分钟时,先调用它。Claude 完成这一轮后,游戏会暂停、保存本次游戏,并显示提示消息。

这取决于 Claude 对任务时长的判断,因此不会每次都触发。/dino 始终有效。

分数

保存在 mod 自己位于 ~/.claude 下的存储中(不在此储存库中):

  • best:最高分
  • scores:最近 50 次运行
  • saved:暂停的游戏,下一次会话中会显示为「Press D to resume」

文件

| 文件 | 内容 | | --- | --- | | .claude-plugin/plugin.json | 清单 | | hooks/hooks.json | 指向 register.tsx | | hooks/register.tsx | start_break 工具、/dino、横条和分数保存 | | hooks/game.tsx | 游戏:按键、物理、绘制(作为 Client surface module 运行) | | types/index.d.ts | 状态契约 | | tests/dino.test.tsx | 开始、暂停、继续 |

开发

claude plugin validate ~/Programming/mods/dino
claude plugin test ~/Programming/mods/dino

Mod 加载一次后,Claude Code 会把类型写入 .claude-plugin/types/ 并生成 tsconfig.json,tsc -p . 会对其进行类型检查。这两个文件都会自动生成并被 gitignore。

本文撰写时,claude plugin test 因为「hooks modules are turned off in this process」而拒绝运行,因此测试已经完成类型检查,但尚未实际运行。

安装

请先查看作者 README 确认 marketplace 和插件名称;命令可能随仓库结构改变。

claude plugin marketplace add TravisBumgarner/claude-mods
claude plugin install dino-break
原文 / README

dino

An ASCII take on Chrome's offline dino game that runs in a band above the Claude Code prompt while Claude works on something long. The plugin is named dino-break.

HI 00412  00087   Claude is working...
      .--.
     (____)
    __
   / o)
__/ /         \|/
  /\           |
_____._______._______._______.
Space/Up: jump   P: pause   X: close

Load it

Mods need Claude Code v2.1.287 or later (claude --version).

For one session:

claude --plugin-dir ~/Programming/mods/dino

For every session, add the folder to the env block of ~/.claude/settings.json:

{
  "env": {
    "CLAUDE_CODE_PLUGIN_DIRS": "~/Programming/mods/dino"
  }
}

To load several mods, separate their paths with :. Interactive sessions watch the folder, so edits reload when you save.

Run /plugin to check it loaded: the dim line under the tabs should name dino-break.

Play

| Key | Does | | --- | --- | | click the game | gives it the keyboard (Esc hands it back to the prompt) | | D | start, or resume a paused run after a 3-2-1 countdown | | Space / Up / W | jump | | P | pause and save the score | | X | save and close |

/dino opens or closes the game by hand.

How it opens on its own

The mod gives Claude a start_break tool and adds a line to the system prompt telling Claude to call it first when a task looks like it'll take more than about a minute. When Claude finishes the turn, the game pauses, saves your run, and shows a toast.

This depends on Claude guessing the task length, so it won't fire every time. /dino always works.

Scores

Saved in the mod's own store under ~/.claude (not in this repo):

  • best: high score
  • scores: last 50 runs
  • saved: the paused run, which comes back as "Press D to resume" in the next session

Files

| File | What | | --- | --- | | .claude-plugin/plugin.json | manifest | | hooks/hooks.json | points at register.tsx | | hooks/register.tsx | start_break tool, /dino, the band, saving scores | | hooks/game.tsx | the game: keys, physics, drawing (runs as a Client surface module) | | types/index.d.ts | state contract | | tests/dino.test.tsx | start, pause, resume |

Develop

claude plugin validate ~/Programming/mods/dino
claude plugin test ~/Programming/mods/dino

After the mod loads once, Claude Code writes its types into .claude-plugin/types/ and a tsconfig.json, and tsc -p . type-checks it. Both are generated and gitignored.

claude plugin test refused to run while this was written ("hooks modules are turned off in this process"), so the test is type-checked but hasn't run yet.

更多类似作品