Merge pull request #12 from defunkt/claude/auto-start-app-on-push-zklQA

Add app startup handling in activate endpoint
This commit is contained in:
Chris Wanstrath 2026-02-12 08:46:10 -08:00 committed by GitHub
commit ee9c4a1d0a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1,4 +1,4 @@
import { APPS_DIR, allApps, registerApp, removeApp, restartApp } from '$apps' import { APPS_DIR, allApps, registerApp, removeApp, restartApp, startApp } from '$apps'
import { computeHash, generateManifest } from '../sync' import { computeHash, generateManifest } from '../sync'
import { loadGitignore } from '@gitignore' import { loadGitignore } from '@gitignore'
import { cpSync, existsSync, mkdirSync, readdirSync, readFileSync, realpathSync, renameSync, rmSync, symlinkSync, unlinkSync, watch, writeFileSync } from 'fs' import { cpSync, existsSync, mkdirSync, readdirSync, readFileSync, realpathSync, renameSync, rmSync, symlinkSync, unlinkSync, watch, writeFileSync } from 'fs'
@ -329,6 +329,9 @@ router.post('/apps/:app/activate', async c => {
} catch (e) { } catch (e) {
return c.json({ error: `Failed to restart app: ${e instanceof Error ? e.message : String(e)}` }, 500) return c.json({ error: `Failed to restart app: ${e instanceof Error ? e.message : String(e)}` }, 500)
} }
} else if (app.state === 'stopped' || app.state === 'invalid') {
// App not running (possibly due to error) - try to start it
startApp(appName)
} }
return c.json({ ok: true }) return c.json({ ok: true })