pluginParsers.ts ×15

Frontier kind: Code frontier

unlabeled · c_9f203d7ff5c5

13 tests · 18731 LOC · 66 files · introduces 0 tests · 87 LOC · 1 file

Introduces — evidence that enters the hierarchy at this concept

Code
15 ranges87 lines · 1 files
Tests
0 tests

Contains — complete concept membership

All code (extent)
1873 ranges18731 lines · 66 files · Browse complete extent
All tests (intent)
13 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: 87 introduced LOC across 15 ranges. Expand a file to inspect source; the > gutter marks introduced lines.

src/vs/platform/agentPlugins/common/pluginParsers.ts 87 introduced LOC · 15 ranges

Open complete file

308 }
309
310 > function makeHookCustomization(hookUri: URI): HookCustomization { pluginParsers.ts
311 > return {
312 > type: CustomizationType.Hook,
313 > id: buildChildId(hookUri),
314 > uri: hookUri.toString(),
315 > name: basename(hookUri),
316 > };
317 > }
318
319 /**
622 * legacy `bash`/`powershell` fields to platform-specific overrides.
623 */
624 > function normalizeHookCommand(raw: Record<string, unknown>): IParsedHookCommand | undefined { pluginParsers.ts
625 > // Allow omitted type (Claude compatibility) — treat as 'command'
626 > if (raw.type !== undefined && raw.type !== 'command') {
627 return undefined;
628 }
630 > const hasCommand = typeof raw.command === 'string' && raw.command.length > 0;
631 > const hasBash = typeof raw.bash === 'string' && (raw.bash as string).length > 0;
632 > const hasPowerShell = typeof raw.powershell === 'string' && (raw.powershell as string).length > 0;
633 > const hasWindows = typeof raw.windows === 'string' && (raw.windows as string).length > 0;
634 > const hasLinux = typeof raw.linux === 'string' && (raw.linux as string).length > 0;
635 > const hasOsx = typeof raw.osx === 'string' && (raw.osx as string).length > 0;
636 >
637 > if (!hasCommand && !hasBash && !hasPowerShell && !hasWindows && !hasLinux && !hasOsx) {
638 return undefined;
639 }
641 > const windows = hasWindows ? raw.windows as string : (hasPowerShell ? raw.powershell as string : undefined);
642 > const linux = hasLinux ? raw.linux as string : (hasBash ? raw.bash as string : undefined);
643 > const osx = hasOsx ? raw.osx as string : (hasBash ? raw.bash as string : undefined);
644 >
645 > const timeout = typeof raw.timeout === 'number'
646 ? raw.timeout
647 > : (typeof raw.timeoutSec === 'number' ? raw.timeoutSec : undefined); pluginParsers.ts
648 >
649 > return {
650 > ...(hasCommand && { command: raw.command as string }),
651 > ...(windows && { windows }),
652 > ...(linux && { linux }),
653 > ...(osx && { osx }),
654 > ...(typeof raw.env === 'object' && raw.env !== null && { env: raw.env as Record<string, string> }),
655 > ...(timeout !== undefined && { timeout }),
656 > };
657 > }
658
659 /**
661 * normalizing fields and resolving the working directory.
662 */
663 > function resolveHookCommand(raw: Record<string, unknown>, workspaceRoot: URI | undefined, userHome: URI): IParsedHookCommand | undefined { pluginParsers.ts
664 > const normalized = normalizeHookCommand(raw);
665 > if (!normalized) {
666 return undefined;
667 }
669 > let cwdUri: URI | undefined;
670 > const rawCwd = typeof raw.cwd === 'string' ? raw.cwd : undefined;
671 > if (rawCwd) {
672 if (rawCwd.startsWith('~/')) {
673 cwdUri = URI.joinPath(userHome, rawCwd.substring(2));
677 cwdUri = joinPath(workspaceRoot, rawCwd);
678 }
679 > } else { pluginParsers.ts
680 > cwdUri = workspaceRoot;
681 > }
682 >
683 > return { ...normalized, cwd: cwdUri };
684 > }
685
686 /**
688 * or a nested structure with a `matcher` (Claude format).
689 */
690 > function extractHookCommands(item: unknown, workspaceRoot: URI | undefined, userHome: URI): IParsedHookCommand[] { pluginParsers.ts
691 > if (!item || typeof item !== 'object') {
692 return [];
693 }
695 > const itemObj = item as Record<string, unknown>;
696 > const commands: IParsedHookCommand[] = [];
697 >
698 > // Nested hooks with matcher (Claude style): { matcher: "...", hooks: [...] }
699 > const nestedHooks = itemObj.hooks;
700 > if (nestedHooks !== undefined && Array.isArray(nestedHooks)) {
701 for (const nested of nestedHooks) {
702 if (!nested || typeof nested !== 'object') {
708 }
709 }
710 > } else { pluginParsers.ts
711 const resolved = resolveHookCommand(itemObj, workspaceRoot, userHome);
712 if (resolved) {
749 return [];
750 }
752 > const hooksObj = hooks as Record<string, unknown>;
753 > const result: IParsedHookGroup[] = [];
754 > const customization = makeHookCustomization(hookUri);
755 >
756 > for (const originalId of Object.keys(hooksObj)) {
757 > const canonicalType = HOOK_TYPE_MAP[originalId];
758 > if (!canonicalType) {
759 continue;
760 }
762 > const hookArray = hooksObj[originalId];
763 > if (!Array.isArray(hookArray)) {
764 continue;
765 }
767 > const commands: IParsedHookCommand[] = [];
768 > for (const item of hookArray) {
769 > commands.push(...extractHookCommands(item, workspaceRoot, userHome));
770 > }
771 >
772 > if (commands.length > 0) {
773 > result.push({ type: canonicalType, commands, uri: hookUri, originalId, customization });
774 > }
775 > }
776 >
777 > return result;
778 > }
779
780 /**