@mainwp/control 1.1.0-beta.1 → 2.0.0

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.
Files changed (172) hide show
  1. package/CHANGELOG.md +177 -0
  2. package/README.md +162 -518
  3. package/dist/chat/chat-engine.d.ts +24 -54
  4. package/dist/chat/chat-engine.d.ts.map +1 -1
  5. package/dist/chat/chat-engine.js +367 -166
  6. package/dist/chat/chat-engine.js.map +1 -1
  7. package/dist/chat/context-window.d.ts +57 -0
  8. package/dist/chat/context-window.d.ts.map +1 -0
  9. package/dist/chat/context-window.js +94 -0
  10. package/dist/chat/context-window.js.map +1 -0
  11. package/dist/chat/providers/anthropic.d.ts +0 -4
  12. package/dist/chat/providers/anthropic.d.ts.map +1 -1
  13. package/dist/chat/providers/anthropic.js +67 -45
  14. package/dist/chat/providers/anthropic.js.map +1 -1
  15. package/dist/chat/providers/gemini.d.ts +2 -2
  16. package/dist/chat/providers/gemini.d.ts.map +1 -1
  17. package/dist/chat/providers/gemini.js +67 -43
  18. package/dist/chat/providers/gemini.js.map +1 -1
  19. package/dist/chat/providers/openai-compatible.d.ts +1 -1
  20. package/dist/chat/providers/openai-compatible.d.ts.map +1 -1
  21. package/dist/chat/providers/openai-compatible.js +91 -29
  22. package/dist/chat/providers/openai-compatible.js.map +1 -1
  23. package/dist/chat/providers/provider-fetch.d.ts +11 -0
  24. package/dist/chat/providers/provider-fetch.d.ts.map +1 -1
  25. package/dist/chat/providers/provider-fetch.js +86 -4
  26. package/dist/chat/providers/provider-fetch.js.map +1 -1
  27. package/dist/chat/providers/provider.d.ts +74 -1
  28. package/dist/chat/providers/provider.d.ts.map +1 -1
  29. package/dist/chat/providers/provider.js +112 -2
  30. package/dist/chat/providers/provider.js.map +1 -1
  31. package/dist/chat/providers/sse-reader.d.ts +3 -0
  32. package/dist/chat/providers/sse-reader.d.ts.map +1 -1
  33. package/dist/chat/providers/sse-reader.js +75 -15
  34. package/dist/chat/providers/sse-reader.js.map +1 -1
  35. package/dist/chat/system-prompt.d.ts +0 -2
  36. package/dist/chat/system-prompt.d.ts.map +1 -1
  37. package/dist/chat/system-prompt.js +10 -6
  38. package/dist/chat/system-prompt.js.map +1 -1
  39. package/dist/chat/tool-envelope.d.ts +3 -0
  40. package/dist/chat/tool-envelope.d.ts.map +1 -1
  41. package/dist/chat/tool-envelope.js +156 -10
  42. package/dist/chat/tool-envelope.js.map +1 -1
  43. package/dist/commands/abilities/info.d.ts.map +1 -1
  44. package/dist/commands/abilities/info.js +6 -3
  45. package/dist/commands/abilities/info.js.map +1 -1
  46. package/dist/commands/abilities/list.js +2 -2
  47. package/dist/commands/abilities/list.js.map +1 -1
  48. package/dist/commands/abilities/run.d.ts.map +1 -1
  49. package/dist/commands/abilities/run.js +147 -48
  50. package/dist/commands/abilities/run.js.map +1 -1
  51. package/dist/commands/chat.d.ts +12 -0
  52. package/dist/commands/chat.d.ts.map +1 -1
  53. package/dist/commands/chat.js +67 -42
  54. package/dist/commands/chat.js.map +1 -1
  55. package/dist/commands/config/show.d.ts.map +1 -1
  56. package/dist/commands/config/show.js +59 -47
  57. package/dist/commands/config/show.js.map +1 -1
  58. package/dist/commands/doctor.d.ts +0 -8
  59. package/dist/commands/doctor.d.ts.map +1 -1
  60. package/dist/commands/doctor.js +22 -36
  61. package/dist/commands/doctor.js.map +1 -1
  62. package/dist/commands/jobs/watch.d.ts +4 -0
  63. package/dist/commands/jobs/watch.d.ts.map +1 -1
  64. package/dist/commands/jobs/watch.js +66 -27
  65. package/dist/commands/jobs/watch.js.map +1 -1
  66. package/dist/commands/login.d.ts.map +1 -1
  67. package/dist/commands/login.js +59 -10
  68. package/dist/commands/login.js.map +1 -1
  69. package/dist/commands/profile/delete.d.ts.map +1 -1
  70. package/dist/commands/profile/delete.js +19 -3
  71. package/dist/commands/profile/delete.js.map +1 -1
  72. package/dist/commands/profile/list.d.ts.map +1 -1
  73. package/dist/commands/profile/list.js +6 -2
  74. package/dist/commands/profile/list.js.map +1 -1
  75. package/dist/commands/profile/use.d.ts.map +1 -1
  76. package/dist/commands/profile/use.js +4 -1
  77. package/dist/commands/profile/use.js.map +1 -1
  78. package/dist/config/fs-utils.d.ts.map +1 -1
  79. package/dist/config/fs-utils.js +19 -6
  80. package/dist/config/fs-utils.js.map +1 -1
  81. package/dist/config/keychain.d.ts +78 -6
  82. package/dist/config/keychain.d.ts.map +1 -1
  83. package/dist/config/keychain.js +194 -27
  84. package/dist/config/keychain.js.map +1 -1
  85. package/dist/config/profile-store.d.ts +11 -3
  86. package/dist/config/profile-store.d.ts.map +1 -1
  87. package/dist/config/profile-store.js +53 -19
  88. package/dist/config/profile-store.js.map +1 -1
  89. package/dist/core/abilities-executor.d.ts +42 -6
  90. package/dist/core/abilities-executor.d.ts.map +1 -1
  91. package/dist/core/abilities-executor.js +264 -67
  92. package/dist/core/abilities-executor.js.map +1 -1
  93. package/dist/core/batch-manager.d.ts +10 -5
  94. package/dist/core/batch-manager.d.ts.map +1 -1
  95. package/dist/core/batch-manager.js +78 -22
  96. package/dist/core/batch-manager.js.map +1 -1
  97. package/dist/core/execute-ability-with-policy.d.ts +8 -0
  98. package/dist/core/execute-ability-with-policy.d.ts.map +1 -0
  99. package/dist/core/execute-ability-with-policy.js +19 -0
  100. package/dist/core/execute-ability-with-policy.js.map +1 -0
  101. package/dist/core/http-client.d.ts +5 -1
  102. package/dist/core/http-client.d.ts.map +1 -1
  103. package/dist/core/http-client.js +118 -46
  104. package/dist/core/http-client.js.map +1 -1
  105. package/dist/core/job-id.d.ts +2 -0
  106. package/dist/core/job-id.d.ts.map +1 -0
  107. package/dist/core/job-id.js +22 -0
  108. package/dist/core/job-id.js.map +1 -0
  109. package/dist/core/preview-plan.d.ts +5 -0
  110. package/dist/core/preview-plan.d.ts.map +1 -0
  111. package/dist/core/preview-plan.js +247 -0
  112. package/dist/core/preview-plan.js.map +1 -0
  113. package/dist/core/safety-controller.d.ts +29 -10
  114. package/dist/core/safety-controller.d.ts.map +1 -1
  115. package/dist/core/safety-controller.js +154 -41
  116. package/dist/core/safety-controller.js.map +1 -1
  117. package/dist/lib/base-command.d.ts +20 -0
  118. package/dist/lib/base-command.d.ts.map +1 -1
  119. package/dist/lib/base-command.js +92 -35
  120. package/dist/lib/base-command.js.map +1 -1
  121. package/dist/output/formatter.d.ts +37 -1
  122. package/dist/output/formatter.d.ts.map +1 -1
  123. package/dist/output/formatter.js +111 -16
  124. package/dist/output/formatter.js.map +1 -1
  125. package/dist/output/json-envelope.d.ts.map +1 -1
  126. package/dist/output/json-envelope.js +8 -5
  127. package/dist/output/json-envelope.js.map +1 -1
  128. package/dist/utils/audit-logger.d.ts +26 -8
  129. package/dist/utils/audit-logger.d.ts.map +1 -1
  130. package/dist/utils/audit-logger.js +93 -20
  131. package/dist/utils/audit-logger.js.map +1 -1
  132. package/dist/utils/error-sanitizer.d.ts +6 -0
  133. package/dist/utils/error-sanitizer.d.ts.map +1 -0
  134. package/dist/utils/error-sanitizer.js +120 -0
  135. package/dist/utils/error-sanitizer.js.map +1 -0
  136. package/dist/utils/errors.d.ts +12 -0
  137. package/dist/utils/errors.d.ts.map +1 -1
  138. package/dist/utils/errors.js +14 -0
  139. package/dist/utils/errors.js.map +1 -1
  140. package/dist/utils/format.d.ts +68 -0
  141. package/dist/utils/format.d.ts.map +1 -1
  142. package/dist/utils/format.js +668 -0
  143. package/dist/utils/format.js.map +1 -1
  144. package/dist/utils/prompt.d.ts.map +1 -1
  145. package/dist/utils/prompt.js +28 -23
  146. package/dist/utils/prompt.js.map +1 -1
  147. package/dist/utils/redaction.d.ts +21 -0
  148. package/dist/utils/redaction.d.ts.map +1 -0
  149. package/dist/utils/redaction.js +85 -0
  150. package/dist/utils/redaction.js.map +1 -0
  151. package/dist/utils/retry.d.ts +0 -4
  152. package/dist/utils/retry.d.ts.map +1 -1
  153. package/dist/utils/retry.js +0 -9
  154. package/dist/utils/retry.js.map +1 -1
  155. package/dist/utils/terminal-sanitizer.d.ts +21 -0
  156. package/dist/utils/terminal-sanitizer.d.ts.map +1 -1
  157. package/dist/utils/terminal-sanitizer.js +80 -14
  158. package/dist/utils/terminal-sanitizer.js.map +1 -1
  159. package/dist/validation/input-sanitizer.d.ts +0 -4
  160. package/dist/validation/input-sanitizer.d.ts.map +1 -1
  161. package/dist/validation/input-sanitizer.js +15 -64
  162. package/dist/validation/input-sanitizer.js.map +1 -1
  163. package/dist/validation/sanitize-schema.d.ts +31 -0
  164. package/dist/validation/sanitize-schema.d.ts.map +1 -0
  165. package/dist/validation/sanitize-schema.js +158 -0
  166. package/dist/validation/sanitize-schema.js.map +1 -0
  167. package/dist/validation/schema-validator.d.ts +10 -0
  168. package/dist/validation/schema-validator.d.ts.map +1 -1
  169. package/dist/validation/schema-validator.js +50 -5
  170. package/dist/validation/schema-validator.js.map +1 -1
  171. package/oclif.manifest.json +96 -74
  172. package/package.json +25 -8
