diff --git a/README.md b/README.md index 3e25b6b..d2fb7db 100644 --- a/README.md +++ b/README.md @@ -61,6 +61,7 @@ ShellTime CLI configuration is stored in `$HOME/.shelltime/config.toml`. The con | `ai.agent.view` | boolean | `false` | Allow AI to auto-execute read-only commands | | `ai.agent.edit` | boolean | `false` | Allow AI to auto-execute file editing commands | | `ai.agent.delete` | boolean | `false` | Allow AI to auto-execute deletion commands | +| `ai.showTips` | boolean | `true` | Show AI-related tips and suggestions | #### Analytics Settings @@ -99,6 +100,9 @@ exclude = [ # AI configuration (optional) # Controls which command types the AI assistant can automatically execute +[ai] +showTips = true # Show AI-related tips and suggestions (default: true) + [ai.agent] view = false # Allow AI to execute read-only commands (ls, cat, less, head, tail, etc.) edit = false # Allow AI to execute file editing commands (vim, nano, code, sed, etc.) diff --git a/commands/query.go b/commands/query.go index 7bd369e..bc7e1bc 100644 --- a/commands/query.go +++ b/commands/query.go @@ -123,7 +123,7 @@ func commandQuery(c *cli.Context) error { } else { // Display command with info about why it's not auto-running displayCommand(newCommand) - if actionType != model.ActionOther { + if shouldShowTips(cfg) && actionType != model.ActionOther { color.Yellow.Printf("\n💡 Tip: This is a %s command. Enable 'ai.agent.%s' in your config to auto-run it.\n", actionType, actionType) } @@ -131,11 +131,13 @@ func commandQuery(c *cli.Context) error { } else { // No auto-run configured, display the command and tip displayCommand(newCommand) - color.Yellow.Printf("\n💡 Tip: You can enable AI auto-run in your config file:\n") - color.Yellow.Printf(" [ai.agent]\n") - color.Yellow.Printf(" view = true # Auto-run view commands\n") - color.Yellow.Printf(" edit = true # Auto-run edit commands\n") - color.Yellow.Printf(" delete = true # Auto-run delete commands\n") + if shouldShowTips(cfg) { + color.Yellow.Printf("\n💡 Tip: You can enable AI auto-run in your config file:\n") + color.Yellow.Printf(" [ai.agent]\n") + color.Yellow.Printf(" view = true # Auto-run view commands\n") + color.Yellow.Printf(" edit = true # Auto-run edit commands\n") + color.Yellow.Printf(" delete = true # Auto-run delete commands\n") + } } return nil @@ -146,6 +148,14 @@ func displayCommand(command string) { color.Cyan.Printf("%s\n", command) } +func shouldShowTips(cfg model.ShellTimeConfig) bool { + // If ShowTips is not set (nil), default to true + if cfg.AI == nil || cfg.AI.ShowTips == nil { + return true + } + return *cfg.AI.ShowTips +} + func executeCommand(ctx context.Context, command string) error { // Get the shell to use shell := os.Getenv("SHELL") diff --git a/model/types.go b/model/types.go index 4a6db7a..1865948 100644 --- a/model/types.go +++ b/model/types.go @@ -13,7 +13,8 @@ type AIAgentConfig struct { } type AIConfig struct { - Agent AIAgentConfig `toml:"agent"` + Agent AIAgentConfig `toml:"agent"` + ShowTips *bool `toml:"showTips"` } type CCUsage struct { @@ -62,6 +63,7 @@ var DefaultAIConfig = &AIConfig{ Edit: false, Delete: false, }, + ShowTips: nil, // defaults to true if nil } var DefaultConfig = ShellTimeConfig{