94 references to AgentInstructionsFile
aspire (12)
Agents\AgentInstructionsFile.cs (1)
18
/// How <see cref="
AgentInstructionsFile
.WriteAsync"/> changed the agent instructions file.
Commands\AgentInitCommand.cs (8)
847
?
AgentInstructionsFile
.GetConfiguredAppHostPath(appConfigurationDirectory) ??
848
AgentInstructionsFile
.GetConfiguredAppHostPath(workspaceRoot) ??
849
await
AgentInstructionsFile
.FindSingleAppHostPathAsync(_projectLocator, workspaceRoot, cancellationToken)
850
:
AgentInstructionsFile
.GetConfiguredAppHostPath(workspaceRoot) ?? (await FindWorkspaceAppHostAsync(workspaceRoot, discoverAppHostAsync, cancellationToken))?.FullName;
858
return await
AgentInstructionsFile
.WriteAndReportAsync(InteractionService, workspaceRoot, appHostPath, aspireSkillsRegistered, cancellationToken);
868
if (
AgentInstructionsFile
.IsInDirectory(workingDirectory.FullName, workspaceRoot))
874
if (appHost is not null &&
AgentInstructionsFile
.IsInDirectory(appHost.FullName, workspaceRoot))
891
return workspaceAppHost is not null &&
AgentInstructionsFile
.IsInDirectory(workspaceAppHost.FullName, workspaceRoot)
Commands\NewCommand.cs (3)
849
(
AgentInstructionsFile
.GetConfiguredAppHostPath(workspaceRoot) ??
850
await
AgentInstructionsFile
.FindSingleAppHostPathAsync(_projectLocator, workspaceRoot, cancellationToken)) is { } appHostPath)
852
await
AgentInstructionsFile
.WriteAndReportAsync(InteractionService, workspaceRoot, appHostPath, aspireSkillsPluginRegistered: false, cancellationToken);
Aspire.Cli.Tests (82)
Agents\AgentInstructionsFileTests.cs (60)
22
var change = await
AgentInstructionsFile
.WriteAsync(workspace.WorkspaceRoot, appHost, aspireSkillsPluginRegistered: true, CancellationToken.None);
36
var change = await
AgentInstructionsFile
.WriteAsync(workspace.WorkspaceRoot, appHost, false, CancellationToken.None);
40
existing + "\r\n\r\n" +
AgentInstructionsFile
.CreateSection("apphost.cs", false, "\r\n") + "\r\n",
49
var oldSection =
AgentInstructionsFile
.CreateSection("old.cs", false, "\n");
52
var change = await
AgentInstructionsFile
.WriteAsync(workspace.WorkspaceRoot, appHost, aspireSkillsPluginRegistered: true, CancellationToken.None);
53
var unchanged = await
AgentInstructionsFile
.WriteAsync(workspace.WorkspaceRoot, appHost, aspireSkillsPluginRegistered: true, CancellationToken.None);
58
$"# Rules\n\n{
AgentInstructionsFile
.CreateSection("apphost.cs", aspireSkillsPluginRegistered: true, "\n")}\n\n## More rules\nKeep tests green.\n",
71
var change = await
AgentInstructionsFile
.WriteAsync(workspace.WorkspaceRoot, appHost, false, CancellationToken.None);
75
Assert.Equal($"# Team rules\n\n{
AgentInstructionsFile
.CreateSection("apphost.cs", false, "\n")}\n", await File.ReadAllTextAsync(target));
91
var change = await
AgentInstructionsFile
.WriteAsync(new DirectoryInfo(link), appHost, false, CancellationToken.None);
96
$"# Agent instructions{newLine}{newLine}{
AgentInstructionsFile
.CreateSection("App/apphost.cs", false, newLine)}{newLine}",
97
await File.ReadAllTextAsync(Path.Combine(link,
AgentInstructionsFile
.FileName)));
108
var change = await
AgentInstructionsFile
.WriteAsync(workspace.WorkspaceRoot, Path.Combine(link, "apphost.cs"), false, CancellationToken.None);
113
$"# Agent instructions{newLine}{newLine}{
AgentInstructionsFile
.CreateSection("app/apphost.cs", false, newLine)}{newLine}",
125
var change = await
AgentInstructionsFile
.WriteAsync(workspace.WorkspaceRoot, appHost, false, CancellationToken.None);
131
$"# Agent instructions{newLine}{newLine}{
AgentInstructionsFile
.CreateSection("apphost.cs", false, newLine)}{newLine}",
140
var existing = $"# Rules\n\n<!-- aspire:begin -->\nAn unterminated section.\n\nKeep this team rule.\n\n{
AgentInstructionsFile
.CreateSection("old.cs", false, "\n")}\n";
143
var change = await
AgentInstructionsFile
.WriteAsync(workspace.WorkspaceRoot, appHost, false, CancellationToken.None);
157
await File.WriteAllTextAsync(GetFilePath(workspace), $"# Rules\n\n{earlierText}\nKeep this team rule.\n\n{
AgentInstructionsFile
.CreateSection("old.cs", false, "\n")}\n");
159
var change = await
AgentInstructionsFile
.WriteAsync(workspace.WorkspaceRoot, appHost, false, CancellationToken.None);
163
$"# Rules\n\n{earlierText}\nKeep this team rule.\n\n{
AgentInstructionsFile
.CreateSection("apphost.cs", false, "\n")}\n",
179
var change = await
AgentInstructionsFile
.WriteAsync(workspace.WorkspaceRoot, appHost, false, CancellationToken.None);
180
var unchanged = await
AgentInstructionsFile
.WriteAsync(workspace.WorkspaceRoot, appHost, false, CancellationToken.None);
185
$"{existing}\n{
AgentInstructionsFile
.CreateSection("apphost.cs", false, "\n")}\n",
200
var change = await
AgentInstructionsFile
.WriteAsync(workspace.WorkspaceRoot, appHost, false, CancellationToken.None);
210
var existing = $"# Rules\n\n```\nAn unclosed code block.\n\n{
AgentInstructionsFile
.CreateSection("old.cs", false, "\n")}\n";
213
var change = await
AgentInstructionsFile
.WriteAsync(
226
await File.WriteAllTextAsync(GetFilePath(workspace), $"# Rules\n\n{
AgentInstructionsFile
.CreateSection("old.cs", false, "\n")}\n{after}");
228
var change = await
AgentInstructionsFile
.WriteAsync(workspace.WorkspaceRoot, appHost, false, CancellationToken.None);
232
$"# Rules\n\n{
AgentInstructionsFile
.CreateSection("apphost.cs", false, "\n")}\n{after}",
241
var existing = $"# Rules\n\n{
AgentInstructionsFile
.SectionStartMarkerPrefix} -->\nMy own notes.\n";
244
var change = await
AgentInstructionsFile
.WriteAsync(workspace.WorkspaceRoot, appHost, false, CancellationToken.None);
255
var oldSection =
AgentInstructionsFile
.CreateSection("old.cs", false, "\n");
258
var change = await
AgentInstructionsFile
.WriteAsync(workspace.WorkspaceRoot, appHost, false, CancellationToken.None);
262
$"# Rules\n\n{
AgentInstructionsFile
.CreateSection("apphost.cs", false, "\n")} Keep this team rule.\nMore rules.\n",
271
var existing = $"# Rules\n\n{
AgentInstructionsFile
.SectionStartMarkerPrefix} -->\nOld section.\n{
AgentInstructionsFile
.SectionEndMarkerPrefix}\nMy own notes.\n";
274
var change = await
AgentInstructionsFile
.WriteAsync(workspace.WorkspaceRoot, appHost, false, CancellationToken.None);
285
var existing = $"# Rules\n\n{
AgentInstructionsFile
.SectionStartMarkerPrefix} -->\nOld section.\n{
AgentInstructionsFile
.SectionEndMarkerPrefix}\nKeep this team rule.\n<!-- unrelated note -->\n";
288
var change = await
AgentInstructionsFile
.WriteAsync(workspace.WorkspaceRoot, appHost, false, CancellationToken.None);
299
var existing = $"# Rules\n\n{
AgentInstructionsFile
.SectionStartMarkerPrefix}\nKeep this team rule.\n{
AgentInstructionsFile
.SectionEndMarkerPrefix} -->\n";
302
var change = await
AgentInstructionsFile
.WriteAsync(workspace.WorkspaceRoot, appHost, false, CancellationToken.None);
316
var change = await
AgentInstructionsFile
.WriteAsync(workspace.WorkspaceRoot, appHost, false, CancellationToken.None);
320
existing + "\n" +
AgentInstructionsFile
.CreateSection("apphost.cs", false, "\n") + "\n",
331
var change = await
AgentInstructionsFile
.WriteAsync(workspace.WorkspaceRoot, appHost, false, CancellationToken.None);
335
$"# Rules\n\n{
AgentInstructionsFile
.CreateSection("apphost.cs", false, "\n")}\nMore rules.\n",
348
var section =
AgentInstructionsFile
.CreateSection(appHostPath, false, "\n");
361
Assert.Null(
AgentInstructionsFile
.GetConfiguredAppHostPath(workspace.WorkspaceRoot));
372
var link = Path.Combine(repository.FullName,
AgentInstructionsFile
.FileName);
376
var succeeded = await
AgentInstructionsFile
.WriteAndReportAsync(
381
await
AgentInstructionsFile
.WriteAsync(repository, Path.Combine(repository.FullName, "apphost.cs"), false, CancellationToken.None));
399
var change = await
AgentInstructionsFile
.WriteAsync(workspace.WorkspaceRoot, appHost, false, CancellationToken.None);
402
byte[] expected = [.. encoding.Preamble, .. encoding.GetBytes($"# R\u00E8gles\n\n{
AgentInstructionsFile
.CreateSection("apphost.cs", false, "\n")}\n")];
414
var change = await
AgentInstructionsFile
.WriteAsync(workspace.WorkspaceRoot, appHost, false, CancellationToken.None);
417
byte[] expected = [.. encoding.Preamble, .. encoding.GetBytes($"# R\u00E8gles\r\n\r\n{
AgentInstructionsFile
.CreateSection("apphost.cs", false, "\r\n")}\r\n")];
430
var change = await
AgentInstructionsFile
.WriteAsync(workspace.WorkspaceRoot, appHost, false, CancellationToken.None);
448
var change = await
AgentInstructionsFile
.WriteAsync(workspace.WorkspaceRoot, appHost, false, CancellationToken.None);
455
Path.Combine(workspace.WorkspaceRoot.FullName,
AgentInstructionsFile
.FileName);
Commands\AgentInitCommandTests.cs (17)
179
$"# Agent instructions{newLine}{newLine}{
AgentInstructionsFile
.CreateSection("src/AppHost/apphost.cs", aspireSkillsPluginRegistered: false, newLine)}{newLine}",
180
await File.ReadAllTextAsync(Path.Combine(context.Project.FullName,
AgentInstructionsFile
.FileName)));
201
var agentInstructionsPath = Path.Combine(context.Project.FullName,
AgentInstructionsFile
.FileName);
210
$"# Agent instructions{newLine}{newLine}{
AgentInstructionsFile
.CreateSection("src/AppHost/apphost.cs", aspireSkillsPluginRegistered: false, newLine)}{newLine}",
231
var agentInstructionsPath = Path.Combine(context.Project.FullName,
AgentInstructionsFile
.FileName);
240
$"# Agent instructions{newLine}{newLine}{
AgentInstructionsFile
.CreateSection("src/AppHost/apphost.cs", aspireSkillsPluginRegistered: true, newLine)}{newLine}",
263
$"# Agent instructions{newLine}{newLine}{
AgentInstructionsFile
.CreateSection("src/AppHost/apphost.cs", aspireSkillsPluginRegistered, newLine)}{newLine}",
264
await File.ReadAllTextAsync(Path.Combine(context.Project.FullName,
AgentInstructionsFile
.FileName)));
286
$"# Agent instructions{newLine}{newLine}{
AgentInstructionsFile
.CreateSection("App.AppHost/App.AppHost.csproj", aspireSkillsPluginRegistered: false, newLine)}{newLine}",
287
await File.ReadAllTextAsync(Path.Combine(context.Project.FullName,
AgentInstructionsFile
.FileName)));
320
$"# Agent instructions{newLine}{newLine}{
AgentInstructionsFile
.CreateSection("B.AppHost/B.AppHost.csproj", aspireSkillsPluginRegistered: false, newLine)}{newLine}",
321
await File.ReadAllTextAsync(Path.Combine(otherRepository.FullName,
AgentInstructionsFile
.FileName)));
322
Assert.False(File.Exists(Path.Combine(context.Project.FullName,
AgentInstructionsFile
.FileName)));
355
$"# Agent instructions{newLine}{newLine}{
AgentInstructionsFile
.CreateSection("src/AppHost/AppHost.csproj", aspireSkillsPluginRegistered: false, newLine)}{newLine}",
356
await File.ReadAllTextAsync(Path.Combine(context.Project.FullName,
AgentInstructionsFile
.FileName)));
387
$"# Agent instructions{newLine}{newLine}{
AgentInstructionsFile
.CreateSection("App.AppHost/App.AppHost.csproj", aspireSkillsPluginRegistered: false, newLine)}{newLine}",
388
await File.ReadAllTextAsync(Path.Combine(context.Project.FullName,
AgentInstructionsFile
.FileName)));
Commands\NewCommandLocalTemplateTests.cs (2)
1416
var agentInstructionsPath = Path.Combine(outputDirectory,
AgentInstructionsFile
.FileName);
1425
$"# Agent instructions{newLine}{newLine}{
AgentInstructionsFile
.CreateSection(expectedAppHost, aspireSkillsPluginRegistered: false, newLine)}{newLine}",
Commands\NewCommandTests.cs (3)
1498
$"# Agent instructions{newLine}{newLine}{
AgentInstructionsFile
.CreateSection("apphost.cs", aspireSkillsPluginRegistered: false, newLine)}{newLine}",
1499
await File.ReadAllTextAsync(Path.Combine(workspace.WorkspaceRoot.FullName, "output",
AgentInstructionsFile
.FileName)));
1513
Assert.False(File.Exists(Path.Combine(outputDirectory,
AgentInstructionsFile
.FileName)));