a2aproject / a2aproject/a2a-rs

a2acli: completion <shell> command

Abierto
#182 0 comentarios 0 reacciones 0 asignados Ver en GitHub
enhancement
Lenguaje dominante
Rust
Estrellas
75
Forks
19
Merge medio
11 h 27 min
PR fusionados (30 d)
21

Descripción

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) |

Guía de contribución

Abrir la guía de contribución

Línea de trabajo

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.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
bash, fish, powershell, rust, shell, zsh
Área
cli, developer-experience
Tipo de issue
Nueva funcionalidad
Dificultad
3/5
Tiempo estimado
1-2 días
Estado de actividad
Activo
Claridad
Bien especificado
Aptitud para principiantes
75/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.