22 lines
841 B
TypeScript
22 lines
841 B
TypeScript
const featureFlags = {
|
|
/** Local-models GUI surfaces (settings pane, pickers, statusbar, tips). */
|
|
localModels: ({ argv }) => process.platform === 'win32' || process.platform === 'darwin' || argv.includes('--local')
|
|
} satisfies Record<string, (args: FeatureFlagInput) => boolean>
|
|
|
|
export type FeatureFlags = { [K in keyof typeof featureFlags]: boolean }
|
|
|
|
export function isCanaryTag(tag: string | null | undefined): boolean {
|
|
return /\+canary\.20\d{6}T\d{6}Z$/.test(tag || '')
|
|
}
|
|
|
|
export interface FeatureFlagInput {
|
|
/** desktop launch flags */
|
|
argv: readonly string[]
|
|
/** Whether this artifact is a canary-channel build. */
|
|
canary: boolean
|
|
}
|
|
|
|
export function resolveFeatureFlags(input: FeatureFlagInput): FeatureFlags {
|
|
return Object.fromEntries(Object.entries(featureFlags).map(([k, v]) => [k, v(input)])) as FeatureFlags
|
|
}
|