Explorar el Código

feat: add ZDOTDIR handling for zsh shell integration

Creates a temporary ZDOTDIR to handle zsh shell integration properly while preserving user's zsh configuration. This ensures VSCode shell integration works correctly with zsh without modifying the user's existing setup.

- Add terminalZdotdir setting (disabled by default)
- Create temporary directory with proper security (sticky bit)
- Add automatic cleanup on terminal close
- Add translations for all supported languages

User confirmed fixes:

Fixes: #2205
Fixes: #2129

Signed-off-by: Eric Wheeler <[email protected]>
Eric Wheeler hace 8 meses
padre
commit
4ef62c6a13
Se han modificado 31 ficheros con 315 adiciones y 0 borrados
  1. 5 0
      src/core/webview/ClineProvider.ts
  2. 7 0
      src/core/webview/webviewMessageHandler.ts
  3. 1 0
      src/exports/roo-code.d.ts
  4. 1 0
      src/exports/types.ts
  5. 25 0
      src/integrations/terminal/Terminal.ts
  6. 174 0
      src/integrations/terminal/TerminalRegistry.ts
  7. 5 0
      src/integrations/terminal/__tests__/TerminalProcessExec.bash.test.ts
  8. 5 0
      src/integrations/terminal/__tests__/TerminalProcessExec.cmd.test.ts
  9. 5 0
      src/integrations/terminal/__tests__/TerminalProcessExec.pwsh.test.ts
  10. 1 0
      src/integrations/terminal/__tests__/TerminalRegistry.test.ts
  11. 2 0
      src/schemas/index.ts
  12. 1 0
      src/shared/ExtensionMessage.ts
  13. 1 0
      src/shared/WebviewMessage.ts
  14. 3 0
      webview-ui/src/components/settings/SettingsView.tsx
  15. 15 0
      webview-ui/src/components/settings/TerminalSettings.tsx
  16. 4 0
      webview-ui/src/context/ExtensionStateContext.tsx
  17. 4 0
      webview-ui/src/i18n/locales/ca/settings.json
  18. 4 0
      webview-ui/src/i18n/locales/de/settings.json
  19. 4 0
      webview-ui/src/i18n/locales/en/settings.json
  20. 4 0
      webview-ui/src/i18n/locales/es/settings.json
  21. 4 0
      webview-ui/src/i18n/locales/fr/settings.json
  22. 4 0
      webview-ui/src/i18n/locales/hi/settings.json
  23. 4 0
      webview-ui/src/i18n/locales/it/settings.json
  24. 4 0
      webview-ui/src/i18n/locales/ja/settings.json
  25. 4 0
      webview-ui/src/i18n/locales/ko/settings.json
  26. 4 0
      webview-ui/src/i18n/locales/pl/settings.json
  27. 4 0
      webview-ui/src/i18n/locales/pt-BR/settings.json
  28. 4 0
      webview-ui/src/i18n/locales/tr/settings.json
  29. 4 0
      webview-ui/src/i18n/locales/vi/settings.json
  30. 4 0
      webview-ui/src/i18n/locales/zh-CN/settings.json
  31. 4 0
      webview-ui/src/i18n/locales/zh-TW/settings.json

+ 5 - 0
src/core/webview/ClineProvider.ts

@@ -360,6 +360,7 @@ export class ClineProvider extends EventEmitter<ClineProviderEvents> implements
 				terminalZshOhMy,
 				terminalZshOhMy,
 				terminalZshP10k,
 				terminalZshP10k,
 				terminalPowershellCounter,
 				terminalPowershellCounter,
+				terminalZdotdir,
 			}) => {
 			}) => {
 				setSoundEnabled(soundEnabled ?? false)
 				setSoundEnabled(soundEnabled ?? false)
 				Terminal.setShellIntegrationTimeout(
 				Terminal.setShellIntegrationTimeout(
@@ -370,6 +371,7 @@ export class ClineProvider extends EventEmitter<ClineProviderEvents> implements
 				Terminal.setTerminalZshOhMy(terminalZshOhMy ?? false)
 				Terminal.setTerminalZshOhMy(terminalZshOhMy ?? false)
 				Terminal.setTerminalZshP10k(terminalZshP10k ?? false)
 				Terminal.setTerminalZshP10k(terminalZshP10k ?? false)
 				Terminal.setPowershellCounter(terminalPowershellCounter ?? false)
 				Terminal.setPowershellCounter(terminalPowershellCounter ?? false)
+				Terminal.setTerminalZdotdir(terminalZdotdir ?? false)
 			},
 			},
 		)
 		)
 
 
@@ -1219,6 +1221,7 @@ export class ClineProvider extends EventEmitter<ClineProviderEvents> implements
 			terminalZshClearEolMark,
 			terminalZshClearEolMark,
 			terminalZshOhMy,
 			terminalZshOhMy,
 			terminalZshP10k,
 			terminalZshP10k,
+			terminalZdotdir,
 			fuzzyMatchThreshold,
 			fuzzyMatchThreshold,
 			mcpEnabled,
 			mcpEnabled,
 			enableMcpServerCreation,
 			enableMcpServerCreation,
@@ -1291,6 +1294,7 @@ export class ClineProvider extends EventEmitter<ClineProviderEvents> implements
 			terminalZshClearEolMark: terminalZshClearEolMark ?? true,
 			terminalZshClearEolMark: terminalZshClearEolMark ?? true,
 			terminalZshOhMy: terminalZshOhMy ?? false,
 			terminalZshOhMy: terminalZshOhMy ?? false,
 			terminalZshP10k: terminalZshP10k ?? false,
 			terminalZshP10k: terminalZshP10k ?? false,
+			terminalZdotdir: terminalZdotdir ?? false,
 			fuzzyMatchThreshold: fuzzyMatchThreshold ?? 1.0,
 			fuzzyMatchThreshold: fuzzyMatchThreshold ?? 1.0,
 			mcpEnabled: mcpEnabled ?? true,
 			mcpEnabled: mcpEnabled ?? true,
 			enableMcpServerCreation: enableMcpServerCreation ?? true,
 			enableMcpServerCreation: enableMcpServerCreation ?? true,
@@ -1382,6 +1386,7 @@ export class ClineProvider extends EventEmitter<ClineProviderEvents> implements
 			terminalZshClearEolMark: stateValues.terminalZshClearEolMark ?? true,
 			terminalZshClearEolMark: stateValues.terminalZshClearEolMark ?? true,
 			terminalZshOhMy: stateValues.terminalZshOhMy ?? false,
 			terminalZshOhMy: stateValues.terminalZshOhMy ?? false,
 			terminalZshP10k: stateValues.terminalZshP10k ?? false,
 			terminalZshP10k: stateValues.terminalZshP10k ?? false,
+			terminalZdotdir: stateValues.terminalZdotdir ?? false,
 			mode: stateValues.mode ?? defaultModeSlug,
 			mode: stateValues.mode ?? defaultModeSlug,
 			language: stateValues.language ?? formatLanguage(vscode.env.language),
 			language: stateValues.language ?? formatLanguage(vscode.env.language),
 			mcpEnabled: stateValues.mcpEnabled ?? true,
 			mcpEnabled: stateValues.mcpEnabled ?? true,

+ 7 - 0
src/core/webview/webviewMessageHandler.ts

@@ -771,6 +771,13 @@ export const webviewMessageHandler = async (provider: ClineProvider, message: We
 				Terminal.setTerminalZshP10k(message.bool)
 				Terminal.setTerminalZshP10k(message.bool)
 			}
 			}
 			break
 			break
+		case "terminalZdotdir":
+			await updateGlobalState("terminalZdotdir", message.bool)
+			await provider.postStateToWebview()
+			if (message.bool !== undefined) {
+				Terminal.setTerminalZdotdir(message.bool)
+			}
+			break
 		case "mode":
 		case "mode":
 			await provider.handleModeSwitch(message.text as Mode)
 			await provider.handleModeSwitch(message.text as Mode)
 			break
 			break

+ 1 - 0
src/exports/roo-code.d.ts

@@ -271,6 +271,7 @@ type GlobalSettings = {
 	terminalZshClearEolMark?: boolean | undefined
 	terminalZshClearEolMark?: boolean | undefined
 	terminalZshOhMy?: boolean | undefined
 	terminalZshOhMy?: boolean | undefined
 	terminalZshP10k?: boolean | undefined
 	terminalZshP10k?: boolean | undefined
+	terminalZdotdir?: boolean | undefined
 	rateLimitSeconds?: number | undefined
 	rateLimitSeconds?: number | undefined
 	diffEnabled?: boolean | undefined
 	diffEnabled?: boolean | undefined
 	fuzzyMatchThreshold?: number | undefined
 	fuzzyMatchThreshold?: number | undefined

+ 1 - 0
src/exports/types.ts

@@ -274,6 +274,7 @@ type GlobalSettings = {
 	terminalZshClearEolMark?: boolean | undefined
 	terminalZshClearEolMark?: boolean | undefined
 	terminalZshOhMy?: boolean | undefined
 	terminalZshOhMy?: boolean | undefined
 	terminalZshP10k?: boolean | undefined
 	terminalZshP10k?: boolean | undefined
+	terminalZdotdir?: boolean | undefined
 	rateLimitSeconds?: number | undefined
 	rateLimitSeconds?: number | undefined
 	diffEnabled?: boolean | undefined
 	diffEnabled?: boolean | undefined
 	fuzzyMatchThreshold?: number | undefined
 	fuzzyMatchThreshold?: number | undefined

+ 25 - 0
src/integrations/terminal/Terminal.ts

@@ -2,6 +2,8 @@ import * as vscode from "vscode"
 import pWaitFor from "p-wait-for"
 import pWaitFor from "p-wait-for"
 import { ExitCodeDetails, mergePromise, TerminalProcess, TerminalProcessResultPromise } from "./TerminalProcess"
 import { ExitCodeDetails, mergePromise, TerminalProcess, TerminalProcessResultPromise } from "./TerminalProcess"
 import { truncateOutput, applyRunLengthEncoding } from "../misc/extract-text"
 import { truncateOutput, applyRunLengthEncoding } from "../misc/extract-text"
+// Import TerminalRegistry here to avoid circular dependencies
+const { TerminalRegistry } = require("./TerminalRegistry")
 
 
 export const TERMINAL_SHELL_INTEGRATION_TIMEOUT = 5000
 export const TERMINAL_SHELL_INTEGRATION_TIMEOUT = 5000
 
 
@@ -12,6 +14,7 @@ export class Terminal {
 	private static terminalZshClearEolMark: boolean = true
 	private static terminalZshClearEolMark: boolean = true
 	private static terminalZshOhMy: boolean = false
 	private static terminalZshOhMy: boolean = false
 	private static terminalZshP10k: boolean = false
 	private static terminalZshP10k: boolean = false
+	private static terminalZdotdir: boolean = false
 
 
 	public terminal: vscode.Terminal
 	public terminal: vscode.Terminal
 	public busy: boolean
 	public busy: boolean
@@ -185,10 +188,16 @@ export class Terminal {
 			// Wait for shell integration before executing the command
 			// Wait for shell integration before executing the command
 			pWaitFor(() => this.terminal.shellIntegration !== undefined, { timeout: Terminal.shellIntegrationTimeout })
 			pWaitFor(() => this.terminal.shellIntegration !== undefined, { timeout: Terminal.shellIntegrationTimeout })
 				.then(() => {
 				.then(() => {
+					// Clean up temporary directory if shell integration is available, zsh did its job:
+					TerminalRegistry.zshCleanupTmpDir(this.id)
+
+					// Run the command in the terminal
 					process.run(command)
 					process.run(command)
 				})
 				})
 				.catch(() => {
 				.catch(() => {
 					console.log(`[Terminal ${this.id}] Shell integration not available. Command execution aborted.`)
 					console.log(`[Terminal ${this.id}] Shell integration not available. Command execution aborted.`)
+					// Clean up temporary directory if shell integration is not available
+					TerminalRegistry.zshCleanupTmpDir(this.id)
 					process.emit(
 					process.emit(
 						"no_shell_integration",
 						"no_shell_integration",
 						`Shell integration initialization sequence '\\x1b]633;A' was not received within ${Terminal.shellIntegrationTimeout / 1000}s. Shell integration has been disabled for this terminal instance. Increase the timeout in the settings if necessary.`,
 						`Shell integration initialization sequence '\\x1b]633;A' was not received within ${Terminal.shellIntegrationTimeout / 1000}s. Shell integration has been disabled for this terminal instance. Increase the timeout in the settings if necessary.`,
@@ -348,4 +357,20 @@ export class Terminal {
 	public static compressTerminalOutput(input: string, lineLimit: number): string {
 	public static compressTerminalOutput(input: string, lineLimit: number): string {
 		return truncateOutput(applyRunLengthEncoding(input), lineLimit)
 		return truncateOutput(applyRunLengthEncoding(input), lineLimit)
 	}
 	}
+
+	/**
+	 * Sets whether to enable ZDOTDIR handling for zsh
+	 * @param enabled Whether to enable ZDOTDIR handling
+	 */
+	public static setTerminalZdotdir(enabled: boolean): void {
+		Terminal.terminalZdotdir = enabled
+	}
+
+	/**
+	 * Gets whether ZDOTDIR handling is enabled
+	 * @returns Whether ZDOTDIR handling is enabled
+	 */
+	public static getTerminalZdotdir(): boolean {
+		return Terminal.terminalZdotdir
+	}
 }
 }

+ 174 - 0
src/integrations/terminal/TerminalRegistry.ts

@@ -1,4 +1,5 @@
 import * as vscode from "vscode"
 import * as vscode from "vscode"
+import * as path from "path"
 import { arePathsEqual } from "../../utils/path"
 import { arePathsEqual } from "../../utils/path"
 import { Terminal } from "./Terminal"
 import { Terminal } from "./Terminal"
 import { TerminalProcess } from "./TerminalProcess"
 import { TerminalProcess } from "./TerminalProcess"
@@ -9,6 +10,7 @@ export class TerminalRegistry {
 	private static terminals: Terminal[] = []
 	private static terminals: Terminal[] = []
 	private static nextTerminalId = 1
 	private static nextTerminalId = 1
 	private static disposables: vscode.Disposable[] = []
 	private static disposables: vscode.Disposable[] = []
+	private static terminalTmpDirs: Map<number, string> = new Map()
 	private static isInitialized = false
 	private static isInitialized = false
 
 
 	static initialize() {
 	static initialize() {
@@ -17,6 +19,18 @@ export class TerminalRegistry {
 		}
 		}
 		this.isInitialized = true
 		this.isInitialized = true
 
 
+		// Register handler for terminal close events to clean up temporary directories
+		const closeDisposable = vscode.window.onDidCloseTerminal((terminal) => {
+			const terminalInfo = this.getTerminalByVSCETerminal(terminal)
+			if (terminalInfo) {
+				// Clean up temporary directory if it exists
+				if (this.terminalTmpDirs.has(terminalInfo.id)) {
+					this.zshCleanupTmpDir(terminalInfo.id)
+				}
+			}
+		})
+		this.disposables.push(closeDisposable)
+
 		try {
 		try {
 			// onDidStartTerminalShellExecution
 			// onDidStartTerminalShellExecution
 			const startDisposable = vscode.window.onDidStartTerminalShellExecution?.(
 			const startDisposable = vscode.window.onDidStartTerminalShellExecution?.(
@@ -141,6 +155,11 @@ export class TerminalRegistry {
 			env.PROMPT_EOL_MARK = ""
 			env.PROMPT_EOL_MARK = ""
 		}
 		}
 
 
+		// Handle ZDOTDIR for zsh if enabled
+		if (Terminal.getTerminalZdotdir()) {
+			env.ZDOTDIR = this.zshInitTmpDir(env)
+		}
+
 		const terminal = vscode.window.createTerminal({
 		const terminal = vscode.window.createTerminal({
 			cwd,
 			cwd,
 			name: "Roo Code",
 			name: "Roo Code",
@@ -151,6 +170,13 @@ export class TerminalRegistry {
 		const cwdString = cwd.toString()
 		const cwdString = cwd.toString()
 		const newTerminal = new Terminal(this.nextTerminalId++, terminal, cwdString)
 		const newTerminal = new Terminal(this.nextTerminalId++, terminal, cwdString)
 
 
+		if (Terminal.getTerminalZdotdir()) {
+			this.terminalTmpDirs.set(newTerminal.id, env.ZDOTDIR)
+			console.info(
+				`[TerminalRegistry] Stored temporary directory path for terminal ${newTerminal.id}: ${env.ZDOTDIR}`,
+			)
+		}
+
 		this.terminals.push(newTerminal)
 		this.terminals.push(newTerminal)
 		return newTerminal
 		return newTerminal
 	}
 	}
@@ -191,6 +217,8 @@ export class TerminalRegistry {
 	}
 	}
 
 
 	static removeTerminal(id: number) {
 	static removeTerminal(id: number) {
+		this.zshCleanupTmpDir(id)
+
 		this.terminals = this.terminals.filter((t) => t.id !== id)
 		this.terminals = this.terminals.filter((t) => t.id !== id)
 	}
 	}
 
 
@@ -279,10 +307,156 @@ export class TerminalRegistry {
 	}
 	}
 
 
 	static cleanup() {
 	static cleanup() {
+		// Clean up all temporary directories
+		this.terminalTmpDirs.forEach((_, terminalId) => {
+			this.zshCleanupTmpDir(terminalId)
+		})
+		this.terminalTmpDirs.clear()
+
 		this.disposables.forEach((disposable) => disposable.dispose())
 		this.disposables.forEach((disposable) => disposable.dispose())
 		this.disposables = []
 		this.disposables = []
 	}
 	}
 
 
+	/**
+	 * Gets the path to the shell integration script for a given shell type
+	 * @param shell The shell type
+	 * @returns The path to the shell integration script
+	 */
+	private static getShellIntegrationPath(shell: "bash" | "pwsh" | "zsh" | "fish"): string {
+		let filename: string
+
+		switch (shell) {
+			case "bash":
+				filename = "shellIntegration-bash.sh"
+				break
+			case "pwsh":
+				filename = "shellIntegration.ps1"
+				break
+			case "zsh":
+				filename = "shellIntegration-rc.zsh"
+				break
+			case "fish":
+				filename = "shellIntegration.fish"
+				break
+			default:
+				throw new Error(`Invalid shell type: ${shell}`)
+		}
+
+		// This is the same path used by the CLI command
+		return path.join(
+			vscode.env.appRoot,
+			"out",
+			"vs",
+			"workbench",
+			"contrib",
+			"terminal",
+			"common",
+			"scripts",
+			filename,
+		)
+	}
+
+	/**
+	 * Initialize a temporary directory for ZDOTDIR
+	 * @param env The environment variables object to modify
+	 * @returns The path to the temporary directory
+	 */
+	private static zshInitTmpDir(env: Record<string, string>): string {
+		// Create a temporary directory with the sticky bit set for security
+		const os = require("os")
+		const path = require("path")
+		const tmpDir = path.join(os.tmpdir(), `roo-zdotdir-${Math.random().toString(36).substring(2, 15)}`)
+		console.info(`[TerminalRegistry] Creating temporary directory for ZDOTDIR: ${tmpDir}`)
+
+		// Save original ZDOTDIR as ROO_ZDOTDIR
+		if (process.env.ZDOTDIR) {
+			env.ROO_ZDOTDIR = process.env.ZDOTDIR
+		}
+
+		// Create the temporary directory
+		vscode.workspace.fs
+			.createDirectory(vscode.Uri.file(tmpDir))
+			.then(() => {
+				console.info(`[TerminalRegistry] Created temporary directory for ZDOTDIR at ${tmpDir}`)
+
+				// Create .zshrc in the temporary directory
+				const zshrcPath = `${tmpDir}/.zshrc`
+
+				// Get the path to the shell integration script
+				const shellIntegrationPath = this.getShellIntegrationPath("zsh")
+
+				const zshrcContent = `
+source "${shellIntegrationPath}"
+ZDOTDIR=\${ROO_ZDOTDIR:-$HOME}
+unset ROO_ZDOTDIR
+[ -f "$ZDOTDIR/.zshenv" ] && source "$ZDOTDIR/.zshenv"
+[ -f "$ZDOTDIR/.zprofile" ] && source "$ZDOTDIR/.zprofile"
+[ -f "$ZDOTDIR/.zshrc" ] && source "$ZDOTDIR/.zshrc"
+[ -f "$ZDOTDIR/.zlogin" ] && source "$ZDOTDIR/.zlogin"
+[ "$ZDOTDIR" = "$HOME" ] && unset ZDOTDIR
+`
+				console.info(`[TerminalRegistry] Creating .zshrc file at ${zshrcPath} with content:\n${zshrcContent}`)
+				vscode.workspace.fs.writeFile(vscode.Uri.file(zshrcPath), Buffer.from(zshrcContent)).then(
+					// Success handler
+					() => {
+						console.info(`[TerminalRegistry] Successfully created .zshrc file at ${zshrcPath}`)
+					},
+					// Error handler
+					(error: Error) => {
+						console.error(`[TerminalRegistry] Error creating .zshrc file at ${zshrcPath}: ${error}`)
+					},
+				)
+			})
+			.then(undefined, (error: Error) => {
+				console.error(`[TerminalRegistry] Error creating temporary directory at ${tmpDir}: ${error}`)
+			})
+
+		return tmpDir
+	}
+
+	/**
+	 * Clean up a temporary directory used for ZDOTDIR
+	 */
+	private static zshCleanupTmpDir(terminalId: number): boolean {
+		const tmpDir = this.terminalTmpDirs.get(terminalId)
+		if (!tmpDir) {
+			return false
+		}
+
+		const logPrefix = `[TerminalRegistry] Cleaning up temporary directory for terminal ${terminalId}`
+		console.info(`${logPrefix}: ${tmpDir}`)
+
+		try {
+			// Use fs to remove the directory and its contents
+			const fs = require("fs")
+			const path = require("path")
+
+			// Remove .zshrc file
+			const zshrcPath = path.join(tmpDir, ".zshrc")
+			if (fs.existsSync(zshrcPath)) {
+				console.info(`${logPrefix}: Removing .zshrc file at ${zshrcPath}`)
+				fs.unlinkSync(zshrcPath)
+			}
+
+			// Remove the directory
+			if (fs.existsSync(tmpDir)) {
+				console.info(`${logPrefix}: Removing directory at ${tmpDir}`)
+				fs.rmdirSync(tmpDir)
+			}
+
+			// Remove it from the map
+			this.terminalTmpDirs.delete(terminalId)
+			console.info(`${logPrefix}: Removed terminal ${terminalId} from temporary directory map`)
+
+			return true
+		} catch (error: unknown) {
+			console.error(
+				`[TerminalRegistry] Error cleaning up temporary directory ${tmpDir}: ${error instanceof Error ? error.message : String(error)}`,
+			)
+			return false
+		}
+	}
+
 	/**
 	/**
 	 * Releases all terminals associated with a task
 	 * Releases all terminals associated with a task
 	 * @param taskId The task ID
 	 * @param taskId The task ID

+ 5 - 0
src/integrations/terminal/__tests__/TerminalProcessExec.bash.test.ts

@@ -11,6 +11,7 @@ jest.mock("vscode", () => {
 	const eventHandlers = {
 	const eventHandlers = {
 		startTerminalShellExecution: null,
 		startTerminalShellExecution: null,
 		endTerminalShellExecution: null,
 		endTerminalShellExecution: null,
+		closeTerminal: null,
 	}
 	}
 
 
 	return {
 	return {
@@ -29,6 +30,10 @@ jest.mock("vscode", () => {
 				eventHandlers.endTerminalShellExecution = handler
 				eventHandlers.endTerminalShellExecution = handler
 				return { dispose: jest.fn() }
 				return { dispose: jest.fn() }
 			}),
 			}),
+			onDidCloseTerminal: jest.fn().mockImplementation((handler) => {
+				eventHandlers.closeTerminal = handler
+				return { dispose: jest.fn() }
+			}),
 		},
 		},
 		ThemeIcon: class ThemeIcon {
 		ThemeIcon: class ThemeIcon {
 			constructor(id: string) {
 			constructor(id: string) {

+ 5 - 0
src/integrations/terminal/__tests__/TerminalProcessExec.cmd.test.ts

@@ -16,6 +16,7 @@ jest.mock("vscode", () => {
 	const eventHandlers = {
 	const eventHandlers = {
 		startTerminalShellExecution: null,
 		startTerminalShellExecution: null,
 		endTerminalShellExecution: null,
 		endTerminalShellExecution: null,
+		closeTerminal: null,
 	}
 	}
 
 
 	return {
 	return {
@@ -34,6 +35,10 @@ jest.mock("vscode", () => {
 				eventHandlers.endTerminalShellExecution = handler
 				eventHandlers.endTerminalShellExecution = handler
 				return { dispose: jest.fn() }
 				return { dispose: jest.fn() }
 			}),
 			}),
+			onDidCloseTerminal: jest.fn().mockImplementation((handler) => {
+				eventHandlers.closeTerminal = handler
+				return { dispose: jest.fn() }
+			}),
 		},
 		},
 		ThemeIcon: class ThemeIcon {
 		ThemeIcon: class ThemeIcon {
 			constructor(id: string) {
 			constructor(id: string) {

+ 5 - 0
src/integrations/terminal/__tests__/TerminalProcessExec.pwsh.test.ts

@@ -17,6 +17,7 @@ jest.mock("vscode", () => {
 	const eventHandlers = {
 	const eventHandlers = {
 		startTerminalShellExecution: null,
 		startTerminalShellExecution: null,
 		endTerminalShellExecution: null,
 		endTerminalShellExecution: null,
+		closeTerminal: null,
 	}
 	}
 
 
 	return {
 	return {
@@ -35,6 +36,10 @@ jest.mock("vscode", () => {
 				eventHandlers.endTerminalShellExecution = handler
 				eventHandlers.endTerminalShellExecution = handler
 				return { dispose: jest.fn() }
 				return { dispose: jest.fn() }
 			}),
 			}),
+			onDidCloseTerminal: jest.fn().mockImplementation((handler) => {
+				eventHandlers.closeTerminal = handler
+				return { dispose: jest.fn() }
+			}),
 		},
 		},
 		ThemeIcon: class ThemeIcon {
 		ThemeIcon: class ThemeIcon {
 			constructor(id: string) {
 			constructor(id: string) {

+ 1 - 0
src/integrations/terminal/__tests__/TerminalRegistry.test.ts

@@ -13,6 +13,7 @@ jest.mock("vscode", () => ({
 				exitStatus: undefined,
 				exitStatus: undefined,
 			}
 			}
 		},
 		},
+		onDidCloseTerminal: jest.fn().mockReturnValue({ dispose: jest.fn() }),
 	},
 	},
 	ThemeIcon: jest.fn(),
 	ThemeIcon: jest.fn(),
 }))
 }))

+ 2 - 0
src/schemas/index.ts

@@ -537,6 +537,7 @@ export const globalSettingsSchema = z.object({
 	terminalZshClearEolMark: z.boolean().optional(),
 	terminalZshClearEolMark: z.boolean().optional(),
 	terminalZshOhMy: z.boolean().optional(),
 	terminalZshOhMy: z.boolean().optional(),
 	terminalZshP10k: z.boolean().optional(),
 	terminalZshP10k: z.boolean().optional(),
+	terminalZdotdir: z.boolean().optional(),
 
 
 	rateLimitSeconds: z.number().optional(),
 	rateLimitSeconds: z.number().optional(),
 	diffEnabled: z.boolean().optional(),
 	diffEnabled: z.boolean().optional(),
@@ -612,6 +613,7 @@ const globalSettingsRecord: GlobalSettingsRecord = {
 	terminalZshClearEolMark: undefined,
 	terminalZshClearEolMark: undefined,
 	terminalZshOhMy: undefined,
 	terminalZshOhMy: undefined,
 	terminalZshP10k: undefined,
 	terminalZshP10k: undefined,
+	terminalZdotdir: undefined,
 
 
 	rateLimitSeconds: undefined,
 	rateLimitSeconds: undefined,
 	diffEnabled: undefined,
 	diffEnabled: undefined,

+ 1 - 0
src/shared/ExtensionMessage.ts

@@ -158,6 +158,7 @@ export type ExtensionState = Pick<
 	| "terminalZshClearEolMark"
 	| "terminalZshClearEolMark"
 	| "terminalZshOhMy"
 	| "terminalZshOhMy"
 	| "terminalZshP10k"
 	| "terminalZshP10k"
+	| "terminalZdotdir"
 	| "diffEnabled"
 	| "diffEnabled"
 	| "fuzzyMatchThreshold"
 	| "fuzzyMatchThreshold"
 	// | "experiments" // Optional in GlobalSettings, required here.
 	// | "experiments" // Optional in GlobalSettings, required here.

+ 1 - 0
src/shared/WebviewMessage.ts

@@ -87,6 +87,7 @@ export interface WebviewMessage {
 		| "terminalZshClearEolMark"
 		| "terminalZshClearEolMark"
 		| "terminalZshOhMy"
 		| "terminalZshOhMy"
 		| "terminalZshP10k"
 		| "terminalZshP10k"
+		| "terminalZdotdir"
 		| "mcpEnabled"
 		| "mcpEnabled"
 		| "enableMcpServerCreation"
 		| "enableMcpServerCreation"
 		| "searchCommits"
 		| "searchCommits"

+ 3 - 0
webview-ui/src/components/settings/SettingsView.tsx

@@ -134,6 +134,7 @@ const SettingsView = forwardRef<SettingsViewRef, SettingsViewProps>(({ onDone, t
 		terminalZshClearEolMark,
 		terminalZshClearEolMark,
 		terminalZshOhMy,
 		terminalZshOhMy,
 		terminalZshP10k,
 		terminalZshP10k,
+		terminalZdotdir,
 		writeDelayMs,
 		writeDelayMs,
 		showRooIgnoredFiles,
 		showRooIgnoredFiles,
 		remoteBrowserEnabled,
 		remoteBrowserEnabled,
@@ -247,6 +248,7 @@ const SettingsView = forwardRef<SettingsViewRef, SettingsViewProps>(({ onDone, t
 			vscode.postMessage({ type: "terminalZshClearEolMark", bool: terminalZshClearEolMark })
 			vscode.postMessage({ type: "terminalZshClearEolMark", bool: terminalZshClearEolMark })
 			vscode.postMessage({ type: "terminalZshOhMy", bool: terminalZshOhMy })
 			vscode.postMessage({ type: "terminalZshOhMy", bool: terminalZshOhMy })
 			vscode.postMessage({ type: "terminalZshP10k", bool: terminalZshP10k })
 			vscode.postMessage({ type: "terminalZshP10k", bool: terminalZshP10k })
+			vscode.postMessage({ type: "terminalZdotdir", bool: terminalZdotdir })
 			vscode.postMessage({ type: "mcpEnabled", bool: mcpEnabled })
 			vscode.postMessage({ type: "mcpEnabled", bool: mcpEnabled })
 			vscode.postMessage({ type: "alwaysApproveResubmit", bool: alwaysApproveResubmit })
 			vscode.postMessage({ type: "alwaysApproveResubmit", bool: alwaysApproveResubmit })
 			vscode.postMessage({ type: "requestDelaySeconds", value: requestDelaySeconds })
 			vscode.postMessage({ type: "requestDelaySeconds", value: requestDelaySeconds })
@@ -496,6 +498,7 @@ const SettingsView = forwardRef<SettingsViewRef, SettingsViewProps>(({ onDone, t
 						terminalZshClearEolMark={terminalZshClearEolMark}
 						terminalZshClearEolMark={terminalZshClearEolMark}
 						terminalZshOhMy={terminalZshOhMy}
 						terminalZshOhMy={terminalZshOhMy}
 						terminalZshP10k={terminalZshP10k}
 						terminalZshP10k={terminalZshP10k}
+						terminalZdotdir={terminalZdotdir}
 						setCachedStateField={setCachedStateField}
 						setCachedStateField={setCachedStateField}
 					/>
 					/>
 				</div>
 				</div>

+ 15 - 0
webview-ui/src/components/settings/TerminalSettings.tsx

@@ -18,6 +18,7 @@ type TerminalSettingsProps = HTMLAttributes<HTMLDivElement> & {
 	terminalZshClearEolMark?: boolean
 	terminalZshClearEolMark?: boolean
 	terminalZshOhMy?: boolean
 	terminalZshOhMy?: boolean
 	terminalZshP10k?: boolean
 	terminalZshP10k?: boolean
+	terminalZdotdir?: boolean
 	setCachedStateField: SetCachedStateField<
 	setCachedStateField: SetCachedStateField<
 		| "terminalOutputLineLimit"
 		| "terminalOutputLineLimit"
 		| "terminalShellIntegrationTimeout"
 		| "terminalShellIntegrationTimeout"
@@ -26,6 +27,7 @@ type TerminalSettingsProps = HTMLAttributes<HTMLDivElement> & {
 		| "terminalZshClearEolMark"
 		| "terminalZshClearEolMark"
 		| "terminalZshOhMy"
 		| "terminalZshOhMy"
 		| "terminalZshP10k"
 		| "terminalZshP10k"
+		| "terminalZdotdir"
 	>
 	>
 }
 }
 
 
@@ -37,6 +39,7 @@ export const TerminalSettings = ({
 	terminalZshClearEolMark,
 	terminalZshClearEolMark,
 	terminalZshOhMy,
 	terminalZshOhMy,
 	terminalZshP10k,
 	terminalZshP10k,
+	terminalZdotdir,
 	setCachedStateField,
 	setCachedStateField,
 	className,
 	className,
 	...props
 	...props
@@ -161,6 +164,18 @@ export const TerminalSettings = ({
 						{t("settings:terminal.zshP10k.description")}
 						{t("settings:terminal.zshP10k.description")}
 					</div>
 					</div>
 				</div>
 				</div>
+
+				<div>
+					<VSCodeCheckbox
+						checked={terminalZdotdir ?? false}
+						onChange={(e: any) => setCachedStateField("terminalZdotdir", e.target.checked)}
+						data-testid="terminal-zdotdir-checkbox">
+						<span className="font-medium">{t("settings:terminal.zdotdir.label")}</span>
+					</VSCodeCheckbox>
+					<div className="text-vscode-descriptionForeground text-sm mt-1">
+						{t("settings:terminal.zdotdir.description")}
+					</div>
+				</div>
 			</Section>
 			</Section>
 		</div>
 		</div>
 	)
 	)

+ 4 - 0
webview-ui/src/context/ExtensionStateContext.tsx

@@ -39,6 +39,8 @@ export interface ExtensionStateContextType extends ExtensionState {
 	setSoundVolume: (value: number) => void
 	setSoundVolume: (value: number) => void
 	terminalShellIntegrationTimeout?: number
 	terminalShellIntegrationTimeout?: number
 	setTerminalShellIntegrationTimeout: (value: number) => void
 	setTerminalShellIntegrationTimeout: (value: number) => void
+	terminalZdotdir?: boolean
+	setTerminalZdotdir: (value: boolean) => void
 	setTtsEnabled: (value: boolean) => void
 	setTtsEnabled: (value: boolean) => void
 	setTtsSpeed: (value: number) => void
 	setTtsSpeed: (value: number) => void
 	setDiffEnabled: (value: boolean) => void
 	setDiffEnabled: (value: boolean) => void
@@ -160,6 +162,7 @@ export const ExtensionStateContextProvider: React.FC<{ children: React.ReactNode
 		pinnedApiConfigs: {}, // Empty object for pinned API configs
 		pinnedApiConfigs: {}, // Empty object for pinned API configs
 		terminalZshOhMy: false, // Default Oh My Zsh integration setting
 		terminalZshOhMy: false, // Default Oh My Zsh integration setting
 		terminalZshP10k: false, // Default Powerlevel10k integration setting
 		terminalZshP10k: false, // Default Powerlevel10k integration setting
+		terminalZdotdir: false, // Default ZDOTDIR handling setting
 	})
 	})
 
 
 	const [didHydrateState, setDidHydrateState] = useState(false)
 	const [didHydrateState, setDidHydrateState] = useState(false)
@@ -289,6 +292,7 @@ export const ExtensionStateContextProvider: React.FC<{ children: React.ReactNode
 			setState((prevState) => ({ ...prevState, terminalOutputLineLimit: value })),
 			setState((prevState) => ({ ...prevState, terminalOutputLineLimit: value })),
 		setTerminalShellIntegrationTimeout: (value) =>
 		setTerminalShellIntegrationTimeout: (value) =>
 			setState((prevState) => ({ ...prevState, terminalShellIntegrationTimeout: value })),
 			setState((prevState) => ({ ...prevState, terminalShellIntegrationTimeout: value })),
+		setTerminalZdotdir: (value) => setState((prevState) => ({ ...prevState, terminalZdotdir: value })),
 		setMcpEnabled: (value) => setState((prevState) => ({ ...prevState, mcpEnabled: value })),
 		setMcpEnabled: (value) => setState((prevState) => ({ ...prevState, mcpEnabled: value })),
 		setEnableMcpServerCreation: (value) =>
 		setEnableMcpServerCreation: (value) =>
 			setState((prevState) => ({ ...prevState, enableMcpServerCreation: value })),
 			setState((prevState) => ({ ...prevState, enableMcpServerCreation: value })),

+ 4 - 0
webview-ui/src/i18n/locales/ca/settings.json

@@ -302,6 +302,10 @@
 			"label": "Temps d'espera d'integració de shell del terminal",
 			"label": "Temps d'espera d'integració de shell del terminal",
 			"description": "Temps màxim d'espera per a la inicialització de la integració de shell abans d'executar comandes. Per a usuaris amb temps d'inici de shell llargs, aquest valor pot necessitar ser augmentat si veieu errors \"Shell Integration Unavailable\" al terminal."
 			"description": "Temps màxim d'espera per a la inicialització de la integració de shell abans d'executar comandes. Per a usuaris amb temps d'inici de shell llargs, aquest valor pot necessitar ser augmentat si veieu errors \"Shell Integration Unavailable\" al terminal."
 		},
 		},
+		"zdotdir": {
+			"label": "Habilitar gestió de ZDOTDIR",
+			"description": "Quan està habilitat, crea un directori temporal per a ZDOTDIR per gestionar correctament la integració del shell zsh. Això assegura que la integració del shell de VSCode funcioni correctament amb zsh mentre es preserva la teva configuració de zsh. (experimental)"
+		},
 		"commandDelay": {
 		"commandDelay": {
 			"label": "Retard de comanda del terminal",
 			"label": "Retard de comanda del terminal",
 			"description": "Retard en mil·lisegons a afegir després de l'execució de la comanda. La configuració predeterminada de 0 desactiva completament el retard. Això pot ajudar a assegurar que la sortida de la comanda es capturi completament en terminals amb problemes de temporització. En la majoria de terminals s'implementa establint `PROMPT_COMMAND='sleep N'` i Powershell afegeix `start-sleep` al final de cada comanda. Originalment era una solució per al error VSCode#237208 i pot no ser necessari."
 			"description": "Retard en mil·lisegons a afegir després de l'execució de la comanda. La configuració predeterminada de 0 desactiva completament el retard. Això pot ajudar a assegurar que la sortida de la comanda es capturi completament en terminals amb problemes de temporització. En la majoria de terminals s'implementa establint `PROMPT_COMMAND='sleep N'` i Powershell afegeix `start-sleep` al final de cada comanda. Originalment era una solució per al error VSCode#237208 i pot no ser necessari."

+ 4 - 0
webview-ui/src/i18n/locales/de/settings.json

@@ -302,6 +302,10 @@
 			"label": "Terminal-Shell-Integrationszeit-Limit",
 			"label": "Terminal-Shell-Integrationszeit-Limit",
 			"description": "Maximale Wartezeit für die Shell-Integration, bevor Befehle ausgeführt werden. Für Benutzer mit langen Shell-Startzeiten musst du diesen Wert möglicherweise erhöhen, wenn du Fehler vom Typ \"Shell Integration Unavailable\" im Terminal siehst."
 			"description": "Maximale Wartezeit für die Shell-Integration, bevor Befehle ausgeführt werden. Für Benutzer mit langen Shell-Startzeiten musst du diesen Wert möglicherweise erhöhen, wenn du Fehler vom Typ \"Shell Integration Unavailable\" im Terminal siehst."
 		},
 		},
+		"zdotdir": {
+			"label": "ZDOTDIR-Behandlung aktivieren",
+			"description": "Erstellt bei Aktivierung ein temporäres Verzeichnis für ZDOTDIR, um die zsh-Shell-Integration korrekt zu handhaben. Dies stellt sicher, dass die VSCode-Shell-Integration mit zsh funktioniert und dabei deine zsh-Konfiguration erhalten bleibt. (experimentell)"
+		},
 		"commandDelay": {
 		"commandDelay": {
 			"label": "Terminal-Befehlsverzögerung",
 			"label": "Terminal-Befehlsverzögerung",
 			"description": "Verzögerung in Millisekunden, die nach der Befehlsausführung hinzugefügt wird. Die Standardeinstellung von 0 deaktiviert die Verzögerung vollständig. Dies kann dazu beitragen, dass die Befehlsausgabe in Terminals mit Timing-Problemen vollständig erfasst wird. In den meisten Terminals wird dies durch Setzen von `PROMPT_COMMAND='sleep N'` implementiert, und Powershell fügt `start-sleep` am Ende jedes Befehls hinzu. Ursprünglich war dies eine Lösung für VSCode-Bug#237208 und ist möglicherweise nicht mehr erforderlich."
 			"description": "Verzögerung in Millisekunden, die nach der Befehlsausführung hinzugefügt wird. Die Standardeinstellung von 0 deaktiviert die Verzögerung vollständig. Dies kann dazu beitragen, dass die Befehlsausgabe in Terminals mit Timing-Problemen vollständig erfasst wird. In den meisten Terminals wird dies durch Setzen von `PROMPT_COMMAND='sleep N'` implementiert, und Powershell fügt `start-sleep` am Ende jedes Befehls hinzu. Ursprünglich war dies eine Lösung für VSCode-Bug#237208 und ist möglicherweise nicht mehr erforderlich."

+ 4 - 0
webview-ui/src/i18n/locales/en/settings.json

@@ -321,6 +321,10 @@
 		"zshP10k": {
 		"zshP10k": {
 			"label": "Enable Powerlevel10k integration",
 			"label": "Enable Powerlevel10k integration",
 			"description": "When enabled, sets POWERLEVEL9K_TERM_SHELL_INTEGRATION=true to enable Powerlevel10k shell integration features. (experimental)"
 			"description": "When enabled, sets POWERLEVEL9K_TERM_SHELL_INTEGRATION=true to enable Powerlevel10k shell integration features. (experimental)"
+		},
+		"zdotdir": {
+			"label": "Enable ZDOTDIR handling",
+			"description": "When enabled, creates a temporary directory for ZDOTDIR to handle zsh shell integration properly. This ensures VSCode shell integration works correctly with zsh while preserving your zsh configuration. (experimental)"
 		}
 		}
 	},
 	},
 	"advanced": {
 	"advanced": {

+ 4 - 0
webview-ui/src/i18n/locales/es/settings.json

@@ -302,6 +302,10 @@
 			"label": "Tiempo de espera de integración del shell del terminal",
 			"label": "Tiempo de espera de integración del shell del terminal",
 			"description": "Tiempo máximo de espera para la inicialización de la integración del shell antes de ejecutar comandos. Para usuarios con tiempos de inicio de shell largos, este valor puede necesitar ser aumentado si ve errores \"Shell Integration Unavailable\" en el terminal."
 			"description": "Tiempo máximo de espera para la inicialización de la integración del shell antes de ejecutar comandos. Para usuarios con tiempos de inicio de shell largos, este valor puede necesitar ser aumentado si ve errores \"Shell Integration Unavailable\" en el terminal."
 		},
 		},
+		"zdotdir": {
+			"label": "Habilitar gestión de ZDOTDIR",
+			"description": "Cuando está habilitado, crea un directorio temporal para ZDOTDIR para manejar correctamente la integración del shell zsh. Esto asegura que la integración del shell de VSCode funcione correctamente con zsh mientras preserva tu configuración de zsh. (experimental)"
+		},
 		"commandDelay": {
 		"commandDelay": {
 			"label": "Retraso de comando del terminal",
 			"label": "Retraso de comando del terminal",
 			"description": "Retraso en milisegundos para añadir después de la ejecución del comando. La configuración predeterminada de 0 desactiva completamente el retraso. Esto puede ayudar a asegurar que la salida del comando se capture completamente en terminales con problemas de temporización. En la mayoría de terminales se implementa estableciendo `PROMPT_COMMAND='sleep N'` y Powershell añade `start-sleep` al final de cada comando. Originalmente era una solución para el error VSCode#237208 y puede no ser necesario."
 			"description": "Retraso en milisegundos para añadir después de la ejecución del comando. La configuración predeterminada de 0 desactiva completamente el retraso. Esto puede ayudar a asegurar que la salida del comando se capture completamente en terminales con problemas de temporización. En la mayoría de terminales se implementa estableciendo `PROMPT_COMMAND='sleep N'` y Powershell añade `start-sleep` al final de cada comando. Originalmente era una solución para el error VSCode#237208 y puede no ser necesario."

+ 4 - 0
webview-ui/src/i18n/locales/fr/settings.json

@@ -302,6 +302,10 @@
 			"label": "Délai d'intégration du shell du terminal",
 			"label": "Délai d'intégration du shell du terminal",
 			"description": "Temps maximum d'attente pour l'initialisation de l'intégration du shell avant d'exécuter des commandes. Pour les utilisateurs avec des temps de démarrage de shell longs, cette valeur peut nécessiter d'être augmentée si vous voyez des erreurs \"Shell Integration Unavailable\" dans le terminal."
 			"description": "Temps maximum d'attente pour l'initialisation de l'intégration du shell avant d'exécuter des commandes. Pour les utilisateurs avec des temps de démarrage de shell longs, cette valeur peut nécessiter d'être augmentée si vous voyez des erreurs \"Shell Integration Unavailable\" dans le terminal."
 		},
 		},
+		"zdotdir": {
+			"label": "Activer la gestion ZDOTDIR",
+			"description": "Lorsque activé, crée un répertoire temporaire pour ZDOTDIR afin de gérer correctement l'intégration du shell zsh. Cela garantit le bon fonctionnement de l'intégration du shell VSCode avec zsh tout en préservant votre configuration zsh. (expérimental)"
+		},
 		"commandDelay": {
 		"commandDelay": {
 			"label": "Délai de commande du terminal",
 			"label": "Délai de commande du terminal",
 			"description": "Délai en millisecondes à ajouter après l'exécution de la commande. Le paramètre par défaut de 0 désactive complètement le délai. Cela peut aider à garantir que la sortie de la commande est entièrement capturée dans les terminaux avec des problèmes de synchronisation. Dans la plupart des terminaux, cela est implémenté en définissant `PROMPT_COMMAND='sleep N'` et Powershell ajoute `start-sleep` à la fin de chaque commande. À l'origine, c'était une solution pour le bug VSCode#237208 et peut ne pas être nécessaire."
 			"description": "Délai en millisecondes à ajouter après l'exécution de la commande. Le paramètre par défaut de 0 désactive complètement le délai. Cela peut aider à garantir que la sortie de la commande est entièrement capturée dans les terminaux avec des problèmes de synchronisation. Dans la plupart des terminaux, cela est implémenté en définissant `PROMPT_COMMAND='sleep N'` et Powershell ajoute `start-sleep` à la fin de chaque commande. À l'origine, c'était une solution pour le bug VSCode#237208 et peut ne pas être nécessaire."

+ 4 - 0
webview-ui/src/i18n/locales/hi/settings.json

@@ -302,6 +302,10 @@
 			"label": "टर्मिनल शेल एकीकरण टाइमआउट",
 			"label": "टर्मिनल शेल एकीकरण टाइमआउट",
 			"description": "कमांड निष्पादित करने से पहले शेल एकीकरण के आरंभ होने के लिए प्रतीक्षा का अधिकतम समय। लंबे शेल स्टार्टअप समय वाले उपयोगकर्ताओं के लिए, यदि आप टर्मिनल में \"Shell Integration Unavailable\" त्रुटियाँ देखते हैं तो इस मान को बढ़ाने की आवश्यकता हो सकती है।"
 			"description": "कमांड निष्पादित करने से पहले शेल एकीकरण के आरंभ होने के लिए प्रतीक्षा का अधिकतम समय। लंबे शेल स्टार्टअप समय वाले उपयोगकर्ताओं के लिए, यदि आप टर्मिनल में \"Shell Integration Unavailable\" त्रुटियाँ देखते हैं तो इस मान को बढ़ाने की आवश्यकता हो सकती है।"
 		},
 		},
+		"zdotdir": {
+			"label": "ZDOTDIR प्रबंधन सक्षम करें",
+			"description": "सक्षम होने पर, zsh शेल एकीकरण को सही ढंग से संभालने के लिए ZDOTDIR के लिए एक अस्थायी डायरेक्टरी बनाता है। यह आपके zsh कॉन्फ़िगरेशन को बनाए रखते हुए VSCode शेल एकीकरण को zsh के साथ सही ढंग से काम करने की सुनिश्चितता करता है। (प्रयोगात्मक)"
+		},
 		"commandDelay": {
 		"commandDelay": {
 			"label": "टर्मिनल कमांड विलंब",
 			"label": "टर्मिनल कमांड विलंब",
 			"description": "कमांड निष्पादन के बाद जोड़ने के लिए मिलीसेकंड में विलंब। 0 का डिफ़ॉल्ट सेटिंग विलंब को पूरी तरह से अक्षम कर देता है। यह टाइमिंग समस्याओं वाले टर्मिनलों में कमांड आउटपुट को पूरी तरह से कैप्चर करने में मदद कर सकता है। अधिकांश टर्मिनलों में यह `PROMPT_COMMAND='sleep N'` सेट करके कार्यान्वित किया जाता है और Powershell प्रत्येक कमांड के अंत में `start-sleep` जोड़ता है। मूल रूप से यह VSCode बग#237208 के लिए एक समाधान था और इसकी आवश्यकता नहीं हो सकती है।"
 			"description": "कमांड निष्पादन के बाद जोड़ने के लिए मिलीसेकंड में विलंब। 0 का डिफ़ॉल्ट सेटिंग विलंब को पूरी तरह से अक्षम कर देता है। यह टाइमिंग समस्याओं वाले टर्मिनलों में कमांड आउटपुट को पूरी तरह से कैप्चर करने में मदद कर सकता है। अधिकांश टर्मिनलों में यह `PROMPT_COMMAND='sleep N'` सेट करके कार्यान्वित किया जाता है और Powershell प्रत्येक कमांड के अंत में `start-sleep` जोड़ता है। मूल रूप से यह VSCode बग#237208 के लिए एक समाधान था और इसकी आवश्यकता नहीं हो सकती है।"

+ 4 - 0
webview-ui/src/i18n/locales/it/settings.json

@@ -302,6 +302,10 @@
 			"label": "Timeout integrazione shell del terminale",
 			"label": "Timeout integrazione shell del terminale",
 			"description": "Tempo massimo di attesa per l'inizializzazione dell'integrazione della shell prima di eseguire i comandi. Per gli utenti con tempi di avvio della shell lunghi, questo valore potrebbe dover essere aumentato se si vedono errori \"Shell Integration Unavailable\" nel terminale."
 			"description": "Tempo massimo di attesa per l'inizializzazione dell'integrazione della shell prima di eseguire i comandi. Per gli utenti con tempi di avvio della shell lunghi, questo valore potrebbe dover essere aumentato se si vedono errori \"Shell Integration Unavailable\" nel terminale."
 		},
 		},
+		"zdotdir": {
+			"label": "Abilita gestione ZDOTDIR",
+			"description": "Quando abilitato, crea una directory temporanea per ZDOTDIR per gestire correttamente l'integrazione della shell zsh. Questo assicura che l'integrazione della shell VSCode funzioni correttamente con zsh mantenendo la tua configurazione zsh. (sperimentale)"
+		},
 		"commandDelay": {
 		"commandDelay": {
 			"label": "Ritardo comando terminale",
 			"label": "Ritardo comando terminale",
 			"description": "Ritardo in millisecondi da aggiungere dopo l'esecuzione del comando. L'impostazione predefinita di 0 disabilita completamente il ritardo. Questo può aiutare a garantire che l'output del comando sia catturato completamente nei terminali con problemi di temporizzazione. Nella maggior parte dei terminali viene implementato impostando `PROMPT_COMMAND='sleep N'` e Powershell aggiunge `start-sleep` alla fine di ogni comando. In origine era una soluzione per il bug VSCode#237208 e potrebbe non essere necessario."
 			"description": "Ritardo in millisecondi da aggiungere dopo l'esecuzione del comando. L'impostazione predefinita di 0 disabilita completamente il ritardo. Questo può aiutare a garantire che l'output del comando sia catturato completamente nei terminali con problemi di temporizzazione. Nella maggior parte dei terminali viene implementato impostando `PROMPT_COMMAND='sleep N'` e Powershell aggiunge `start-sleep` alla fine di ogni comando. In origine era una soluzione per il bug VSCode#237208 e potrebbe non essere necessario."

+ 4 - 0
webview-ui/src/i18n/locales/ja/settings.json

@@ -302,6 +302,10 @@
 			"label": "ターミナルシェル統合タイムアウト",
 			"label": "ターミナルシェル統合タイムアウト",
 			"description": "コマンドを実行する前にシェル統合の初期化を待つ最大時間。シェルの起動時間が長いユーザーの場合、ターミナルで「Shell Integration Unavailable」エラーが表示される場合は、この値を増やす必要があるかもしれません。"
 			"description": "コマンドを実行する前にシェル統合の初期化を待つ最大時間。シェルの起動時間が長いユーザーの場合、ターミナルで「Shell Integration Unavailable」エラーが表示される場合は、この値を増やす必要があるかもしれません。"
 		},
 		},
+		"zdotdir": {
+			"label": "ZDOTDIR 処理を有効化",
+			"description": "有効にすると、zsh シェル統合を適切に処理するために ZDOTDIR 用の一時ディレクトリを作成します。これにより、zsh の設定を保持しながら VSCode のシェル統合が正しく機能します。(実験的)"
+		},
 		"commandDelay": {
 		"commandDelay": {
 			"label": "ターミナルコマンド遅延",
 			"label": "ターミナルコマンド遅延",
 			"description": "コマンド実行後に追加する遅延時間(ミリ秒)。デフォルト設定の0は遅延を完全に無効にします。これはタイミングの問題があるターミナルでコマンド出力を完全にキャプチャするのに役立ちます。ほとんどのターミナルでは`PROMPT_COMMAND='sleep N'`を設定することで実装され、PowerShellは各コマンドの最後に`start-sleep`を追加します。元々はVSCodeバグ#237208の回避策で、必要ない場合があります。"
 			"description": "コマンド実行後に追加する遅延時間(ミリ秒)。デフォルト設定の0は遅延を完全に無効にします。これはタイミングの問題があるターミナルでコマンド出力を完全にキャプチャするのに役立ちます。ほとんどのターミナルでは`PROMPT_COMMAND='sleep N'`を設定することで実装され、PowerShellは各コマンドの最後に`start-sleep`を追加します。元々はVSCodeバグ#237208の回避策で、必要ない場合があります。"

+ 4 - 0
webview-ui/src/i18n/locales/ko/settings.json

@@ -302,6 +302,10 @@
 			"label": "터미널 쉘 통합 타임아웃",
 			"label": "터미널 쉘 통합 타임아웃",
 			"description": "명령을 실행하기 전에 쉘 통합이 초기화될 때까지 기다리는 최대 시간. 쉘 시작 시간이 긴 사용자의 경우, 터미널에서 \"Shell Integration Unavailable\" 오류가 표시되면 이 값을 늘려야 할 수 있습니다."
 			"description": "명령을 실행하기 전에 쉘 통합이 초기화될 때까지 기다리는 최대 시간. 쉘 시작 시간이 긴 사용자의 경우, 터미널에서 \"Shell Integration Unavailable\" 오류가 표시되면 이 값을 늘려야 할 수 있습니다."
 		},
 		},
+		"zdotdir": {
+			"label": "ZDOTDIR 처리 활성화",
+			"description": "활성화하면 zsh 셸 통합을 올바르게 처리하기 위한 ZDOTDIR용 임시 디렉터리를 생성합니다. 이를 통해 zsh 구성을 유지하면서 VSCode 셸 통합이 zsh와 올바르게 작동합니다. (실험적)"
+		},
 		"commandDelay": {
 		"commandDelay": {
 			"label": "터미널 명령 지연",
 			"label": "터미널 명령 지연",
 			"description": "명령 실행 후 추가할 지연 시간(밀리초). 기본값 0은 지연을 완전히 비활성화합니다. 이는 타이밍 문제가 있는 터미널에서 명령 출력을 완전히 캡처하는 데 도움이 될 수 있습니다. 대부분의 터미널에서는 `PROMPT_COMMAND='sleep N'`을 설정하여 구현되며, PowerShell은 각 명령 끝에 `start-sleep`을 추가합니다. 원래는 VSCode 버그#237208에 대한 해결책이었으며 필요하지 않을 수 있습니다."
 			"description": "명령 실행 후 추가할 지연 시간(밀리초). 기본값 0은 지연을 완전히 비활성화합니다. 이는 타이밍 문제가 있는 터미널에서 명령 출력을 완전히 캡처하는 데 도움이 될 수 있습니다. 대부분의 터미널에서는 `PROMPT_COMMAND='sleep N'`을 설정하여 구현되며, PowerShell은 각 명령 끝에 `start-sleep`을 추가합니다. 원래는 VSCode 버그#237208에 대한 해결책이었으며 필요하지 않을 수 있습니다."

+ 4 - 0
webview-ui/src/i18n/locales/pl/settings.json

@@ -302,6 +302,10 @@
 			"label": "Limit czasu integracji powłoki terminala",
 			"label": "Limit czasu integracji powłoki terminala",
 			"description": "Maksymalny czas oczekiwania na inicjalizację integracji powłoki przed wykonaniem poleceń. Dla użytkowników z długim czasem uruchamiania powłoki, ta wartość może wymagać zwiększenia, jeśli widzisz błędy \"Shell Integration Unavailable\" w terminalu."
 			"description": "Maksymalny czas oczekiwania na inicjalizację integracji powłoki przed wykonaniem poleceń. Dla użytkowników z długim czasem uruchamiania powłoki, ta wartość może wymagać zwiększenia, jeśli widzisz błędy \"Shell Integration Unavailable\" w terminalu."
 		},
 		},
+		"zdotdir": {
+			"label": "Włącz obsługę ZDOTDIR",
+			"description": "Po włączeniu tworzy tymczasowy katalog dla ZDOTDIR, aby poprawnie obsłużyć integrację powłoki zsh. Zapewnia to prawidłowe działanie integracji powłoki VSCode z zsh, zachowując twoją konfigurację zsh. (eksperymentalne)"
+		},
 		"commandDelay": {
 		"commandDelay": {
 			"label": "Opóźnienie poleceń terminala",
 			"label": "Opóźnienie poleceń terminala",
 			"description": "Opóźnienie w milisekundach dodawane po wykonaniu polecenia. Domyślne ustawienie 0 całkowicie wyłącza opóźnienie. Może to pomóc w zapewnieniu pełnego przechwytywania wyjścia poleceń w terminalach z problemami z synchronizacją. W większości terminali jest to implementowane przez ustawienie `PROMPT_COMMAND='sleep N'`, a PowerShell dodaje `start-sleep` na końcu każdego polecenia. Pierwotnie było to obejście błędu VSCode#237208 i może nie być potrzebne."
 			"description": "Opóźnienie w milisekundach dodawane po wykonaniu polecenia. Domyślne ustawienie 0 całkowicie wyłącza opóźnienie. Może to pomóc w zapewnieniu pełnego przechwytywania wyjścia poleceń w terminalach z problemami z synchronizacją. W większości terminali jest to implementowane przez ustawienie `PROMPT_COMMAND='sleep N'`, a PowerShell dodaje `start-sleep` na końcu każdego polecenia. Pierwotnie było to obejście błędu VSCode#237208 i może nie być potrzebne."

+ 4 - 0
webview-ui/src/i18n/locales/pt-BR/settings.json

@@ -302,6 +302,10 @@
 			"label": "Tempo limite de integração do shell do terminal",
 			"label": "Tempo limite de integração do shell do terminal",
 			"description": "Tempo máximo de espera para a inicialização da integração do shell antes de executar comandos. Para usuários com tempos de inicialização de shell longos, este valor pode precisar ser aumentado se você vir erros \"Shell Integration Unavailable\" no terminal."
 			"description": "Tempo máximo de espera para a inicialização da integração do shell antes de executar comandos. Para usuários com tempos de inicialização de shell longos, este valor pode precisar ser aumentado se você vir erros \"Shell Integration Unavailable\" no terminal."
 		},
 		},
+		"zdotdir": {
+			"label": "Ativar gerenciamento do ZDOTDIR",
+			"description": "Quando ativado, cria um diretório temporário para o ZDOTDIR para lidar corretamente com a integração do shell zsh. Isso garante que a integração do shell do VSCode funcione corretamente com o zsh enquanto preserva sua configuração do zsh. (experimental)"
+		},
 		"commandDelay": {
 		"commandDelay": {
 			"label": "Atraso de comando do terminal",
 			"label": "Atraso de comando do terminal",
 			"description": "Atraso em milissegundos para adicionar após a execução do comando. A configuração padrão de 0 desativa completamente o atraso. Isso pode ajudar a garantir que a saída do comando seja totalmente capturada em terminais com problemas de temporização. Na maioria dos terminais, isso é implementado definindo `PROMPT_COMMAND='sleep N'` e o PowerShell adiciona `start-sleep` ao final de cada comando. Originalmente era uma solução para o bug VSCode#237208 e pode não ser necessário."
 			"description": "Atraso em milissegundos para adicionar após a execução do comando. A configuração padrão de 0 desativa completamente o atraso. Isso pode ajudar a garantir que a saída do comando seja totalmente capturada em terminais com problemas de temporização. Na maioria dos terminais, isso é implementado definindo `PROMPT_COMMAND='sleep N'` e o PowerShell adiciona `start-sleep` ao final de cada comando. Originalmente era uma solução para o bug VSCode#237208 e pode não ser necessário."

+ 4 - 0
webview-ui/src/i18n/locales/tr/settings.json

@@ -302,6 +302,10 @@
 			"label": "Terminal kabuk entegrasyonu zaman aşımı",
 			"label": "Terminal kabuk entegrasyonu zaman aşımı",
 			"description": "Komutları yürütmeden önce kabuk entegrasyonunun başlatılması için beklenecek maksimum süre. Kabuk başlatma süresi uzun olan kullanıcılar için, terminalde \"Shell Integration Unavailable\" hatalarını görürseniz bu değerin artırılması gerekebilir."
 			"description": "Komutları yürütmeden önce kabuk entegrasyonunun başlatılması için beklenecek maksimum süre. Kabuk başlatma süresi uzun olan kullanıcılar için, terminalde \"Shell Integration Unavailable\" hatalarını görürseniz bu değerin artırılması gerekebilir."
 		},
 		},
+		"zdotdir": {
+			"label": "ZDOTDIR işlemeyi etkinleştir",
+			"description": "Etkinleştirildiğinde, zsh kabuğu entegrasyonunu düzgün şekilde işlemek için ZDOTDIR için geçici bir dizin oluşturur. Bu, zsh yapılandırmanızı korurken VSCode kabuk entegrasyonunun zsh ile düzgün çalışmasını sağlar. (deneysel)"
+		},
 		"commandDelay": {
 		"commandDelay": {
 			"label": "Terminal komut gecikmesi",
 			"label": "Terminal komut gecikmesi",
 			"description": "Komut yürütmesinden sonra eklenecek gecikme süresi (milisaniye). 0 varsayılan ayarı gecikmeyi tamamen devre dışı bırakır. Bu, zamanlama sorunları olan terminallerde komut çıktısının tam olarak yakalanmasını sağlamaya yardımcı olabilir. Çoğu terminalde bu, `PROMPT_COMMAND='sleep N'` ayarlanarak uygulanır ve PowerShell her komutun sonuna `start-sleep` ekler. Başlangıçta VSCode hata#237208 için bir geçici çözümdü ve gerekli olmayabilir."
 			"description": "Komut yürütmesinden sonra eklenecek gecikme süresi (milisaniye). 0 varsayılan ayarı gecikmeyi tamamen devre dışı bırakır. Bu, zamanlama sorunları olan terminallerde komut çıktısının tam olarak yakalanmasını sağlamaya yardımcı olabilir. Çoğu terminalde bu, `PROMPT_COMMAND='sleep N'` ayarlanarak uygulanır ve PowerShell her komutun sonuna `start-sleep` ekler. Başlangıçta VSCode hata#237208 için bir geçici çözümdü ve gerekli olmayabilir."

+ 4 - 0
webview-ui/src/i18n/locales/vi/settings.json

@@ -302,6 +302,10 @@
 			"label": "Thời gian chờ tích hợp shell terminal",
 			"label": "Thời gian chờ tích hợp shell terminal",
 			"description": "Thời gian tối đa để chờ tích hợp shell khởi tạo trước khi thực hiện lệnh. Đối với người dùng có thời gian khởi động shell dài, giá trị này có thể cần được tăng lên nếu bạn thấy lỗi \"Shell Integration Unavailable\" trong terminal."
 			"description": "Thời gian tối đa để chờ tích hợp shell khởi tạo trước khi thực hiện lệnh. Đối với người dùng có thời gian khởi động shell dài, giá trị này có thể cần được tăng lên nếu bạn thấy lỗi \"Shell Integration Unavailable\" trong terminal."
 		},
 		},
+		"zdotdir": {
+			"label": "Bật xử lý ZDOTDIR",
+			"description": "Khi được bật, tạo thư mục tạm thời cho ZDOTDIR để xử lý tích hợp shell zsh một cách chính xác. Điều này đảm bảo tích hợp shell VSCode hoạt động chính xác với zsh trong khi vẫn giữ nguyên cấu hình zsh của bạn. (thử nghiệm)"
+		},
 		"commandDelay": {
 		"commandDelay": {
 			"label": "Độ trễ lệnh terminal",
 			"label": "Độ trễ lệnh terminal",
 			"description": "Độ trễ tính bằng mili giây để thêm vào sau khi thực hiện lệnh. Cài đặt mặc định là 0 sẽ tắt hoàn toàn độ trễ. Điều này có thể giúp đảm bảo đầu ra lệnh được ghi lại đầy đủ trong các terminal có vấn đề về thời gian. Trong hầu hết các terminal, điều này được thực hiện bằng cách đặt `PROMPT_COMMAND='sleep N'` và PowerShell thêm `start-sleep` vào cuối mỗi lệnh. Ban đầu là giải pháp cho lỗi VSCode#237208 và có thể không cần thiết."
 			"description": "Độ trễ tính bằng mili giây để thêm vào sau khi thực hiện lệnh. Cài đặt mặc định là 0 sẽ tắt hoàn toàn độ trễ. Điều này có thể giúp đảm bảo đầu ra lệnh được ghi lại đầy đủ trong các terminal có vấn đề về thời gian. Trong hầu hết các terminal, điều này được thực hiện bằng cách đặt `PROMPT_COMMAND='sleep N'` và PowerShell thêm `start-sleep` vào cuối mỗi lệnh. Ban đầu là giải pháp cho lỗi VSCode#237208 và có thể không cần thiết."

+ 4 - 0
webview-ui/src/i18n/locales/zh-CN/settings.json

@@ -302,6 +302,10 @@
 			"label": "终端初始化等待时间",
 			"label": "终端初始化等待时间",
 			"description": "执行命令前等待 Shell 集成初始化的最长时间。对于 Shell 启动时间较长的用户,如果在终端中看到\"Shell Integration Unavailable\"错误,可能需要增加此值。"
 			"description": "执行命令前等待 Shell 集成初始化的最长时间。对于 Shell 启动时间较长的用户,如果在终端中看到\"Shell Integration Unavailable\"错误,可能需要增加此值。"
 		},
 		},
+		"zdotdir": {
+			"label": "启用 ZDOTDIR 处理",
+			"description": "启用后将创建临时目录用于 ZDOTDIR,以正确处理 zsh shell 集成。这确保 VSCode shell 集成能与 zsh 正常工作,同时保留您的 zsh 配置。(实验性)"
+		},
 		"commandDelay": {
 		"commandDelay": {
 			"label": "终端命令延迟",
 			"label": "终端命令延迟",
 			"description": "命令执行后添加的延迟时间(毫秒)。默认设置为 0 时完全禁用延迟。这可以帮助确保在有计时问题的终端中完全捕获命令输出。在大多数终端中,这是通过设置 `PROMPT_COMMAND='sleep N'` 实现的,而 PowerShell 会在每个命令末尾添加 `start-sleep`。最初是为了解决 VSCode 错误#237208,现在可能不再需要。"
 			"description": "命令执行后添加的延迟时间(毫秒)。默认设置为 0 时完全禁用延迟。这可以帮助确保在有计时问题的终端中完全捕获命令输出。在大多数终端中,这是通过设置 `PROMPT_COMMAND='sleep N'` 实现的,而 PowerShell 会在每个命令末尾添加 `start-sleep`。最初是为了解决 VSCode 错误#237208,现在可能不再需要。"

+ 4 - 0
webview-ui/src/i18n/locales/zh-TW/settings.json

@@ -302,6 +302,10 @@
 			"label": "終端機 Shell 整合逾時",
 			"label": "終端機 Shell 整合逾時",
 			"description": "執行命令前等待 Shell 整合初始化的最長時間。如果您的 Shell 啟動較慢,且終端機出現「Shell 整合無法使用」的錯誤訊息,可能需要提高此數值。"
 			"description": "執行命令前等待 Shell 整合初始化的最長時間。如果您的 Shell 啟動較慢,且終端機出現「Shell 整合無法使用」的錯誤訊息,可能需要提高此數值。"
 		},
 		},
+		"zdotdir": {
+			"label": "啟用 ZDOTDIR 處理",
+			"description": "啟用後將建立暫存目錄用於 ZDOTDIR,以正確處理 zsh shell 整合。這確保 VSCode shell 整合能與 zsh 正常運作,同時保留您的 zsh 設定。(實驗性)"
+		},
 		"commandDelay": {
 		"commandDelay": {
 			"label": "終端機命令延遲",
 			"label": "終端機命令延遲",
 			"description": "命令執行後添加的延遲時間(毫秒)。預設值為 0 時完全停用延遲。這可以幫助確保在有計時問題的終端機中完整擷取命令輸出。在大多數終端機中,這是透過設定 `PROMPT_COMMAND='sleep N'` 實現的,而 PowerShell 會在每個命令結尾加入 `start-sleep`。最初是為了解決 VSCode 錯誤#237208,現在可能不再需要。"
 			"description": "命令執行後添加的延遲時間(毫秒)。預設值為 0 時完全停用延遲。這可以幫助確保在有計時問題的終端機中完整擷取命令輸出。在大多數終端機中,這是透過設定 `PROMPT_COMMAND='sleep N'` 實現的,而 PowerShell 會在每個命令結尾加入 `start-sleep`。最初是為了解決 VSCode 錯誤#237208,現在可能不再需要。"