You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CHANGELOG.md
+12Lines changed: 12 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -9,6 +9,18 @@ This project follows [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
9
9
10
10
## [Unreleased]
11
11
12
+
## [3.7.7]
13
+
14
+
### Added
15
+
16
+
-**`switchbot claude-code setup` command** — 6-step pipeline that bootstraps Claude Code integration end-to-end: verify `claude` CLI on PATH, optionally install `@switchbot/openapi-cli`, register the MCP server via `claude mcp add --scope user`, authenticate, and run a health check. Supports `--yes` (non-interactive), `--skip`, `--dry-run`, `--json`. Paste `npx @switchbot/openapi-cli claude-code setup` into Claude Code chat to set up without opening a terminal.
17
+
-**Claude Code Plugin Marketplace support** — `.claude-plugin/marketplace.json` now correctly points to `packages/claude-code-plugin/plugins/switchbot` so `/plugin marketplace add OpenWonderLabs/switchbot-openapi-cli` followed by `/plugin install switchbot@switchbot` works end-to-end. `smoke-codex-git-sparse.mjs` extended to validate both the Claude Code and Codex marketplace entry points.
18
+
19
+
### Fixed
20
+
21
+
-**`switchbot auth login` clears device/status cache** — switching accounts no longer returns stale data from the previous account's cache. `clearCache()` and `clearStatusCache()` are called immediately after new credentials are saved.
22
+
-**`codex setup --help` / `claude-code setup --help`** — both commands now list `--dry-run` and `--json` under a "Global flags that also apply to this command" section so users do not have to discover them from the README.
Copy file name to clipboardExpand all lines: CONTRIBUTING.md
+11Lines changed: 11 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -28,3 +28,14 @@ Example body:
28
28
The CHANGELOG itself follows Keep a Changelog + SemVer, with a
29
29
**Changed (BREAKING)** section whenever a release introduces a breaking
30
30
change (even in a patch version).
31
+
32
+
## Plugin hook strategies
33
+
34
+
The two plugin packages use different `onInstall` hook strategies — this is intentional:
35
+
36
+
| Package | Hook command | Reason |
37
+
|---------|-------------|--------|
38
+
|`packages/claude-code-plugin`|`node ../bin/auth.js` (relative path) | Claude Code installs the full npm package; `bin/` is always adjacent. |
39
+
|`packages/codex-plugin`|`switchbot-codex-auth` (global binary) | Codex may install only the `plugins/switchbot/` sub-directory, placing it in `~/.codex/plugins/switchbot/`. A relative path to `bin/auth.js` would escape the plugin directory and fail. Using the globally-installed binary works regardless of install layout. |
40
+
41
+
When changing either hook, preserve this distinction. Do not "unify" them without first verifying that both installation layouts still resolve the hook correctly.
openclaw plugins install @switchbot/openclaw-skill # via OpenClaw plugin manager (recommended)
111
119
# or
112
-
npm install -g @switchbot/openclaw-skill # via npm
120
+
npm install -g @switchbot/openclaw-skill # via npm
113
121
114
122
switchbot-openclaw setup # verify CLI install and credentials
115
123
switchbot auth login # browser OAuth — saves to OS keychain
@@ -121,27 +129,40 @@ switchbot auth login # browser OAuth — saves to OS keychain
121
129
122
130
## Claude Code integration
123
131
124
-
**Step 0 — verify first.** If the MCP server is already configured (e.g. via a managed environment or prior setup), no additional steps are needed:
132
+
**Already configured? Paste into Claude Code chat:**
125
133
126
-
```bash
127
-
switchbot doctor --json
134
+
```
135
+
Is my SwitchBot integration working? Please check and list my devices.
136
+
```
137
+
138
+
Claude will call `account_overview` or `switchbot doctor` to verify — no terminal needed.
139
+
140
+
**Fresh setup — paste into Claude Code chat:**
141
+
142
+
```
143
+
Please set up my SwitchBot integration by running:
144
+
npx @switchbot/openapi-cli claude-code setup
128
145
```
129
146
130
-
If 24 tools are visible and the integration is healthy, you're done.
147
+
Claude will run the setup command via the Bash tool. It installs the CLI if missing, registers the MCP server via `claude mcp add --scope user`, and opens a browser login if credentials are not yet configured. Restart Claude Code afterwards to load the MCP tools.
131
148
132
-
**Fresh setup:**
149
+
**Or run manually in your terminal:**
133
150
134
151
```bash
135
152
npm install -g @switchbot/openapi-cli
136
-
claude mcp add switchbot -- switchbot mcp serve --tools all
137
-
switchbot auth login # browser OAuth — saves to OS keychain
153
+
switchbot claude-code setup
138
154
```
139
155
140
-
Run `switchbot doctor --json` afterwards to confirm everything is working.
156
+
The optional skill package [`@switchbot/claude-code-plugin`](https://www.npmjs.com/package/@switchbot/claude-code-plugin) bundles the SKILL.md context document. Install it only if your environment does not already load the skill automatically.
141
157
142
-
The optional skill package [`@switchbot/claude-code-plugin`](https://www.npmjs.com/package/@switchbot/claude-code-plugin) bundles the SKILL.md context document and install hook. Install it only if your environment does not already load the skill automatically.
158
+
**Or install via Claude Code Plugin Marketplace** (requires Claude Code with plugin marketplace support enabled):
**Note:** The root `marketplace.json`file in this repo is for Codex CLI Route B (git sparse clone) and points to the Codex plugin at `packages/codex-plugin/plugins/switchbot`. Claude Code users register via `claude mcp add` and do not use this file.
165
+
**Note:** The root `marketplace.json` in this repo is for Codex CLI Route B (git sparse clone) and points to `packages/codex-plugin/plugins/switchbot`. The `.claude-plugin/marketplace.json` is for Claude Code Plugin Marketplace and points to `packages/claude-code-plugin/plugins/switchbot`.
Copy file name to clipboardExpand all lines: package.json
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
{
2
2
"name": "@switchbot/openapi-cli",
3
-
"version": "3.7.6",
3
+
"version": "3.7.7",
4
4
"description": "SwitchBot smart home CLI — control devices, run scenes, stream real-time events, and integrate AI agents via MCP. Full API v1.1 coverage.",
0 commit comments