Skip to content

Expose queue_validator via WP-CLI command #511

@saraichinwag

Description

@saraichinwag

Problem

The QueueValidator tool is only available inside AI pipelines (registered via registerGlobalTool). When agents or humans need to validate topics from the CLI — e.g. during quiz/content ideation sessions — there's no way to call it.

I hit this today during quiz ideation: the task instructions said to use queue_validator for each candidate, but it's not callable from WP-CLI. Had to fall back to manual cross-referencing.

Proposed Solution

Add a WP-CLI subcommand that wraps QueueValidator::validate():

wp datamachine queue validate "Topic Title" --post_type=quiz --flow_id=48 --threshold=0.65

Output:

  • clear — no duplicates found
  • duplicate — shows match details (source, title, similarity score)

The validate() method is already cleanly factored out as a public method, separate from the AI tool wrapper. This should be a thin CLI command that passes args through.

Parameters

Flag Required Default Description
<topic> yes Topic/title to validate
--post_type no post Post type to check against
--flow_id no Flow ID for queue checking
--threshold no 0.65 Jaccard similarity threshold

Nice-to-have

  • Also register as a WordPress Ability so it's accessible from the Abilities API too
  • --format=json output option for scripting

Context

QueueValidator lives at inc/Engine/AI/Tools/Global/QueueValidator.php. The validate() method already returns structured results — just needs a CLI entry point.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions