Skip to main content

GravityKit\GravityMigrate\Abilities\Bootstrap

Registers the gravitymigrate product and every ability under it.

The product declaration is what gives these abilities MCP tool names in Foundation's catalog at /wp-json/gravitykit/v1/abilities, which is the only place a connected client reads them from.

No-ops when the Abilities API is absent -- WordPress below 6.9, or a Foundation copy without the component. The rest of the plugin is unaffected.

Since: %ver%

Source: src/Abilities/Bootstrap.php:24

Details

  • Kind: class
  • Namespace: GravityKit\GravityMigrate\Abilities

Methods

MethodDescription
init()Wires the product and its abilities. Hooked to gk/foundation/initialized.
register_product()Declares the product: the MCP tool-name prefix, and every category an ability may sit in.
categories()The categories this product registers, keyed by slug.
next_steps_map()Which ability usually follows which, and when.
next_steps_for()One ability's follow-ups, or none.
register_abilities()Registers every ability class with Foundation.
ability_classes()Every ability class, found rather than listed.

Method Reference

init()

public static function init(): void

Wires the product and its abilities. Hooked to gk/foundation/initialized.

That fires on plugins_loaded and the registration action fires on init at priority 99, so callbacks added here are in place before either runs.

Returns

  • void

Since: %ver%

Source: src/Abilities/Bootstrap.php:36

register_product()

public static function register_product( array $products ): array

Declares the product: the MCP tool-name prefix, and every category an ability may sit in.

Foundation registers these before any ability registration runs, so every category an ability names exists by the time it is referenced.

Parameters

NameTypeDefaultDescription
$productsarrayProduct declarations, keyed by product slug.

Returns

  • array

Since: %ver%

Source: src/Abilities/Bootstrap.php:63

categories()

public static function categories(): array

The categories this product registers, keyed by slug.

A scope subcategory's slug must start with gk-gravitymigrate-, or Foundation derives no gk_scope and a cross-product scope filter misses every ability in it. discovery is the shared vocabulary for readonly listings; the others name what the ability acts on, never whether it writes, which is what the annotations carry.

Returns

  • array<string, — array{label:string, description:string}>

Since: %ver%

Source: src/Abilities/Bootstrap.php:84

next_steps_map()

public static function next_steps_map(): array

Which ability usually follows which, and when.

Surfaced verbatim on each ability's meta.annotations.next_steps, which the MCP client appends to that tool's description as real tool names. A step pointing at an ability this product does not register is dropped by the client without a warning.

A missing key means no guidance. Memoised, so the __() calls fire once per request.

Returns

  • array<string, — array<int, array{ability:string, when:string}>>

Since: %ver%

Source: src/Abilities/Bootstrap.php:118

next_steps_for()

public static function next_steps_for( string $ability_name ): array

One ability's follow-ups, or none.

Parameters

NameTypeDefaultDescription
$ability_namestringFully-qualified ability name.

Returns

  • array<int, — array{ability:string, when:string}>

Since: %ver%

Source: src/Abilities/Bootstrap.php:205

register_abilities()

public static function register_abilities( $manager=null ): void

Registers every ability class with Foundation.

Parameters

NameTypeDefaultDescription
$managermixednullFoundation's abilities manager, as the action passes it.

Returns

  • void

Since: %ver%

Source: src/Abilities/Bootstrap.php:220

ability_classes()

public static function ability_classes(): array

Every ability class, found rather than listed.

One file per ability under src/Abilities/{Category}/, discovered by glob. A file whose class is not an \Ability subclass named after it is skipped silently.

Returns

  • string[] — Fully-qualified class names, sorted by ability name.

Since: %ver%

Source: src/Abilities/Bootstrap.php:242