mirror of
https://github.com/nix-community/home-manager.git
synced 2025-12-18 06:51:10 +01:00
opencode: path support for agents/commands
Support paths for the commands/agents since we are linking files. Signed-off-by: Austin Horstman <khaneliman12@gmail.com>
This commit is contained in:
parent
d7686f26e8
commit
c104ee92bf
1 changed files with 44 additions and 52 deletions
|
|
@ -80,45 +80,47 @@ in
|
||||||
};
|
};
|
||||||
|
|
||||||
commands = lib.mkOption {
|
commands = lib.mkOption {
|
||||||
type = lib.types.attrsOf lib.types.lines;
|
type = lib.types.attrsOf (lib.types.either lib.types.lines lib.types.path);
|
||||||
default = { };
|
default = { };
|
||||||
description = ''
|
description = ''
|
||||||
Custom commands for opencode.
|
Custom commands for opencode.
|
||||||
The attribute name becomes the command filename, and the value is the file content.
|
The attribute name becomes the command filename, and the value is either:
|
||||||
|
- Inline content as a string
|
||||||
|
- A path to a file containing the command content
|
||||||
Commands are stored in ~/.config/opencode/command/ directory.
|
Commands are stored in ~/.config/opencode/command/ directory.
|
||||||
'';
|
'';
|
||||||
example = {
|
example = lib.literalExpression ''
|
||||||
changelog = ''
|
{
|
||||||
|
changelog = '''
|
||||||
# Update Changelog Command
|
# Update Changelog Command
|
||||||
|
|
||||||
Update CHANGELOG.md with a new entry for the specified version.
|
Update CHANGELOG.md with a new entry for the specified version.
|
||||||
Usage: /changelog [version] [change-type] [message]
|
Usage: /changelog [version] [change-type] [message]
|
||||||
'';
|
''';
|
||||||
fix-issue = ''
|
fix-issue = ./commands/fix-issue.md;
|
||||||
# Fix Issue Command
|
commit = '''
|
||||||
|
|
||||||
Fix a GitHub issue following coding standards.
|
|
||||||
Usage: /fix-issue [issue-number]
|
|
||||||
'';
|
|
||||||
commit = ''
|
|
||||||
# Commit Command
|
# Commit Command
|
||||||
|
|
||||||
Create a git commit with proper message formatting.
|
Create a git commit with proper message formatting.
|
||||||
Usage: /commit [message]
|
Usage: /commit [message]
|
||||||
|
''';
|
||||||
|
}
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
};
|
|
||||||
|
|
||||||
agents = lib.mkOption {
|
agents = lib.mkOption {
|
||||||
type = lib.types.attrsOf lib.types.lines;
|
type = lib.types.attrsOf (lib.types.either lib.types.lines lib.types.path);
|
||||||
default = { };
|
default = { };
|
||||||
description = ''
|
description = ''
|
||||||
Custom agents for opencode.
|
Custom agents for opencode.
|
||||||
The attribute name becomes the agent filename, and the value is the file content.
|
The attribute name becomes the agent filename, and the value is either:
|
||||||
|
- Inline content as a string
|
||||||
|
- A path to a file containing the agent content
|
||||||
Agents are stored in ~/.config/opencode/agent/ directory.
|
Agents are stored in ~/.config/opencode/agent/ directory.
|
||||||
'';
|
'';
|
||||||
example = {
|
example = lib.literalExpression ''
|
||||||
code-reviewer = ''
|
{
|
||||||
|
code-reviewer = '''
|
||||||
# Code Reviewer Agent
|
# Code Reviewer Agent
|
||||||
|
|
||||||
You are a senior software engineer specializing in code reviews.
|
You are a senior software engineer specializing in code reviews.
|
||||||
|
|
@ -129,20 +131,10 @@ in
|
||||||
- Check for security vulnerabilities
|
- Check for security vulnerabilities
|
||||||
- Ensure code follows best practices
|
- Ensure code follows best practices
|
||||||
- Suggest improvements for readability and performance
|
- Suggest improvements for readability and performance
|
||||||
|
''';
|
||||||
|
documentation = ./agents/documentation.md;
|
||||||
|
}
|
||||||
'';
|
'';
|
||||||
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
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
@ -166,15 +158,15 @@ in
|
||||||
}
|
}
|
||||||
// lib.mapAttrs' (
|
// lib.mapAttrs' (
|
||||||
name: content:
|
name: content:
|
||||||
lib.nameValuePair "opencode/command/${name}.md" {
|
lib.nameValuePair "opencode/command/${name}.md" (
|
||||||
text = content;
|
if lib.isPath content then { source = content; } else { text = content; }
|
||||||
}
|
)
|
||||||
) cfg.commands
|
) cfg.commands
|
||||||
// lib.mapAttrs' (
|
// lib.mapAttrs' (
|
||||||
name: content:
|
name: content:
|
||||||
lib.nameValuePair "opencode/agent/${name}.md" {
|
lib.nameValuePair "opencode/agent/${name}.md" (
|
||||||
text = content;
|
if lib.isPath content then { source = content; } else { text = content; }
|
||||||
}
|
)
|
||||||
) cfg.agents;
|
) cfg.agents;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue