crosspad-mcp-server 8.1.2 → 9.0.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.
Files changed (69) hide show
  1. package/.claude-plugin/marketplace.json +13 -0
  2. package/.claude-plugin/plugin.json +14 -0
  3. package/.mcp.json +9 -0
  4. package/README.md +95 -0
  5. package/dist/config.d.ts +3 -0
  6. package/dist/config.js +8 -0
  7. package/dist/config.js.map +1 -1
  8. package/dist/index.d.ts +1 -0
  9. package/dist/index.js +369 -49
  10. package/dist/index.js.map +1 -1
  11. package/dist/tools/idf-flash.js +2 -2
  12. package/dist/tools/idf-flash.js.map +1 -1
  13. package/dist/tools/idf-monitor.d.ts +3 -1
  14. package/dist/tools/idf-monitor.js +19 -3
  15. package/dist/tools/idf-monitor.js.map +1 -1
  16. package/dist/tools/midi.js +20 -16
  17. package/dist/tools/midi.js.map +1 -1
  18. package/dist/tools/symbols.d.ts +3 -1
  19. package/dist/tools/symbols.js +31 -1
  20. package/dist/tools/symbols.js.map +1 -1
  21. package/dist/tools/trace-buffer.d.ts +40 -0
  22. package/dist/tools/trace-buffer.js +74 -0
  23. package/dist/tools/trace-buffer.js.map +1 -0
  24. package/dist/tools/trace-device.d.ts +10 -0
  25. package/dist/tools/trace-device.js +26 -0
  26. package/dist/tools/trace-device.js.map +1 -0
  27. package/dist/tools/trace-doctor.d.ts +43 -0
  28. package/dist/tools/trace-doctor.js +150 -0
  29. package/dist/tools/trace-doctor.js.map +1 -0
  30. package/dist/tools/trace-export.d.ts +4 -0
  31. package/dist/tools/trace-export.js +14 -0
  32. package/dist/tools/trace-export.js.map +1 -0
  33. package/dist/tools/trace-session.d.ts +118 -0
  34. package/dist/tools/trace-session.js +346 -0
  35. package/dist/tools/trace-session.js.map +1 -0
  36. package/dist/tools/trace-symbols.d.ts +24 -0
  37. package/dist/tools/trace-symbols.js +44 -0
  38. package/dist/tools/trace-symbols.js.map +1 -0
  39. package/dist/tools/trace-webui.d.ts +53 -0
  40. package/dist/tools/trace-webui.js +222 -0
  41. package/dist/tools/trace-webui.js.map +1 -0
  42. package/dist/utils/device.d.ts +5 -0
  43. package/dist/utils/device.js +43 -15
  44. package/dist/utils/device.js.map +1 -1
  45. package/dist/utils/exec.js +26 -0
  46. package/dist/utils/exec.js.map +1 -1
  47. package/dist/utils/userConfig.d.ts +13 -0
  48. package/dist/utils/userConfig.js +43 -0
  49. package/dist/utils/userConfig.js.map +1 -0
  50. package/package.json +12 -4
  51. package/skills/crosspad/SKILL.md +58 -0
  52. package/skills/crosspad/reference/faq.md +40 -0
  53. package/skills/crosspad/reference/install.md +84 -0
  54. package/skills/crosspad/reference/repos.md +29 -0
  55. package/skills/crosspad/reference/role-contributor.md +64 -0
  56. package/skills/crosspad/reference/role-fw-dev.md +44 -0
  57. package/skills/crosspad/reference/role-user.md +49 -0
  58. package/skills/crosspad/reference/tools.md +68 -0
  59. package/skills/crosspad/scripts/doctor.sh +65 -0
  60. package/skills/crosspad/scripts/setup.sh +53 -0
  61. package/skills/swd-tracer/SKILL.md +135 -0
  62. package/skills/swd-tracer/reference/signals.md +42 -0
  63. package/skills/swd-tracer/scripts/detect-env.sh +61 -0
  64. package/skills/swd-tracer/scripts/install-udev-rules.sh +25 -0
  65. package/skills/swd-tracer/scripts/setup-venv.sh +26 -0
  66. package/tracer/PROTOCOL.md +260 -0
  67. package/tracer/README.md +327 -0
  68. package/tracer/swd_tracer.py +1066 -0
  69. package/tracer/ui/index.html +834 -0
