@rigstate/cli 0.7.19 → 0.7.21
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/daemon.pid +1 -1
- package/.rigstate/daemon.state.json +3 -3
- package/.rigstate/guardian.lock +4 -2
- package/.rigstate/rules-cache.json +1 -1
- package/dist/index.cjs +23 -7
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +23 -7
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/daemon/core.ts +6 -0
- package/src/daemon/file-watcher.ts +12 -5
package/package.json
CHANGED
package/src/daemon/core.ts
CHANGED
|
@@ -19,6 +19,7 @@ import { createBridgeListener, type BridgeListenerEvents } from './bridge-listen
|
|
|
19
19
|
import { DaemonConfig, DaemonState } from './types.js';
|
|
20
20
|
import { trackSkillUsage } from './telemetry.js';
|
|
21
21
|
import { jitProvisionSkill } from '../utils/skills-provisioner.js';
|
|
22
|
+
import { syncProjectRules } from '../commands/sync-rules.js';
|
|
22
23
|
|
|
23
24
|
export class GuardianDaemon extends EventEmitter {
|
|
24
25
|
private config: DaemonConfig;
|
|
@@ -60,6 +61,11 @@ export class GuardianDaemon extends EventEmitter {
|
|
|
60
61
|
// 2. Load and Sync Rules
|
|
61
62
|
await this.guardianMonitor.loadRules();
|
|
62
63
|
console.log(chalk.green(` ✓ Loaded ${this.guardianMonitor.getRuleCount()} rules`));
|
|
64
|
+
|
|
65
|
+
// Auto-Sync Brain to IDE (The "Missing Link")
|
|
66
|
+
console.log(chalk.dim('🧠 Syncing Brain to IDE (.cursor/rules)...'));
|
|
67
|
+
await syncProjectRules(this.config.projectId, this.config.apiKey, this.config.apiUrl);
|
|
68
|
+
|
|
63
69
|
await this.syncHeuristics();
|
|
64
70
|
|
|
65
71
|
// 3. Setup File Watcher
|
|
@@ -38,11 +38,16 @@ export function createFileWatcher(watchPath: string): FileWatcher {
|
|
|
38
38
|
watcher = chokidar.watch(absolutePath, {
|
|
39
39
|
ignored: (pathStr) => {
|
|
40
40
|
// Ignore clearly non-code directories and heavy assets
|
|
41
|
-
|
|
41
|
+
// Convert to relative for easier matching
|
|
42
|
+
const relativePath = path.relative(process.cwd(), pathStr);
|
|
43
|
+
const segments = relativePath.split(path.sep);
|
|
44
|
+
|
|
42
45
|
const ignoreDirs = [
|
|
43
46
|
'node_modules', '.git', '.next', '.turbo', 'dist', 'build',
|
|
44
47
|
'.rigstate', 'coverage', 'tmp', 'temp', 'vendor', '.cache',
|
|
45
|
-
'public', 'artifacts', 'out', '.vercel', '.npm'
|
|
48
|
+
'public', 'artifacts', 'out', '.vercel', '.npm', '.agent',
|
|
49
|
+
'.cursor', '.npm-cache', 'backups', 'docs', 'tests', 'tools',
|
|
50
|
+
'scripts', 'supabase'
|
|
46
51
|
];
|
|
47
52
|
|
|
48
53
|
if (segments.some(segment => ignoreDirs.includes(segment))) {
|
|
@@ -50,6 +55,7 @@ export function createFileWatcher(watchPath: string): FileWatcher {
|
|
|
50
55
|
}
|
|
51
56
|
|
|
52
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
|
|
53
59
|
const isFile = !!path.extname(pathStr);
|
|
54
60
|
if (isFile && !isCodeFile(pathStr)) {
|
|
55
61
|
return true;
|
|
@@ -60,12 +66,13 @@ export function createFileWatcher(watchPath: string): FileWatcher {
|
|
|
60
66
|
persistent: true,
|
|
61
67
|
ignoreInitial: true,
|
|
62
68
|
ignorePermissionErrors: true,
|
|
63
|
-
depth:
|
|
69
|
+
depth: 5, // Strongly reduced for major monorepos
|
|
64
70
|
awaitWriteFinish: {
|
|
65
|
-
stabilityThreshold:
|
|
66
|
-
pollInterval:
|
|
71
|
+
stabilityThreshold: 500, // Increased for stability
|
|
72
|
+
pollInterval: 200
|
|
67
73
|
},
|
|
68
74
|
usePolling: false,
|
|
75
|
+
followSymlinks: false, // Prevent symlink loops and extra handles
|
|
69
76
|
atomic: true
|
|
70
77
|
});
|
|
71
78
|
|