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>
This commit is contained in:
@@ -4,7 +4,6 @@ import path from 'path';
|
||||
import { afterEach, describe, expect, it } from 'vitest';
|
||||
|
||||
import {
|
||||
buildLaunchdPlist,
|
||||
buildRuntimePathEnv,
|
||||
buildStackRestartSystemdUnit,
|
||||
buildSystemdUnit,
|
||||
@@ -14,61 +13,17 @@ import { getServiceDefs, type ServiceDef } from './service-defs.js';
|
||||
/**
|
||||
* Tests for service configuration generation.
|
||||
*
|
||||
* These tests verify the generated content of plist/systemd/nohup configs
|
||||
* These tests verify the generated content of systemd configs
|
||||
* without actually loading services.
|
||||
*/
|
||||
|
||||
const baseServiceDef: ServiceDef = {
|
||||
kind: 'primary',
|
||||
description: 'EJClaw Personal Assistant',
|
||||
launchdLabel: 'com.ejclaw',
|
||||
logName: 'ejclaw',
|
||||
name: 'ejclaw',
|
||||
};
|
||||
|
||||
describe('plist generation', () => {
|
||||
it('contains the correct label', () => {
|
||||
const plist = buildLaunchdPlist(
|
||||
baseServiceDef,
|
||||
'/home/user/ejclaw',
|
||||
'/usr/local/bin/node',
|
||||
'/home/user',
|
||||
);
|
||||
expect(plist).toContain('<string>com.ejclaw</string>');
|
||||
});
|
||||
|
||||
it('uses the correct node path', () => {
|
||||
const plist = buildLaunchdPlist(
|
||||
baseServiceDef,
|
||||
'/home/user/ejclaw',
|
||||
'/opt/node/bin/node',
|
||||
'/home/user',
|
||||
);
|
||||
expect(plist).toContain('<string>/opt/node/bin/node</string>');
|
||||
});
|
||||
|
||||
it('points to dist/index.js', () => {
|
||||
const plist = buildLaunchdPlist(
|
||||
baseServiceDef,
|
||||
'/home/user/ejclaw',
|
||||
'/usr/local/bin/node',
|
||||
'/home/user',
|
||||
);
|
||||
expect(plist).toContain('/home/user/ejclaw/dist/index.js');
|
||||
});
|
||||
|
||||
it('sets log paths', () => {
|
||||
const plist = buildLaunchdPlist(
|
||||
baseServiceDef,
|
||||
'/home/user/ejclaw',
|
||||
'/usr/local/bin/node',
|
||||
'/home/user',
|
||||
);
|
||||
expect(plist).toContain('ejclaw.log');
|
||||
expect(plist).toContain('ejclaw.error.log');
|
||||
});
|
||||
});
|
||||
|
||||
describe('systemd unit generation', () => {
|
||||
it('shares the runtime PATH builder across service formats', () => {
|
||||
expect(buildRuntimePathEnv('/usr/bin/bun', '/home/user')).toBe(
|
||||
@@ -156,26 +111,6 @@ describe('systemd unit generation', () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe('WSL nohup fallback', () => {
|
||||
it('generates a valid wrapper script', () => {
|
||||
const projectRoot = '/home/user/ejclaw';
|
||||
const nodePath = '/usr/bin/node';
|
||||
const pidFile = path.join(projectRoot, 'ejclaw.pid');
|
||||
|
||||
// Simulate what service.ts generates
|
||||
const wrapper = `#!/bin/bash
|
||||
set -euo pipefail
|
||||
cd ${JSON.stringify(projectRoot)}
|
||||
nohup ${JSON.stringify(nodePath)} ${JSON.stringify(projectRoot)}/dist/index.js >> ${JSON.stringify(projectRoot)}/logs/ejclaw.log 2>> ${JSON.stringify(projectRoot)}/logs/ejclaw.error.log &
|
||||
echo $! > ${JSON.stringify(pidFile)}`;
|
||||
|
||||
expect(wrapper).toContain('#!/bin/bash');
|
||||
expect(wrapper).toContain('nohup');
|
||||
expect(wrapper).toContain(nodePath);
|
||||
expect(wrapper).toContain('ejclaw.pid');
|
||||
});
|
||||
});
|
||||
|
||||
describe('service definitions', () => {
|
||||
const tempRoots: string[] = [];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user