@rayburst/cli 0.4.5 → 0.4.7
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.
|
@@ -944,8 +944,12 @@ async function analyzeProject(projectPath, projectId, onLog) {
|
|
|
944
944
|
edges
|
|
945
945
|
};
|
|
946
946
|
log(" Checking for changed files vs remote...");
|
|
947
|
-
const
|
|
948
|
-
log(` Found ${
|
|
947
|
+
const allChangedFiles = getChangedFilesVsRemote(projectPath);
|
|
948
|
+
log(` Found ${allChangedFiles.length} changed files`);
|
|
949
|
+
const changedFiles = allChangedFiles.filter((filePath) => {
|
|
950
|
+
return !filePath.includes("node_modules") && !filePath.includes(".test.") && !filePath.includes(".spec.") && (filePath.endsWith(".ts") || filePath.endsWith(".tsx") || filePath.endsWith(".js") || filePath.endsWith(".jsx"));
|
|
951
|
+
});
|
|
952
|
+
log(` Filtered to ${changedFiles.length} analyzed source files`);
|
|
949
953
|
const changedFilesMetadata = [];
|
|
950
954
|
for (const filePath of changedFiles) {
|
|
951
955
|
try {
|
|
@@ -1917,6 +1921,57 @@ function getEdgeChanges(oldEdge, newEdge) {
|
|
|
1917
1921
|
}
|
|
1918
1922
|
return changes;
|
|
1919
1923
|
}
|
|
1924
|
+
function generateChangeHistoryEntry(diff, trigger, gitCommitHash, newPlanData) {
|
|
1925
|
+
const timestamp = Date.now();
|
|
1926
|
+
const analysisRunId = `${timestamp}-${Math.random().toString(36).substring(7)}`;
|
|
1927
|
+
const nodeChanges = [];
|
|
1928
|
+
for (const node of diff.added.nodes) {
|
|
1929
|
+
const filePath = node.id.split("::")[0] || "unknown";
|
|
1930
|
+
nodeChanges.push({
|
|
1931
|
+
timestamp,
|
|
1932
|
+
nodeId: node.id,
|
|
1933
|
+
changeType: "added",
|
|
1934
|
+
changedFields: void 0,
|
|
1935
|
+
previousState: void 0,
|
|
1936
|
+
currentState: node,
|
|
1937
|
+
filePath
|
|
1938
|
+
});
|
|
1939
|
+
}
|
|
1940
|
+
for (const nodeId of diff.removed.nodeIds) {
|
|
1941
|
+
const filePath = nodeId.split("::")[0] || "unknown";
|
|
1942
|
+
nodeChanges.push({
|
|
1943
|
+
timestamp,
|
|
1944
|
+
nodeId,
|
|
1945
|
+
changeType: "removed",
|
|
1946
|
+
changedFields: void 0,
|
|
1947
|
+
previousState: void 0,
|
|
1948
|
+
// We don't have the previous state in current diff
|
|
1949
|
+
currentState: void 0,
|
|
1950
|
+
filePath
|
|
1951
|
+
});
|
|
1952
|
+
}
|
|
1953
|
+
for (const modifiedNode of diff.modified.nodes) {
|
|
1954
|
+
const filePath = modifiedNode.id.split("::")[0] || "unknown";
|
|
1955
|
+
const changedFields = Object.keys(modifiedNode.changes || {});
|
|
1956
|
+
nodeChanges.push({
|
|
1957
|
+
timestamp,
|
|
1958
|
+
nodeId: modifiedNode.id,
|
|
1959
|
+
changeType: "modified",
|
|
1960
|
+
changedFields: changedFields.length > 0 ? changedFields : void 0,
|
|
1961
|
+
previousState: void 0,
|
|
1962
|
+
// Would need old plan data to populate
|
|
1963
|
+
currentState: newPlanData.nodes.find((n) => n.id === modifiedNode.id),
|
|
1964
|
+
filePath
|
|
1965
|
+
});
|
|
1966
|
+
}
|
|
1967
|
+
return {
|
|
1968
|
+
timestamp,
|
|
1969
|
+
analysisRunId,
|
|
1970
|
+
trigger,
|
|
1971
|
+
nodeChanges,
|
|
1972
|
+
gitCommitHash
|
|
1973
|
+
};
|
|
1974
|
+
}
|
|
1920
1975
|
|
|
1921
1976
|
// src/vite-plugin.ts
|
|
1922
1977
|
import chalk2 from "chalk";
|
|
@@ -1973,9 +2028,23 @@ function rayburstPlugin(options = {}) {
|
|
|
1973
2028
|
const projectPath = config.root;
|
|
1974
2029
|
const previousAnalysis = await readLocalAnalysis(projectPath);
|
|
1975
2030
|
const newAnalysis = await analyzeProject(projectPath);
|
|
1976
|
-
await writeLocalAnalysis(projectPath, newAnalysis);
|
|
1977
2031
|
if (previousAnalysis) {
|
|
1978
2032
|
const diff = generateDiff(previousAnalysis, newAnalysis);
|
|
2033
|
+
if (diff.added.nodes.length > 0 || diff.removed.nodeIds.length > 0 || diff.modified.nodes.length > 0) {
|
|
2034
|
+
const trigger = triggerFile === "git-event" || triggerFile === "git-poll" ? "git-commit" : "file-change";
|
|
2035
|
+
const firstBranch = Object.keys(newAnalysis.planData)[0];
|
|
2036
|
+
if (firstBranch) {
|
|
2037
|
+
const planData = newAnalysis.planData[firstBranch];
|
|
2038
|
+
const historyEntry = generateChangeHistoryEntry(diff, trigger, void 0, planData);
|
|
2039
|
+
const existingHistory = previousAnalysis.changeHistory?.[firstBranch] || [];
|
|
2040
|
+
const maxHistoryEntries = 100;
|
|
2041
|
+
const updatedHistory = [...existingHistory, historyEntry].slice(-maxHistoryEntries);
|
|
2042
|
+
newAnalysis.changeHistory = {
|
|
2043
|
+
...newAnalysis.changeHistory,
|
|
2044
|
+
[firstBranch]: updatedHistory
|
|
2045
|
+
};
|
|
2046
|
+
}
|
|
2047
|
+
}
|
|
1979
2048
|
console.log(chalk2.green("[Rayburst] Analysis updated:"));
|
|
1980
2049
|
console.log(
|
|
1981
2050
|
chalk2.gray(
|
|
@@ -1998,6 +2067,7 @@ function rayburstPlugin(options = {}) {
|
|
|
1998
2067
|
chalk2.green(`[Rayburst] Initial analysis complete: ${nodeCount} nodes, ${edgeCount} edges`)
|
|
1999
2068
|
);
|
|
2000
2069
|
}
|
|
2070
|
+
await writeLocalAnalysis(projectPath, newAnalysis);
|
|
2001
2071
|
} catch (error) {
|
|
2002
2072
|
const message = error instanceof Error ? error.message : String(error);
|
|
2003
2073
|
console.error(chalk2.red("[Rayburst] Analysis failed:"), message);
|
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.7",
|
|
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,12 +42,13 @@
|
|
|
42
42
|
}
|
|
43
43
|
},
|
|
44
44
|
"dependencies": {
|
|
45
|
+
"@rayburst/cli": "^0.4.6",
|
|
45
46
|
"chalk": "^5.3.0",
|
|
46
47
|
"ts-morph": "^21.0.1",
|
|
47
48
|
"zod": "^4.2.0"
|
|
48
49
|
},
|
|
49
50
|
"devDependencies": {
|
|
50
|
-
"@rayburst/types": "^0.1.
|
|
51
|
+
"@rayburst/types": "^0.1.9",
|
|
51
52
|
"@types/node": "^25.0.2",
|
|
52
53
|
"tsup": "^8.5.1",
|
|
53
54
|
"typescript": "^5.9.3",
|