| 515 | previousOffset |
| 516 | ); |
| 517 | if (portOffset !== originalOffset) |
| 518 | console.log(`${DIM}Auto-selected port offset ${portOffset}${RESET}`); |
| 519 | // Persist before tmux or any service exists: a killed partial startup still |
| 520 | // leaves every later command on the ports the children inherited. |
| 521 | writePersistedPortOffset(repoRoot, portOffset); |
| 522 | removeStaleComposeProject(repoRoot, previousOffset); |
| 523 | } |
| 524 | |
| 525 | process.env.KILO_PORT_OFFSET = String(portOffset); |
| 526 | |
| 527 | // After the offset is final: Compose and the app env must name the same |
| 528 | // database. An offset worktree runs its own containers on its own ports. |
| 529 | for (const line of syncInfraEnv(repoRoot)) console.log(`${DIM}${line}${RESET}`); |
| 530 | |
| 531 | // Repeated bundle setup calls reuse a complete stack without refreshing |
| 532 | // secrets or restarting live panes. |
| 533 | if (sessionAlreadyRunning && reuseRunning) { |
| 534 | const manifest = readManifest(repoRoot); |
| 535 | const missing = await missingRunningServices(manifest, sessionName, serviceNames, { |