MCPcopy Create free account
hub / github.com/RioArisk/claudecode_api_RemoteControl / trustProjectCwd

Function trustProjectCwd

lib/pty-manager.js:40–67  ·  view source on GitHub ↗
(cwd)

Source from the content-addressed store, hash-verified

38}
39
40function trustProjectCwd(cwd) {
41 const resolved = path.resolve(String(cwd || ''));
42 if (!resolved) return;
43
44 let stateData = {};
45 try {
46 stateData = JSON.parse(fs.readFileSync(CLAUDE_STATE_FILE, 'utf8'));
47 } catch {}
48
49 stateData.projects = stateData.projects && typeof stateData.projects === 'object' ? stateData.projects : {};
50 const keyVariants = process.platform === 'win32'
51 ? [resolved, resolved.replace(/\\/g, '/')]
52 : [resolved];
53
54 for (const projectKey of keyVariants) {
55 const existing = stateData.projects[projectKey];
56 stateData.projects[projectKey] = {
57 ...(existing && typeof existing === 'object' ? existing : {}),
58 hasTrustDialogAccepted: true,
59 projectOnboardingSeenCount: Number.isInteger(existing?.projectOnboardingSeenCount)
60 ? existing.projectOnboardingSeenCount
61 : 0,
62 };
63 }
64
65 fs.writeFileSync(CLAUDE_STATE_FILE, JSON.stringify(stateData, null, 2));
66 log(`Trusted Claude project cwd: ${resolved}`);
67}
68
69function spawnClaude() {
70 const isWin = process.platform === 'win32';

Callers 1

restartClaudeFunction · 0.85

Calls 1

logFunction · 0.85

Tested by

no test coverage detected