@rigstate/cli 0.7.18 → 0.7.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.rigstate/cache/heuristics.json +79 -0
- package/.rigstate/daemon.pid +1 -0
- package/.rigstate/daemon.state.json +8 -0
- package/.rigstate/guardian.lock +5 -0
- package/.rigstate/rules-cache.json +166 -0
- package/dist/index.cjs +106 -26
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +106 -26
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/commands/daemon.ts +16 -5
- package/src/daemon/file-watcher.ts +24 -19
- package/src/index.ts +1 -2
package/package.json
CHANGED
package/src/commands/daemon.ts
CHANGED
|
@@ -56,11 +56,22 @@ export function createDaemonCommand(): Command {
|
|
|
56
56
|
const spinner = ora();
|
|
57
57
|
|
|
58
58
|
try {
|
|
59
|
-
// Check if already running
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
59
|
+
// Check if already running - be silent if it's just a stale PID file
|
|
60
|
+
const pidPath = path.join(process.cwd(), PID_FILE);
|
|
61
|
+
try {
|
|
62
|
+
const content = await fs.readFile(pidPath, 'utf-8');
|
|
63
|
+
const pid = parseInt(content.trim(), 10);
|
|
64
|
+
try {
|
|
65
|
+
process.kill(pid, 0);
|
|
66
|
+
// If we get here, the process is actually running
|
|
67
|
+
console.log(chalk.yellow('⚠ Another daemon instance is active (PID ' + pid + ').'));
|
|
68
|
+
console.log(chalk.dim(` Run "rigstate daemon status" for details or Ctrl+C to stop.\n`));
|
|
69
|
+
} catch {
|
|
70
|
+
// Process is dead, cleanup stale file silently
|
|
71
|
+
await fs.unlink(pidPath).catch(() => { });
|
|
72
|
+
}
|
|
73
|
+
} catch {
|
|
74
|
+
// No PID file, all good
|
|
64
75
|
}
|
|
65
76
|
|
|
66
77
|
// Create daemon
|
|
@@ -36,32 +36,37 @@ export function createFileWatcher(watchPath: string): FileWatcher {
|
|
|
36
36
|
const absolutePath = path.resolve(process.cwd(), watchPath);
|
|
37
37
|
|
|
38
38
|
watcher = chokidar.watch(absolutePath, {
|
|
39
|
-
ignored:
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
'
|
|
53
|
-
|
|
54
|
-
|
|
39
|
+
ignored: (pathStr) => {
|
|
40
|
+
// Ignore clearly non-code directories and heavy assets
|
|
41
|
+
const segments = pathStr.split(path.sep);
|
|
42
|
+
const ignoreDirs = [
|
|
43
|
+
'node_modules', '.git', '.next', '.turbo', 'dist', 'build',
|
|
44
|
+
'.rigstate', 'coverage', 'tmp', 'temp', 'vendor', '.cache',
|
|
45
|
+
'public', 'artifacts', 'out', '.vercel', '.npm'
|
|
46
|
+
];
|
|
47
|
+
|
|
48
|
+
if (segments.some(segment => ignoreDirs.includes(segment))) {
|
|
49
|
+
return true;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
// If it's a file, only watch if it's a code file
|
|
53
|
+
const isFile = !!path.extname(pathStr);
|
|
54
|
+
if (isFile && !isCodeFile(pathStr)) {
|
|
55
|
+
return true;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
return false;
|
|
59
|
+
},
|
|
55
60
|
persistent: true,
|
|
56
61
|
ignoreInitial: true,
|
|
57
|
-
ignorePermissionErrors: true,
|
|
58
|
-
depth: 20
|
|
62
|
+
ignorePermissionErrors: true,
|
|
63
|
+
depth: 10, // Reduced from 20 for large monorepos
|
|
59
64
|
awaitWriteFinish: {
|
|
60
65
|
stabilityThreshold: 300,
|
|
61
66
|
pollInterval: 100
|
|
62
67
|
},
|
|
63
68
|
usePolling: false,
|
|
64
|
-
atomic: true
|
|
69
|
+
atomic: true
|
|
65
70
|
});
|
|
66
71
|
|
|
67
72
|
watcher.on('change', (filePath: string) => {
|
package/src/index.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { createRequire } from 'module';
|
|
2
1
|
import { Command } from 'commander';
|
|
3
2
|
import chalk from 'chalk';
|
|
4
3
|
import { createLoginCommand } from './commands/login.js';
|
|
@@ -26,7 +25,7 @@ import { createCouncilCommand } from './commands/council.js';
|
|
|
26
25
|
import { checkVersion } from './utils/version.js';
|
|
27
26
|
import dotenv from 'dotenv';
|
|
28
27
|
|
|
29
|
-
|
|
28
|
+
// @ts-ignore - 'require' is injected by tsup banner
|
|
30
29
|
const pkg = require('../package.json');
|
|
31
30
|
|
|
32
31
|
// Load environment variables
|