[Other] Terminal: shell tab completion for the strata command

Open Beginner friendly
#6,086 2 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 5 days

@ackalker is already working on this.

Since Nov 16, 2026.

  • #6087 by @ackalker — open

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
74/100
Issue type
Feature
Clarity
Clearly specified
Activity status
Active
Tech stack
bash, fish, python, zsh

Research direction

Start with parser() in strata_cli/cli.py to see how subcommands are defined, then read the existing Terminal tests and docs/TERMINAL.md. Add the opt-in completion command using the optional shtab package, keeping its import lazy and handling the missing-package case with exit code 2. Done when generated scripts cover current top-level commands, pass the listed shell syntax checks, and the setup is documented.

Written by the indexing model from the issue text.

Description

Problem: typing strata and pressing Tab in bash, zsh or fish completes nothing. The command grammar lives in strata_cli/cli.py (parser(), about 25 subcommands and many nested ones), and there is no way to get it into a shell. Workaround today: none, short of hand-writing a completion script, which drifts from the grammar as soon as a subcommand changes.

Version and system this was written and tested on: strata 0.2.15 (build 0.1.61; python 3.13.14) from a source checkout at c77572806. NVIDIA GeForce RTX 5080 with 16 GB VRAM, plus an AMD Radeon 610M iGPU; 60 GB RAM; CachyOS Linux, kernel 7.3.4-1-cachyos, x86_64. No GPU work is involved: this is a CLI-only change, validated with the mock-free Terminal test suite.

Proposal (small, opt-in): a strata complete --shell bash|zsh|fish subcommand that prints a completion script generated from the installed CLI's own argparse grammar with the optional shtab package, so there is no second grammar to maintain.

  • strata_cli/cli.py: one subparser and one ~10-line handler that prints shtab.complete(parser(), shell=...) to stdout.
  • shtab is imported lazily inside the handler only. The default path (serve, launch, status, …) changes by zero lines, and the hash-locked Terminal bundle gains no new package. Without shtab the command prints what to install and exits 2.
  • Tests: tests/terminal/test_shell_completions.py regenerates each script, checks it names every current top-level command and parses (bash -n, zsh -n, fish -n).
  • Docs: one short section in docs/TERMINAL.md.
  • No installer changes: the user adds one line to their shell profile.

Limits: PowerShell output is not generated (shtab has no PowerShell target); value completion (profile names, model IDs) is not in this scope. Subcommand and flag completion is the whole grammar already in the parser.

Related: I found no existing issue or PR about shell completion (searched "tab completion", "shell completion", "autocomplete", "shtab", "argcomplete").

Dominant language
C++
Stars
11.6k
Forks
1k
Avg merge
18d 13h
Merged PRs (30d)
4

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

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.

More from Niko1221/Strata

All issues in Niko1221/Strata

Similar issues

More C++ issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.