Skip to content
This repository was archived by the owner on Feb 14, 2026. It is now read-only.

Commit 43c4a7c

Browse files
authored
feat: add HAPPY_DISABLE_CAFFEINATE environment variable (#38)
1 parent c2f4d9b commit 43c4a7c

File tree

3 files changed

+17
-0
lines changed

3 files changed

+17
-0
lines changed

README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,14 @@ This will:
3939
- `--claude-env KEY=VALUE` - Set environment variable for Claude Code
4040
- `--claude-arg ARG` - Pass additional argument to Claude CLI
4141

42+
## Environment Variables
43+
44+
- `HAPPY_SERVER_URL` - Custom server URL (default: https://api.cluster-fluster.com)
45+
- `HAPPY_WEBAPP_URL` - Custom web app URL (default: https://app.happy.engineering)
46+
- `HAPPY_HOME_DIR` - Custom home directory for Happy data (default: ~/.happy)
47+
- `HAPPY_DISABLE_CAFFEINATE` - Disable macOS sleep prevention (set to `true`, `1`, or `yes`)
48+
- `HAPPY_EXPERIMENTAL` - Enable experimental features (set to `true`, `1`, or `yes`)
49+
4250
## Requirements
4351

4452
- Node.js >= 20.0.0

src/configuration.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ class Configuration {
2525
public readonly currentCliVersion: string
2626

2727
public readonly isExperimentalEnabled: boolean
28+
public readonly disableCaffeinate: boolean
2829

2930
constructor() {
3031
// Server configuration - priority: parameter > environment > default
@@ -51,6 +52,7 @@ class Configuration {
5152
this.daemonLockFile = join(this.happyHomeDir, 'daemon.state.json.lock')
5253

5354
this.isExperimentalEnabled = ['true', '1', 'yes'].includes(process.env.HAPPY_EXPERIMENTAL?.toLowerCase() || '');
55+
this.disableCaffeinate = ['true', '1', 'yes'].includes(process.env.HAPPY_DISABLE_CAFFEINATE?.toLowerCase() || '');
5456

5557
this.currentCliVersion = packageJson.version
5658

src/utils/caffeinate.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
import { spawn, ChildProcess } from 'child_process'
77
import { logger } from '@/ui/logger'
8+
import { configuration } from '@/configuration'
89

910
let caffeinateProcess: ChildProcess | null = null
1011

@@ -15,6 +16,12 @@ let caffeinateProcess: ChildProcess | null = null
1516
* @returns true if caffeinate was started, false otherwise
1617
*/
1718
export function startCaffeinate(): boolean {
19+
// Check if caffeinate is disabled via configuration
20+
if (configuration.disableCaffeinate) {
21+
logger.debug('[caffeinate] Caffeinate disabled via HAPPY_DISABLE_CAFFEINATE environment variable')
22+
return false
23+
}
24+
1825
// Only run on macOS
1926
if (process.platform !== 'darwin') {
2027
logger.debug('[caffeinate] Not on macOS, skipping caffeinate')

0 commit comments

Comments
 (0)