feat: add YAML config file support via koanf#40
Merged
Conversation
7 tasks
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
Bugbot Autofix prepared fixes for 1 of the 1 bugs found in the latest run.
Or push these changes by commenting: Preview (3bcb036975)diff --git a/pkg/cmd/push.go b/pkg/cmd/push.go
--- a/pkg/cmd/push.go
+++ b/pkg/cmd/push.go
@@ -65,7 +65,13 @@
return fmt.Errorf("invalid target: %w", err)
}
- token := resolveAPIKey()
+ // push historically preferred HYPEMAN_BEARER_TOKEN over HYPEMAN_API_KEY.
+ // Check the legacy variable first to preserve backward compatibility for
+ // environments that export both.
+ token := os.Getenv("HYPEMAN_BEARER_TOKEN")
+ if token == "" {
+ token = resolveAPIKey()
+ }
// Use custom transport that always sends Basic auth header
transport := &authTransport{ |
sjmiller609
approved these changes
Feb 16, 2026
Add ~/.config/hypeman/cli.yaml support so the CLI can read base_url and api_key from a config file instead of requiring environment variables. Config precedence: CLI flags > env vars > config file. This pairs with the server-side config migration in kernel/hypeman to enable a zero-config local experience after running install.sh.
- Add resolveBaseURL() and resolveAPIKey() helpers to config.go - Update exec, cp, and push commands to use shared helpers - All commands now consistently use: flag > env > config file - WebSocket commands no longer bypass cli.yaml configuration
Update getDefaultRequestOptions to use resolveBaseURL() and resolveAPIKey() so SDK calls and WebSocket calls share the same HYPEMAN_BEARER_TOKEN > HYPEMAN_API_KEY > config file precedence.
HYPEMAN_API_KEY is the documented primary env var. HYPEMAN_BEARER_TOKEN is a legacy fallback and should not override it.
Load HYPEMAN_BASE_URL and HYPEMAN_API_KEY via koanf's env provider in loadCLIConfig() instead of manual os.Getenv checks. This gives consistent precedence (env > config file) in one place. HYPEMAN_BEARER_TOKEN remains as a legacy fallback checked separately.
cc6b592 to
b959cf4
Compare
| if token == "" { | ||
| token = os.Getenv("HYPEMAN_API_KEY") | ||
| } | ||
| token := resolveAPIKey() |
There was a problem hiding this comment.
Push drops legacy token env fallback
Medium Severity
handlePush now reads auth only via resolveAPIKey(), which excludes the previous HYPEMAN_BEARER_TOKEN fallback. Existing environments that still set only HYPEMAN_BEARER_TOKEN will now push without credentials and fail authentication, creating a regression in push behavior.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Summary
~/.config/hypeman/cli.yamlsupport so the CLI can readbase_urlandapi_keyfrom a config file instead of requiring environment variablesHYPEMAN_BASE_URL,HYPEMAN_API_KEY) > config fileCompanion PR
Context
This pairs with the server-side config migration in
kernel/hypemanto enable a zero-config local experience: the install script generates both the serverconfig.yamland the CLIcli.yamlwith a pre-authenticated token, so users can immediately runhypemancommands after installation without setting any environment variables.Test plan
base_urlandapi_keyfrom~/.config/hypeman/cli.yaml--base-urlflag overrides both env vars and config fileNote
Medium Risk
Introduces a new configuration-loading path (file + env overlay) and changes how auth/base URL are resolved across multiple commands, which could affect connectivity/auth behavior if precedence or parsing differs from prior env-only logic.
Overview
Adds YAML-based CLI configuration via
~/.config/hypeman/cli.yaml, loadingbase_url/api_keywith precedence--base-urlflag >HYPEMAN_env vars > config file (defaulting base URL tohttp://localhost:8080).Refactors request/client setup and the
cp,exec, andpushcommands to use sharedresolveBaseURL/resolveAPIKeyhelpers (including attaching API key automatically ingetDefaultRequestOptions), and updates missing-key errors to mention config-file setup.Written by Cursor Bugbot for commit b959cf4. This will update automatically on new commits. Configure here.