Skip to content

Commit f0d1138

Browse files
committed
rename AgentInstructionFileType
1 parent 852abaf commit f0d1138

12 files changed

Lines changed: 42 additions & 42 deletions

File tree

src/vs/sessions/contrib/sessions/test/browser/customizationCounts.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import assert from 'assert';
77
import { URI } from '../../../../../base/common/uri.js';
88
import { ensureNoDisposablesAreLeakedInTestSuite } from '../../../../../base/test/common/utils.js';
99
import { PromptsType } from '../../../../../workbench/contrib/chat/common/promptSyntax/promptTypes.js';
10-
import { IPromptsService, PromptsStorage, IPromptPath, ILocalPromptPath, IUserPromptPath, IExtensionPromptPath, IAgentInstructionFile, AgentFileType } from '../../../../../workbench/contrib/chat/common/promptSyntax/service/promptsService.js';
10+
import { IPromptsService, PromptsStorage, IPromptPath, ILocalPromptPath, IUserPromptPath, IExtensionPromptPath, IAgentInstructionFile, AgentInstructionFileType } from '../../../../../workbench/contrib/chat/common/promptSyntax/service/promptsService.js';
1111
import { IAICustomizationWorkspaceService, IStorageSourceFilter } from '../../../../../workbench/contrib/chat/common/aiCustomizationWorkspaceService.js';
1212
import { IWorkspaceContextService, IWorkspace, IWorkspaceFolder, WorkbenchState } from '../../../../../platform/workspace/common/workspace.js';
1313
import { getSourceCounts, getSourceCountsTotal, getCustomizationTotalCount } from '../../browser/customizationCounts.js';
@@ -34,7 +34,7 @@ function extensionFile(path: string): IExtensionPromptPath {
3434
}
3535

3636
function agentInstructionFile(path: string): IAgentInstructionFile {
37-
return { uri: URI.file(path), realPath: undefined, type: AgentFileType.agentsMd };
37+
return { uri: URI.file(path), realPath: undefined, type: AgentInstructionFileType.agentsMd };
3838
}
3939

