MCPcopy
hub / github.com/codeaashu/claude-code / ensureSession

Function ensureSession

src/tools/shared/spawnMultiAgent.ts:171–186  ·  view source on GitHub ↗

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

(sessionName: string)

Source from the content-addressed store, hash-verified

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

Callers 1

Calls 2

hasSessionFunction · 0.85
execFileNoThrowFunction · 0.85

Tested by

no test coverage detected