WIP Remove jumper is support of command palette#285
Conversation
📝 WalkthroughWalkthroughThis PR removes the Jumper UI: deletes its CSS and JS assets, removes the Jumper UI class and related admin integration, and removes related AJAX search handlers; also includes a small change to command-palette slug handling. Changes
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 inconclusive)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 3
🧹 Nitpick comments (6)
inc/managers/class-customer-manager.php (1)
21-24: Fix misleading class docblock for Customer_ManagerThe docblock says “Handles processes related to webhooks,” but this class manages customers. Consider updating it for clarity:
- * Handles processes related to webhooks. + * Handles processes related to customers.assets/js/command-palette.js (2)
15-19: Remove or conditionally enable debug console.log statements before release.Multiple
console.logstatements are present throughout the file for debugging purposes. These should be removed or wrapped in a debug flag check before production release to avoid cluttering the browser console.Consider wrapping debug logs in a conditional:
+const DEBUG = config.debug || false; + +function log(...args) { + if (DEBUG) { + console.log('[Ultimate Multisite]', ...args); + } +} + // Then replace console.log calls with: -console.log('[Ultimate Multisite] Command palette API detected, initializing...'); +log('Command palette API detected, initializing...');Also applies to: 32-37, 82-82, 88-88, 114-114, 150-150, 174-174, 195-195
286-286: Pluralization fallback may not handle irregular plurals.The fallback
entity.label + 's'assumes regular English pluralization. Whilelabel_pluralfrom the backend should normally be provided, consider that irregular nouns (e.g., "Category" → "Categories") won't be handled correctly by the fallback.This is acceptable if the backend consistently provides
label_plural, but worth noting for edge cases or third-party extensions.inc/apis/trait-command-palette.php (1)
115-118: Simple pluralization may not handle irregular nouns.Adding
's'works for current entity types but won't handle irregular plurals correctly. Consider allowing managers to override this method or providing explicit plural forms in the configuration.Current entity names (customer, site, membership, etc.) pluralize correctly with 's', so this is acceptable for now but worth noting for future extensibility.
inc/apis/class-command-palette-rest-controller.php (2)
145-145: Remove redundant default value.The
limitparameter already has a default value of 15 defined inget_search_params()(Line 103). The?: 15fallback is unnecessary.Apply this diff:
- $limit = $request->get_param('limit') ?: 15; + $limit = $request->get_param('limit');
147-155: Consider removing duplicate validation.The minimum query length check here duplicates the validation callback defined in
get_search_params()(Line 90). The REST framework will reject requests with short queries before reaching this handler.This block can be safely removed:
- // Minimum query length - if (strlen($query) < 2) { - return rest_ensure_response( - [ - 'results' => [], - 'message' => __('Query must be at least 2 characters.', 'ultimate-multisite'), - ] - ); - } -
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (19)
assets/css/jumper.css(0 hunks)assets/js/command-palette.js(1 hunks)assets/js/jumper.js(0 hunks)inc/apis/class-command-palette-rest-controller.php(1 hunks)inc/apis/trait-command-palette.php(1 hunks)inc/class-ajax.php(0 hunks)inc/class-wp-ultimo.php(1 hunks)inc/managers/class-broadcast-manager.php(2 hunks)inc/managers/class-checkout-form-manager.php(2 hunks)inc/managers/class-customer-manager.php(2 hunks)inc/managers/class-discount-code-manager.php(2 hunks)inc/managers/class-domain-manager.php(2 hunks)inc/managers/class-membership-manager.php(2 hunks)inc/managers/class-payment-manager.php(2 hunks)inc/managers/class-product-manager.php(2 hunks)inc/managers/class-site-manager.php(2 hunks)inc/managers/class-webhook-manager.php(2 hunks)inc/ui/class-command-palette-manager.php(1 hunks)inc/ui/class-jumper.php(0 hunks)
💤 Files with no reviewable changes (4)
- assets/css/jumper.css
- inc/class-ajax.php
- assets/js/jumper.js
- inc/ui/class-jumper.php
🧰 Additional context used
🧬 Code graph analysis (10)
inc/managers/class-customer-manager.php (2)
inc/class-wp-ultimo.php (1)
WP_Ultimo(23-956)inc/apis/trait-command-palette.php (1)
enable_command_palette(42-50)
inc/managers/class-payment-manager.php (2)
inc/class-wp-ultimo.php (1)
WP_Ultimo(23-956)inc/apis/trait-command-palette.php (1)
enable_command_palette(42-50)
inc/managers/class-membership-manager.php (2)
inc/class-wp-ultimo.php (1)
WP_Ultimo(23-956)inc/apis/trait-command-palette.php (1)
enable_command_palette(42-50)
inc/managers/class-site-manager.php (2)
inc/class-wp-ultimo.php (1)
WP_Ultimo(23-956)inc/apis/trait-command-palette.php (1)
enable_command_palette(42-50)
inc/managers/class-domain-manager.php (2)
inc/class-wp-ultimo.php (1)
WP_Ultimo(23-956)inc/apis/trait-command-palette.php (1)
enable_command_palette(42-50)
inc/class-wp-ultimo.php (4)
ultimate-multisite.php (1)
WP_Ultimo(124-126)inc/ui/class-command-palette-manager.php (1)
Command_Palette_Manager(22-247)inc/deprecated/deprecated.php (1)
get_instance(353-356)inc/apis/class-command-palette-rest-controller.php (1)
Command_Palette_Rest_Controller(22-266)
assets/js/command-palette.js (1)
inc/apis/class-command-palette-rest-controller.php (2)
search(141-213)init(48-51)
inc/ui/class-command-palette-manager.php (2)
inc/apis/class-command-palette-rest-controller.php (1)
init(48-51)inc/functions/helper.php (1)
wu_get_version(21-24)
inc/managers/class-discount-code-manager.php (2)
inc/class-wp-ultimo.php (1)
WP_Ultimo(23-956)inc/apis/trait-command-palette.php (1)
enable_command_palette(42-50)
inc/apis/trait-command-palette.php (3)
inc/ui/class-command-palette-manager.php (1)
register_entity_type(108-111)inc/models/class-customer.php (2)
get_display_name(211-220)get_email_address(284-293)inc/models/class-discount-code.php (1)
get_code(219-222)
🪛 PHPMD (2.15.0)
inc/apis/class-command-palette-rest-controller.php
182-182: Avoid unused local variables such as '$config'. (undefined)
(UnusedLocalVariable)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
- GitHub Check: cypress (8.2, chrome)
- GitHub Check: cypress (8.1, chrome)
🔇 Additional comments (28)
inc/managers/class-broadcast-manager.php (1)
31-32: Command Palette wiring for broadcasts matches the shared patternIncluding
\WP_Ultimo\Apis\Command_Paletteand invokingenable_command_palette()ininit()cleanly optsBroadcast_Managerinto the new command palette flow without changing existing behavior.Also applies to: 64-65
inc/managers/class-payment-manager.php (1)
34-35: Payments now correctly participate in the command paletteAdding the
Command_Palettetrait and callingenable_command_palette()duringinit()brings payments into the centralized search/navigation system with no impact on existing hooks.Also applies to: 68-69
inc/managers/class-domain-manager.php (1)
32-33: Domain manager command palette support is hooked up correctlyUsing the
Command_Palettetrait and enabling it ininit()is consistent with other managers and should make domains available to the command palette without affecting existing domain-mapping flows.Also applies to: 139-140
inc/managers/class-webhook-manager.php (1)
30-31: Webhook manager palette integration is consistent and non‑disruptiveTrait inclusion plus
enable_command_palette()ininit()neatly registers webhooks with the new command palette infrastructure and leaves existing webhook behavior unchanged.Also applies to: 79-80
inc/managers/class-customer-manager.php (1)
31-32: Customers are correctly opted into the command paletteAdding the
Command_Palettetrait and enabling it duringinit()aligns Customer_Manager with the other managers participating in command palette search, without altering existing login/verification logic.Also applies to: 64-65
inc/managers/class-discount-code-manager.php (1)
30-31: Discount codes now exposed to the command palette as intendedIncluding the
Command_Palettetrait and callingenable_command_palette()ininit()correctly wires Discount_Code_Manager into the shared command palette infrastructure without impacting the payment‑received listener.Also applies to: 63-64
inc/class-wp-ultimo.php (1)
453-456: Core now boots the command palette manager and REST controller in the right placeInitializing
WP_Ultimo\UI\Command_Palette_ManagerandWP_Ultimo\Apis\Command_Palette_Rest_Controllerfromload_extra_components()is consistent with how other UI and API components are loaded and cleanly replaces the legacy Jumper bootstrap.Also applies to: 457-460
inc/managers/class-checkout-form-manager.php (1)
28-29: Checkout forms are correctly registered for command palette supportUsing the
Command_Palettetrait and callingenable_command_palette()ininit()brings checkout forms into the shared palette ecosystem while keeping the manager’s responsibilities small and focused.Also applies to: 59-60
inc/managers/class-membership-manager.php (1)
30-30: LGTM! Command Palette trait integration follows established patterns.The trait usage and
enable_command_palette()call are consistent with the existingRest_Api,WP_CLI, andMCP_Abilitiestrait integrations in this manager.Also applies to: 64-65
inc/managers/class-site-manager.php (1)
32-32: LGTM! Consistent Command Palette integration.The trait integration mirrors the pattern used in other managers and follows the established conventions for enabling API capabilities.
Also applies to: 65-66
inc/managers/class-product-manager.php (1)
30-30: LGTM! Command Palette integration is consistent.The trait usage and initialization call follow the same pattern established across other manager classes.
Also applies to: 62-63
assets/js/command-palette.js (1)
47-136: LGTM! Well-structured search hook with caching and debouncing.The
useEntitySearchhook implements sensible patterns: 300ms debounce for API calls, minimum 2-character search threshold, in-memory caching, and proper cleanup of timeouts. The cache persists for the page session which is appropriate for command palette usage.inc/apis/trait-command-palette.php (4)
42-50: LGTM! Clean trait initialization pattern.The
enable_command_palette()method follows the established pattern from other API traits, with an early return guard and deferred registration via theinithook at priority 20.
254-269: LGTM! Robust title extraction with appropriate fallbacks.The method chains through common getter methods (
get_display_name,get_title,get_name) with a sensible ID-based fallback, ensuring a title is always returned regardless of entity type.
279-322: LGTM! Well-structured entity-specific subtitle generation.The method appropriately uses
method_existschecks before calling entity-specific getters, and the switch statement provides clean separation for different entity types. The bullet separator (•) provides a clean visual delimiter.
192-218: No action required. The wildcard search pattern'search' => "*{$query}*"is fully supported and is the standard convention used throughout the codebase for search queries inwu_get_*functions (e.g.,wu_get_sites(),wu_get_customers()). The implementation correctly follows established patterns.inc/apis/class-command-palette-rest-controller.php (5)
1-51: LGTM! Clean class structure.The controller follows WordPress REST API patterns with proper namespace usage and singleton initialization.
59-73: LGTM! Proper route registration.The REST route is properly configured with appropriate methods, callbacks, and parameter validation.
81-109: LGTM! Well-defined search parameters.The parameter definitions include appropriate validation, sanitization, and constraints.
225-248: LGTM! Solid delegation pattern.The method properly validates the manager class, checks capabilities, and delegates to entity-specific search logic.
258-265: LGTM! Convention-based class resolution.The method uses string manipulation to derive manager class names from entity slugs. While this relies on naming conventions, the
class_exists()check provides safety, and this pattern appears consistent with the codebase's architecture.inc/ui/class-command-palette-manager.php (7)
1-45: LGTM! Well-structured manager class.The class follows WordPress patterns with proper initialization hooks and singleton usage.
54-71: LGTM! Appropriate version detection strategy.The check for WordPress 6.4+ with JavaScript-based feature detection is a sound approach. The comment clarifies that 6.9+ has admin-wide support while 6.4+ has editor support.
79-97: LGTM! Appropriate context gating.The method properly restricts Command Palette loading to admin area with appropriate capability checks.
108-122: LGTM! Clean entity registration API.The registration methods provide a straightforward interface for managing entity types.
130-162: LGTM! Proper script enqueueing and configuration.The script is properly enqueued with all necessary dependencies and comprehensive configuration data passed to JavaScript.
170-205: LGTM! Robust custom links parsing with backward compatibility.The method properly parses custom links from the legacy
jumper_custom_linkssetting (Line 172), maintaining backward compatibility during the Jumper-to-Command Palette migration. The use ofexplode(':', $line, 2)correctly handles URLs containing colons (e.g., ports, protocols).
213-246: LGTM! Clear settings interface.The settings registration provides a clear interface for custom links configuration. The retention of the
jumper_custom_linksfield ID maintains backward compatibility during the transition.
|
the command pallet is not really ready yet. W'll review in WP 7 |
Replaces the legacy Jumper quick-navigation widget with the native
WordPress Command Palette (Ctrl/Cmd+K), available since WordPress 6.4.
## What was built
- Command_Palette_Manager (inc/ui/): singleton that gates on WP 6.4+,
enqueues command-palette.js, localises config (entities, REST URL,
nonce, custom links), and registers a 'Tools > Command Palette' settings
section reusing the existing jumper_custom_links setting.
- Command_Palette trait (inc/apis/): added to all 10 entity managers
(broadcast, checkout_form, customer, discount_code, domain, membership,
payment, product, site, webhook). Each manager calls
enable_command_palette() in init(), which registers the entity with the
manager on the 'init' hook.
- Command_Palette_Rest_Controller (inc/apis/): REST endpoint at
ultimate-multisite/v1/command-palette/search. Requires manage_network
capability. Searches all registered entity types (or a specific one via
entity_type param), applies wu_command_palette_search_results filter.
- command-palette.js: registers a dynamic command loader (useEntitySearch
hook with 300ms debounce, 2-char minimum, result caching) plus static
commands for the dashboard, settings, system info, entity list pages,
and custom links. Uses wp.commands, wp.element, wp.apiFetch.
- class-wp-ultimo.php: loads Command_Palette_Manager and
Command_Palette_Rest_Controller instead of Jumper::get_instance().
## CodeRabbit fixes applied
- slug.replace('_', '-') → slug.replace(/_/g, '-') to handle multi-
underscore slugs (e.g. checkout_form → checkout-forms).
- search_permissions_check(): removed strict bool return type; actual
return is bool|WP_Error per WP REST API convention.
- foreach ($entities as $slug => $config): changed to
foreach (array_keys($entities) as $slug) to avoid unused variable.
## Scope
The legacy Jumper UI is no longer loaded. The underlying AJAX search
handlers (search_models, render_selectize_templates) are intentionally
preserved — they are used by selectize dropdowns throughout the admin
and are not Jumper-specific.
Closes #474
Ref: PR #285 (closed WIP)
#477) feat: implement WordPress Command Palette to replace Jumper navigation Implements the WordPress Command Palette (⌘K / Ctrl+K) as a replacement for the legacy Jumper navigation widget. - Command_Palette_Manager, Command_Palette trait, REST controller - Integrated across 10 entity managers - command-palette.js with debounced search, static commands, custom links - All CodeRabbit findings from PR #285 addressed upfront Closes #474 Ref: PR #285 (closed WIP)
|
Dispatching worker to address 3 unresolved CodeRabbit suggestions before merge.
aidevops.sh v3.5.538 plugin for OpenCode v1.3.0 with claude-sonnet-4-6 spent 2m and 5,554 tokens on this as a headless worker. Overall, 115d 19h since this issue was created. |
|
PR has merge conflicts — branch is 440 commits behind main. Dispatching worker to rebase.
aidevops.sh v3.5.538 plugin for OpenCode v1.3.0 with claude-sonnet-4-6 spent 8m and 14,919 tokens on this as a headless worker. Overall, 115d 19h since this issue was created. |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
assets/js/command-palette.js (1)
10-37: Consider removing or gating console logs for production.Multiple
console.logstatements throughout the file (lines 15, 19, 32-37, 82, 88, 114, 119, 150, 174, 195, 307) are useful for debugging but add noise in production. Consider wrapping them in a debug flag or removing them.💡 Example approach
// Add near the top of the IIFE const DEBUG = window.wuCommandPalette?.debug || false; const log = DEBUG ? console.log.bind(console, '[Ultimate Multisite]') : () => {}; // Then replace console.log calls: log('Command palette API detected, initializing...');🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@assets/js/command-palette.js` around lines 10 - 37, The file currently emits multiple console.log calls (e.g., the initialization message and configuration dump referencing config, entities, restUrl, customLinks) which should be gated for production; add a DEBUG flag (sourced from window.wuCommandPalette?.debug) near the top of the IIFE and create a log wrapper (e.g., const log = DEBUG ? console.log.bind(console, '[Ultimate Multisite]') : () => {}) then replace all console.log usages in this module (including the initialization, configuration output and other debug lines) with the log wrapper so logs only appear when DEBUG is true.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@inc/apis/class-command-palette-rest-controller.php`:
- Around line 119-131: Remove the PHP 8 union return type from the method
signature of search_permissions_check — delete ": bool|\WP_Error" so the
function has no return type declaration (leave the existing body that returns
true or new \WP_Error intact) and ensure the method is documented with PHPDoc to
state it returns bool|\WP_Error; this keeps compatibility with PHP 7.4 while
preserving behavior.
---
Nitpick comments:
In `@assets/js/command-palette.js`:
- Around line 10-37: The file currently emits multiple console.log calls (e.g.,
the initialization message and configuration dump referencing config, entities,
restUrl, customLinks) which should be gated for production; add a DEBUG flag
(sourced from window.wuCommandPalette?.debug) near the top of the IIFE and
create a log wrapper (e.g., const log = DEBUG ? console.log.bind(console,
'[Ultimate Multisite]') : () => {}) then replace all console.log usages in this
module (including the initialization, configuration output and other debug
lines) with the log wrapper so logs only appear when DEBUG is true.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: b1a9ce4c-adad-4f45-b963-f541526efb4e
📒 Files selected for processing (2)
assets/js/command-palette.jsinc/apis/class-command-palette-rest-controller.php
|
Rebase worker exited without completing. The branch is 440 commits behind main with 7 conflict files:
This rebase requires manual resolution — the conflicts span core files that have changed significantly in 440 commits. Recommend: maintainer manually rebases or cherry-picks the command palette feature onto a fresh branch from main. Aborted the incomplete rebase to restore repo to clean state. aidevops.sh v3.5.538 plugin for OpenCode v1.3.0 with claude-sonnet-4-6 spent 13m and 18,893 tokens on this as a headless worker. Overall, 115d 19h since this issue was created. |
|
Dispatching rebase worker.
aidevops.sh v3.5.538 plugin for OpenCode v1.3.0 with claude-sonnet-4-6 spent 5m and 13,575 tokens on this as a headless worker. Overall, 115d 19h since this issue was created. |
2e0f73b to
4e0ed99
Compare
🔨 Build Complete - Ready for Testing!📦 Download Build Artifact (Recommended)Download the zip build, upload to WordPress and test:
🌐 Test in WordPress Playground (Very Experimental)Click the link below to instantly test this PR in your browser - no installation needed! Login credentials: |
|
Performance Test Results Performance test results for 0751b95 are in 🛎️! Note: the numbers in parentheses show the difference to the previous (baseline) test run. Differences below 2% or 0.5 in absolute values are not shown. URL:
|
|
Dispatching worker to address CodeRabbit review suggestions before merge.
aidevops.sh v3.5.538 plugin for OpenCode v1.3.0 with claude-sonnet-4-6 spent 16m and 13,387 tokens on this as a headless worker. Overall, 115d 20h since this issue was created. |
…rsion in slug URLs
Addresses CodeRabbit suggestion: String.replace(/_/g, '-') is functionally
equivalent but replaceAll('_', '-') is more explicit and directly matches
the CodeRabbit suggestion for clarity.
🔨 Build Complete - Ready for Testing!📦 Download Build Artifact (Recommended)Download the zip build, upload to WordPress and test:
🌐 Test in WordPress Playground (Very Experimental)Click the link below to instantly test this PR in your browser - no installation needed! Login credentials: |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
assets/js/command-palette.js (1)
15-19: Consider removing debug console statements before final merge.Multiple
console.logcalls throughout the file (lines 15, 19, 32, 82, 88, 114, 150, 174, 195) will clutter browser consoles in production. Since this is WIP, these can be cleaned up before the final merge.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@assets/js/command-palette.js` around lines 15 - 19, Remove the debug console.log statements that print messages like '[Ultimate Multisite] Command palette not available - wp.commands or wp.element missing' and '[Ultimate Multisite] Command palette API detected, initializing...' from assets/js/command-palette.js; either delete them or wrap them behind a DEBUG flag/constant (e.g., DEBUG || process.env.NODE_ENV !== 'production') so they don’t run in production, and ensure all other console.log calls in this file (the remaining debug messages) are similarly removed or guarded before merging.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@assets/js/command-palette.js`:
- Around line 15-19: Remove the debug console.log statements that print messages
like '[Ultimate Multisite] Command palette not available - wp.commands or
wp.element missing' and '[Ultimate Multisite] Command palette API detected,
initializing...' from assets/js/command-palette.js; either delete them or wrap
them behind a DEBUG flag/constant (e.g., DEBUG || process.env.NODE_ENV !==
'production') so they don’t run in production, and ensure all other console.log
calls in this file (the remaining debug messages) are similarly removed or
guarded before merging.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 4241ba68-673e-40bd-914a-b26b5041954c
📒 Files selected for processing (1)
assets/js/command-palette.js
|
Completed via PR #285, merged to main. Merged by deterministic merge pass (pulse-wrapper.sh). No worker summary was available — the worker either crashed before writing one or this PR predates the merge summary convention. |
Summary by CodeRabbit