From 6ae6e25eebe7017402c3ee43c47ca0bae8002dd4 Mon Sep 17 00:00:00 2001 From: AnnatarHe Date: Tue, 7 Oct 2025 21:43:38 +0800 Subject: [PATCH 1/2] feat(ai): add configurable tips display via showTips config MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add new `showTips` configuration option under the `ai` config section to allow users to disable AI-related tips. When set to false, tips about AI auto-run configuration will not be displayed. Configuration example: ```toml [ai] showTips = false ``` Defaults to true when not set to maintain backward compatibility. šŸ¤– Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- commands/query.go | 22 ++++++++++++++++------ model/types.go | 4 +++- 2 files changed, 19 insertions(+), 7 deletions(-) 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{ From 28ab1cfe3e13cf7e12ee588ed8d2f2dcea29f0c7 Mon Sep 17 00:00:00 2001 From: AnnatarHe Date: Tue, 7 Oct 2025 21:52:17 +0800 Subject: [PATCH 2/2] docs(ai): add showTips configuration to README MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Document the new `ai.showTips` configuration option in both the configuration reference table and the example configuration section. šŸ¤– Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- README.md | 4 ++++ 1 file changed, 4 insertions(+) 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.)