Skip to content

Commit 370488d

Browse files
authored
Merge pull request #23 from varalys/fix/daemon-init-check
fix: daemon exits gracefully if lore init has not been run
2 parents 8c1204a + 9e2728e commit 370488d

File tree

2 files changed

+16
-3
lines changed

2 files changed

+16
-3
lines changed

.github/workflows/release.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -149,10 +149,8 @@ jobs:
149149
150150
def caveats
151151
<<~EOS
152-
Run this first to configure lore:
152+
To get started, run:
153153
lore init
154-
155-
The background service will not work until lore init has been run.
156154
EOS
157155
end
158156

src/daemon/mod.rs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ use tokio::signal;
3232
use tokio::sync::{oneshot, RwLock};
3333
use tracing_appender::non_blocking::WorkerGuard;
3434

35+
use crate::config::Config;
36+
3537
pub use server::{send_command_sync, DaemonCommand, DaemonResponse};
3638
pub use state::{DaemonState, DaemonStats};
3739
pub use watcher::SessionWatcher;
@@ -63,6 +65,19 @@ pub async fn run_daemon() -> Result<()> {
6365
);
6466
}
6567

68+
// Check if lore has been initialized
69+
let config_path = Config::config_path()?;
70+
if !config_path.exists() {
71+
anyhow::bail!(
72+
"Lore has not been initialized.\n\n\
73+
Run 'lore init' first to:\n \
74+
- Select which AI tools to watch\n \
75+
- Configure your machine identity\n \
76+
- Import existing sessions\n\n\
77+
Then start the daemon with 'lore daemon start' or let init do it for you."
78+
);
79+
}
80+
6681
// Set up file logging
6782
let _guard = setup_logging(&state)?;
6883

0 commit comments

Comments
 (0)