@@ -0,0 +1,58 @@
1
+ ---
2
+ name: crosspad
3
+ description: Use FIRST when starting any work in a CrossPad repo, when installing or configuring the crosspad-mcp server, or when unsure how the CrossPad ecosystem (repos, MCP tools, build/flash/sim/trace, app registry) fits together. The entry point to the whole CrossPad MCP toolkit — routes to install, per-role guides (user / firmware dev / server contributor), a tool cheat-sheet, an FAQ, and the swd-tracer skill. Run `bash scripts/doctor.sh` to check the environment.
4
+ ---
5
+
6
+ # CrossPad — start here
7
+
8
+ CrossPad is a 16-pad embedded MIDI controller. Its software spans several repos,
9
+ and the **crosspad-mcp** server gives an LLM purpose-built tools to build, flash,
10
+ test, drive the simulator, search code, and manage app packages across them.
11
+
12
+ This skill is the **map**. It loads light — read a `reference/*.md` file only when
13
+ its topic comes up. For real-time SWD variable tracing on STM32 MCU, use the separate
14
+ **`swd-tracer`** skill.
15
+
16
+ ## First move
17
+
18
+ ```bash
19
+ bash scripts/doctor.sh # read-only: what repos/env/server are present, and what's missing
20
+ ```
21
+
22
+ (Resolve `scripts/` relative to this SKILL.md — e.g. `~/.claude/skills/crosspad/scripts/`
23
+ for a global install, or `<crosspad-mcp>/skills/crosspad/scripts/` in the repo/plugin.)
24
+
25
+ ## Architecture map
26
+
27
+ ```
28
+ ┌─────────────────────────┐
29
+ you (LLM session) ── │ crosspad-mcp server │ ── 28 tools + resources
30
+ └────────────┬────────────┘
31
+ │ resolves repos from CROSSPAD_*_ROOT
32
+ ┌──────────────┬─────────────┼─────────────┬───────────────┐
33
+ crosspad-pc platform-idf ESP32-S3 crosspad-core crosspad-gui
34
+ (PC simulator) (ESP-IDF fw) (Arduino fw) (shared logic) (display UI)
35
+ └──────── apps installed as submodules from the crosspad-apps registry ┘
36
+
37
+ CrossPad_STM32_r20 — the STM32G0B1 board firmware (separate repo; SWD trace via swd-tracer skill)
38
+ ```
39
+
40
+ ## Routing table — "I want to … → read this"
41
+
42
+ | Goal | Open |
43
+ |------|------|
44
+ | Install / configure the crosspad-mcp server (Node, env vars, `.mcp.json`, Desktop) | `reference/install.md` — or run `scripts/setup.sh` for assisted install |
45
+ | Understand the repos and what lives where | `reference/repos.md` |
46
+ | I'm a **user** of the MCP/firmware (build sim, flash, manage apps, drive sim) | `reference/role-user.md` |
47
+ | I'm a **firmware developer** (where the code is, interfaces, capabilities, tests) | `reference/role-fw-dev.md` |
48
+ | I'm a **crosspad-mcp contributor** (server `src/`, add a tool, dev/build/test) | `reference/role-contributor.md` |
49
+ | Which tool do I use for a task? | `reference/tools.md` |
50
+ | Something is broken / a tool errors | `reference/faq.md` |
51
+ | Trace firmware variables in real time over SWD (ST-Link) | use the **`swd-tracer`** skill |
52
+
53
+ ## Conventions
54
+
55
+ - Prefer `crosspad_*` MCP tools over raw shell (`git`, `cmake`, `idf.py`, `grep`) —
56
+ they resolve repos dynamically and return structured errors. See `reference/tools.md`.
57
+ - Only repos that exist on disk appear in tool results; missing repos are silent.
58
+ If a tool says a repo is undetected, see `reference/install.md` env vars.
@@ -0,0 +1,40 @@
1
+ # FAQ — common errors & pitfalls
2
+
3
+ **Q: A tool says a repo isn't detected / isn't found.**
4
+ A: Only repos present on disk appear. Set the matching `CROSSPAD_*_ROOT` env var (see
5
+ `reference/install.md`) or place the repo under `CROSSPAD_GIT_DIR` (default `~/GIT`).
6
+ Check `crosspad://workspace` to see what resolved.
7
+
8
+ **Q: The `crosspad_*` tools don't appear at all.**
9
+ A: The server isn't registered. Run `claude mcp add crosspad -- npx -y crosspad-mcp-server`
10
+ (or add `.mcp.json`), then restart Claude Code. `bash scripts/doctor.sh` confirms reachability.
11
+
12
+ **Q: `crosspad_run` succeeds but interaction tools fail.**
13
+ A: Interactive tools talk to the running sim over TCP `localhost:19840`. Confirm the sim
14
+ is up (`crosspad_run` returns a PID + readiness probe) and that `CROSSPAD_REMOTE_PORT`/`HOST`
15
+ match. `crosspad_check platform=pc` flags a stale exe.
16
+
17
+ **Q: PC build fails on missing dependencies.**
18
+ A: The PC simulator uses vcpkg. Set `VCPKG_ROOT` (default `~/vcpkg`, `C:/vcpkg` on Windows);
19
+ on Windows also `VCVARSALL` for the MSVC environment.
20
+
21
+ **Q: IDF build can't find ESP-IDF.**
22
+ A: Set `IDF_PATH` (auto-detect tries `~/esp/esp-idf`). The build sources the IDF export env.
23
+
24
+ **Q: `npm test` / tooling fails with "styleText is not exported from node:util" (or similar).**
25
+ A: System Node is too old. Use Node 22 (e.g. `nvm use 22`). Server runtime needs Node ≥ 18.
26
+
27
+ **Q: `idf.py` / a build fails with a git "bare repository" error.**
28
+ A: A safe-directory/bare-repo guard. Override via `GIT_CONFIG` env or neutralize the guard;
29
+ re-run the build.
30
+
31
+ **Q: `crosspad_commit` refuses.**
32
+ A: It refuses on merge conflicts and never pushes. Resolve conflicts, re-stage, retry.
33
+
34
+ **Q: I want to trace firmware variables live.**
35
+ A: That's the separate `swd-tracer` skill (`crosspad_trace`) for CrossPad_STM32_r20 over
36
+ ST-Link. Run its `doctor` action first.
37
+
38
+ **Q: How do I see everything at a glance?**
39
+ A: `bash scripts/doctor.sh` (env), `crosspad_repo_status` (git), and the
40
+ `crosspad://workspace` resource (repos + sim).
@@ -0,0 +1,84 @@
1
+ # Install & configure crosspad-mcp
2
+
3
+ ## Fastest path
4
+
5
+ ```bash
6
+ claude mcp add crosspad -- npx -y crosspad-mcp-server
7
+ ```
8
+
9
+ Restart Claude Code; the `crosspad_*` tools appear. For an assisted, interactive
10
+ setup that also helps set repo paths, run `bash scripts/setup.sh` from this skill.
11
+
12
+ ## With custom repo paths
13
+
14
+ ```bash
15
+ claude mcp add crosspad \
16
+ --env CROSSPAD_IDF_ROOT=/path/to/platform-idf \
17
+ --env CROSSPAD_PC_ROOT=/path/to/crosspad-pc \
18
+ -- npx -y crosspad-mcp-server
19
+ ```
20
+
21
+ ## Per-project `.mcp.json` (Claude Code picks it up automatically)
22
+
23
+ ```json
24
+ {
25
+ "mcpServers": {
26
+ "crosspad": {
27
+ "type": "stdio",
28
+ "command": "npx",
29
+ "args": ["-y", "crosspad-mcp-server"],
30
+ "env": {
31
+ "CROSSPAD_IDF_ROOT": "/path/to/platform-idf",
32
+ "CROSSPAD_PC_ROOT": "/path/to/crosspad-pc"
33
+ }
34
+ }
35
+ }
36
+ }
37
+ ```
38
+
39
+ ## Claude Desktop
40
+
41
+ Edit `~/Library/Application Support/Claude/claude_desktop_config.json` (macOS) or
42
+ `%APPDATA%\Claude\claude_desktop_config.json` (Windows) with the same
43
+ `mcpServers.crosspad` block (drop the `"type"` field).
44
+
45
+ ## Environment variables
46
+
47
+ Each repo path is individually configurable; unset paths fall back to
48
+ `$CROSSPAD_GIT_DIR/<repo-name>` (flat layout). Only repos that exist on disk
49
+ appear in tool results.
50
+
51
+ | Variable | Default | Purpose |
52
+ |----------|---------|---------|
53
+ | `CROSSPAD_GIT_DIR` | `~/GIT` | Base dir for the flat-layout fallback |
54
+ | `CROSSPAD_PC_ROOT` | `$GIT_DIR/crosspad-pc` | PC simulator repo |
55
+ | `CROSSPAD_IDF_ROOT` | `$GIT_DIR/platform-idf` | ESP-IDF platform repo |
56
+ | `CROSSPAD_ARDUINO_ROOT` | `$GIT_DIR/ESP32-S3` | Arduino platform repo |
57
+ | `CROSSPAD_CORE_ROOT` | `$GIT_DIR/crosspad-core` | crosspad-core (standalone) |
58
+ | `CROSSPAD_GUI_ROOT` | `$GIT_DIR/crosspad-gui` | crosspad-gui (standalone) |
59
+ | `IDF_PATH` | auto (`~/esp/esp-idf`) | ESP-IDF SDK path |
60
+ | `VCPKG_ROOT` | `~/vcpkg` / `C:/vcpkg` | vcpkg install (PC build deps) |
61
+ | `VCVARSALL` | VS2022 default | MSVC vcvarsall.bat (Windows only) |
62
+ | `CROSSPAD_REMOTE_PORT` | `19840` | Simulator remote-control TCP port |
63
+ | `CROSSPAD_REMOTE_HOST` | `127.0.0.1` | Simulator remote-control TCP host |
64
+
65
+ ## Node version
66
+
67
+ The server requires Node ≥ 18 (`package.json` `engines`). If `npm test`/tooling
68
+ fails with errors like `styleText is not exported from node:util`, the system
69
+ Node is too old — use Node 22 (e.g. via nvm: `nvm use 22`).
70
+
71
+ ## Transports
72
+
73
+ - **stdio** (default) — `npx crosspad-mcp-server`. For Claude Code / Desktop / IDE.
74
+ - **HTTP** — `npx crosspad-mcp-server --http 3000` exposes `http://localhost:3000/mcp`
75
+ for remote dev boxes / browser MCP clients (stateful `Mcp-Session-Id` sessions).
76
+
77
+ ## Verify
78
+
79
+ ```bash
80
+ bash scripts/doctor.sh # which repos/env resolve, is the server built, app-registry present
81
+ ```
82
+
83
+ Or check the `crosspad://workspace` MCP resource — it lists detected repos,
84
+ branches, dirty counts, and simulator status without a tool call.
@@ -0,0 +1,29 @@
1
+ # CrossPad repos — what lives where
2
+
3
+ The crosspad-mcp server discovers these dynamically from `CROSSPAD_*_ROOT`
4
+ (see `reference/install.md`). Only repos present on disk show up in tool results.
5
+
6
+ | Repo | Env var | What it is |
7
+ |------|---------|-----------|
8
+ | **crosspad-pc** | `CROSSPAD_PC_ROOT` | Desktop **simulator** — runs the firmware logic on the host (CMake/Ninja + vcpkg). Build with `crosspad_build platform=pc`, launch with `crosspad_run`. |
9
+ | **platform-idf** | `CROSSPAD_IDF_ROOT` | **ESP-IDF** firmware for the ESP32-S3 sidekick. Build with `crosspad_build platform=idf`, flash with `crosspad_flash transport=uart\|ota`. |
10
+ | **ESP32-S3** | `CROSSPAD_ARDUINO_ROOT` | Arduino-framework variant of the ESP32-S3 firmware. |
11
+ | **crosspad-core** | `CROSSPAD_CORE_ROOT` | Shared, platform-independent logic + **interfaces** (the contract PC/IDF/Arduino implement). Browse with `crosspad_list_interfaces` / `crosspad_interface_implementations`. |
12
+ | **crosspad-gui** | `CROSSPAD_GUI_ROOT` | Display/UI layer. |
13
+ | **crosspad-apps** | (registry) | App package **registry**. Apps install into a platform repo as git submodules via `crosspad_apps_*` tools. |
14
+ | **CrossPad_STM32_r20** | (STM repo) | STM32G0B1 single-board firmware. Real-time variable tracing over SWD lives in the **`swd-tracer`** skill, not here. |
15
+
16
+ ## How they relate
17
+
18
+ - **crosspad-core** defines interfaces; **crosspad-pc**, **platform-idf**, and
19
+ **ESP32-S3** are concrete platforms implementing them. Same app logic, three targets.
20
+ - **Apps** are reusable behaviors (instruments, sequencers, utilities) pulled from
21
+ the **crosspad-apps** registry into a platform repo as submodules.
22
+ - The **PC simulator** is the fast iteration loop — build/run/screenshot/input on
23
+ the host before flashing real hardware.
24
+
25
+ ## Inspecting state
26
+
27
+ - `crosspad_repo_status` — git status across every detected repo at once.
28
+ - `crosspad_repo_diff` — submodule drift in crosspad-pc / platform-idf.
29
+ - `crosspad://workspace` resource — JSON snapshot of repos, branches, dirty counts, sim status.
@@ -0,0 +1,64 @@
1
+ # Role: crosspad-mcp server contributor
2
+
3
+ You are developing the crosspad-mcp server itself (this repo).
4
+
5
+ ## Setup
6
+
7
+ ```bash
8
+ git clone https://github.com/CrossPad/crosspad-mcp.git
9
+ cd crosspad-mcp
10
+ npm install
11
+ npm run dev # tsc --watch
12
+ npm run build # one-shot tsc → dist/
13
+ npm test # vitest run
14
+ npm run test:watch # vitest watch
15
+ ```
16
+
17
+ Node ≥ 18; use Node 22 if tooling complains about missing `node:` exports.
18
+
19
+ ## Layout
20
+
21
+ ```
22
+ src/
23
+ index.ts — tool registrations (one tool per action) + SERVER_INSTRUCTIONS
24
+ config.ts — per-repo env vars, dynamic repo discovery, IDF/MSVC paths
25
+ utils/
26
+ exec.ts — platform-aware command execution (MSVC/IDF/shell)
27
+ git.ts — repo status, submodule pins
28
+ remote-client.ts — TCP client for the simulator (localhost:19840)
29
+ tools/
30
+ app-manager.ts — crosspad_apps: registry + Python subprocess
31
+ architecture.ts — interfaces, REGISTER_APP scan
32
+ build.ts — PC build + run
33
+ build-check.ts — build health check
34
+ diff-core.ts — submodule drift analysis
35
+ idf-build.ts — ESP-IDF build
36
+ input.ts — simulator input events
37
+ log.ts — log capture
38
+ repos.ts — multi-repo git status
39
+ scaffold.ts — app boilerplate generation
40
+ screenshot.ts — simulator screenshots
41
+ settings.ts — simulator settings R/W
42
+ stats.ts — simulator runtime stats
43
+ symbols.ts — cross-repo symbol search
44
+ test.ts — Catch2 test runner
45
+ *.test.ts — unit tests per module (vitest, fs mocking)
46
+ ```
47
+
48
+ ## Adding a tool
49
+
50
+ 1. Implement the logic in a focused `src/tools/<name>.ts` (+ `<name>.test.ts`).
51
+ 2. Register it in `src/index.ts` with a zod schema (validate ranges/enums) and the
52
+ right MCP annotations: `readOnlyHint` for status/search/list, `destructiveHint`
53
+ for mutating ops (clients use these to decide on confirmation prompts).
54
+ 3. Return the uniform envelope `{ success: boolean, ...data, error?: string }`; set
55
+ `isError: true` on failure so clients route errors distinctly.
56
+ 4. If the tool changes how a user should work, update `SERVER_INSTRUCTIONS` and the
57
+ relevant `skills/crosspad/reference/*.md`.
58
+ 5. `npm run build` then `npm test`.
59
+
60
+ ## Conventions
61
+
62
+ - One tool = one action with a strict schema. Stream long-running output via MCP
63
+ logging (build/test/log) so the client sees progress.
64
+ - Keep files focused; mirror the existing module-per-concern split.
@@ -0,0 +1,44 @@
1
+ # Role: firmware developer
2
+
3
+ You edit CrossPad firmware/core logic. Use the MCP tools to navigate and verify
4
+ across repos instead of raw shell.
5
+
6
+ ## Find code (prefer over `grep -r`)
7
+
8
+ | Want | Tool |
9
+ |------|------|
10
+ | A class/function/macro/enum/typedef definition | `crosspad_search_symbols` |
11
+ | List crosspad-core interfaces | `crosspad_list_interfaces` |
12
+ | Find implementations of an interface | `crosspad_interface_implementations` |
13
+ | Capability flags + per-platform sets | `crosspad_capabilities` |
14
+ | Apps registered via `REGISTER_APP()` | `crosspad_list_apps_source` |
15
+ | One symbol in one repo (MCP resource) | `crosspad://symbols/{repo}/{symbol}` |
16
+
17
+ ## Architecture to keep in mind
18
+
19
+ - **crosspad-core** owns the interfaces; platforms (crosspad-pc, platform-idf,
20
+ ESP32-S3) implement them. Add behavior at the right layer — shared logic in core,
21
+ platform specifics in the platform repo. See `reference/repos.md`.
22
+ - The **PC simulator** is the fastest verify loop: build/run/screenshot/input on the
23
+ host (`reference/role-user.md`) before touching hardware.
24
+
25
+ ## Build & test
26
+
27
+ ```
28
+ crosspad_build platform=pc # or platform=idf
29
+ crosspad_test_run # build + run Catch2 suite (filter, list_only)
30
+ crosspad_check platform=pc # health: stale exe, new sources, submodule drift
31
+ ```
32
+
33
+ `crosspad_build` parses compiler output into a structured `errors[]` — read those
34
+ rather than scrolling raw logs.
35
+
36
+ ## Committing across repos
37
+
38
+ `crosspad_commit` commits staged changes with correct multi-repo paths and refuses
39
+ on merge conflicts (never pushes). Use it instead of raw `git commit`.
40
+
41
+ ## Real-time variable tracing
42
+
43
+ For live RAM-variable plots on the STM32 board (CrossPad_STM32_r20), use the
44
+ **`swd-tracer`** skill (`crosspad_trace` tool) — not covered here.
@@ -0,0 +1,49 @@
1
+ # Role: MCP / firmware user
2
+
3
+ You build and drive CrossPad firmware (mostly the PC simulator) and manage apps.
4
+ You are not editing the crosspad-mcp server itself.
5
+
6
+ ## Typical loop (PC simulator)
7
+
8
+ ```
9
+ crosspad_check platform=pc # stale exe? new sources? submodule drift?
10
+ crosspad_build platform=pc # mode: incremental | clean | reconfigure; build_type for Debug/Release
11
+ crosspad_run platform=pc # launch sim, returns PID + TCP readiness probe
12
+ ... interact (below) ...
13
+ crosspad_kill platform=pc # stop it when done
14
+ ```
15
+
16
+ ## Driving the running simulator
17
+
18
+ | Want | Tool |
19
+ |------|------|
20
+ | See the screen | `crosspad_screenshot` (file path; `return_inline` for base64) |
21
+ | Press pads / encoder / keys | `crosspad_input` (`action`: pad_press/release, encoder_*, click, key) |
22
+ | Send MIDI | `crosspad_midi` (`type`: note_on/off, cc, program_change) |
23
+ | Inspect runtime state | `crosspad_stats` (pads, capabilities, heap, apps) |
24
+ | Read/write settings | `crosspad_settings_get` / `crosspad_settings_set` |
25
+
26
+ ## Flashing hardware
27
+
28
+ ```
29
+ crosspad_build platform=idf # build ESP-IDF firmware
30
+ crosspad_flash transport=uart # or transport=ota with firmware_path
31
+ crosspad_log target=idf # read serial logs
32
+ crosspad_devices # list USB serial devices, flag CrossPads
33
+ ```
34
+
35
+ ## Managing apps (crosspad-apps registry)
36
+
37
+ | Want | Tool |
38
+ |------|------|
39
+ | List apps + where installed | `crosspad_apps_list` |
40
+ | Install an app (as submodule) | `crosspad_apps_install` (`platform`, `app_name`, `ref`, `force`) |
41
+ | Remove an app | `crosspad_apps_remove` |
42
+ | Update one / all apps | `crosspad_apps_update` (`app_name` or `update_all`) |
43
+ | Rebuild manifest from disk | `crosspad_apps_sync` |
44
+
45
+ Use these instead of manual `git submodule` operations.
46
+
47
+ ## If something breaks
48
+
49
+ See `reference/faq.md` (repo not detected, sim won't start, build deps, …).
@@ -0,0 +1,68 @@
1
+ # Tool cheat-sheet — grouped by task
2
+
3
+ 28 tools. All return `{ success, ...data, error? }`; failures also set `isError: true`.
4
+ Read-only tools (status/search/list) skip client confirmation prompts; destructive
5
+ ones (commit, flash, clean build, apps_install) trigger one.
6
+
7
+ ## Build & flash
8
+ | Tool | Use |
9
+ |------|-----|
10
+ | `crosspad_build` | Build `platform: pc\|idf` (`mode`, `build_type` for PC) |
11
+ | `crosspad_run` | Launch built simulator (`platform: pc`) → PID + TCP readiness |
12
+ | `crosspad_kill` | Stop running simulator (`platform: pc`) |
13
+ | `crosspad_check` | Health check (`platform: pc`): stale exe, new sources, drift |
14
+ | `crosspad_flash` | Flash firmware (`transport: uart\|ota`, `port?`, `firmware_path?`) |
15
+ | `crosspad_log` | Capture logs (`target: pc\|idf`) |
16
+ | `crosspad_devices` | List USB serial devices, flag CrossPads |
17
+ | `crosspad_trace` | Real-time SWD variable trace (STM32) — see the `swd-tracer` skill |
18
+
19
+ ## Tests
20
+ | Tool | Use |
21
+ |------|-----|
22
+ | `crosspad_test_run` | Build + run Catch2 suite (`filter`, `list_only`) |
23
+
24
+ ## Simulator interaction
25
+ | Tool | Use |
26
+ |------|-----|
27
+ | `crosspad_screenshot` | PNG screenshot (`return_inline` for base64) |
28
+ | `crosspad_input` | Input events (`action`: pad_press/release, encoder_*, click, key) |
29
+ | `crosspad_midi` | MIDI events (`type`: note_on/off, cc, program_change) |
30
+ | `crosspad_stats` | Runtime state: pads, capabilities, heap, apps |
31
+ | `crosspad_settings_get` / `crosspad_settings_set` | Read/write settings |
32
+
33
+ ## Git / repos
34
+ | Tool | Use |
35
+ |------|-----|
36
+ | `crosspad_repo_status` | git status across all detected repos |
37
+ | `crosspad_repo_diff` | Submodule drift (crosspad-pc / platform-idf) |
38
+ | `crosspad_submodule_update` | Update submodule to `origin/<branch>` + stage |
39
+ | `crosspad_commit` | Commit staged changes (refuses on conflicts; never pushes) |
40
+
41
+ ## Code search & scaffolding
42
+ | Tool | Use |
43
+ |------|-----|
44
+ | `crosspad_search_symbols` | Find class/function/macro/enum/typedef defs |
45
+ | `crosspad_list_interfaces` | List crosspad-core interfaces |
46
+ | `crosspad_interface_implementations` | Find implementations of an interface |
47
+ | `crosspad_capabilities` | Capability flags + per-platform sets |
48
+ | `crosspad_list_apps_source` | Apps registered via `REGISTER_APP()` |
49
+
50
+ ## App package manager
51
+ | Tool | Use |
52
+ |------|-----|
53
+ | `crosspad_apps_list` | Apps from registry + where installed |
54
+ | `crosspad_apps_install` | Install app as submodule (`platform`, `app_name`, `ref`, `force`) |
55
+ | `crosspad_apps_remove` | Remove installed app submodule |
56
+ | `crosspad_apps_update` | Update one (`app_name`) or all (`update_all`) |
57
+ | `crosspad_apps_sync` | Rebuild manifest from disk |
58
+
59
+ ## Resources (loadable without a tool call)
60
+ | URI | Use |
61
+ |-----|-----|
62
+ | `crosspad://workspace` | Detected repos, branches, HEADs, dirty counts, sim status |
63
+ | `crosspad://apps/registry/<platform>` | Raw `app-registry.json` per platform |
64
+ | `crosspad://apps/installed/<platform>` | Raw installed `apps.json` per platform |
65
+ | `crosspad://symbols/{repo}/{symbol}` | Resolve one symbol in `<repo>` (or `all`) |
66
+
67
+ > v8 note: platform/transport is an arg, not part of the tool name
68
+ > (e.g. `crosspad_build platform=pc`, not `crosspad_build_pc`).
@@ -0,0 +1,65 @@
1
+ #!/usr/bin/env bash
2
+ # CrossPad environment doctor — read-only. Reports which repos/env/server/registry
3
+ # are present and what to do about gaps. Writes nothing.
4
+ set -uo pipefail
5
+
6
+ GIT_DIR="${CROSSPAD_GIT_DIR:-$HOME/GIT}"
7
+
8
+ ok() { printf ' \033[32mOK\033[0m %s\n' "$1"; }
9
+ miss() { printf ' \033[31mMISS\033[0m %s\n' "$1"; }
10
+ info() { printf ' \033[33m..\033[0m %s\n' "$1"; }
11
+
12
+ echo "== CrossPad environment =="
13
+
14
+ # 1. Node
15
+ if command -v node >/dev/null 2>&1; then
16
+ NODE_V="$(node --version)"
17
+ NODE_MAJ="${NODE_V#v}"; NODE_MAJ="${NODE_MAJ%%.*}"
18
+ if [ "${NODE_MAJ:-0}" -ge 18 ]; then ok "Node $NODE_V (>= 18)"
19
+ else miss "Node $NODE_V is < 18 — use Node 18+ (e.g. nvm use 22)"; fi
20
+ else
21
+ miss "node not found — install Node >= 18"
22
+ fi
23
+
24
+ # 2. Repos (only those present matter)
25
+ repo_check() { # $1 = env var name, $2 = default subdir, $3 = label
26
+ local val="${!1:-$GIT_DIR/$2}"
27
+ if { [ -d "$val/.git" ] || [ -d "$val" ]; } && [ -n "$(ls -A "$val" 2>/dev/null)" ]; then
28
+ ok "$3: $val"
29
+ else
30
+ info "$3 not at $val — set \$$1 if it lives elsewhere"
31
+ fi
32
+ }
33
+ repo_check CROSSPAD_PC_ROOT crosspad-pc "crosspad-pc (PC sim)"
34
+ repo_check CROSSPAD_IDF_ROOT platform-idf "platform-idf (ESP-IDF)"
35
+ repo_check CROSSPAD_ARDUINO_ROOT ESP32-S3 "ESP32-S3 (Arduino)"
36
+ repo_check CROSSPAD_CORE_ROOT crosspad-core "crosspad-core"
37
+ repo_check CROSSPAD_GUI_ROOT crosspad-gui "crosspad-gui"
38
+
39
+ # 3. Toolchains (best-effort, informational)
40
+ command -v cmake >/dev/null 2>&1 && ok "cmake present" || info "cmake not found (needed for PC build)"
41
+ command -v idf.py >/dev/null 2>&1 && ok "idf.py present" || info "idf.py not on PATH (source ESP-IDF export.sh for firmware build)"
42
+ [ -n "${IDF_PATH:-}" ] && ok "IDF_PATH=$IDF_PATH" || info "IDF_PATH unset (auto-detect tries ~/esp/esp-idf)"
43
+ [ -n "${VCPKG_ROOT:-}" ] && ok "VCPKG_ROOT=$VCPKG_ROOT" || info "VCPKG_ROOT unset (PC build deps; default ~/vcpkg)"
44
+
45
+ # 4. crosspad-mcp server: is it registered with Claude?
46
+ if command -v claude >/dev/null 2>&1; then
47
+ if claude mcp list 2>/dev/null | grep -qi crosspad; then
48
+ ok "crosspad MCP server registered with Claude"
49
+ else
50
+ miss "crosspad MCP server not registered — run scripts/setup.sh or: claude mcp add crosspad -- npx -y crosspad-mcp-server"
51
+ fi
52
+ else
53
+ info "claude CLI not found — can't check MCP registration"
54
+ fi
55
+
56
+ # 5. Local server build (only relevant when run from inside the repo)
57
+ SKILL_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
58
+ REPO_ROOT="$(cd "$SKILL_DIR/../.." 2>/dev/null && pwd)"
59
+ if [ -f "$REPO_ROOT/package.json" ] && grep -q '"crosspad-mcp-server"' "$REPO_ROOT/package.json" 2>/dev/null; then
60
+ if [ -f "$REPO_ROOT/dist/index.js" ]; then ok "server built: $REPO_ROOT/dist/index.js"
61
+ else miss "server not built — run 'npm run build' in $REPO_ROOT"; fi
62
+ fi
63
+
64
+ echo "== done =="
65
+ echo "Next: read reference/install.md (setup) or reference/role-*.md (your role). For trace: swd-tracer skill."
@@ -0,0 +1,53 @@
1
+ #!/usr/bin/env bash
2
+ # CrossPad assisted setup — registers the crosspad-mcp server with Claude and
3
+ # helps set repo env vars. Idempotent: safe to re-run. Prompts before changes;
4
+ # pass --yes to accept defaults non-interactively.
5
+ set -uo pipefail
6
+
7
+ YES=0
8
+ [ "${1:-}" = "--yes" ] && YES=1
9
+
10
+ ask() { # $1 = prompt, $2 = default; echoes the answer
11
+ local ans
12
+ if [ "$YES" = "1" ]; then echo "$2"; return; fi
13
+ read -r -p "$1 [$2]: " ans
14
+ echo "${ans:-$2}"
15
+ }
16
+
17
+ echo "== CrossPad setup =="
18
+
19
+ # 1. Node check (hard requirement)
20
+ if ! command -v node >/dev/null 2>&1; then
21
+ echo "ERROR: Node is required (>= 18). Install it (e.g. via nvm) and re-run." >&2
22
+ exit 1
23
+ fi
24
+
25
+ # 2. claude CLI check
26
+ if ! command -v claude >/dev/null 2>&1; then
27
+ echo "claude CLI not found. Install Claude Code, then re-run — or add the server"
28
+ echo "manually via a .mcp.json (see reference/install.md)."
29
+ exit 1
30
+ fi
31
+
32
+ # 3. Already registered?
33
+ if claude mcp list 2>/dev/null | grep -qi crosspad; then
34
+ echo "crosspad MCP server already registered. Nothing to do."
35
+ echo "(Re-add with different env? Remove first: claude mcp remove crosspad)"
36
+ exit 0
37
+ fi
38
+
39
+ # 4. Collect repo paths (only pass env for ones the user confirms exist)
40
+ GIT_DIR="${CROSSPAD_GIT_DIR:-$HOME/GIT}"
41
+ PC_ROOT="$(ask 'crosspad-pc repo path' "$GIT_DIR/crosspad-pc")"
42
+ IDF_ROOT="$(ask 'platform-idf repo path' "$GIT_DIR/platform-idf")"
43
+
44
+ ENV_ARGS=()
45
+ [ -d "$PC_ROOT" ] && ENV_ARGS+=(--env "CROSSPAD_PC_ROOT=$PC_ROOT")
46
+ [ -d "$IDF_ROOT" ] && ENV_ARGS+=(--env "CROSSPAD_IDF_ROOT=$IDF_ROOT")
47
+
48
+ # 5. Register
49
+ echo "Registering crosspad MCP server..."
50
+ claude mcp add crosspad "${ENV_ARGS[@]}" -- npx -y crosspad-mcp-server
51
+
52
+ echo "== done =="
53
+ echo "Restart Claude Code, then run scripts/doctor.sh to verify."