MCPcopy Index your code
hub / github.com/callstack/agent-device / writeCliSession

Function writeCliSession

src/cli/auth-session.ts:296–307  ·  view source on GitHub ↗
(options: { stateDir: string; session: CliSessionRecord })

Source from the content-addressed store, hash-verified

294}
295
296export function writeCliSession(options: { stateDir: string; session: CliSessionRecord }): void {
297 const filePath = resolveCliSessionPath(options.stateDir);
298 fs.mkdirSync(path.dirname(filePath), { recursive: true, mode: 0o700 });
299 fs.writeFileSync(filePath, `${JSON.stringify(options.session, null, 2)}\n`, {
300 mode: 0o600,
301 });
302 try {
303 fs.chmodSync(filePath, 0o600);
304 } catch {
305 // Best effort on filesystems that do not support POSIX mode bits.
306 }
307}
308
309export function removeCliSession(options: { stateDir: string }): boolean {
310 const filePath = resolveCliSessionPath(options.stateDir);

Callers 2

loginWithDeviceAuthFunction · 0.85

Calls 1

resolveCliSessionPathFunction · 0.85

Tested by

no test coverage detected