Skip to content

Add halvorai-ingest init: register a source without Node.js - #6

Merged
hedge-waleed merged 2 commits into
mainfrom
claude/project-thread-v1ek4q
Oct 27, 2026
Merged

hedge-waleed merged 2 commits into
mainfrom
claude/project-thread-v1ek4q

Conversation

@hedge-waleed

Copy link
Copy Markdown
Contributor

Requested by Waleed · project thread

Why

Before a Python user can send events, they need a registered source key. Until now the only way to make one was npx @halvorai/ingest init, which requires Node.js. The dashboard can't register one either, and the README wrongly said it could.

What changed

  • New command. halvorai-ingest init (a console script, or python -m halvorai_ingest init) and run_init() work the same way as the Node.js init:
    • generate an Ed25519 key on the machine
    • send only its public half to POST /v1/sources
    • write HALVOR_API_KEY and HALVOR_SOURCE_KEY (with kid set to the source id) to .env.local, leaving other lines alone
    • write HALVOR_ENDPOINT too, but only when an endpoint was chosen
    • send one signed test event and print the dashboard link
  • Options. --api-key, which falls back to HALVOR_API_KEY and then a hidden prompt. Also --endpoint, --name, --cwd and --dashboard. The command exits with 1 and a one-line message on failure.
  • Docs. README and CHANGELOG (Unreleased) are updated. The version is not bumped, so releasing is a separate step.

Tests

  • tests/test_init.py has 8 new tests. They cover:
    • the source is registered with the public JWK only
    • the .env.local contents
    • the test event's signature verifies against the registered key
    • a chosen endpoint is kept
    • a refused registration writes nothing
    • a refused test event raises
    • a bad key
    • the CLI exit code
    • dashboard mapping that matches the Node.js SDK
  • uv run mypy: clean. uv run pytest -q: 143 passed on 3.12 and on 3.10.

Generated by Claude Code

`halvorai-ingest init` (and `python -m halvorai_ingest init`) generates an
Ed25519 source key, registers its public half with POST /v1/sources, writes
HALVOR_API_KEY and HALVOR_SOURCE_KEY to .env.local, sends one test event and
prints the dashboard link, matching `npx @halvorai/ingest init`.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CpycUbSFBBfQHu8wK6MHGC
@hedge-waleed hedge-waleed self-assigned this Oct 27, 2026
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CpycUbSFBBfQHu8wK6MHGC
@hedge-waleed
hedge-waleed merged commit 9a5a5d7 into main Oct 27, 2026
1 check passed
@hedge-waleed
hedge-waleed deleted the claude/project-thread-v1ek4q branch October 27, 2026 12:51
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.

2 participants