a2aproject / a2aproject/a2a-cli

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

Ouverte
#33 1 commentaire 0 réactions 0 personnes assignées Voir sur GitHub
enhancement P2
Langage dominant
Go
Étoiles
95
Forks
4
Merge moyen
3 j 2 h
PR mergées (30 j)
24

Description

**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.

Guide de contribution

Ouvrir le guide de contribution

Évaluation

Cette issue n'a pas encore été évaluée.

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.