Skip to content

support loading local .opencode/config.json config file name#4766

Closed
Alb-O wants to merge 2 commits into
anomalyco:devfrom
Alb-O:config-json-local
Closed

support loading local .opencode/config.json config file name#4766
Alb-O wants to merge 2 commits into
anomalyco:devfrom
Alb-O:config-json-local

Conversation

@Alb-O

@Alb-O Alb-O commented Nov 26, 2025

Copy link
Copy Markdown
Contributor

The config.json filename is supported in the global XDG config path, but not from project-specific path (.opencode/config.json ). This PR simply allows config.json to be supported inside .opencode dirs.

The name opencode.json makes sense when only having the json file in the root, but looks a little silly when it's in: .opencode/opencode.json

@rekram1-node

Copy link
Copy Markdown
Collaborator

ugh I almost wanna kill config.json entirely it just adds confusion

@Alb-O

Alb-O commented Nov 26, 2025

Copy link
Copy Markdown
Contributor Author

Oh, didn't know that was the sentiment. I would prefer config.json but up to you guys :)

@rekram1-node

Copy link
Copy Markdown
Collaborator

well we kinda screwed ourselves but originally it used to be:

~/.config/opencode/config.json

but in your project it was only opencode.json

Then we supported opencode.json in all locations
Then we added jsonc
Then people wanted to read opencode.json from the .opencode directory

And now we are here hahaha

@ariane-emory

ariane-emory commented Nov 26, 2025

Copy link
Copy Markdown
Contributor

I kind of agree with @rekram1-node here.

Personally, I thinkconfig.json can be kind of un-ergonomic when editing: I've got a few applications installed with config.json files, and often have several (or all) of them open simultaneously open In emacs buffers.

As a result, when I use the switch-to-buffer key and type in something like conf<tab> at the prompt, it can't unambiguously complete the entire buffer name: it'll partially complete it to something like config.json< and I'll have to type part of the directory path to disambiguate it and then hit tab again to finish completing the buffer name.

On the other hand, most of the time I only have one opencode.json file open so I can usually just type ope<tab> and it'll complete the rest of the file name, no muss no fuss.

@Alb-O

Alb-O commented Nov 26, 2025

Copy link
Copy Markdown
Contributor Author

I'm not sure we're on the same page at all, why is it confusing to support multiple fallback config filenames? If you prefer opencode.json, just use that, and it can stay as the primary one to reference in the documentation for consistency. I don't see how this is a 'screwed up' kind of spot...

@rekram1-node

Copy link
Copy Markdown
Collaborator

im exaggerating but it's just annoying when people ask for help and I say can you show me your opencode.json and then they say oh I have .jsonc is that not supported, etc etc its really not a big deal it's just annoying how often it confuses people

@Alb-O

Alb-O commented Nov 26, 2025

Copy link
Copy Markdown
Contributor Author

Yeah I get that, I think this actually exposes a more general problem with programs that support multiple configuration files/locations/merging etc. The user needs a way to see what opencode sees as the definitive post-processed config, e.g. a 'print-config' functionality, which would also be used as the source of truth when helping users with debugging

@ariane-emory

Copy link
Copy Markdown
Contributor

@Alb-O This exists, try opencode debug config.

When multiple config files are allowed I always have immediate questions like "What happens if more than one of these config files exist, which takes precedence?", so it does always at least add one more thing I need to spend some time thinking about.

@Alb-O

Alb-O commented Nov 26, 2025

Copy link
Copy Markdown
Contributor Author

Ah didn't see that, nice. Welp, didn't really expect this sentiment towards config.json. I suppose .opencode/opencode.json is not a big deal.

@Alb-O Alb-O closed this by deleting the head repository Dec 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants