Skip to content

v0.3.1

Choose a tag to compare

@oscarhugopaz oscarhugopaz released this 05 Jun 00:24
· 27 commits to main since this release

Patch release. Fixes a critical bug in mainwp init (and
mainwp config set ...) where the active profile never received
its url, api_key, and api_path.

Root cause was two compounding bugs in lib/config.sh:

  1. mainwp_config_set_field built a jq expression that read
    .url from the document root instead of writing to
    .profiles[$p].url. The new value was passed via --arg v
    but never referenced in the expression, so every set call
    wrote the literal string null to the config file.
  2. mainwp_config_set_active declared local cfg="$1" and
    required a positional argument, but the init command called
    it with no arguments. Combined with the broken set_field,
    the visible result was set -u: $1: unbound variable from
    inside the function followed by a config file containing
    only {"active": "default"}.

After the fix, mainwp init stores the profile correctly and
mainwp config get round-trips the values.

Also: tests/smoke.sh now sandboxes $HOME to a temp dir for
the duration of the run. A previous run of the test suite had
polluted the real ~/.config/mainwp/config.json with the
broken null payload (same root cause); that file is wiped.
The sandbox makes the suite safe to run on a developer machine
that has a real MainWP Dashboard.

45 smoke tests, all passing. Upgrade with
`brew update && brew upgrade mainwp`.