2023-08-24 10:45:51 +08:00
|
|
|
import * as vscode from 'vscode';
|
|
|
|
import * as fs from 'fs';
|
|
|
|
import * as path from 'path';
|
|
|
|
|
|
|
|
const featureTogglesJson = `
|
|
|
|
{
|
|
|
|
"ask-code-summary": false,
|
2023-08-25 10:41:14 +08:00
|
|
|
"ask-code": true,
|
2023-08-24 10:45:51 +08:00
|
|
|
"ask-code-dfs": false
|
|
|
|
}`;
|
|
|
|
const featureToggles = JSON.parse(featureTogglesJson);
|
|
|
|
|
2023-08-24 10:45:51 +08:00
|
|
|
|
2023-11-30 13:25:18 +08:00
|
|
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
2023-08-24 10:45:51 +08:00
|
|
|
export function FT(feature: string): boolean {
|
|
|
|
const betaInvitationCode = vscode.workspace.getConfiguration('DevChat').get<string>('betaInvitationCode');
|
|
|
|
const expectedInvitationCode = 'WELCOMEADDTODEVCHAT';
|
|
|
|
|
|
|
|
return betaInvitationCode === expectedInvitationCode || featureToggles[feature] === true;
|
|
|
|
}
|
|
|
|
|
2023-11-30 13:25:18 +08:00
|
|
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
2023-08-24 10:45:51 +08:00
|
|
|
export function FTs(): any {
|
|
|
|
// visited features
|
|
|
|
let newFeatureToggles = {};
|
|
|
|
for (const feature in featureToggles) {
|
|
|
|
newFeatureToggles[feature] = FT(feature);
|
|
|
|
}
|
|
|
|
return newFeatureToggles;
|
|
|
|
}
|