package/README.md CHANGED
@@ -1,615 +1,259 @@
1
- # MainWP Control
2
-
3
- A CLI for managing your MainWP Dashboard from the terminal. List sites, push updates, sync data, run batch operations across dozens of sites. The command is `mainwpcontrol`.
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
- > **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).
12
-
13
- 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/).
14
-
15
- ```bash
16
- npm install -g @mainwp/control
17
-
18
- mainwpcontrol login
19
-
20
- mainwpcontrol abilities list
21
- ```
22
-
23
- You should see something like this:
24
-
25
- ```text
26
- Abilities (87 total)
27
-
28
- Sites
29
- Name Description Type
30
- ---------------- -------------------- --------------
31
- list-sites-v1 List MainWP sites 📖 read
32
- mainwpcontrol abilities run list-sites-v1
33
- get-site-v1 Get site details 📖 read
34
- mainwpcontrol abilities run get-site-v1
35
- sync-sites-v1 Sync all sites ✏️ write
36
- mainwpcontrol abilities run sync-sites-v1
37
- ```
38
-
39
- That's it. You're connected and you can see every operation your Dashboard supports.
40
-
41
- ---
42
-
43
- ## What Just Happened
44
-
45
- `abilities list` shows every operation available on your Dashboard. These are called "abilities" and they cover sites, plugins, themes, updates, clients, tags, and more.
1
+ <p align="center">
2
+ <img src="https://raw.githubusercontent.com/mainwp/mainwp-control/main/docs/images/mainwp-control-logo-2026.png" alt="MainWP Control" width="400">
3
+ </p>
4
+
5
+ <p align="center">
6
+ <strong>Run updates, syncs, backups, and health checks across every WordPress site in your MainWP Dashboard from scripts, cron, and CI.</strong>
7
+ </p>
8
+
9
+ <p align="center">
10
+ <a href="https://mainwp.com/mainwp-tools/mainwp-control/">Website</a> ·
11
+ <a href="https://mainwp.com/mainwp-ai/">MainWP AI</a> ·
12
+ <a href="https://docs.mainwp.com/api-reference/mainwp-control">Documentation</a> ·
13
+ <a href="https://github.com/mainwp/mainwp-control/tree/main/docs/workflows">Workflows</a> ·
14
+ <a href="https://community.mainwp.com/">Community</a> ·
15
+ <a href="https://mainwpinvite.com/">Discord</a> ·
16
+ <a href="https://mainwp.com/mainwp-support/">Support</a>
17
+ </p>
18
+
19
+ <p align="center">
20
+ <a href="https://www.npmjs.com/package/@mainwp/control"><img src="https://img.shields.io/npm/v/@mainwp/control" alt="npm version"></a>
21
+ <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>
22
+ <a href="https://github.com/mainwp/mainwp-control/blob/main/LICENSE"><img src="https://img.shields.io/badge/license-GPL--3.0--or--later-blue" alt="License: GPL-3.0-or-later"></a>
23
+ </p>
46
24
 
