@rayburst/cli 0.4.9 → 0.4.11
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.
|
@@ -1977,6 +1977,7 @@ function generateChangeHistoryEntry(diff, trigger, gitCommitHash, newPlanData) {
|
|
|
1977
1977
|
import chalk2 from "chalk";
|
|
1978
1978
|
import * as fs3 from "fs";
|
|
1979
1979
|
import * as path5 from "path";
|
|
1980
|
+
import chokidar from "chokidar";
|
|
1980
1981
|
function rayburstPlugin(options = {}) {
|
|
1981
1982
|
const {
|
|
1982
1983
|
enabled = process.env.CI !== "true",
|
|
@@ -1988,6 +1989,7 @@ function rayburstPlugin(options = {}) {
|
|
|
1988
1989
|
let isAnalyzing = false;
|
|
1989
1990
|
let lastGitState = null;
|
|
1990
1991
|
let gitPollInterval = null;
|
|
1992
|
+
let fileWatcher = null;
|
|
1991
1993
|
const checkGitState = (projectPath) => {
|
|
1992
1994
|
try {
|
|
1993
1995
|
const gitDir = path5.join(projectPath, ".git");
|
|
@@ -2099,28 +2101,56 @@ function rayburstPlugin(options = {}) {
|
|
|
2099
2101
|
console.log(chalk2.blue("[Rayburst] Starting code analysis..."));
|
|
2100
2102
|
await runAnalysis();
|
|
2101
2103
|
},
|
|
2102
|
-
// Hook 3: Watch for changes using
|
|
2104
|
+
// Hook 3: Watch for changes using dedicated Chokidar watcher
|
|
2103
2105
|
configureServer(server) {
|
|
2104
2106
|
if (!enabled) return;
|
|
2107
|
+
console.log(chalk2.blue("[Rayburst] Configuring file watcher..."));
|
|
2105
2108
|
const handleFileChange = (filePath) => {
|
|
2109
|
+
console.log(chalk2.gray(`[Rayburst] Raw file event: ${filePath}`));
|
|
2106
2110
|
if (!filePath.match(/\.(ts|tsx|js|jsx)$/)) {
|
|
2111
|
+
console.log(chalk2.gray(`[Rayburst] Skipping (not TS/JS): ${filePath}`));
|
|
2107
2112
|
return;
|
|
2108
2113
|
}
|
|
2109
2114
|
if (filePath.includes("node_modules") || filePath.includes(".rayburst") || filePath.includes(".test.") || filePath.includes(".spec.")) {
|
|
2115
|
+
console.log(chalk2.gray(`[Rayburst] Skipping (filtered): ${filePath}`));
|
|
2110
2116
|
return;
|
|
2111
2117
|
}
|
|
2118
|
+
console.log(chalk2.yellow(`[Rayburst] Accepted file change: ${filePath}`));
|
|
2112
2119
|
if (debounceTimer) {
|
|
2113
2120
|
clearTimeout(debounceTimer);
|
|
2114
2121
|
}
|
|
2115
2122
|
debounceTimer = setTimeout(() => {
|
|
2116
2123
|
const relativePath = filePath.replace(config.root, "").replace(/^\//, "");
|
|
2117
|
-
console.log(chalk2.dim(`[Rayburst] File changed: ${relativePath}`));
|
|
2124
|
+
console.log(chalk2.dim(`[Rayburst] File changed (after debounce): ${relativePath}`));
|
|
2118
2125
|
runAnalysis(filePath);
|
|
2119
2126
|
}, debounceMs);
|
|
2120
2127
|
};
|
|
2121
|
-
|
|
2122
|
-
|
|
2123
|
-
|
|
2128
|
+
const srcPath = path5.join(config.root, "src");
|
|
2129
|
+
if (fs3.existsSync(srcPath)) {
|
|
2130
|
+
console.log(chalk2.blue("[Rayburst] Creating dedicated file watcher..."));
|
|
2131
|
+
fileWatcher = chokidar.watch(srcPath, {
|
|
2132
|
+
ignored: [
|
|
2133
|
+
"**/node_modules/**",
|
|
2134
|
+
"**/.rayburst/**",
|
|
2135
|
+
"**/*.test.*",
|
|
2136
|
+
"**/*.spec.*",
|
|
2137
|
+
"**/.git/**"
|
|
2138
|
+
],
|
|
2139
|
+
persistent: true,
|
|
2140
|
+
ignoreInitial: true,
|
|
2141
|
+
awaitWriteFinish: {
|
|
2142
|
+
stabilityThreshold: 100,
|
|
2143
|
+
pollInterval: 100
|
|
2144
|
+
}
|
|
2145
|
+
});
|
|
2146
|
+
fileWatcher.on("ready", () => {
|
|
2147
|
+
console.log(chalk2.green("[Rayburst] File watcher is ready and monitoring changes"));
|
|
2148
|
+
});
|
|
2149
|
+
fileWatcher.on("change", handleFileChange);
|
|
2150
|
+
fileWatcher.on("add", handleFileChange);
|
|
2151
|
+
fileWatcher.on("unlink", handleFileChange);
|
|
2152
|
+
console.log(chalk2.dim(`[Rayburst] Watching directory: ${srcPath}`));
|
|
2153
|
+
}
|
|
2124
2154
|
const gitHeadPath = path5.join(config.root, ".git", "HEAD");
|
|
2125
2155
|
if (fs3.existsSync(gitHeadPath)) {
|
|
2126
2156
|
server.watcher.add(gitHeadPath);
|
|
@@ -2140,9 +2170,9 @@ function rayburstPlugin(options = {}) {
|
|
|
2140
2170
|
}, 5e3);
|
|
2141
2171
|
}
|
|
2142
2172
|
return () => {
|
|
2143
|
-
|
|
2144
|
-
|
|
2145
|
-
|
|
2173
|
+
if (fileWatcher) {
|
|
2174
|
+
fileWatcher.close();
|
|
2175
|
+
}
|
|
2146
2176
|
if (debounceTimer) {
|
|
2147
2177
|
clearTimeout(debounceTimer);
|
|
2148
2178
|
}
|
package/dist/index.js
CHANGED
package/dist/vite-plugin.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rayburst/cli",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.11",
|
|
4
4
|
"description": "Rayburst - Automatic code analysis for TypeScript/JavaScript projects via Vite plugin",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -42,8 +42,9 @@
|
|
|
42
42
|
}
|
|
43
43
|
},
|
|
44
44
|
"dependencies": {
|
|
45
|
-
"@rayburst/cli": "^0.4.
|
|
45
|
+
"@rayburst/cli": "^0.4.9",
|
|
46
46
|
"chalk": "^5.3.0",
|
|
47
|
+
"chokidar": "^3.6.0",
|
|
47
48
|
"ts-morph": "^21.0.1",
|
|
48
49
|
"zod": "^4.2.0"
|
|
49
50
|
},
|