mirror of
https://github.com/nix-community/home-manager.git
synced 2025-11-08 19:46: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:
parent
c104ee92bf
commit
53538044d9
12 changed files with 160 additions and 0 deletions
37
tests/modules/programs/opencode/agents-inline.nix
Normal file
37
tests/modules/programs/opencode/agents-inline.nix
Normal 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}
|
||||||
|
'';
|
||||||
|
}
|
||||||
13
tests/modules/programs/opencode/agents-path.nix
Normal file
13
tests/modules/programs/opencode/agents-path.nix
Normal 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}
|
||||||
|
'';
|
||||||
|
}
|
||||||
4
tests/modules/programs/opencode/changelog-command.md
Normal file
4
tests/modules/programs/opencode/changelog-command.md
Normal 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]
|
||||||
10
tests/modules/programs/opencode/code-reviewer-agent.md
Normal file
10
tests/modules/programs/opencode/code-reviewer-agent.md
Normal 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
|
||||||
25
tests/modules/programs/opencode/commands-inline.nix
Normal file
25
tests/modules/programs/opencode/commands-inline.nix
Normal 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}
|
||||||
|
'';
|
||||||
|
}
|
||||||
13
tests/modules/programs/opencode/commands-path.nix
Normal file
13
tests/modules/programs/opencode/commands-path.nix
Normal 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}
|
||||||
|
'';
|
||||||
|
}
|
||||||
4
tests/modules/programs/opencode/commit-command.md
Normal file
4
tests/modules/programs/opencode/commit-command.md
Normal file
|
|
@ -0,0 +1,4 @@
|
||||||
|
# Commit Command
|
||||||
|
|
||||||
|
Create a git commit with proper message formatting.
|
||||||
|
Usage: /commit [message]
|
||||||
|
|
@ -3,4 +3,9 @@
|
||||||
opencode-empty-settings = ./empty-settings.nix;
|
opencode-empty-settings = ./empty-settings.nix;
|
||||||
opencode-rules = ./rules.nix;
|
opencode-rules = ./rules.nix;
|
||||||
opencode-empty-rules = ./empty-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;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
10
tests/modules/programs/opencode/documentation-agent.md
Normal file
10
tests/modules/programs/opencode/documentation-agent.md
Normal 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
|
||||||
30
tests/modules/programs/opencode/mixed-content.nix
Normal file
30
tests/modules/programs/opencode/mixed-content.nix
Normal 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}
|
||||||
|
'';
|
||||||
|
}
|
||||||
4
tests/modules/programs/opencode/test-agent.md
Normal file
4
tests/modules/programs/opencode/test-agent.md
Normal file
|
|
@ -0,0 +1,4 @@
|
||||||
|
# Test Agent
|
||||||
|
|
||||||
|
This is a test agent loaded from a file path.
|
||||||
|
Used to verify path support functionality.
|
||||||
5
tests/modules/programs/opencode/test-command.md
Normal file
5
tests/modules/programs/opencode/test-command.md
Normal 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
|
||||||
Loading…
Add table
Add a link
Reference in a new issue