Skip to content

Commit 0280d4c

Browse files
rajbosCopilot
andcommitted
rename settings namespace from copilotTokenTracker to aiEngineeringFluency with graceful migration
- Duplicate all 25 copilotTokenTracker.* settings as aiEngineeringFluency.* in package.json - Add deprecationMessage to all old copilotTokenTracker.* entries - Update all getConfiguration/affectsConfiguration call sites in extension.ts, sessionDiscovery.ts, backend/settings.ts, backend/commands.ts, backend/facade.ts, backend/services/azureResourceService.ts, backend/services/syncService.ts - Add migrateSettingsIfNeeded() function that runs at activation and copies any user-set values from old namespace to new, then exits if nothing to migrate - Fix long-standing bug in syncService.ts: executeCommand used wrong command prefix (copilotTokenTracker.configureBackend -> aiEngineeringFluency.configureBackend) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent ab862ff commit 0280d4c

8 files changed

Lines changed: 286 additions & 44 deletions

File tree

vscode-extension/package.json

Lines changed: 205 additions & 25 deletions
Large diffs are not rendered by default.

vscode-extension/src/backend/commands.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ export class BackendCommandHandler {
259259
* Handles enabling team sharing (consent gate).
260260
*/
261261
async handleEnableTeamSharing(): Promise<void> {
262-
const config = vscode.workspace.getConfiguration('copilotTokenTracker');
262+
const config = vscode.workspace.getConfiguration('aiEngineeringFluency');
263263
const conf = ConfirmationMessages.enableTeamSharing();
264264
const consent = await vscode.window.showWarningMessage(
265265
conf.message,
@@ -296,7 +296,7 @@ export class BackendCommandHandler {
296296
return;
297297
}
298298

299-
const config = vscode.workspace.getConfiguration('copilotTokenTracker');
299+
const config = vscode.workspace.getConfiguration('aiEngineeringFluency');
300300
try {
301301
await config.update('backend.sharingProfile', 'teamAnonymized', vscode.ConfigurationTarget.Global);
302302
await config.update('backend.shareWithTeam', false, vscode.ConfigurationTarget.Global);

vscode-extension/src/backend/facade.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -580,7 +580,7 @@ export class BackendFacade {
580580
}
581581

582582
public async toggleBackendWorkspaceMachineNameSync(): Promise<void> {
583-
const config = vscode.workspace.getConfiguration("copilotTokenTracker");
583+
const config = vscode.workspace.getConfiguration("aiEngineeringFluency");
584584
const current = config.get<boolean>(
585585
"backend.shareWorkspaceMachineNames",
586586
false,
@@ -637,7 +637,7 @@ export class BackendFacade {
637637
"Extension context is unavailable; cannot update configuration.",
638638
);
639639
}
640-
const config = vscode.workspace.getConfiguration("copilotTokenTracker");
640+
const config = vscode.workspace.getConfiguration("aiEngineeringFluency");
641641
await Promise.all([
642642
config.update(
643643
"backend.enabled",
@@ -1030,7 +1030,7 @@ export class BackendFacade {
10301030
}
10311031
}
10321032

1033-
const config = vscode.workspace.getConfiguration("copilotTokenTracker");
1033+
const config = vscode.workspace.getConfiguration("aiEngineeringFluency");
10341034
await Promise.all([
10351035
config.update(
10361036
"backend.enabled",

vscode-extension/src/backend/services/azureResourceService.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ export class AzureResourceService {
3737
* Configure backend wizard (MVP: Storage Tables only).
3838
*/
3939
async configureBackendWizard(): Promise<void> {
40-
const config = vscode.workspace.getConfiguration('copilotTokenTracker');
40+
const config = vscode.workspace.getConfiguration('aiEngineeringFluency');
4141
const credential = this.credentialService.createAzureCredential();
4242

4343
// Sanity check that we can get a token (common failure is "not logged in")
@@ -495,7 +495,7 @@ export class AzureResourceService {
495495
* Set sharing profile command.
496496
*/
497497
async setSharingProfileCommand(): Promise<void> {
498-
const config = vscode.workspace.getConfiguration('copilotTokenTracker');
498+
const config = vscode.workspace.getConfiguration('aiEngineeringFluency');
499499
const currentSettings = this.deps.getSettings();
500500
const currentProfile = currentSettings.sharingProfile;
501501

vscode-extension/src/backend/services/syncService.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ export class SyncService {
235235
'Configure Backend'
236236
).then(choice => {
237237
if (choice === 'Configure Backend') {
238-
vscode.commands.executeCommand('copilotTokenTracker.configureBackend');
238+
vscode.commands.executeCommand('aiEngineeringFluency.configureBackend');
239239
}
240240
});
241241
this.stopTimer();

vscode-extension/src/backend/settings.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ export interface BackendQueryFilters {
5454
}
5555

5656
export function getBackendSettings(): BackendSettings {
57-
const config = vscode.workspace.getConfiguration('copilotTokenTracker');
57+
const config = vscode.workspace.getConfiguration('aiEngineeringFluency');
5858
const sharingProfileInspect = typeof (config as any).inspect === 'function'
5959
? config.inspect<string>('backend.sharingProfile')
6060
: undefined;

vscode-extension/src/extension.ts

Lines changed: 71 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -920,7 +920,7 @@ class CopilotTokenTracker implements vscode.Disposable {
920920
// Re-render open panels when display settings change
921921
context.subscriptions.push(
922922
vscode.workspace.onDidChangeConfiguration(e => {
923-
if (e.affectsConfiguration('copilotTokenTracker.display')) {
923+
if (e.affectsConfiguration('aiEngineeringFluency.display')) {
924924
this.refreshOpenPanelsForSettingChange();
925925
}
926926
})
@@ -1828,7 +1828,7 @@ class CopilotTokenTracker implements vscode.Disposable {
18281828
}
18291829

18301830
private getCompactNumbersSetting(): boolean {
1831-
return vscode.workspace.getConfiguration('copilotTokenTracker').get<boolean>('display.compactNumbers', true);
1831+
return vscode.workspace.getConfiguration('aiEngineeringFluency').get<boolean>('display.compactNumbers', true);
18321832
}
18331833

18341834
private refreshOpenPanelsForSettingChange(): void {
@@ -4839,7 +4839,7 @@ class CopilotTokenTracker implements vscode.Disposable {
48394839
case 'suppressUnknownTool': {
48404840
const toolName = message.toolName as string;
48414841
if (toolName) {
4842-
const config = vscode.workspace.getConfiguration('copilotTokenTracker');
4842+
const config = vscode.workspace.getConfiguration('aiEngineeringFluency');
48434843
const current = config.get<string[]>('suppressedUnknownTools', []);
48444844
if (!current.includes(toolName)) {
48454845
await config.update('suppressedUnknownTools', [...current, toolName], vscode.ConfigurationTarget.Global);
@@ -7429,7 +7429,7 @@ ${hashtag}`;
74297429
if (choice === "Open Settings") {
74307430
vscode.commands.executeCommand(
74317431
"workbench.action.openSettings",
7432-
"copilotTokenTracker.backend",
7432+
"aiEngineeringFluency.backend",
74337433
);
74347434
}
74357435
});
@@ -7440,15 +7440,15 @@ ${hashtag}`;
74407440
await this.dispatch('openSettings:diagnostics', () =>
74417441
vscode.commands.executeCommand(
74427442
"workbench.action.openSettings",
7443-
"copilotTokenTracker.backend",
7443+
"aiEngineeringFluency.backend",
74447444
)
74457445
);
74467446
break;
74477447
case "openDisplaySettings":
74487448
await this.dispatch('openDisplaySettings:diagnostics', () =>
74497449
vscode.commands.executeCommand(
74507450
"workbench.action.openSettings",
7451-
"copilotTokenTracker.display",
7451+
"aiEngineeringFluency.display",
74527452
)
74537453
);
74547454
break;
@@ -7775,7 +7775,7 @@ ${hashtag}`;
77757775
* Get backend storage information for diagnostics
77767776
*/
77777777
private async getBackendStorageInfo(): Promise<any> {
7778-
const config = vscode.workspace.getConfiguration("copilotTokenTracker");
7778+
const config = vscode.workspace.getConfiguration("aiEngineeringFluency");
77797779
const enabled = config.get<boolean>("backend.enabled", false);
77807780
const storageAccount = config.get<string>("backend.storageAccount", "");
77817781
const subscriptionId = config.get<string>("backend.subscriptionId", "");
@@ -8266,7 +8266,7 @@ ${hashtag}`;
82668266
);
82678267

82688268
const suppressedUnknownTools = vscode.workspace
8269-
.getConfiguration('copilotTokenTracker')
8269+
.getConfiguration('aiEngineeringFluency')
82708270
.get<string[]>('suppressedUnknownTools', []);
82718271

82728272
const initialData = stats ? JSON.stringify({
@@ -8334,10 +8334,72 @@ ${hashtag}`;
83348334
}
83358335
}
83368336

8337-
export function activate(context: vscode.ExtensionContext) {
8337+
/**
8338+
* One-time migration: copies any user-set values from the old `copilotTokenTracker.*` namespace
8339+
* to the new `aiEngineeringFluency.*` namespace. The old settings remain in package.json
8340+
* with `deprecationMessage` so VS Code continues to show them as deprecated; this function
8341+
* handles users who already had values configured before the rename.
8342+
*
8343+
* Leave this migration in place for a couple of extension versions before removing it.
8344+
*/
8345+
async function migrateSettingsIfNeeded(log: (m: string) => void): Promise<void> {
8346+
const keys = [
8347+
'display.compactNumbers',
8348+
'backend.enabled',
8349+
'backend.backend',
8350+
'backend.authMode',
8351+
'backend.datasetId',
8352+
'backend.sharingProfile',
8353+
'backend.userId',
8354+
'backend.shareWithTeam',
8355+
'backend.shareWorkspaceMachineNames',
8356+
'backend.shareConsentAt',
8357+
'backend.userIdentityMode',
8358+
'backend.userIdMode',
8359+
'backend.subscriptionId',
8360+
'backend.resourceGroup',
8361+
'backend.storageAccount',
8362+
'backend.aggTable',
8363+
'backend.eventsTable',
8364+
'backend.lookbackDays',
8365+
'backend.includeMachineBreakdown',
8366+
'backend.blobUploadEnabled',
8367+
'backend.blobContainerName',
8368+
'backend.blobUploadFrequencyHours',
8369+
'backend.blobCompressFiles',
8370+
'sampleDataDirectory',
8371+
'suppressedUnknownTools',
8372+
];
8373+
8374+
const oldCfg = vscode.workspace.getConfiguration('copilotTokenTracker');
8375+
const newCfg = vscode.workspace.getConfiguration('aiEngineeringFluency');
8376+
8377+
let migrated = 0;
8378+
for (const key of keys) {
8379+
const insp = oldCfg.inspect(key);
8380+
if (insp?.globalValue !== undefined) {
8381+
await newCfg.update(key, insp.globalValue, vscode.ConfigurationTarget.Global);
8382+
migrated++;
8383+
}
8384+
if (insp?.workspaceValue !== undefined) {
8385+
await newCfg.update(key, insp.workspaceValue, vscode.ConfigurationTarget.Workspace);
8386+
migrated++;
8387+
}
8388+
}
8389+
8390+
if (migrated > 0) {
8391+
log(`Migrated ${migrated} setting(s) from 'copilotTokenTracker' to 'aiEngineeringFluency' namespace.`);
8392+
}
8393+
}
8394+
8395+
export async function activate(context: vscode.ExtensionContext) {
83388396
// Create the token tracker
83398397
const tokenTracker = new CopilotTokenTracker(context.extensionUri, context);
83408398

8399+
// Migrate settings from the old copilotTokenTracker namespace to aiEngineeringFluency.
8400+
// Run before any other settings are read so the new keys are populated first.
8401+
await migrateSettingsIfNeeded((m) => (tokenTracker as any).log(m));
8402+
83418403
// Wire up backend facade and commands so the diagnostics webview can launch the
83428404
// configuration wizard. Uses tokenTracker logging and helpers via casting to any.
83438405
try {

vscode-extension/src/sessionDiscovery.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ export class SessionDiscovery {
246246

247247
// Screenshot/demo mode: if a sample data directory is configured, use it exclusively
248248
const sampleDir = this.deps.sampleDataDirectoryOverride?.()
249-
?? vscode.workspace.getConfiguration('copilotTokenTracker').get<string>('sampleDataDirectory');
249+
?? vscode.workspace.getConfiguration('aiEngineeringFluency').get<string>('sampleDataDirectory');
250250
if (sampleDir && sampleDir.trim().length > 0) {
251251
const resolvedSampleDir = sampleDir.trim();
252252
try {

0 commit comments

Comments
 (0)