dcdpr / dcdpr/jp

Add shell completion support with intelligent configuration field completion

Open
#238 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
Rust
Stars
16
Forks
3
Avg merge
1d 1h
Merged PRs (30d)
121

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

Resources

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading the Config fields method in crates/jp_config/src/config.rs and the CLI definitions in crates/jp_cli/src/lib.rs. Trace how jp config currently handles fields and workspace paths before planning the completion subcommand and shell-specific behavior. Done means bash, zsh, and fish completion support, workspace-aware field and array completion, installation guidance, and the requested config list-fields command.

Written by the indexing model from the issue text.

Assessment

Tech stack
bash, fish, rust, zsh
Domain
cli, developer-experience, documentation
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.