feat: add claudeArgs input for direct CLI argument passing

- Add claude_args input to action.yml for flexible CLI control
- Parse arguments with industry-standard shell-quote library
- Maintain proper argument order: -p [claudeArgs] [legacy] [BASE_ARGS]
- Keep tag mode defaults (needed for functionality)
- Agent mode has no defaults (full user control)
- Add comprehensive tests for new functionality
- Add example workflow showing usage
This commit is contained in:
km-anthropic
2025-08-07 15:45:17 -07:00
parent e2bdca6133
commit a7759cfcd1
5 changed files with 156 additions and 101 deletions

View File

@@ -58,28 +58,15 @@ export const agentMode: Mode = {
promptContent,
);
// Export tool environment variables for agent mode
const baseTools = [
"Edit",
"MultiEdit",
"Glob",
"Grep",
"LS",
"Read",
"Write",
];
// Add user-specified tools
const allowedTools = [...baseTools, ...context.inputs.allowedTools];
const disallowedTools = [
"WebSearch",
"WebFetch",
...context.inputs.disallowedTools,
];
// Export as INPUT_ prefixed variables for the base action
core.exportVariable("INPUT_ALLOWED_TOOLS", allowedTools.join(","));
core.exportVariable("INPUT_DISALLOWED_TOOLS", disallowedTools.join(","));
// Agent mode: User has full control via claudeArgs or legacy inputs
// No default tools are enforced - Claude Code's defaults will apply
// Export user-specified tools only if provided
if (context.inputs.allowedTools.length > 0) {
core.exportVariable("INPUT_ALLOWED_TOOLS", context.inputs.allowedTools.join(","));
}
if (context.inputs.disallowedTools.length > 0) {
core.exportVariable("INPUT_DISALLOWED_TOOLS", context.inputs.disallowedTools.join(","));
}
// Agent mode uses a minimal MCP configuration
// We don't need comment servers or PR-specific tools for automation