@rayburst/cli 0.4.6 → 0.4.8
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.
|
@@ -1921,6 +1921,57 @@ function getEdgeChanges(oldEdge, newEdge) {
|
|
|
1921
1921
|
}
|
|
1922
1922
|
return changes;
|
|
1923
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
|
+
}
|
|
1924
1975
|
|
|
1925
1976
|
// src/vite-plugin.ts
|
|
1926
1977
|
import chalk2 from "chalk";
|
|
@@ -1977,9 +2028,23 @@ function rayburstPlugin(options = {}) {
|
|
|
1977
2028
|
const projectPath = config.root;
|
|
1978
2029
|
const previousAnalysis = await readLocalAnalysis(projectPath);
|
|
1979
2030
|
const newAnalysis = await analyzeProject(projectPath);
|
|
1980
|
-
await writeLocalAnalysis(projectPath, newAnalysis);
|
|
1981
2031
|
if (previousAnalysis) {
|
|
1982
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
|
+
}
|
|
1983
2048
|
console.log(chalk2.green("[Rayburst] Analysis updated:"));
|
|
1984
2049
|
console.log(
|
|
1985
2050
|
chalk2.gray(
|
|
@@ -2002,6 +2067,7 @@ function rayburstPlugin(options = {}) {
|
|
|
2002
2067
|
chalk2.green(`[Rayburst] Initial analysis complete: ${nodeCount} nodes, ${edgeCount} edges`)
|
|
2003
2068
|
);
|
|
2004
2069
|
}
|
|
2070
|
+
await writeLocalAnalysis(projectPath, newAnalysis);
|
|
2005
2071
|
} catch (error) {
|
|
2006
2072
|
const message = error instanceof Error ? error.message : String(error);
|
|
2007
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.8",
|
|
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",
|