Skip to main content

har2cli

Turn an authenticated browser HAR into a redacted HTTP contract, then hand one GET endpoint to agtcli for packaging as a CLI.

har2cli derives and tests the request. agtcli owns the generated CLI contract. A HAR does not explain domain intent, so the generated get command is a starting point, not a claim that the API has been understood completely.

Agent skill

The checkout exposes skill/ as the project-local $har2cli skill through .agents/skills/har2cli. Agents launched in this repo can use it to learn one read-only action with $chrome, guide a focused HAR export, and generate the CLI. The detailed workflow stays with the code and calls har2cli --help for the current command contract.

Install

uv tool install har2cli     # or: pip install har2cli
har2cli --help

From a clone instead:

uv sync
uv tool install --editable .

Recipes

Import an existing HAR, then inspect likely application calls:

har2cli import orders.har
har2cli endpoints
har2cli inspect req-42

The latest import becomes active. endpoints hides static assets, analytics, preflights, and non-HTTP entries. The classifier is intentionally inspectable, not an SDK generator.

Replay one captured GET. --max-cost 1 makes the intended request budget explicit:

har2cli replay req-42 --max-cost 1

Redirects are returned rather than followed. POST, PUT, PATCH, and DELETE are refused before a connection is opened. Loopback, private, link-local, and reserved destinations are refused by default. After inspecting a trusted HAR, use --allow-private for an intended intranet service.

Find which captured credential names are needed:

har2cli auth-bisect req-42 --max-cost 10

This sends a baseline GET followed by capped elimination probes. It reports names such as cookie:session or header:Authorization; values never enter the output. It compares status, content type, login redirects, and response shape. Treat the result as evidence for this endpoint and session, not a general authentication specification. Two domain states can still have the same shape.

The probe is not authoritative without a service-specific login predicate, so scaffolding keeps every captured credential candidate by default. After you review and accept the endpoint-specific evidence, opt in for that one scaffold:

har2cli scaffold orders --request req-42 --accept-auth-bisect

The command refuses missing, malformed, or stale bisection evidence. Its JSON output records whether auth came from captured candidates or an accepted bisection and lists every omitted candidate name.

Generate one agtcli CLI from the selected contract:

har2cli scaffold orders --request req-42
cd orders
uv sync
uv run pytest -q

The generated project contains a redacted endpoint manifest, a structure-only response fixture, credential and transport hooks, one get command, contract tests, and the weak-agent-test reminder.

From the scaffold's parent directory, target its uv project explicitly:

uv run --project ./orders orders --help

Stored data

State lives in ~/.har2cli/; set HAR2CLI_CONFIG_DIR to relocate it. Imported captures are sanitized before they are written. Replay-only values are kept in a separate 0600 sidecar and are never returned by inspect, including with --raw. State directories are 0700.

Redaction recognizes common credential names and shapes, echoed request secrets, cookies, signed query fields, and obvious secret-bearing path segments. It cannot infer every domain-specific identifier, so keep capture state private and inspect a contract before scaffolding it.

The source HAR is not modified or deleted. It still contains the browser's original credentials, so handle it as a secret.

A HAR is also executable network input. Import can inspect any HAR, but replay only one you trust. Captured field names remain data in the endpoint contract; generated Markdown escapes them instead of treating them as instructions.

Version-one boundary

This version imports an existing HAR and handles ordinary HTTP GET requests. Browser capture, mutating methods, pagination, refresh tokens, WebSockets, and lifecycle probing are not implemented.

For agents

har2cli --help owns the operating rules and exit-code table. Under --json, stdout is one JSON document; notes and errors also go to stderr.

Development

uv sync
uv run pytest -q
uv run agtcli check .

The agtcli framework installs from PyPI.

Metadata

Release files for har2cli 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for har2cli 0.1.0
File Size Uploaded Provenance
har2cli-0.1.0.tar.gz 57.2 kB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for har2cli 0.1.0
File Interpreter ABI Platform
har2cli-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 89.2 kB

Release files / har2cli-0.1.0.tar.gz

Download URL har2cli-0.1.0.tar.gz
Size 57.2 kB
Tags Source
SHA-256 checksum
How to use checksums
5bd247d6256593dd2cb09ed0989d4d941167f51bd8ac56fc5fd68e2091e8cb7e
BLAKE2b-256 checksum
How to use checksums
37ad3d150aa95d3324d0b01779241a5344776bc6ce8cdaf913166da03ceb6c6d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 18, 2026.

Transparency log

Release files / har2cli-0.1.0-py3-none-any.whl

Download URL har2cli-0.1.0-py3-none-any.whl
Size 32.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
968940b0e6c5fbc2d062508c26dfd7d4f29c9342c6a2384a039f96201cfa3d13
BLAKE2b-256 checksum
How to use checksums
28d3ea6264c5bd05ba7b9f08946ad59c2ec29a6016a070b2eb5a5338e9108097
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 18, 2026.

Transparency log

Security for har2cli 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for har2cli-0.1.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 18, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page