47
- Each ability has a name (like `list-sites-v1`) that you pass to `abilities run` to execute it. The list tells you whether each one is read-only, a write operation, or destructive.
48
-
49
- ---
50
-
51
- ## Common Use Cases
52
-
53
- **List all your sites:**
54
-
55
- ```bash
56
- mainwpcontrol abilities run list-sites-v1 --json
57
- ```
25
+ # MainWP Control
58
26
 
59
- **Check for pending updates across sites:**
27
+ [MainWP Control](https://mainwp.com/mainwp-tools/mainwp-control/) (`@mainwp/control`) is the official command-line interface for your self-hosted MainWP Dashboard. It is built for WordPress professionals and agencies who want weekly checks, backups, and update rounds running reliably on a schedule instead of in a browser tab:
60
28
 
61
29
  ```bash
30
+ # Which sites have pending updates?
62
31
  mainwpcontrol abilities run list-updates-v1 --json
63
- ```
64
32
 
65
- **Get details for a specific site:**
33
+ # Sync every site and wait for it to finish
34
+ mainwpcontrol abilities run sync-sites-v1 --wait --json
66
35
 
67
- ```bash
68
- mainwpcontrol abilities run get-site-v1 --input '{"site_id_or_domain": 1}' --json
36
+ # Nightly from cron: alert Slack if any site is disconnected
37
+ mainwpcontrol abilities run list-sites-v1 \
38
+ --input '{"status":"disconnected","per_page":1}' --json \
39
+ | jq -e '.data.data.total == 0' >/dev/null \
40
+ || curl -fsS "$SLACK_WEBHOOK" -d '{"text":"Sites need attention"}'
69
41
  ```
70
42
 
71
- > **Windows?** This works as-is in [Git Bash](https://gitforwindows.org/). In PowerShell, escape the inner quotes: `'{\"site_id_or_domain\": 1}'`. Or skip quoting entirely with `--input-file` ([details](docs/workflows/input-from-file.md)).
43
+ MainWP Control runs on your own computer, server, or CI runner and connects straight to your Dashboard over HTTPS, with no MainWP service in between. Your client sites keep running the MainWP Child plugin they already have, with no extra plugins to install. Destructive actions such as updates, restores, and deletions show a readable plan first and wait for your explicit confirmation.
72
44
 
73
- **Preview a destructive action before running it:**
45
+ <p align="center">
46
+ <img src="https://raw.githubusercontent.com/mainwp/mainwp-control/main/docs/images/mainwp-control-fleet-from-the-terminal.png" alt="Dark MainWP branded card titled Your WordPress fleet from the terminal showing a terminal listing Dashboard abilities, running sync-sites-v1 with --wait and --json to a success envelope, and checking exit code 0" width="800">
47
+ </p>
74
48
 
75
- ```bash
76
- mainwpcontrol abilities run delete-site-v1 \
77
- --input '{"site_id_or_domain": "mysite.com"}' \
78
- --dry-run --json
79
- ```
80
-
81
- Nothing changes until you explicitly pass `--confirm`.
82
-
83
- **Update plugins and wait for completion:**
49
+ ## Pick the right tool for the job
84
50
 
85
- ```bash
86
- mainwpcontrol abilities run update-site-plugins-v1 \
87
- --input '{"site_id": 1}' \
88
- --wait --json
89
- ```
51
+ All three free MainWP tools connect to the same WordPress Abilities API on your MainWP Dashboard with preview-and-confirm guardrails:
90
52
 
91
- `--wait` blocks until the operation finishes. Useful in CI pipelines.
53
+ | Tool | Best for | Where it runs |
54
+ | --- | --- | --- |
55
+ | **MainWP Control** *(this package)* | Cron jobs, shell scripts, CI/CD pipelines, monitoring agents, and repeatable batch runs with structured JSON and exit codes (plus optional terminal chat) | Your computer, server, or CI runner |
56
+ | **[MainWP MCP](https://github.com/mainwp/mainwp-mcp)** | Conversational site management in Claude, ChatGPT, Cursor, VS Code Copilot, or OpenAI Codex | Local `@mainwp/mcp` server, or [a direct connection to your Dashboard](https://docs.mainwp.com/mcp-server/remote/overview) over HTTPS |
57
+ | **[MainWP Assistant](https://docs.mainwp.com/dashboard/mainwp-assistant/overview)** | Quick MainWP documentation answers (with no AI key) and site checks inside your Dashboard | **Assistant** in your Dashboard sidebar |
92
58
 
93
- ---
59
+ ## Quick Start
94
60
 
95
- ## Installation
61
+ ### Requirements
96
62
 
97
- ### Standard install (recommended)
63
+ - **MainWP Dashboard 6.4.2 or later** on **WordPress 6.9 or later**, reachable over HTTPS
64
+ - **MainWP Child** on your client sites
65
+ - **Node.js 20.18.1 or later** (macOS, Linux, Windows, or CI runners)
98
66
 
99
- Pre-built keychain binaries are included for macOS, Windows, and Linux (x64 and arm64). On other platforms you may need C++ build tools during installation.
67
+ > **On Windows?** Use [Git Bash](https://gitforwindows.org/) to run every example below as written. For scheduled jobs, use [WSL](https://learn.microsoft.com/en-us/windows/wsl/install) or GitHub Actions.
100
68
 
101
- ```bash
102
- npm install -g @mainwp/control
69
+ ### Guided setup or manual setup
103
70
 
104
- # Interactive login (stores credentials in your OS keychain)
105
- mainwpcontrol login
106
- ```
71
+ In your MainWP Dashboard, open **AI > MainWP Control** for a guided four-step setup that creates an Application Password and gives ready-to-copy install and test commands. To configure from the terminal directly:
107
72
 
108
- ### Environment variable auth (CI, Docker, headless)
73
+ **1. Create an Application Password.** In your Dashboard, open **API Access > Application Passwords** (or **Users > Profile > Application Passwords** in WordPress admin), add one named "MainWP Control", and copy it right away. A dedicated WordPress user for automation keeps your audit trail clean and its access easy to revoke.
109
74
 
110
- Use this when no OS keychain is available, or if keytar fails to build.
75
+ **2. Install and sign in.**
111
76
 
112
77
  ```bash
113
78
  npm install -g @mainwp/control
114
79
 
115
- export MAINWP_APP_PASSWORD='xxxx xxxx xxxx xxxx xxxx xxxx'
116
-
117
- mainwpcontrol login --url https://dashboard.example.com --username admin
80
+ mainwpcontrol login
118
81
  ```
119
82
 
120
- When the OS keychain is unavailable, credentials are not stored on disk. Keep `MAINWP_APP_PASSWORD` set for each run.
121
-
122
- If keytar is installed but broken, set `MAINWPCONTROL_NO_KEYTAR=1` to skip loading it.
123
-
124
- ---
125
-
126
- <details>
127
- <summary><strong>New to the Command Line?</strong></summary>
128
-
129
- If you haven't used a terminal before, here's what you need to know.
83
+ `login` prompts for your Dashboard URL, username, and Application Password, then stores the credential in your OS keychain. For CI and headless servers, use [environment variable auth](https://github.com/mainwp/mainwp-control/blob/main/docs/configuration.md#environment-variable-auth).
130
84
 
131
- ### What is a terminal?
85
+ **3. Discover abilities and run your first check.**
132
86
 
133
- A terminal is where you type commands instead of clicking buttons. You'll see it called "command line" or "shell" in different places.
134
-
135
- **How to open it:**
136
- - **macOS**: Open **Terminal** (search in Spotlight, or look in Applications > Utilities)
137
- - **Windows**: Open **Git Bash** (installed with [Git for Windows](https://gitforwindows.org/)). If you don't have it, PowerShell works too — see the [quoting notes](#json-quoting-on-the-command-line) below.
138
- - **Linux**: Open your distribution's **Terminal** app (usually in the applications menu)
139
-
140
- ### What does `npm install -g` do?
141
-
142
- `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.
143
-
144
- ### What is an environment variable?
145
-
146
- An environment variable is a named value that programs can read. They're commonly used for passwords and API keys.
147
-
148
- **Setting one:**
149
87
  ```bash
150
- # macOS / Linux (lasts until you close the terminal)
151
- export MAINWP_APP_PASSWORD='xxxx xxxx xxxx xxxx xxxx xxxx'
152
-
153
- # Windows PowerShell (lasts until you close the window)
154
- $env:MAINWP_APP_PASSWORD = 'xxxx xxxx xxxx xxxx xxxx xxxx'
88
+ mainwpcontrol abilities list --category mainwp-sites
155
89
  ```
156
90
 
157
- 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.
158
-
159
- ### What is an Application Password?
160
-
161
- 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`).
162
-
163
- **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.
164
-
165
- ### Reading command output
166
-
167
- When you run a command, the output appears in your terminal. A few things to know:
168
-
169
- - **`--json`** tells `mainwpcontrol` to output structured JSON (useful for scripting and piping to other tools)
170
- - **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.
171
-
172
- ### JSON quoting on the command line
173
-
174
- When you pass JSON with `--input`, quoting depends on your shell:
175
-
176
- ```bash
177
- # macOS / Linux / Git Bash on Windows
178
- mainwpcontrol abilities run get-site-v1 --input '{"site_id_or_domain": 1}' --json
179
-
180
- # Windows PowerShell
181
- mainwpcontrol abilities run get-site-v1 --input '{\"site_id_or_domain\": 1}' --json
182
- ```
183
-
184
- **Git Bash on Windows** (comes with [Git for Windows](https://gitforwindows.org/)) handles quoting the same way macOS and Linux do. If you use Git Bash, all the examples in this documentation work without changes.
185
-
186
- PowerShell strips the inner double quotes unless you escape them with backslashes. If this gets annoying, put your parameters in a file and use `--input-file`:
91
+ ```text
92
+ Abilities (30 total)
187
93
 
188
- ```bash
189
- mainwpcontrol abilities run get-site-v1 --input-file params.json --json
94
+ mainwp-sites
95
+ Name Description Type
96
+ -------------------- ----------------- ---------
97
+ mainwp/list-sites-v1 List MainWP Sites 📖 read
98
+ mainwpcontrol abilities run list-sites-v1
99
+ mainwp/get-site-v1 Get MainWP Site 📖 read
100
+ mainwpcontrol abilities run get-site-v1 --input '{"site_id_or_domain":1}'
101
+ mainwp/sync-sites-v1 Sync MainWP Sites ✏️ write
102
+ mainwpcontrol abilities run sync-sites-v1
103
+ ...
190
104
  ```
191
105
 
192
- This works the same on every platform. See [Input from File](docs/workflows/input-from-file.md) for details.
193
-
194
- </details>
195
-
196
- ---
197
-
198
- ## Basic Usage
199
-
200
- ### Abilities
201
-
202
- 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`.
106
+ Run `mainwpcontrol abilities list` on its own to see every core and active add-on ability on your Dashboard, with its read, write, or destructive label and exact run command. Try a read-only check right away:
203
107
 
204
108
  ```bash
205
- # List all abilities
206
- mainwpcontrol abilities list
207
-
208
- # Filter by category
209
- mainwpcontrol abilities list --category sites
210
-
211
- # Get full details and input schema for an ability
212
- mainwpcontrol abilities info list-sites-v1
213
-
214
- # Run an ability
215
109
  mainwpcontrol abilities run list-sites-v1 --json
216
-
217
- # Run with input parameters
218
- mainwpcontrol abilities run get-site-v1 --input '{"site_id_or_domain": 1}' --json
219
-
220
- # Windows PowerShell: escape inner quotes (Git Bash doesn't need this)
221
- mainwpcontrol abilities run get-site-v1 --input '{\"site_id_or_domain\": 1}' --json
222
-
223
- # Or use a file (works everywhere)
224
- mainwpcontrol abilities run get-site-v1 --input-file params.json --json
225
- ```
226
-
227
- ### Profiles
228
-
229
- 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.
230
-
231
- ```bash
232
- # List all profiles
233
- mainwpcontrol profile list
234
-
235
- # Switch active profile
236
- mainwpcontrol profile use production.example.com
237
-
238
- # Use a profile for one command without switching
239
- mainwpcontrol abilities list --profile staging.example.com
240
-
241
- # Delete a profile and its keychain credentials
242
- mainwpcontrol profile delete staging.example.com
243
- ```
244
-
245
- ### Diagnostics
246
-
247
- `doctor` checks your configuration, credentials, and Dashboard connectivity. Run it first if something isn't working.
248
-
249
- ```bash
250
- # Check configuration and connectivity
251
- mainwpcontrol doctor
252
-
253
- # Verbose output
254
- mainwpcontrol doctor -v
255
-
256
- # JSON output
257
- mainwpcontrol doctor --json
258
110
  ```
259
111
 
260
- ### Chat Mode
261
-
262
- 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.
263
-
264
- Set one of these environment variables to enable it:
265
-
266
- ```bash
267
- # Pick one (Anthropic, OpenAI, Google, or OpenRouter)
268
- export ANTHROPIC_API_KEY='sk-ant-...'
269
-
270
- mainwpcontrol chat
271
- mainwpcontrol chat "list all sites with pending updates"
272
- ```
273
-
274
- See [Chat Mode Configuration](#chat-mode-configuration) for all supported providers and flags.
275
-
276
- ### Global Flags
277
-
278
- These flags work on every command.
279
-
280
- | Flag | Description |
281
- |------|-------------|
282
- | `--json` | Structured JSON output |
283
- | `--quiet` / `-q` | Suppress output (exit code only) |
284
- | `--profile <name>` | Use a specific profile |
285
- | `--debug` | Show redacted debug diagnostics on stderr |
286
- | `--help` | Show help |
287
-
288
- ### Abilities Run Flags
289
-
290
- Extra flags for `abilities run`. These control input, safety checks, and batch job behavior.
291
-
292
- | Flag | Description |
293
- |------|-------------|
294
- | `--input` / `-i` | Input parameters as JSON (use `-` for stdin) |
295
- | `--input-file` | Read input from a JSON file |
296
- | `--dry-run` | Preview changes without executing |
297
- | `--confirm` | Execute a destructive ability |
298
- | `--force` | Skip interactive confirmation (CI mode) |
299
- | `--wait` | Block until batch job completes |
300
- | `--wait-timeout` | Max seconds to wait (default: 300) |
301
-
302
- ---
303
-
304
- ## Concepts
305
-
306
- ### Abilities
307
-
308
- Abilities are the operations your MainWP Dashboard exposes through its REST API. Each one has:
112
+ > **New to the command line?** [Getting Started](https://github.com/mainwp/mainwp-control/blob/main/docs/getting-started.md) covers terminals, npm, Application Passwords, environment variables, and JSON quoting.
309
113
 
310
- - A versioned name (e.g., `list-sites-v1`, `delete-site-v1`)
311
- - An input schema (what parameters it accepts)
312
- - Annotations that tell you what kind of operation it is
114
+ ## Why a CLI for your WordPress network?
313
115
 
314
- The annotations matter:
315
- - **Readonly**: Safe to run anytime. Cannot modify data.
316
- - **Destructive**: Permanently changes or deletes data. Requires `--dry-run` preview, then `--confirm` to execute.
317
- - **Idempotent**: Safe to re-run. Same result on repeated calls.
116
+ Your MainWP Dashboard UI is built for hands-on sessions. MainWP Control is built for repeatable care-plan routines that run unattended and protect your client sites:
318
117
 
319
- Run `mainwpcontrol abilities info <name>` to see the full schema and annotations for any ability.
118
+ - **Scriptable JSON output.** `--json` prints one clean envelope on stdout while progress and warnings stay on stderr, ready to pipe straight into `jq`, a spreadsheet, or a monitoring agent.
119
+ - **Predictable exit codes.** Outcomes map to exit codes `0` through `5` by error class (input, auth, network, API, internal), plus standard signal exits (`130` and `143`), so pipelines branch cleanly on status codes.
120
+ - **Resumable batch jobs.** Large multi-site operations queue on your Dashboard and return a `job_id`. Pass `--wait` or run `mainwpcontrol jobs watch <job-id>` to follow progress or reconnect to a running job later.
121
+ - **Readable previews before changes.** `--dry-run` prints the plan site by site: each version change, anything held back, and the backup check result, with errors and warnings from your Dashboard at the top. Every confirmed run is written to a local audit log.
122
+ - **Credentials bound to your Dashboard.** Interactive logins store your Application Password in your OS keychain (macOS Keychain, Windows Credential Manager, or Linux libsecret). Headless and CI jobs pair `MAINWP_APP_PASSWORD` with `MAINWP_DASHBOARD_URL` so credentials stay scoped to your named Dashboard.
320
123
 
321
- ### Profiles
322
-
323
- 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).
324
-
325
- Running `mainwpcontrol login` creates a profile automatically, named after the Dashboard hostname:
124
+ ## Everyday commands
326
125
 
327
126
  ```bash
328
- # Creates profile "staging.example.com"
329
- mainwpcontrol login --url https://staging.example.com --username admin
330
-
331
- # Creates profile "production.example.com"
332
- mainwpcontrol login --url https://production.example.com --username admin
333
- ```
334
-
335
- The profile file at `~/.config/mainwpcontrol/profiles.json` never contains passwords.
336
-
337
- ### Safety Model
127
+ # Check for pending updates across all sites
128
+ mainwpcontrol abilities run list-updates-v1 --json
338
129
 
339
- Destructive operations follow a two-step pattern: preview first, then execute.
130
+ # Get details for one site
131
+ mainwpcontrol abilities run get-site-v1 --input '{"site_id_or_domain": 1}' --json
340
132
 
341
- ```bash
342
- # Step 1: Preview (nothing changes)
133
+ # Preview a destructive action first; nothing changes until you pass --confirm
343
134
  mainwpcontrol abilities run delete-site-v1 \
344
135
  --input '{"site_id_or_domain": "mysite.com"}' \
345
136
  --dry-run --json
346
137
 
347
- # Step 2: Execute after reviewing the preview
348
- mainwpcontrol abilities run delete-site-v1 \
349
- --input '{"site_id_or_domain": "mysite.com"}' \
350
- --confirm --force --json
351
- ```
352
-
353
- `--dry-run` and `--confirm` are mutually exclusive. You cannot pass both.
354
-
355
- In CI/scripted workflows where you've already validated the operation, pass `--confirm --force` directly to skip the interactive prompt.
356
-
357
- ### Batch Jobs
138
+ # Preview plugin updates, then confirm and wait for completion
139
+ # (--force skips the interactive prompt in CI while keeping preview validation)
140
+ mainwpcontrol abilities run update-site-plugins-v1 \
141
+ --input '{"site_id_or_domain": 1}' --dry-run --json
142
+ mainwpcontrol abilities run update-site-plugins-v1 \
143
+ --input '{"site_id_or_domain": 1}' --confirm --force --wait --json
358
144
 
359
- Operations that affect many items (200+) are automatically queued as batch jobs. The command returns a `job_id` immediately, and you can watch progress:
145
+ # Inspect the input schema and safety annotations for any ability
146
+ mainwpcontrol abilities info update-site-plugins-v1
360
147
 
361
- ```bash
362
- mainwpcontrol jobs watch <job-id>
363
-
364
- # With a timeout
365
- mainwpcontrol jobs watch <job-id> --timeout 120
148
+ # Check configuration, credentials, and Dashboard connectivity
149
+ mainwpcontrol doctor
366
150
  ```
367
151
 
368
- Or use `--wait` on the original command to block until completion:
152
+ Managing more than one Dashboard? Each `login` saves a profile named after its hostname. Switch defaults with `mainwpcontrol profile use <name>` or target one per command with `--profile <name>`. See the [CLI Reference](https://github.com/mainwp/mainwp-control/blob/main/docs/cli-reference.md#profile).
369
153
 
370
- ```bash
371
- mainwpcontrol abilities run sync-sites-v1 --wait --wait-timeout 300 --json
372
- ```
154
+ > **Using Windows PowerShell?** Put JSON parameters in a file and pass `--input-file` for consistent quoting across shells. See [Input from File](https://github.com/mainwp/mainwp-control/blob/main/docs/workflows/input-from-file.md).
373
155
 
374
- ---
156
+ ## What you can automate
375
157
 
376
- ## Advanced Usage
158
+ Your MainWP Dashboard registers over 100 core abilities across ten categories in the free MainWP Core, plus abilities from active MainWP add-ons. MainWP Control discovers them at runtime, so new abilities are ready as soon as your Dashboard has them, with no CLI update:
377
159
 
378
- ### CI/CD Patterns
160
+ - **Sites (`mainwp-sites`):** list, count, sync, check connectivity, add, update, reconnect, suspend, or remove child sites; inspect security, changes, and site costs; manage installed or abandoned plugins and themes, activate or deactivate plugins, switch themes, and delete retired ones ([Sites Abilities](https://docs.mainwp.com/api-reference/abilities-api/sites))
161
+ - **Built-In Backups (`mainwp-backups`):** check backup status and history, run backups, manage backup tasks, snapshots, and storage destinations, and monitor or roll back restores ([Backup Abilities](https://docs.mainwp.com/api-reference/abilities-api/backups))
162
+ - **Updates (`mainwp-updates`):** list pending core, plugin, theme, and translation updates, manage ignored updates, and preview and apply updates on one site or across your network ([Updates Abilities](https://docs.mainwp.com/api-reference/abilities-api/updates))
163
+ - **Clients (`mainwp-clients`):** manage client records, site assignments, and client status, and view read-only client costs when Cost Tracker is active ([Clients Abilities](https://docs.mainwp.com/api-reference/abilities-api/clients))
164
+ - **Tags (`mainwp-tags`):** create, update, and delete tags, and list tagged sites and clients ([Tags Abilities](https://docs.mainwp.com/api-reference/abilities-api/tags))
165
+ - **Knowledge (`mainwp-knowledge`):** read and manage Agency, Client, and Site Context, Skills, and Memory records ([MainWP Knowledge](https://docs.mainwp.com/dashboard/overview/mainwp-knowledge))
166
+ - **Insights, Fleet, and Monitoring (`mainwp-insights`, `mainwp-fleet`, `mainwp-monitoring`):** pull uptime stats and downtime incidents, query Network Activity logs and summaries, view upcoming renewals when Cost Tracker is active, and check WordPress, PHP, and MySQL versions across your sites ([Abilities API Overview](https://docs.mainwp.com/api-reference/abilities-api/overview))
167
+ - **Batch Operations (`mainwp-batch`):** poll and resume queued multi-site jobs ([Batch Operations](https://docs.mainwp.com/api-reference/abilities-api/batch-operations))
168
+ - **Chat mode (optional):** query your Dashboard in plain English from the terminal using your own Anthropic, OpenAI, Google Gemini, or OpenRouter key, or a local model, through the same preview-and-confirm safety path ([Chat Mode](https://github.com/mainwp/mainwp-control/blob/main/docs/chat.md))
379
169
 
380
- ```bash
381
- # Non-interactive login
382
- export MAINWP_APP_PASSWORD='xxxx xxxx xxxx xxxx xxxx xxxx'
383
- mainwpcontrol login --url https://dashboard.example.com --username admin
170
+ Run `mainwpcontrol abilities list` to inspect every ability on your Dashboard, `mainwpcontrol abilities info <name>` to see its input schema and annotations, and `mainwpcontrol abilities run <name>` to execute it.
384
171
 
385
- # Silent execution with exit codes
386
- mainwpcontrol abilities run list-sites-v1 --json --quiet
387
- echo "Exit code: $?"
172
+ ## Safety and previews
388
173
 
389
- # Pipeline branching on exit codes
390
- if mainwpcontrol abilities run check-sites-v1 --json --quiet; then
391
- echo "All sites healthy"
392
- else
393
- echo "Issues detected"
394
- fi
395
- ```
174
+ Every ability carries annotations classifying it as read, write, or destructive, backed by a conservative name-based override for deletions, updates, restores, and rollbacks. Destructive operations run in two steps:
396
175
 
397
- ### Input from Files and Stdin
176
+ 1. **`--dry-run`** previews what your MainWP Dashboard reports will change. Update previews list each site's version changes, held-back items, and backup check result. A preview for one site, tag, or client names it. Errors and warnings from your Dashboard come first.
177
+ 2. **`--confirm`** runs a fresh preview first and executes once that preview succeeds. Each confirmed run is written to a local audit log before it is sent.
398
178
 
399
- ```bash
400
- # From a JSON file
401
- mainwpcontrol abilities run update-site-plugins-v1 --input-file params.json --json
179
+ Validated pipelines can pass `--confirm --force` per command to skip the interactive prompt while keeping preview checks and audit logging active. Chat mode runs through the same execution path, so a model can propose a destructive change and you confirm it in your terminal. Full details live in [Safety & Destructive Operations](https://github.com/mainwp/mainwp-control/blob/main/docs/safety.md).
402
180
 
403
- # From stdin
404
- echo '{"site_id_or_domain": 1}' | mainwpcontrol abilities run get-site-v1 --input - --json
181
+ ## Configuration for CI and headless runners
405
182
 
406
- # Heredoc
407
- mainwpcontrol abilities run get-site-v1 --input - --json <<EOF
408
- {"site_id_or_domain": 1}
409
- EOF
410
- ```
411
-
412
- ### Chat Mode Configuration
413
-
414
- Chat requires one of these environment variables:
415
-
416
- | Variable | Provider |
417
- |----------|----------|
418
- | `ANTHROPIC_API_KEY` | Anthropic Claude |
419
- | `OPENAI_API_KEY` | OpenAI GPT |
420
- | `GOOGLE_API_KEY` | Google Gemini |
421
- | `OPENROUTER_API_KEY` | OpenRouter |
422
- | `LOCAL_LLM_API_KEY` | Local LLM (with optional `LOCAL_LLM_URL`) |
183
+ Interactive use works right after `mainwpcontrol login`. For CI, Docker, and headless machines, supply your Application Password and its matching Dashboard URL through environment variables:
423
184
 
424
- Additional chat flags: `--provider`, `--model`, `--max-turns`, `--max-context-messages`, `--no-stream`.
425
-
426
- In non-TTY environments (pipes, CI), `mainwpcontrol chat` without a message argument exits with guidance instead of hanging.
427
-
428
- ### Shell Completion
185
+ | Variable | Description |
186
+ | --- | --- |
187
+ | `MAINWP_APP_PASSWORD` | Application Password for non-interactive login and headless runs |
188
+ | `MAINWP_DASHBOARD_URL` | Your Dashboard URL that `MAINWP_APP_PASSWORD` belongs to, required whenever a command authenticates from the environment |
189
+ | `MAINWPCONTROL_NO_KEYTAR` | Set to `1` to skip OS keychain loading |
190
+ | `MAINWP_ALLOW_HTTP` | Set to `1` to allow `http://` Dashboard URLs for local development |
429
191
 
430
192
  ```bash
431
- # Bash
432
- source /path/to/mainwp-control/scripts/completions/mainwpcontrol.bash
433
-
434
- # Zsh
435
- source /path/to/mainwp-control/scripts/completions/mainwpcontrol.zsh
193
+ export MAINWP_APP_PASSWORD='xxxx xxxx xxxx xxxx xxxx xxxx'
194
+ export MAINWP_DASHBOARD_URL='https://dashboard.example.com'
195
+ mainwpcontrol login --url https://dashboard.example.com --username admin
196
+ mainwpcontrol abilities list
436
197
  ```
437
198
 
438
- ### Configuration File
199
+ When `MAINWP_APP_PASSWORD` is set, the CLI sends it to your Dashboard URL in `MAINWP_DASHBOARD_URL` and stops if the target differs, matching the host binding used by the OS keychain. Optional defaults (JSON output, timeouts, chat provider) live in `~/.config/mainwpcontrol/settings.json`. See the [Configuration guide](https://github.com/mainwp/mainwp-control/blob/main/docs/configuration.md) for every setting and chat provider variable.
439
200
 
440
- Settings live at `~/.config/mainwpcontrol/settings.json`:
201
+ ## Documentation and workflows
441
202
 
442
- ```json
443
- {
444
- "defaultJsonOutput": true,
445
- "timeout": 30000,
446
- "debug": false,
447
- "llmProvider": "openai",
448
- "chatContextMessages": 20
449
- }
450
- ```
203
+ Full CLI guides live in the repository and at [docs.mainwp.com/api-reference/mainwp-control](https://docs.mainwp.com/api-reference/mainwp-control):
451
204
 
452
- ### Workflow Guides
205
+ - [Getting Started](https://github.com/mainwp/mainwp-control/blob/main/docs/getting-started.md): terminals, npm, Application Passwords, and JSON quoting
206
+ - [CLI Reference](https://github.com/mainwp/mainwp-control/blob/main/docs/cli-reference.md): every command, flag, shell completion, and exit code
207
+ - [Configuration](https://github.com/mainwp/mainwp-control/blob/main/docs/configuration.md): profiles, `settings.json`, environment variables, and credential storage
208
+ - [Safety & Destructive Operations](https://github.com/mainwp/mainwp-control/blob/main/docs/safety.md): preview-and-confirm rules, ability classification, batch jobs, and audit logging
209
+ - [Chat Mode](https://github.com/mainwp/mainwp-control/blob/main/docs/chat.md): plain-English terminal chat with your own LLM API key or local model
210
+ - [Troubleshooting](https://github.com/mainwp/mainwp-control/blob/main/docs/troubleshooting.md): install, connection, and authentication diagnostics
211
+ - [Changelog](https://github.com/mainwp/mainwp-control/blob/main/CHANGELOG.md): release history and 2.0.0 upgrade notes
453
212
 
454
- Step-by-step guides for common automation patterns:
213
+ Step-by-step automation guides in [docs/workflows](https://github.com/mainwp/mainwp-control/tree/main/docs/workflows):
455
214
 
456
215
  | Workflow | Description |
457
- |----------|-------------|
458
- | [Daily Health Check](docs/workflows/daily-health-check.md) | Cron job that checks site connectivity and alerts via Slack |
459
- | [Plugin Deployment Verification](docs/workflows/plugin-deployment-verification.md) | GitHub Actions workflow to verify a plugin exists across all sites |
460
- | [Monthly Batch Updates](docs/workflows/monthly-batch-updates.md) | Preview and apply updates safely, scripted and GitHub Actions variants |
461
- | [Input from File](docs/workflows/input-from-file.md) | Pass complex parameters via JSON files, stdin pipes, or heredocs |
462
- | [Monitoring Integration](docs/workflows/monitoring-integration.md) | Send site metrics to Datadog, StatsD, or other monitoring tools |
463
-
464
- ---
465
-
466
- ## Reference
467
-
468
- ### Exit Codes
469
-
470
- | Code | Meaning | CI Usage |
471
- |------|---------|----------|
472
- | 0 | Success | Continue pipeline |
473
- | 1 | User/input error | Fix command syntax |
474
- | 2 | Auth/config error | Check credentials |
475
- | 3 | Network error | Retry or check connectivity |
476
- | 4 | API error | Check ability parameters |
477
- | 5 | Internal error | Report bug |
478
-
479
- ### Environment Variables
480
-
481
- #### MainWP Configuration
482
-
483
- | Variable | Description |
484
- |----------|-------------|
485
- | `MAINWP_APP_PASSWORD` | Application password for non-interactive login and commands when keychain is unavailable |
486
- | `MAINWPCONTROL_NO_KEYTAR` | Set to `1` to skip keytar (keychain) loading entirely |
487
- | `MAINWP_ALLOW_HTTP` | Set to `1` to allow insecure HTTP Dashboard URLs |
488
-
489
- #### Chat/LLM Configuration
490
-
491
- | Variable | Description |
492
- |----------|-------------|
493
- | `ANTHROPIC_API_KEY` | Anthropic Claude |
494
- | `OPENAI_API_KEY` | OpenAI GPT |
495
- | `GOOGLE_API_KEY` | Google Gemini |
496
- | `OPENROUTER_API_KEY` | OpenRouter |
497
- | `LOCAL_LLM_API_KEY` | Local LLM provider (required to enable local provider) |
498
- | `LOCAL_LLM_URL` | Local endpoint URL (optional, defaults to localhost) |
499
- | `MAINWP_LLM_PROVIDER` | Override auto-detected provider |
500
- | `MAINWP_LLM_MODEL` | Specify model to use |
501
-
502
- ### Configuration Settings
503
-
504
- All settings in `~/.config/mainwpcontrol/settings.json`:
505
-
506
- | Setting | Type | Description |
507
- |---------|------|-------------|
508
- | `defaultJsonOutput` | boolean | Default to JSON output |
509
- | `timeout` | number | HTTP request timeout in milliseconds |
510
- | `debug` | boolean | Enable debug output |
511
- | `llmProvider` | string | Default LLM provider for chat |
512
- | `chatContextMessages` | number | Max messages in chat context |
513
- | `skipSSLVerification` | boolean | Disable TLS verification (insecure, prefer per-profile setting via `login --skip-ssl-verify`) |
514
- | `allowInsecureHttp` | boolean | Allow `http://` Dashboard URLs without `MAINWP_ALLOW_HTTP=1` |
515
-
516
- ---
517
-
518
- ## Troubleshooting
519
-
520
- <details>
521
- <summary><strong>"keytar failed to build" or native module errors during install</strong></summary>
522
-
523
- Keytar requires native C++ compilation on some platforms. If it fails:
524
-
525
- 1. **Use environment variable auth instead** (bypasses keytar entirely):
526
- ```bash
527
- export MAINWP_APP_PASSWORD='your-application-password'
528
- mainwpcontrol login --url https://dashboard.example.com --username admin
529
- ```
530
- 2. **Or skip keytar explicitly** by setting `MAINWPCONTROL_NO_KEYTAR=1` before running commands.
531
-
532
- The pre-built binaries cover macOS, Windows, and Linux (x64/arm64). If you're on a different platform or architecture, you'll need C++ build tools (`gcc`, `g++`, `make`) or the env var approach.
533
-
534
- </details>
535
-
536
- <details>
537
- <summary><strong>"command not found" after install</strong></summary>
538
-
539
- This usually means your npm global bin directory isn't in your system PATH.
540
-
541
- 1. **Find where npm installs global packages:**
542
- ```bash
543
- npm config get prefix
544
- ```
545
- 2. **Add the `bin` subdirectory to your PATH.** For example, if the prefix is `/usr/local`:
546
- ```bash
547
- # Add to ~/.bashrc, ~/.zshrc, or your shell profile:
548
- export PATH="/usr/local/bin:$PATH"
549
- ```
550
- 3. **Restart your terminal** (or run `source ~/.zshrc` / `source ~/.bashrc`) and try again.
551
-
552
- On Windows, the npm global directory is usually already in PATH after installing Node.js.
553
-
554
- </details>
555
-
556
- <details>
557
- <summary><strong>"connection refused" or network errors</strong></summary>
558
-
559
- If `mainwpcontrol login` or commands fail with connection errors:
560
-
561
- 1. **Check the Dashboard URL.** Make sure it's the full URL with `https://` (e.g., `https://dashboard.example.com`). Don't include a trailing slash.
562
- 2. **Verify HTTPS.** `mainwpcontrol` requires HTTPS by default. If your Dashboard uses HTTP (not recommended), set `MAINWP_ALLOW_HTTP=1`.
563
- 3. **Check firewall/network.** Make sure your machine can reach the Dashboard:
564
- ```bash
565
- curl -I https://dashboard.example.com
566
- ```
567
- 4. **SSL certificate issues.** If using a self-signed certificate, you can use `mainwpcontrol login --skip-ssl-verify` (not recommended for production).
568
-
569
- </details>
570
-
571
- ---
216
+ | --- | --- |
217
+ | [Daily Health Check](https://github.com/mainwp/mainwp-control/blob/main/docs/workflows/daily-health-check.md) | Cron job that checks site connectivity and alerts via Slack |
218
+ | [Plugin Deployment Verification](https://github.com/mainwp/mainwp-control/blob/main/docs/workflows/plugin-deployment-verification.md) | GitHub Actions workflow to verify a plugin across all sites |
219
+ | [Monthly Batch Updates](https://github.com/mainwp/mainwp-control/blob/main/docs/workflows/monthly-batch-updates.md) | Preview and apply updates in scheduled scripts and GitHub Actions |
220
+ | [Input from File](https://github.com/mainwp/mainwp-control/blob/main/docs/workflows/input-from-file.md) | Pass complex parameters via JSON files, stdin pipes, or heredocs |
221
+ | [Monitoring Integration](https://github.com/mainwp/mainwp-control/blob/main/docs/workflows/monitoring-integration.md) | Send site metrics to Datadog, StatsD, or other monitoring tools |
222
+
223
+ ## Community and support
224
+
225
+ - [MainWP Community](https://community.mainwp.com/) forum
226
+ - [Discord](https://mainwpinvite.com/)
227
+ - [MainWP Support](https://mainwp.com/mainwp-support/)
228
+ - [Issue Tracker](https://github.com/mainwp/mainwp-control/issues)
572
229
 
573
230
  ## Contributing
574
231
 
232
+ Bug fixes, security patches, and Abilities API compatibility updates are welcome. See [CONTRIBUTING.md](https://github.com/mainwp/mainwp-control/blob/main/CONTRIBUTING.md) for scope and requirements.
233
+
575
234
  ```bash
576
- npm run build # Build the project
577
- npm test # Run tests (unit + e2e, no network needed)
578
- npm run lint # Check code style
235
+ npm ci # install dependencies
236
+ npm run build # build
237
+ npm run typecheck # type check
238
+ npm test # unit and e2e tests (offline)
239
+ npm run lint # check code style
579
240
  ```
580
241
 
581
- ### Live Integration Tests
242
+ CI runs lint, typecheck, tests, and build on every pull request.
582
243
 
583
- `npm run test:live` runs tests against a real MainWP Dashboard, including workflow documentation validation. These require a running Dashboard and credentials:
244
+ `npm run test:live` validates login, ability discovery, read-only execution, `--dry-run` previews, safety rules, exit codes, and every workflow `jq` expression against a real Dashboard:
584
245
 
585
246
  ```bash
586
247
  export MAINWP_API_URL=https://your-dashboard.example.com
587
248
  export MAINWP_USER=your-admin-username
588
249
  export MAINWP_APP_PASSWORD='your-application-password'
250
+ export MAINWP_DASHBOARD_URL="$MAINWP_API_URL"
589
251
 
590
252
  npm run test:live
591
253
  ```
592
254
 
593
- The live suite includes API tests (login, abilities discovery, read-only execution, safety model, exit codes) and workflow doc tests (validates that every jq expression, field name, and data pipeline documented in `docs/workflows/` works against the real API).
594
-
595
- Live tests are safe: they only run read-only operations and `--dry-run` previews, never mutations.
596
-
597
- ---
255
+ See [Acceptance Testing](https://github.com/mainwp/mainwp-control/blob/main/docs/acceptance-testing.md) for the full pack-and-install test harness.
598
256
 
599
257
  ## License
600
258
 
601
- GPL-3.0-or-later
602
-
603
- ---
604
-
605
- ## Requirements
606
-
607
- - Node.js 20 LTS or later
608
- - MainWP Dashboard 6+ with Abilities API
609
- - WordPress Application Password
610
-
611
- ---
612
-
613
- - [MainWP](https://mainwp.com/)
614
- - [MainWP MCP Server](https://github.com/mainwp/mainwp-mcp)
615
- - [Issue Tracker](https://github.com/mainwp/mainwp-control/issues)
259
+ GPL-3.0-or-later. MainWP Control, MainWP Dashboard, MainWP Child, and MainWP MCP are open source under the GPL. See [LICENSE](https://github.com/mainwp/mainwp-control/blob/main/LICENSE).