refactor: CI optimization, logging improvements, and codebase formatting (#456)
* fix(db): remove unique constraint on folder to support multi-channel agents * ci: implement automated skill drift detection and self-healing PRs * fix: align registration logic with Gavriel's feedback and fix build/test issues from Daniel Mi * style: conform to prettier standards for CI validation * test: fix branch naming inconsistency in CI (master vs main) * fix(ci): robust module resolution by removing file extensions in scripts * refactor(ci): simplify skill validation by removing redundant combination tests * style: conform skills-engine to prettier, unify logging in index.ts and cleanup unused imports * refactor: extract multi-channel DB changes to separate branch Move channel column, folder suffix logic, and related migrations to feat/multi-channel-db-v2 for independent review. This PR now contains only CI/CD optimizations, Prettier formatting, and logging improvements. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -68,8 +68,17 @@ export async function run(_args: string[]): Promise<void> {
|
||||
}
|
||||
}
|
||||
|
||||
function setupLaunchd(projectRoot: string, nodePath: string, homeDir: string): void {
|
||||
const plistPath = path.join(homeDir, 'Library', 'LaunchAgents', 'com.nanoclaw.plist');
|
||||
function setupLaunchd(
|
||||
projectRoot: string,
|
||||
nodePath: string,
|
||||
homeDir: string,
|
||||
): void {
|
||||
const plistPath = path.join(
|
||||
homeDir,
|
||||
'Library',
|
||||
'LaunchAgents',
|
||||
'com.nanoclaw.plist',
|
||||
);
|
||||
fs.mkdirSync(path.dirname(plistPath), { recursive: true });
|
||||
|
||||
const plist = `<?xml version="1.0" encoding="UTF-8"?>
|
||||
@@ -107,7 +116,9 @@ function setupLaunchd(projectRoot: string, nodePath: string, homeDir: string): v
|
||||
logger.info({ plistPath }, 'Wrote launchd plist');
|
||||
|
||||
try {
|
||||
execSync(`launchctl load ${JSON.stringify(plistPath)}`, { stdio: 'ignore' });
|
||||
execSync(`launchctl load ${JSON.stringify(plistPath)}`, {
|
||||
stdio: 'ignore',
|
||||
});
|
||||
logger.info('launchctl load succeeded');
|
||||
} catch {
|
||||
logger.warn('launchctl load failed (may already be loaded)');
|
||||
@@ -133,7 +144,11 @@ function setupLaunchd(projectRoot: string, nodePath: string, homeDir: string): v
|
||||
});
|
||||
}
|
||||
|
||||
function setupLinux(projectRoot: string, nodePath: string, homeDir: string): void {
|
||||
function setupLinux(
|
||||
projectRoot: string,
|
||||
nodePath: string,
|
||||
homeDir: string,
|
||||
): void {
|
||||
const serviceManager = getServiceManager();
|
||||
|
||||
if (serviceManager === 'systemd') {
|
||||
@@ -186,7 +201,11 @@ function checkDockerGroupStale(): boolean {
|
||||
}
|
||||
}
|
||||
|
||||
function setupSystemd(projectRoot: string, nodePath: string, homeDir: string): void {
|
||||
function setupSystemd(
|
||||
projectRoot: string,
|
||||
nodePath: string,
|
||||
homeDir: string,
|
||||
): void {
|
||||
const runningAsRoot = isRoot();
|
||||
|
||||
// Root uses system-level service, non-root uses user-level
|
||||
@@ -202,7 +221,9 @@ function setupSystemd(projectRoot: string, nodePath: string, homeDir: string): v
|
||||
try {
|
||||
execSync('systemctl --user daemon-reload', { stdio: 'pipe' });
|
||||
} catch {
|
||||
logger.warn('systemd user session not available — falling back to nohup wrapper');
|
||||
logger.warn(
|
||||
'systemd user session not available — falling back to nohup wrapper',
|
||||
);
|
||||
setupNohupFallback(projectRoot, nodePath, homeDir);
|
||||
return;
|
||||
}
|
||||
@@ -284,7 +305,11 @@ WantedBy=${runningAsRoot ? 'multi-user.target' : 'default.target'}`;
|
||||
});
|
||||
}
|
||||
|
||||
function setupNohupFallback(projectRoot: string, nodePath: string, homeDir: string): void {
|
||||
function setupNohupFallback(
|
||||
projectRoot: string,
|
||||
nodePath: string,
|
||||
homeDir: string,
|
||||
): void {
|
||||
logger.warn('No systemd detected — generating nohup wrapper script');
|
||||
|
||||
const wrapperPath = path.join(projectRoot, 'start-nanoclaw.sh');
|
||||
|
||||
Reference in New Issue
Block a user