a2aproject / a2aproject/a2a-cli

feat: add task download to save an agent's task artifacts to disk

Abierto
#33 1 comentario 0 reacciones 0 asignados Ver en GitHub
enhancement P2
Lenguaje dominante
Go
Estrellas
95
Forks
4
Merge medio
3 d 2 h
PR fusionados (30 d)
24

Descripción

**Goal:** Let a user save an agent's file artifacts to local disk with one command, instead of only seeing them summarised in the terminal.
**User story:** As a developer whose agent produced files, I want task download to save the artifacts to disk, so that I can use the generated files directly instead of extracting base64 from JSON by hand.

**Priority:** P2 · **Area:** CLI code

## Problem

The `task` command group covers `get`, `list`, `subscribe`, `cancel`, and `push-config`, but there is **no way to save a task's file artifacts to disk**. `task get` and `send` only render/report artifacts (and a file part currently shows as `[binary N bytes]`), so a caller who wants the actual bytes has no supported command.

`task download` does not exist today:

```
$ a2a task download --help
Work with tasks

Usage:
a2a task [command]
```

## Proposed behavior

Add `a2a task download ` that writes the task's artifacts to disk:

```
a2a task download [--output-dir ] [--artifact ]
```

- Writes each file artifact to `--output-dir` (default: current directory), using the artifact's name and media type; falls back to a safe generated name when none is provided.
- `--artifact ` (repeatable) downloads only the named artifact(s); default downloads all.
- Data/text artifacts are written too (e.g. `.json`/`.txt`), so nothing is silently skipped.
- Reports each path written; refuses to overwrite unless `--force` (or writes uniquely-named files).
- Works across transports and honours `-o json` (emit the list of written paths as structured output).

## Who benefits

- Developers pulling generated files (reports, images, data) from an agent without hand-parsing JSON.
- CI jobs that archive an agent's outputs as build artifacts.
- AI coding agents that need the produced files on disk to continue a workflow.

## Acceptance criteria

- [ ] `a2a task download ` writes all artifacts to disk and prints the paths.
- [ ] `--output-dir` and `--artifact` selection work.
- [ ] File artifacts use name + media type; collisions handled safely.
- [ ] `-o json` emits the written paths as structured output; exit code reflects success/failure.
- [ ] Tests cover: all-artifacts download, single `--artifact`, and a missing task.

## Environment

- CLI version: `a2a version v0.0.0-…1e29dfe94f95+dirty`
- OS: Linux x86_64

## Notes

`task list`, `task subscribe`, and `task push-config` already exist — this request is scoped to the one missing member of the group, `task download`. The rendering of file parts by name/media-type/size is tracked separately and complements this command.

Guía de contribución

Abrir la guía de contribución

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.