@rayburst/cli 0.2.0 → 0.2.1
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/dist/chunk-NIOHEIF6.js +722 -0
- package/dist/index.d.ts +54 -6
- package/dist/index.js +24 -6
- package/dist/vite-plugin.d.ts +6 -3
- package/dist/vite-plugin.js +6 -109
- package/package.json +4 -3
- package/dist/analysis/analyze-project.d.ts +0 -9
- package/dist/analysis/analyze-project.js +0 -440
- package/dist/git-utils.d.ts +0 -33
- package/dist/git-utils.js +0 -96
- package/dist/incremental-analyzer.d.ts +0 -128
- package/dist/incremental-analyzer.js +0 -259
- package/dist/local-storage.d.ts +0 -39
- package/dist/local-storage.js +0 -117
- package/dist/registry.d.ts +0 -89
- package/dist/registry.js +0 -287
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,54 @@
|
|
|
1
|
-
export { rayburstPlugin } from './vite-plugin';
|
|
2
|
-
|
|
3
|
-
export {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
export { RayburstPluginOptions, rayburstPlugin } from './vite-plugin.js';
|
|
2
|
+
import { AnalysisResult } from '@rayburst/types';
|
|
3
|
+
export { AnalysisResult } from '@rayburst/types';
|
|
4
|
+
import 'vite';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Analyze a TypeScript/React project and generate nodes/edges data
|
|
8
|
+
* @param {string} projectPath - Absolute path to project root
|
|
9
|
+
* @param {string} projectId - Project ID
|
|
10
|
+
* @param {function} onLog - Callback for logging
|
|
11
|
+
* @returns {Promise<AnalysisResult>} Analysis data with nodes and edges
|
|
12
|
+
*/
|
|
13
|
+
declare function analyzeProject(projectPath: string, projectId?: string, onLog?: (message: string) => void): Promise<AnalysisResult>;
|
|
14
|
+
|
|
15
|
+
interface ProjectMeta {
|
|
16
|
+
projectId: string;
|
|
17
|
+
projectName: string;
|
|
18
|
+
createdAt: string;
|
|
19
|
+
cliVersion: string;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Ensures the .rayburst directory exists in the project
|
|
23
|
+
*/
|
|
24
|
+
declare function ensureRayburstDir(projectPath: string): Promise<string>;
|
|
25
|
+
/**
|
|
26
|
+
* Reads analysis data from .rayburst/analysis.json
|
|
27
|
+
*/
|
|
28
|
+
declare function readLocalAnalysis(projectPath: string): Promise<AnalysisResult | null>;
|
|
29
|
+
/**
|
|
30
|
+
* Writes analysis data to .rayburst/analysis.json
|
|
31
|
+
*/
|
|
32
|
+
declare function writeLocalAnalysis(projectPath: string, analysis: AnalysisResult): Promise<void>;
|
|
33
|
+
/**
|
|
34
|
+
* Reads project metadata from .rayburst/meta.json
|
|
35
|
+
*/
|
|
36
|
+
declare function readLocalMeta(projectPath: string): Promise<ProjectMeta | null>;
|
|
37
|
+
/**
|
|
38
|
+
* Writes project metadata to .rayburst/meta.json
|
|
39
|
+
*/
|
|
40
|
+
declare function writeLocalMeta(projectPath: string, meta: ProjectMeta): Promise<void>;
|
|
41
|
+
/**
|
|
42
|
+
* Adds .rayburst/ entry to .gitignore if not already present
|
|
43
|
+
*/
|
|
44
|
+
declare function addGitignoreEntry(projectPath: string): Promise<void>;
|
|
45
|
+
/**
|
|
46
|
+
* Checks if a project has been initialized (has .rayburst directory)
|
|
47
|
+
*/
|
|
48
|
+
declare function isProjectInitialized(projectPath: string): Promise<boolean>;
|
|
49
|
+
/**
|
|
50
|
+
* Initializes a project with .rayburst directory and metadata
|
|
51
|
+
*/
|
|
52
|
+
declare function initializeProject(projectPath: string, projectName: string, cliVersion: string): Promise<ProjectMeta>;
|
|
53
|
+
|
|
54
|
+
export { type ProjectMeta, addGitignoreEntry, analyzeProject, ensureRayburstDir, initializeProject, isProjectInitialized, readLocalAnalysis, readLocalMeta, writeLocalAnalysis, writeLocalMeta };
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,24 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
import {
|
|
2
|
+
addGitignoreEntry,
|
|
3
|
+
analyzeProject,
|
|
4
|
+
ensureRayburstDir,
|
|
5
|
+
initializeProject,
|
|
6
|
+
isProjectInitialized,
|
|
7
|
+
rayburstPlugin,
|
|
8
|
+
readLocalAnalysis,
|
|
9
|
+
readLocalMeta,
|
|
10
|
+
writeLocalAnalysis,
|
|
11
|
+
writeLocalMeta
|
|
12
|
+
} from "./chunk-NIOHEIF6.js";
|
|
13
|
+
export {
|
|
14
|
+
addGitignoreEntry,
|
|
15
|
+
analyzeProject,
|
|
16
|
+
ensureRayburstDir,
|
|
17
|
+
initializeProject,
|
|
18
|
+
isProjectInitialized,
|
|
19
|
+
rayburstPlugin,
|
|
20
|
+
readLocalAnalysis,
|
|
21
|
+
readLocalMeta,
|
|
22
|
+
writeLocalAnalysis,
|
|
23
|
+
writeLocalMeta
|
|
24
|
+
};
|
package/dist/vite-plugin.d.ts
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
1
|
+
import { Plugin } from 'vite';
|
|
2
|
+
|
|
3
|
+
interface RayburstPluginOptions {
|
|
3
4
|
enabled?: boolean;
|
|
4
5
|
debounceMs?: number;
|
|
5
6
|
outputPath?: string;
|
|
6
7
|
}
|
|
7
|
-
|
|
8
|
+
declare function rayburstPlugin(options?: RayburstPluginOptions): Plugin;
|
|
9
|
+
|
|
10
|
+
export { type RayburstPluginOptions, rayburstPlugin };
|
package/dist/vite-plugin.js
CHANGED
|
@@ -1,109 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
debounceMs = 1500, } = options;
|
|
8
|
-
let config;
|
|
9
|
-
let debounceTimer = null;
|
|
10
|
-
let isAnalyzing = false;
|
|
11
|
-
const runAnalysis = async (triggerFile) => {
|
|
12
|
-
if (isAnalyzing)
|
|
13
|
-
return;
|
|
14
|
-
isAnalyzing = true;
|
|
15
|
-
try {
|
|
16
|
-
const projectPath = config.root;
|
|
17
|
-
// Read previous analysis
|
|
18
|
-
const previousAnalysis = await readLocalAnalysis(projectPath);
|
|
19
|
-
// Run analysis
|
|
20
|
-
const newAnalysis = await analyzeProject(projectPath);
|
|
21
|
-
// Write to .rayburst/analysis.json
|
|
22
|
-
await writeLocalAnalysis(projectPath, newAnalysis);
|
|
23
|
-
// Show diff if previous exists
|
|
24
|
-
if (previousAnalysis) {
|
|
25
|
-
const diff = generateDiff(previousAnalysis, newAnalysis);
|
|
26
|
-
console.log(chalk.green('[Rayburst] Analysis updated:'));
|
|
27
|
-
console.log(chalk.gray(` Added: ${diff.added.nodes.length} nodes, ${diff.added.edges.length} edges`));
|
|
28
|
-
console.log(chalk.gray(` Removed: ${diff.removed.nodeIds.length} nodes, ${diff.removed.edgeIds.length} edges`));
|
|
29
|
-
if (diff.modified.nodes.length > 0) {
|
|
30
|
-
console.log(chalk.gray(` Modified: ${diff.modified.nodes.length} nodes`));
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
else {
|
|
34
|
-
const firstBranch = Object.keys(newAnalysis.planData)[0];
|
|
35
|
-
const nodeCount = firstBranch ? newAnalysis.planData[firstBranch].nodes.length : 0;
|
|
36
|
-
const edgeCount = firstBranch ? newAnalysis.planData[firstBranch].edges.length : 0;
|
|
37
|
-
console.log(chalk.green(`[Rayburst] Initial analysis complete: ${nodeCount} nodes, ${edgeCount} edges`));
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
catch (error) {
|
|
41
|
-
const message = error instanceof Error ? error.message : String(error);
|
|
42
|
-
console.error(chalk.red('[Rayburst] Analysis failed:'), message);
|
|
43
|
-
}
|
|
44
|
-
finally {
|
|
45
|
-
isAnalyzing = false;
|
|
46
|
-
}
|
|
47
|
-
};
|
|
48
|
-
return {
|
|
49
|
-
name: 'rayburst-analyzer',
|
|
50
|
-
// Hook 1: Store resolved config
|
|
51
|
-
configResolved(resolvedConfig) {
|
|
52
|
-
config = resolvedConfig;
|
|
53
|
-
},
|
|
54
|
-
// Hook 2: Run initial analysis when dev server starts
|
|
55
|
-
async buildStart() {
|
|
56
|
-
// Only run in dev mode (serve), not during build
|
|
57
|
-
if (!enabled || config.command !== 'serve') {
|
|
58
|
-
return;
|
|
59
|
-
}
|
|
60
|
-
const projectPath = config.root;
|
|
61
|
-
// Initialize project
|
|
62
|
-
await ensureRayburstDir(projectPath);
|
|
63
|
-
await addGitignoreEntry(projectPath);
|
|
64
|
-
console.log(chalk.blue('[Rayburst] Starting code analysis...'));
|
|
65
|
-
// Run initial analysis
|
|
66
|
-
await runAnalysis();
|
|
67
|
-
},
|
|
68
|
-
// Hook 3: Watch for changes using Vite's built-in watcher
|
|
69
|
-
configureServer(server) {
|
|
70
|
-
if (!enabled)
|
|
71
|
-
return;
|
|
72
|
-
const handleFileChange = (filePath) => {
|
|
73
|
-
// Only analyze TypeScript/JavaScript files
|
|
74
|
-
if (!filePath.match(/\.(ts|tsx|js|jsx)$/)) {
|
|
75
|
-
return;
|
|
76
|
-
}
|
|
77
|
-
// Skip non-relevant files
|
|
78
|
-
if (filePath.includes('node_modules') ||
|
|
79
|
-
filePath.includes('.rayburst') ||
|
|
80
|
-
filePath.includes('.test.') ||
|
|
81
|
-
filePath.includes('.spec.')) {
|
|
82
|
-
return;
|
|
83
|
-
}
|
|
84
|
-
// Debounce rapid changes
|
|
85
|
-
if (debounceTimer) {
|
|
86
|
-
clearTimeout(debounceTimer);
|
|
87
|
-
}
|
|
88
|
-
debounceTimer = setTimeout(() => {
|
|
89
|
-
const relativePath = filePath.replace(config.root, '').replace(/^\//, '');
|
|
90
|
-
console.log(chalk.dim(`[Rayburst] File changed: ${relativePath}`));
|
|
91
|
-
runAnalysis(filePath);
|
|
92
|
-
}, debounceMs);
|
|
93
|
-
};
|
|
94
|
-
// Use Vite's built-in file watcher
|
|
95
|
-
server.watcher.on('change', handleFileChange);
|
|
96
|
-
server.watcher.on('add', handleFileChange);
|
|
97
|
-
server.watcher.on('unlink', handleFileChange);
|
|
98
|
-
// Cleanup function
|
|
99
|
-
return () => {
|
|
100
|
-
server.watcher.off('change', handleFileChange);
|
|
101
|
-
server.watcher.off('add', handleFileChange);
|
|
102
|
-
server.watcher.off('unlink', handleFileChange);
|
|
103
|
-
if (debounceTimer) {
|
|
104
|
-
clearTimeout(debounceTimer);
|
|
105
|
-
}
|
|
106
|
-
};
|
|
107
|
-
},
|
|
108
|
-
};
|
|
109
|
-
}
|
|
1
|
+
import {
|
|
2
|
+
rayburstPlugin
|
|
3
|
+
} from "./chunk-NIOHEIF6.js";
|
|
4
|
+
export {
|
|
5
|
+
rayburstPlugin
|
|
6
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rayburst/cli",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"description": "Rayburst - Automatic code analysis for TypeScript/JavaScript projects via Vite plugin",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -20,8 +20,8 @@
|
|
|
20
20
|
"README.md"
|
|
21
21
|
],
|
|
22
22
|
"scripts": {
|
|
23
|
-
"build": "
|
|
24
|
-
"dev": "
|
|
23
|
+
"build": "tsup",
|
|
24
|
+
"dev": "tsup --watch"
|
|
25
25
|
},
|
|
26
26
|
"keywords": [
|
|
27
27
|
"rayburst",
|
|
@@ -49,6 +49,7 @@
|
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
51
|
"@types/node": "^25.0.2",
|
|
52
|
+
"tsup": "^8.5.1",
|
|
52
53
|
"typescript": "^5.9.3",
|
|
53
54
|
"vite": "^7.1.7"
|
|
54
55
|
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { type AnalysisResult } from '@rayburst/types';
|
|
2
|
-
/**
|
|
3
|
-
* Analyze a TypeScript/React project and generate nodes/edges data
|
|
4
|
-
* @param {string} projectPath - Absolute path to project root
|
|
5
|
-
* @param {string} projectId - Project ID
|
|
6
|
-
* @param {function} onLog - Callback for logging
|
|
7
|
-
* @returns {Promise<AnalysisResult>} Analysis data with nodes and edges
|
|
8
|
-
*/
|
|
9
|
-
export declare function analyzeProject(projectPath: string, projectId?: string, onLog?: (message: string) => void): Promise<AnalysisResult>;
|