capiscio 2.1.3__tar.gz → 2.2.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- capiscio-2.2.0/.github/workflows/e2e.yml +47 -0
- capiscio-2.2.0/.github/workflows/test.yml +43 -0
- capiscio-2.2.0/CHANGELOG.md +34 -0
- {capiscio-2.1.3 → capiscio-2.2.0}/PKG-INFO +7 -3
- {capiscio-2.1.3 → capiscio-2.2.0}/README.md +2 -2
- capiscio-2.2.0/docs/getting-started/installation.md +36 -0
- capiscio-2.2.0/docs/index.md +55 -0
- capiscio-2.2.0/docs/reference/commands.md +46 -0
- capiscio-2.2.0/mkdocs.yml +90 -0
- {capiscio-2.1.3 → capiscio-2.2.0}/pyproject.toml +6 -1
- capiscio-2.2.0/pytest.ini +12 -0
- {capiscio-2.1.3 → capiscio-2.2.0}/src/capiscio/__init__.py +1 -1
- {capiscio-2.1.3 → capiscio-2.2.0}/src/capiscio/manager.py +1 -1
- capiscio-2.2.0/tests/README.md +98 -0
- capiscio-2.2.0/tests/conftest.py +7 -0
- capiscio-2.2.0/tests/e2e/conftest.py +41 -0
- capiscio-2.2.0/tests/e2e/fixtures/invalid-agent-card.json +9 -0
- capiscio-2.2.0/tests/e2e/fixtures/malformed.txt +4 -0
- capiscio-2.2.0/tests/e2e/fixtures/valid-agent-card.json +26 -0
- capiscio-2.2.0/tests/e2e/test_badge_e2e.py +159 -0
- capiscio-2.2.0/tests/e2e/test_validate_e2e.py +123 -0
- capiscio-2.2.0/tests/unit/test_cli.py +237 -0
- capiscio-2.2.0/tests/unit/test_manager.py +256 -0
- capiscio-2.2.0/uv.lock +833 -0
- capiscio-2.1.3/tests/test_cli.py +0 -59
- {capiscio-2.1.3 → capiscio-2.2.0}/.github/workflows/pr-checks.yml +0 -0
- {capiscio-2.1.3 → capiscio-2.2.0}/.github/workflows/publish.yml +0 -0
- {capiscio-2.1.3 → capiscio-2.2.0}/.gitignore +0 -0
- {capiscio-2.1.3 → capiscio-2.2.0}/LICENSE +0 -0
- {capiscio-2.1.3 → capiscio-2.2.0}/src/capiscio/cli.py +0 -0
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
name: E2E Tests
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main, develop]
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: [main, develop]
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
e2e-tests:
|
|
11
|
+
name: E2E Tests (Python ${{ matrix.python-version }})
|
|
12
|
+
runs-on: ubuntu-latest
|
|
13
|
+
|
|
14
|
+
strategy:
|
|
15
|
+
fail-fast: false
|
|
16
|
+
matrix:
|
|
17
|
+
python-version: ["3.10", "3.11", "3.12"]
|
|
18
|
+
|
|
19
|
+
steps:
|
|
20
|
+
- uses: actions/checkout@v4
|
|
21
|
+
|
|
22
|
+
- name: Set up Python ${{ matrix.python-version }}
|
|
23
|
+
uses: actions/setup-python@v5
|
|
24
|
+
with:
|
|
25
|
+
python-version: ${{ matrix.python-version }}
|
|
26
|
+
|
|
27
|
+
- name: Install dependencies
|
|
28
|
+
run: |
|
|
29
|
+
python -m pip install --upgrade pip
|
|
30
|
+
pip install -e ".[dev,test]"
|
|
31
|
+
|
|
32
|
+
- name: Run unit tests
|
|
33
|
+
run: |
|
|
34
|
+
pytest tests/unit/ -v --cov=capiscio --cov-report=xml --cov-report=term
|
|
35
|
+
|
|
36
|
+
- name: Run E2E tests
|
|
37
|
+
run: |
|
|
38
|
+
pytest tests/e2e/ -v --tb=short
|
|
39
|
+
|
|
40
|
+
- name: Upload coverage reports
|
|
41
|
+
if: matrix.python-version == '3.11'
|
|
42
|
+
uses: codecov/codecov-action@v4
|
|
43
|
+
with:
|
|
44
|
+
file: ./coverage.xml
|
|
45
|
+
flags: unittests
|
|
46
|
+
name: codecov-umbrella
|
|
47
|
+
fail_ci_if_error: false
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
name: Unit Tests
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main, develop]
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: [main, develop]
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
test:
|
|
11
|
+
name: Unit Tests (Python ${{ matrix.python-version }})
|
|
12
|
+
runs-on: ${{ matrix.os }}
|
|
13
|
+
|
|
14
|
+
strategy:
|
|
15
|
+
fail-fast: false
|
|
16
|
+
matrix:
|
|
17
|
+
os: [ubuntu-latest, macos-latest, windows-latest]
|
|
18
|
+
python-version: ["3.10", "3.11", "3.12"]
|
|
19
|
+
|
|
20
|
+
steps:
|
|
21
|
+
- uses: actions/checkout@v4
|
|
22
|
+
|
|
23
|
+
- name: Set up Python ${{ matrix.python-version }}
|
|
24
|
+
uses: actions/setup-python@v5
|
|
25
|
+
with:
|
|
26
|
+
python-version: ${{ matrix.python-version }}
|
|
27
|
+
|
|
28
|
+
- name: Install dependencies
|
|
29
|
+
run: |
|
|
30
|
+
python -m pip install --upgrade pip
|
|
31
|
+
pip install -e ".[dev,test]"
|
|
32
|
+
|
|
33
|
+
- name: Run unit tests
|
|
34
|
+
run: |
|
|
35
|
+
pytest tests/unit/ -v --cov=capiscio --cov-report=xml --cov-report=term
|
|
36
|
+
|
|
37
|
+
- name: Upload coverage
|
|
38
|
+
if: matrix.python-version == '3.11' && matrix.os == 'ubuntu-latest'
|
|
39
|
+
uses: codecov/codecov-action@v4
|
|
40
|
+
with:
|
|
41
|
+
file: ./coverage.xml
|
|
42
|
+
flags: unittests
|
|
43
|
+
name: codecov-umbrella
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
+
|
|
8
|
+
## [2.2.0] - 2025-12-10
|
|
9
|
+
|
|
10
|
+
### Changed
|
|
11
|
+
- **VERSION ALIGNMENT**: All CapiscIO packages now share the same version number.
|
|
12
|
+
- `capiscio-core`, `capiscio` (npm), and `capiscio` (PyPI) are all v2.2.0.
|
|
13
|
+
- Simplifies compatibility - no version matrix needed.
|
|
14
|
+
- **CORE VERSION**: Now downloads `capiscio-core` v2.2.0.
|
|
15
|
+
|
|
16
|
+
### Added
|
|
17
|
+
- **Test Suite**: Added comprehensive test coverage (96%) for CLI wrapper and binary manager.
|
|
18
|
+
|
|
19
|
+
## [2.1.3] - 2025-11-21
|
|
20
|
+
|
|
21
|
+
### Fixed
|
|
22
|
+
- **Core Version Sync**: Fixed an issue where the wrapper attempted to download a non-existent `v2.1.2` of `capiscio-core`. It now correctly downloads `v1.0.2`.
|
|
23
|
+
- **Package Versioning**: Bumped package version to `2.1.3` to resolve PyPI conflicts while pointing to the stable `v1.0.2` core binary.
|
|
24
|
+
|
|
25
|
+
## [2.1.2] - 2025-11-21
|
|
26
|
+
|
|
27
|
+
### Added
|
|
28
|
+
- **CLI Wrapper**: Initial release of the new Python CLI wrapper.
|
|
29
|
+
- **Architecture**: Replaced the legacy Python library with a lightweight wrapper that downloads and executes the high-performance Go binary (`capiscio-core`).
|
|
30
|
+
- **Platform Support**: Automatic detection and download for Linux, macOS, and Windows (AMD64/ARM64).
|
|
31
|
+
- **Zero Dependencies**: The wrapper itself has minimal dependencies (`rich`, `platformdirs`, `requests`) and delegates all logic to the standalone binary.
|
|
32
|
+
|
|
33
|
+
### Removed
|
|
34
|
+
- **Legacy Library**: Removed the old Python implementation of the validation logic in favor of the unified Go core.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: capiscio
|
|
3
|
-
Version: 2.
|
|
3
|
+
Version: 2.2.0
|
|
4
4
|
Summary: The official CapiscIO CLI tool for validating A2A agents.
|
|
5
5
|
Project-URL: Homepage, https://capisc.io
|
|
6
6
|
Project-URL: Documentation, https://docs.capisc.io/cli
|
|
@@ -27,6 +27,10 @@ Provides-Extra: dev
|
|
|
27
27
|
Requires-Dist: build; extra == 'dev'
|
|
28
28
|
Requires-Dist: pytest>=7.0.0; extra == 'dev'
|
|
29
29
|
Requires-Dist: twine; extra == 'dev'
|
|
30
|
+
Provides-Extra: test
|
|
31
|
+
Requires-Dist: pytest-cov>=4.0.0; extra == 'test'
|
|
32
|
+
Requires-Dist: pytest>=7.0.0; extra == 'test'
|
|
33
|
+
Requires-Dist: requests>=2.31.0; extra == 'test'
|
|
30
34
|
Description-Content-Type: text/markdown
|
|
31
35
|
|
|
32
36
|
# CapiscIO CLI (Python)
|
|
@@ -58,8 +62,8 @@ Once installed, the `capiscio` command is available in your terminal. It passes
|
|
|
58
62
|
# Validate an agent
|
|
59
63
|
capiscio validate https://my-agent.example.com
|
|
60
64
|
|
|
61
|
-
#
|
|
62
|
-
capiscio
|
|
65
|
+
# Validate with JSON output
|
|
66
|
+
capiscio validate https://my-agent.example.com --json
|
|
63
67
|
|
|
64
68
|
# Check version
|
|
65
69
|
capiscio --version
|
|
@@ -27,8 +27,8 @@ Once installed, the `capiscio` command is available in your terminal. It passes
|
|
|
27
27
|
# Validate an agent
|
|
28
28
|
capiscio validate https://my-agent.example.com
|
|
29
29
|
|
|
30
|
-
#
|
|
31
|
-
capiscio
|
|
30
|
+
# Validate with JSON output
|
|
31
|
+
capiscio validate https://my-agent.example.com --json
|
|
32
32
|
|
|
33
33
|
# Check version
|
|
34
34
|
capiscio --version
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# CapiscIO Python CLI
|
|
2
|
+
|
|
3
|
+
The **CapiscIO Python CLI** is a lightweight wrapper that automatically downloads and executes the high-performance [CapiscIO Core](https://github.com/capiscio/capiscio-core) binary.
|
|
4
|
+
|
|
5
|
+
It provides a seamless experience for Python developers, allowing you to install the CLI via `pip` without worrying about platform-specific binaries.
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
pip install capiscio
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Usage
|
|
14
|
+
|
|
15
|
+
Once installed, the `capiscio` command is available in your terminal. It passes all arguments directly to the underlying Core binary.
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
# Validate an agent card
|
|
19
|
+
capiscio validate ./agent-card.json
|
|
20
|
+
|
|
21
|
+
# Check version
|
|
22
|
+
capiscio --version
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
For full command reference, see the [CapiscIO Core Documentation](../../capiscio-core/index.md).
|
|
26
|
+
|
|
27
|
+
## How it Works
|
|
28
|
+
|
|
29
|
+
1. **Detection**: When you run `capiscio`, the wrapper detects your Operating System (Linux, macOS, Windows) and Architecture (AMD64, ARM64).
|
|
30
|
+
2. **Download**: It checks if the correct `capiscio-core` binary is present in your user cache directory. If not, it downloads it securely from GitHub Releases.
|
|
31
|
+
3. **Execution**: It executes the binary with your provided arguments, piping input and output directly to your terminal.
|
|
32
|
+
|
|
33
|
+
## Requirements
|
|
34
|
+
|
|
35
|
+
* Python 3.10+
|
|
36
|
+
* Internet connection (for initial binary download)
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: CapiscIO Python CLI - Documentation
|
|
3
|
+
description: Official documentation for the CapiscIO Python CLI wrapper.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# CapiscIO Python CLI
|
|
7
|
+
|
|
8
|
+
The **CapiscIO Python CLI** is a lightweight wrapper around the [CapiscIO Core](https://github.com/capiscio/capiscio-core) binary, designed for seamless integration into Python environments.
|
|
9
|
+
|
|
10
|
+
!!! info "This is a Wrapper Package"
|
|
11
|
+
This package does NOT contain validation logic. It downloads and executes the `capiscio-core` Go binary, which performs the actual validation.
|
|
12
|
+
|
|
13
|
+
<div class="grid cards" markdown>
|
|
14
|
+
|
|
15
|
+
- **🚀 Getting Started**
|
|
16
|
+
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
Install the CLI via pip.
|
|
20
|
+
|
|
21
|
+
[:octicons-arrow-right-24: Installation](./getting-started/installation.md)
|
|
22
|
+
|
|
23
|
+
- **⚙️ Reference**
|
|
24
|
+
|
|
25
|
+
---
|
|
26
|
+
|
|
27
|
+
Wrapper commands and usage.
|
|
28
|
+
|
|
29
|
+
[:octicons-arrow-right-24: Commands](./reference/commands.md)
|
|
30
|
+
|
|
31
|
+
</div>
|
|
32
|
+
|
|
33
|
+
## Quick Start
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
# Install
|
|
37
|
+
pip install capiscio
|
|
38
|
+
|
|
39
|
+
# Validate an agent card
|
|
40
|
+
capiscio validate ./agent-card.json
|
|
41
|
+
|
|
42
|
+
# Validate with JSON output
|
|
43
|
+
capiscio validate ./agent-card.json --json
|
|
44
|
+
|
|
45
|
+
# Check core binary version
|
|
46
|
+
capiscio --version
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## What This Package Does
|
|
50
|
+
|
|
51
|
+
1. **Downloads** the correct `capiscio-core` binary for your platform (macOS/Linux/Windows, AMD64/ARM64)
|
|
52
|
+
2. **Caches** the binary in your user cache directory
|
|
53
|
+
3. **Executes** the binary with your arguments, using `os.execv()` for zero overhead
|
|
54
|
+
|
|
55
|
+
All validation logic lives in `capiscio-core`. This wrapper just makes it easy to install via pip.
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# Wrapper-Specific Commands
|
|
2
|
+
|
|
3
|
+
While most commands are handled by the Core binary, the Python wrapper includes a few utility commands for managing the wrapper itself.
|
|
4
|
+
|
|
5
|
+
## `capiscio --wrapper-version`
|
|
6
|
+
|
|
7
|
+
Displays the version of the Python wrapper package itself, distinct from the Core binary version.
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
$ capiscio --wrapper-version
|
|
11
|
+
capiscio-python wrapper v2.1.3
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## `capiscio --wrapper-clean`
|
|
15
|
+
|
|
16
|
+
Removes the cached `capiscio-core` binary. This is useful if the binary becomes corrupted or if you want to force a re-download.
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
$ capiscio --wrapper-clean
|
|
20
|
+
Cleaned cache directory: /Users/username/Library/Caches/capiscio/bin
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
## Core Commands
|
|
26
|
+
|
|
27
|
+
All other commands are passed directly to the `capiscio-core` binary. See the [CLI Reference](https://docs.capisc.io/reference/cli/) for full documentation.
|
|
28
|
+
|
|
29
|
+
### Common Commands
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
# Validate an agent card
|
|
33
|
+
capiscio validate ./agent-card.json
|
|
34
|
+
|
|
35
|
+
# Validate with JSON output
|
|
36
|
+
capiscio validate ./agent-card.json --json
|
|
37
|
+
|
|
38
|
+
# Validate with live endpoint testing
|
|
39
|
+
capiscio validate https://agent.example.com --test-live
|
|
40
|
+
|
|
41
|
+
# Check version of the core binary
|
|
42
|
+
capiscio --version
|
|
43
|
+
|
|
44
|
+
# Generate a signing key pair
|
|
45
|
+
capiscio key gen --out-priv ./private.jwk --out-pub ./public.jwk
|
|
46
|
+
```
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
# CapiscIO Python CLI Wrapper
|
|
2
|
+
|
|
3
|
+
site_name: CapiscIO Python CLI
|
|
4
|
+
site_url: https://docs.capisc.io/capiscio-python
|
|
5
|
+
site_description: The official Python wrapper for the CapiscIO Core CLI.
|
|
6
|
+
site_author: CapiscIO Team
|
|
7
|
+
copyright: Copyright © 2025 CapiscIO
|
|
8
|
+
|
|
9
|
+
repo_name: capiscio/capiscio-python
|
|
10
|
+
repo_url: https://github.com/capiscio/capiscio-python
|
|
11
|
+
edit_uri: edit/main/docs/
|
|
12
|
+
|
|
13
|
+
theme:
|
|
14
|
+
name: material
|
|
15
|
+
logo: https://docs.capisc.io/assets/logo.png
|
|
16
|
+
favicon: https://docs.capisc.io/assets/favicon.ico
|
|
17
|
+
palette:
|
|
18
|
+
- scheme: slate
|
|
19
|
+
primary: blue grey
|
|
20
|
+
accent: cyan
|
|
21
|
+
toggle:
|
|
22
|
+
icon: material/brightness-4
|
|
23
|
+
name: Switch to light mode
|
|
24
|
+
- scheme: default
|
|
25
|
+
primary: blue grey
|
|
26
|
+
accent: cyan
|
|
27
|
+
toggle:
|
|
28
|
+
icon: material/brightness-7
|
|
29
|
+
name: Switch to dark mode
|
|
30
|
+
|
|
31
|
+
font:
|
|
32
|
+
text: Roboto
|
|
33
|
+
code: Roboto Mono
|
|
34
|
+
|
|
35
|
+
features:
|
|
36
|
+
- navigation.instant
|
|
37
|
+
- navigation.tracking
|
|
38
|
+
- navigation.tabs
|
|
39
|
+
- navigation.sections
|
|
40
|
+
- navigation.expand
|
|
41
|
+
- navigation.top
|
|
42
|
+
- navigation.footer
|
|
43
|
+
- toc.follow
|
|
44
|
+
- search.suggest
|
|
45
|
+
- search.highlight
|
|
46
|
+
- content.code.copy
|
|
47
|
+
- content.tabs.link
|
|
48
|
+
|
|
49
|
+
plugins:
|
|
50
|
+
- search:
|
|
51
|
+
lang: en
|
|
52
|
+
|
|
53
|
+
markdown_extensions:
|
|
54
|
+
- abbr
|
|
55
|
+
- admonition
|
|
56
|
+
- attr_list
|
|
57
|
+
- def_list
|
|
58
|
+
- footnotes
|
|
59
|
+
- md_in_html
|
|
60
|
+
- tables
|
|
61
|
+
- toc:
|
|
62
|
+
permalink: true
|
|
63
|
+
- pymdownx.details
|
|
64
|
+
- pymdownx.highlight:
|
|
65
|
+
anchor_linenums: true
|
|
66
|
+
- pymdownx.inlinehilite
|
|
67
|
+
- pymdownx.superfences:
|
|
68
|
+
custom_fences:
|
|
69
|
+
- name: mermaid
|
|
70
|
+
class: mermaid
|
|
71
|
+
format: !!python/name:pymdownx.superfences.fence_code_format
|
|
72
|
+
- pymdownx.tabbed:
|
|
73
|
+
alternate_style: true
|
|
74
|
+
- pymdownx.tasklist:
|
|
75
|
+
custom_checkbox: true
|
|
76
|
+
|
|
77
|
+
extra:
|
|
78
|
+
homepage: https://docs.capisc.io
|
|
79
|
+
social:
|
|
80
|
+
- icon: fontawesome/brands/github
|
|
81
|
+
link: https://github.com/capiscio
|
|
82
|
+
- icon: fontawesome/brands/twitter
|
|
83
|
+
link: https://twitter.com/capiscio
|
|
84
|
+
|
|
85
|
+
nav:
|
|
86
|
+
- Home: index.md
|
|
87
|
+
- Getting Started:
|
|
88
|
+
- Installation: getting-started/installation.md
|
|
89
|
+
- Reference:
|
|
90
|
+
- Commands: reference/commands.md
|
|
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "capiscio"
|
|
7
|
-
version = "2.
|
|
7
|
+
version = "2.2.0"
|
|
8
8
|
description = "The official CapiscIO CLI tool for validating A2A agents."
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
requires-python = ">=3.10"
|
|
@@ -36,6 +36,11 @@ dev = [
|
|
|
36
36
|
"build",
|
|
37
37
|
"twine",
|
|
38
38
|
]
|
|
39
|
+
test = [
|
|
40
|
+
"pytest>=7.0.0",
|
|
41
|
+
"pytest-cov>=4.0.0",
|
|
42
|
+
"requests>=2.31.0",
|
|
43
|
+
]
|
|
39
44
|
|
|
40
45
|
[project.scripts]
|
|
41
46
|
capiscio = "capiscio.cli:main"
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
[pytest]
|
|
2
|
+
testpaths = tests
|
|
3
|
+
python_files = test_*.py
|
|
4
|
+
python_classes = Test*
|
|
5
|
+
python_functions = test_*
|
|
6
|
+
addopts = -v --strict-markers
|
|
7
|
+
markers =
|
|
8
|
+
e2e: marks tests as end-to-end tests requiring a live server
|
|
9
|
+
unit: marks tests as unit tests (no external dependencies)
|
|
10
|
+
|
|
11
|
+
filterwarnings =
|
|
12
|
+
ignore::DeprecationWarning
|
|
@@ -17,7 +17,7 @@ console = Console()
|
|
|
17
17
|
logger = logging.getLogger(__name__)
|
|
18
18
|
|
|
19
19
|
# Configuration
|
|
20
|
-
CORE_VERSION = "
|
|
20
|
+
CORE_VERSION = "2.2.0" # The version of the core binary to download
|
|
21
21
|
GITHUB_REPO = "capiscio/capiscio-core"
|
|
22
22
|
BINARY_NAME = "capiscio"
|
|
23
23
|
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
# Tests for capiscio-python CLI
|
|
2
|
+
|
|
3
|
+
This directory contains unit and E2E tests for the `capiscio` CLI wrapper.
|
|
4
|
+
|
|
5
|
+
## Directory Structure
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
tests/
|
|
9
|
+
├── unit/ # Unit tests with mocks (no server required)
|
|
10
|
+
│ ├── test_cli.py
|
|
11
|
+
│ └── test_manager.py
|
|
12
|
+
└── e2e/ # E2E tests (offline mode, no server required)
|
|
13
|
+
├── conftest.py # Pytest fixtures and configuration
|
|
14
|
+
├── fixtures/ # Test data files
|
|
15
|
+
│ ├── valid-agent-card.json
|
|
16
|
+
│ ├── invalid-agent-card.json
|
|
17
|
+
│ └── malformed.txt
|
|
18
|
+
├── test_validate_e2e.py # Validation command tests
|
|
19
|
+
└── test_badge_e2e.py # Badge issuance/verification tests
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## Running Tests
|
|
23
|
+
|
|
24
|
+
### Run All Tests
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
pytest # All tests
|
|
28
|
+
pytest tests/unit/ # Unit tests only
|
|
29
|
+
pytest tests/e2e/ # E2E tests only
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
### Run Specific Test File
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
pytest tests/e2scio --cov-report=html
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## E2E Test Design
|
|
39
|
+
|
|
40
|
+
The E2E tests are designed to run **offline** without requiring a server:
|
|
41
|
+
|
|
42
|
+
- **Validate tests**: Use `--schema-only` flag for local schema validation
|
|
43
|
+
- **Badge tests**: Use `--self-sign` for issuance and `--accept-self-signed --offline` for verification
|
|
44
|
+
|
|
45
|
+
This approach allows E2E tests to run in CI without complex server infrastructure.
|
|
46
|
+
|
|
47
|
+
## Test Coverage
|
|
48
|
+
|
|
49
|
+
### Validate Command (`test_validate_e2e.py`)
|
|
50
|
+
|
|
51
|
+
- ✅ Valid local agent card file (schema-only mode)
|
|
52
|
+
- ✅ Invalid local agent card file
|
|
53
|
+
- ✅ Malformed JSON file
|
|
54
|
+
- ✅ Nonexistent file
|
|
55
|
+
- ✅ JSON output format
|
|
56
|
+
- ✅ Help command
|
|
57
|
+
|
|
58
|
+
### ├── test_validate_e2e.sue self-signed badge
|
|
59
|
+
- ✅ Issue badge with custom expiration
|
|
60
|
+
- ✅ Issue badge with audience restriction
|
|
61
|
+
- ✅ Verify self-signed badge (offline)
|
|
62
|
+
- ✅ Verify invalid token (error handling)
|
|
63
|
+
- ✅ Help commands (badge, issue, verify)
|
|
64
|
+
|
|
65
|
+
## CI/CD Integration
|
|
66
|
+
|
|
67
|
+
The E2E tests run in GitHub Actions without server dependencies:
|
|
68
|
+
|
|
69
|
+
```yaml
|
|
70
|
+
# See .github/workflows/e2e.yml
|
|
71
|
+
- name: Run E2E tests
|
|
72
|
+
run: pytest tests/e2e/
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
## Notes
|
|
76
|
+
|
|
77
|
+
- **Offline Mode**: All E2E tests run offline without server dependencies
|
|
78
|
+
- **Download Messages**: On first run, the CLI may download the capiscio-core binary; tests handle this gracefully
|
|
79
|
+
|
|
80
|
+
## Troubleshooting
|
|
81
|
+
|
|
82
|
+
### Build/Install Issues
|
|
83
|
+
|
|
84
|
+
Ensure the project is installed:
|
|
85
|
+
|
|
86
|
+
```bash
|
|
87
|
+
pip install -e .
|
|
88
|
+
pytest tests/e2e/
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
### Path Issues
|
|
92
|
+
|
|
93
|
+
Ensure you're running pytest from the project root:
|
|
94
|
+
|
|
95
|
+
```bash
|
|
96
|
+
cd /path/to/capiscio-python
|
|
97
|
+
pytest tests/e2e/
|
|
98
|
+
```
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"""
|
|
2
|
+
pytest configuration for capiscio-python CLI E2E tests.
|
|
3
|
+
|
|
4
|
+
Provides fixtures for testing the CLI offline using:
|
|
5
|
+
- validate --schema-only
|
|
6
|
+
- badge issue --self-sign
|
|
7
|
+
- badge verify --accept-self-signed --offline
|
|
8
|
+
"""
|
|
9
|
+
|
|
10
|
+
import pytest
|
|
11
|
+
from pathlib import Path
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
@pytest.fixture(scope="session")
|
|
15
|
+
def fixtures_dir() -> Path:
|
|
16
|
+
"""Get path to fixtures directory."""
|
|
17
|
+
return Path(__file__).parent / "fixtures"
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
@pytest.fixture
|
|
21
|
+
def valid_agent_card_path(fixtures_dir: Path) -> Path:
|
|
22
|
+
"""Path to valid agent card fixture."""
|
|
23
|
+
return fixtures_dir / "valid-agent-card.json"
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
@pytest.fixture
|
|
27
|
+
def invalid_agent_card_path(fixtures_dir: Path) -> Path:
|
|
28
|
+
"""Path to invalid agent card fixture."""
|
|
29
|
+
return fixtures_dir / "invalid-agent-card.json"
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
@pytest.fixture
|
|
33
|
+
def malformed_json_path(fixtures_dir: Path) -> Path:
|
|
34
|
+
"""Path to malformed JSON fixture."""
|
|
35
|
+
return fixtures_dir / "malformed.txt"
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
@pytest.fixture
|
|
39
|
+
def nonexistent_path(fixtures_dir: Path) -> Path:
|
|
40
|
+
"""Path to a file that doesn't exist."""
|
|
41
|
+
return fixtures_dir / "does-not-exist.json"
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
{
|
|
2
|
+
"protocolVersion": "1.3.0",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"name": "Test Agent",
|
|
5
|
+
"description": "A test agent for E2E validation tests",
|
|
6
|
+
"url": "https://example.com/.well-known/agent.json",
|
|
7
|
+
"capabilities": {
|
|
8
|
+
"streaming": false,
|
|
9
|
+
"pushNotifications": false
|
|
10
|
+
},
|
|
11
|
+
"skills": [
|
|
12
|
+
{
|
|
13
|
+
"id": "test-skill",
|
|
14
|
+
"name": "Test Skill",
|
|
15
|
+
"description": "A skill for testing",
|
|
16
|
+
"tags": ["test", "validation"]
|
|
17
|
+
}
|
|
18
|
+
],
|
|
19
|
+
"provider": {
|
|
20
|
+
"organization": "Test Organization",
|
|
21
|
+
"url": "https://example.com"
|
|
22
|
+
},
|
|
23
|
+
"authentication": {
|
|
24
|
+
"schemes": ["none"]
|
|
25
|
+
}
|
|
26
|
+
}
|