@mainwp/control 1.0.1 → 1.1.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/CHANGELOG.md +156 -0
- package/README.md +136 -516
- package/dist/chat/chat-engine.d.ts +24 -54
- package/dist/chat/chat-engine.d.ts.map +1 -1
- package/dist/chat/chat-engine.js +345 -166
- package/dist/chat/chat-engine.js.map +1 -1
- package/dist/chat/context-window.d.ts +57 -0
- package/dist/chat/context-window.d.ts.map +1 -0
- package/dist/chat/context-window.js +94 -0
- package/dist/chat/context-window.js.map +1 -0
- package/dist/chat/providers/anthropic.d.ts +0 -4
- package/dist/chat/providers/anthropic.d.ts.map +1 -1
- package/dist/chat/providers/anthropic.js +67 -45
- package/dist/chat/providers/anthropic.js.map +1 -1
- package/dist/chat/providers/gemini.d.ts +2 -2
- package/dist/chat/providers/gemini.d.ts.map +1 -1
- package/dist/chat/providers/gemini.js +67 -43
- package/dist/chat/providers/gemini.js.map +1 -1
- package/dist/chat/providers/openai-compatible.d.ts +1 -1
- package/dist/chat/providers/openai-compatible.d.ts.map +1 -1
- package/dist/chat/providers/openai-compatible.js +91 -29
- package/dist/chat/providers/openai-compatible.js.map +1 -1
- package/dist/chat/providers/provider-fetch.d.ts +11 -0
- package/dist/chat/providers/provider-fetch.d.ts.map +1 -1
- package/dist/chat/providers/provider-fetch.js +86 -4
- package/dist/chat/providers/provider-fetch.js.map +1 -1
- package/dist/chat/providers/provider.d.ts +74 -1
- package/dist/chat/providers/provider.d.ts.map +1 -1
- package/dist/chat/providers/provider.js +112 -2
- package/dist/chat/providers/provider.js.map +1 -1
- package/dist/chat/providers/sse-reader.d.ts +3 -0
- package/dist/chat/providers/sse-reader.d.ts.map +1 -1
- package/dist/chat/providers/sse-reader.js +75 -15
- package/dist/chat/providers/sse-reader.js.map +1 -1
- package/dist/chat/system-prompt.d.ts +0 -2
- package/dist/chat/system-prompt.d.ts.map +1 -1
- package/dist/chat/system-prompt.js +10 -6
- package/dist/chat/system-prompt.js.map +1 -1
- package/dist/chat/tool-envelope.d.ts +3 -0
- package/dist/chat/tool-envelope.d.ts.map +1 -1
- package/dist/chat/tool-envelope.js +156 -10
- package/dist/chat/tool-envelope.js.map +1 -1
- package/dist/commands/abilities/info.d.ts.map +1 -1
- package/dist/commands/abilities/info.js +6 -3
- package/dist/commands/abilities/info.js.map +1 -1
- package/dist/commands/abilities/list.d.ts.map +1 -1
- package/dist/commands/abilities/list.js +59 -3
- package/dist/commands/abilities/list.js.map +1 -1
- package/dist/commands/abilities/run.d.ts.map +1 -1
- package/dist/commands/abilities/run.js +126 -41
- package/dist/commands/abilities/run.js.map +1 -1
- package/dist/commands/chat.d.ts +12 -0
- package/dist/commands/chat.d.ts.map +1 -1
- package/dist/commands/chat.js +61 -27
- package/dist/commands/chat.js.map +1 -1
- package/dist/commands/config/show.d.ts.map +1 -1
- package/dist/commands/config/show.js +59 -47
- package/dist/commands/config/show.js.map +1 -1
- package/dist/commands/doctor.d.ts +0 -8
- package/dist/commands/doctor.d.ts.map +1 -1
- package/dist/commands/doctor.js +23 -37
- package/dist/commands/doctor.js.map +1 -1
- package/dist/commands/jobs/watch.d.ts +4 -0
- package/dist/commands/jobs/watch.d.ts.map +1 -1
- package/dist/commands/jobs/watch.js +66 -27
- package/dist/commands/jobs/watch.js.map +1 -1
- package/dist/commands/login.d.ts.map +1 -1
- package/dist/commands/login.js +59 -10
- package/dist/commands/login.js.map +1 -1
- package/dist/commands/profile/delete.d.ts.map +1 -1
- package/dist/commands/profile/delete.js +19 -3
- package/dist/commands/profile/delete.js.map +1 -1
- package/dist/commands/profile/list.d.ts.map +1 -1
- package/dist/commands/profile/list.js +6 -2
- package/dist/commands/profile/list.js.map +1 -1
- package/dist/commands/profile/use.d.ts.map +1 -1
- package/dist/commands/profile/use.js +4 -1
- package/dist/commands/profile/use.js.map +1 -1
- package/dist/config/fs-utils.d.ts.map +1 -1
- package/dist/config/fs-utils.js +19 -6
- package/dist/config/fs-utils.js.map +1 -1
- package/dist/config/keychain.d.ts +78 -6
- package/dist/config/keychain.d.ts.map +1 -1
- package/dist/config/keychain.js +194 -27
- package/dist/config/keychain.js.map +1 -1
- package/dist/config/profile-store.d.ts +11 -3
- package/dist/config/profile-store.d.ts.map +1 -1
- package/dist/config/profile-store.js +53 -19
- package/dist/config/profile-store.js.map +1 -1
- package/dist/core/abilities-executor.d.ts +23 -5
- package/dist/core/abilities-executor.d.ts.map +1 -1
- package/dist/core/abilities-executor.js +137 -42
- package/dist/core/abilities-executor.js.map +1 -1
- package/dist/core/batch-manager.d.ts +10 -5
- package/dist/core/batch-manager.d.ts.map +1 -1
- package/dist/core/batch-manager.js +78 -22
- package/dist/core/batch-manager.js.map +1 -1
- package/dist/core/execute-ability-with-policy.d.ts +8 -0
- package/dist/core/execute-ability-with-policy.d.ts.map +1 -0
- package/dist/core/execute-ability-with-policy.js +19 -0
- package/dist/core/execute-ability-with-policy.js.map +1 -0
- package/dist/core/http-client.d.ts +4 -0
- package/dist/core/http-client.d.ts.map +1 -1
- package/dist/core/http-client.js +116 -44
- package/dist/core/http-client.js.map +1 -1
- package/dist/core/job-id.d.ts +2 -0
- package/dist/core/job-id.d.ts.map +1 -0
- package/dist/core/job-id.js +22 -0
- package/dist/core/job-id.js.map +1 -0
- package/dist/core/safety-controller.d.ts +20 -10
- package/dist/core/safety-controller.d.ts.map +1 -1
- package/dist/core/safety-controller.js +87 -35
- package/dist/core/safety-controller.js.map +1 -1
- package/dist/lib/base-command.d.ts +20 -0
- package/dist/lib/base-command.d.ts.map +1 -1
- package/dist/lib/base-command.js +92 -35
- package/dist/lib/base-command.js.map +1 -1
- package/dist/output/formatter.d.ts +36 -0
- package/dist/output/formatter.d.ts.map +1 -1
- package/dist/output/formatter.js +105 -15
- package/dist/output/formatter.js.map +1 -1
- package/dist/output/json-envelope.d.ts.map +1 -1
- package/dist/output/json-envelope.js +8 -5
- package/dist/output/json-envelope.js.map +1 -1
- package/dist/utils/audit-logger.d.ts +26 -8
- package/dist/utils/audit-logger.d.ts.map +1 -1
- package/dist/utils/audit-logger.js +93 -20
- package/dist/utils/audit-logger.js.map +1 -1
- package/dist/utils/error-sanitizer.d.ts +6 -0
- package/dist/utils/error-sanitizer.d.ts.map +1 -0
- package/dist/utils/error-sanitizer.js +120 -0
- package/dist/utils/error-sanitizer.js.map +1 -0
- package/dist/utils/errors.d.ts +12 -0
- package/dist/utils/errors.d.ts.map +1 -1
- package/dist/utils/errors.js +14 -0
- package/dist/utils/errors.js.map +1 -1
- package/dist/utils/format.d.ts +68 -0
- package/dist/utils/format.d.ts.map +1 -1
- package/dist/utils/format.js +668 -0
- package/dist/utils/format.js.map +1 -1
- package/dist/utils/prompt.d.ts.map +1 -1
- package/dist/utils/prompt.js +25 -24
- package/dist/utils/prompt.js.map +1 -1
- package/dist/utils/redaction.d.ts +21 -0
- package/dist/utils/redaction.d.ts.map +1 -0
- package/dist/utils/redaction.js +85 -0
- package/dist/utils/redaction.js.map +1 -0
- package/dist/utils/retry.d.ts +0 -4
- package/dist/utils/retry.d.ts.map +1 -1
- package/dist/utils/retry.js +0 -9
- package/dist/utils/retry.js.map +1 -1
- package/dist/utils/terminal-sanitizer.d.ts +21 -0
- package/dist/utils/terminal-sanitizer.d.ts.map +1 -1
- package/dist/utils/terminal-sanitizer.js +80 -14
- package/dist/utils/terminal-sanitizer.js.map +1 -1
- package/dist/validation/input-sanitizer.d.ts +0 -4
- package/dist/validation/input-sanitizer.d.ts.map +1 -1
- package/dist/validation/input-sanitizer.js +15 -64
- package/dist/validation/input-sanitizer.js.map +1 -1
- package/dist/validation/sanitize-schema.d.ts +31 -0
- package/dist/validation/sanitize-schema.d.ts.map +1 -0
- package/dist/validation/sanitize-schema.js +158 -0
- package/dist/validation/sanitize-schema.js.map +1 -0
- package/dist/validation/schema-validator.d.ts +10 -0
- package/dist/validation/schema-validator.d.ts.map +1 -1
- package/dist/validation/schema-validator.js +50 -5
- package/dist/validation/schema-validator.js.map +1 -1
- package/oclif.manifest.json +23 -1
- package/package.json +21 -7
package/README.md
CHANGED
|
@@ -1,467 +1,156 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
**Looking for the MCP Server instead?** [MainWP MCP Server](https://github.com/mainwp/mainwp-mcp) is for conversational AI management inside Claude, Cursor, or any MCP-compatible client. MainWP Control is for automation: cron jobs, CI/CD pipelines, monitoring scripts, and batch operations. Both talk to the same Abilities API with the same safety model.
|
|
6
|
-
|
|
7
|
-
---
|
|
8
|
-
|
|
9
|
-
## Quick Start
|
|
10
|
-
|
|
11
|
-
You need Node.js 20+ and a MainWP Dashboard (v6+) with an [Application Password](https://make.wordpress.org/core/2020/11/05/application-passwords-integration-guide/).
|
|
12
|
-
|
|
13
|
-
```bash
|
|
14
|
-
npm install -g @mainwp/control
|
|
15
|
-
|
|
16
|
-
mainwpcontrol login
|
|
17
|
-
|
|
18
|
-
mainwpcontrol abilities list
|
|
19
|
-
```
|
|
20
|
-
|
|
21
|
-
You should see something like this:
|
|
22
|
-
|
|
23
|
-
```text
|
|
24
|
-
Abilities (87 total)
|
|
25
|
-
|
|
26
|
-
Sites
|
|
27
|
-
Name Description Type
|
|
28
|
-
---------------- -------------------- --------------
|
|
29
|
-
list-sites-v1 List MainWP sites 📖 read
|
|
30
|
-
mainwpcontrol abilities run list-sites-v1
|
|
31
|
-
get-site-v1 Get site details 📖 read
|
|
32
|
-
mainwpcontrol abilities run get-site-v1
|
|
33
|
-
sync-sites-v1 Sync all sites ✏️ write
|
|
34
|
-
mainwpcontrol abilities run sync-sites-v1
|
|
35
|
-
```
|
|
36
|
-
|
|
37
|
-
That's it. You're connected and you can see every operation your Dashboard supports.
|
|
38
|
-
|
|
39
|
-
---
|
|
1
|
+
<p align="center">
|
|
2
|
+
<img src="docs/images/mainwp-control-logo-2026.png" alt="MainWP Control" width="400">
|
|
3
|
+
</p>
|
|
40
4
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
---
|
|
5
|
+
<p align="center">
|
|
6
|
+
<img src="https://img.shields.io/badge/status-stable-green" alt="Stable">
|
|
7
|
+
<a href="https://www.npmjs.com/package/@mainwp/control"><img src="https://img.shields.io/npm/v/@mainwp/control" alt="npm version"></a>
|
|
8
|
+
<a href="https://github.com/mainwp/mainwp-control/actions/workflows/ci.yml"><img src="https://github.com/mainwp/mainwp-control/actions/workflows/ci.yml/badge.svg" alt="CI"></a>
|
|
9
|
+
</p>
|
|
48
10
|
|
|
49
|
-
|
|
11
|
+
# MainWP Control
|
|
50
12
|
|
|
51
|
-
|
|
13
|
+
_A [MainWP Labs](https://mainwp.com/mainwp-labs/) project, powered by MainWP_
|
|
52
14
|
|
|
53
|
-
|
|
54
|
-
mainwpcontrol abilities run list-sites-v1 --json
|
|
55
|
-
```
|
|
56
|
-
|
|
57
|
-
**Check for pending updates across sites:**
|
|
15
|
+
Manage your whole WordPress network from the terminal. [MainWP Control](https://github.com/mainwp/mainwp-control) is a command-line interface for your MainWP Dashboard, built for the work you do on a schedule rather than in a browser tab:
|
|
58
16
|
|
|
59
17
|
```bash
|
|
18
|
+
# Which sites have pending updates?
|
|
60
19
|
mainwpcontrol abilities run list-updates-v1 --json
|
|
61
|
-
```
|
|
62
|
-
|
|
63
|
-
**Get details for a specific site:**
|
|
64
20
|
|
|
65
|
-
|
|
66
|
-
mainwpcontrol abilities run
|
|
67
|
-
```
|
|
21
|
+
# Sync every site and wait for the result
|
|
22
|
+
mainwpcontrol abilities run sync-sites-v1 --wait --json
|
|
68
23
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
mainwpcontrol abilities run get-site-v1 --input '{\"site_id\": 1}' --json
|
|
24
|
+
# Nightly health check from cron, alert on failure
|
|
25
|
+
mainwpcontrol abilities run check-sites-v1 --quiet \
|
|
26
|
+
|| curl -fsS "$SLACK_WEBHOOK" -d '{"text":"Sites down"}'
|
|
73
27
|
```
|
|
74
28
|
|
|
75
|
-
|
|
29
|
+
The CLI is a small program that runs on your own computer or server. Nothing new is installed on your Dashboard or your child sites; it talks to the same Abilities API your Dashboard already exposes. Anything classified as destructive stops for a preview and your explicit confirmation before it runs.
|
|
76
30
|
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
31
|
+
<p align="center">
|
|
32
|
+
<img src="docs/images/mainwp-control-fleet-from-the-terminal.png" alt="Dark MainWP branded card with the headline "Your WordPress fleet from the terminal" and a terminal listing 87 Dashboard abilities, running sync-sites-v1 with the wait and json flags to a success envelope, then checking exit code 0" width="800">
|
|
33
|
+
</p>
|
|
80
34
|
|
|
81
|
-
|
|
35
|
+
**Looking for the MCP Server instead?** [MainWP MCP Server](https://github.com/mainwp/mainwp-mcp) connects Claude, Cursor, and other AI tools to your Dashboard for conversational management. MainWP Control is for automation: cron jobs, CI/CD pipelines, monitoring scripts, and batch operations. Both talk to the same Abilities API with the same safety model.
|
|
82
36
|
|
|
83
|
-
|
|
37
|
+
## Why a CLI?
|
|
84
38
|
|
|
85
|
-
|
|
86
|
-
mainwpcontrol abilities run delete-site-v1 \
|
|
87
|
-
--input '{"site_id_or_domain": "mysite.com"}' \
|
|
88
|
-
--dry-run --json
|
|
89
|
-
```
|
|
39
|
+
The Dashboard UI is built for a person clicking through sites. A CLI is built for everything that should happen without you watching:
|
|
90
40
|
|
|
91
|
-
|
|
41
|
+
- **Scriptable output.** `--json` prints exactly one machine-readable envelope on stdout. Warnings and progress never contaminate it, so you can pipe results straight into `jq`, a spreadsheet, or a monitoring agent.
|
|
42
|
+
- **Honest exit codes.** Classified outcomes exit 0-5 by error class (input, auth, network, API, internal); interruptions use the standard signal exits (130/143). Your pipeline branches on the code instead of parsing error text.
|
|
43
|
+
- **Batch operations that survive.** Large operations queue as batch jobs with a `job_id` you can watch, wait on, or come back to. A timeout or Ctrl-C leaves you with a resumable job, not a mystery.
|
|
44
|
+
- **Credentials that stay put.** Passwords live in your OS keychain, or in an environment variable for CI. The profile file on disk never contains them.
|
|
45
|
+
- **Guard rails you can't script around by accident.** Destructive abilities require a successful `--dry-run` preview and an explicit `--confirm`, and each confirmed run is written to a local audit log.
|
|
92
46
|
|
|
93
|
-
|
|
47
|
+
## What You Can Do
|
|
94
48
|
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
`--wait` blocks until the operation finishes. Useful in CI pipelines.
|
|
49
|
+
- **Site Management**: List sites, check connection status, sync data, add or remove child sites
|
|
50
|
+
- **Update Management**: See pending updates across all sites, apply core/plugin/theme updates
|
|
51
|
+
- **Plugin and Theme Control**: View installed plugins and themes, activate or deactivate them
|
|
52
|
+
- **Client Organization**: Manage client records, assign sites to clients, track costs
|
|
53
|
+
- **Bulk Operations**: Sync, reconnect, or check connectivity across dozens of sites at once
|
|
54
|
+
- **Chat Mode**: Optionally talk to your Dashboard in plain English, with the same safety gates
|
|
102
55
|
|
|
103
|
-
|
|
56
|
+
Built for WordPress agencies and site managers who want their MainWP routine in scripts, schedulers, and pipelines.
|
|
104
57
|
|
|
105
|
-
##
|
|
58
|
+
## Quick Start
|
|
106
59
|
|
|
107
|
-
|
|
60
|
+
**Requirements:** Node.js >=20.18.1 and MainWP Dashboard 6.0+
|
|
108
61
|
|
|
109
|
-
|
|
62
|
+
> **On Windows?** Use [Git Bash](https://gitforwindows.org/) and every example below works without changes. For scheduled workflows (cron), see [WSL](https://learn.microsoft.com/en-us/windows/wsl/install).
|
|
110
63
|
|
|
111
|
-
|
|
112
|
-
npm install -g @mainwp/control
|
|
64
|
+
**1. Create an Application Password.** This is a separate password WordPress issues for tools like this one; it never changes your login and you can revoke it at any time.
|
|
113
65
|
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
66
|
+
1. Log into your MainWP Dashboard as an administrator
|
|
67
|
+
2. Go to **Users > Profile** (click your username in the top right)
|
|
68
|
+
3. Scroll to the **Application Passwords** section
|
|
69
|
+
4. Enter a name like "MainWP Control" and click **Add New Application Password**
|
|
70
|
+
5. Copy the generated password immediately (it is only shown once; spaces are fine either way)
|
|
117
71
|
|
|
118
|
-
|
|
72
|
+
> **Tip:** Create a dedicated WordPress user for API access rather than using your main admin account. It keeps the audit trail clean and is easy to revoke later.
|
|
119
73
|
|
|
120
|
-
|
|
74
|
+
**2. Install and log in.**
|
|
121
75
|
|
|
122
76
|
```bash
|
|
123
77
|
npm install -g @mainwp/control
|
|
124
78
|
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
mainwpcontrol login --url https://dashboard.example.com --username admin
|
|
128
|
-
```
|
|
129
|
-
|
|
130
|
-
When the OS keychain is unavailable, credentials are not stored on disk. Keep `MAINWP_APP_PASSWORD` set for each run.
|
|
131
|
-
|
|
132
|
-
If keytar is installed but broken, set `MAINWPCONTROL_NO_KEYTAR=1` to skip loading it.
|
|
133
|
-
|
|
134
|
-
---
|
|
135
|
-
|
|
136
|
-
<details>
|
|
137
|
-
<summary><strong>New to the Command Line?</strong></summary>
|
|
138
|
-
|
|
139
|
-
If you haven't used a terminal before, here's what you need to know.
|
|
140
|
-
|
|
141
|
-
### What is a terminal?
|
|
142
|
-
|
|
143
|
-
A terminal is where you type commands instead of clicking buttons. You'll see it called "command line" or "shell" in different places.
|
|
144
|
-
|
|
145
|
-
**How to open it:**
|
|
146
|
-
- **macOS**: Open **Terminal** (search in Spotlight, or look in Applications > Utilities)
|
|
147
|
-
- **Windows**: Open **PowerShell** (search in the Start menu)
|
|
148
|
-
- **Linux**: Open your distribution's **Terminal** app (usually in the applications menu)
|
|
149
|
-
|
|
150
|
-
### What does `npm install -g` do?
|
|
151
|
-
|
|
152
|
-
`npm` is the Node.js package manager. It downloads and installs JavaScript packages. The `-g` flag installs globally, which makes `mainwpcontrol` available as a command anywhere on your system, not only in one project folder.
|
|
153
|
-
|
|
154
|
-
### What is an environment variable?
|
|
155
|
-
|
|
156
|
-
An environment variable is a named value that programs can read. They're commonly used for passwords and API keys.
|
|
157
|
-
|
|
158
|
-
**Setting one:**
|
|
159
|
-
```bash
|
|
160
|
-
# macOS / Linux (lasts until you close the terminal)
|
|
161
|
-
export MAINWP_APP_PASSWORD='xxxx xxxx xxxx xxxx xxxx xxxx'
|
|
162
|
-
|
|
163
|
-
# Windows PowerShell (lasts until you close the window)
|
|
164
|
-
$env:MAINWP_APP_PASSWORD = 'xxxx xxxx xxxx xxxx xxxx xxxx'
|
|
165
|
-
```
|
|
166
|
-
|
|
167
|
-
For long-term storage, use the OS keychain (the default when you run `mainwpcontrol login`) or a restricted-permission `.env` file rather than pasting credentials into shell profile files.
|
|
168
|
-
|
|
169
|
-
### What is an Application Password?
|
|
170
|
-
|
|
171
|
-
WordPress Application Passwords let external tools like `mainwpcontrol` access your site without using your main login password. They look like groups of four characters separated by spaces (e.g., `abcd efgh ijkl mnop qrst uvwx`).
|
|
172
|
-
|
|
173
|
-
**To create one:** Log into WordPress admin > Users > Your Profile > scroll to **Application Passwords** > enter a name like "mainwpcontrol" > click **Add New Application Password** > copy the generated password.
|
|
174
|
-
|
|
175
|
-
### Reading command output
|
|
176
|
-
|
|
177
|
-
When you run a command, the output appears in your terminal. A few things to know:
|
|
178
|
-
|
|
179
|
-
- **`--json`** tells `mainwpcontrol` to output structured JSON (useful for scripting and piping to other tools)
|
|
180
|
-
- **Exit codes** indicate success (`0`) or failure (`1` through `5`). You won't see them directly, but scripts and CI use them to decide what happens next. Run `echo $?` (macOS/Linux) or `echo $LASTEXITCODE` (PowerShell) after a command to check.
|
|
181
|
-
|
|
182
|
-
### JSON quoting on the command line
|
|
183
|
-
|
|
184
|
-
When you pass JSON with `--input`, quoting depends on your shell:
|
|
185
|
-
|
|
186
|
-
```bash
|
|
187
|
-
# macOS / Linux / Git Bash on Windows
|
|
188
|
-
mainwpcontrol abilities run get-site-v1 --input '{"site_id": 1}' --json
|
|
189
|
-
|
|
190
|
-
# Windows PowerShell
|
|
191
|
-
mainwpcontrol abilities run get-site-v1 --input '{\"site_id\": 1}' --json
|
|
192
|
-
```
|
|
193
|
-
|
|
194
|
-
Windows strips the inner double quotes unless you escape them with backslashes. If this gets annoying (and it will, with longer JSON), put your parameters in a file and use `--input-file`:
|
|
195
|
-
|
|
196
|
-
```bash
|
|
197
|
-
mainwpcontrol abilities run get-site-v1 --input-file params.json --json
|
|
79
|
+
mainwpcontrol login
|
|
198
80
|
```
|
|
199
81
|
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
**Git Bash on Windows** (comes with Git for Windows) handles quoting the same way macOS and Linux do. If you use Git Bash, all the examples in this documentation work without changes.
|
|
82
|
+
`login` prompts for your Dashboard URL, username, and the Application Password, then stores the credentials in your OS keychain. For CI and headless machines, use [environment variable auth](docs/configuration.md#environment-variable-auth) instead.
|
|
203
83
|
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
---
|
|
207
|
-
|
|
208
|
-
## Basic Usage
|
|
209
|
-
|
|
210
|
-
### Abilities
|
|
211
|
-
|
|
212
|
-
Your Dashboard exposes its operations as "abilities." You browse them, pick one, and run it. Every ability has a versioned name like `list-sites-v1` that you pass to `abilities run`.
|
|
84
|
+
**3. See what your Dashboard can do.**
|
|
213
85
|
|
|
214
86
|
```bash
|
|
215
|
-
# List all abilities
|
|
216
87
|
mainwpcontrol abilities list
|
|
217
|
-
|
|
218
|
-
# Filter by category
|
|
219
|
-
mainwpcontrol abilities list --category sites
|
|
220
|
-
|
|
221
|
-
# Get full details and input schema for an ability
|
|
222
|
-
mainwpcontrol abilities info list-sites-v1
|
|
223
|
-
|
|
224
|
-
# Run an ability
|
|
225
|
-
mainwpcontrol abilities run list-sites-v1 --json
|
|
226
|
-
|
|
227
|
-
# Run with input parameters
|
|
228
|
-
mainwpcontrol abilities run get-site-v1 --input '{"site_id": 1}' --json
|
|
229
|
-
|
|
230
|
-
# Windows PowerShell: escape inner quotes
|
|
231
|
-
mainwpcontrol abilities run get-site-v1 --input '{\"site_id\": 1}' --json
|
|
232
|
-
|
|
233
|
-
# Or use a file (works everywhere)
|
|
234
|
-
mainwpcontrol abilities run get-site-v1 --input-file params.json --json
|
|
235
|
-
```
|
|
236
|
-
|
|
237
|
-
### Profiles
|
|
238
|
-
|
|
239
|
-
Each `mainwpcontrol login` creates a profile, a named connection to a Dashboard, identified by hostname. If you manage multiple Dashboards, run `login` once per Dashboard to create a profile for each.
|
|
240
|
-
|
|
241
|
-
```bash
|
|
242
|
-
# List all profiles
|
|
243
|
-
mainwpcontrol profile list
|
|
244
|
-
|
|
245
|
-
# Switch active profile
|
|
246
|
-
mainwpcontrol profile use production.example.com
|
|
247
|
-
|
|
248
|
-
# Use a profile for one command without switching
|
|
249
|
-
mainwpcontrol abilities list --profile staging.example.com
|
|
250
|
-
|
|
251
|
-
# Delete a profile and its keychain credentials
|
|
252
|
-
mainwpcontrol profile delete staging.example.com
|
|
253
88
|
```
|
|
254
89
|
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
`doctor` checks your configuration, credentials, and Dashboard connectivity. Run it first if something isn't working.
|
|
258
|
-
|
|
259
|
-
```bash
|
|
260
|
-
# Check configuration and connectivity
|
|
261
|
-
mainwpcontrol doctor
|
|
262
|
-
|
|
263
|
-
# Verbose output
|
|
264
|
-
mainwpcontrol doctor -v
|
|
90
|
+
```text
|
|
91
|
+
Abilities (87 total)
|
|
265
92
|
|
|
266
|
-
|
|
267
|
-
|
|
93
|
+
Sites
|
|
94
|
+
Name Description Type
|
|
95
|
+
---------------- -------------------- --------------
|
|
96
|
+
list-sites-v1 List MainWP sites 📖 read
|
|
97
|
+
mainwpcontrol abilities run list-sites-v1
|
|
98
|
+
get-site-v1 Get site details 📖 read
|
|
99
|
+
mainwpcontrol abilities run get-site-v1
|
|
100
|
+
sync-sites-v1 Sync all sites ✏️ write
|
|
101
|
+
mainwpcontrol abilities run sync-sites-v1
|
|
268
102
|
```
|
|
269
103
|
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
If you have an LLM API key, you can talk to your Dashboard in plain English instead of constructing commands. Good for exploration, not required for anything.
|
|
273
|
-
|
|
274
|
-
Set one of these environment variables to enable it:
|
|
104
|
+
Every operation your Dashboard supports, with the exact command to run it and whether it reads, writes, or destroys. Pick one and run it:
|
|
275
105
|
|
|
276
106
|
```bash
|
|
277
|
-
|
|
278
|
-
export ANTHROPIC_API_KEY='sk-ant-...'
|
|
279
|
-
|
|
280
|
-
mainwpcontrol chat
|
|
281
|
-
mainwpcontrol chat "list all sites with pending updates"
|
|
107
|
+
mainwpcontrol abilities run list-sites-v1 --json
|
|
282
108
|
```
|
|
283
109
|
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
### Global Flags
|
|
287
|
-
|
|
288
|
-
These flags work on every command.
|
|
289
|
-
|
|
290
|
-
| Flag | Description |
|
|
291
|
-
|------|-------------|
|
|
292
|
-
| `--json` | Structured JSON output |
|
|
293
|
-
| `--quiet` / `-q` | Suppress output (exit code only) |
|
|
294
|
-
| `--profile <name>` | Use a specific profile |
|
|
295
|
-
| `--debug` | Show redacted debug diagnostics on stderr |
|
|
296
|
-
| `--help` | Show help |
|
|
297
|
-
|
|
298
|
-
### Abilities Run Flags
|
|
299
|
-
|
|
300
|
-
Extra flags for `abilities run`. These control input, safety checks, and batch job behavior.
|
|
110
|
+
> **New to the command line?** [Getting Started](docs/getting-started.md) covers terminals, environment variables, JSON quoting, and everything else the other guides assume.
|
|
301
111
|
|
|
302
|
-
|
|
303
|
-
|------|-------------|
|
|
304
|
-
| `--input` / `-i` | Input parameters as JSON (use `-` for stdin) |
|
|
305
|
-
| `--input-file` | Read input from a JSON file |
|
|
306
|
-
| `--dry-run` | Preview changes without executing |
|
|
307
|
-
| `--confirm` | Execute a destructive ability |
|
|
308
|
-
| `--force` | Skip interactive confirmation (CI mode) |
|
|
309
|
-
| `--wait` | Block until batch job completes |
|
|
310
|
-
| `--wait-timeout` | Max seconds to wait (default: 300) |
|
|
311
|
-
|
|
312
|
-
---
|
|
313
|
-
|
|
314
|
-
## Concepts
|
|
315
|
-
|
|
316
|
-
### Abilities
|
|
317
|
-
|
|
318
|
-
Abilities are the operations your MainWP Dashboard exposes through its REST API. Each one has:
|
|
319
|
-
|
|
320
|
-
- A versioned name (e.g., `list-sites-v1`, `delete-site-v1`)
|
|
321
|
-
- An input schema (what parameters it accepts)
|
|
322
|
-
- Annotations that tell you what kind of operation it is
|
|
323
|
-
|
|
324
|
-
The annotations matter:
|
|
325
|
-
- **Readonly**: Safe to run anytime. Cannot modify data.
|
|
326
|
-
- **Destructive**: Permanently changes or deletes data. Requires `--dry-run` preview, then `--confirm` to execute.
|
|
327
|
-
- **Idempotent**: Safe to re-run. Same result on repeated calls.
|
|
328
|
-
|
|
329
|
-
Run `mainwpcontrol abilities info <name>` to see the full schema and annotations for any ability.
|
|
330
|
-
|
|
331
|
-
### Profiles
|
|
332
|
-
|
|
333
|
-
A profile is a named connection to a MainWP Dashboard. It stores the Dashboard URL and username. Your password stays in the OS keychain (or in the `MAINWP_APP_PASSWORD` environment variable when no keychain is available).
|
|
334
|
-
|
|
335
|
-
Running `mainwpcontrol login` creates a profile automatically, named after the Dashboard hostname:
|
|
112
|
+
## Everyday Commands
|
|
336
113
|
|
|
337
114
|
```bash
|
|
338
|
-
#
|
|
339
|
-
mainwpcontrol
|
|
340
|
-
|
|
341
|
-
# Creates profile "production.example.com"
|
|
342
|
-
mainwpcontrol login --url https://production.example.com --username admin
|
|
343
|
-
```
|
|
344
|
-
|
|
345
|
-
The profile file at `~/.config/mainwpcontrol/profiles.json` never contains passwords.
|
|
346
|
-
|
|
347
|
-
### Safety Model
|
|
115
|
+
# Check for pending updates across all sites
|
|
116
|
+
mainwpcontrol abilities run list-updates-v1 --json
|
|
348
117
|
|
|
349
|
-
|
|
118
|
+
# Get details for one site
|
|
119
|
+
mainwpcontrol abilities run get-site-v1 --input '{"site_id_or_domain": 1}' --json
|
|
350
120
|
|
|
351
|
-
|
|
352
|
-
# Step 1: Preview (nothing changes)
|
|
121
|
+
# Preview a destructive action; nothing changes without --confirm
|
|
353
122
|
mainwpcontrol abilities run delete-site-v1 \
|
|
354
123
|
--input '{"site_id_or_domain": "mysite.com"}' \
|
|
355
124
|
--dry-run --json
|
|
356
125
|
|
|
357
|
-
#
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
--
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
`--dry-run` and `--confirm` are mutually exclusive. You cannot pass both.
|
|
364
|
-
|
|
365
|
-
In CI/scripted workflows where you've already validated the operation, pass `--confirm --force` directly to skip the interactive prompt.
|
|
366
|
-
|
|
367
|
-
### Batch Jobs
|
|
368
|
-
|
|
369
|
-
Operations that affect many items (200+) are automatically queued as batch jobs. The command returns a `job_id` immediately, and you can watch progress:
|
|
370
|
-
|
|
371
|
-
```bash
|
|
372
|
-
mainwpcontrol jobs watch <job-id>
|
|
373
|
-
|
|
374
|
-
# With a timeout
|
|
375
|
-
mainwpcontrol jobs watch <job-id> --timeout 120
|
|
376
|
-
```
|
|
377
|
-
|
|
378
|
-
Or use `--wait` on the original command to block until completion:
|
|
379
|
-
|
|
380
|
-
```bash
|
|
381
|
-
mainwpcontrol abilities run sync-sites-v1 --wait --wait-timeout 300 --json
|
|
382
|
-
```
|
|
383
|
-
|
|
384
|
-
---
|
|
385
|
-
|
|
386
|
-
## Advanced Usage
|
|
387
|
-
|
|
388
|
-
### CI/CD Patterns
|
|
389
|
-
|
|
390
|
-
```bash
|
|
391
|
-
# Non-interactive login
|
|
392
|
-
export MAINWP_APP_PASSWORD='xxxx xxxx xxxx xxxx xxxx xxxx'
|
|
393
|
-
mainwpcontrol login --url https://dashboard.example.com --username admin
|
|
394
|
-
|
|
395
|
-
# Silent execution with exit codes
|
|
396
|
-
mainwpcontrol abilities run list-sites-v1 --json --quiet
|
|
397
|
-
echo "Exit code: $?"
|
|
398
|
-
|
|
399
|
-
# Pipeline branching on exit codes
|
|
400
|
-
if mainwpcontrol abilities run check-sites-v1 --json --quiet; then
|
|
401
|
-
echo "All sites healthy"
|
|
402
|
-
else
|
|
403
|
-
echo "Issues detected"
|
|
404
|
-
fi
|
|
405
|
-
```
|
|
406
|
-
|
|
407
|
-
### Input from Files and Stdin
|
|
408
|
-
|
|
409
|
-
```bash
|
|
410
|
-
# From a JSON file
|
|
411
|
-
mainwpcontrol abilities run update-site-plugins-v1 --input-file params.json --json
|
|
412
|
-
|
|
413
|
-
# From stdin
|
|
414
|
-
echo '{"site_id": 1}' | mainwpcontrol abilities run get-site-v1 --input - --json
|
|
415
|
-
|
|
416
|
-
# Heredoc
|
|
417
|
-
mainwpcontrol abilities run get-site-v1 --input - --json <<EOF
|
|
418
|
-
{"site_id": 1}
|
|
419
|
-
EOF
|
|
420
|
-
```
|
|
421
|
-
|
|
422
|
-
### Chat Mode Configuration
|
|
423
|
-
|
|
424
|
-
Chat requires one of these environment variables:
|
|
425
|
-
|
|
426
|
-
| Variable | Provider |
|
|
427
|
-
|----------|----------|
|
|
428
|
-
| `ANTHROPIC_API_KEY` | Anthropic Claude |
|
|
429
|
-
| `OPENAI_API_KEY` | OpenAI GPT |
|
|
430
|
-
| `GOOGLE_API_KEY` | Google Gemini |
|
|
431
|
-
| `OPENROUTER_API_KEY` | OpenRouter |
|
|
432
|
-
| `LOCAL_LLM_API_KEY` | Local LLM (with optional `LOCAL_LLM_URL`) |
|
|
433
|
-
|
|
434
|
-
Additional chat flags: `--provider`, `--model`, `--max-turns`, `--max-context-messages`, `--no-stream`.
|
|
435
|
-
|
|
436
|
-
In non-TTY environments (pipes, CI), `mainwpcontrol chat` without a message argument exits with guidance instead of hanging.
|
|
126
|
+
# Updates are classified destructive too: preview, then confirm
|
|
127
|
+
# (--force skips the interactive prompt for CI; --wait blocks until done)
|
|
128
|
+
mainwpcontrol abilities run update-site-plugins-v1 \
|
|
129
|
+
--input '{"site_id_or_domain": 1}' --dry-run --json
|
|
130
|
+
mainwpcontrol abilities run update-site-plugins-v1 \
|
|
131
|
+
--input '{"site_id_or_domain": 1}' --confirm --force --wait --json
|
|
437
132
|
|
|
438
|
-
|
|
133
|
+
# See the input schema for any ability
|
|
134
|
+
mainwpcontrol abilities info update-site-plugins-v1
|
|
439
135
|
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
source /path/to/mainwp-control/scripts/completions/mainwpcontrol.bash
|
|
443
|
-
|
|
444
|
-
# Zsh
|
|
445
|
-
source /path/to/mainwp-control/scripts/completions/mainwpcontrol.zsh
|
|
136
|
+
# Something wrong? Diagnose configuration and connectivity
|
|
137
|
+
mainwpcontrol doctor
|
|
446
138
|
```
|
|
447
139
|
|
|
448
|
-
|
|
140
|
+
Managing more than one Dashboard? Each `login` creates a profile named after the hostname; switch with `mainwpcontrol profile use <name>` or per-command with `--profile <name>`. See the [CLI Reference](docs/cli-reference.md#profile) for details.
|
|
449
141
|
|
|
450
|
-
|
|
142
|
+
> **Windows PowerShell** quoting of inline JSON is unreliable; put parameters in a file and use `--input-file` instead. Git Bash handles the examples as written. Details in [Input from File](docs/workflows/input-from-file.md).
|
|
451
143
|
|
|
452
|
-
|
|
453
|
-
{
|
|
454
|
-
"defaultJsonOutput": true,
|
|
455
|
-
"timeout": 30000,
|
|
456
|
-
"debug": false,
|
|
457
|
-
"llmProvider": "openai",
|
|
458
|
-
"chatContextMessages": 20
|
|
459
|
-
}
|
|
460
|
-
```
|
|
144
|
+
## Documentation
|
|
461
145
|
|
|
462
|
-
|
|
146
|
+
- [Getting Started](docs/getting-started.md): terminals, npm, Application Passwords, and JSON quoting, if the command line is new territory
|
|
147
|
+
- [CLI Reference](docs/cli-reference.md): every command, flag, and exit code
|
|
148
|
+
- [Configuration](docs/configuration.md): profiles, settings.json, environment variables, and credential storage
|
|
149
|
+
- [Safety & Destructive Operations](docs/safety.md): the preview-and-confirm flow, ability annotations, batch jobs, and what the guard rails do and don't cover
|
|
150
|
+
- [Chat Mode](docs/chat.md): plain-English management with your own LLM API key
|
|
151
|
+
- [Troubleshooting](docs/troubleshooting.md): install failures, connection errors, and authentication issues
|
|
463
152
|
|
|
464
|
-
Step-by-step guides
|
|
153
|
+
Step-by-step automation guides live in [docs/workflows](docs/workflows):
|
|
465
154
|
|
|
466
155
|
| Workflow | Description |
|
|
467
156
|
|----------|-------------|
|
|
@@ -471,152 +160,83 @@ Step-by-step guides for common automation patterns:
|
|
|
471
160
|
| [Input from File](docs/workflows/input-from-file.md) | Pass complex parameters via JSON files, stdin pipes, or heredocs |
|
|
472
161
|
| [Monitoring Integration](docs/workflows/monitoring-integration.md) | Send site metrics to Datadog, StatsD, or other monitoring tools |
|
|
473
162
|
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
## Reference
|
|
477
|
-
|
|
478
|
-
### Exit Codes
|
|
479
|
-
|
|
480
|
-
| Code | Meaning | CI Usage |
|
|
481
|
-
|------|---------|----------|
|
|
482
|
-
| 0 | Success | Continue pipeline |
|
|
483
|
-
| 1 | User/input error | Fix command syntax |
|
|
484
|
-
| 2 | Auth/config error | Check credentials |
|
|
485
|
-
| 3 | Network error | Retry or check connectivity |
|
|
486
|
-
| 4 | API error | Check ability parameters |
|
|
487
|
-
| 5 | Internal error | Report bug |
|
|
163
|
+
## Configuration
|
|
488
164
|
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
#### MainWP Configuration
|
|
165
|
+
Interactive use needs no configuration beyond `mainwpcontrol login`. For CI, Docker, and headless machines:
|
|
492
166
|
|
|
493
167
|
| Variable | Description |
|
|
494
168
|
|----------|-------------|
|
|
495
|
-
| `MAINWP_APP_PASSWORD` | Application
|
|
496
|
-
| `
|
|
497
|
-
| `
|
|
498
|
-
|
|
499
|
-
#### Chat/LLM Configuration
|
|
500
|
-
|
|
501
|
-
| Variable | Description |
|
|
502
|
-
|----------|-------------|
|
|
503
|
-
| `ANTHROPIC_API_KEY` | Anthropic Claude |
|
|
504
|
-
| `OPENAI_API_KEY` | OpenAI GPT |
|
|
505
|
-
| `GOOGLE_API_KEY` | Google Gemini |
|
|
506
|
-
| `OPENROUTER_API_KEY` | OpenRouter |
|
|
507
|
-
| `LOCAL_LLM_API_KEY` | Local LLM provider (required to enable local provider) |
|
|
508
|
-
| `LOCAL_LLM_URL` | Local endpoint URL (optional, defaults to localhost) |
|
|
509
|
-
| `MAINWP_LLM_PROVIDER` | Override auto-detected provider |
|
|
510
|
-
| `MAINWP_LLM_MODEL` | Specify model to use |
|
|
511
|
-
|
|
512
|
-
### Configuration Settings
|
|
513
|
-
|
|
514
|
-
All settings in `~/.config/mainwpcontrol/settings.json`:
|
|
515
|
-
|
|
516
|
-
| Setting | Type | Description |
|
|
517
|
-
|---------|------|-------------|
|
|
518
|
-
| `defaultJsonOutput` | boolean | Default to JSON output |
|
|
519
|
-
| `timeout` | number | HTTP request timeout in milliseconds |
|
|
520
|
-
| `debug` | boolean | Enable debug output |
|
|
521
|
-
| `llmProvider` | string | Default LLM provider for chat |
|
|
522
|
-
| `chatContextMessages` | number | Max messages in chat context |
|
|
523
|
-
| `skipSSLVerification` | boolean | Disable TLS verification (insecure, prefer per-profile setting via `login --skip-ssl-verify`) |
|
|
524
|
-
| `allowInsecureHttp` | boolean | Allow `http://` Dashboard URLs without `MAINWP_ALLOW_HTTP=1` |
|
|
525
|
-
|
|
526
|
-
---
|
|
527
|
-
|
|
528
|
-
## Troubleshooting
|
|
529
|
-
|
|
530
|
-
<details>
|
|
531
|
-
<summary><strong>"keytar failed to build" or native module errors during install</strong></summary>
|
|
532
|
-
|
|
533
|
-
Keytar requires native C++ compilation on some platforms. If it fails:
|
|
534
|
-
|
|
535
|
-
1. **Use environment variable auth instead** (bypasses keytar entirely):
|
|
536
|
-
```bash
|
|
537
|
-
export MAINWP_APP_PASSWORD='your-application-password'
|
|
538
|
-
mainwpcontrol login --url https://dashboard.example.com --username admin
|
|
539
|
-
```
|
|
540
|
-
2. **Or skip keytar explicitly** by setting `MAINWPCONTROL_NO_KEYTAR=1` before running commands.
|
|
169
|
+
| `MAINWP_APP_PASSWORD` | Application Password for non-interactive login, and for commands when no OS keychain is available |
|
|
170
|
+
| `MAINWP_DASHBOARD_URL` | The Dashboard `MAINWP_APP_PASSWORD` belongs to. Required whenever a command authenticates using that fallback |
|
|
171
|
+
| `MAINWPCONTROL_NO_KEYTAR` | Set to `1` to skip keychain loading entirely |
|
|
172
|
+
| `MAINWP_ALLOW_HTTP` | Set to `1` to allow insecure `http://` Dashboard URLs |
|
|
541
173
|
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
174
|
+
```bash
|
|
175
|
+
export MAINWP_APP_PASSWORD='xxxx xxxx xxxx xxxx xxxx xxxx'
|
|
176
|
+
export MAINWP_DASHBOARD_URL='https://dashboard.example.com'
|
|
177
|
+
mainwpcontrol login --url https://dashboard.example.com --username admin
|
|
178
|
+
mainwpcontrol abilities list
|
|
179
|
+
```
|
|
548
180
|
|
|
549
|
-
|
|
181
|
+
Whenever the password comes from `MAINWP_APP_PASSWORD`, the CLI sends it only to the
|
|
182
|
+
Dashboard named in `MAINWP_DASHBOARD_URL`, and fails instead of sending it anywhere
|
|
183
|
+
else. That covers `login` as well as later commands: in CI the password usually lives
|
|
184
|
+
in a protected secret store while command arguments do not, so pinning the destination
|
|
185
|
+
next to the secret is what stops an edited pipeline from redirecting it. It also means
|
|
186
|
+
a `profiles.json` someone else can write cannot point your credential at their server.
|
|
550
187
|
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
2. **Add the `bin` subdirectory to your PATH.** For example, if the prefix is `/usr/local`:
|
|
556
|
-
```bash
|
|
557
|
-
# Add to ~/.bashrc, ~/.zshrc, or your shell profile:
|
|
558
|
-
export PATH="/usr/local/bin:$PATH"
|
|
559
|
-
```
|
|
560
|
-
3. **Restart your terminal** (or run `source ~/.zshrc` / `source ~/.bashrc`) and try again.
|
|
188
|
+
Credentials in the OS keychain are bound to their Dashboard the same way and need no
|
|
189
|
+
extra variable. `login` only prompts for the password when `MAINWP_APP_PASSWORD` is
|
|
190
|
+
unset; when it is set, the same binding applies. Commands that only display
|
|
191
|
+
configuration, such as `doctor` and `config show`, are unaffected.
|
|
561
192
|
|
|
562
|
-
|
|
193
|
+
Optional defaults (JSON output, timeouts, chat provider) live in `~/.config/mainwpcontrol/settings.json`. The full list of settings, chat provider keys, and the credential storage model are in the [Configuration guide](docs/configuration.md).
|
|
563
194
|
|
|
564
|
-
|
|
195
|
+
## Abilities
|
|
565
196
|
|
|
566
|
-
|
|
567
|
-
<summary><strong>"connection refused" or network errors</strong></summary>
|
|
197
|
+
Your Dashboard exposes its operations as versioned, self-describing "abilities" (the exact set varies by Dashboard version):
|
|
568
198
|
|
|
569
|
-
|
|
199
|
+
| Category | Abilities | Reference |
|
|
200
|
+
| ---------------- | --------- | ----------------------------------------------------------------------------------------- |
|
|
201
|
+
| Sites | 30 | [Sites Abilities](https://docs.mainwp.com/api-reference/abilities-api/sites) |
|
|
202
|
+
| Updates | 13 | [Updates Abilities](https://docs.mainwp.com/api-reference/abilities-api/updates) |
|
|
203
|
+
| Clients | 11 | [Clients Abilities](https://docs.mainwp.com/api-reference/abilities-api/clients) |
|
|
204
|
+
| Tags | 7 | [Tags Abilities](https://docs.mainwp.com/api-reference/abilities-api/tags) |
|
|
205
|
+
| Batch Operations | 1 | [Batch Operations](https://docs.mainwp.com/api-reference/abilities-api/batch-operations) |
|
|
570
206
|
|
|
571
|
-
|
|
572
|
-
2. **Verify HTTPS.** `mainwpcontrol` requires HTTPS by default. If your Dashboard uses HTTP (not recommended), set `MAINWP_ALLOW_HTTP=1`.
|
|
573
|
-
3. **Check firewall/network.** Make sure your machine can reach the Dashboard:
|
|
574
|
-
```bash
|
|
575
|
-
curl -I https://dashboard.example.com
|
|
576
|
-
```
|
|
577
|
-
4. **SSL certificate issues.** If using a self-signed certificate, you can use `mainwpcontrol login --skip-ssl-verify` (not recommended for production).
|
|
207
|
+
The table counts the Dashboard's built-in `mainwp/*` abilities. Extensions and other plugins can register their own, so your total may be higher (the 87 in the Quick Start sample comes from a Dashboard with extensions installed). `abilities list` shows what your Dashboard actually offers, `abilities info <name>` shows an ability's input schema and annotations, and `abilities run <name>` executes it. Because the CLI discovers abilities at runtime, new Dashboard capabilities appear without a CLI update.
|
|
578
208
|
|
|
579
|
-
|
|
209
|
+
## Safety
|
|
580
210
|
|
|
581
|
-
|
|
211
|
+
Every ability carries annotations that classify it as read-only, a write, or destructive, and the CLI enforces them. Destructive operations follow a two-step flow: a `--dry-run` preview shows what the Dashboard reports would be affected, and only an explicit `--confirm` executes it. The destructive class is deliberately wide: deletions, updates (`update-site-*`, `run-updates-*`, `update-all-*`), any ability that does not declare itself non-destructive, and a conservative name-based override that a mislabeling Dashboard cannot downgrade. The two flags are mutually exclusive, previews that fail block execution, and each confirmed run is written to a local audit log. Scripted pipelines that have already validated an operation can pass `--confirm --force` to skip the interactive prompt; that is a deliberate, per-command decision, never a default. Chat mode goes through the identical execution path, so an LLM can propose a destructive action but cannot confirm it. The full model is in [Safety & Destructive Operations](docs/safety.md).
|
|
582
212
|
|
|
583
213
|
## Contributing
|
|
584
214
|
|
|
585
215
|
```bash
|
|
586
|
-
npm
|
|
587
|
-
npm
|
|
588
|
-
npm run
|
|
216
|
+
npm ci # install dependencies
|
|
217
|
+
npm run build # build
|
|
218
|
+
npm test # run tests (unit + e2e, no network needed)
|
|
219
|
+
npm run lint # check code style
|
|
589
220
|
```
|
|
590
221
|
|
|
591
|
-
|
|
222
|
+
CI runs lint, type check, tests, and build on every pull request.
|
|
592
223
|
|
|
593
|
-
`npm run test:live`
|
|
224
|
+
`npm run test:live` exercises a real Dashboard: API tests (login, discovery, read-only execution, safety model, exit codes) plus validation that every jq expression and field name in `docs/workflows/` works against the real API. It runs read-only operations and `--dry-run` previews only, never mutations, and needs credentials:
|
|
594
225
|
|
|
595
226
|
```bash
|
|
596
227
|
export MAINWP_API_URL=https://your-dashboard.example.com
|
|
597
228
|
export MAINWP_USER=your-admin-username
|
|
598
|
-
export MAINWP_APP_PASSWORD=your-application-password
|
|
229
|
+
export MAINWP_APP_PASSWORD='your-application-password'
|
|
230
|
+
export MAINWP_DASHBOARD_URL="$MAINWP_API_URL"
|
|
599
231
|
|
|
600
232
|
npm run test:live
|
|
601
233
|
```
|
|
602
234
|
|
|
603
|
-
The
|
|
604
|
-
|
|
605
|
-
Live tests are safe: they only run read-only operations and `--dry-run` previews, never mutations.
|
|
606
|
-
|
|
607
|
-
---
|
|
235
|
+
The full acceptance harness, which packs and installs the CLI as a consumer would, is described in [Acceptance Testing](docs/acceptance-testing.md).
|
|
608
236
|
|
|
609
237
|
## License
|
|
610
238
|
|
|
611
|
-
GPL-3.0-or-later
|
|
612
|
-
|
|
613
|
-
---
|
|
614
|
-
|
|
615
|
-
## Requirements
|
|
616
|
-
|
|
617
|
-
- Node.js 20 LTS or later
|
|
618
|
-
- MainWP Dashboard 6+ with Abilities API
|
|
619
|
-
- WordPress Application Password
|
|
239
|
+
GPL-3.0-or-later. See [LICENSE](LICENSE).
|
|
620
240
|
|
|
621
241
|
---
|
|
622
242
|
|