fix: pass cwd to sendMessage so Claude knows the project directory on resume
This commit is contained in:
@@ -29,7 +29,7 @@ export function createMessageHandler(
|
||||
await ctx.replyWithChatAction("typing");
|
||||
|
||||
// Run Claude call without blocking the bot's event loop
|
||||
claude.sendMessage(text, session.sessionId).then(async (result) => {
|
||||
claude.sendMessage(text, session.sessionId, session.cwd).then(async (result) => {
|
||||
const response = result || "(empty response)";
|
||||
const chunks = splitMessage(response);
|
||||
for (const chunk of chunks) {
|
||||
|
||||
@@ -59,10 +59,10 @@ export class ClaudeService {
|
||||
};
|
||||
}
|
||||
|
||||
async sendMessage(prompt: string, sessionId: string): Promise<string> {
|
||||
async sendMessage(prompt: string, sessionId: string, cwd: string): Promise<string> {
|
||||
const raw = await runClaude(
|
||||
["-p", prompt, "--output-format", "json", "--resume", sessionId, "--dangerously-skip-permissions", "--append-system-prompt", APPEND_PROMPT],
|
||||
process.cwd(),
|
||||
cwd,
|
||||
);
|
||||
|
||||
const parsed = JSON.parse(raw.trim().split("\n").pop()!) as CliJsonResult;
|
||||
|
||||
Reference in New Issue
Block a user