Skip to content

CLI: Add command to add follower for testing #1938

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Jul 24, 2025
Merged

Conversation

obenland
Copy link
Member

Proposed changes:

  • Introduces the add_follower WP-CLI command to add a follower to a user's followers list for testing purposes. The command accepts an actor URL and an optional user argument, defaulting to the blog actor if not specified.

@obenland obenland requested a review from pfefferle July 16, 2025 18:09
@obenland obenland self-assigned this Jul 16, 2025
@Copilot Copilot AI review requested due to automatic review settings July 16, 2025 18:09
@obenland obenland added the Skip Changelog Disables the "Changelog Updated" action for PRs where changelog entries are not necessary. label Jul 16, 2025
Copilot

This comment was marked as outdated.

@pfefferle
Copy link
Member

I see this in the same category as #1075

We should not add test/debug/dev cli commands, because this could confuse users.

obenland and others added 2 commits July 22, 2025 15:29
Introduces the `add_follower` WP-CLI command to add a follower to a user's followers list for testing purposes. The command accepts an actor URL and an optional user argument, defaulting to the blog actor if not specified.
@obenland obenland force-pushed the add/follower-command branch from 800bbab to 48cc294 Compare July 22, 2025 20:30
obenland added 2 commits July 22, 2025 15:43
Refactors the WP-CLI command implementation by moving development and testing commands (such as add_follower and generate comments) from includes/class-cli.php to a new development/class-cli.php. Updates development/load.php to register the new CLI command class for development environments, and removes the add_follower method from the main CLI class. This separation improves maintainability and organization of development tooling.
@obenland obenland requested a review from Copilot July 22, 2025 20:49
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR introduces WP-CLI development commands for testing ActivityPub functionality, specifically adding the ability to manually add followers to users for testing purposes. The changes create a separate development CLI namespace to distinguish testing commands from production ones.

  • Adds a new add_follower WP-CLI command for testing follower functionality
  • Creates a development-specific CLI command structure separate from production commands
  • Includes additional development tooling for generating test comments and reactions

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

File Description
includes/class-cli.php Adds necessary imports for Actors and Followers collections
development/load.php Registers development CLI commands and autoloader for development namespace
development/class-cli.php New file implementing development CLI commands including add_follower and generate commands
activitypub.php Minor cleanup removing unused WP_CLI import and fixing namespace reference

@pfefferle
Copy link
Member

Oh nice, you also brought over my comment generator 😍

@pfefferle
Copy link
Member

How do I best test this PR?

When running wp-env run cli wp activitypub add_follower [email protected] --user=1 I see an error:

Screenshot 2025-07-24 at 13 37 18

@obenland
Copy link
Member Author

Ah, I should have added that to the testing steps. I use npm run env -- run cli wp activitypub add_follower [email protected] --user=1, but I think your version with the global wp-env should work, too. Did you have docker running when you tried it?

@pfefferle
Copy link
Member

yes, docker was running. you can see the error message above. something because of security concerns.

...but it works with the command you provided! 👍

@obenland obenland merged commit 1d3c4bb into trunk Jul 24, 2025
11 checks passed
@obenland obenland deleted the add/follower-command branch July 24, 2025 13:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] CLI Skip Changelog Disables the "Changelog Updated" action for PRs where changelog entries are not necessary.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants