crosspad-mcp-server 4.0.1 → 5.0.1
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/README.md +114 -127
- package/dist/config.d.ts +13 -3
- package/dist/config.js +89 -20
- package/dist/config.js.map +1 -1
- package/dist/index.js +214 -308
- package/dist/index.js.map +1 -1
- package/dist/tools/app-manager.d.ts +37 -0
- package/dist/tools/app-manager.js +230 -0
- package/dist/tools/app-manager.js.map +1 -0
- package/dist/tools/architecture.d.ts +1 -1
- package/dist/tools/architecture.js +45 -34
- package/dist/tools/architecture.js.map +1 -1
- package/dist/tools/build-check.js +2 -2
- package/dist/tools/build-check.js.map +1 -1
- package/dist/tools/build.js +2 -4
- package/dist/tools/build.js.map +1 -1
- package/dist/tools/diff-core.js.map +1 -1
- package/dist/tools/idf-build.js +3 -3
- package/dist/tools/idf-build.js.map +1 -1
- package/dist/tools/log.js +3 -3
- package/dist/tools/log.js.map +1 -1
- package/dist/tools/repos.js +38 -28
- package/dist/tools/repos.js.map +1 -1
- package/dist/tools/screenshot.d.ts +1 -2
- package/dist/tools/screenshot.js +3 -10
- package/dist/tools/screenshot.js.map +1 -1
- package/dist/tools/symbols.js +5 -4
- package/dist/tools/symbols.js.map +1 -1
- package/dist/tools/test.js +2 -5
- package/dist/tools/test.js.map +1 -1
- package/dist/utils/exec.d.ts +12 -4
- package/dist/utils/exec.js +52 -17
- package/dist/utils/exec.js.map +1 -1
- package/package.json +24 -4
- package/.mcpregistry_github_token +0 -1
- package/.mcpregistry_registry_token +0 -1
- package/mcp-publisher.exe +0 -0
- package/mcp-publisher.tar.gz +0 -0
- package/server.json +0 -21
- package/src/config.ts +0 -45
- package/src/index.ts +0 -484
- package/src/tools/architecture.ts +0 -260
- package/src/tools/build-check.ts +0 -178
- package/src/tools/build.ts +0 -130
- package/src/tools/diff-core.ts +0 -130
- package/src/tools/idf-build.ts +0 -182
- package/src/tools/input.ts +0 -80
- package/src/tools/log.ts +0 -75
- package/src/tools/repos.ts +0 -75
- package/src/tools/scaffold.ts +0 -229
- package/src/tools/screenshot.ts +0 -100
- package/src/tools/settings.ts +0 -68
- package/src/tools/stats.ts +0 -38
- package/src/tools/symbols.ts +0 -185
- package/src/tools/test.ts +0 -264
- package/src/utils/exec.ts +0 -376
- package/src/utils/git.ts +0 -45
- package/src/utils/remote-client.ts +0 -107
- package/tsconfig.json +0 -16
package/README.md
CHANGED
|
@@ -1,187 +1,174 @@
|
|
|
1
|
-
# crosspad-mcp
|
|
1
|
+
# crosspad-mcp-server
|
|
2
2
|
|
|
3
|
-
MCP (Model Context Protocol) server that gives Claude Code full control over the CrossPad development workflow — build, test,
|
|
3
|
+
MCP (Model Context Protocol) server that gives Claude Code full control over the CrossPad development workflow — build, test, manage app packages, interact with the simulator, search code across repos. All from natural language.
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## Install
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
**Testing** — run Catch2 tests with filtering, scaffold test infrastructure from scratch.
|
|
12
|
-
|
|
13
|
-
**Code navigation** — search symbols (classes, functions, macros, enums) across all CrossPad repos at once. Query interfaces and their platform implementations. List registered apps.
|
|
14
|
-
|
|
15
|
-
**Simulator interaction** — take screenshots (full window or LCD-only), press pads, rotate the encoder, click UI elements, read runtime stats (pad state, capabilities, heap), read/write settings — all while the simulator is running.
|
|
16
|
-
|
|
17
|
-
**Multi-repo awareness** — git status across all 5 CrossPad repos, detect dev-mode vs submodule-mode, diff crosspad-core/gui against pinned commits.
|
|
18
|
-
|
|
19
|
-
**Real-time streaming** — build output, test results, and log capture stream line-by-line to Claude instead of blocking until completion.
|
|
20
|
-
|
|
21
|
-
## Prerequisites
|
|
22
|
-
|
|
23
|
-
- **Node.js** 18+
|
|
24
|
-
- **crosspad-pc** repo cloned and buildable (cmake, vcpkg, SDL2)
|
|
25
|
-
- **Windows**: Visual Studio 2022 (MSVC) — auto-detected
|
|
26
|
-
- **macOS/Linux**: clang or gcc, cmake, ninja (optional)
|
|
7
|
+
```bash
|
|
8
|
+
claude mcp add crosspad -- npx -y crosspad-mcp-server
|
|
9
|
+
```
|
|
27
10
|
|
|
28
|
-
|
|
11
|
+
Or with a custom repos directory:
|
|
29
12
|
|
|
30
13
|
```bash
|
|
31
|
-
|
|
32
|
-
cd crosspad-mcp
|
|
33
|
-
npm install
|
|
34
|
-
npm run build
|
|
14
|
+
claude mcp add crosspad --env CROSSPAD_GIT_DIR=/path/to/your/GIT -- npx -y crosspad-mcp-server
|
|
35
15
|
```
|
|
36
16
|
|
|
37
|
-
|
|
17
|
+
That's it. Restart Claude Code and the tools are available.
|
|
18
|
+
|
|
19
|
+
### Alternative: `.mcp.json` in your project
|
|
38
20
|
|
|
39
|
-
Add to your
|
|
21
|
+
Add to your repo root — Claude Code picks it up automatically:
|
|
40
22
|
|
|
41
23
|
```json
|
|
42
24
|
{
|
|
43
25
|
"mcpServers": {
|
|
44
26
|
"crosspad": {
|
|
45
|
-
"
|
|
46
|
-
"
|
|
47
|
-
"
|
|
27
|
+
"type": "stdio",
|
|
28
|
+
"command": "npx",
|
|
29
|
+
"args": ["-y", "crosspad-mcp-server"],
|
|
30
|
+
"env": {
|
|
31
|
+
"CROSSPAD_GIT_DIR": "/path/to/your/GIT"
|
|
32
|
+
}
|
|
48
33
|
}
|
|
49
34
|
}
|
|
50
35
|
}
|
|
51
36
|
```
|
|
52
37
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
### Configure for VS Code (Copilot / Cline / etc.)
|
|
38
|
+
### Alternative: Claude Desktop
|
|
56
39
|
|
|
57
|
-
|
|
40
|
+
Edit `~/Library/Application Support/Claude/claude_desktop_config.json` (macOS) or `%APPDATA%\Claude\claude_desktop_config.json` (Windows):
|
|
58
41
|
|
|
59
42
|
```json
|
|
60
43
|
{
|
|
61
|
-
"
|
|
44
|
+
"mcpServers": {
|
|
62
45
|
"crosspad": {
|
|
63
|
-
"command": "
|
|
64
|
-
"args": ["
|
|
46
|
+
"command": "npx",
|
|
47
|
+
"args": ["-y", "crosspad-mcp-server"],
|
|
48
|
+
"env": {
|
|
49
|
+
"CROSSPAD_GIT_DIR": "/path/to/your/GIT"
|
|
50
|
+
}
|
|
65
51
|
}
|
|
66
52
|
}
|
|
67
53
|
}
|
|
68
54
|
```
|
|
69
55
|
|
|
70
|
-
##
|
|
56
|
+
## Tools (6)
|
|
71
57
|
|
|
72
|
-
|
|
58
|
+
### `crosspad_build` — Build, run, or check the PC simulator or ESP-IDF firmware
|
|
73
59
|
|
|
74
|
-
|
|
|
75
|
-
|
|
76
|
-
| `
|
|
77
|
-
| `
|
|
78
|
-
| `
|
|
79
|
-
| `
|
|
80
|
-
| `
|
|
60
|
+
| Action | What it does |
|
|
61
|
+
|--------|-------------|
|
|
62
|
+
| `pc` | Build PC simulator (incremental/clean/reconfigure) |
|
|
63
|
+
| `pc_run` | Launch simulator, return PID |
|
|
64
|
+
| `pc_check` | Health check: stale exe, new sources, submodule drift |
|
|
65
|
+
| `pc_log` | Run exe, capture stdout for N seconds, kill |
|
|
66
|
+
| `idf` | Build ESP-IDF firmware (build/fullclean/clean) |
|
|
81
67
|
|
|
82
|
-
|
|
68
|
+
### `crosspad_test` — Catch2 tests for crosspad-pc
|
|
83
69
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
"command": "node",
|
|
89
|
-
"args": ["/Users/you/GIT/crosspad-mcp/dist/index.js"],
|
|
90
|
-
"env": {
|
|
91
|
-
"CROSSPAD_GIT_DIR": "/Users/you/GIT",
|
|
92
|
-
"VCPKG_ROOT": "/opt/vcpkg"
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
```
|
|
70
|
+
| Action | What it does |
|
|
71
|
+
|--------|-------------|
|
|
72
|
+
| `run` | Build + run tests, with optional name filter |
|
|
73
|
+
| `scaffold` | Generate test CMakeLists.txt + sample test file |
|
|
98
74
|
|
|
99
|
-
|
|
75
|
+
### `crosspad_sim` — Interact with the running simulator
|
|
100
76
|
|
|
101
|
-
|
|
77
|
+
| Action | What it does |
|
|
78
|
+
|--------|-------------|
|
|
79
|
+
| `screenshot` | Capture PNG (full window or LCD only) |
|
|
80
|
+
| `input` | Press pads, rotate encoder, click, send keys |
|
|
81
|
+
| `stats` | Pad state, capabilities, heap, registered apps |
|
|
82
|
+
| `settings_get` | Read settings by category |
|
|
83
|
+
| `settings_set` | Write individual setting key |
|
|
102
84
|
|
|
103
|
-
|
|
104
|
-
|---|---|
|
|
105
|
-
| `crosspad_build` | Build the simulator. Modes: `incremental` (default), `clean` (wipe + rebuild), `reconfigure` (cmake configure + build — use after adding new source files) |
|
|
106
|
-
| `crosspad_run` | Launch `bin/main.exe`. Returns PID immediately |
|
|
107
|
-
| `crosspad_build_check` | Health check: stale exe? new source files needing reconfigure? submodule drift? dirty working trees? |
|
|
108
|
-
| `crosspad_log` | Launch the exe, capture stdout/stderr for N seconds, then kill it. Great for checking init, crashes, runtime errors |
|
|
85
|
+
### `crosspad_repo` — Git status and submodule diffs
|
|
109
86
|
|
|
110
|
-
|
|
87
|
+
| Action | What it does |
|
|
88
|
+
|--------|-------------|
|
|
89
|
+
| `status` | Git status across all detected CrossPad repos |
|
|
90
|
+
| `diff` | Submodule drift: commits ahead/behind, changed files |
|
|
111
91
|
|
|
112
|
-
|
|
113
|
-
|---|---|
|
|
114
|
-
| `crosspad_test` | Build and run the Catch2 test suite. Supports name filtering (`[core]`, `PadManager`) and `list_only` mode |
|
|
115
|
-
| `crosspad_test_scaffold` | Generate test infrastructure (CMakeLists.txt + sample test). Returns file contents — does NOT write to disk |
|
|
92
|
+
### `crosspad_code` — Search and analyze code across repos
|
|
116
93
|
|
|
117
|
-
|
|
94
|
+
| Action | What it does |
|
|
95
|
+
|--------|-------------|
|
|
96
|
+
| `search` | Find classes, functions, macros, enums via git grep |
|
|
97
|
+
| `interfaces` | List crosspad-core interfaces and their implementations |
|
|
98
|
+
| `apps` | List REGISTER_APP registrations per platform |
|
|
99
|
+
| `scaffold` | Generate new app boilerplate (cpp, hpp, CMakeLists.txt) |
|
|
118
100
|
|
|
119
|
-
|
|
120
|
-
|---|---|
|
|
121
|
-
| `crosspad_repos_status` | Git status across all 5 CrossPad repos. Detects dev-mode (junction/symlink) vs submodule-mode |
|
|
122
|
-
| `crosspad_diff_core` | What changed in crosspad-core/gui vs the pinned submodule commit. Commits ahead/behind, changed files, uncommitted changes |
|
|
101
|
+
### `crosspad_apps` — App package manager
|
|
123
102
|
|
|
124
|
-
|
|
103
|
+
| Action | What it does |
|
|
104
|
+
|--------|-------------|
|
|
105
|
+
| `list` | Available apps from the crosspad-apps registry |
|
|
106
|
+
| `install` | Install app as git submodule |
|
|
107
|
+
| `remove` | Remove app submodule |
|
|
108
|
+
| `update` | Update one or all installed apps |
|
|
109
|
+
| `sync` | Sync manifest with existing submodules |
|
|
125
110
|
|
|
126
|
-
|
|
127
|
-
|---|---|
|
|
128
|
-
| `crosspad_search_symbols` | Find classes, functions, macros, enums across all repos. Filters by kind and repo. Uses `git grep` |
|
|
129
|
-
| `crosspad_scaffold_app` | Generate boilerplate for a new CrossPad app (cpp, hpp, CMakeLists.txt, optional pad logic handler) |
|
|
130
|
-
| `crosspad_interfaces` | Query crosspad-core interfaces: `list` all, `implementations <Name>`, or `capabilities` flags |
|
|
131
|
-
| `crosspad_apps` | List registered apps per platform (`pc`, `esp32`, `2player`, `all`) |
|
|
111
|
+
## Configuration
|
|
132
112
|
|
|
133
|
-
|
|
113
|
+
All paths auto-detected. Override via env vars if needed:
|
|
134
114
|
|
|
135
|
-
|
|
115
|
+
| Variable | Default | Description |
|
|
116
|
+
|----------|---------|-------------|
|
|
117
|
+
| `CROSSPAD_GIT_DIR` | `~/GIT` | Base directory containing CrossPad repos |
|
|
118
|
+
| `CROSSPAD_PC_ROOT` | `$GIT_DIR/crosspad-pc` | PC simulator repo |
|
|
119
|
+
| `CROSSPAD_IDF_ROOT` | `$GIT_DIR/platform-idf` | ESP-IDF platform repo |
|
|
120
|
+
| `IDF_PATH` | auto-detected (`~/esp/esp-idf`) | ESP-IDF SDK path |
|
|
121
|
+
| `VCPKG_ROOT` | `~/vcpkg` (Linux) / `C:/vcpkg` (Win) | vcpkg installation |
|
|
122
|
+
| `VCVARSALL` | VS2022 default | MSVC vcvarsall.bat (Windows only) |
|
|
136
123
|
|
|
137
|
-
|
|
138
|
-
|---|---|
|
|
139
|
-
| `crosspad_screenshot` | Capture PNG screenshot. `region`: `full` (490x680 window) or `lcd` (320x240 screen only). Save to file or return base64 |
|
|
140
|
-
| `crosspad_input` | Send events: `click` {x,y}, `pad_press` {pad,velocity}, `pad_release`, `encoder_rotate` {delta}, `encoder_press`/`release`, `key` {keycode} |
|
|
141
|
-
| `crosspad_stats` | Runtime diagnostics: pad state (16 pads), capabilities, registered apps, heap usage, settings snapshot |
|
|
142
|
-
| `crosspad_settings` | Read settings by category or write individual keys. Auto-saves to `~/.crosspad/preferences.json` |
|
|
124
|
+
Repos are discovered dynamically — only repos that exist on disk appear in status/search results.
|
|
143
125
|
|
|
144
|
-
##
|
|
126
|
+
## How it works
|
|
145
127
|
|
|
146
|
-
|
|
147
|
-
src/
|
|
148
|
-
index.ts — MCP server, tool registrations, streaming logger
|
|
149
|
-
config.ts — platform-aware paths (env vars, OS detection)
|
|
150
|
-
utils/
|
|
151
|
-
exec.ts — runBuild/runBuildStream (MSVC on Windows, default shell on Unix)
|
|
152
|
-
git.ts — getRepoStatus(), getSubmodulePin(), getHead()
|
|
153
|
-
remote-client.ts — TCP client for simulator remote control (localhost:19840)
|
|
154
|
-
tools/
|
|
155
|
-
build.ts — crosspad_build, crosspad_run
|
|
156
|
-
build-check.ts — crosspad_build_check
|
|
157
|
-
log.ts — crosspad_log
|
|
158
|
-
test.ts — crosspad_test, crosspad_test_scaffold
|
|
159
|
-
repos.ts — crosspad_repos_status
|
|
160
|
-
diff-core.ts — crosspad_diff_core
|
|
161
|
-
symbols.ts — crosspad_search_symbols
|
|
162
|
-
scaffold.ts — crosspad_scaffold_app
|
|
163
|
-
architecture.ts — crosspad_interfaces, crosspad_apps
|
|
164
|
-
screenshot.ts — crosspad_screenshot
|
|
165
|
-
input.ts — crosspad_input
|
|
166
|
-
stats.ts — crosspad_stats
|
|
167
|
-
settings.ts — crosspad_settings
|
|
168
|
-
```
|
|
128
|
+
**Static tools** (build, repos, code, apps) work without the simulator — they operate on the filesystem, git, and Python package manager.
|
|
169
129
|
|
|
170
|
-
**
|
|
130
|
+
**Interactive tools** (sim) communicate with the running PC simulator via TCP on `localhost:19840` using newline-delimited JSON.
|
|
171
131
|
|
|
172
|
-
**
|
|
132
|
+
**Streaming** — long-running tools (build, test, log) emit output line-by-line via MCP logging, so Claude sees progress in real-time.
|
|
173
133
|
|
|
174
|
-
**
|
|
134
|
+
**App manager** — delegates to the Python-based `crosspad_app_manager.py` from [crosspad-apps](https://github.com/CrossPad/crosspad-apps). Reads registry JSON directly for listing, uses Python subprocess for install/remove/update.
|
|
175
135
|
|
|
176
136
|
## Development
|
|
177
137
|
|
|
178
138
|
```bash
|
|
179
|
-
|
|
139
|
+
git clone https://github.com/CrossPad/crosspad-mcp.git
|
|
140
|
+
cd crosspad-mcp
|
|
141
|
+
npm install
|
|
142
|
+
npm run dev # watch mode
|
|
180
143
|
npm run build # one-shot build
|
|
181
144
|
```
|
|
182
145
|
|
|
183
|
-
|
|
146
|
+
```
|
|
147
|
+
src/
|
|
148
|
+
index.ts — 6 tool registrations with action dispatch
|
|
149
|
+
config.ts — env-agnostic paths, dynamic repo discovery
|
|
150
|
+
utils/
|
|
151
|
+
exec.ts — platform-aware command execution (MSVC/IDF/shell)
|
|
152
|
+
git.ts — repo status, submodule pins
|
|
153
|
+
remote-client.ts — TCP client for simulator (localhost:19840)
|
|
154
|
+
tools/
|
|
155
|
+
app-manager.ts — crosspad_apps (Python subprocess)
|
|
156
|
+
architecture.ts — interfaces, REGISTER_APP scan
|
|
157
|
+
build.ts — PC build + run
|
|
158
|
+
build-check.ts — build health check
|
|
159
|
+
diff-core.ts — submodule drift analysis
|
|
160
|
+
idf-build.ts — ESP-IDF build
|
|
161
|
+
input.ts — simulator input events
|
|
162
|
+
log.ts — exe log capture
|
|
163
|
+
repos.ts — multi-repo git status
|
|
164
|
+
scaffold.ts — app boilerplate generation
|
|
165
|
+
screenshot.ts — simulator screenshots
|
|
166
|
+
settings.ts — simulator settings R/W
|
|
167
|
+
stats.ts — simulator runtime stats
|
|
168
|
+
symbols.ts — cross-repo symbol search
|
|
169
|
+
test.ts — Catch2 test runner
|
|
170
|
+
```
|
|
184
171
|
|
|
185
172
|
## License
|
|
186
173
|
|
|
187
|
-
Part of the [CrossPad](https://github.com/CrossPad) project.
|
|
174
|
+
MIT — Part of the [CrossPad](https://github.com/CrossPad) project.
|
package/dist/config.d.ts
CHANGED
|
@@ -1,10 +1,20 @@
|
|
|
1
1
|
export declare const IS_WINDOWS: boolean;
|
|
2
2
|
export declare const IS_MAC: boolean;
|
|
3
3
|
export declare const CROSSPAD_PC_ROOT: string;
|
|
4
|
-
export declare const
|
|
4
|
+
export declare const CROSSPAD_IDF_ROOT: string;
|
|
5
|
+
export declare const IDF_PATH: string;
|
|
5
6
|
export declare const VCVARSALL: string;
|
|
6
7
|
export declare const VCPKG_TOOLCHAIN: string;
|
|
7
8
|
export declare const BUILD_DIR: string;
|
|
8
9
|
export declare const BIN_EXE: string;
|
|
9
|
-
|
|
10
|
-
export declare
|
|
10
|
+
/** Returns only repos that actually exist on disk. Cached for server lifetime. */
|
|
11
|
+
export declare function getRepos(): Record<string, string>;
|
|
12
|
+
export declare const REPOS: Record<string, string>;
|
|
13
|
+
/**
|
|
14
|
+
* Resolve the crosspad-core include path. Checks:
|
|
15
|
+
* 1. Standalone repo at $GIT_DIR/crosspad-core
|
|
16
|
+
* 2. Submodule inside platform-idf: $IDF_ROOT/components/crosspad-core
|
|
17
|
+
* 3. Submodule inside crosspad-pc: $PC_ROOT/crosspad-core
|
|
18
|
+
* Returns null if not found anywhere.
|
|
19
|
+
*/
|
|
20
|
+
export declare function resolveCrosspadCore(): string | null;
|
package/dist/config.js
CHANGED
|
@@ -1,33 +1,102 @@
|
|
|
1
|
+
import fs from "fs";
|
|
1
2
|
import path from "path";
|
|
2
3
|
import os from "os";
|
|
3
4
|
export const IS_WINDOWS = process.platform === "win32";
|
|
4
5
|
export const IS_MAC = process.platform === "darwin";
|
|
5
|
-
//
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
const GIT_DIR = process.env.CROSSPAD_GIT_DIR || defaultGitDir;
|
|
6
|
+
// ═══════════════════════════════════════════════════════════════════════
|
|
7
|
+
// BASE PATHS — all overridable via env vars
|
|
8
|
+
// ═══════════════════════════════════════════════════════════════════════
|
|
9
|
+
const GIT_DIR = process.env.CROSSPAD_GIT_DIR || path.join(os.homedir(), "GIT");
|
|
10
10
|
export const CROSSPAD_PC_ROOT = process.env.CROSSPAD_PC_ROOT || path.join(GIT_DIR, "crosspad-pc");
|
|
11
|
-
export const
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
11
|
+
export const CROSSPAD_IDF_ROOT = process.env.CROSSPAD_IDF_ROOT || path.join(GIT_DIR, "platform-idf");
|
|
12
|
+
// ═══════════════════════════════════════════════════════════════════════
|
|
13
|
+
// ESP-IDF SDK PATH — fallback chain
|
|
14
|
+
// ═══════════════════════════════════════════════════════════════════════
|
|
15
|
+
function findIdfPath() {
|
|
16
|
+
if (process.env.IDF_PATH)
|
|
17
|
+
return process.env.IDF_PATH;
|
|
18
|
+
// Try common paths
|
|
19
|
+
const candidates = [
|
|
20
|
+
path.join(os.homedir(), "esp", "esp-idf"),
|
|
21
|
+
path.join(os.homedir(), "esp", "v5.5.4", "esp-idf"),
|
|
22
|
+
path.join(os.homedir(), "esp", "v5.5", "esp-idf"),
|
|
23
|
+
];
|
|
24
|
+
for (const p of candidates) {
|
|
25
|
+
if (fs.existsSync(p))
|
|
26
|
+
return p;
|
|
27
|
+
}
|
|
28
|
+
// Last resort — return the most common default even if missing
|
|
29
|
+
return path.join(os.homedir(), "esp", "esp-idf");
|
|
30
|
+
}
|
|
31
|
+
export const IDF_PATH = findIdfPath();
|
|
32
|
+
// ═══════════════════════════════════════════════════════════════════════
|
|
33
|
+
// MSVC / VCPKG — Windows-only build tools
|
|
34
|
+
// ═══════════════════════════════════════════════════════════════════════
|
|
20
35
|
export const VCVARSALL = process.env.VCVARSALL ||
|
|
21
36
|
"C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\VC\\Auxiliary\\Build\\vcvarsall.bat";
|
|
22
|
-
// vcpkg — platform-aware defaults
|
|
23
37
|
const defaultVcpkgRoot = IS_WINDOWS ? "C:/vcpkg" : path.join(os.homedir(), "vcpkg");
|
|
24
38
|
const vcpkgRoot = process.env.VCPKG_ROOT || defaultVcpkgRoot;
|
|
25
39
|
export const VCPKG_TOOLCHAIN = path.join(vcpkgRoot, "scripts", "buildsystems", "vcpkg.cmake");
|
|
40
|
+
// ═══════════════════════════════════════════════════════════════════════
|
|
41
|
+
// PC SIMULATOR PATHS
|
|
42
|
+
// ═══════════════════════════════════════════════════════════════════════
|
|
26
43
|
export const BUILD_DIR = path.join(CROSSPAD_PC_ROOT, "build");
|
|
27
44
|
const EXE_EXT = IS_WINDOWS ? ".exe" : "";
|
|
28
|
-
export const BIN_EXE = path.join(CROSSPAD_PC_ROOT, "bin", `
|
|
29
|
-
//
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
45
|
+
export const BIN_EXE = path.join(CROSSPAD_PC_ROOT, "bin", `main${EXE_EXT}`);
|
|
46
|
+
// ═══════════════════════════════════════════════════════════════════════
|
|
47
|
+
// REPOS — dynamic discovery, cached
|
|
48
|
+
// ═══════════════════════════════════════════════════════════════════════
|
|
49
|
+
/** Known repo candidates: name → expected path */
|
|
50
|
+
const REPO_CANDIDATES = {
|
|
51
|
+
"crosspad-core": path.join(GIT_DIR, "crosspad-core"),
|
|
52
|
+
"crosspad-gui": path.join(GIT_DIR, "crosspad-gui"),
|
|
53
|
+
"crosspad-pc": CROSSPAD_PC_ROOT,
|
|
54
|
+
"platform-idf": CROSSPAD_IDF_ROOT,
|
|
55
|
+
"ESP32-S3": path.join(GIT_DIR, "ESP32-S3"),
|
|
56
|
+
"2playerCrosspad": path.join(GIT_DIR, "2playerCrosspad"),
|
|
57
|
+
};
|
|
58
|
+
let cachedRepos = null;
|
|
59
|
+
/** Returns only repos that actually exist on disk. Cached for server lifetime. */
|
|
60
|
+
export function getRepos() {
|
|
61
|
+
if (cachedRepos)
|
|
62
|
+
return cachedRepos;
|
|
63
|
+
const found = {};
|
|
64
|
+
for (const [name, repoPath] of Object.entries(REPO_CANDIDATES)) {
|
|
65
|
+
if (fs.existsSync(repoPath)) {
|
|
66
|
+
found[name] = repoPath;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
cachedRepos = found;
|
|
70
|
+
return found;
|
|
71
|
+
}
|
|
72
|
+
// Legacy compat — some tool files still import REPOS directly
|
|
73
|
+
export const REPOS = REPO_CANDIDATES;
|
|
74
|
+
// ═══════════════════════════════════════════════════════════════════════
|
|
75
|
+
// CROSSPAD-CORE RESOLUTION — finds crosspad-core wherever it lives
|
|
76
|
+
// ═══════════════════════════════════════════════════════════════════════
|
|
77
|
+
let cachedCrosspadCorePath = undefined;
|
|
78
|
+
/**
|
|
79
|
+
* Resolve the crosspad-core include path. Checks:
|
|
80
|
+
* 1. Standalone repo at $GIT_DIR/crosspad-core
|
|
81
|
+
* 2. Submodule inside platform-idf: $IDF_ROOT/components/crosspad-core
|
|
82
|
+
* 3. Submodule inside crosspad-pc: $PC_ROOT/crosspad-core
|
|
83
|
+
* Returns null if not found anywhere.
|
|
84
|
+
*/
|
|
85
|
+
export function resolveCrosspadCore() {
|
|
86
|
+
if (cachedCrosspadCorePath !== undefined)
|
|
87
|
+
return cachedCrosspadCorePath;
|
|
88
|
+
const candidates = [
|
|
89
|
+
path.join(GIT_DIR, "crosspad-core"),
|
|
90
|
+
path.join(CROSSPAD_IDF_ROOT, "components", "crosspad-core"),
|
|
91
|
+
path.join(CROSSPAD_PC_ROOT, "crosspad-core"),
|
|
92
|
+
];
|
|
93
|
+
for (const p of candidates) {
|
|
94
|
+
if (fs.existsSync(path.join(p, "include", "crosspad"))) {
|
|
95
|
+
cachedCrosspadCorePath = p;
|
|
96
|
+
return p;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
cachedCrosspadCorePath = null;
|
|
100
|
+
return null;
|
|
101
|
+
}
|
|
33
102
|
//# sourceMappingURL=config.js.map
|
package/dist/config.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,MAAM,IAAI,CAAC;AAEpB,MAAM,CAAC,MAAM,UAAU,GAAG,OAAO,CAAC,QAAQ,KAAK,OAAO,CAAC;AACvD,MAAM,CAAC,MAAM,MAAM,GAAG,OAAO,CAAC,QAAQ,KAAK,QAAQ,CAAC;AAEpD,
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,MAAM,IAAI,CAAC;AAEpB,MAAM,CAAC,MAAM,UAAU,GAAG,OAAO,CAAC,QAAQ,KAAK,OAAO,CAAC;AACvD,MAAM,CAAC,MAAM,MAAM,GAAG,OAAO,CAAC,QAAQ,KAAK,QAAQ,CAAC;AAEpD,0EAA0E;AAC1E,4CAA4C;AAC5C,0EAA0E;AAE1E,MAAM,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC,gBAAgB,IAAI,IAAI,CAA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