promptsServiceImpl.ts ×9

Frontier kind: Code frontier

unlabeled · c_d9a8cb51f75d

6 tests · 67726 LOC · 326 files · introduces 0 tests · 48 LOC · 1 file

Introduces — evidence that enters the hierarchy at this concept

Code
9 ranges48 lines · 1 files
Tests
0 tests

Contains — complete concept membership

All code (extent)
6532 ranges67726 lines · 326 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: 48 introduced LOC across 9 ranges. Expand a file to inspect source; the > gutter marks introduced lines.

src/vs/workbench/contrib/chat/common/promptSyntax/service/promptsServiceImpl.ts 48 introduced LOC · 9 ranges

Open complete file

1118 return { type: PromptsType.hook, files, sourceFolders, hooksInfo: undefined, durationInMillis: stopWatch.elapsed() };
1119 }
1121 > const useClaudeHooks = this.configurationService.getValue<boolean>(PromptsConfig.USE_CLAUDE_HOOKS);
1122 > const hookFiles = await this.listPromptFiles(PromptsType.hook, token);
1123 >
1124 > this.logger.trace(`[PromptsService] Found ${hookFiles.length} hook file(s).`);
1125 >
1126 > // Get user home for tilde expansion
1127 > const userHomeUri = await this.pathService.userHome();
1128 const userHome = userHomeUri.scheme === Schemas.file ? userHomeUri.fsPath : userHomeUri.path;
1129
1132 // Process each hook file in parallel
1133 const fileResults = await Promise.all(hookFiles.map(async (hookFile): Promise<{
1134 > file?: IPromptFileDiscoveryResult; promptsServiceImpl.ts
1135 > hooks?: Map<HookType, IParsedHookCommand[]>;
1136 > sourceUri?: URI;
1137 > hasDisabledClaudeHooks?: boolean;
1138 > }> => {
1139 > const name = basename(hookFile.uri);
1140 >
1141 > // Plugins are handled separately down below because they do their own parsing+interpolation
1142 > if (hookFile.storage === PromptsStorage.plugin) {
1143 return {
1144 file: {
1168
1169 // Validate it's an object
1170 > if (!json || typeof json !== 'object') { promptsServiceImpl.ts
1171 return {
1172 file: {
1182 // falling back to the first workspace folder for user-level hooks outside the workspace
1183 const hookWorkspaceFolder = this.workspaceService.getWorkspaceFolder(hookFile.uri) ?? defaultFolder;
1184 > const workspaceRootUri = hookWorkspaceFolder?.uri; promptsServiceImpl.ts
1185 >
1186 > // Use format-aware parsing that handles Copilot and Claude formats
1187 > const { format, hooks: parsedHooks, disabledAllHooks } = parseHooksFromFile(hookFile.uri, json, workspaceRootUri, userHome);
1188 >
1189 > // Skip files that have all hooks disabled
1190 > if (disabledAllHooks) {
1191 this.logger.trace(`[PromptsService] Skipping hook file with disableAllHooks: ${hookFile.uri}`);
1192 return {
1200
1201 // Skip Claude hooks when the setting is disabled (after parsing to check for commands)
1202 > if (format === HookSourceFormat.Claude && useClaudeHooks === false) { promptsServiceImpl.ts
1203 const hasAnyCommands = [...parsedHooks.values()].some(({ hooks: cmds }) => cmds.length > 0);
1204 this.logger.trace(`[PromptsService] Skipping Claude hook file (disabled via setting): ${hookFile.uri}`);
1244 }
1245 }));
1247 > // Merge results from parallel processing
1248 > const files: IPromptFileDiscoveryResult[] = [];
1249 > let hasDisabledClaudeHooks = false;
1250 > const collectedHooks = new Map<HookType, IParsedHookCommand[]>();
1251 >
1252 > for (const { file, hooks, sourceUri, hasDisabledClaudeHooks: disabled } of fileResults) {
1253 > if (file) {
1254 > files.push(file);
1255 > }
1256 > if (disabled) {
1257 hasDisabledClaudeHooks = true;
1258 }
1259 > if (hooks && sourceUri) { promptsServiceImpl.ts
1260 for (const [hookType, commands] of hooks) {
1261 let bucket = collectedHooks.get(hookType);
1269 }
1270 }
1272 >
1273 > // Collect hooks from agent plugins
1274 > const plugins = this.agentPluginService.plugins.get();
1275 > for (const plugin of plugins) {
1276 if (!isContributionEnabled(plugin.enablement.get())) {
1277 continue;
1288 }
1289 }
1291 > const sourceFolders = await this._collectSourceFolderDiagnostics(PromptsType.hook);
1292 >
1293 > // Check if any hooks were collected
1294 > if (collectedHooks.size === 0) {
1295 this.logger.trace('[PromptsService] No valid hooks collected.');
1296 return { type: PromptsType.hook, files, sourceFolders, hooksInfo: undefined, durationInMillis: stopWatch.elapsed() };