-
Notifications
You must be signed in to change notification settings - Fork 5.6k
Enable load nested hint files #4002
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 8 commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
91c528d
refactor to extract load goosehints to a separate file
lifeizhou-ap 2b164e3
traverse upwards to get all the hints
lifeizhou-ap 6bedbeb
add the configuration for nested hints
lifeizhou-ap d9f7983
Merge branch 'main' into lifei/read-upper-goosehints
lifeizhou-ap 5c31ea8
resolved merge conflicts and refactor
lifeizhou-ap 31be8dd
moved tests
lifeizhou-ap 51ace7d
changed the logic that only traverse to project git root
lifeizhou-ap 3af6ba6
fixed the lint
lifeizhou-ap 7d38c5e
Merge branch 'main' into lifei/read-upper-goosehints
lifeizhou-ap db64e9e
added agent.md back
lifeizhou-ap 533913d
fixed compilation error
lifeizhou-ap b2b4a3f
fixed lint check
lifeizhou-ap 3b7f6b6
increased max depth to 6 to fit mono repo use case
lifeizhou-ap 3129deb
Revert "increased max depth to 6 to fit mono repo use case"
lifeizhou-ap 04ef6df
removed configuration for nested hints. use it directly
lifeizhou-ap File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| use cliclack; | ||
| use console::style; | ||
| use goose::config::Config; | ||
| use serde_json::Value; | ||
| use std::error::Error; | ||
|
|
||
| pub fn configure_nested_hints_dialog() -> Result<(), Box<dyn Error>> { | ||
| let config = Config::global(); | ||
|
|
||
| if std::env::var("GOOSE_NESTED_HINTS").is_ok() { | ||
| let _ = cliclack::log::info("Notice: GOOSE_NESTED_HINTS environment variable is set and will override the configuration here."); | ||
| } | ||
|
|
||
| let current_enabled: bool = config.get_param("NESTED_GOOSE_HINTS").unwrap_or(false); | ||
|
|
||
| println!( | ||
| "Current nested hints setting: {}", | ||
| style(if current_enabled { | ||
| "enabled" | ||
| } else { | ||
| "disabled" | ||
| }) | ||
| .cyan() | ||
| ); | ||
|
|
||
| let enable = cliclack::confirm("Enable nested hint files loading (eg: .goosehints)?") | ||
| .initial_value(current_enabled) | ||
| .interact()?; | ||
|
|
||
| config.set_param("NESTED_GOOSE_HINTS", Value::Bool(enable))?; | ||
|
|
||
| if enable { | ||
| cliclack::outro("✓ Nested hints enabled - Goose will load hint files from current directory upwards to project root (.git) or current directory if no .git directory found")?; | ||
| } else { | ||
| cliclack::outro("✓ Nested hints disabled - Goose will only load hint files from the current working directory")?; | ||
| } | ||
|
|
||
| Ok(()) | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,6 @@ | ||
| pub mod bench; | ||
| pub mod configure; | ||
| pub mod configure_settings; | ||
| pub mod info; | ||
| pub mod mcp; | ||
| pub mod project; | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I actually think enabled could be a better default here, and people would only need to seek out the config option if they didn't want it for some reason.