Command Line (CLI)
Jankx provides a robust, built-in CLI via WP-CLI for blazing quick data generation, cache curation, option resets, and full demo imports.
1. System Commands (wp jankx system)
Useful for checking framework environment health, memory, and performance optimizations on the fly.
System Status & Health
wp jankx system status
wp jankx system health
These commands perform sanity checks, validating the current versions of PHP and WordPress against Jankx' minimum requirements. It will output memory usage statistics and ensure directories are writable.
Optimization & Maintenance
wp jankx system optimize
wp jankx system maintenance --enable
The optimize command flushes expired transients globally, deletes internal Jankx cache chunks, and flushes rewrite rules. maintenance toggles WordPress' maintenance mode flag.
2. Seeder Framework (wp jankx seed)
No need to struggle importing gigantic XML files just to get dummy data. The Jankx seeder dynamically bootstraps terms, posts, and configurations into the site database through specific, object-oriented PHP classes.
List seeders by Group
wp jankx seed list
wp jankx seed list --group=ecommerce
Execute a Seeder
# Run by ID/Alias
wp jankx seed run gaming-portal
# Run by Class Name (Laravel style)
wp jankx seed run PetShopSeeder
wp jankx seed run --class=BlogDemoSeeder
# Run by Group or with Options
wp jankx seed run --group=blog
wp jankx seed run pet-shop --verbose
Dry-run mode is also available via wp jankx seed run --dry-run to calculate the number of dummy items that will be generated without actually making alterations.
Rollback Seed Data
wp jankx seed rollback gaming-portal
A smart rollback implementation. Reverts ONLY the specific posts and categories generated by the seeded cycle without harming existing user data.
3. Import Full Demo Packages (wp jankx demo)
A full site replicator. Capable of restoring XML Content, Widget assignments, Theme Customizers, Menu hooks, and generic Site Options in a pipeline pattern. Parses from demos/manifest.json.
Discover demos:
wp jankx demo list
Import pipeline:
wp jankx demo import gaming-portal
wp jankx demo import pet-shop --xml-only
wp jankx demo import blog-magazine --skip-images
Clearing generated demo footprints:
wp jankx demo reset
wp jankx demo reset gaming-portal
4. Extending the CLI Config
You can provide specific commands and auto-inject seeders into your Theme's `config/cli.php` file.
// Appears in config/cli.php
return [
'commands' => [
'jankx custom_cmd' => App\Console\Commands\MyCustomCommand::class,
],
'seeders' => [
App\Console\Seeders\MovieDemoSeeder::class,
],
];
5. Guide: Creating a Custom Seeder
To create a specific data generation pipeline, extend AbstractSeeder and implement the run() method. Review the example below:
namespace App\Console\Seeders;
use Jankx\Foundation\Cli\Seeders\AbstractSeeder;
class MovieDemoSeeder extends AbstractSeeder
{
// Alias used for running (e.g. wp jankx seed run movie)
public static function getName(): string { return 'movie'; }
public static function getDescription(): string { return 'Seeds movie demo data'; }
// Estimation for dry-runs
public function count(): int { return 5; }
public function run(array $options = []): void
{
// ensurePost makes item generation idempotent (no duplicates allowed)
$this->ensurePost([
'post_title' => 'The Matrix',
'post_content' => 'Movie description...',
'post_type' => 'post',
'post_status' => 'publish'
]);
$this->log('Successfully generated movies!');
}
}
Make sure to register your new Seeder in the 'seeders' array located inside config/cli.php or hook it dynamically.
6. Guide: Creating a Theme Demo Package
To prepare a site template for others to import easily, follow these structural steps:
- On a configured WP install, export XML Content, Customizer config, and Widgets.
- Create a sub-folder under
demo/inside your theme (e.g.demo/my-store). - Copy/Paste your JSON and XML files directly into that directory.
- Modify the core
demo/manifest.jsonto register the package.
Example demo/manifest.json properties:
{
"my-store": {
"name": "My Store Demo",
"description": "E-Commerce boilerplate showcase",
"version": "1.0.0",
"files": {
"content": "content.xml", // Posts, Pages, Images
"widgets": "widgets.json", // Sidebar & Layout mappings
"customizer": "customizer.json", // Theme Mods config
"options": "options.json" // Global Site Options
}
}
}
You can now immediately trigger wp jankx demo import my-store from your terminal.
Made with ❤️ by Jankx Team