chore(app): global config changes

This commit is contained in:
adamelmore
2026-01-28 07:28:02 -06:00
parent 6650aa6f35
commit 2f35c40bb5
5 changed files with 1637 additions and 375 deletions
+52 -6
View File
@@ -14,7 +14,7 @@ import type {
AuthSetErrors,
AuthSetResponses,
CommandListResponses,
Config as Config2,
Config as Config3,
ConfigGetResponses,
ConfigProvidersResponses,
ConfigUpdateErrors,
@@ -34,6 +34,9 @@ import type {
FindSymbolsResponses,
FindTextResponses,
FormatterStatusResponses,
GlobalConfigGetResponses,
GlobalConfigUpdateErrors,
GlobalConfigUpdateResponses,
GlobalDisposeResponses,
GlobalEventResponses,
GlobalHealthResponses,
@@ -215,6 +218,44 @@ class HeyApiRegistry<T> {
}
}
export class Config extends HeyApiClient {
/**
* Get global configuration
*
* Retrieve the current global OpenCode configuration settings and preferences.
*/
public get<ThrowOnError extends boolean = false>(options?: Options<never, ThrowOnError>) {
return (options?.client ?? this.client).get<GlobalConfigGetResponses, unknown, ThrowOnError>({
url: "/global/config",
...options,
})
}
/**
* Update global configuration
*
* Update global OpenCode configuration settings and preferences.
*/
public update<ThrowOnError extends boolean = false>(
parameters?: {
config?: Config3
},
options?: Options<never, ThrowOnError>,
) {
const params = buildClientParams([parameters], [{ args: [{ key: "config", map: "body" }] }])
return (options?.client ?? this.client).patch<GlobalConfigUpdateResponses, GlobalConfigUpdateErrors, ThrowOnError>({
url: "/global/config",
...options,
...params,
headers: {
"Content-Type": "application/json",
...options?.headers,
...params.headers,
},
})
}
}
export class Global extends HeyApiClient {
/**
* Get health
@@ -251,6 +292,11 @@ export class Global extends HeyApiClient {
...options,
})
}
private _config?: Config
get config(): Config {
return (this._config ??= new Config({ client: this.client }))
}
}
export class Project extends HeyApiClient {
@@ -541,7 +587,7 @@ export class Pty extends HeyApiClient {
}
}
export class Config extends HeyApiClient {
export class Config2 extends HeyApiClient {
/**
* Get configuration
*
@@ -569,7 +615,7 @@ export class Config extends HeyApiClient {
public update<ThrowOnError extends boolean = false>(
parameters?: {
directory?: string
config?: Config2
config?: Config3
},
options?: Options<never, ThrowOnError>,
) {
@@ -3168,9 +3214,9 @@ export class OpencodeClient extends HeyApiClient {
return (this._pty ??= new Pty({ client: this.client }))
}
private _config?: Config
get config(): Config {
return (this._config ??= new Config({ client: this.client }))
private _config?: Config2
get config(): Config2 {
return (this._config ??= new Config2({ client: this.client }))
}
private _tool?: Tool