devops-whc 1.0.1 → 1.0.2

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/README.md CHANGED
@@ -1,8 +1,8 @@
1
1
  # devops-whc
2
2
 
3
- WHC cPanel MCP server for deploy, verify, rollback, logs, backup, and health flows.
3
+ WHC cPanel automation CLI for deploy, verify, rollback, logs, backup, and health flows.
4
4
 
5
- Current release: 1.0.1
5
+ Current workspace version: 1.0.2
6
6
 
7
7
  ## Publish Package Layout
8
8
 
@@ -14,7 +14,7 @@ The repository root is the development workspace. The publish package is prepare
14
14
 
15
15
  ## What this is
16
16
 
17
- This package exposes an MCP server that VS Code Copilot or any MCP client can launch over stdio. It is designed for WHC cPanel projects and keeps the local workflow, target environment, and safety rules explicit.
17
+ This package exposes a stdio tool server and CLI that VS Code Copilot or other clients can launch. It is designed for WHC cPanel projects and keeps the local workflow, target environment, and safety rules explicit.
18
18
 
19
19
  The server supports both usage patterns:
20
20
 
@@ -40,34 +40,80 @@ Or install globally:
40
40
 
41
41
  ```powershell
42
42
  npm install -g devops-whc
43
- whc-mcp --help
43
+ whc --help
44
44
  ```
45
45
 
46
46
  ## Quick Start
47
47
 
48
48
  1. Copy `.env.example` to `.env`.
49
49
  2. Fill in the required WHC credentials and target paths.
50
- 3. Run `npm run mcp:prepare` once per workspace.
50
+ 3. Run `npm run prepare` once per workspace.
51
51
  4. Start the server with `npm run serve` for local development, or `npx -y devops-whc --serve` after npm install.
52
52
 
53
- If you are using VS Code Copilot MCP, point the server command to the published package or to the local `start-mcp.cjs` helper.
53
+ If you are using VS Code Copilot, point the server command to the published package or to the local `start-whc.cjs` helper.
54
54
 
55
- ## VS Code MCP Config
55
+ ## NPM Scripts (Workspace Root)
56
+
57
+ Run these from repository root (`devops-whc`):
58
+
59
+ ```powershell
60
+ npm run help
61
+ npm run serve
62
+ npm run start
63
+ npm run probe
64
+ npm run check:generic
65
+ npm run check:health
66
+ ```
67
+
68
+ Quality and release scripts:
69
+
70
+ ```powershell
71
+ npm run lint
72
+ npm run typecheck
73
+ npm test
74
+ npm run build
75
+ npm run pack:check
76
+ npm run publish:prepare
77
+ ```
78
+
79
+ When to use each:
80
+
81
+ 1. `npm run serve`: run directly from TypeScript source (best for local development).
82
+ 2. `npm run start`: run built output through `scripts/start-whc.cjs` (best for local runtime behavior similar to published package).
83
+ 3. `npm run prepare`: initialize local `.whc` state once.
84
+ 4. `npm run pack:check` / `npm run publish:npm`: publish pipeline scripts.
85
+
86
+ ## NPM Scripts (Publish Subpackage)
87
+
88
+ If you work inside `packages/devops-whc`, available scripts are:
89
+
90
+ ```powershell
91
+ npm --prefix packages/devops-whc run help
92
+ npm --prefix packages/devops-whc run start
93
+ npm --prefix packages/devops-whc run serve
94
+ npm --prefix packages/devops-whc run probe
95
+ npm --prefix packages/devops-whc run check:generic
96
+ npm --prefix packages/devops-whc run check:health
97
+ ```
98
+
99
+ These scripts automatically sync fresh artifacts from root via pre-hooks before execution.
100
+
101
+ ## VS Code Tool Server Config
56
102
 
57
103
  Published-package example:
58
104
 
