From 35ffcde728f5bce5a0516fd0ac10642d10a07685 Mon Sep 17 00:00:00 2001 From: AnnatarHe Date: Sun, 28 Dec 2025 15:12:59 +0800 Subject: [PATCH] fix(config): make endpoints optional and use relative schema path MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Add omitempty tag to Endpoints field for proper optional serialization - Change YAML schema reference to relative path ./config-schema.json 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 --- commands/auth.go | 4 ++-- model/types.go | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/commands/auth.go b/commands/auth.go index 456317c..e87a043 100644 --- a/commands/auth.go +++ b/commands/auth.go @@ -45,7 +45,7 @@ func commandAuth(c *cli.Context) error { SetupLogger(configDir) // Generate JSON schema for IDE autocompletion - schemaFile := configDir + "/config.schema.json" + schemaFile := configDir + "/config-schema.json" if err := generateSchemaFile(schemaFile); err != nil { slog.Warn("Failed to generate schema file", slog.Any("err", err)) } @@ -58,7 +58,7 @@ func commandAuth(c *cli.Context) error { return fmt.Errorf("failed to marshal default config: %w", err) } // Prepend $schema for IDE autocompletion support - schemaHeader := "# yaml-language-server: $schema=" + schemaFile + "\n" + schemaHeader := "# yaml-language-server: $schema=./config-schema.json\n" content = append([]byte(schemaHeader), content...) err = os.WriteFile(configFile, content, 0644) if err != nil { diff --git a/model/types.go b/model/types.go index 46719c5..38e54d0 100644 --- a/model/types.go +++ b/model/types.go @@ -60,7 +60,7 @@ type ShellTimeConfig struct { DataMasking *bool `toml:"dataMasking" yaml:"dataMasking" json:"dataMasking"` // for debug purpose - Endpoints []Endpoint `toml:"ENDPOINTS" yaml:"endpoints" json:"endpoints"` + Endpoints []Endpoint `toml:"ENDPOINTS,omitempty" yaml:"endpoints,omitempty" json:"endpoints,omitempty"` // WARNING // This config will track each command metrics you run in current shell.