2.2 KiB
2.2 KiB
spec
| spec |
|---|
| dot-kde |
What to build
Extend the subcommand-discovery mechanism to glob one directory level
deeper, so a dot subcommand can live as commands/<name>/<name>.fish
alongside a companion file (e.g. a Python helper), not just as a flat
commands/<name>.fish. This mechanism exists in two places today
(dot.fish's __dot_help and completions/dot.fish's
__dot_custom_subcommands), intentionally duplicated rather than shared
(fish autoload constraints) — both must be updated together and stay in
sync. Existing flat-file subcommands must keep working unchanged.
This is pure prefactoring: no KDE-specific behavior is introduced here.
Acceptance criteria
dot helplists a subcommand that lives atcommands/<name>/<name>.fishdot <name>sources and dispatches tocommands/<name>/<name>.fish's_dot_<name>function- Tab-completion (
__dot_custom_subcommands) lists a nested-directory subcommand - Existing flat-file subcommands (
dot install) are still discovered and dispatched correctly tests/dot.fishcovers a nested-directory dummy command dispatching correctly, alongside the existing flat-file dispatch case
Implementation Notes
- The dispatch check in
dot.fishtries the flat file first, then falls back tocommands/<name>/<name>.fish— a flat file always wins if both somehow exist for the same name. - The nested-directory scan requires the file basename to match its containing directory's name (
commands/foo/foo.fish), not just any.fishfile one level deep — this matches the acceptance criteria's exact convention and avoids misclassifying a stray companion file (e.g. a.pyhelper) as its own subcommand. - Tab-completion's nested-directory listing was verified manually (sourcing
completions/dot.fishand calling__dot_custom_subcommandsdirectly) rather than via an automated test —tests/dot.fishhas no existing infrastructure for testing completions at all, even for pre-existing flat commands, so adding one here would be out of scope for this prefactoring task. - Updated
CLAUDE.md's "Architecture" and "Adding a subcommand" sections to document the new nested-directory convention, since it previously only described the flat-file dispatch contract.