59
105
  ```jsonc
60
106
  {
61
107
  "servers": {
62
- "whc-mcp": {
108
+ "whc": {
63
109
  "type": "stdio",
64
110
  "command": "npx",
65
111
  "args": ["-y", "devops-whc", "--serve"],
66
112
  "env": {
67
113
  "WHC_ENV_FILE": "${workspaceFolder}/.env",
68
114
  "WHC_LOCAL_PROJECT_ROOT": "${workspaceFolder}",
69
- "WHC_STATE_ROOT": ".mcp/whc-mcp",
70
- "WHC_MCP_INSTANCE_NAME": "whc-mcp"
115
+ "WHC_STATE_ROOT": ".whc",
116
+ "WHC_INSTANCE_NAME": "whc"
71
117
  }
72
118
  }
73
119
  }
@@ -79,16 +125,16 @@ Local-source example:
79
125
  ```jsonc
80
126
  {
81
127
  "servers": {
82
- "whc-mcp": {
128
+ "whc": {
83
129
  "type": "stdio",
84
130
  "command": "node",
85
- "args": ["./scripts/start-mcp.cjs"],
131
+ "args": ["./scripts/start-whc.cjs"],
86
132
  "cwd": "${workspaceFolder}",
87
133
  "env": {
88
134
  "WHC_ENV_FILE": "${workspaceFolder}/.env",
89
135
  "WHC_LOCAL_PROJECT_ROOT": "${workspaceFolder}",
90
- "WHC_STATE_ROOT": ".mcp/whc-mcp",
91
- "WHC_MCP_INSTANCE_NAME": "whc-mcp"
136
+ "WHC_STATE_ROOT": ".whc",
137
+ "WHC_INSTANCE_NAME": "whc"
92
138
  }
93
139
  }
94
140
  }
@@ -98,11 +144,12 @@ Local-source example:
98
144
  ## CLI Commands
99
145
 
100
146
  ```powershell
101
- whc-mcp --serve
102
- whc-mcp --probe
103
- whc-mcp --check-health
104
- whc-mcp --help
105
- whc-mcp --version
147
+ whc --serve
148
+ whc --probe
149
+ whc --check-generic --project-root D:/Source/mytho/source/wordpress --workflow-mode ssh_scp_wpcli
150
+ whc --check-health
151
+ whc --help
152
+ whc --version
106
153
  ```
107
154
 
108
155
  If you are using the npm package directly, the same commands work through `npx`:
@@ -110,25 +157,51 @@ If you are using the npm package directly, the same commands work through `npx`:
110
157
  ```powershell
111
158
  npx -y devops-whc --serve
112
159
  npx -y devops-whc --probe
160
+ npx -y devops-whc --check-generic --project-root D:/Source/mytho/source/wordpress --workflow-mode ssh_scp_wpcli
113
161
  npx -y devops-whc --check-health
114
162
  npx -y devops-whc --help
115
163
  npx -y devops-whc --version
116
164
  ```
117
165
 
118
- ## Required Environment Variables
119
-
120
- Set these in your local `.env` file:
121
-
122
- - `WHC_API_TOKEN`
123
- - `WHC_USER`
124
- - `WHC_HOST`
125
- - `WHC_PROD_SSH_HOST`
126
- - `WHC_PROD_SSH_USERNAME`
127
- - `WHC_PROD_SSH_PRIVATE_KEY_PATH`
166
+ ## Local Run vs Script Run
167
+
168
+ You can run the tool in both ways:
169
+
170
+ 1. Local development from this repo:
171
+ - Use npm scripts (`npm run serve`, `npm run probe`, `npm run check:generic`, ...).
172
+ 2. Installed package usage:
173
+ - Use `npx -y devops-whc ...` or global `whc ...`.
174
+
175
+ You do not have to call custom script files manually in normal usage. The wrapper script (`start-whc.cjs`) is already wired behind `npm run start` and package start flow.
176
+
177
+ ## Required Environment Variables
178
+
179
+ Base config:
180
+
181
+ - `WHC_WORKFLOW_MODE`
182
+ - `WHC_LOCAL_PROJECT_ROOT`
183
+
184
+ For `git_deploy`:
185
+
186
+ - `WHC_API_TOKEN`
187
+ - `WHC_USER`
188
+ - `WHC_HOST`
189
+ - `WHC_PROD_PATH`
190
+
191
+ For `ssh_scp_wpcli`:
192
+
193
+ - `WHC_STAGING_SSH_HOST`
194
+ - `WHC_STAGING_SSH_USERNAME`
195
+ - one of:
196
+ - `WHC_STAGING_SSH_PRIVATE_KEY_PATH`
197
+ - `WHC_STAGING_SSH_PASSWORD`
128
198
 
129
199
  ## Optional Environment Variables
130
200
 
131
- - `WHC_WORKFLOW_MODE`
201
+ - `WHC_WORKFLOW_MODE`
202
+ - `git_deploy`: local source -> cPanel-managed Git repo -> deployment task
203
+ - `ssh_scp_wpcli`: source-driven workflow like `mytho/source` (doctor + SCP + WP-CLI + smoke)
204
+ - default if omitted: `ssh_scp_wpcli`
132
205
  - `WHC_PRIMARY_DOMAIN`
133
206
  - `WHC_TESTING_DOMAIN`
134
207
  - `WHC_STAGING_DOMAIN`
@@ -137,7 +210,7 @@ Set these in your local `.env` file:
137
210
  - `WHC_REQUIRE_STAGING_CONFIRM`
138
211
  - `WHC_WARN_DYNAMIC_DATA_SYNC`
139
212
  - `WHC_ENFORCE_STAGING_FIRST`
140
- - `WHC_ALLOW_STAGING_GIT_CONTROLLED`
213
+
141
214
  - `WHC_STAGING_SSH_HOST`
142
215
  - `WHC_STAGING_SSH_PORT`
143
216
  - `WHC_STAGING_SSH_USERNAME`
@@ -174,17 +247,71 @@ npx -y devops-whc --check-health
174
247
 
175
248
  Use this to inspect disk, SSL, load, and capability state.
176
249
 
177
- ### 3) Start the MCP server in VS Code
250
+ ### 3) Run deploy readiness check (single command)
178
251
 
179
- Once the MCP config is in place, Copilot can launch the server and call tools such as `whc_prepare`, `whc_deploy`, `whc_verify`, and `whc_rollback`.
252
+ ```powershell
253
+ npx -y devops-whc --check-generic --project-root D:/Source/mytho/source/wordpress --workflow-mode ssh_scp_wpcli
254
+ ```
180
255
 
181
- ### 4) Prepare workspace state once
256
+ Or from local clone:
182
257
 
183
258
  ```powershell
184
- npm run mcp:prepare
259
+ npm run check:generic -- D:/Source/mytho/source/wordpress
185
260
  ```
186
261
 
187
- This initializes the hidden project state under `.mcp/whc-mcp` and ensures the workspace ignores local management files.
262
+ This command validates whether your local WordPress source shape is compatible with the WHC generic pipeline supported by this tool.
263
+
264
+ `--project-root` is required. `--app-path` is optional.
265
+
266
+ If `--app-path` is omitted, WHC treats `project-root` itself as the app root.
267
+ If `--app-path` is provided but wrong, the command fails and does not initialize hidden files.
268
+
269
+ Once the effective app root is valid, the command bootstraps hidden WHC state inside that app directory:
270
+
271
+ 1. `<app-path>/.whc/state/...`
272
+ 2. `<app-path>/.whc/logs/...`
273
+ 3. `<app-path>/.whc/env/whc.env`
274
+ 4. `<app-path>/.whc/env/whc.env.example`
275
+
276
+ If credentials or SSH keys are still missing for that specific project, the check returns `status=blocked` with exact env keys to fill in the bootstrapped hidden env file.
277
+
278
+ Current behavior by workflow mode:
279
+
280
+ 1. `git_deploy`: validates local source/layout compatibility for repository-driven cPanel deploy flows, including `.cpanel.yml` at repository root.
281
+ 2. `ssh_scp_wpcli`: validates the `mytho/source` style contract more directly:
282
+ - deployable plugin/theme entrypoints
283
+ - idempotent seed script
284
+ - local `ssh`/`scp`
285
+ - staging SSH/WP-CLI/path/domain probes
286
+ - `/wp-json/` HTTP readiness
287
+
288
+ Important current boundary:
289
+
290
+ 1. `check:generic` is the main trustworthy gate for source compatibility and hidden-state bootstrap.
291
+ 2. `whc_setup_remote` is for wiring remote Git repository metadata on cPanel.
292
+ 3. `ssh_scp_wpcli` is the default workflow mode for `mytho/source`.
293
+ 4. `git_deploy` now triggers the cPanel deployment task for the requested `repository_root` and optional `branch`.
294
+ 5. `whc_deploy` is still not the end-to-end executor for the `mytho/source` SCP/WP-CLI pipeline.
295
+
296
+ What you need from the result:
297
+
298
+ 1. `ready_for_deploy=true` and `status=ready`: ready to run deploy pipeline.
299
+ 2. `ready_for_deploy=false` and `status=blocked`: not ready yet.
300
+ 3. `next_actions`: exact steps to fix before rerun.
301
+
302
+ You do not need to choose or manage internal source categories. The command applies internal checks and returns one deploy readiness decision plus actionable next steps.
303
+
304
+ ### 4) Start the tool server in VS Code
305
+
306
+ Once the config is in place, Copilot can launch the server and call tools such as `whc_prepare`, `whc_deploy`, `whc_verify`, and `whc_rollback`.
307
+
308
+ ### 5) Prepare workspace state once
309
+
310
+ ```powershell
311
+ npm run prepare
312
+ ```
313
+
314
+ This initializes the hidden project state under `.whc` and ensures the workspace ignores local management files.
188
315
 
189
316
  ## Safety Notes
190
317
 
@@ -193,16 +320,58 @@ This initializes the hidden project state under `.mcp/whc-mcp` and ensures the w
193
320
  3. The npm tarball is limited to the published files list and does not include local env files.
194
321
  4. For staging-to-live or database-changing operations, follow the tool safety prompts and confirm the release intent.
195
322
 
196
- ## Publish Checklist
323
+ ## Release Prep
324
+
325
+ Run these from repository root before publishing:
326
+
327
+ ```powershell
328
+ npm run typecheck
329
+ npm test
330
+ npm run publish:prepare
331
+ npm run pack:check
332
+ ```
333
+
334
+ What each step does:
335
+
336
+ 1. `npm run typecheck`: validates TypeScript before release.
337
+ 2. `npm test`: runs the test suite.
338
+ 3. `npm run publish:prepare`: syncs root docs/scripts/build output into `packages/devops-whc`.
339
+ 4. `npm run pack:check`: dry-runs the actual npm package from `packages/devops-whc`.
340
+
341
+ Publish only after the dry-run looks correct:
342
+
343
+ ```powershell
344
+ npm run publish:npm
345
+ ```
346
+
347
+ ## NPM Auth
348
+
349
+ Authenticate npm on this machine before the real publish:
350
+
351
+ ```powershell
352
+ npm whoami
353
+ npm login
354
+ npm whoami
355
+ ```
356
+
357
+ If your org uses browser-based auth, npm may open a web flow after `npm login`.
358
+
359
+ Useful checks:
360
+
361
+ ```powershell
362
+ npm config get registry
363
+ npm access ls-packages
364
+ ```
365
+
366
+ Release notes:
367
+
368
+ 1. `npm run publish:npm` publishes from `packages/devops-whc`, not from repository root.
369
+ 2. For prerelease versions like `1.0.2-next`, the publish script automatically uses dist-tag `next`.
370
+ 3. Do not run `npm publish` directly from the repository root package.
371
+ 4. Be explicit in release notes that `ssh_scp_wpcli` is the default mode for `mytho/source`, while `git_deploy` is the repository-driven cPanel deployment path.
197
372
 
198
- 1. `npm run test`
199
- 2. `npm run pack:check`
200
- 3. `npm --prefix packages/devops-whc publish`
373
+ ## License
201
374
 
202
- Notes:
203
- 1. `npm run pack:check` automatically runs publish preparation and packs from `packages/devops-whc`.
204
- 2. Do not publish from the repository root package.
375
+ ISC
205
376
 
206
- ## License
207
377
 
208
- ISC
@@ -1,7 +1,7 @@
1
- # WHC.ca (cPanel) MCP Server Requirements
1
+ # WHC.ca (cPanel) tool server Requirements
2
2
 
3
3
  ## 1. Objective
4
- Build a specialized MCP (Model Context Protocol) Server to automate the management and deployment of web projects hosted on Web Hosting Canada (WHC.ca). The goal is to facilitate a seamless **Local -> Staging -> Production** workflow directly from the terminal/Gemini CLI.
4
+ Build a specialized WHC tool server (stdio + CLI) to automate the management and deployment of web projects hosted on Web Hosting Canada (WHC.ca). The goal is to facilitate a seamless **Local -> Staging -> Production** workflow directly from the terminal/Gemini CLI.
5
5
 
6
6
  ## 2. Core Features
7
7
  - **Git Automation:** Remote repository creation and branch-based synchronization.
@@ -72,14 +72,14 @@ Operational implication:
72
72
  1. A successful `whc_setup_remote` still requires local source push (`git push`) and subsequent `whc_deploy`.
73
73
 
74
74
  ## 3.3 Manual Prerequisites (Must Be Explicit)
75
- These steps are not auto-solvable by MCP and must be prepared by operator:
75
+ These steps are not auto-solvable by tool server and must be prepared by operator:
76
76
  1. WHC API token creation and placement in env.
77
77
  2. SSH key provisioning to correct cPanel account.
78
78
  3. Credential scope alignment (target path ownership/account).
79
79
 
80
80
  ## 4. Technical Stack
81
81
  - **Language:** TypeScript / Node.js.
82
- - **Framework:** MCP SDK (@modelcontextprotocol/sdk).
82
+ - **Framework:** tool server SDK (@modelcontextprotocol/sdk).
83
83
  - **Communication:**
84
84
  - **cPanel UAPI:** Over HTTPS (Port 2083) using API Tokens.
85
85
  - **SSH:** Using `ssh2` or system SSH (Port 27).
@@ -88,7 +88,7 @@ These steps are not auto-solvable by MCP and must be prepared by operator:
88
88
  ## 5. Implementation Roadmap
89
89
 
90
90
  ### Phase 1: Foundation & Auth
91
- - [ ] Initialize MCP project.
91
+ - [ ] Initialize tool server project.
92
92
  - [ ] Implement secure `.env` loading for `WHC_API_TOKEN`, `WHC_USER`, and `WHC_HOST`.
93
93
  - [ ] Test connectivity to cPanel API and SSH.
94
94
 
@@ -103,10 +103,12 @@ These steps are not auto-solvable by MCP and must be prepared by operator:
103
103
  - [ ] Add health check dashboard.
104
104
 
105
105
  ### Phase 4: Gemini CLI Integration
106
- - [ ] Register the MCP server in `gemini-config.json`.
106
+ - [ ] Register the tool server in `gemini-config.json`.
107
107
  - [ ] Create high-level commands/aliases (e.g., `whc-sync-staging`).
108
108
 
109
109
  ## 6. Security Protocol
110
110
  - No API tokens or Private Keys are to be hardcoded.
111
111
  - All sensitive data must reside in a local `.env` file excluded from git.
112
112
  - API requests must use HTTPS with proper header authentication.
113
+
114
+
@@ -13,10 +13,10 @@ else {
13
13
  dotenv_1.default.config();
14
14
  }
15
15
  const envSchema = zod_1.z.object({
16
- WHC_API_TOKEN: zod_1.z.string().min(1),
17
- WHC_USER: zod_1.z.string().min(1),
18
- WHC_HOST: zod_1.z.string().min(1),
19
- WHC_WORKFLOW_MODE: zod_1.z.enum(["managed_clone_sync", "git_controlled"]).default("managed_clone_sync"),
16
+ WHC_API_TOKEN: zod_1.z.string().min(1).optional(),
17
+ WHC_USER: zod_1.z.string().min(1).optional(),
18
+ WHC_HOST: zod_1.z.string().min(1).optional(),
19
+ WHC_WORKFLOW_MODE: zod_1.z.enum(["git_deploy", "ssh_scp_wpcli"]).default("ssh_scp_wpcli"),
20
20
  WHC_PRIMARY_DOMAIN: zod_1.z.string().min(1).optional(),
21
21
  WHC_TESTING_DOMAIN: zod_1.z.string().min(1).optional(),
22
22
  WHC_STAGING_DOMAIN: zod_1.z.string().min(1).optional(),
@@ -34,14 +34,10 @@ const envSchema = zod_1.z.object({
34
34
  .enum(["true", "false"])
35
35
  .default("true")
36
36
  .transform((value) => value === "true"),
37
- WHC_ALLOW_STAGING_GIT_CONTROLLED: zod_1.z
38
- .enum(["true", "false"])
39
- .default("false")
40
- .transform((value) => value === "true"),
41
- WHC_PROD_SSH_HOST: zod_1.z.string().min(1),
37
+ WHC_PROD_SSH_HOST: zod_1.z.string().min(1).optional(),
42
38
  WHC_PROD_SSH_PORT: zod_1.z.coerce.number().int().positive().default(27),
43
- WHC_PROD_SSH_USERNAME: zod_1.z.string().min(1),
44
- WHC_PROD_SSH_PRIVATE_KEY_PATH: zod_1.z.string().min(1),
39
+ WHC_PROD_SSH_USERNAME: zod_1.z.string().min(1).optional(),
40
+ WHC_PROD_SSH_PRIVATE_KEY_PATH: zod_1.z.string().min(1).optional(),
45
41
  WHC_STAGING_SSH_HOST: zod_1.z.string().min(1).optional(),
46
42
  WHC_STAGING_SSH_PORT: zod_1.z.coerce.number().int().positive().optional(),
47
43
  WHC_STAGING_SSH_USERNAME: zod_1.z.string().min(1).optional(),
@@ -64,7 +60,8 @@ const envSchema = zod_1.z.object({
64
60
  WHC_FLOW_LOG_PATH: zod_1.z.string().min(1).optional(),
65
61
  });
66
62
  function loadConfig(env = process.env) {
67
- const parsed = envSchema.safeParse(env);
63
+ const normalizedEnv = Object.fromEntries(Object.entries(env).map(([key, value]) => [key, value === "" ? undefined : value]));
64
+ const parsed = envSchema.safeParse(normalizedEnv);
68
65
  if (!parsed.success) {
69
66
  const issues = parsed.error.issues
70
67
  .map((issue) => issue.path.join("."))
@@ -72,17 +69,46 @@ function loadConfig(env = process.env) {
72
69
  throw new Error(`VALIDATION_ERROR: Missing or invalid env vars: ${issues.join(", ")}`);
73
70
  }
74
71
  const data = parsed.data;
75
- const prodSshHost = data.WHC_PROD_SSH_HOST;
72
+ const workflowMode = data.WHC_WORKFLOW_MODE;
73
+ const missingFields = [];
74
+ if (workflowMode === "git_deploy") {
75
+ for (const key of [
76
+ "WHC_API_TOKEN",
77
+ "WHC_USER",
78
+ "WHC_HOST",
79
+ ]) {
80
+ if (!(data[key] ?? "").trim()) {
81
+ missingFields.push(key);
82
+ }
83
+ }
84
+ }
85
+ else {
86
+ for (const key of [
87
+ "WHC_STAGING_SSH_HOST",
88
+ "WHC_STAGING_SSH_USERNAME",
89
+ ]) {
90
+ if (!(data[key] ?? "").trim()) {
91
+ missingFields.push(key);
92
+ }
93
+ }
94
+ if (!(data.WHC_STAGING_SSH_PRIVATE_KEY_PATH ?? "").trim() && !(data.WHC_STAGING_SSH_PASSWORD ?? "").trim()) {
95
+ missingFields.push("WHC_STAGING_SSH_PRIVATE_KEY_PATH|WHC_STAGING_SSH_PASSWORD");
96
+ }
97
+ }
98
+ if (missingFields.length > 0) {
99
+ throw new Error(`VALIDATION_ERROR: Missing or invalid env vars: ${missingFields.join(", ")}`);
100
+ }
101
+ const prodSshHost = data.WHC_PROD_SSH_HOST ?? data.WHC_HOST ?? data.WHC_STAGING_SSH_HOST ?? "";
76
102
  const prodSshPort = data.WHC_PROD_SSH_PORT;
77
- const prodSshUsername = data.WHC_PROD_SSH_USERNAME;
78
- const prodSshPrivateKeyPath = data.WHC_PROD_SSH_PRIVATE_KEY_PATH;
103
+ const prodSshUsername = data.WHC_PROD_SSH_USERNAME ?? data.WHC_USER ?? data.WHC_STAGING_SSH_USERNAME ?? "";
104
+ const prodSshPrivateKeyPath = data.WHC_PROD_SSH_PRIVATE_KEY_PATH ?? data.WHC_STAGING_SSH_PRIVATE_KEY_PATH ?? "";
79
105
  const hasStagingSsh = !!data.WHC_STAGING_SSH_HOST || !!data.WHC_STAGING_SSH_USERNAME || !!data.WHC_STAGING_SSH_PRIVATE_KEY_PATH;
80
106
  return {
81
- apiToken: data.WHC_API_TOKEN,
82
- user: data.WHC_USER,
83
- host: data.WHC_HOST,
84
- apiBaseUrl: `https://${data.WHC_HOST}:2083`,
85
- workflowMode: data.WHC_WORKFLOW_MODE,
107
+ apiToken: data.WHC_API_TOKEN ?? "",
108
+ user: data.WHC_USER ?? "",
109
+ host: data.WHC_HOST ?? "",
110
+ apiBaseUrl: data.WHC_HOST ? `https://${data.WHC_HOST}:2083` : "",
111
+ workflowMode,
86
112
  domains: {
87
113
  primary: data.WHC_PRIMARY_DOMAIN,
88
114
  testing: data.WHC_TESTING_DOMAIN,
@@ -105,7 +131,6 @@ function loadConfig(env = process.env) {
105
131
  requireStagingConfirm: data.WHC_REQUIRE_STAGING_CONFIRM,
106
132
  warnDynamicDataSync: data.WHC_WARN_DYNAMIC_DATA_SYNC,
107
133
  enforceStagingFirst: data.WHC_ENFORCE_STAGING_FIRST,
108
- allowStagingGitControlled: data.WHC_ALLOW_STAGING_GIT_CONTROLLED,
109
134
  },
110
135
  sshTargets: {
111
136
  prod: {
@@ -26,7 +26,6 @@ async function executeWhcDbBackup(config, request, deps = {}) {
26
26
  const dumpPath = buildDumpPath(output_path, target_environment, compress);
27
27
  // Dry run: preview command without executing
28
28
  if (request.dry_run) {
29
- const previewCmd = buildWpCliCommand(dumpPath, compress, tables);
30
29
  return {
31
30
  ok: true,
32
31
  action_id: actionIdFactory(),