mirror of
https://github.com/anthropics/claude-code-action.git
synced 2026-01-24 07:24:12 +08:00
feat: simplify to two modes (tag and agent) for v1.0
BREAKING CHANGES: - Remove review mode entirely - now handled via slash commands in agent mode - Remove all deprecated backward compatibility fields (mode, anthropic_model, override_prompt, direct_prompt) - Simplify mode detection: prompt overrides everything, then @claude mentions trigger tag mode, default is agent mode - Remove slash command resolution from GitHub Action - Claude Code handles natively - Remove variable substitution - prompts passed through as-is Architecture changes: - Only two modes now: tag (for @claude mentions) and agent (everything else) - Agent mode is the default for all events including PRs - Users configure behavior via prompts/slash commands (e.g. /review) - GitHub Action is now a thin wrapper that passes prompts to Claude Code - Mode names changed: 'experimental-review' → removed entirely This aligns with the philosophy that the GitHub Action should do minimal work and delegate to Claude Code for all intelligent behavior.
This commit is contained in:
@@ -1,24 +1,20 @@
|
||||
import type { GitHubContext } from "../github/context";
|
||||
import {
|
||||
isEntityContext,
|
||||
isAutomationContext,
|
||||
isPullRequestEvent,
|
||||
isIssueCommentEvent,
|
||||
isPullRequestReviewCommentEvent,
|
||||
} from "../github/context";
|
||||
import { checkContainsTrigger } from "../github/validation/trigger";
|
||||
|
||||
export type AutoDetectedMode = "review" | "tag" | "agent";
|
||||
export type AutoDetectedMode = "tag" | "agent";
|
||||
|
||||
export function detectMode(context: GitHubContext): AutoDetectedMode {
|
||||
if (isPullRequestEvent(context)) {
|
||||
const allowedActions = ["opened", "synchronize", "reopened"];
|
||||
const action = context.payload.action;
|
||||
if (allowedActions.includes(action)) {
|
||||
return "review";
|
||||
}
|
||||
// If prompt is provided, always use agent mode
|
||||
if (context.inputs?.prompt) {
|
||||
return "agent";
|
||||
}
|
||||
|
||||
// Check for @claude mentions (tag mode)
|
||||
if (isEntityContext(context)) {
|
||||
if (
|
||||
isIssueCommentEvent(context) ||
|
||||
@@ -36,21 +32,16 @@ export function detectMode(context: GitHubContext): AutoDetectedMode {
|
||||
}
|
||||
}
|
||||
|
||||
if (isAutomationContext(context)) {
|
||||
return "agent";
|
||||
}
|
||||
|
||||
// Default to agent mode for everything else
|
||||
return "agent";
|
||||
}
|
||||
|
||||
export function getModeDescription(mode: AutoDetectedMode): string {
|
||||
switch (mode) {
|
||||
case "review":
|
||||
return "Automated code review mode for pull requests";
|
||||
case "tag":
|
||||
return "Interactive mode triggered by @claude mentions";
|
||||
case "agent":
|
||||
return "Automation mode for scheduled tasks and workflows";
|
||||
return "General automation mode for all events";
|
||||
default:
|
||||
return "Unknown mode";
|
||||
}
|
||||
@@ -65,12 +56,10 @@ export function getDefaultPromptForMode(
|
||||
context: GitHubContext,
|
||||
): string | undefined {
|
||||
switch (mode) {
|
||||
case "review":
|
||||
return "/review";
|
||||
case "tag":
|
||||
return undefined;
|
||||
case "agent":
|
||||
return context.inputs?.directPrompt || context.inputs?.overridePrompt;
|
||||
return context.inputs?.prompt;
|
||||
default:
|
||||
return undefined;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user