@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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rigstate/cli",
3
- "version": "0.7.18",
3
+ "version": "0.7.19",
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,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
- '**/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
+ 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, // Don't crash on EPERM
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 // Handle atomic writes (like vim/saving) better
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
- 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