@Secret

@Secret

@Secret hides a command or subcommand from help listings and tab-completion suggestions, while still keeping it fully executable. This is useful for admin-only backdoors, debug commands, or internal utilities that you don't want regular users to discover.

Where to Place

On a class (subcommand class) or a method (subcommand method).

@Target({ElementType.TYPE, ElementType.METHOD})

Properties

None — @Secret is a marker annotation. Just place it and you're done.

Example







@RootCommand("secrettest")
public class SecretTestCommand {

    @Execute
    public void defaultUsage(PLATFORMSOURCE source) {
        source.reply("secrettest default");
    }

    // Normal subcommand — visible everywhere
    @SubCommand("visible")
    public static class VisibleSub {
        @Execute
        public void run(PLATFORMSOURCE source) {
            source.reply("visible executed");
        }
    }

    // Secret subcommand — hidden from help and tab-completion
    @Secret
    @SubCommand("hidden")
    public static class HiddenSub {
        @Execute
        public void run(PLATFORMSOURCE source) {
            source.reply("hidden executed");
        }

        @SubCommand("deep")
        public static class HiddenDeep {
            @Execute
            public void run(PLATFORMSOURCE source, @Named("val") String val) {
                source.reply("hidden deep val=" + val);
            }
        }
    }
}

What happens

Action Result
Tab-completing /secrettest Shows visible — does not show hidden
Tab-completing /secrettest hidden Returns empty — no suggestions leak
Tab-completing /secrettest hidden deep Returns empty — entire subtree is hidden
Running /secrettest hidden ✅ Executes successfully
Running /secrettest hidden deep someValue ✅ Executes successfully
Querying help for /secrettest Lists visible pathways — excludes all hidden pathways

Key Behavior

  • Tab-completion: Secret commands and their entire subtree are excluded from suggestions. Even if a user types the secret command name and presses tab, no deeper suggestions are shown.
  • Help entries: Secret commands are skipped during help query traversal. No pathway under a secret node appears in help listings.
  • Execution: Secret commands are still fully executable. A user who knows the command can run it normally.
  • Subtree hiding: Marking a command as @Secret hides everything beneath it — all its children, their children, and so on.