From 1d160f2880abdeb10351e51e6707337eadc8ff17 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Karela=20Proch=C3=A1zka?= Date: Fri, 20 Nov 2026 17:17:41 +0100 Subject: [PATCH 1/4] feat(integrations): add Claude Code plugin marketplace for the play skill The repo is now a Claude Code plugin marketplace. The tiny-engineer plugin ships skills/ only (source ./skills), so installing it copies the skill, not the CAD and firmware tree, and the skill stays in one place for Claude Code, Cursor and Antigravity. /plugin marketplace add jamro/tiny-engineer /plugin install tiny-engineer@tiny-engineer --- .claude-plugin/marketplace.json | 20 ++++++++++++++++++++ AGENTS.md | 3 ++- CONTRIBUTING.md | 2 +- docs/integration.md | 13 ++++++++++++- 4 files changed, 35 insertions(+), 3 deletions(-) create mode 100644 .claude-plugin/marketplace.json diff --git a/.claude-plugin/marketplace.json b/.claude-plugin/marketplace.json new file mode 100644 index 00000000..8012b7cf --- /dev/null +++ b/.claude-plugin/marketplace.json @@ -0,0 +1,20 @@ +{ + "name": "tiny-engineer", + "owner": { + "name": "Krzysztof Jamroz", + "url": "https://github.com/jamro/tiny-engineer" + }, + "description": "Claude Code plugins for the Tiny Engineer desk robot", + "plugins": [ + { + "name": "tiny-engineer", + "source": "./skills", + "description": "Make the Tiny Engineer desk robot speak through its speaker while it gestures (POST /play)", + "category": "productivity", + "keywords": ["robot", "esp32", "tts"], + "homepage": "https://github.com/jamro/tiny-engineer/blob/main/docs/integration.md", + "license": "MIT", + "skills": ["./"] + } + ] +} diff --git a/AGENTS.md b/AGENTS.md index a612268e..8ecb974d 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -14,6 +14,7 @@ Tiny Engineer is an open-source ESP32-C3 Wi-Fi desk robot: 3D-printed mechanics, | `ui/` | Web control panel (Vite, TypeScript, Preact); `pio run` builds it into one minified page and embeds it gzipped in the firmware | | `packages/` | HTTP / hook CLIs (Cursor, Antigravity, Claude Code, …) — scope `integrations` | | `skills/` | Agent skills shared by Claude Code, Cursor and Antigravity — scope `integrations` | +| `.claude-plugin/` | Claude Code plugin marketplace; the `tiny-engineer` plugin ships `skills/` — scope `integrations` | | `3d_models/` | CAD and printables (CERN-OHL-S) | | `mods/` | Optional mods; models under `mods//3d_models/` (CERN-OHL-S) | | `hardware/` | KiCad boards (CERN-OHL-S) | @@ -73,7 +74,7 @@ Web UI API page: one-line route descriptions only (except supported-parameter li Format: `type(scope): summary` (imperative, lowercase type, no trailing period; PR title same). Scopes: `firmware`, `http`, `settings`, `anim`, `servos`, `wifi`, `integrations`, `cad`, `mods`, `pcb`, `docs`, `scripts`, `ci`. -`integrations` = anything under `packages/` or `skills/`. Do not add a new scope per package. +`integrations` = anything under `packages/`, `skills/` or `.claude-plugin/`. Do not add a new scope per package. `mods` = anything under `mods/`. Name the mod in the summary. Do not add a new scope per mod. Breaking rules, SemVer mapping, and examples: [CONTRIBUTING.md](CONTRIBUTING.md). diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index d8522bbd..2aa33919 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -100,7 +100,7 @@ Format: `type(scope): summary` Scopes: `firmware`, `http`, `settings`, `anim`, `servos`, `wifi`, `integrations`, `cad`, `mods`, `pcb`, `docs`, `scripts`, `ci`, `web`, `cli`. -`integrations` is anything under `packages/` (Cursor, Antigravity, Claude Code, later agent CLIs). Do not add a new scope per package. +`integrations` is anything under `packages/` (Cursor, Antigravity, Claude Code, later agent CLIs), `skills/`, or `.claude-plugin/`. Do not add a new scope per package. `mods` is anything under `mods/`. Name the mod in the summary. Do not add a new scope per mod. diff --git a/docs/integration.md b/docs/integration.md index 5fc38115..bb603ede 100644 --- a/docs/integration.md +++ b/docs/integration.md @@ -121,7 +121,18 @@ WAV for `/play`: 16-bit mono PCM at 22050 Hz. Details: [`api.md#post-play`](api. ### Speaking through the robot (skill) -Install the shared [`tiny-engineer-play`](../skills/tiny-engineer-play/SKILL.md) skill (`curl` + `POST /play`). Same skill works in Claude Code, Cursor, and Antigravity: +Install the shared [`tiny-engineer-play`](../skills/tiny-engineer-play/SKILL.md) skill (`curl` + `POST /play`). It needs a text-to-speech tool (`espeak-ng` on Linux, `say` on macOS) and `ffmpeg`. + +**Claude Code: install the plugin.** This repo is a Claude Code plugin marketplace ([`.claude-plugin/marketplace.json`](../.claude-plugin/marketplace.json)). No clone needed, and updates come through `/plugin`: + +```text +/plugin marketplace add jamro/tiny-engineer +/plugin install tiny-engineer@tiny-engineer +``` + +The skill is then `/tiny-engineer:tiny-engineer-play`, and Claude also uses it when you ask the robot to say something. The plugin carries only `skills/`. + +**From a checkout.** The same skill works in Claude Code, Cursor, and Antigravity. A symlink follows whatever branch the checkout is on; copy the folder instead for a fixed version: ```bash mkdir -p ~/.claude/skills && ln -s "$PWD/skills/tiny-engineer-play" ~/.claude/skills/ # Claude Code From 586dd8c8bd1ae470c9169f658ff7ad5bf2b293f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Karela=20Proch=C3=A1zka?= Date: Fri, 20 Nov 2026 17:26:54 +0100 Subject: [PATCH 2/4] docs(integrations): note the play skill reads URL and token from the environment --- docs/integration.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/docs/integration.md b/docs/integration.md index bb603ede..49455b1c 100644 --- a/docs/integration.md +++ b/docs/integration.md @@ -123,6 +123,14 @@ WAV for `/play`: 16-bit mono PCM at 22050 Hz. Details: [`api.md#post-play`](api. Install the shared [`tiny-engineer-play`](../skills/tiny-engineer-play/SKILL.md) skill (`curl` + `POST /play`). It needs a text-to-speech tool (`espeak-ng` on Linux, `say` on macOS) and `ffmpeg`. +The skill's script reads the robot address and token only from the environment (`TINY_ENGINEER_URL`, default `http://tiny-engineer.local`, and `TINY_ENGINEER_TOKEN`). It does not read the user config that `tiny-engineer setup` writes. If your robot uses another address or an `access_token`, export both before you start the agent: + +```bash +export TINY_ENGINEER_URL=http://192.168.x.x +export TINY_ENGINEER_TOKEN=your-access-token +claude +``` + **Claude Code: install the plugin.** This repo is a Claude Code plugin marketplace ([`.claude-plugin/marketplace.json`](../.claude-plugin/marketplace.json)). No clone needed, and updates come through `/plugin`: ```text From 151935a810b6ed2e0c97cf4c7dd238d435ccb8dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Karela=20Proch=C3=A1zka?= Date: Fri, 20 Nov 2026 17:52:19 +0100 Subject: [PATCH 3/4] feat(integrations): ship Claude Code hooks in the plugin The tiny-engineer plugin now carries the same 13 hook events as `tiny-engineer setup claude-code`, inline in the marketplace entry, so one install drives the robot in every project. The hooks call an installed tiny-engineer CLI, else npx, and stay quiet in projects that already have Tiny Engineer hooks, so events never fire twice. Docs install the marketplace with --sparse .claude-plugin skills, so Claude Code checks out a few KB instead of the 200+ MB repo. --- .claude-plugin/marketplace.json | 171 +++++++++++++++++++++++++++++++- AGENTS.md | 2 +- docs/integration.md | 24 +++-- 3 files changed, 185 insertions(+), 12 deletions(-) diff --git a/.claude-plugin/marketplace.json b/.claude-plugin/marketplace.json index 8012b7cf..a37d2a06 100644 --- a/.claude-plugin/marketplace.json +++ b/.claude-plugin/marketplace.json @@ -9,12 +9,177 @@ { "name": "tiny-engineer", "source": "./skills", - "description": "Make the Tiny Engineer desk robot speak through its speaker while it gestures (POST /play)", + "description": "Tiny Engineer desk robot for Claude Code: poses on every agent event (hooks) and speech through its speaker (tiny-engineer-play skill)", "category": "productivity", - "keywords": ["robot", "esp32", "tts"], + "keywords": [ + "robot", + "esp32", + "hooks", + "tts" + ], "homepage": "https://github.com/jamro/tiny-engineer/blob/main/docs/integration.md", "license": "MIT", - "skills": ["./"] + "skills": [ + "./" + ], + "hooks": { + "SessionStart": [ + { + "hooks": [ + { + "type": "command", + "command": "grep -qs \"hook claude-code\" \"$CLAUDE_PROJECT_DIR/.claude/settings.json\" \"$CLAUDE_PROJECT_DIR/.claude/settings.local.json\" && exit 0; if command -v tiny-engineer >/dev/null 2>&1; then tiny-engineer hook claude-code; else npx -y tiny-engineer hook claude-code; fi", + "async": true, + "timeout": 30 + } + ] + } + ], + "SessionEnd": [ + { + "hooks": [ + { + "type": "command", + "command": "grep -qs \"hook claude-code\" \"$CLAUDE_PROJECT_DIR/.claude/settings.json\" \"$CLAUDE_PROJECT_DIR/.claude/settings.local.json\" && exit 0; if command -v tiny-engineer >/dev/null 2>&1; then tiny-engineer hook claude-code; else npx -y tiny-engineer hook claude-code; fi", + "async": true, + "timeout": 30 + } + ] + } + ], + "UserPromptSubmit": [ + { + "hooks": [ + { + "type": "command", + "command": "grep -qs \"hook claude-code\" \"$CLAUDE_PROJECT_DIR/.claude/settings.json\" \"$CLAUDE_PROJECT_DIR/.claude/settings.local.json\" && exit 0; if command -v tiny-engineer >/dev/null 2>&1; then tiny-engineer hook claude-code; else npx -y tiny-engineer hook claude-code; fi", + "async": true, + "timeout": 30 + } + ] + } + ], + "SubagentStart": [ + { + "hooks": [ + { + "type": "command", + "command": "grep -qs \"hook claude-code\" \"$CLAUDE_PROJECT_DIR/.claude/settings.json\" \"$CLAUDE_PROJECT_DIR/.claude/settings.local.json\" && exit 0; if command -v tiny-engineer >/dev/null 2>&1; then tiny-engineer hook claude-code; else npx -y tiny-engineer hook claude-code; fi", + "async": true, + "timeout": 30 + } + ] + } + ], + "PreToolUse": [ + { + "hooks": [ + { + "type": "command", + "command": "grep -qs \"hook claude-code\" \"$CLAUDE_PROJECT_DIR/.claude/settings.json\" \"$CLAUDE_PROJECT_DIR/.claude/settings.local.json\" && exit 0; if command -v tiny-engineer >/dev/null 2>&1; then tiny-engineer hook claude-code; else npx -y tiny-engineer hook claude-code; fi", + "async": true, + "timeout": 30 + } + ] + } + ], + "PostToolBatch": [ + { + "hooks": [ + { + "type": "command", + "command": "grep -qs \"hook claude-code\" \"$CLAUDE_PROJECT_DIR/.claude/settings.json\" \"$CLAUDE_PROJECT_DIR/.claude/settings.local.json\" && exit 0; if command -v tiny-engineer >/dev/null 2>&1; then tiny-engineer hook claude-code; else npx -y tiny-engineer hook claude-code; fi", + "async": true, + "timeout": 30 + } + ] + } + ], + "PostToolUseFailure": [ + { + "hooks": [ + { + "type": "command", + "command": "grep -qs \"hook claude-code\" \"$CLAUDE_PROJECT_DIR/.claude/settings.json\" \"$CLAUDE_PROJECT_DIR/.claude/settings.local.json\" && exit 0; if command -v tiny-engineer >/dev/null 2>&1; then tiny-engineer hook claude-code; else npx -y tiny-engineer hook claude-code; fi", + "async": true, + "timeout": 30 + } + ] + } + ], + "PreCompact": [ + { + "hooks": [ + { + "type": "command", + "command": "grep -qs \"hook claude-code\" \"$CLAUDE_PROJECT_DIR/.claude/settings.json\" \"$CLAUDE_PROJECT_DIR/.claude/settings.local.json\" && exit 0; if command -v tiny-engineer >/dev/null 2>&1; then tiny-engineer hook claude-code; else npx -y tiny-engineer hook claude-code; fi", + "async": true, + "timeout": 30 + } + ] + } + ], + "PermissionRequest": [ + { + "hooks": [ + { + "type": "command", + "command": "grep -qs \"hook claude-code\" \"$CLAUDE_PROJECT_DIR/.claude/settings.json\" \"$CLAUDE_PROJECT_DIR/.claude/settings.local.json\" && exit 0; if command -v tiny-engineer >/dev/null 2>&1; then tiny-engineer hook claude-code; else npx -y tiny-engineer hook claude-code; fi", + "async": true, + "timeout": 30 + } + ] + } + ], + "PermissionDenied": [ + { + "hooks": [ + { + "type": "command", + "command": "grep -qs \"hook claude-code\" \"$CLAUDE_PROJECT_DIR/.claude/settings.json\" \"$CLAUDE_PROJECT_DIR/.claude/settings.local.json\" && exit 0; if command -v tiny-engineer >/dev/null 2>&1; then tiny-engineer hook claude-code; else npx -y tiny-engineer hook claude-code; fi", + "async": true, + "timeout": 30 + } + ] + } + ], + "Notification": [ + { + "hooks": [ + { + "type": "command", + "command": "grep -qs \"hook claude-code\" \"$CLAUDE_PROJECT_DIR/.claude/settings.json\" \"$CLAUDE_PROJECT_DIR/.claude/settings.local.json\" && exit 0; if command -v tiny-engineer >/dev/null 2>&1; then tiny-engineer hook claude-code; else npx -y tiny-engineer hook claude-code; fi", + "async": true, + "timeout": 30 + } + ] + } + ], + "Stop": [ + { + "hooks": [ + { + "type": "command", + "command": "grep -qs \"hook claude-code\" \"$CLAUDE_PROJECT_DIR/.claude/settings.json\" \"$CLAUDE_PROJECT_DIR/.claude/settings.local.json\" && exit 0; if command -v tiny-engineer >/dev/null 2>&1; then tiny-engineer hook claude-code; else npx -y tiny-engineer hook claude-code; fi", + "async": true, + "timeout": 30 + } + ] + } + ], + "StopFailure": [ + { + "hooks": [ + { + "type": "command", + "command": "grep -qs \"hook claude-code\" \"$CLAUDE_PROJECT_DIR/.claude/settings.json\" \"$CLAUDE_PROJECT_DIR/.claude/settings.local.json\" && exit 0; if command -v tiny-engineer >/dev/null 2>&1; then tiny-engineer hook claude-code; else npx -y tiny-engineer hook claude-code; fi", + "async": true, + "timeout": 30 + } + ] + } + ] + } } ] } diff --git a/AGENTS.md b/AGENTS.md index 8ecb974d..8ca7fc09 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -14,7 +14,7 @@ Tiny Engineer is an open-source ESP32-C3 Wi-Fi desk robot: 3D-printed mechanics, | `ui/` | Web control panel (Vite, TypeScript, Preact); `pio run` builds it into one minified page and embeds it gzipped in the firmware | | `packages/` | HTTP / hook CLIs (Cursor, Antigravity, Claude Code, …) — scope `integrations` | | `skills/` | Agent skills shared by Claude Code, Cursor and Antigravity — scope `integrations` | -| `.claude-plugin/` | Claude Code plugin marketplace; the `tiny-engineer` plugin ships `skills/` — scope `integrations` | +| `.claude-plugin/` | Claude Code plugin marketplace; the `tiny-engineer` plugin ships `skills/` plus inline Claude Code hooks — scope `integrations` | | `3d_models/` | CAD and printables (CERN-OHL-S) | | `mods/` | Optional mods; models under `mods//3d_models/` (CERN-OHL-S) | | `hardware/` | KiCad boards (CERN-OHL-S) | diff --git a/docs/integration.md b/docs/integration.md index 49455b1c..2c49f5dc 100644 --- a/docs/integration.md +++ b/docs/integration.md @@ -101,6 +101,21 @@ npx -y tiny-engineer uninstall cursor --yes # remove only Tiny Engineer hook ent This firmware repo already ships configs pointing at the **local** CLI bin for developing the package. +### Claude Code plugin (all projects) + +Instead of `setup` per project, Claude Code can install the hooks once for every project as a plugin. This repo is a Claude Code plugin marketplace ([`.claude-plugin/marketplace.json`](../.claude-plugin/marketplace.json)). The `tiny-engineer` plugin brings the same 13 hook events as `setup claude-code` plus the [`tiny-engineer-play`](#speaking-through-the-robot-skill) skill. Run in a terminal: + +```bash +claude plugin marketplace add jamro/tiny-engineer --sparse .claude-plugin skills +claude plugin install tiny-engineer@tiny-engineer +``` + +`--sparse` makes Claude Code check out only the two folders the plugin needs (a few KB) instead of the whole repo with CAD, PCB, and firmware sources (over 200 MB). Restart Claude Code afterwards. Turn the plugin off or on with `/plugin`. + +- The hooks run `tiny-engineer hook claude-code` when the CLI is on `PATH` (global npm install or a system package), else `npx -y tiny-engineer hook claude-code`. Connection prefs (URL, token, transport) come from the user config file described above, or from process env. +- A project whose `.claude/settings.json` or `.claude/settings.local.json` already has Tiny Engineer hooks (from `setup`, or this repo's dev hooks) keeps those, and the plugin stays quiet there, so events never fire twice. +- The skill is `/tiny-engineer:tiny-engineer-play` (plugin skills are namespaced). Claude also uses it when you ask the robot to say something. + ### Hook smoke test ```bash @@ -131,14 +146,7 @@ export TINY_ENGINEER_TOKEN=your-access-token claude ``` -**Claude Code: install the plugin.** This repo is a Claude Code plugin marketplace ([`.claude-plugin/marketplace.json`](../.claude-plugin/marketplace.json)). No clone needed, and updates come through `/plugin`: - -```text -/plugin marketplace add jamro/tiny-engineer -/plugin install tiny-engineer@tiny-engineer -``` - -The skill is then `/tiny-engineer:tiny-engineer-play`, and Claude also uses it when you ask the robot to say something. The plugin carries only `skills/`. +**Claude Code:** the [Claude Code plugin](#claude-code-plugin-all-projects) includes this skill. **From a checkout.** The same skill works in Claude Code, Cursor, and Antigravity. A symlink follows whatever branch the checkout is on; copy the folder instead for a fixed version: From b201410b8e73968fcab382d008f5afff6072e109 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Karela=20Proch=C3=A1zka?= Date: Fri, 20 Nov 2026 20:07:07 +0100 Subject: [PATCH 4/4] fix(integrations): drop npx fallback from Claude Code plugin hooks Claude Code does not enforce timeout on async hooks, so a stalled npm registry could leave one npx process behind per event, and every event paid an npm resolve. The hooks now exit 0 when tiny-engineer is not on PATH, and the docs ask for npm i -g tiny-engineer. Drop the no-op timeout to match what setup claude-code writes. --- .claude-plugin/marketplace.json | 65 +++++++++++++-------------------- docs/integration.md | 3 +- 2 files changed, 28 insertions(+), 40 deletions(-) diff --git a/.claude-plugin/marketplace.json b/.claude-plugin/marketplace.json index a37d2a06..993763e7 100644 --- a/.claude-plugin/marketplace.json +++ b/.claude-plugin/marketplace.json @@ -28,9 +28,8 @@ "hooks": [ { "type": "command", - "command": "grep -qs \"hook claude-code\" \"$CLAUDE_PROJECT_DIR/.claude/settings.json\" \"$CLAUDE_PROJECT_DIR/.claude/settings.local.json\" && exit 0; if command -v tiny-engineer >/dev/null 2>&1; then tiny-engineer hook claude-code; else npx -y tiny-engineer hook claude-code; fi", - "async": true, - "timeout": 30 + "command": "grep -qs \"hook claude-code\" \"$CLAUDE_PROJECT_DIR/.claude/settings.json\" \"$CLAUDE_PROJECT_DIR/.claude/settings.local.json\" && exit 0; command -v tiny-engineer >/dev/null 2>&1 || exit 0; tiny-engineer hook claude-code", + "async": true } ] } @@ -40,9 +39,8 @@ "hooks": [ { "type": "command", - "command": "grep -qs \"hook claude-code\" \"$CLAUDE_PROJECT_DIR/.claude/settings.json\" \"$CLAUDE_PROJECT_DIR/.claude/settings.local.json\" && exit 0; if command -v tiny-engineer >/dev/null 2>&1; then tiny-engineer hook claude-code; else npx -y tiny-engineer hook claude-code; fi", - "async": true, - "timeout": 30 + "command": "grep -qs \"hook claude-code\" \"$CLAUDE_PROJECT_DIR/.claude/settings.json\" \"$CLAUDE_PROJECT_DIR/.claude/settings.local.json\" && exit 0; command -v tiny-engineer >/dev/null 2>&1 || exit 0; tiny-engineer hook claude-code", + "async": true } ] } @@ -52,9 +50,8 @@ "hooks": [ { "type": "command", - "command": "grep -qs \"hook claude-code\" \"$CLAUDE_PROJECT_DIR/.claude/settings.json\" \"$CLAUDE_PROJECT_DIR/.claude/settings.local.json\" && exit 0; if command -v tiny-engineer >/dev/null 2>&1; then tiny-engineer hook claude-code; else npx -y tiny-engineer hook claude-code; fi", - "async": true, - "timeout": 30 + "command": "grep -qs \"hook claude-code\" \"$CLAUDE_PROJECT_DIR/.claude/settings.json\" \"$CLAUDE_PROJECT_DIR/.claude/settings.local.json\" && exit 0; command -v tiny-engineer >/dev/null 2>&1 || exit 0; tiny-engineer hook claude-code", + "async": true } ] } @@ -64,9 +61,8 @@ "hooks": [ { "type": "command", - "command": "grep -qs \"hook claude-code\" \"$CLAUDE_PROJECT_DIR/.claude/settings.json\" \"$CLAUDE_PROJECT_DIR/.claude/settings.local.json\" && exit 0; if command -v tiny-engineer >/dev/null 2>&1; then tiny-engineer hook claude-code; else npx -y tiny-engineer hook claude-code; fi", - "async": true, - "timeout": 30 + "command": "grep -qs \"hook claude-code\" \"$CLAUDE_PROJECT_DIR/.claude/settings.json\" \"$CLAUDE_PROJECT_DIR/.claude/settings.local.json\" && exit 0; command -v tiny-engineer >/dev/null 2>&1 || exit 0; tiny-engineer hook claude-code", + "async": true } ] } @@ -76,9 +72,8 @@ "hooks": [ { "type": "command", - "command": "grep -qs \"hook claude-code\" \"$CLAUDE_PROJECT_DIR/.claude/settings.json\" \"$CLAUDE_PROJECT_DIR/.claude/settings.local.json\" && exit 0; if command -v tiny-engineer >/dev/null 2>&1; then tiny-engineer hook claude-code; else npx -y tiny-engineer hook claude-code; fi", - "async": true, - "timeout": 30 + "command": "grep -qs \"hook claude-code\" \"$CLAUDE_PROJECT_DIR/.claude/settings.json\" \"$CLAUDE_PROJECT_DIR/.claude/settings.local.json\" && exit 0; command -v tiny-engineer >/dev/null 2>&1 || exit 0; tiny-engineer hook claude-code", + "async": true } ] } @@ -88,9 +83,8 @@ "hooks": [ { "type": "command", - "command": "grep -qs \"hook claude-code\" \"$CLAUDE_PROJECT_DIR/.claude/settings.json\" \"$CLAUDE_PROJECT_DIR/.claude/settings.local.json\" && exit 0; if command -v tiny-engineer >/dev/null 2>&1; then tiny-engineer hook claude-code; else npx -y tiny-engineer hook claude-code; fi", - "async": true, - "timeout": 30 + "command": "grep -qs \"hook claude-code\" \"$CLAUDE_PROJECT_DIR/.claude/settings.json\" \"$CLAUDE_PROJECT_DIR/.claude/settings.local.json\" && exit 0; command -v tiny-engineer >/dev/null 2>&1 || exit 0; tiny-engineer hook claude-code", + "async": true } ] } @@ -100,9 +94,8 @@ "hooks": [ { "type": "command", - "command": "grep -qs \"hook claude-code\" \"$CLAUDE_PROJECT_DIR/.claude/settings.json\" \"$CLAUDE_PROJECT_DIR/.claude/settings.local.json\" && exit 0; if command -v tiny-engineer >/dev/null 2>&1; then tiny-engineer hook claude-code; else npx -y tiny-engineer hook claude-code; fi", - "async": true, - "timeout": 30 + "command": "grep -qs \"hook claude-code\" \"$CLAUDE_PROJECT_DIR/.claude/settings.json\" \"$CLAUDE_PROJECT_DIR/.claude/settings.local.json\" && exit 0; command -v tiny-engineer >/dev/null 2>&1 || exit 0; tiny-engineer hook claude-code", + "async": true } ] } @@ -112,9 +105,8 @@ "hooks": [ { "type": "command", - "command": "grep -qs \"hook claude-code\" \"$CLAUDE_PROJECT_DIR/.claude/settings.json\" \"$CLAUDE_PROJECT_DIR/.claude/settings.local.json\" && exit 0; if command -v tiny-engineer >/dev/null 2>&1; then tiny-engineer hook claude-code; else npx -y tiny-engineer hook claude-code; fi", - "async": true, - "timeout": 30 + "command": "grep -qs \"hook claude-code\" \"$CLAUDE_PROJECT_DIR/.claude/settings.json\" \"$CLAUDE_PROJECT_DIR/.claude/settings.local.json\" && exit 0; command -v tiny-engineer >/dev/null 2>&1 || exit 0; tiny-engineer hook claude-code", + "async": true } ] } @@ -124,9 +116,8 @@ "hooks": [ { "type": "command", - "command": "grep -qs \"hook claude-code\" \"$CLAUDE_PROJECT_DIR/.claude/settings.json\" \"$CLAUDE_PROJECT_DIR/.claude/settings.local.json\" && exit 0; if command -v tiny-engineer >/dev/null 2>&1; then tiny-engineer hook claude-code; else npx -y tiny-engineer hook claude-code; fi", - "async": true, - "timeout": 30 + "command": "grep -qs \"hook claude-code\" \"$CLAUDE_PROJECT_DIR/.claude/settings.json\" \"$CLAUDE_PROJECT_DIR/.claude/settings.local.json\" && exit 0; command -v tiny-engineer >/dev/null 2>&1 || exit 0; tiny-engineer hook claude-code", + "async": true } ] } @@ -136,9 +127,8 @@ "hooks": [ { "type": "command", - "command": "grep -qs \"hook claude-code\" \"$CLAUDE_PROJECT_DIR/.claude/settings.json\" \"$CLAUDE_PROJECT_DIR/.claude/settings.local.json\" && exit 0; if command -v tiny-engineer >/dev/null 2>&1; then tiny-engineer hook claude-code; else npx -y tiny-engineer hook claude-code; fi", - "async": true, - "timeout": 30 + "command": "grep -qs \"hook claude-code\" \"$CLAUDE_PROJECT_DIR/.claude/settings.json\" \"$CLAUDE_PROJECT_DIR/.claude/settings.local.json\" && exit 0; command -v tiny-engineer >/dev/null 2>&1 || exit 0; tiny-engineer hook claude-code", + "async": true } ] } @@ -148,9 +138,8 @@ "hooks": [ { "type": "command", - "command": "grep -qs \"hook claude-code\" \"$CLAUDE_PROJECT_DIR/.claude/settings.json\" \"$CLAUDE_PROJECT_DIR/.claude/settings.local.json\" && exit 0; if command -v tiny-engineer >/dev/null 2>&1; then tiny-engineer hook claude-code; else npx -y tiny-engineer hook claude-code; fi", - "async": true, - "timeout": 30 + "command": "grep -qs \"hook claude-code\" \"$CLAUDE_PROJECT_DIR/.claude/settings.json\" \"$CLAUDE_PROJECT_DIR/.claude/settings.local.json\" && exit 0; command -v tiny-engineer >/dev/null 2>&1 || exit 0; tiny-engineer hook claude-code", + "async": true } ] } @@ -160,9 +149,8 @@ "hooks": [ { "type": "command", - "command": "grep -qs \"hook claude-code\" \"$CLAUDE_PROJECT_DIR/.claude/settings.json\" \"$CLAUDE_PROJECT_DIR/.claude/settings.local.json\" && exit 0; if command -v tiny-engineer >/dev/null 2>&1; then tiny-engineer hook claude-code; else npx -y tiny-engineer hook claude-code; fi", - "async": true, - "timeout": 30 + "command": "grep -qs \"hook claude-code\" \"$CLAUDE_PROJECT_DIR/.claude/settings.json\" \"$CLAUDE_PROJECT_DIR/.claude/settings.local.json\" && exit 0; command -v tiny-engineer >/dev/null 2>&1 || exit 0; tiny-engineer hook claude-code", + "async": true } ] } @@ -172,9 +160,8 @@ "hooks": [ { "type": "command", - "command": "grep -qs \"hook claude-code\" \"$CLAUDE_PROJECT_DIR/.claude/settings.json\" \"$CLAUDE_PROJECT_DIR/.claude/settings.local.json\" && exit 0; if command -v tiny-engineer >/dev/null 2>&1; then tiny-engineer hook claude-code; else npx -y tiny-engineer hook claude-code; fi", - "async": true, - "timeout": 30 + "command": "grep -qs \"hook claude-code\" \"$CLAUDE_PROJECT_DIR/.claude/settings.json\" \"$CLAUDE_PROJECT_DIR/.claude/settings.local.json\" && exit 0; command -v tiny-engineer >/dev/null 2>&1 || exit 0; tiny-engineer hook claude-code", + "async": true } ] } diff --git a/docs/integration.md b/docs/integration.md index 2c49f5dc..16c0a5b6 100644 --- a/docs/integration.md +++ b/docs/integration.md @@ -106,13 +106,14 @@ This firmware repo already ships configs pointing at the **local** CLI bin for d Instead of `setup` per project, Claude Code can install the hooks once for every project as a plugin. This repo is a Claude Code plugin marketplace ([`.claude-plugin/marketplace.json`](../.claude-plugin/marketplace.json)). The `tiny-engineer` plugin brings the same 13 hook events as `setup claude-code` plus the [`tiny-engineer-play`](#speaking-through-the-robot-skill) skill. Run in a terminal: ```bash +npm i -g tiny-engineer claude plugin marketplace add jamro/tiny-engineer --sparse .claude-plugin skills claude plugin install tiny-engineer@tiny-engineer ``` `--sparse` makes Claude Code check out only the two folders the plugin needs (a few KB) instead of the whole repo with CAD, PCB, and firmware sources (over 200 MB). Restart Claude Code afterwards. Turn the plugin off or on with `/plugin`. -- The hooks run `tiny-engineer hook claude-code` when the CLI is on `PATH` (global npm install or a system package), else `npx -y tiny-engineer hook claude-code`. Connection prefs (URL, token, transport) come from the user config file described above, or from process env. +- The hooks run `tiny-engineer hook claude-code`, so the CLI must be on `PATH` (the `npm i -g` above, or a system package). Without it the hooks exit quietly and the robot stays still. They do not fall back to `npx`: Claude Code enforces no timeout on async hooks, and a stalled npm registry would leave one `npx` process behind per event. Connection prefs (URL, token, transport) come from the user config file described above, or from process env. - A project whose `.claude/settings.json` or `.claude/settings.local.json` already has Tiny Engineer hooks (from `setup`, or this repo's dev hooks) keeps those, and the plugin stays quiet there, so events never fire twice. - The skill is `/tiny-engineer:tiny-engineer-play` (plugin skills are namespaced). Claude also uses it when you ask the robot to say something.