@rayburst/cli 0.4.14 → 0.4.15
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.
|
@@ -1918,6 +1918,60 @@ var unpluginFactory = (options = {}) => {
|
|
|
1918
1918
|
let isAnalyzing = false;
|
|
1919
1919
|
let lastGitState = null;
|
|
1920
1920
|
let gitPollInterval = null;
|
|
1921
|
+
const changeHistoryMap = {};
|
|
1922
|
+
const MAX_HISTORY_ENTRIES = 100;
|
|
1923
|
+
const generateNodeChanges = (branchId, oldNodes, newNodes) => {
|
|
1924
|
+
const changes = [];
|
|
1925
|
+
const timestamp = Date.now();
|
|
1926
|
+
const oldNodesMap = new Map((oldNodes || []).map((n) => [n.id, n]));
|
|
1927
|
+
const newNodesMap = new Map(newNodes.map((n) => [n.id, n]));
|
|
1928
|
+
for (const newNode of newNodes) {
|
|
1929
|
+
const oldNode = oldNodesMap.get(newNode.id);
|
|
1930
|
+
if (!oldNode) {
|
|
1931
|
+
changes.push({
|
|
1932
|
+
timestamp,
|
|
1933
|
+
nodeId: newNode.id,
|
|
1934
|
+
changeType: "added",
|
|
1935
|
+
currentState: newNode,
|
|
1936
|
+
filePath: newNode.id.split("::")[0] || ""
|
|
1937
|
+
});
|
|
1938
|
+
} else {
|
|
1939
|
+
const nodeChanged = JSON.stringify(oldNode) !== JSON.stringify(newNode);
|
|
1940
|
+
if (nodeChanged) {
|
|
1941
|
+
changes.push({
|
|
1942
|
+
timestamp,
|
|
1943
|
+
nodeId: newNode.id,
|
|
1944
|
+
changeType: "modified",
|
|
1945
|
+
previousState: oldNode,
|
|
1946
|
+
currentState: newNode,
|
|
1947
|
+
filePath: newNode.id.split("::")[0] || ""
|
|
1948
|
+
});
|
|
1949
|
+
}
|
|
1950
|
+
}
|
|
1951
|
+
}
|
|
1952
|
+
for (const oldNode of oldNodes || []) {
|
|
1953
|
+
if (!newNodesMap.has(oldNode.id)) {
|
|
1954
|
+
changes.push({
|
|
1955
|
+
timestamp,
|
|
1956
|
+
nodeId: oldNode.id,
|
|
1957
|
+
changeType: "removed",
|
|
1958
|
+
previousState: oldNode,
|
|
1959
|
+
filePath: oldNode.id.split("::")[0] || ""
|
|
1960
|
+
});
|
|
1961
|
+
}
|
|
1962
|
+
}
|
|
1963
|
+
return changes;
|
|
1964
|
+
};
|
|
1965
|
+
const addToChangeHistory = (branchId, changes) => {
|
|
1966
|
+
if (changes.length === 0) return;
|
|
1967
|
+
if (!changeHistoryMap[branchId]) {
|
|
1968
|
+
changeHistoryMap[branchId] = [];
|
|
1969
|
+
}
|
|
1970
|
+
changeHistoryMap[branchId].push(...changes);
|
|
1971
|
+
if (changeHistoryMap[branchId].length > MAX_HISTORY_ENTRIES) {
|
|
1972
|
+
changeHistoryMap[branchId] = changeHistoryMap[branchId].slice(-MAX_HISTORY_ENTRIES);
|
|
1973
|
+
}
|
|
1974
|
+
};
|
|
1921
1975
|
const checkGitState = (projectPath) => {
|
|
1922
1976
|
try {
|
|
1923
1977
|
const gitDir = path4.join(projectPath, ".git");
|
|
@@ -1958,6 +2012,18 @@ var unpluginFactory = (options = {}) => {
|
|
|
1958
2012
|
const projectPath = config.root;
|
|
1959
2013
|
const previousAnalysis = await readLocalAnalysis(projectPath);
|
|
1960
2014
|
const newAnalysis = await analyzeProject(projectPath);
|
|
2015
|
+
if (previousAnalysis) {
|
|
2016
|
+
for (const branchId of Object.keys(newAnalysis.planData)) {
|
|
2017
|
+
const oldNodes = previousAnalysis.planData[branchId]?.nodes;
|
|
2018
|
+
const newNodes = newAnalysis.planData[branchId]?.nodes || [];
|
|
2019
|
+
const changes = generateNodeChanges(branchId, oldNodes, newNodes);
|
|
2020
|
+
addToChangeHistory(branchId, changes);
|
|
2021
|
+
if (changes.length > 0) {
|
|
2022
|
+
console.log(chalk.yellow(`[Rayburst] Detected ${changes.length} node changes in branch ${branchId}`));
|
|
2023
|
+
}
|
|
2024
|
+
}
|
|
2025
|
+
}
|
|
2026
|
+
newAnalysis.changeHistory = { ...changeHistoryMap };
|
|
1961
2027
|
if (previousAnalysis) {
|
|
1962
2028
|
console.log(chalk.green("[Rayburst] Analysis updated"));
|
|
1963
2029
|
} else {
|
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.15",
|
|
4
4
|
"description": "Rayburst - Automatic code analysis for TypeScript/JavaScript projects via Vite plugin",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
"zod": "^4.2.0"
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
52
|
-
"@rayburst/types": "
|
|
52
|
+
"@rayburst/types": "file:../rayburst-types",
|
|
53
53
|
"@types/node": "^25.0.2",
|
|
54
54
|
"tsup": "^8.5.1",
|
|
55
55
|
"typescript": "^5.9.3",
|