mirror of
https://github.com/anthropics/claude-code-action.git
synced 2026-01-22 22:44:13 +08:00
feat: add getSystemPrompt method to mode interface (#400)
Allows modes to provide custom system prompts that are appended to Claude's base system prompt. This enables mode-specific instructions without modifying the core action logic. - Add optional getSystemPrompt method to Mode interface - Implement method in all existing modes (tag, agent, review) - Update prepare.ts to call getSystemPrompt and export as env var - Wire up APPEND_SYSTEM_PROMPT in action.yml to pass to base-action All modes currently return undefined (no additional prompts), but the infrastructure is now in place for future modes to provide custom instructions.
This commit is contained in:
@@ -112,4 +112,9 @@ export const agentMode: Mode = {
|
||||
// Minimal fallback - repository is a string in PreparedContext
|
||||
return `Repository: ${context.repository}`;
|
||||
},
|
||||
|
||||
getSystemPrompt() {
|
||||
// Agent mode doesn't need additional system prompts
|
||||
return undefined;
|
||||
},
|
||||
};
|
||||
|
||||
@@ -349,4 +349,10 @@ This ensures users get value from the review even before checking individual inl
|
||||
mcpConfig,
|
||||
};
|
||||
},
|
||||
|
||||
getSystemPrompt() {
|
||||
// Review mode doesn't need additional system prompts
|
||||
// The review-specific instructions are included in the main prompt
|
||||
return undefined;
|
||||
},
|
||||
};
|
||||
|
||||
@@ -130,4 +130,9 @@ export const tagMode: Mode = {
|
||||
): string {
|
||||
return generateDefaultPrompt(context, githubData, useCommitSigning);
|
||||
},
|
||||
|
||||
getSystemPrompt() {
|
||||
// Tag mode doesn't need additional system prompts
|
||||
return undefined;
|
||||
},
|
||||
};
|
||||
|
||||
@@ -73,6 +73,13 @@ export type Mode = {
|
||||
* @returns PrepareResult with commentId, branchInfo, and mcpConfig
|
||||
*/
|
||||
prepare(options: ModeOptions): Promise<ModeResult>;
|
||||
|
||||
/**
|
||||
* Returns an optional system prompt to append to Claude's base system prompt.
|
||||
* This allows modes to add mode-specific instructions.
|
||||
* @returns The system prompt string or undefined if no additional prompt is needed
|
||||
*/
|
||||
getSystemPrompt?(context: ModeContext): string | undefined;
|
||||
};
|
||||
|
||||
// Define types for mode prepare method
|
||||
|
||||
Reference in New Issue
Block a user