Files
EJClaw/setup/service-defs.ts
Codex e999ce9a33 refactor: drop macOS launchd and nohup service install paths
The service only runs under Linux systemd. Remove setupLaunchd,
setupNohupFallback, buildLaunchdPlist, the launchd/nohup service checks
in setup/verify-services.ts, ServiceDef.launchdLabel, launchd/ and the
unused repo-tokens/ GitHub action. Without systemd, `setup --step
service` now fails with systemd_unavailable instead of writing a nohup
wrapper.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-01 19:10:19 +09:00

63 lines
1.5 KiB
TypeScript

export type ServiceKind = 'primary';
export interface ServiceDef {
/** Stable topology kind used by setup/verify logic */
kind: ServiceKind;
/** systemd unit name */
name: string;
/** Human-readable description for systemd */
description: string;
/** Log file prefix (e.g. "ejclaw" → logs/ejclaw.log) */
logName: string;
/** Absolute path to EnvironmentFile (systemd) — loaded before Environment= */
environmentFile?: string;
/** Extra Environment= lines for systemd */
extraEnv?: Record<string, string>;
}
interface ServiceTemplate {
kind: ServiceKind;
name: string;
description: string;
logName: string;
}
const CURRENT_SERVICE_TEMPLATES: ServiceTemplate[] = [
{
kind: 'primary',
name: 'ejclaw',
description: 'EJClaw Personal Assistant (Claude Code)',
logName: 'ejclaw',
},
];
function materializeServiceDef(template: ServiceTemplate): ServiceDef {
const environmentFile = undefined;
const extraEnv =
template.kind === 'primary'
? {
EJCLAW_UNSAFE_HOST_PAIRED_MODE: '1',
}
: undefined;
return {
kind: template.kind,
name: template.name,
description: template.description,
logName: template.logName,
environmentFile,
extraEnv,
};
}
export function getServiceDefs(projectRoot: string): ServiceDef[] {
void projectRoot;
return CURRENT_SERVICE_TEMPLATES.map((template) =>
materializeServiceDef(template),
);
}
export function getConfiguredServiceNames(projectRoot: string): string[] {
return getServiceDefs(projectRoot).map((def) => def.name);
}