Skip to content

Commit 44d79c4

Browse files
authored
Update cli (#4)
* feat(cli): add --verbose option and defer imports * feat(cli): add version command * feat(cli): add custom -h/--help option * feat(cli): add debug flag, logging, and response parser * chore: handle A2A client errors and connection failures * fix(cli): package version in card title * feat(cli): integrate rich-click to enhance command help * docs: for new rich cli and flags * feat(cli): refactor card output * feat(cli): add agent card validation utilities and tests * refactor: match json rendering to text output * chore: bump version to 0.1.8 * docs: for new agent card validation command
1 parent 43129db commit 44d79c4

10 files changed

Lines changed: 1033 additions & 101 deletions

File tree

AGENTS.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ Use `just` for all development tasks:
1616
| `just console` | Run Textual devtools console |
1717
| `just get-card` | Fetch agent card (CLI) |
1818
| `just send` | Send message to agent (CLI) |
19+
| `just validate` | Validate agent card (CLI) |
1920
| `just version` | Show current version |
2021
| `just bump` | Bump version (patch, minor, major) |
2122
| `just tag` | Create git tag for current version |
@@ -27,8 +28,9 @@ Use `just` for all development tasks:
2728
handler/
2829
├── src/a2a_handler/ # Main package
2930
│ ├── _version.py # Version string
30-
│ ├── cli.py # CLI (click)
31+
│ ├── cli.py # CLI (rich-click)
3132
│ ├── client.py # A2A protocol client (a2a-sdk)
33+
│ ├── validation.py # Agent card validation utilities
3234
│ ├── server.py # A2A server agent (google-adk, litellm)
3335
│ ├── tui.py # TUI application (textual)
3436
│ ├── common/ # Shared utilities (rich, logging)
@@ -61,7 +63,7 @@ The `a2a_handler.client` module provides A2A protocol logic:
6163

6264
## Key Dependencies
6365

64-
- **CLI**: `click`
66+
- **CLI**: `rich-click` (enhanced `click` with rich formatting)
6567
- **Client**: `a2a-sdk`, `httpx`
6668
- **Server**: `google-adk`, `litellm`, `uvicorn`
6769
- **TUI**: `textual`

CONTRIBUTING.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,9 @@ Handler is a single Python package (`a2a-handler`) with all modules under `src/a
66

77
| Module | Description |
88
|--------|-------------|
9-
| `cli.py` | CLI built with `click`. Entry point: `handler` |
9+
| `cli.py` | CLI built with `rich-click`. Entry point: `handler` |
1010
| `client.py` | A2A protocol client library using `a2a-sdk` |
11+
| `validation.py` | Agent card validation utilities |
1112
| `common/` | Shared utilities (logging, printing with `rich`) |
1213
| `server.py` | Reference A2A agent using `google-adk` + `litellm` |
1314
| `tui.py` | TUI application built with `textual` |
@@ -43,6 +44,7 @@ just install # or: uv sync
4344
| `just console` | Run Textual devtools console |
4445
| `just get-card [url]` | Fetch agent card from URL |
4546
| `just send [url] [msg]` | Send message to agent |
47+
| `just validate [source]` | Validate agent card from URL or file |
4648
| `just version` | Show current version |
4749
| `just bump [level]` | Bump version (patch, minor, major) |
4850
| `just tag` | Create git tag for current version |

README.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,16 +54,44 @@ handler tui
5454

5555
### CLI
5656

57+
#### Global Options
58+
59+
```bash
60+
handler --verbose # Enable verbose logging output
61+
handler --debug # Enable debug logging output
62+
handler --help # Show help for any command
63+
```
64+
65+
#### Commands
66+
5767
Fetch agent card from A2A server:
5868

5969
```bash
6070
handler card http://localhost:8000
71+
handler card http://localhost:8000 --output json # JSON output
72+
```
73+
74+
Validate an agent card from a URL or file:
75+
76+
```bash
77+
handler validate http://localhost:8000 # Validate from URL
78+
handler validate ./agent-card.json # Validate from file
79+
handler validate http://localhost:8000 --output json # JSON output
6180
```
6281

6382
Send a message to an A2A agent:
6483

6584
```bash
6685
handler send http://localhost:8000 "Hello World"
86+
handler send http://localhost:8000 "Hello" --output json # JSON output
87+
handler send http://localhost:8000 "Hello" --context-id abc # Conversation continuity
88+
handler send http://localhost:8000 "Hello" --task-id xyz # Reference existing task
89+
```
90+
91+
Show version:
92+
93+
```bash
94+
handler version
6795
```
6896

6997
## Contributing

pyproject.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "a2a-handler"
3-
version = "0.1.7"
3+
version = "0.1.8"
44
description = "An A2A Protocol client TUI and CLI."
55
readme = "README.md"
66
requires-python = ">=3.11"
@@ -34,6 +34,7 @@ classifiers = [
3434
dependencies = [
3535
"a2a-sdk>=0.2.5",
3636
"click>=8.0.0",
37+
"rich-click>=1.8.0",
3738
"google-adk>=0.5.0",
3839
"httpx>=0.27.0",
3940
"litellm>=1.0.0",

0 commit comments

Comments
 (0)