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:
@@ -40,9 +40,7 @@ export function acquireLock(): () => void {
|
||||
} catch {
|
||||
// Lock file exists — check if it's stale or from a dead process
|
||||
try {
|
||||
const existing: LockInfo = JSON.parse(
|
||||
fs.readFileSync(lockPath, 'utf-8'),
|
||||
);
|
||||
const existing: LockInfo = JSON.parse(fs.readFileSync(lockPath, 'utf-8'));
|
||||
if (!isStale(existing) && isProcessAlive(existing.pid)) {
|
||||
throw new Error(
|
||||
`Operation in progress (pid ${existing.pid}, started ${new Date(existing.timestamp).toISOString()}). If this is stale, delete ${LOCK_FILE}`,
|
||||
@@ -59,11 +57,17 @@ export function acquireLock(): () => void {
|
||||
// Corrupt or unreadable — overwrite
|
||||
}
|
||||
|
||||
try { fs.unlinkSync(lockPath); } catch { /* already gone */ }
|
||||
try {
|
||||
fs.unlinkSync(lockPath);
|
||||
} catch {
|
||||
/* already gone */
|
||||
}
|
||||
try {
|
||||
fs.writeFileSync(lockPath, JSON.stringify(lockInfo), { flag: 'wx' });
|
||||
} catch {
|
||||
throw new Error('Lock contention: another process acquired the lock. Retry.');
|
||||
throw new Error(
|
||||
'Lock contention: another process acquired the lock. Retry.',
|
||||
);
|
||||
}
|
||||
return () => releaseLock();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user