refactor(hosts): Simplify the host provider interface for callers (#5057)

* refactor(hosts): Simplify the host provider interface for callers

- Streamline API to reduce complexity for consuming code
- Update all references across core, controller, and integration modules
- Consolidate provider patterns for easier usage
- Rename host-providers.ts to host-provider.ts

# Conflicts:
#	src/core/controller/index.ts
#	src/extension.ts
#	src/integrations/git/commit-message-generator.ts

* Add comment

* In the tests, reset the HostProvider to prevent it complaining that it is being reinitialized

* Update comment

* Fix imports
This commit is contained in:
Sarah Fortune authored and GitHub committed 2025-07-21 12:20:50 -07:00
1 parent c970b8030e
commit 8d5985c8fd
30 files changed
+223 -172

No files matched your search

+3 -3
View File
@@ -1,6 +1,6 @@
import type { Controller } from "../index"
import { EmptyRequest, Empty, String } from "@shared/proto/common"
import * as hostProviders from "@hosts/host-providers"
import { EmptyRequest, String } from "@shared/proto/common"
import { HostProvider } from "@/hosts/host-provider"
import { WebviewProviderType } from "@/shared/webview/types"
/**
@@ -10,7 +10,7 @@ import { WebviewProviderType } from "@/shared/webview/types"
* @returns Empty response
*/
export async function getWebviewHtml(_controller: Controller, _: EmptyRequest): Promise<String> {
const webviewProvider = hostProviders.createWebviewProvider(WebviewProviderType.SIDEBAR)
const webviewProvider = HostProvider.get().createWebviewProvider(WebviewProviderType.SIDEBAR)
return Promise.resolve(String.create({ value: webviewProvider.getHtmlContent() }))
}