a2aproject / a2aproject/a2a-rs

a2acli: completion <shell> command

Offen
#182 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
enhancement
Vorherrschende Sprache
Rust
Sterne
75
Forks
19
Ø Merge
11 Std. 27 Min.
Gemergte PRs (30 T.)
21

Beschreibung

Part of #181 (Tier 2).

## Summary

`A2ACLI_CLI_002` (Tier 2) requires a `completion ` command that emits a shell completion script for the named shell (§7.1).

`a2acli` has no such command. The canonical Go CLI gets this for free — cobra registers a default `completion` command — which is why it does not appear in its `internal/cli/`. clap does not, so this needs the `clap_complete` crate.

## Why

It is the cheapest requirement in the tier and the one a person at a terminal notices first. `a2acli`'s surface is deep (`task push-config create --auth-scheme …`), which is precisely the shape that is unpleasant to type without completion.

## Scope

- [ ] Add `clap_complete` and a `completion ` subcommand covering at least bash, zsh, fish and PowerShell, matching the shells cobra's default command supports.
- [ ] Emit the script on **stdout** and nothing else — the output is meant to be redirected to a file or `eval`'d, so a diagnostic on stdout would corrupt it (§11.1).
- [ ] An unsupported shell name is a usage error (exit 2) with the accepted values named.
- [ ] `completion` takes no agent and performs no network call: it must work with no agent configured at all, so it MUST NOT resolve an Agent Card. Same for `--help` and `--version`.
- [ ] `-o json` has no meaning here; the script is emitted regardless of output mode rather than wrapped.
- [ ] Document it in `a2acli/README.md` with the per-shell install line.
- [ ] Tests: each supported shell emits a non-empty script on stdout with empty stderr and exit 0; an unknown shell exits 2.

## Requirements closed

| ID | Requirement |
| --- | --- |
| `A2ACLI_CLI_002` | `completion ` — emits a shell completion script for the named shell (§7.1) |

Beitragsleitfaden

Beitragsleitfaden öffnen

Rechercherichtung

The issue is to add a `completion ` subcommand using the `clap_complete` crate. Start by examining the existing CLI structure in the `a2acli` module, likely in `src/cli.rs` or similar. Add the new subcommand, integrate `clap_complete`, and ensure it outputs only the script to stdout. Write tests for each supported shell (bash, zsh, fish, PowerShell) and for an unknown shell error. Check `a2acli/README.md` for documentation updates.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
bash, fish, powershell, rust, shell, zsh
Bereich
cli, developer-experience
Issue-Typ
Feature
Schwierigkeit
3/5
Geschätzter Aufwand
1-2 Tage
Aktivitätsstatus
Aktiv
Klarheit
Klar beschrieben
Anfängerfreundlichkeit
75/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.