Skip to content

rename mainwpctl to mainwpcontrol#2

Merged
dennisdornon merged 2 commits intomainfrom
rename/mainwpctl-to-mainwpcontrol
Mar 24, 2026
Merged

rename mainwpctl to mainwpcontrol#2
dennisdornon merged 2 commits intomainfrom
rename/mainwpctl-to-mainwpcontrol

Conversation

@dennisdornon
Copy link
Copy Markdown
Contributor

@dennisdornon dennisdornon commented Mar 24, 2026

Renames the CLI binary and all references from mainwpctl to mainwpcontrol to align with the product name.

Changes across 74 files:

  • binary name: mainwpctlmainwpcontrol
  • config dir: ~/.config/mainwpctl~/.config/mainwpcontrol
  • keychain service name updated
  • env var MAINWPCTL_NO_KEYTARMAINWPCONTROL_NO_KEYTAR
  • shell completions renamed
  • all docs, tests, and references updated

Build passes, 663/663 tests pass, lint clean.

Note: testers should re-run mainwpcontrol login after pulling this.

Summary by CodeRabbit

  • Refactor

    • Renamed CLI executable from mainwpctl to mainwpcontrol across the application.
    • Updated configuration directory from ~/.config/mainwpctl to ~/.config/mainwpcontrol.
    • Changed environment variable from MAINWPCTL_NO_KEYTAR to MAINWPCONTROL_NO_KEYTAR.
  • Documentation

    • Updated all user-facing guides and examples to reflect the new CLI command name.
    • Revised shell completion scripts and configuration documentation.
  • Tests

    • Updated test fixtures and assertions to use new CLI identifiers.
  • Chores

    • Updated package configuration, macOS bundle identifier, and S3 release bucket references.

Align the executable name with the product name "MainWP Control"
for easier user recall. This is a clean pre-release break (0 users).

Changes across 74 files:
- package.json: bin, oclif.bin, oclif.dirname, identifier, s3 bucket
- All source: mainwpctl→mainwpcontrol, MAINWPCTL→MAINWPCONTROL
- Shell completions: file renames + content update
- Docs: npx examples fixed to use --package=@mainwp/control form
- npm paths corrected to @mainwp/control (was broken before rename)

