@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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rigstate/cli",
3
- "version": "0.7.18",
3
+ "version": "0.7.20",
4
4
  "description": "Rigstate CLI - Code audit, sync and supervision tool",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -56,11 +56,22 @@ export function createDaemonCommand(): Command {
56
56
  const spinner = ora();
57
57
 
58
58
  try {
59
- // Check if already running
60
- if (await isRunning()) {
61
- console.log(chalk.yellow('⚠ Another daemon instance may be running.'));
62
- console.log(chalk.dim(` Check ${PID_FILE} or run "rigstate daemon status"`));
63
- console.log(chalk.dim(' Use Ctrl+C to stop the running daemon first.\n'));
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
- '**/node_modules/**',
41
- '**/.git/**',
42
- '**/.next/**',
43
- '**/.turbo/**',
44
- '**/dist/**',
45
- '**/build/**',
46
- '**/.rigstate/**',
47
- '**/coverage/**',
48
- '**/.DS_Store',
49
- '**/tmp/**',
50
- '**/temp/**',
51
- '**/vendor/**',
52
- '**/.cache/**',
53
- '**/public/**'
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, // Don't crash on EPERM
58
- depth: 20,
68
+ ignorePermissionErrors: true,
69
+ depth: 5, // Strongly reduced for major monorepos
59
70
  awaitWriteFinish: {
60
- stabilityThreshold: 300,
61
- pollInterval: 100
71
+ stabilityThreshold: 500, // Increased for stability
72
+ pollInterval: 200
62
73
  },
63
74
  usePolling: false,
64
- atomic: true // Handle atomic writes (like vim/saving) better
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
- const require = createRequire(import.meta.url);
28
+ // @ts-ignore - 'require' is injected by tsup banner
30
29
  const pkg = require('../package.json');
31
30
 
32
31
  // Load environment variables