Repository navigation
v0.3.3
Patch release. Fixes three latent bugs that only surface against
a real MainWP Dashboard that returns typical-sized JSON. All three
were uncovered by pointing the CLI at a production dashboard for
the first time.
-
Connectivity check was always failing (lib/commands/init.sh)
mainwp_api_get /sites/basic per_page=1passedper_page=1as
the request body, not as a query parameter, so curl ended up
doingGET /sites/basicwith body='per_page=1'. MainWP rejected
it with HTTP 400 and the init wizard reported
"Connectivity check failed" even with a perfectly valid URL and
key. Fix: pass an empty body andper_page=1as an extra arg.
mainwp_api_get /sites/basic "" "per_page=1" -
sites countalways showed 0 (lib/commands/sites.sh)
The MainWP /sites/count endpoint returns{"count":N}rather
than the{total}/{data:{total}}shapes the CLI was
looking for. The jq path fell through to the0fallback. Add
.count(and.data.count) to the lookup chain. -
SIGPIPE killed the script on any list endpoint (lib/output.sh)
mainwp_render_tableused a pipe to read the first byte of the
payload:
first="$(printf '%s' "$input" | head -c 1)"
With multi-KB JSON, head exits after one byte and printf gets
SIGPIPE on the next write. Withset -o pipefailthat aborted
the whole script with exit 141 and no output. Switch to
parameter expansion:${input:0:1}. No pipe, no signal, no race.
After the fixes the full flow works against a real dashboard:
```
$ mainwp init
✓ Profile 'default' saved.
✓ Connected to https://main.carnaval.studio
==> Dashboard reports 3 site(s) (showing first page only).
$ mainwp sites count
==> Connected sites: 3
$ mainwp --plain sites list
ID,Name,URL,Status
45 cusconatureadventure.com https://cusconatureadventure.com/ connected
44 dynamicdutch.com/ https://dynamicdutch.com/ connected
41 jazmingonzalez.pe https://jazmingonzalez.pe/ connected
```
61 smoke tests, all passing. Upgrade with
`brew update && brew upgrade mainwp`.