MCPcopy Create free account
hub / github.com/AnukarOP/claude-code-leaked / ensureSession

Function ensureSession

source code/tools/shared/spawnMultiAgent.ts:173–188  ·  view source on GitHub ↗

* Creates a new tmux session if it doesn't exist

(sessionName: string)

Source from the content-addressed store, hash-verified

171 * Creates a new tmux session if it doesn't exist
172 */
173async function ensureSession(sessionName: string): Promise<void> {
174 const exists = await hasSession(sessionName)
175 if (!exists) {
176 const result = await execFileNoThrow(TMUX_COMMAND, [
177 'new-session',
178 '-d',
179 '-s',
180 sessionName,
181 ])
182 if (result.code !== 0) {
183 throw new Error(
184 `Failed to create tmux session '${sessionName}': ${result.stderr || 'Unknown error'}`,
185 )
186 }
187 }
188}
189
190/**
191 * Gets the command to spawn a teammate.

Callers 1

Calls 2

hasSessionFunction · 0.85
execFileNoThrowFunction · 0.85

Tested by

no test coverage detected