mirror of
https://github.com/anthropics/claude-code-action.git
synced 2026-01-23 23:14:13 +08:00
Compare commits
3 Commits
v1.0.29
...
ashwin/deb
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5940655715 | ||
|
|
0c4374199a | ||
|
|
c67fb66a79 |
@@ -101,7 +101,7 @@ export function parseSdkOptions(options: ClaudeOptions): ParsedSdkOptions {
|
|||||||
env.GITHUB_ACTION_INPUTS = process.env.INPUT_ACTION_INPUTS_PRESENT;
|
env.GITHUB_ACTION_INPUTS = process.env.INPUT_ACTION_INPUTS_PRESENT;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Build system prompt option
|
// Build system prompt option - default to claude_code preset
|
||||||
let systemPrompt: SdkOptions["systemPrompt"];
|
let systemPrompt: SdkOptions["systemPrompt"];
|
||||||
if (options.systemPrompt) {
|
if (options.systemPrompt) {
|
||||||
systemPrompt = options.systemPrompt;
|
systemPrompt = options.systemPrompt;
|
||||||
@@ -111,6 +111,12 @@ export function parseSdkOptions(options: ClaudeOptions): ParsedSdkOptions {
|
|||||||
preset: "claude_code",
|
preset: "claude_code",
|
||||||
append: options.appendSystemPrompt,
|
append: options.appendSystemPrompt,
|
||||||
};
|
};
|
||||||
|
} else {
|
||||||
|
// Default to claude_code preset when no custom prompt is specified
|
||||||
|
systemPrompt = {
|
||||||
|
type: "preset",
|
||||||
|
preset: "claude_code",
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
// Build SDK options - use merged tools from both direct options and claudeArgs
|
// Build SDK options - use merged tools from both direct options and claudeArgs
|
||||||
@@ -130,6 +136,9 @@ export function parseSdkOptions(options: ClaudeOptions): ParsedSdkOptions {
|
|||||||
// Note: allowedTools and disallowedTools have been removed from extraArgs to prevent duplicates
|
// Note: allowedTools and disallowedTools have been removed from extraArgs to prevent duplicates
|
||||||
extraArgs,
|
extraArgs,
|
||||||
env,
|
env,
|
||||||
|
|
||||||
|
// Load settings from all sources to pick up CLI-installed plugins, CLAUDE.md, etc.
|
||||||
|
settingSources: ["user", "project", "local"],
|
||||||
};
|
};
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|||||||
@@ -75,12 +75,28 @@ export async function runClaudeWithSdk(
|
|||||||
}
|
}
|
||||||
|
|
||||||
console.log(`Running Claude with prompt from file: ${promptPath}`);
|
console.log(`Running Claude with prompt from file: ${promptPath}`);
|
||||||
|
console.log(
|
||||||
|
"[DEBUG] Prompt content (first 2000 chars):",
|
||||||
|
prompt.substring(0, 2000),
|
||||||
|
);
|
||||||
|
console.log("[DEBUG] Prompt length:", prompt.length);
|
||||||
|
console.log(
|
||||||
|
"[DEBUG] sdkOptions passed to query():",
|
||||||
|
JSON.stringify(sdkOptions, null, 2),
|
||||||
|
);
|
||||||
|
|
||||||
const messages: SDKMessage[] = [];
|
const messages: SDKMessage[] = [];
|
||||||
let resultMessage: SDKResultMessage | undefined;
|
let resultMessage: SDKResultMessage | undefined;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
console.log("[DEBUG] About to call query()...");
|
||||||
for await (const message of query({ prompt, options: sdkOptions })) {
|
for await (const message of query({ prompt, options: sdkOptions })) {
|
||||||
|
console.log(
|
||||||
|
"[DEBUG] Received message type:",
|
||||||
|
message.type,
|
||||||
|
"subtype:",
|
||||||
|
(message as any).subtype,
|
||||||
|
);
|
||||||
messages.push(message);
|
messages.push(message);
|
||||||
|
|
||||||
const sanitized = sanitizeSdkOutput(message, showFullOutput);
|
const sanitized = sanitizeSdkOutput(message, showFullOutput);
|
||||||
@@ -90,8 +106,16 @@ export async function runClaudeWithSdk(
|
|||||||
|
|
||||||
if (message.type === "result") {
|
if (message.type === "result") {
|
||||||
resultMessage = message as SDKResultMessage;
|
resultMessage = message as SDKResultMessage;
|
||||||
|
console.log(
|
||||||
|
"[DEBUG] Got result message:",
|
||||||
|
JSON.stringify(resultMessage, null, 2),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
console.log(
|
||||||
|
"[DEBUG] Finished iterating query(), total messages:",
|
||||||
|
messages.length,
|
||||||
|
);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error("SDK execution error:", error);
|
console.error("SDK execution error:", error);
|
||||||
core.setOutput("conclusion", "failure");
|
core.setOutput("conclusion", "failure");
|
||||||
|
|||||||
@@ -174,7 +174,15 @@ export async function runClaude(promptPath: string, options: ClaudeOptions) {
|
|||||||
);
|
);
|
||||||
|
|
||||||
if (useAgentSdk) {
|
if (useAgentSdk) {
|
||||||
|
console.log(
|
||||||
|
"[DEBUG] Raw options passed to SDK path:",
|
||||||
|
JSON.stringify(options, null, 2),
|
||||||
|
);
|
||||||
const parsedOptions = parseSdkOptions(options);
|
const parsedOptions = parseSdkOptions(options);
|
||||||
|
console.log(
|
||||||
|
"[DEBUG] Parsed SDK options:",
|
||||||
|
JSON.stringify(parsedOptions, null, 2),
|
||||||
|
);
|
||||||
return runClaudeWithSdk(promptPath, parsedOptions);
|
return runClaudeWithSdk(promptPath, parsedOptions);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user