Implement --transient CLI option for stateless VS Code sessions (#254223)

This commit is contained in:
Copilot
2025-07-06 15:47:20 +02:00
committed by GitHub
parent 698b638444
commit 9b592e0c0a
3 changed files with 17 additions and 0 deletions
+15
View File
@@ -242,6 +242,21 @@ export async function main(argv: string[]): Promise<any> {
});
}
// Handle --transient option
if (args['transient']) {
const tempParentDir = randomPath(tmpdir(), 'vscode');
const tempUserDataDir = join(tempParentDir, 'data');
const tempExtensionsDir = join(tempParentDir, 'extensions');
addArg(argv, '--user-data-dir', tempUserDataDir);
addArg(argv, '--extensions-dir', tempExtensionsDir);
addArg(argv, '--disable-updates');
if (args.verbose) {
console.log(`Warning: state is temporarily stored in: "${tempParentDir}"`);
}
}
const hasReadStdinArg = args._.some(arg => arg === '-') || args.chat?._.some(arg => arg === '-');
if (hasReadStdinArg) {
// remove the "-" argument when we read from stdin
@@ -107,6 +107,7 @@ export interface NativeParsedArgs {
'install-source'?: string;
'add-mcp'?: string[];
'disable-updates'?: boolean;
'transient'?: boolean;
'use-inmemory-secretstorage'?: boolean;
'password-store'?: string;
'disable-workspace-trust'?: boolean;
+1
View File
@@ -168,6 +168,7 @@ export const OPTIONS: OptionDescriptions<Required<NativeParsedArgs>> = {
'skip-welcome': { type: 'boolean' },
'disable-telemetry': { type: 'boolean' },
'disable-updates': { type: 'boolean' },
'transient': { type: 'boolean' },
'use-inmemory-secretstorage': { type: 'boolean', deprecates: ['disable-keytar'] },
'password-store': { type: 'string' },
'disable-workspace-trust': { type: 'boolean' },