LLM-friendly CLI for 1177/journalen data access.
- JSON-first output for deterministic automation
- Stable error schema and exit codes
- BankID QR login flow for terminal use
- Session-safe handling for sensitive healthcare data
python3 -m pip install -e .1177 auth login
1177 auth login --qr-output web
1177 auth status
1177 auth logout
1177 journal entries list --page 1 --page-size 10
1177 journal diagnoses list
1177 journal diagnoses detail --diagnosis-id dx-123
1177 journal results listSuccess payloads are printed to stdout as JSON.
Errors are printed to stderr as JSON with:
error: human readable messagecode: stable machine codedetails: machine-readable context
For auth QR flows, stderr can also include machine-readable events:
bankid_qr_frame: base64 QR frame payloads (--qr-output base64|both)bankid_qr_web_url: localhost page URL (--qr-output web)
python3 -m pip install -e ".[dev]"
pytestRun only the contract test module:
pytest tests/test_output_contract.pyRun only live tests by marker (default behavior is skip unless enabled):
pytest -m live_bankid tests/test_live_api_contract.pyRun live contract tests against real endpoints (manual pre-login reuse):
1177 auth login
export CLI1177_AUTH_STATE_PATH="$HOME/.local/state/1177-cli/auth-state.json"
export CLI1177_LIVE_BANKID=1
pytest -m live_bankid tests/test_live_api_contract.pyLive tests are opt-in and skipped unless both environment variables are set. The auth state file must already exist and contain a journal-ready session.
This repo includes a packaged Agent Skill in .agent/.
Local build:
python scripts/generate-skill-manifest.py
python scripts/package-skill.pyThe output archive is written to:
dist/1177-cli.skillGitHub CI also builds this .skill file for each push and pull_request
and uploads it as the 1177-cli-skill workflow artifact.