enable-hub-continue-dev feature flag

This commit is contained in:
Nate 2025-02-13 09:59:31 -08:00
parent 79070a5548
commit b2dad4b6cd
5 changed files with 28 additions and 6 deletions

View file

@ -1,3 +1,4 @@
import fetch from "node-fetch";
import { IdeSettings } from "..";
export interface ControlPlaneEnv {
@ -60,6 +61,17 @@ const LOCAL_ENV: ControlPlaneEnv = {
APP_URL: "http://localhost:3000/",
};
export async function enableHubContinueDev() {
try {
const resp = await fetch("http://localhost:3001/features/hub");
const data = (await resp.json()) as any;
if ("enabled" in data && data.enabled === true) {
return true;
}
} catch (e: any) {}
return false;
}
export async function getControlPlaneEnv(
ideSettingsPromise: Promise<IdeSettings>,
): Promise<ControlPlaneEnv> {

View file

@ -110,7 +110,7 @@
"@continuedev/fetch": "^1.0.4",
"@continuedev/llm-info": "^1.0.2",
"@continuedev/openai-adapters": "^1.0.10",
"@modelcontextprotocol/sdk": "^1.4.1",
"@modelcontextprotocol/sdk": "^1.5.0",
"@mozilla/readability": "^0.5.0",
"@octokit/rest": "^20.0.2",
"@typescript-eslint/eslint-plugin": "^7.8.0",

View file

@ -2,7 +2,7 @@ import * as child_process from "node:child_process";
import { exec } from "node:child_process";
import { Range } from "core";
import { EXTENSION_NAME } from "core/control-plane/env";
import { enableHubContinueDev, EXTENSION_NAME } from "core/control-plane/env";
import { GetGhTokenArgs } from "core/protocol/ide";
import { editConfigJson, getConfigJsonPath } from "core/util/paths";
import * as vscode from "vscode";
@ -619,7 +619,7 @@ class VsCodeIde implements IDE {
return vscode.workspace.fs.readDirectory(vscode.Uri.parse(dir)) as any;
}
getIdeSettingsSync(): IdeSettings {
private getIdeSettingsSync(): IdeSettings {
const settings = vscode.workspace.getConfiguration(EXTENSION_NAME);
const remoteConfigServerUrl = settings.get<string | undefined>(
"remoteConfigServerUrl",
@ -652,7 +652,17 @@ class VsCodeIde implements IDE {
}
async getIdeSettings(): Promise<IdeSettings> {
return this.getIdeSettingsSync();
const ideSettings = this.getIdeSettingsSync();
// Feature flag for when hub is enabled
if (ideSettings.continueTestEnvironment !== "production") {
const enableHub = await enableHubContinueDev();
if (enableHub) {
ideSettings.continueTestEnvironment = "production";
}
}
return ideSettings;
}
}

View file

@ -380,7 +380,7 @@ export class VsCodeExtension {
.get<boolean>("enableContinueHub");
vscode.workspace.onDidChangeConfiguration(async (event) => {
if (event.affectsConfiguration(EXTENSION_NAME)) {
const settings = this.ide.getIdeSettingsSync();
const settings = await this.ide.getIdeSettings();
const webviewProtocol = await this.webviewProtocolPromise;
void webviewProtocol.request("didChangeIdeSettings", {
settings,

2
gui/package-lock.json generated
View file

@ -112,7 +112,7 @@
"@continuedev/fetch": "^1.0.4",
"@continuedev/llm-info": "^1.0.2",
"@continuedev/openai-adapters": "^1.0.10",
"@modelcontextprotocol/sdk": "^1.4.1",
"@modelcontextprotocol/sdk": "^1.5.0",
"@mozilla/readability": "^0.5.0",
"@octokit/rest": "^20.0.2",
"@typescript-eslint/eslint-plugin": "^7.8.0",