Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
3c6d28b
feat(install): add Codex CLI and plugin preflight checks for --agent …
May 23, 2026
d610d60
feat(install): add codex-checks module with CLI/npm/registration checks
May 23, 2026
521d0f6
feat(install): add resolvePluginId shared utility to codex-checks
May 23, 2026
3ca2006
feat(doctor): export Check, CHECK_REGISTRY, and runDoctorChecks helper
May 23, 2026
cae25cb
feat(install): extend AgentName with codex, add stepRegisterCodexPlugin
May 23, 2026
06d7a66
feat(codex): add switchbot codex doctor subcommand
May 23, 2026
9545ad9
feat(install): add codex agent path routing to stepRegisterCodexPlugin
May 23, 2026
0e4c28c
feat(codex): add switchbot codex repair subcommand
May 23, 2026
7582361
feat(codex): register codex command in program-builder and add COMMAN…
May 23, 2026
8013bda
refactor(codex): extract credentialsPresent helper, share resolveCode…
May 23, 2026
c066238
feat(codex): hint repair command when doctor reports warn or fail
May 23, 2026
0582d75
docs(spec): codex install paths design — setup subcommand + AGENTS.md…
May 23, 2026
4e3050c
docs(spec): fix 4 consistency issues in codex-commands design
May 23, 2026
a4bab08
docs(spec): fix 5 remaining consistency issues + add 3 test cases in …
May 23, 2026
c7a5723
docs(codex): align spec drift on doctor-verify, auth argv, register h…
May 23, 2026
4d73f53
fix(codex): tighten install warnings and extract registerCodexPlugin …
May 23, 2026
c760cec
feat(codex): add codex setup subcommand and route repair through shar…
May 23, 2026
9d67815
docs(readme): add Codex integration quick start section
May 23, 2026
5bd10f5
docs(spec): monorepo migration design — absorb codex-plugin and openc…
May 23, 2026
e2684b8
docs(spec): fix 3 design issues in monorepo migration — workspace:*, …
May 23, 2026
c5fbacd
feat(monorepo): consolidate codex-plugin via npm workspaces
May 23, 2026
e79a991
feat(monorepo): import openclaw-skill as workspace package
May 23, 2026
685b755
ci(publish): per-package matrix and detect-versions gate for monorepo
May 23, 2026
a577cab
ci(publish): defer @switchbot/openclaw-skill npm publish
May 23, 2026
71851c0
feat(codex): 6-step setup adds install-codex-plugin; onInstall is bes…
May 23, 2026
86a449e
fix(codex): junction workaround for @-path; ship corrected marketplac…
May 23, 2026
1cf02cb
test(codex): add pack-install smoke for codex plugin tarball
May 23, 2026
2a75c94
fix(codex): stable Windows junction alias; add stage field to Registr…
May 23, 2026
75f5b4a
fix(codex): relocate Windows alias to LOCALAPPDATA and repair stale j…
May 23, 2026
1e3945a
fix(codex-plugin): mirror alias-relocation logic in install.js
May 23, 2026
99fa2a5
docs(changelog): describe final alias path and repair behavior
May 23, 2026
8ada5e5
test(openclaw-skill): use 127.0.0.1 in policy-editor fetch URLs
May 23, 2026
73ec2f0
fix: publish openclaw-skill and fix Windows .cmd shim invocations
May 23, 2026
e9b8bf6
fix(auth): release callback port immediately when open() throws
May 23, 2026
12c1dea
fix(codex): pre-remove plugin before add to avoid Windows backup ACCE…
May 23, 2026
b187e03
test(codex-checks): add plugin-remove mock slot in registration tests
May 23, 2026
2b3585a
docs(readme): simplify Codex install section for non-technical users
May 23, 2026
f3f5162
docs(readme): split Codex section into paste-to-chat and developer bl…
May 23, 2026
69144c8
chore: merge origin/main, keep simplified Codex docs and drop opencla…
May 23, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 0 additions & 20 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,11 @@ jobs:
run: |
CLI_VERSION=$(node -p "require('./package.json').version")
CODEX_VERSION=$(node -p "require('./packages/codex-plugin/package.json').version")
OPENCLAW_VERSION=$(node -p "require('./packages/openclaw-skill/package.json').version")
echo "Root CLI: @switchbot/openapi-cli@$CLI_VERSION"
echo "Codex plugin: @switchbot/codex-plugin@$CODEX_VERSION"
echo "OpenClaw skill: @switchbot/openclaw-skill@$OPENCLAW_VERSION"
{
echo "cli_version=$CLI_VERSION"
echo "codex_version=$CODEX_VERSION"
echo "openclaw_version=$OPENCLAW_VERSION"
} >> "$GITHUB_OUTPUT"
id: versions

Expand All @@ -52,7 +49,6 @@ jobs:
env:
CLI_VERSION: ${{ steps.versions.outputs.cli_version }}
CODEX_VERSION: ${{ steps.versions.outputs.codex_version }}
OPENCLAW_VERSION: ${{ steps.versions.outputs.openclaw_version }}
run: |
# For each package, query npm; if the exact version is already published, skip.
check_unpublished() {
Expand All @@ -68,14 +64,11 @@ jobs:
}
CLI_PUBLISH=$(check_unpublished "@switchbot/openapi-cli" "$CLI_VERSION")
CODEX_PUBLISH=$(check_unpublished "@switchbot/codex-plugin" "$CODEX_VERSION")
OPENCLAW_PUBLISH=$(check_unpublished "@switchbot/openclaw-skill" "$OPENCLAW_VERSION")
echo "cli_publish=$CLI_PUBLISH"
echo "codex_publish=$CODEX_PUBLISH"
echo "openclaw_publish=$OPENCLAW_PUBLISH"
{
echo "cli_publish=$CLI_PUBLISH"
echo "codex_publish=$CODEX_PUBLISH"
echo "openclaw_publish=$OPENCLAW_PUBLISH"
} >> "$GITHUB_OUTPUT"