4040
function makeWorkspaceFolder(path: string, name?: string): IWorkspaceFolder {

src/vs/workbench/contrib/chat/browser/chatTipEligibilityTracker.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import { IContextKeyService } from '../../../../platform/contextkey/common/conte
1010
import { ILogService } from '../../../../platform/log/common/log.js';
1111
import { IStorageService, StorageScope, StorageTarget } from '../../../../platform/storage/common/storage.js';
1212
import { ChatContextKeys } from '../common/actions/chatContextKeys.js';
13-
import { AgentFileType, IPromptsService } from '../common/promptSyntax/service/promptsService.js';
13+
import { AgentInstructionFileType, IPromptsService } from '../common/promptSyntax/service/promptsService.js';
1414
import { PromptsType } from '../common/promptSyntax/promptTypes.js';
1515
import { ILanguageModelToolsService } from '../common/tools/languageModelToolsService.js';
1616
import { TipEligibilityStorageKeys } from './chatTipStorageKeys.js';
@@ -30,7 +30,7 @@ export interface ITipExclusionConfig {
3030
/** File-based exclusion configuration. */
3131
readonly excludeWhenPromptFilesExist?: {
3232
readonly promptType: PromptsType;
33-
readonly agentFileType?: AgentFileType;
33+
readonly agentFileType?: AgentInstructionFileType;
3434
readonly excludeUntilChecked?: boolean;
3535
};
3636
}

src/vs/workbench/contrib/chat/browser/promptSyntax/pickers/promptFilePickers.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { localize } from '../../../../../../nls.js';
77
import { URI } from '../../../../../../base/common/uri.js';
88
import { Codicon } from '../../../../../../base/common/codicons.js';
99
import { ThemeIcon } from '../../../../../../base/common/themables.js';
10-
import { AgentFileType, IExtensionPromptPath, IPromptPath, IPromptsService, PromptsStorage } from '../../../common/promptSyntax/service/promptsService.js';
10+
import { AgentInstructionFileType, IExtensionPromptPath, IPromptPath, IPromptsService, PromptsStorage } from '../../../common/promptSyntax/service/promptsService.js';
1111
import { basename, dirname, extUri, joinPath } from '../../../../../../base/common/resources.js';
1212
import { DisposableStore } from '../../../../../../base/common/lifecycle.js';
1313
import { IFileService } from '../../../../../../platform/files/common/files.js';
@@ -475,7 +475,7 @@ export class PromptFilePickers {
475475
// Don't show the folder path for files under .github folder (namely, copilot-instructions.md) since that is only defined once per repo.
476476
return {
477477
uri: agentInstructionFile.uri,
478-
description: agentInstructionFile.type !== AgentFileType.copilotInstructionsMd ? folderName : undefined,
478+
description: agentInstructionFile.type !== AgentInstructionFileType.copilotInstructionsMd ? folderName : undefined,
479479
storage: PromptsStorage.local,
480480
type: options.type
481481
} satisfies IPromptPath;

src/vs/workbench/contrib/chat/common/promptSyntax/computeAutomaticInstructions.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import { ILanguageModelToolsService, IToolData, VSCodeToolReference } from '../t
2424
import { PromptsConfig } from './config/config.js';
2525
import { isInClaudeAgentsFolder, isInClaudeRulesFolder, isPromptOrInstructionsFile } from './config/promptFileLocations.js';
2626
import { ParsedPromptFile } from './promptFileParser.js';
27-
import { AgentFileType, IAgentSkill, ICustomAgent, IInstructionFile, IPromptsService } from './service/promptsService.js';
27+
import { AgentInstructionFileType, IAgentSkill, ICustomAgent, IInstructionFile, IPromptsService } from './service/promptsService.js';
2828
import { AGENT_DEBUG_LOG_ENABLED_SETTING, AGENT_DEBUG_LOG_FILE_LOGGING_ENABLED_SETTING, TROUBLESHOOT_SKILL_PATH } from './promptTypes.js';
2929
import { OffsetRange } from '../../../../../editor/common/core/ranges/offsetRange.js';
3030
import { ChatConfiguration, ChatModeKind } from '../constants.js';
@@ -252,12 +252,12 @@ export class ComputeAutomaticInstructions {
252252
for (const { uri, type } of allCandidates) {
253253
const varEntry = toPromptFileVariableEntry(uri, PromptFileVariableKind.Instruction, undefined, true);
254254
entries.add(varEntry);
255-
if (type === AgentFileType.copilotInstructionsMd) {
255+
if (type === AgentInstructionFileType.copilotInstructionsMd) {
256256
copilotEntries.add(varEntry);
257257
}
258258

259259
telemetryEvent.agentInstructionsCount++;
260-
if (type === AgentFileType.claudeMd) {
260+
if (type === AgentInstructionFileType.claudeMd) {
261261
telemetryEvent.claudeMdCount++;
262262
}
263263
logger.logInfo(`Agent instruction file added: ${uri.toString()}`);

src/vs/workbench/contrib/chat/common/promptSyntax/service/promptsService.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,7 @@ export interface IAgentSkill {
334334
/**
335335
* Type of agent instruction file.
336336
*/
337-
export enum AgentFileType {
337+
export enum AgentInstructionFileType {
338338
agentsMd = 'agentsMd',
339339
claudeMd = 'claudeMd',
340340
copilotInstructionsMd = 'copilotInstructionsMd',
@@ -350,7 +350,7 @@ export interface IAgentInstructionFile {
350350
* The real path of the file, if it is a symlink.
351351
*/
352352
readonly realPath: URI | undefined;
353-
readonly type: AgentFileType;
353+
readonly type: AgentInstructionFileType;
354354
}
355355

356356
export interface Logger {

src/vs/workbench/contrib/chat/common/promptSyntax/service/promptsServiceImpl.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ import { AGENT_MD_FILENAME, CLAUDE_CONFIG_FOLDER, CLAUDE_LOCAL_MD_FILENAME, CLAU
3434
import { PROMPT_LANGUAGE_ID, PromptFileSource, PromptsType, Target, getPromptsTypeForLanguageId } from '../promptTypes.js';
3535
import { IWorkspaceInstructionFile, PromptFilesLocator } from '../utils/promptFilesLocator.js';
3636
import { evaluateApplyToPattern, PromptFileParser, ParsedPromptFile, PromptHeaderAttributes } from '../promptFileParser.js';
37-
import { IAgentInstructions, type IAgentSource, IChatPromptSlashCommand, IConfiguredHooksInfo, ICustomAgent, IExtensionPromptPath, ILocalPromptPath, IPluginPromptPath, IPromptPath, IPromptsService, IAgentSkill, IInstructionDiscoveryInfo, IInstructionDiscoveryResult, IInstructionFile, IUserPromptPath, PromptsStorage, CUSTOM_AGENT_PROVIDER_ACTIVATION_EVENT, INSTRUCTIONS_PROVIDER_ACTIVATION_EVENT, IPromptFileContext, IPromptFileResource, PROMPT_FILE_PROVIDER_ACTIVATION_EVENT, SKILL_PROVIDER_ACTIVATION_EVENT, IPromptDiscoveryInfo, IPromptFileDiscoveryResult, IPromptSourceFolderResult, ICustomAgentVisibility, IAgentInstructionFile, AgentFileType, Logger, ISlashCommandDiscoveryInfo, ISlashCommandDiscoveryResult, IAgentDiscoveryInfo, IAgentDiscoveryResult, IHookDiscoveryInfo, IResolvedChatPromptSlashCommand } from './promptsService.js';
37+
import { IAgentInstructions, type IAgentSource, IChatPromptSlashCommand, IConfiguredHooksInfo, ICustomAgent, IExtensionPromptPath, ILocalPromptPath, IPluginPromptPath, IPromptPath, IPromptsService, IAgentSkill, IInstructionDiscoveryInfo, IInstructionDiscoveryResult, IInstructionFile, IUserPromptPath, PromptsStorage, CUSTOM_AGENT_PROVIDER_ACTIVATION_EVENT, INSTRUCTIONS_PROVIDER_ACTIVATION_EVENT, IPromptFileContext, IPromptFileResource, PROMPT_FILE_PROVIDER_ACTIVATION_EVENT, SKILL_PROVIDER_ACTIVATION_EVENT, IPromptDiscoveryInfo, IPromptFileDiscoveryResult, IPromptSourceFolderResult, ICustomAgentVisibility, IAgentInstructionFile, AgentInstructionFileType, Logger, ISlashCommandDiscoveryInfo, ISlashCommandDiscoveryResult, IAgentDiscoveryInfo, IAgentDiscoveryResult, IHookDiscoveryInfo, IResolvedChatPromptSlashCommand } from './promptsService.js';
3838
import { Delayer } from '../../../../../../base/common/async.js';
3939
import { Schemas } from '../../../../../../base/common/network.js';
4040
import { ChatRequestHooks, parseSubagentHooksFromYaml } from '../hookSchema.js';
@@ -955,15 +955,15 @@ export class PromptsService extends Disposable implements IPromptsService {
955955
if (!useAgentMD) {
956956
logger?.logInfo('Agent MD files are disabled via configuration.');
957957
} else {
958-
rootFiles.push({ fileName: AGENT_MD_FILENAME, type: AgentFileType.agentsMd });
958+
rootFiles.push({ fileName: AGENT_MD_FILENAME, type: AgentInstructionFileType.agentsMd });
959959
}
960960
const useClaudeMD = this.configurationService.getValue(PromptsConfig.USE_CLAUDE_MD);
961961
if (!useClaudeMD) {
962962
logger?.logInfo('Claude MD files are disabled via configuration.');
963963
} else {
964-
const claudeMdFile = { fileName: CLAUDE_MD_FILENAME, type: AgentFileType.claudeMd };
964+
const claudeMdFile = { fileName: CLAUDE_MD_FILENAME, type: AgentInstructionFileType.claudeMd };
965965
rootFiles.push(claudeMdFile); // CLAUDE.md in workspace root
966-
rootFiles.push({ fileName: CLAUDE_LOCAL_MD_FILENAME, type: AgentFileType.claudeMd }); // CLAUDE.local.md in workspace root
966+
rootFiles.push({ fileName: CLAUDE_LOCAL_MD_FILENAME, type: AgentInstructionFileType.claudeMd }); // CLAUDE.local.md in workspace root
967967

968968
promises.push(this.fileLocator.findFilesInRoots(rootFolders, CLAUDE_CONFIG_FOLDER, [claudeMdFile], token, resolvedAgentFiles)); // CLAUDE.md in .claude folder under workspace root
969969
promises.push(this.fileLocator.findFilesInRoots([await this.pathService.userHome()], CLAUDE_CONFIG_FOLDER, [claudeMdFile], token, resolvedAgentFiles)); // CLAUDE.md in in ~/.claude folder
@@ -972,7 +972,7 @@ export class PromptsService extends Disposable implements IPromptsService {
972972
if (!useCopilotInstructionsFiles) {
973973
logger?.logInfo('Copilot instructions files are disabled via configuration.');
974974
} else {
975-
const githubConfigFiles = [{ fileName: COPILOT_CUSTOM_INSTRUCTIONS_FILENAME, type: AgentFileType.copilotInstructionsMd }];
975+
const githubConfigFiles = [{ fileName: COPILOT_CUSTOM_INSTRUCTIONS_FILENAME, type: AgentInstructionFileType.copilotInstructionsMd }];
976976
promises.push(this.fileLocator.findFilesInRoots(rootFolders, GITHUB_CONFIG_FOLDER, githubConfigFiles, token, resolvedAgentFiles));
977977
}
978978

src/vs/workbench/contrib/chat/common/promptSyntax/utils/promptFilesLocator.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import { Schemas } from '../../../../../../base/common/network.js';
1919
import { getExcludes, IFileQuery, ISearchConfiguration, ISearchService, QueryType } from '../../../../../services/search/common/search.js';
2020
import { CancellationToken, CancellationTokenSource } from '../../../../../../base/common/cancellation.js';
2121
import { isCancellationError } from '../../../../../../base/common/errors.js';
22-
import { AgentFileType, IPromptPath, IAgentInstructionFile, Logger, PromptsStorage } from '../service/promptsService.js';
22+
import { AgentInstructionFileType, IPromptPath, IAgentInstructionFile, Logger, PromptsStorage } from '../service/promptsService.js';
2323
import { IUserDataProfileService } from '../../../../../services/userDataProfile/common/userDataProfile.js';
2424
import { Emitter, Event } from '../../../../../../base/common/event.js';
2525
import { DisposableStore } from '../../../../../../base/common/lifecycle.js';
@@ -35,7 +35,7 @@ const MAX_INSTRUCTIONS_RECURSION_DEPTH = 5;
3535

3636
export interface IWorkspaceInstructionFile {
3737
readonly fileName: string;
38-
readonly type: AgentFileType;
38+
readonly type: AgentInstructionFileType;
3939
}
4040

4141
/**
@@ -601,7 +601,7 @@ export class PromptFilesLocator {
601601
const results: IAgentInstructionFile[] = [];
602602
for (const r of searchResult.results) {
603603
const realPath = undefined; // We can skip realpath resolution here for performance; duplicates can be handled later if needed
604-
results.push({ uri: r.resource, realPath, type: AgentFileType.agentsMd });
604+
results.push({ uri: r.resource, realPath, type: AgentInstructionFileType.agentsMd });
605605
}
606606
return results;
607607
} catch (e) {
@@ -633,7 +633,7 @@ export class PromptFilesLocator {
633633
const stat = await this.fileService.resolve(uri);
634634
if (stat.isFile && stat.name.toLowerCase() === agentsMdFileName) {
635635
const realPath = stat.isSymbolicLink ? await this.fileService.realpath(stat.resource) : undefined;
636-
result.push({ uri: stat.resource, realPath, type: AgentFileType.agentsMd });
636+
result.push({ uri: stat.resource, realPath, type: AgentInstructionFileType.agentsMd });
637637
} else if (stat.isDirectory && stat.children) {
638638
// Recursively traverse subdirectories
639639
for (const child of stat.children) {

src/vs/workbench/contrib/chat/test/browser/chatTipService.test.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import { ILogService, NullLogService } from '../../../../../platform/log/common/
1818
import { IProductService } from '../../../../../platform/product/common/productService.js';
1919
import { IStorageService, InMemoryStorageService, StorageScope, StorageTarget } from '../../../../../platform/storage/common/storage.js';
2020
import { ChatTipService, CREATE_AGENT_INSTRUCTIONS_TRACKING_COMMAND, CREATE_AGENT_TRACKING_COMMAND, CREATE_PROMPT_TRACKING_COMMAND, CREATE_SKILL_TRACKING_COMMAND, FORK_CONVERSATION_TRACKING_COMMAND, IChatTip, ITipDefinition, TipEligibilityTracker } from '../../browser/chatTipService.js';
21-
import { AgentFileType, IPromptPath, IPromptsService, IAgentInstructionFile, PromptsStorage } from '../../common/promptSyntax/service/promptsService.js';
21+
import { AgentInstructionFileType, IPromptPath, IPromptsService, IAgentInstructionFile, PromptsStorage } from '../../common/promptSyntax/service/promptsService.js';
2222
import { URI } from '../../../../../base/common/uri.js';
2323
import { ChatContextKeys } from '../../common/actions/chatContextKeys.js';
2424
import { ChatAgentLocation, ChatModeKind } from '../../common/constants.js';
@@ -904,14 +904,14 @@ suite('ChatTipService', () => {
904904
test('excludes tip.customInstructions when copilot-instructions.md exists in workspace', async () => {
905905
const tip = createMockTip({
906906
id: 'tip.customInstructions',
907-
excludeWhenPromptFilesExist: { promptType: PromptsType.instructions, agentFileType: AgentFileType.copilotInstructionsMd, excludeUntilChecked: true },
907+
excludeWhenPromptFilesExist: { promptType: PromptsType.instructions, agentFileType: AgentInstructionFileType.copilotInstructionsMd, excludeUntilChecked: true },
908908
});
909909

910910
const tracker = testDisposables.add(new TipEligibilityTracker(
911911
[tip],
912912
{ onDidExecuteCommand: Event.None, onWillExecuteCommand: Event.None } as Partial<ICommandService> as ICommandService,
913913
storageService,
914-
createMockPromptsService([{ uri: { path: '/.github/copilot-instructions.md' }, realPath: undefined, type: AgentFileType.copilotInstructionsMd } as IAgentInstructionFile]) as IPromptsService,
914+
createMockPromptsService([{ uri: { path: '/.github/copilot-instructions.md' }, realPath: undefined, type: AgentInstructionFileType.copilotInstructionsMd } as IAgentInstructionFile]) as IPromptsService,
915915
createMockToolsService(),
916916
new NullLogService(),
917917
));
@@ -925,14 +925,14 @@ suite('ChatTipService', () => {
925925
test('does not exclude tip.customInstructions when only AGENTS.md exists', async () => {
926926
const tip = createMockTip({
927927
id: 'tip.customInstructions',
928-
excludeWhenPromptFilesExist: { promptType: PromptsType.instructions, agentFileType: AgentFileType.copilotInstructionsMd, excludeUntilChecked: true },
928+
excludeWhenPromptFilesExist: { promptType: PromptsType.instructions, agentFileType: AgentInstructionFileType.copilotInstructionsMd, excludeUntilChecked: true },
929929
});
930930

931931
const tracker = testDisposables.add(new TipEligibilityTracker(
932932
[tip],
933933
{ onDidExecuteCommand: Event.None, onWillExecuteCommand: Event.None } as Partial<ICommandService> as ICommandService,
934934
storageService,
935-
createMockPromptsService([{ uri: { path: '/AGENTS.md' }, realPath: undefined, type: AgentFileType.agentsMd } as IAgentInstructionFile]) as IPromptsService,
935+
createMockPromptsService([{ uri: { path: '/AGENTS.md' }, realPath: undefined, type: AgentInstructionFileType.agentsMd } as IAgentInstructionFile]) as IPromptsService,
936936
createMockToolsService(),
937937
new NullLogService(),
938938
));
@@ -946,7 +946,7 @@ suite('ChatTipService', () => {
946946
test('excludes tip.customInstructions when .instructions.md files exist in workspace', async () => {
947947
const tip = createMockTip({
948948
id: 'tip.customInstructions',
949-
excludeWhenPromptFilesExist: { promptType: PromptsType.instructions, agentFileType: AgentFileType.copilotInstructionsMd, excludeUntilChecked: true },
949+
excludeWhenPromptFilesExist: { promptType: PromptsType.instructions, agentFileType: AgentInstructionFileType.copilotInstructionsMd, excludeUntilChecked: true },
950950
});
951951

952952
const tracker = testDisposables.add(new TipEligibilityTracker(
@@ -967,7 +967,7 @@ suite('ChatTipService', () => {
967967
test('does not exclude tip.customInstructions when no instruction files exist', async () => {
968968
const tip = createMockTip({
969969
id: 'tip.customInstructions',
970-
excludeWhenPromptFilesExist: { promptType: PromptsType.instructions, agentFileType: AgentFileType.copilotInstructionsMd, excludeUntilChecked: true },
970+
excludeWhenPromptFilesExist: { promptType: PromptsType.instructions, agentFileType: AgentInstructionFileType.copilotInstructionsMd, excludeUntilChecked: true },
971971
});
972972

973973
const tracker = testDisposables.add(new TipEligibilityTracker(
@@ -1701,7 +1701,7 @@ suite('ChatTipService', () => {
17011701

17021702
const tip = createMockTip({
17031703
id: 'tip.customInstructions',
1704-
excludeWhenPromptFilesExist: { promptType: PromptsType.instructions, agentFileType: AgentFileType.copilotInstructionsMd, excludeUntilChecked: true },
1704+
excludeWhenPromptFilesExist: { promptType: PromptsType.instructions, agentFileType: AgentInstructionFileType.copilotInstructionsMd, excludeUntilChecked: true },
17051705
});
17061706

17071707
const tracker = testDisposables.add(new TipEligibilityTracker(

0 commit comments

Comments
 (0)