Skip to content

Add kognic-auth call subcommand for authenticated HTTP requests#50

Merged
Michel Edkrantz (MichelEdkrantz) merged 4 commits intomasterfrom
cli-api-call
Feb 12, 2026
Merged

Add kognic-auth call subcommand for authenticated HTTP requests#50
Michel Edkrantz (MichelEdkrantz) merged 4 commits intomasterfrom
cli-api-call

Conversation

@MichelEdkrantz
Copy link
Copy Markdown
Member

Summary

  • Adds kognic-auth call subcommand — a lightweight authenticated curl for Kognic APIs that handles OAuth automatically
  • Supports -X, -d, -H flags mirroring curl conventions, plus --context for multi-environment config
  • Adds --format option with five output modes: json (default), jsonl, csv, tsv, and table (markdown)
  • Auto-flattens JSON responses that are top-level arrays or single-key wrapper objects (e.g. {"data": [...]})
  • Nested dicts/lists are JSON-serialized in tabular formats
  • Introduces config file support (~/.config/kognic/config.json) with named contexts and URL-based auto-matching

Test plan

  • 45 CLI tests covering all formats, edge cases (empty data, sparse keys, nested values, non-flattenable responses), error handling
  • All pre-commit hooks pass (ruff check, ruff format, trailing whitespace)

🤖 Generated with Claude Code

Adds a `call` subcommand that resolves credentials from a config file
(~/.config/kognic/config.json) based on URL domain matching, then makes
authenticated API requests. Also adds PTH ruff lint rule and migrates
existing code to use pathlib.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…able output

Supports automatic flattening of JSON responses that are top-level arrays
or single-key objects wrapping an array (e.g. {"data": [...]}). Nested
values are JSON-serialized in tabular formats.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@MichelEdkrantz Michel Edkrantz (MichelEdkrantz) merged commit 3c527ec into master Feb 12, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant