CLI & Config changes to support disabling core tools#35
Conversation
Allow users to disable all built-in core tools (bash, read, write,
edit, grep, find, ls, subagent) without recompiling, using a CLI flag,
environment variable, or .kit.yml config key.
Changes
-------
cmd/root.go
- Declare noCoreToolsFlag bool alongside noExtensionsFlag.
- Register --no-core-tools persistent flag with a descriptive help string
listing the affected tools.
- Bind the flag to viper key "no-core-tools" so the config file and
KIT_NO_CORE_TOOLS env var also work (viper's standard precedence:
CLI flag > env var > config file > default).
- Set kitOpts.DisableCoreTools = viper.GetBool("no-core-tools") when
assembling the Options struct in runNormalMode.
pkg/kit/kit.go
- Add disableCoreTools local variable inside the viperInitMu-protected
snapshot block, mirroring the noExtensions pattern exactly.
- Resolve it as opts.DisableCoreTools || viper.GetBool("no-core-tools")
so the SDK option and the viper key are both respected (OR semantics:
either source can enable the flag).
- Pass the resolved disableCoreTools into kitsetup.AgentSetupOptions
instead of the raw opts.DisableCoreTools, completing the chain.
Usage
-----
# CLI flag
kit --no-core-tools
# Environment variable
KIT_NO_CORE_TOOLS=true kit
# .kit.yml config file
no-core-tools: true
# SDK (unchanged, was already supported)
kit.New(ctx, &kit.Options{DisableCoreTools: true})
The downstream path (kitsetup → agent.AgentConfig.DisableCoreTools →
agent.NewAgent nil-tool branch) was already in place and required no
changes.
Update three locations in README.md to reflect the new no-core-tools control surface introduced in the previous commit: CLI Reference → Global Flags Add --no-core-tools under the Extensions and tools section alongside --no-extensions, with a description listing the affected tools. Configuration → Basic Configuration Add no-core-tools: false to the example .kit.yml block so users know it is a valid config file key (equivalent to the CLI flag and env var). Go SDK → With Options Expand the DisableCoreTools comment to note that the same behaviour is also available via --no-core-tools, KIT_NO_CORE_TOOLS, and no-core-tools: true in .kit.yml, making the cross-surface relationship explicit for SDK consumers.
|
Connected to Huly®: KIT-36 |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughAdds a persistent Changesno-core-tools capability
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@cmd/root.go`:
- Line 333: The call to viper.BindPFlag that binds "no-core-tools" currently
discards its returned error; update the init code so the error from
viper.BindPFlag(rootCmd.PersistentFlags().Lookup("no-core-tools")) is checked,
and if non-nil return or handle it by wrapping with fmt.Errorf("bind
no-core-tools flag: %w", err) (or log and exit as appropriate for init),
ensuring the binding failure is not silently ignored.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: c0207512-3f05-4163-93d0-0891cbd1857c
📒 Files selected for processing (3)
README.mdcmd/root.gopkg/kit/kit.go
|
Tested it locally & it works as expected 🎉 |
|
@kskarthik thanks for the PR. Could you fix the linting issues? |
|
@ezynda3 Done! |
Allow users to disable all built-in core tools (bash, read, write,
edit, grep, find, ls, subagent) without recompiling, using a CLI flag,
environment variable, or .kit.yml config key.
Changes
cmd/root.go
listing the affected tools.
KIT_NO_CORE_TOOLS env var also work (viper's standard precedence:
CLI flag > env var > config file > default).
assembling the Options struct in runNormalMode.
pkg/kit/kit.go
snapshot block, mirroring the noExtensions pattern exactly.
so the SDK option and the viper key are both respected (OR semantics:
either source can enable the flag).
instead of the raw opts.DisableCoreTools, completing the chain.
Usage
CLI flag
kit --no-core-toolsEnvironment variable
KIT_NO_CORE_TOOLS=true kit.kit.yml config file
no-core-tools: trueSDK (unchanged, was already supported)
kit.New(ctx, &kit.Options{DisableCoreTools: true})
The downstream path (kitsetup → agent.AgentConfig.DisableCoreTools →
agent.NewAgent nil-tool branch) was already in place and required no
changes.
Summary by CodeRabbit
New Features
--no-core-toolsCLI flag (also configurable via KIT_NO_CORE_TOOLS env var or.kit.yml) to control built-in core tools.Documentation
--no-core-toolsflag, env var, and configuration key; updated example YAML and CLI flag docs.