diff --git a/src/modes/detector.ts b/src/modes/detector.ts index 92d1fed..5b9b7cd 100644 --- a/src/modes/detector.ts +++ b/src/modes/detector.ts @@ -44,6 +44,10 @@ export function detectMode(context: GitHubContext): AutoDetectedMode { // Issue events if (isEntityContext(context) && isIssuesEvent(context)) { + // If prompt is provided, use agent mode (same as PR events) + if (context.inputs.prompt) { + return "agent"; + } // Check for @claude mentions or labels/assignees if (checkContainsTrigger(context)) { return "tag"; diff --git a/tests/modes/detector.test.ts b/tests/modes/detector.test.ts index 6cbbcb3..39f5d14 100644 --- a/tests/modes/detector.test.ts +++ b/tests/modes/detector.test.ts @@ -113,6 +113,33 @@ describe("detectMode with enhanced routing", () => { expect(detectMode(context)).toBe("agent"); }); + + it("should use agent mode for issues with explicit prompt", () => { + const context: GitHubContext = { + ...baseContext, + eventName: "issues", + eventAction: "opened", + payload: { issue: { number: 1, body: "Test issue" } } as any, + entityNumber: 1, + isPR: false, + inputs: { ...baseContext.inputs, prompt: "Analyze this issue" }, + }; + + expect(detectMode(context)).toBe("agent"); + }); + + it("should use tag mode for issues with @claude mention and no prompt", () => { + const context: GitHubContext = { + ...baseContext, + eventName: "issues", + eventAction: "opened", + payload: { issue: { number: 1, body: "@claude help" } } as any, + entityNumber: 1, + isPR: false, + }; + + expect(detectMode(context)).toBe("tag"); + }); }); describe("Comment Events (unchanged behavior)", () => {