- name: Smoke test packed root CLI artifact
Expand Down Expand Up @@ -119,16 +112,3 @@ jobs:
if: steps.detect.outputs.codex_publish == 'true' && steps.publish_codex.outcome == 'failure'
run: |
echo "::warning::codex-plugin publish step failed; root CLI promotion is unaffected. Investigate before next release."

- name: Publish openclaw-skill to npm dist-tag next
id: publish_openclaw
if: steps.detect.outputs.openclaw_publish == 'true'
continue-on-error: true
run: npm publish -w @switchbot/openclaw-skill --tag next --provenance --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

- name: Annotate openclaw-skill publish failures
if: steps.detect.outputs.openclaw_publish == 'true' && steps.publish_openclaw.outcome == 'failure'
run: |
echo "::warning::openclaw-skill publish step failed; root CLI promotion is unaffected. Investigate before next release."
64 changes: 19 additions & 45 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -171,72 +171,46 @@ for the agent surface.

## Codex integration

For [OpenAI Codex CLI](https://github.com/openai/codex) users, the SwitchBot integration ships as a separate plugin package — `@switchbot/codex-plugin` — registered via `codex plugin add`. The `switchbot codex` command group orchestrates setup, health checks, and repair end-to-end.
Use SwitchBot with [OpenAI Codex CLI](https://github.com/openai/codex) to control your smart home devices through natural-language AI conversations.

### Prerequisites
### Quick start — just paste this into Codex

- **Codex CLI** installed and on `$PATH` (see the link above)
- **Node.js ≥ 18** (same as the base CLI)
Not sure how to run commands? Copy the block below and paste it directly into your Codex chat:

### One-command bootstrap (recommended)

On a brand-new machine — no SwitchBot CLI installed yet — use `npx`:

```bash
```
Please set up the SwitchBot integration for me by running:
npx @switchbot/openapi-cli codex setup
Then restart Codex and confirm it's working.
```

This works because `setup` runs six steps in order, the package-install steps fix the chicken-and-egg:
Codex will run the setup, walk you through signing in, and let you know when it's ready.

1. `check-codex-cli` — verify `codex` is on `$PATH`
2. `install-switchbot-cli` — if `@switchbot/openapi-cli` is not in `npm list -g`, install it globally (so the `switchbot` binary stays after the `npx` invocation exits)
3. `install-codex-plugin` — if `@switchbot/codex-plugin` is not in `npm list -g`, install it globally
4. `register-plugin` — `codex plugin marketplace add` + `codex plugin add` for `@switchbot/codex-plugin`
5. `auth` — prompt for SwitchBot credentials if missing (spawns `switchbot auth login`, inheriting your active `--profile` and `--config`)
6. `doctor-verify` — run 7 checks (4 base: node, path, credentials, mcp + 3 codex: cli, npm package, plugin registered)

Restart Codex when complete, then verify:

```bash
switchbot devices list
```
### For developers

### Manual install
**Requirements:** [Codex CLI](https://github.com/openai/codex) on `$PATH`, Node.js ≥ 18.

If you prefer step-by-step control:
**One-command bootstrap** (installs CLI + plugin + auth + health check in one shot):

```bash
npm install -g @switchbot/openapi-cli @switchbot/codex-plugin
switchbot install --agent codex # registers the already-installed plugin
switchbot auth login # if you don't already have credentials
npx @switchbot/openapi-cli codex setup
```

`switchbot install --agent codex` is **register-only** — it fails fast if `@switchbot/codex-plugin` is not present in `npm list -g`. Use `codex setup` instead if you want the package install bundled in.

### Health checks and repair
**Manual install** (if you prefer explicit control):

```bash
switchbot codex doctor # 7-check health summary; exits 1 on any fail
switchbot codex repair # re-verify, re-auth, re-register, re-check
npm install -g @switchbot/openapi-cli @switchbot/codex-plugin
switchbot install --agent codex # register-only; package must already be installed
switchbot auth login
```

`codex repair` runs five steps: `verify-cli` → `re-auth` → `remove-plugin` (best-effort) → `register-plugin` → `doctor-verify`. Both `setup` and `repair` support:

- `--dry-run` — print the step list without mutating anything
- `--json` — machine-readable outcome
- `--yes` — non-interactive; auth prompts become `failed` instead of spawning `auth login`
- `--skip <names>` — comma-separated. Only `install-switchbot-cli` / `install-codex-plugin` / `auth` (setup) and `re-auth` / `remove-plugin` (repair) are skippable; passing any other step name exits 2.

### Profile and config scope

All `codex` subcommands honor the global `--profile` and `--config` flags. Auth credentials are written to (and read from) the active profile, and the spawned `auth login` inherits both:
**Health check and repair:**

```bash
switchbot --profile staging codex setup
switchbot --config /path/to/cfg.json codex doctor
switchbot codex doctor # 7-check summary; exits 1 on any failure
switchbot codex repair # re-auth + re-register + re-check
```

> Run `switchbot codex setup --help` (or `repair --help`, `doctor --help`) for the full flag list.
Both `setup` and `repair` accept `--dry-run`, `--json`, `--yes`, and `--profile` / `--config` (global flags). Run `switchbot codex setup --help` for the full flag list.

## Credentials

Expand Down
Loading