Skip to content

Commit c0513e2

Browse files
committed
Reduce AGENTS.md and ref skills
1 parent 35158da commit c0513e2

4 files changed

Lines changed: 67 additions & 12 deletions

File tree

.agents/skills/api-patterns/SKILL.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -309,6 +309,31 @@ A2A requests use `Authorization: A2A <apiKey>` (not Bearer).
309309
the raw API yourself, you **must** use `Content-Type: application/json`.
310310
Using `data=` (raw string) results in **415 Unsupported Media Type**.
311311

312+
## TLS / Certificate Verification
313+
314+
The `verify` parameter on `SafeguardClient` and `A2AContext` accepts:
315+
316+
- `True` (default) — use system trust store
317+
- `False` — disable TLS verification (development only)
318+
- `str` — path to a CA bundle file for custom trust
319+
320+
```python
321+
# CA bundle (recommended for production)
322+
client = SafeguardClient("host", auth=auth, verify="/path/to/ca-bundle.pem")
323+
324+
# Disable verification (development only)
325+
client = SafeguardClient("host", auth=auth, verify=False)
326+
```
327+
328+
### Environment Variables for Trust
329+
330+
| Variable | Affects | Description |
331+
|----------|---------|-------------|
332+
| `REQUESTS_CA_BUNDLE` | All HTTP requests | CA bundle path for `requests` library |
333+
| `WEBSOCKET_CLIENT_CA_BUNDLE` | SignalR event listeners | CA bundle path for WebSocket connections |
334+
335+
Set these when the appliance uses a certificate signed by an internal CA.
336+
312337
## Common Patterns
313338

314339
### GET with query parameters

.agents/skills/architecture/SKILL.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,20 @@ listener.start()
207207
- Previous client is logged out best-effort on each reconnection
208208
- `stop()` stops inner listener, joins reconnect thread, emits `STOPPED`
209209

210+
### Client Factory Methods
211+
212+
`SafeguardClient` provides convenience methods to create event listeners
213+
from an authenticated client:
214+
215+
```python
216+
listener = client.get_event_listener() # SafeguardEventListener
217+
persistent = client.get_persistent_event_listener() # PersistentSafeguardEventListener
218+
```
219+
220+
**Note:** `AsyncSafeguardClient` does **not** have event listener factory
221+
methods. Create listeners directly using the sync client or construct them
222+
manually.
223+
210224
### signalrcore Protocol Version Bug
211225

212226
signalrcore 1.0.2 incorrectly uses `negotiateVersion` (the negotiate

.agents/skills/testing-guide/SKILL.md

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,16 @@ description: >-
1313

1414
```bash
1515
# Unit tests (no live appliance required)
16-
python -m pytest tests/ -m "not integration"
16+
poetry run python -m pytest tests/ -m "not integration"
1717

1818
# Integration tests (requires live appliance)
19-
SPP_HOST=<host> SPP_USERNAME=<user> SPP_PASSWORD=<pass> python -m pytest tests/ -m integration
19+
SPP_HOST=<host> SPP_USERNAME=<user> SPP_PASSWORD=<pass> poetry run python -m pytest tests/ -m integration
2020

2121
# Single test file
22-
python -m pytest tests/test_auth.py -v
22+
poetry run python -m pytest tests/test_auth.py -v
2323

2424
# Single test by name
25-
python -m pytest tests/ -k "test_password_auth_defaults" -v
25+
poetry run python -m pytest tests/ -k "test_password_auth_defaults" -v
2626
```
2727

2828
## pytest Configuration
@@ -190,6 +190,19 @@ The test's session-scoped `a2a_env` fixture handles all of this automatically
190190
(including `openssl` cert generation in a temp directory). Cleanup deletes the
191191
trusted cert by thumbprint.
192192

193+
### TLS Trust for Integration Tests
194+
195+
If the appliance uses a certificate signed by an internal CA, set these
196+
environment variables in addition to the standard test variables:
197+
198+
| Variable | Affects | Description |
199+
|----------|---------|-------------|
200+
| `REQUESTS_CA_BUNDLE` | All HTTP requests | CA bundle path for `requests` |
201+
| `WEBSOCKET_CLIENT_CA_BUNDLE` | SignalR event listeners | CA bundle path for WebSocket |
202+
203+
Alternatively, pass the CA path via `SPP_CA_FILE` — the test fixtures pass it
204+
as `verify=<path>` to client constructors.
205+
193206
### A2A `set_password` Content-Type
194207

195208
A2A `set_password` requires `Content-Type: application/json`. Use `json=`

AGENTS.md

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -35,26 +35,29 @@ PySafeguard/
3535
## Setup and build
3636

3737
```bash
38-
pip install poetry # Install Poetry (if needed)
39-
poetry install --all-extras # Install all deps including dev and optional
40-
poetry build # Build sdist + wheel
38+
pip install poetry # Install Poetry (if needed)
39+
poetry install --all-extras # Install all deps including dev and optional
40+
poetry build # Build sdist + wheel
4141
```
4242

43+
All `poetry run` prefixed commands below assume deps are installed via
44+
`poetry install --all-extras`.
45+
4346
## Linting and type checking
4447

4548
```bash
46-
ruff check src/ # Lint (line length: 160)
47-
ruff format --check src/ # Format check
48-
mypy src/ # Type check (strict mode)
49+
poetry run ruff check src/ # Lint (line length: 160)
50+
poetry run ruff format --check src/ # Format check
51+
poetry run mypy src/ # Type check (strict mode)
4952
```
5053

5154
All code must pass `mypy --strict` without errors. Ruff enforces 160-char lines.
5255

5356
## Testing
5457

5558
```bash
56-
python -m pytest tests/ -m "not integration" # Unit tests (no appliance)
57-
python -m pytest tests/ -m integration # Integration tests (live appliance)
59+
poetry run python -m pytest tests/ -m "not integration" # Unit tests
60+
poetry run python -m pytest tests/ -m integration # Integration (live appliance)
5861
```
5962

6063
Uses `pytest-asyncio` with `asyncio_mode = "auto"` — async tests run without

0 commit comments

Comments
 (0)