summaryrefslogtreecommitdiffhomepage
path: root/internal/config
diff options
context:
space:
mode:
authorGarrett Ladley <[email protected]>2025-04-27 14:11:09 -0400
committerGitHub <[email protected]>2025-04-27 20:11:09 +0200
commit8f3a94df92ce783f8957aeb66b08801be736adfb (patch)
treec2e9442f2e9b3df2f0e60c2220502aa1f64cb1bf /internal/config
parent4415220555d8de0f28a2c17c01805eb98df395d4 (diff)
downloadopencode-8f3a94df92ce783f8957aeb66b08801be736adfb.tar.gz
opencode-8f3a94df92ce783f8957aeb66b08801be736adfb.zip
feat: configure context paths (#86)
Diffstat (limited to 'internal/config')
-rw-r--r--internal/config/config.go32
1 files changed, 24 insertions, 8 deletions
diff --git a/internal/config/config.go b/internal/config/config.go
index 1da1f6c94..4864ef18a 100644
--- a/internal/config/config.go
+++ b/internal/config/config.go
@@ -67,14 +67,15 @@ type LSPConfig struct {
// Config is the main configuration structure for the application.
type Config struct {
- Data Data `json:"data"`
- WorkingDir string `json:"wd,omitempty"`
- MCPServers map[string]MCPServer `json:"mcpServers,omitempty"`
- Providers map[models.ModelProvider]Provider `json:"providers,omitempty"`
- LSP map[string]LSPConfig `json:"lsp,omitempty"`
- Agents map[AgentName]Agent `json:"agents"`
- Debug bool `json:"debug,omitempty"`
- DebugLSP bool `json:"debugLSP,omitempty"`
+ Data Data `json:"data"`
+ WorkingDir string `json:"wd,omitempty"`
+ MCPServers map[string]MCPServer `json:"mcpServers,omitempty"`
+ Providers map[models.ModelProvider]Provider `json:"providers,omitempty"`
+ LSP map[string]LSPConfig `json:"lsp,omitempty"`
+ Agents map[AgentName]Agent `json:"agents"`
+ Debug bool `json:"debug,omitempty"`
+ DebugLSP bool `json:"debugLSP,omitempty"`
+ ContextPaths []string `json:"contextPaths,omitempty"`
}
// Application constants
@@ -84,6 +85,20 @@ const (
appName = "opencode"
)
+var defaultContextPaths = []string{
+ ".github/copilot-instructions.md",
+ ".cursorrules",
+ ".cursor/rules/",
+ "CLAUDE.md",
+ "CLAUDE.local.md",
+ "opencode.md",
+ "opencode.local.md",
+ "OpenCode.md",
+ "OpenCode.local.md",
+ "OPENCODE.md",
+ "OPENCODE.local.md",
+}
+
// Global configuration instance
var cfg *Config
@@ -185,6 +200,7 @@ func configureViper() {
// setDefaults configures default values for configuration options.
func setDefaults(debug bool) {
viper.SetDefault("data.directory", defaultDataDirectory)
+ viper.SetDefault("contextPaths", defaultContextPaths)
if debug {
viper.SetDefault("debug", true)