-
Notifications
You must be signed in to change notification settings - Fork 1
Description
Add comprehensive shell completion support for jp including intelligent configuration field completion that understands current workspace context and array indexing.
Context
Currently jp lacks shell completion support, making it difficult to discover and use configuration options efficiently. This is particularly challenging given the rich configuration system with nested fields, arrays, and workspace-specific values. Other CLI tools like docker, git, and cargo provide excellent completion experiences that significantly improve usability.
The existing Config fields method already provides the foundation for listing all available configuration fields, and clap supports shell completion generation, making this enhancement very feasible.
Alternatives
Users currently need to manually reference documentation or use jp config show to discover configuration options, which breaks the flow when working in the terminal. Tab completion is the standard expectation for modern CLI tools.
Proposed Implementation
Add two main components:
Shell Completion Installation: Add jp completion subcommand with shell-specific installation for bash, zsh, and fish. Generate completion scripts using clap built-in completion support with installation instructions in help text.
Configuration Field Completion: Add jp config list-fields subcommand that uses existing Config fields method. Enhanced completion script that calls this subcommand for cfg and c arguments with workspace-aware completion that parses current configuration to provide array indexing.
Smart Array Completion: For array fields like assistant.instructions, completion should offer both the entire array override and individual element access with dynamic array length detection based on current workspace configuration.
Tasks
- Add jp completion subcommand that generates shell completion scripts using clap
- Add jp config list-fields subcommand that leverages existing Config fields method
- Create bash completion script that calls jp config list-fields for cfg completions
- Create zsh completion script with similar functionality
- Create fish completion script with similar functionality
- Enhance field listing to support workspace-aware array indexing by parsing current config
- Add completion for workspace paths when using workspace flag
- Update documentation with installation instructions for each shell