chore(setup): minimize verify diff
This commit is contained in:
@@ -16,7 +16,12 @@ import { readEnvFile } from '../src/env.js';
|
||||
import { log } from '../src/log.js';
|
||||
import { pingCliAgent, type PingResult } from './lib/agent-ping.js';
|
||||
import { getLaunchdLabel, getSystemdUnit } from '../src/install-slug.js';
|
||||
import { getPlatform, getServiceManager, hasSystemd, isRoot } from './platform.js';
|
||||
import {
|
||||
getPlatform,
|
||||
getServiceManager,
|
||||
hasSystemd,
|
||||
isRoot,
|
||||
} from './platform.js';
|
||||
import { emitStatus } from './status.js';
|
||||
|
||||
export async function run(_args: string[]): Promise<void> {
|
||||
@@ -33,7 +38,11 @@ export async function run(_args: string[]): Promise<void> {
|
||||
// a sibling checkout (common for developers with multiple clones), this
|
||||
// repo's `data/cli.sock` won't exist — AGENT_PING would return a
|
||||
// misleading `socket_error`. Surface the mismatch directly instead.
|
||||
let service: 'not_found' | 'stopped' | 'running' | 'running_other_checkout' = 'not_found';
|
||||
let service:
|
||||
| 'not_found'
|
||||
| 'stopped'
|
||||
| 'running'
|
||||
| 'running_other_checkout' = 'not_found';
|
||||
let runningFromPath: string | null = null;
|
||||
const mgr = getServiceManager();
|
||||
|
||||
@@ -65,7 +74,10 @@ export async function run(_args: string[]): Promise<void> {
|
||||
execSync(`${prefix} is-active ${systemdUnit}`, { stdio: 'ignore' });
|
||||
service = 'running';
|
||||
try {
|
||||
const pidStr = execSync(`${prefix} show ${systemdUnit} -p MainPID --value`, { encoding: 'utf-8' }).trim();
|
||||
const pidStr = execSync(
|
||||
`${prefix} show ${systemdUnit} -p MainPID --value`,
|
||||
{ encoding: 'utf-8' },
|
||||
).trim();
|
||||
const pid = Number(pidStr);
|
||||
if (Number.isInteger(pid) && pid > 0) {
|
||||
runningFromPath = resolveBinaryScript(pid);
|
||||
@@ -103,7 +115,11 @@ export async function run(_args: string[]): Promise<void> {
|
||||
}
|
||||
}
|
||||
|
||||
if (service === 'running' && runningFromPath && !isPathInside(runningFromPath, projectRoot)) {
|
||||
if (
|
||||
service === 'running' &&
|
||||
runningFromPath &&
|
||||
!isPathInside(runningFromPath, projectRoot)
|
||||
) {
|
||||
service = 'running_other_checkout';
|
||||
}
|
||||
|
||||
@@ -194,7 +210,11 @@ export async function run(_args: string[]): Promise<void> {
|
||||
|
||||
// 6. Check mount allowlist
|
||||
let mountAllowlist = 'missing';
|
||||
if (fs.existsSync(path.join(homeDir, '.config', 'nanoclaw', 'mount-allowlist.json'))) {
|
||||
if (
|
||||
fs.existsSync(
|
||||
path.join(homeDir, '.config', 'nanoclaw', 'mount-allowlist.json'),
|
||||
)
|
||||
) {
|
||||
mountAllowlist = 'configured';
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user