Skip to content

Commit 5bf8778

Browse files
authored
feat: derive provider count from eyrie registry, drop legacy credential naming (#161)
* feat: derive provider count from eyrie registry; drop legacy credential naming - RegisteredProviderCount() now returns eyrieengine.RegisteredGatewayCount() instead of a hard-coded 27, so adding a provider in eyrie needs no hawk changes - Rename MigrateLegacyCredentials -> MigrateEnvFileCredentials across gateway, hawkconfig, and the credentials migrate command - migrateStoredModelProvider / plaintextCredentialFilesPresent renames; manpage + gateway-count tests derive expectations from the registry - Bump external/eyrie to feat/typed-provider-credentials (registry-driven credential mapping) - Hermeticize TestFormatModelThinkingCell (real user settings were leaking per-model thinking preferences into the assertion) * chore: update eyrie submodule to registry-driven credential mapping * chore: align eyrie go.mod pseudo-version with submodule pointer
1 parent c2e8a3d commit 5bf8778

13 files changed

Lines changed: 44 additions & 40 deletions

‎cmd/credentials.go‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,21 +41,21 @@ var credentialsRemoveCmd = &cobra.Command{
4141

4242
var credentialsMigrateCmd = &cobra.Command{
4343
Use: "migrate",
44-
Short: "Import legacy plaintext credential files into the OS secret store",
44+
Short: "Import plaintext credential files into the OS secret store",
4545
RunE: func(cmd *cobra.Command, args []string) error {
4646
ctx := context.Background()
4747
storage := hawkconfig.CredentialStorageStatus(ctx)
4848
if !storage.Writable {
4949
return fmt.Errorf("cannot migrate: %s", storage.Detail)
5050
}
51-
n, err := hawkconfig.MigrateLegacyCredentials(ctx)
51+
n, err := hawkconfig.MigrateEnvFileCredentials(ctx)
5252
if err != nil {
5353
return err
5454
}
5555
if n == 0 {
56-
cmd.Println("No legacy credential files found (already using secure storage).")
56+
cmd.Println("No plaintext credential files found (already using secure storage).")
5757
} else {
58-
cmd.Printf("Migrated %d key(s) to %s and removed legacy credential files.\n", n, hawkconfig.CredentialStoreName())
58+
cmd.Printf("Migrated %d key(s) to %s and removed plaintext credential files.\n", n, hawkconfig.CredentialStoreName())
5959
}
6060
return nil
6161
},

‎cmd/manpage_test.go‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@ import (
77
)
88

99
func TestProviderCountCopyMatchesRegistry(t *testing.T) {
10-
const documentedProviderCount = 27
11-
if got := registeredProviderCount(); got != documentedProviderCount {
12-
t.Fatalf("registered providers = %d, update documented count %d and this assertion", got, documentedProviderCount)
10+
count := registeredProviderCount()
11+
if count < 20 {
12+
t.Fatalf("registered providers = %d, expected a first-class provider registry", count)
1313
}
1414

15-
want := fmt.Sprintf("%d first-class LLM providers", documentedProviderCount)
15+
want := fmt.Sprintf("%d first-class LLM providers", count)
1616
if !strings.Contains(rootCmd.Long, want) {
1717
t.Fatalf("CLI help does not contain registry-backed provider count %q", want)
1818
}

‎cmd/model_table_test.go‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,9 @@ func TestFormatModelCapabilities(t *testing.T) {
6767
}
6868

6969
func TestFormatModelThinkingCell(t *testing.T) {
70+
// Isolate from the developer's real hawk settings (per-model thinking
71+
// preferences would otherwise change the asserted defaults).
72+
t.Setenv("HOME", t.TempDir())
7073
row := modelTableRowFromOption(configModelOption{
7174
ID: "demo/no-think", DisplayName: "no-think", Owner: "demo",
7275
Capabilities: []string{"tools"},

‎external/eyrie‎

Submodule eyrie updated from 6de314a to 256ef60

‎go.mod‎

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎go.sum‎

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎internal/config/catalog_gateways_test.go‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ func TestAllSetupGateways_RegistryOnly(t *testing.T) {
3131
}
3232
}
3333
// Required gateways that exist in the published eyrie v0.1.3.
34-
want := map[string]bool{"azure": true, "bedrock": true, "gemini": true, "grok": true, "openrouter": true, "kimi": true, "vertex": true, "xiaomi_mimo_payg": true, "xiaomi_mimo_token_plan": true, "deepseek": true, "minimax_token_plan": true, "minimax_payg": true, "zai_payg": true, "zai_coding": true}
34+
want := map[string]bool{"azure": true, "bedrock": true, "gemini": true, "grok": true, "openrouter": true, "kimi": true, "vertex": true, "xiaomi_mimo_payg": true, "xiaomi_mimo_token_plan": true, "deepseek": true, "minimax_token_plan": true, "minimax_payg": true, "zai_payg": true, "zai_coding": true, "agnes": true}
3535
for id := range want {
3636
found := false
3737
for _, gw := range gws {

‎internal/config/developer_path.go‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -134,15 +134,15 @@ func EvaluateDeveloperPath(ctx context.Context) DeveloperPathReport {
134134
})
135135
}
136136

137-
if legacy, paths := legacyCredentialFilesPresent(); legacy {
137+
if present, paths := plaintextCredentialFilesPresent(); present {
138138
checks = append(checks, PathCheck{
139-
Section: "Security", Name: "legacy env", Status: PathWarn,
139+
Section: "Security", Name: "plaintext env", Status: PathWarn,
140140
Detail: "Plaintext credential files: " + strings.Join(paths, ", "),
141141
FixHint: "Run hawk credentials migrate",
142142
})
143143
} else {
144144
checks = append(checks, PathCheck{
145-
Section: "Security", Name: "legacy env", Status: PathPass,
145+
Section: "Security", Name: "plaintext env", Status: PathPass,
146146
Detail: "No ~/.hawk/env or ~/.hawk/.env files",
147147
Blocking: true,
148148
})
@@ -316,7 +316,7 @@ func providerJSONHasSecretsOnDisk() (bool, string) {
316316
return status.HasSecrets, status.Detail
317317
}
318318

319-
func legacyCredentialFilesPresent() (bool, []string) {
319+
func plaintextCredentialFilesPresent() (bool, []string) {
320320
hawkDir := filepath.Join(home.MustDir(), ".hawk")
321321
var paths []string
322322
for _, name := range []string{"env", ".env"} {

‎internal/config/developer_path_test.go‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,11 @@ func TestProviderJSONHasSecretsOnDisk_None(t *testing.T) {
5858
}
5959
}
6060

61-
func TestLegacyCredentialFilesPresent_None(t *testing.T) {
61+
func TestPlaintextCredentialFilesPresent_None(t *testing.T) {
6262
isolateMilestoneTest(t)
63-
found, paths := legacyCredentialFilesPresent()
63+
found, paths := plaintextCredentialFilesPresent()
6464
if found || len(paths) > 0 {
65-
t.Fatalf("expected no legacy files, got %v", paths)
65+
t.Fatalf("expected no plaintext files, got %v", paths)
6666
}
6767
}
6868

‎internal/config/eyrie_engine.go‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,8 @@ func CredentialStorageStatus(ctx context.Context) gateway.CredentialStorageRepor
5656
return gateway.CredentialStorage(ctx)
5757
}
5858

59-
func MigrateLegacyCredentials(ctx context.Context) (int, error) {
60-
return gateway.MigrateLegacyCredentials(ctx)
59+
func MigrateEnvFileCredentials(ctx context.Context) (int, error) {
60+
return gateway.MigrateEnvFileCredentials(ctx)
6161
}
6262

6363
// EnginePreflightReport runs preflight against the default gateway.

0 commit comments

Comments
 (0)