-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathindex.ts
More file actions
74 lines (69 loc) · 2.88 KB
/
index.ts
File metadata and controls
74 lines (69 loc) · 2.88 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
import * as vscode from 'vscode';
import { registerProxyCommands } from './proxy';
import { registerRecordingCommands } from './recording';
import { registerConfigCommands } from './config';
import { registerInstallCommands } from './install';
import { registerJwtCommands } from './jwt';
import { registerDiscoveryCommands } from './discovery';
import { registerDocCommands } from './docs';
import { Commands } from '../constants';
import { addExtensionToRecommendations } from '../utils';
import { registerUpgradeConfigCommands } from './upgrade-config';
/**
* Register all commands for the extension.
*
* Commands are organized into logical groups:
* - proxy: start, stop, restart
* - recording: start/stop recording, raise mock
* - config: open, create new
* - install: install, upgrade
* - jwt: create JWT tokens
* - discovery: discover URLs to watch
* - docs: open plugin documentation, add language model config
* - workspace: add to recommendations
*/
export function registerCommands(
context: vscode.ExtensionContext,
configuration: vscode.WorkspaceConfiguration
): void {
registerProxyCommands(context, configuration);
registerRecordingCommands(context);
registerConfigCommands(context, configuration);
registerInstallCommands(context, configuration);
registerJwtCommands(context, configuration);
registerDiscoveryCommands(context, configuration);
registerDocCommands(context);
context.subscriptions.push(
vscode.commands.registerCommand(Commands.addToRecommendations, async () => {
const success = await addExtensionToRecommendations();
if (success) {
vscode.window.showInformationMessage('Dev Proxy Toolkit added to workspace recommendations.');
} else {
vscode.window.showErrorMessage('Failed to add extension to workspace recommendations. Ensure a workspace folder is open.');
}
})
);
context.subscriptions.push(
vscode.commands.registerCommand(Commands.resetState, async () => {
const keys = context.globalState.keys();
for (const key of keys) {
await context.globalState.update(key, undefined);
}
vscode.window.showInformationMessage('Dev Proxy Toolkit state has been reset. Reload the window to apply changes.', 'Reload').then(action => {
if (action === 'Reload') {
vscode.commands.executeCommand('workbench.action.reloadWindow');
}
});
})
);
registerUpgradeConfigCommands(context);
}
// Re-export individual modules for testing and direct access
export { registerProxyCommands } from './proxy';
export { registerRecordingCommands } from './recording';
export { registerConfigCommands } from './config';
export { registerInstallCommands } from './install';
export { registerJwtCommands } from './jwt';
export { registerDiscoveryCommands } from './discovery';
export { registerDocCommands } from './docs';
export { registerUpgradeConfigCommands } from './upgrade-config';