1
0
Fork 0
mirror of https://github.com/nix-community/home-manager.git synced 2025-11-08 11:36:05 +01:00

tests/opencode: expand tests for agents / commands

Include various tests for the agents and command file generation and
different ways of configuring it.

Signed-off-by: Austin Horstman <khaneliman12@gmail.com>
This commit is contained in:
Austin Horstman 2025-09-16 21:29:05 -05:00
parent c104ee92bf
commit 53538044d9
12 changed files with 160 additions and 0 deletions

View file

@ -0,0 +1,37 @@
{
programs.opencode = {
enable = true;
agents = {
code-reviewer = ''
# Code Reviewer Agent
You are a senior software engineer specializing in code reviews.
Focus on code quality, security, and maintainability.
## Guidelines
- Review for potential bugs and edge cases
- Check for security vulnerabilities
- Ensure code follows best practices
- Suggest improvements for readability and performance'';
documentation = ''
# Documentation Agent
You are a technical writer who creates clear, comprehensive documentation.
Focus on user-friendly explanations and examples.
## Guidelines
- Write clear, concise documentation
- Include practical examples
- Use proper formatting and structure
- Consider the target audience'';
};
};
nmt.script = ''
assertFileExists home-files/.config/opencode/agent/code-reviewer.md
assertFileExists home-files/.config/opencode/agent/documentation.md
assertFileContent home-files/.config/opencode/agent/code-reviewer.md \
${./code-reviewer-agent.md}
assertFileContent home-files/.config/opencode/agent/documentation.md \
${./documentation-agent.md}
'';
}

View file

@ -0,0 +1,13 @@
{
programs.opencode = {
enable = true;
agents = {
test-agent = ./test-agent.md;
};
};
nmt.script = ''
assertFileExists home-files/.config/opencode/agent/test-agent.md
assertFileContent home-files/.config/opencode/agent/test-agent.md \
${./test-agent.md}
'';
}

View file

@ -0,0 +1,4 @@
# Update Changelog Command
Update CHANGELOG.md with a new entry for the specified version.
Usage: /changelog [version] [change-type] [message]

View file

@ -0,0 +1,10 @@
# Code Reviewer Agent
You are a senior software engineer specializing in code reviews.
Focus on code quality, security, and maintainability.
## Guidelines
- Review for potential bugs and edge cases
- Check for security vulnerabilities
- Ensure code follows best practices
- Suggest improvements for readability and performance

View file

@ -0,0 +1,25 @@
{
programs.opencode = {
enable = true;
commands = {
changelog = ''
# Update Changelog Command
Update CHANGELOG.md with a new entry for the specified version.
Usage: /changelog [version] [change-type] [message]'';
commit = ''
# Commit Command
Create a git commit with proper message formatting.
Usage: /commit [message]'';
};
};
nmt.script = ''
assertFileExists home-files/.config/opencode/command/changelog.md
assertFileExists home-files/.config/opencode/command/commit.md
assertFileContent home-files/.config/opencode/command/changelog.md \
${./changelog-command.md}
assertFileContent home-files/.config/opencode/command/commit.md \
${./commit-command.md}
'';
}

View file

@ -0,0 +1,13 @@
{
programs.opencode = {
enable = true;
commands = {
test-command = ./test-command.md;
};
};
nmt.script = ''
assertFileExists home-files/.config/opencode/command/test-command.md
assertFileContent home-files/.config/opencode/command/test-command.md \
${./test-command.md}
'';
}

View file

@ -0,0 +1,4 @@
# Commit Command
Create a git commit with proper message formatting.
Usage: /commit [message]

View file

@ -3,4 +3,9 @@
opencode-empty-settings = ./empty-settings.nix;
opencode-rules = ./rules.nix;
opencode-empty-rules = ./empty-rules.nix;
opencode-agents-inline = ./agents-inline.nix;
opencode-commands-inline = ./commands-inline.nix;
opencode-agents-path = ./agents-path.nix;
opencode-commands-path = ./commands-path.nix;
opencode-mixed-content = ./mixed-content.nix;
}

View file

@ -0,0 +1,10 @@
# Documentation Agent
You are a technical writer who creates clear, comprehensive documentation.
Focus on user-friendly explanations and examples.
## Guidelines
- Write clear, concise documentation
- Include practical examples
- Use proper formatting and structure
- Consider the target audience

View file

@ -0,0 +1,30 @@
{
programs.opencode = {
enable = true;
commands = {
inline-command = ''
# Inline Command
This command is defined inline.
'';
path-command = ./test-command.md;
};
agents = {
inline-agent = ''
# Inline Agent
This agent is defined inline.
'';
path-agent = ./test-agent.md;
};
};
nmt.script = ''
assertFileExists home-files/.config/opencode/command/inline-command.md
assertFileExists home-files/.config/opencode/command/path-command.md
assertFileExists home-files/.config/opencode/agent/inline-agent.md
assertFileExists home-files/.config/opencode/agent/path-agent.md
assertFileContent home-files/.config/opencode/command/path-command.md \
${./test-command.md}
assertFileContent home-files/.config/opencode/agent/path-agent.md \
${./test-agent.md}
'';
}

View file

@ -0,0 +1,4 @@
# Test Agent
This is a test agent loaded from a file path.
Used to verify path support functionality.

View file

@ -0,0 +1,5 @@
# Test Command
This is a test command loaded from a file path.
Used to verify path support functionality.
Usage: /test-command