mirror of
https://github.com/anthropics/claude-code-action.git
synced 2026-01-23 06:54:13 +08:00
* feat: add slash command shipping infrastructure - Created /slash-commands/ directory to store bundled slash commands - Added code-review.md slash command for automated PR reviews - Modified setup-claude-code-settings.ts to copy slash commands to ~/.claude/ - Added test coverage for slash command installation - Commands are automatically installed when the GitHub Action runs * fix: simplify slash command implementation to match codebase patterns - Reverted to using Bun's $ shell syntax consistently with the rest of the codebase - Simplified slash command copying to basic shell commands - Removed unnecessary fs/promises complexity - Maintained all functionality and test coverage - More appropriate for GitHub Action context where inputs are trusted * remove test slash command * fix: rename slash_commands_dir to experimental_slash_commands_dir - Added 'experimental' prefix as suggested by Ashwin - Updated all references in action.yml and base-action - Restored accidentally removed code-review.md file --------- Co-authored-by: km-anthropic <km-anthropic@users.noreply.github.com>
45 lines
1.3 KiB
TypeScript
45 lines
1.3 KiB
TypeScript
#!/usr/bin/env bun
|
|
|
|
import * as core from "@actions/core";
|
|
import { preparePrompt } from "./prepare-prompt";
|
|
import { runClaude } from "./run-claude";
|
|
import { setupClaudeCodeSettings } from "./setup-claude-code-settings";
|
|
import { validateEnvironmentVariables } from "./validate-env";
|
|
|
|
async function run() {
|
|
try {
|
|
validateEnvironmentVariables();
|
|
|
|
await setupClaudeCodeSettings(
|
|
process.env.INPUT_SETTINGS,
|
|
undefined, // homeDir
|
|
process.env.INPUT_EXPERIMENTAL_SLASH_COMMANDS_DIR,
|
|
);
|
|
|
|
const promptConfig = await preparePrompt({
|
|
prompt: process.env.INPUT_PROMPT || "",
|
|
promptFile: process.env.INPUT_PROMPT_FILE || "",
|
|
});
|
|
|
|
await runClaude(promptConfig.path, {
|
|
allowedTools: process.env.INPUT_ALLOWED_TOOLS,
|
|
disallowedTools: process.env.INPUT_DISALLOWED_TOOLS,
|
|
maxTurns: process.env.INPUT_MAX_TURNS,
|
|
mcpConfig: process.env.INPUT_MCP_CONFIG,
|
|
systemPrompt: process.env.INPUT_SYSTEM_PROMPT,
|
|
appendSystemPrompt: process.env.INPUT_APPEND_SYSTEM_PROMPT,
|
|
claudeEnv: process.env.INPUT_CLAUDE_ENV,
|
|
fallbackModel: process.env.INPUT_FALLBACK_MODEL,
|
|
model: process.env.ANTHROPIC_MODEL,
|
|
});
|
|
} catch (error) {
|
|
core.setFailed(`Action failed with error: ${error}`);
|
|
core.setOutput("conclusion", "failure");
|
|
process.exit(1);
|
|
}
|
|
}
|
|
|
|
if (import.meta.main) {
|
|
run();
|
|
}
|