Skip to content

feat: add flags to omni config init for non-interactive setup - #63

Merged
dspangen merged 2 commits into
mainfrom
config-init-flags
Jun 16, 2026
Merged

feat: add flags to omni config init for non-interactive setup#63
dspangen merged 2 commits into
mainfrom
config-init-flags

Conversation

@dspangen

@dspangen dspangen commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds --name, --endpoint, --auth, and --api-key flags to omni config init so profiles can be created without interactive prompts — the main motivation being one-command OAuth setup:

# OAuth (opens browser, no prompts)
omni config init --name prod --endpoint https://myorg.omniapp.co --auth oauth

# API key
omni config init --name prod --endpoint https://myorg.omniapp.co --api-key "$OMNI_API_TOKEN"

Behavior

  • Each supplied flag skips its corresponding prompt; missing values still prompt interactively, so flags and prompts can be mixed.
  • --api-key alone implies --auth api-key.
  • An unrecognized --auth value errors (the interactive prompt keeps its lenient 1/2/o/a handling).
  • --auth oauth combined with --api-key is rejected as contradictory.
  • OAuth still validates the endpoint (HTTPS + allowlisted domain) before opening the browser.
  • Named --name instead of --profile to avoid colliding with the global -p/--profile flag.
  • Example/prompt endpoint URLs updated to the real https://<slug>.omniapp.co form, which is on the endpoint allowlist.

Testing

  • New tests: no-prompt api-key path (incl. default-profile assignment), fast endpoint-validation failure for --auth oauth, invalid --auth error, flag-conflict error.
  • go test ./... passes; the OAuth happy path isn't unit-tested since it requires a live browser login.

🤖 Generated with Claude Code

--name, --endpoint, --auth, and --api-key each skip their interactive
prompt, so OAuth profiles can be created with a single command:

  omni config init --name prod --endpoint https://myorg.omni.co --auth oauth

--api-key alone implies --auth api-key. Invalid --auth values and the
contradictory --auth oauth + --api-key combination are rejected.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@dspangen
dspangen requested a review from n8agrin June 12, 2026 15:52
Omni app URLs are https://<slug>.omniapp.co, and that domain is on the
endpoint allowlist — so copied examples now pass validation.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@dspangen
dspangen merged commit 605af48 into main Jun 16, 2026
2 checks passed
@dspangen
dspangen deleted the config-init-flags branch June 16, 2026 15:30
dspangen added a commit that referenced this pull request Jun 26, 2026
PR #63 added an --api-key flag for non-interactive setup. Accepting a
secret on the command line leaks it into shell history and process
listings (and from there into anything scraping them, including agentic
tooling). Drop the flag and always read the key from a hidden prompt.

The non-secret --name, --endpoint, and --auth flags remain, so the
primary motivation — one-command non-interactive OAuth setup — still
works. For api-key auth the key is now always read via term.ReadPassword,
even when --auth api-key is supplied non-interactively.

Removes the two tests that exercised the deleted flag.


Claude-Session: https://claude.ai/code/session_01EfZEjYSR3cRVTHgifwJYjK

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
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