Skip to content

feat: implement filesystem-based hierarchical subcommand routing#623

Open
AboMeezO wants to merge 12 commits intoneplextech:mainfrom
AboMeezO:CommandHandler2.0
Open

feat: implement filesystem-based hierarchical subcommand routing#623
AboMeezO wants to merge 12 commits intoneplextech:mainfrom
AboMeezO:CommandHandler2.0

Conversation

@AboMeezO
Copy link
Copy Markdown

@AboMeezO AboMeezO commented Apr 8, 2026

Summary

Introduces a filesystem-based routing system for Discord commands, enabling hierarchical subcommands and subcommand groups to be defined through directory structure. The system builds a CommandTree and resolves it into valid Discord application commands automatically.

This update improves modularity, scalability, and command organization while maintaining full backward compatibility with flat command structures.

Key Changes

  • Filesystem Router

    • Added CommandsRouter to resolve directory structure into a command tree
    • Introduced CommandTree to represent hierarchical command relationships
  • Command Registration

    • Refactored AppCommandHandler to process hierarchical nodes
    • Generates ApplicationCommandData from the resolved tree
    • Includes diagnostic output for visualizing command structure
  • Middleware System

    • Added support for +middleware.ts at the directory level
    • Middleware is scoped and inherited by descendant commands only
  • Message Command Support

    • Enhanced MessageCommandParser to support hierarchical command paths
    • Maintains parity between slash commands and message-based commands
  • Testing & Examples

    • Added comprehensive tests for routing, parsing, and command generation
    • Included a full working example in the test-bot application

Impact

  • Fully backward compatible with existing flat commands
  • No breaking changes to current command handling
  • Hierarchical routing is opt-in and does not affect legacy structure

@vercel
Copy link
Copy Markdown

vercel bot commented Apr 8, 2026

@AboMeezO is attempting to deploy a commit to the Neplex Team on Vercel.

A member of the Team first needs to authorize it.

@vercel
Copy link
Copy Markdown

vercel bot commented Apr 9, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
commandkit Ready Ready Preview, Comment Apr 9, 2026 1:59am

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant