-
Notifications
You must be signed in to change notification settings - Fork 18.6k
feat: create global opencode.jsonc if no configs exist #26992
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -409,6 +409,16 @@ export const layer = Layer.effect( | |
|
|
||
| const loadGlobal = Effect.fnUntraced(function* () { | ||
| let result: Info = {} | ||
| // Seed the default global config with the schema for editor completion, but avoid writing when the user | ||
| // explicitly routes config through env-provided paths or content. | ||
| if (!Flag.OPENCODE_CONFIG && !Flag.OPENCODE_CONFIG_DIR && !Flag.OPENCODE_CONFIG_CONTENT) { | ||
| const file = globalConfigFile() | ||
| if (!existsSync(file)) { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Suggestion: this check only considers |
||
| yield* fs | ||
| .writeWithDirs(file, JSON.stringify({ $schema: "https://opencode.ai/config.json" }, null, 2)) | ||
| .pipe(Effect.catch(() => Effect.void)) | ||
| } | ||
| } | ||
| result = mergeConfig(result, yield* loadFile(path.join(Global.Path.config, "config.json"))) | ||
| result = mergeConfig(result, yield* loadFile(path.join(Global.Path.config, "opencode.json"))) | ||
| result = mergeConfig(result, yield* loadFile(path.join(Global.Path.config, "opencode.jsonc"))) | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.