Agents\LocalAspireSkillsTests.cs (58)
26var paths = names.Select(name => Path.Combine(_context.Project.FullName, ".agents", "skills", name, "SKILL.md")).ToArray();
31var before = Directory.GetFileSystemEntries(_context.Workspace.Path, "*", SearchOption.AllDirectories).Order().ToArray();
32Assert.False(Directory.Exists(_context.ExecutionContext.CacheDirectory.FullName));
34var result = Scan([_context.Copilot]);
38Assert.Equal(before, Directory.GetFileSystemEntries(_context.Workspace.Path, "*", SearchOption.AllDirectories).Order());
49var path = Path.Combine(_context.Project.FullName, directory, "skills", "aspire", "SKILL.md");
52var empty = Path.Combine(_context.Project.FullName, directory, "skills", "aspire-init", "SKILL.md");
55await AgentConfigurationTestContext.WriteAsync(Path.Combine(_context.Project.FullName, directory, "skills", "aspire-custom", "SKILL.md"), "unrelated");
56await AgentConfigurationTestContext.WriteAsync(Path.Combine(_context.Project.FullName, directory, "skills", "playwright-cli", "SKILL.md"), "unrelated");
57var before = Directory.GetFileSystemEntries(_context.Workspace.Path, "*", SearchOption.AllDirectories).Order().ToArray();
59var result = Scan([_context.Clients.Single(scanner => scanner.DisplayName == agent)]);
66Assert.Equal(before, Directory.GetFileSystemEntries(_context.Workspace.Path, "*", SearchOption.AllDirectories).Order());
72var project = Path.Combine(_context.Project.FullName, ".agents", "skills", "aspire-init", "SKILL.md");
73var user = Path.Combine(_context.Home.FullName, ".agents", "skills", "aspireify", "SKILL.md");
77var result = Scan([_context.Copilot, _context.OpenCode]);
86var custom = Path.Combine(_context.Home.FullName, "claude-work");
87_context.SetVariable("CLAUDE_CONFIG_DIR", custom);
90await AgentConfigurationTestContext.WriteAsync(Path.Combine(_context.Home.FullName, ".claude", "skills", "aspire", "SKILL.md"), "old home");
91await AgentConfigurationTestContext.WriteAsync(Path.Combine(_context.Project.FullName, ".github", "skills", "aspire", "SKILL.md"), "other agent");
93var result = Scan([_context.ClaudeCode]);
102var custom = _context.Workspace.CreateDirectory("custom-opencode");
103_context.SetVariable("OPENCODE_CONFIG_DIR", custom.FullName);
106Path.Combine(_context.Project.FullName, ".opencode", "skill", "aspire", "SKILL.md"),
114var result = Scan([_context.OpenCode]);
128? Path.Combine(_context.OpenCodeDirectory, "opencode.jsonc")
129: Path.Combine(_context.Project.FullName, ".opencode", "opencode.jsonc");
132Path.Combine(_context.Project.FullName, "team-skills", "aspire", "SKILL.md"),
133Path.Combine(_context.Home.FullName, "shared-skills", "aspireify", "SKILL.md")
144var result = Scan([_context.OpenCode]);
161var path = Path.Combine(_context.Project.FullName, "opencode.json");
164var result = Scan([_context.OpenCode]);
175await AgentConfigurationTestContext.WriteAsync(Path.Combine(_context.CopilotDirectory, "installed-plugins", "aspire", "skills", "aspire", "SKILL.md"), "installed");
176await AgentConfigurationTestContext.WriteAsync(Path.Combine(_context.Project.FullName, "unrelated", ".agents", "skills", "aspire", "SKILL.md"), "unrelated");
178var result = Scan(_context.Clients);
193var parent = _context.Project.CreateSubdirectory("apps");
195var paths = new[] { _context.Project, parent, working }
204Path.Combine(_context.Workspace.Path, directory, "skills", "aspire", "SKILL.md"), "outside the workspace");
205var before = Directory.GetFileSystemEntries(_context.Workspace.Path, "*", SearchOption.AllDirectories).Order().ToArray();
207var result = LocalAspireSkills.Find(working, _context.Project,
208[_context.Clients.Single(scanner => scanner.DisplayName == agent)], TestContext.Current.CancellationToken);
212Assert.Equal(before, Directory.GetFileSystemEntries(_context.Workspace.Path, "*", SearchOption.AllDirectories).Order());
218var outside = _context.Workspace.CreateDirectory("outside");
219var selected = Path.Combine(_context.Project.FullName, ".agents", "skills", "aspire", "SKILL.md");
222await AgentConfigurationTestContext.WriteAsync(Path.Combine(_context.Workspace.Path, ".agents", "skills", "aspire", "SKILL.md"), "ancestor");
224var result = LocalAspireSkills.Find(outside, _context.Project, [_context.OpenCode],
234var path = Path.Combine(_context.Project.FullName, ".agents", "skills", "aspire", "SKILL.md");
236await AgentConfigurationTestContext.WriteAsync(Path.Combine(_context.Project.FullName, ".agents", "skills", "aspireify", "SKILL.md"), "readable");
238var result = Scan([_context.Copilot]);
250LocalAspireSkills.Find(_context.Project, _context.Project, _context.Clients, new CancellationToken(canceled: true)));
251Assert.Empty(_context.Project.EnumerateFileSystemInfos());
252Assert.Empty(_context.Home.EnumerateFileSystemInfos());
256=> LocalAspireSkills.Find(_context.Project, _context.Project, agents, TestContext.Current.CancellationToken);
258public void Dispose() => _context.Dispose();