fix: remove process.cwd() fallback for working directory in chat route
The chat route and claude-client both fell back to process.cwd() when working_directory was empty, causing Claude to operate in the server's directory instead of the user's project. Since session creation now requires a valid working_directory, these fallbacks are unnecessary and misleading. Fall back to os.homedir() as a safer last resort. Also update CLAUDE.md: require explicit user confirmation before publishing releases (no auto push+tag). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
1 parent
01e7e0c1e3
commit
6aca8c3870
3 files changed
+6
-2
No files matched your search
@@ -32,7 +32,7 @@ export async function POST(request: NextRequest) {
|
||||
let savedContent = content;
|
||||
let fileMeta: Array<{ id: string; name: string; type: string; size: number; filePath: string }> | undefined;
|
||||
if (files && files.length > 0) {
|
||||
const workDir = session.working_directory || process.cwd();
|
||||
const workDir = session.working_directory;
|
||||
const uploadDir = path.join(workDir, '.codepilot-uploads');
|
||||
if (!fs.existsSync(uploadDir)) {
|
||||
fs.mkdirSync(uploadDir, { recursive: true });
|
||||
|
||||
@@ -316,7 +316,7 @@ export function streamClaude(options: ClaudeStreamOptions): ReadableStream<strin
|
||||
const skipPermissions = getSetting('dangerously_skip_permissions') === 'true';
|
||||
|
||||
const queryOptions: Options = {
|
||||
cwd: workingDirectory || process.cwd(),
|
||||
cwd: workingDirectory || os.homedir(),
|
||||
abortController,
|
||||
includePartialMessages: true,
|
||||
permissionMode: skipPermissions
|
||||
|
||||
Reference in new issue
Block a user