feat: system service management (gyandoot service install|remove|status)

- Create systemd + launchd service templates in resources/
- Add gyandoot-core/src/service.rs module with full lifecycle
  - systemd: user service, daemon-reload, enable, start, stop, disable
  - launchd: macOS plist, load/unload, start/stop (launchctl)
- Add 'gyandoot service install|remove|status' CLI subcommand
- Update setup wizard: prompts 'Install system service? [y/N]'
- Update install.sh: prompts user for service install after binary
- Browser auto-starts at runtime (browser_manager), no separate service needed
- Camoufox installed via npm, auto-started by GyanDoot agent loop
This commit is contained in:
2026-06-11 23:23:49 +05:30
parent f2d612bd28
commit b2650a569c
8 changed files with 615 additions and 83 deletions

View File

@@ -333,6 +333,40 @@ pub fn run_setup_wizard() -> anyhow::Result<Option<WizardResult>> {
&format!("Configuration saved to {}", config_path.display()),
);
// Step 7: Optional service install
println!();
terminal::section_header("System Service");
println!(" GyanDoot can run as a system service and auto-start on boot.");
println!(" This keeps the gateway server running in the background.");
let install_service = terminal::confirm_prompt(
"Install GyanDoot system service (auto-start on boot)?",
Some(false),
);
if install_service {
terminal::show_status(
terminal::StatusKind::Info,
"Installing system service...",
);
match gyandoot_core::service::install_service() {
Ok(status) => {
terminal::show_status(
terminal::StatusKind::Success,
&format!("Service installed! (init: {})", status.init_system),
);
}
Err(e) => {
terminal::show_status(
terminal::StatusKind::Warning,
&format!("Could not install service: {}", e),
);
println!(" You can install later with: gyandoot service install");
}
}
} else {
println!(" You can install later with: gyandoot service install");
}
Ok(Some(WizardResult {
provider: choice,
config,