fix(cli): harden install integration checks

Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
DottaandPaperclip committed 2026-07-27 15:32:13 +00:00
1 parent 1c5b6c1caf
commit 8354cecede
4 files changed
+27 -6

No files matched your search

+4 -1
View File
@@ -100,7 +100,10 @@ export async function serviceHealthChecks(
},
);
const expectedVersion = readInstallManifest()?.version ?? null;
let expectedVersion: string | null = null;
try {
expectedVersion = readInstallManifest()?.version ?? null;
} catch {}
results.push(
!health.ok
? {
+11
View File
@@ -14,6 +14,7 @@ export type OnboardServiceOptions = {
type OnboardServiceDependencies = {
detect: (instanceId: string) => Promise<ServiceManagerDetection>;
confirm: () => Promise<boolean>;
confirmLinger: () => Promise<boolean>;
isInteractive: () => boolean;
info: (message: string) => void;
success: (message: string) => void;
@@ -29,6 +30,13 @@ const defaultDependencies: OnboardServiceDependencies = {
});
return !p.isCancel(answer) && answer === true;
},
confirmLinger: async () => {
const answer = await p.confirm({
message: "Allow Paperclip to keep running after logout? This may request system authorization.",
initialValue: false,
});
return !p.isCancel(answer) && answer === true;
},
isInteractive: () => process.stdin.isTTY === true && process.stdout.isTTY === true,
info: (message) => p.log.message(pc.dim(message)),
success: (message) => p.log.success(message),
@@ -61,6 +69,9 @@ export async function handleOnboardService(
if (!explicitlyRequested && !(await deps.confirm())) return false;
await detection.manager.install({ startNow: true, startOnLogin: true });
if (!explicitlyRequested && detection.manager.enableLinger && await deps.confirmLinger()) {
await detection.manager.enableLinger();
}
deps.success(`Installed and started ${detection.manager.serviceName}.`);
return true;
}