wp-admin: hide-when-empty submenu items#68
Merged
Conversation
A fresh install of openclaWP shows 13 submenu items, most pointing to empty pages. This commit makes most capability surfaces appear in the sidebar only when they have at least one entry — the system reacts to its own state instead of imposing a taxonomy on the user. Always visible: Chat, Channels, Workflows, Custom Tools, Settings. Hide-when-empty: Routines, Usage, Knowledge Base, MCP Servers, WhatsApp, Connected Clients, Tool activity, MCP Clients. Pages remain reachable via their `?page=…` URL even when hidden — only the menu entry is gated. An `openclawp_admin_menu_always_visible` filter lets host installs force-show a surface. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
5 tasks
lezama
added a commit
that referenced
this pull request
May 19, 2026
…#68) (#69) Adds a "Discover capabilities" panel below the chat UI on the openclaWP Chat admin page. Each row shows one capability surface with a one-line description, a population count or "Not set up yet" hint, and a link to that page. This is the discovery anchor that complements #68 (hide-when-empty submenu items): with the menu condensed, a first-time user now has one obvious place to see what openclaWP can do. Refactor: - `OpenclaWP_Admin_Menu_Visibility::is_surface_populated( string $slug ) : bool` and `surface_count( string $slug ): ?int` extracted as public static methods so the menu gating and the Discover panel share one source of truth (no risk of disagreeing about whether a capability is set up). - New `parent_for_slug()` convenience wrapper centralises the `add_submenu_page` parent-resolution pattern; 8 admin classes updated to use it. The panel is dismissible per user (stored in `openclawp_discover_dismissed` user meta). Settings page exposes a "Show it again" affordance. Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
5 tasks
lezama
added a commit
that referenced
this pull request
May 19, 2026
Adds an `openclawp_agent_file` CPT and a wp-admin → openclaWP → Agent files surface for authoring markdown documents (AGENTS.md, SOUL.md, BOOTSTRAP.md, …) that customise agent behaviour without touching PHP. Files target a specific agent via the `agent_slug` meta, or apply globally when that meta is empty. The new submenu is hide-when-empty (PR #68 pattern) and the Discover panel (PR #69) picks up the new surface automatically through the shared `OpenclaWP_Admin_Menu_Visibility::surface_count()` helper. A follow-up PR will wire the file contents into the runtime prompt assembler so the agent actually reads them — this PR ships the CPT + admin UI first so admins can start authoring while the runtime side bakes (TODO note in the store class header). Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
A fresh install of openclaWP shows 13 submenu items, most pointing to empty pages. This PR makes most capability surfaces appear in the sidebar only when they have at least one entry — the system reacts to its own state rather than imposing a taxonomy on the user.
Always visible (the conceptual primitives every install needs):
Hide-when-empty:
Deep-link URLs still work — only the menu visibility is affected. An
openclawp_admin_menu_always_visiblefilter lets host installs override.Why
Found during a UX review of the full plugin tour (finding #4). The "Advanced" / collapse alternative was rejected because:
Test plan
admin.php?page=openclawp-mcp-serversstill works when hidden from the menu.openclawp_admin_menu_always_visiblefilter keeps that item visible regardless of population.Follow-up (not in this PR)
🤖 Generated with Claude Code