No migration. Testers must re-login after this change.
- .env.example: config dir comment still said ~/.config/mainwpctl
- README.md: 3 references to MAINWPCTL_NO_KEYTAR (runtime uses MAINWPCONTROL_NO_KEYTAR)
- docs/workflows/*.md: version output said mainwpcontrol/x.y.z but CLI prints @mainwp/control/x.y.z (oclif uses npm package name)
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Mar 24, 2026

Walkthrough

This PR performs a comprehensive rename of the CLI executable name from mainwpctl to mainwpcontrol across configuration, documentation, source code, shell completions, and test files. The change updates environment variables, directory paths, command references, function names, and identifiers throughout the codebase to reflect the new name.

Changes

Cohort / File(s) Summary
Configuration & Package Metadata
.env.example, package.json
Updated environment variable name MAINWPCTL_NO_KEYTARMAINWPCONTROL_NO_KEYTAR, config directory path ~/.config/mainwpctl~/.config/mainwpcontrol, and Oclif/package.json identifiers including bin, dirname, macOS bundle identifier, and S3 release bucket name.
Documentation
README.md, scripts/completions/README.md, docs/workflows/*
Renamed all CLI command references from mainwpctl to mainwpcontrol in usage examples, configuration paths, shell completion instructions, and workflow documentation across daily-health-check, input-from-file, monitoring-integration, monthly-batch-updates, and plugin-deployment-verification guides.
Shell Completion Scripts
scripts/completions/mainwpcontrol.bash, mainwpcontrol.zsh, profile-completer.sh, regenerate.sh
Renamed completion function names and registration from _mainwpctl_* to _mainwpcontrol_*, updated config file paths from mainwpctl/profiles.json to mainwpcontrol/profiles.json, and adjusted completion script filenames and sourcing references.
Test Files - E2E
src/__tests__/e2e/command-workflows.test.ts, exit-codes.test.ts, json-contract.test.ts, login-abilities-flow.test.ts, non-tty-behavior.test.ts
Updated mock configuration bin and name fields from mainwpctl to mainwpcontrol, and adjusted keytar service identifier expectations in credential assertions.
Test Files - Process & Fixtures
src/__tests__/process/*.test.ts, fixtures/cli-runner.ts, fixtures/config-dir.ts
Updated test documentation comments, environment variable MAINWPCTL_NO_KEYTARMAINWPCONTROL_NO_KEYTAR, config directory fixture path from mainwpctl to mainwpcontrol, and assertion expectations for CLI binary names in smoke/help output tests.
Chat System
src/chat/chat-engine.ts, src/chat/chat-engine.test.ts, src/chat/providers/*.ts, system-prompt.ts, tool-envelope.ts
Updated module documentation comments and embedded CLI name in the CORE_PROMPT system prompt from mainwpctl to mainwpcontrol, affecting chat context and user-facing instructions.
Command Implementations
src/commands/abilities/*.ts, chat.ts, config/show.ts, doctor.ts, jobs/watch.ts, login.ts, profile/*.ts
Updated user-facing error messages, command guidance, and documentation comments to reference mainwpcontrol instead of mainwpctl in error output, help text, and instructional messages.
Core Infrastructure
src/core/abilities-executor.ts, batch-manager.ts, http-client.ts, safety-controller.ts
Updated module documentation, error guidance text, and User-Agent header value to use mainwpcontrol instead of mainwpctl in diagnostic and network communication layers.
Configuration Management
src/config/keychain.ts, profile-store.ts, settings.ts
Updated SERVICE_NAME constant and environment variable check from MAINWPCTL_NO_KEYTAR to MAINWPCONTROL_NO_KEYTAR, and changed config directory resolution from mainwpctl to mainwpcontrol in XDG paths and error messaging.
Utilities & Validation
src/lib/base-command.ts, src/output/*.ts, src/utils/*.ts, src/validation/*.ts
Updated documentation comments, error messages, config path patterns, and user-facing text across formatting, error handling, input sanitization, and schema validation modules to reference mainwpcontrol throughout.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title 'rename mainwpctl to mainwpcontrol' accurately and concisely summarizes the primary change across all 74 files, matching the stated objectives.
Docstring Coverage ✅ Passed Docstring coverage is 80.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch rename/mainwpctl-to-mainwpcontrol

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (7)
src/utils/errors.ts (1)

2-2: Documentation updated, but consider class name consistency.

The module documentation correctly references mainwpcontrol, but the base error class is still named MainWPCTLError. Since this is a pre-release breaking change according to the PR summary, you may want to align the class name with the new CLI name for consistency.

♻️ Optional: Rename error class for consistency

If you want full consistency with the new CLI name:

-export abstract class MainWPCTLError extends Error {
+export abstract class MainWPControlError extends Error {

This would require updating all references to MainWPCTLError across the codebase. If intentionally keeping the old class name for internal abbreviation purposes, the current state is acceptable.

Also applies to: 9-12

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/utils/errors.ts` at line 2, The base error class name MainWPCTLError is
inconsistent with the new CLI name (mainwpcontrol); rename the class to
MainWPControlError and update its export to match, then search and replace all
references/usages of MainWPCTLError across the codebase (imports, instanceof
checks, tests, and docs) to use MainWPControlError so names remain consistent
with the updated documentation and CLI branding.
src/lib/base-command.ts (1)

160-170: Prefer dynamic bin name in user hints to avoid future rename churn.

Using this.config.bin here would keep runtime guidance aligned automatically.

♻️ Proposed refactor
   private async loadProfile(profileName?: string): Promise<void> {
     const profileStore = getProfileStore();
+    const bin = this.config.bin ?? 'mainwpcontrol';

     if (profileName) {
       const profile = await profileStore.get(profileName);
       if (!profile) {
         throw new ConfigError(
           `Profile not found: ${profileName}`,
           undefined,
-          'List available profiles with `mainwpcontrol profile list` or create one with `mainwpcontrol login`'
+          `List available profiles with \`${bin} profile list\` or create one with \`${bin} login\``
         );
       }
       this.currentProfile = profile;
     } else {
       this.currentProfile = await profileStore.getActive();
       if (!this.currentProfile) {
         throw new ConfigError(
           'No profile configured.',
           undefined,
-          'Create your first profile with `mainwpcontrol login`'
+          `Create your first profile with \`${bin} login\``
         );
       }
     }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/lib/base-command.ts` around lines 160 - 170, The user-facing hint
messages in BaseCommand (where this.currentProfile is set and where a
ConfigError is thrown) use a hardcoded CLI name; update those messages to
reference the dynamic this.config.bin instead so runtime hints stay correct
after renames — replace the literal "mainwpcontrol" occurrences in the messages
around the currentProfile/profileStore.getActive logic with this.config.bin
(ensure the same change is applied to both the 'profile list'/'login' hint and
the 'Create your first profile' hint).
docs/workflows/monitoring-integration.md (1)

85-88: Add language specifier to the fenced code block.

The code block showing expected version output should have a language specifier for consistent formatting.

📝 Suggested fix
 Expected output:

-```
+```text
 `@mainwp/control/x.y.z` darwin-arm64 node-vNN.NN.N
</details>

<details>
<summary>🤖 Prompt for AI Agents</summary>

Verify each finding against the current code and only fix it if needed.

In @docs/workflows/monitoring-integration.md around lines 85 - 88, Add a
language specifier to the fenced code block that contains the expected output
string @mainwp/control/x.y.z darwin-arm64 node-vNN.NN.N so it renders
consistently (e.g., change the opening totext); ensure the closing ```
remains and nothing else in the block is altered.


</details>

</blockquote></details>
<details>
<summary>scripts/completions/mainwpcontrol.bash (1)</summary><blockquote>

`11-16`: **Consider renaming internal variable for consistency.**

The internal variable `_MAINWPCTL_COMPLETION_DIR` still uses the old naming convention. While this doesn't affect functionality (it's not user-facing), renaming it to `_MAINWPCONTROL_COMPLETION_DIR` would improve consistency.


<details>
<summary>📝 Suggested fix</summary>

```diff
 # Determine the directory where this script is located
-_MAINWPCTL_COMPLETION_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
+_MAINWPCONTROL_COMPLETION_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"

 # Source the profile completer helper
-if [[ -f "${_MAINWPCTL_COMPLETION_DIR}/profile-completer.sh" ]]; then
-    source "${_MAINWPCTL_COMPLETION_DIR}/profile-completer.sh"
+if [[ -f "${_MAINWPCONTROL_COMPLETION_DIR}/profile-completer.sh" ]]; then
+    source "${_MAINWPCONTROL_COMPLETION_DIR}/profile-completer.sh"
 fi
```
</details>

<details>
<summary>🤖 Prompt for AI Agents</summary>

```
Verify each finding against the current code and only fix it if needed.

In `@scripts/completions/mainwpcontrol.bash` around lines 11 - 16, Rename the
internal variable _MAINWPCTL_COMPLETION_DIR to _MAINWPCONTROL_COMPLETION_DIR
throughout the script: update its declaration where it's set with cd/dirname and
any subsequent references (e.g., the conditional that checks and sources
"${_MAINWPCTL_COMPLETION_DIR}/profile-completer.sh") so they consistently use
the new symbol _MAINWPCONTROL_COMPLETION_DIR.
```

</details>

</blockquote></details>
<details>
<summary>docs/workflows/monthly-batch-updates.md (1)</summary><blockquote>

`46-49`: **Optional: Add language specifier to code block.**

The fenced code block showing the Application Password example lacks a language specifier. Adding `text` would satisfy the markdownlint MD040 rule.



<details>
<summary>📝 Add language specifier</summary>

```diff
-   ```
+   ```text
    AbCD 1234 efGH 5678 ijKL 9012
    ```
```
</details>

<details>
<summary>🤖 Prompt for AI Agents</summary>

Verify each finding against the current code and only fix it if needed.

In @docs/workflows/monthly-batch-updates.md around lines 46 - 49, The fenced
code block containing the Application Password example (the block with "AbCD
1234 efGH 5678 ijKL 9012") is missing a language specifier; update the markdown
by adding a language tag (use "text") after the opening backticks so the block
reads ```text to satisfy MD040 and make the snippet explicit.


</details>

</blockquote></details>
<details>
<summary>scripts/completions/mainwpcontrol.zsh (1)</summary><blockquote>

`11-11`: **Inconsistent variable name: `_MAINWPCTL_COMPLETION_DIR` not renamed.**

The variable on line 11 still uses the old `MAINWPCTL` prefix while all functions have been renamed to `_mainwpcontrol_*`. For consistency with the rename, this should be updated.



<details>
<summary>♻️ Rename variable for consistency</summary>

```diff
 # Determine the directory where this script is located
-_MAINWPCTL_COMPLETION_DIR="${0:A:h}"
+_MAINWPCONTROL_COMPLETION_DIR="${0:A:h}"

 # Source the profile completer helper
-if [[ -f "${_MAINWPCTL_COMPLETION_DIR}/profile-completer.sh" ]]; then
-    source "${_MAINWPCTL_COMPLETION_DIR}/profile-completer.sh"
+if [[ -f "${_MAINWPCONTROL_COMPLETION_DIR}/profile-completer.sh" ]]; then
+    source "${_MAINWPCONTROL_COMPLETION_DIR}/profile-completer.sh"
 fi
```
</details>

<details>
<summary>🤖 Prompt for AI Agents</summary>

```
Verify each finding against the current code and only fix it if needed.

In `@scripts/completions/mainwpcontrol.zsh` at line 11, Update the inconsistent
variable name _MAINWPCTL_COMPLETION_DIR to match the new naming convention used
by the functions (e.g., _mainwpcontrol_*): locate where
_MAINWPCTL_COMPLETION_DIR is defined and rename it to
_mainwpcontrol_completion_dir (or the project’s chosen snake-case/case style for
_mainwpcontrol_) and update any references that use _MAINWPCTL_COMPLETION_DIR so
they point to the new name (ensure consistency with functions like
_mainwpcontrol_complete and any other _mainwpcontrol_* symbols).
```

</details>

</blockquote></details>
<details>
<summary>scripts/completions/profile-completer.sh (1)</summary><blockquote>

`9-10`: **Consider using POSIX-compliant syntax or updating the shebang.**

The script uses `local` (line 10), which is not defined in POSIX `sh`. While this works fine when sourced by bash/zsh (the intended use case), the `#!/bin/sh` shebang is technically inconsistent.

Options:
1. Change shebang to `#!/bin/bash` to match the bashism usage
2. Remove `local` if strict POSIX compliance is needed

Since this script is only sourced by bash/zsh completion scripts, this is unlikely to cause runtime issues.



<details>
<summary>🔧 Option 1: Update shebang to bash</summary>

```diff
-#!/bin/sh
+#!/bin/bash
 # profile-completer.sh - Helper script to get available mainwpcontrol profile names
```
</details>

<details>
<summary>🤖 Prompt for AI Agents</summary>

```
Verify each finding against the current code and only fix it if needed.

In `@scripts/completions/profile-completer.sh` around lines 9 - 10, The function
_mainwpcontrol_get_profiles uses the bash-only keyword local, so update the
script shebang from #!/bin/sh to a bash-compatible interpreter (e.g. change to
#!/usr/bin/env bash or #!/bin/bash) so the local declaration is valid when the
script is executed/sourced; keep the local usage in _mainwpcontrol_get_profiles
and any other functions that rely on bashisms to avoid refactoring to POSIX sh.
```

</details>

</blockquote></details>

</blockquote></details>

<details>
<summary>🤖 Prompt for all review comments with AI agents</summary>

Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In @docs/workflows/monitoring-integration.md:

  • Around line 85-88: Add a language specifier to the fenced code block that
    contains the expected output string @mainwp/control/x.y.z darwin-arm64 node-vNN.NN.N so it renders consistently (e.g., change the opening totext); ensure the closing ``` remains and nothing else in the block is
    altered.

In @docs/workflows/monthly-batch-updates.md:

  • Around line 46-49: The fenced code block containing the Application Password
    example (the block with "AbCD 1234 efGH 5678 ijKL 9012") is missing a language
    specifier; update the markdown by adding a language tag (use "text") after the
    opening backticks so the block reads ```text to satisfy MD040 and make the
    snippet explicit.

In @scripts/completions/mainwpcontrol.bash:

  • Around line 11-16: Rename the internal variable _MAINWPCTL_COMPLETION_DIR to
    _MAINWPCONTROL_COMPLETION_DIR throughout the script: update its declaration
    where it's set with cd/dirname and any subsequent references (e.g., the
    conditional that checks and sources
    "${_MAINWPCTL_COMPLETION_DIR}/profile-completer.sh") so they consistently use
    the new symbol _MAINWPCONTROL_COMPLETION_DIR.

In @scripts/completions/mainwpcontrol.zsh:

  • Line 11: Update the inconsistent variable name _MAINWPCTL_COMPLETION_DIR to
    match the new naming convention used by the functions (e.g., mainwpcontrol):
    locate where _MAINWPCTL_COMPLETION_DIR is defined and rename it to
    _mainwpcontrol_completion_dir (or the project’s chosen snake-case/case style for
    mainwpcontrol) and update any references that use _MAINWPCTL_COMPLETION_DIR so
    they point to the new name (ensure consistency with functions like
    _mainwpcontrol_complete and any other mainwpcontrol
    symbols).

In @scripts/completions/profile-completer.sh:

  • Around line 9-10: The function _mainwpcontrol_get_profiles uses the bash-only
    keyword local, so update the script shebang from #!/bin/sh to a bash-compatible
    interpreter (e.g. change to #!/usr/bin/env bash or #!/bin/bash) so the local
    declaration is valid when the script is executed/sourced; keep the local usage
    in _mainwpcontrol_get_profiles and any other functions that rely on bashisms to
    avoid refactoring to POSIX sh.

In @src/lib/base-command.ts:

  • Around line 160-170: The user-facing hint messages in BaseCommand (where
    this.currentProfile is set and where a ConfigError is thrown) use a hardcoded
    CLI name; update those messages to reference the dynamic this.config.bin instead
    so runtime hints stay correct after renames — replace the literal
    "mainwpcontrol" occurrences in the messages around the
    currentProfile/profileStore.getActive logic with this.config.bin (ensure the
    same change is applied to both the 'profile list'/'login' hint and the 'Create
    your first profile' hint).

In @src/utils/errors.ts:

  • Line 2: The base error class name MainWPCTLError is inconsistent with the new
    CLI name (mainwpcontrol); rename the class to MainWPControlError and update its
    export to match, then search and replace all references/usages of MainWPCTLError
    across the codebase (imports, instanceof checks, tests, and docs) to use
    MainWPControlError so names remain consistent with the updated documentation and
    CLI branding.

</details>

---

<details>
<summary>ℹ️ Review info</summary>

<details>
<summary>⚙️ Run configuration</summary>

**Configuration used**: Organization UI

**Review profile**: CHILL

**Plan**: Pro

**Run ID**: `f635644b-ec3f-4f27-a11b-756e34218041`

</details>

<details>
<summary>📥 Commits</summary>

Reviewing files that changed from the base of the PR and between c380258cd19c7edcab61ddbe927ec3629e1df506 and 01edfa2113cb0bfd8fb3e905b9ff9c09f35c9457.

</details>

<details>
<summary>⛔ Files ignored due to path filters (1)</summary>

* `package-lock.json` is excluded by `!**/package-lock.json`

</details>

<details>
<summary>📒 Files selected for processing (73)</summary>

* `.env.example`
* `README.md`
* `docs/workflows/daily-health-check.md`
* `docs/workflows/input-from-file.md`
* `docs/workflows/monitoring-integration.md`
* `docs/workflows/monthly-batch-updates.md`
* `docs/workflows/plugin-deployment-verification.md`
* `package.json`
* `scripts/completions/README.md`
* `scripts/completions/mainwpcontrol.bash`
* `scripts/completions/mainwpcontrol.zsh`
* `scripts/completions/profile-completer.sh`
* `scripts/completions/regenerate.sh`
* `src/__tests__/e2e/command-workflows.test.ts`
* `src/__tests__/e2e/exit-codes.test.ts`
* `src/__tests__/e2e/json-contract.test.ts`
* `src/__tests__/e2e/login-abilities-flow.test.ts`
* `src/__tests__/e2e/non-tty-behavior.test.ts`
* `src/__tests__/process/abilities-info.test.ts`
* `src/__tests__/process/abilities-list.test.ts`
* `src/__tests__/process/abilities-run.test.ts`
* `src/__tests__/process/auth.test.ts`
* `src/__tests__/process/batch-wait.test.ts`
* `src/__tests__/process/doctor.test.ts`
* `src/__tests__/process/exit-codes.test.ts`
* `src/__tests__/process/fixtures/cli-runner.ts`
* `src/__tests__/process/fixtures/config-dir.ts`
* `src/__tests__/process/global-flags.test.ts`
* `src/__tests__/process/live-api.test.ts`
* `src/__tests__/process/live-workflow-docs.test.ts`
* `src/__tests__/process/scenarios.test.ts`
* `src/__tests__/process/smoke.test.ts`
* `src/chat/chat-engine.test.ts`
* `src/chat/chat-engine.ts`
* `src/chat/providers/anthropic.ts`
* `src/chat/providers/gemini.ts`
* `src/chat/providers/local.ts`
* `src/chat/providers/openai.ts`
* `src/chat/providers/openrouter.ts`
* `src/chat/providers/provider.ts`
* `src/chat/system-prompt.ts`
* `src/chat/tool-envelope.ts`
* `src/commands/abilities/info.ts`
* `src/commands/abilities/list.ts`
* `src/commands/abilities/run.ts`
* `src/commands/chat.ts`
* `src/commands/config/show.ts`
* `src/commands/doctor.ts`
* `src/commands/jobs/watch.ts`
* `src/commands/login.ts`
* `src/commands/profile/delete.ts`
* `src/commands/profile/list.ts`
* `src/commands/profile/use.ts`
* `src/config/keychain.ts`
* `src/config/profile-store.ts`
* `src/config/settings.ts`
* `src/core/abilities-executor.ts`
* `src/core/batch-manager.ts`
* `src/core/http-client.ts`
* `src/core/safety-controller.ts`
* `src/lib/base-command.ts`
* `src/output/formatter.ts`
* `src/output/json-envelope.ts`
* `src/utils/audit-logger.ts`
* `src/utils/colors.ts`
* `src/utils/errors.ts`
* `src/utils/exit-codes.ts`
* `src/utils/format.ts`
* `src/utils/prompt.ts`
* `src/utils/retry.ts`
* `src/utils/terminal-sanitizer.ts`
* `src/validation/input-sanitizer.ts`
* `src/validation/schema-validator.ts`

</details>

</details>

<!-- This is an auto-generated comment by CodeRabbit for review status -->

@dennisdornon dennisdornon merged commit 5dfd6dd into main Mar 24, 2026
9 checks passed
@dennisdornon dennisdornon deleted the rename/mainwpctl-to-mainwpcontrol branch March 24, 2026 15:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant