worktreeIsolation.ts ×5

Frontier kind: Code frontier

unlabeled · c_8a466710b468

6 tests · 24520 LOC · 98 files · introduces 0 tests · 33 LOC · 1 file

Introduces — evidence that enters the hierarchy at this concept

Code
5 ranges33 lines · 1 files
Tests
0 tests

Contains — complete concept membership

All code (extent)
2085 ranges24520 lines · 98 files · Browse complete extent
All tests (intent)
6 testsBrowse complete intent

Neighbourhood graph

The orange circle is the focus. Violet and green circles are every ancestor and descendant, broader and narrower, at any distance; blue squares and pink diamonds are the introduced files and exact introduced tests of every visible concept, not only the focus's. Arrows point from broader to narrower concepts and bridge only concepts omitted from this view. Undirected links show source or test introduction. Concept and file size follows LOC; exact test nodes use test-count units.

Introduced files, introduced tests, and structurally relevant concept specialization

In the embedded map, ordinary wheel input scrolls the page; use the visible controls to zoom and drag to pan. Open the full-screen map for canvas navigation: wheel pans, Ctrl/Command plus wheel zooms, and arrow keys pan when this region is focused. On touch screens, open the full-screen map to pan or pinch. If JavaScript or WebGL is unavailable, use the native relationship evidence on this page.

Graph controls are ready.

Interactive rendering requires JavaScript and WebGL. Use the native relationship evidence on this page while the interactive map is unavailable.

Native relationship evidence

Every exact file and test below is linked only from the concept that introduces it.

Introduced tests

Every collected test enters the hierarchy at exactly one concept.

No tests are introduced at this concept. Its intent tests are introduced by other concepts.

Introduced code

Every collected source range enters the hierarchy at exactly one concept.

1 file ranked by introduced lines: 33 introduced LOC across 5 ranges. Expand a file to inspect source; the > gutter marks introduced lines.

src/vs/platform/agentHost/node/shared/worktreeIsolation.ts 33 introduced LOC · 5 ranges

Open complete file

296 */
297 async resolveIsolationConfig(request: IResolveIsolationConfigRequest): Promise<IIsolationConfigContribution> {
298 > const gitInfo = request.workingDirectory ? await this._getGitInfo(request.workingDirectory) : undefined; worktreeIsolation.ts
299 >
300 > const isolationProperty = schemaProperty<'folder' | 'worktree'>({
301 > type: 'string',
302 > title: localize('agentHost.sessionConfig.isolation', "Isolation"),
303 > description: localize('agentHost.sessionConfig.isolationDescription', "Where the agent should make changes"),
304 > enum: gitInfo ? ['folder', 'worktree'] : ['folder'],
305 > enumLabels: gitInfo ? [localize('agentHost.sessionConfig.isolation.folder', "Folder"), localize('agentHost.sessionConfig.isolation.worktree', "Worktree")] : [localize('agentHost.sessionConfig.isolation.folder', "Folder")],
306 > enumDescriptions: gitInfo ? [localize('agentHost.sessionConfig.isolation.folderDescription', "Work directly in the folder"), localize('agentHost.sessionConfig.isolation.worktreeDescription', "Create a Git worktree for isolation")] : [localize('agentHost.sessionConfig.isolation.folderDescription', "Work directly in the folder")],
307 > default: gitInfo ? 'worktree' : 'folder',
308 > readOnly: !gitInfo,
309 > sessionMutable: false,
310 > });
311 >
312 > // Resolve isolation first — downstream schema shapes (branch's
313 > // read-only mode + enum restriction) depend on the effective value.
314 > const isolationDefault: 'folder' | 'worktree' = gitInfo ? 'worktree' : 'folder';
315 > const isolationValue = isolationProperty.validate(request.config?.[SessionConfigKey.Isolation])
316 ? request.config![SessionConfigKey.Isolation] as 'folder' | 'worktree'
317 : isolationDefault;
319 > let branchProperty: ISchemaProperty<string> | undefined;
320 > let branchDefault: string | undefined;
321 > let branchValue: string | undefined;
322 > let worktreeBranchPrefixProperty: ISchemaProperty<string> | undefined;
323 > let worktreeIncludeFilesProperty: ISchemaProperty<readonly string[]> | undefined;
324 > if (gitInfo) {
325 const branchReadOnly = isolationValue === 'folder';
326 branchDefault = isolationValue === 'worktree' ? gitInfo.defaultBranch.name : gitInfo.currentBranch;
370 });
371 }
373 > return { isolationProperty, branchProperty, worktreeBranchPrefixProperty, worktreeIncludeFilesProperty, isolationValue, branchDefault, branchValue };
374 > }
375
376 /**
715
716 private async _getGitInfo(workingDirectory: URI): Promise<{ currentBranch: string; defaultBranch: IDefaultBranch } | undefined> {
717 > const repositoryRoot = await this._gitService.getRepositoryRoot(workingDirectory); worktreeIsolation.ts
718 > if (!repositoryRoot) {
719 return undefined;
720 }
727
728 const currentBranch = await this._gitService.getCurrentBranch(repositoryRoot) ?? 'HEAD';
729 > const defaultBranch = await this._gitService.getDefaultBranch(repositoryRoot) ?? { name: currentBranch, startPoint: currentBranch }; worktreeIsolation.ts
730 > return { currentBranch, defaultBranch };
731 > }
732
733 private async _resolveBranchStartPoint(repositoryRoot: URI, selectedBranch: string): Promise<string> {