@rigstate/cli 0.7.18 → 0.7.20
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 +7 -0
- package/.rigstate/rules-cache.json +166 -0
- package/dist/index.cjs +121 -28
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +121 -28
- 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 +33 -21
- 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,44 @@ 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
|
+
// Convert to relative for easier matching
|
|
42
|
+
const relativePath = path.relative(process.cwd(), pathStr);
|
|
43
|
+
const segments = relativePath.split(path.sep);
|
|
44
|
+
|
|
45
|
+
const ignoreDirs = [
|
|
46
|
+
'node_modules', '.git', '.next', '.turbo', 'dist', 'build',
|
|
47
|
+
'.rigstate', 'coverage', 'tmp', 'temp', 'vendor', '.cache',
|
|
48
|
+
'public', 'artifacts', 'out', '.vercel', '.npm', '.agent',
|
|
49
|
+
'.cursor', '.npm-cache', 'backups', 'docs', 'tests', 'tools',
|
|
50
|
+
'scripts', 'supabase'
|
|
51
|
+
];
|
|
52
|
+
|
|
53
|
+
if (segments.some(segment => ignoreDirs.includes(segment))) {
|
|
54
|
+
return true;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
// If it's a file, only watch if it's a code file
|
|
58
|
+
// Directories don't have an extension in our convention for this check
|
|
59
|
+
const isFile = !!path.extname(pathStr);
|
|
60
|
+
if (isFile && !isCodeFile(pathStr)) {
|
|
61
|
+
return true;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
return false;
|
|
65
|
+
},
|
|
55
66
|
persistent: true,
|
|
56
67
|
ignoreInitial: true,
|
|
57
|
-
ignorePermissionErrors: true,
|
|
58
|
-
depth:
|
|
68
|
+
ignorePermissionErrors: true,
|
|
69
|
+
depth: 5, // Strongly reduced for major monorepos
|
|
59
70
|
awaitWriteFinish: {
|
|
60
|
-
stabilityThreshold:
|
|
61
|
-
pollInterval:
|
|
71
|
+
stabilityThreshold: 500, // Increased for stability
|
|
72
|
+
pollInterval: 200
|
|
62
73
|
},
|
|
63
74
|
usePolling: false,
|
|
64
|
-
|
|
75
|
+
followSymlinks: false, // Prevent symlink loops and extra handles
|
|
76
|
+
atomic: true
|
|
65
77
|
});
|
|
66
78
|
|
|
67
79
|
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
|