Open History to see the last commit
1import {
2 PROVIDER_DISPLAY_NAMES,
3 type ProviderKind,
4 type ServerProvider,
5} from "@workbench/contracts";
6
7export const COWORK_SHELL = {
8 hideGitSurfaces: true,
9 hideTerminalSurfaces: true,
10 hideDiffSurfaces: true,
11} as const;
12
13export const TASK_LABEL_SINGULAR = "task";
14export const TASK_LABEL_PLURAL = "tasks";
15
16export function formatProviderDisplayLabel(provider: ProviderKind | string): string {
17 const knownLabel = PROVIDER_DISPLAY_NAMES[provider as ProviderKind];
18 if (knownLabel) {
19 return knownLabel;
20 }
21
22 return provider
23 .replace(/([a-z])([A-Z])/g, "$1 $2")
24 .replace(/[_-]+/g, " ")
25 .replace(/\s+/g, " ")
26 .trim()
27 .replace(/\b\w/g, (match) => match.toUpperCase());
28}
29
30export function describeProviderAvailability(
31 provider: Pick<ServerProvider, "enabled" | "installed" | "status">,
32): string {
33 if (!provider.enabled) {
34 return "Disabled";
35 }
36 if (!provider.installed) {
37 return "Not installed";
38 }
39 if (provider.status === "error") {
40 return "Unavailable";
41 }
42 if (provider.status === "warning") {
43 return "Limited";
44 }
45 if (provider.status === "disabled") {
46 return "Disabled";
47 }
48 return "Ready";
49}