@rayburst/cli 0.1.17 → 0.2.0
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/README.md +165 -257
- package/dist/analysis/analyze-project.d.ts +9 -0
- package/dist/analysis/analyze-project.js +440 -0
- package/dist/git-utils.d.ts +33 -0
- package/dist/git-utils.js +96 -0
- package/dist/incremental-analyzer.d.ts +128 -0
- package/dist/incremental-analyzer.js +259 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +6 -0
- package/dist/local-storage.d.ts +39 -0
- package/dist/local-storage.js +117 -0
- package/dist/registry.d.ts +89 -0
- package/dist/registry.js +287 -0
- package/dist/vite-plugin.d.ts +7 -0
- package/dist/vite-plugin.js +109 -0
- package/package.json +33 -30
- package/bin/rayburst.js +0 -232
- package/dist/assets/_commonjsHelpers-B85MJLTf.js +0 -5
- package/dist/assets/hostInit-BWYxHpMp.js +0 -9
- package/dist/assets/index-9R1akZrm.js +0 -578
- package/dist/assets/index-BW-RulSg.js +0 -258
- package/dist/assets/index-VnAMn3JB.js +0 -16587
- package/dist/assets/preload-helper-Dea3Szod.js +0 -54
- package/dist/assets/rayburstCli__loadRemote__rayburstApp_mf_1_App__loadRemote__-CHUYMhiU.js +0 -35
- package/dist/assets/rayburstCli__loadShare__react__loadShare__-CE7VtFm0.js +0 -19
- package/dist/assets/rayburstCli__mf_v__runtimeInit__mf_v__-C_SVfzik.js +0 -4173
- package/dist/assets/remoteEntry-B8biLITo.js +0 -122
- package/dist/assets/virtualExposes-DwA08f_D.js +0 -5
- package/dist/index.html +0 -56
- package/index.html +0 -54
- package/scripts/analyze-project.js +0 -475
- package/server.js +0 -188
- package/src/file-watcher.js +0 -174
- package/src/git-utils.js +0 -105
- package/src/incremental-analyzer.js +0 -295
- package/src/main.tsx +0 -126
- package/src/registry.js +0 -262
- package/vite-plugin-api.js +0 -123
- package/vite.config.ts +0 -73
package/README.md
CHANGED
|
@@ -1,344 +1,253 @@
|
|
|
1
|
-
# Rayburst
|
|
1
|
+
# Rayburst
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Automatic code analysis for TypeScript/JavaScript projects. Rayburst runs in the background during development and generates dependency graphs that you can visualize in the Rayburst web application.
|
|
4
4
|
|
|
5
|
-
##
|
|
6
|
-
|
|
7
|
-
Install globally via npm:
|
|
5
|
+
## Features
|
|
8
6
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
7
|
+
- **Automatic Analysis**: Runs automatically when you start your dev server - no manual commands needed
|
|
8
|
+
- **Real-time Updates**: Watches for file changes and updates analysis instantly
|
|
9
|
+
- **TypeScript/JavaScript Support**: Full analysis of TS, TSX, JS, and JSX files
|
|
10
|
+
- **React Components**: Detects React components and their dependencies
|
|
11
|
+
- **Function Tracking**: Maps function calls and relationships
|
|
12
|
+
- **Git Integration**: Tracks branches, commits, and changes
|
|
13
|
+
- **Zero Configuration**: Works out of the box with sensible defaults
|
|
12
14
|
|
|
13
|
-
##
|
|
15
|
+
## Installation
|
|
14
16
|
|
|
15
17
|
```bash
|
|
16
|
-
|
|
17
|
-
rayburst register /path/to/your/project
|
|
18
|
-
|
|
19
|
-
# Analyze the project
|
|
20
|
-
rayburst analyze
|
|
21
|
-
|
|
22
|
-
# Start the dashboard
|
|
23
|
-
rayburst start
|
|
18
|
+
npm install --save-dev @rayburst/cli
|
|
24
19
|
```
|
|
25
20
|
|
|
26
|
-
|
|
21
|
+
## Usage
|
|
27
22
|
|
|
28
|
-
|
|
23
|
+
### Vite Projects
|
|
29
24
|
|
|
30
|
-
|
|
25
|
+
Add the Rayburst plugin to your `vite.config.ts`:
|
|
31
26
|
|
|
32
|
-
|
|
27
|
+
```typescript
|
|
28
|
+
import { defineConfig } from 'vite'
|
|
29
|
+
import react from '@vitejs/plugin-react'
|
|
30
|
+
import { rayburstPlugin } from '@rayburst/cli/vite'
|
|
33
31
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
# Register with custom name
|
|
42
|
-
rayburst register --name "My Project"
|
|
32
|
+
export default defineConfig({
|
|
33
|
+
plugins: [
|
|
34
|
+
rayburstPlugin(), // Add this line
|
|
35
|
+
react(),
|
|
36
|
+
],
|
|
37
|
+
})
|
|
43
38
|
```
|
|
44
39
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
List all registered projects.
|
|
40
|
+
That's it! Now when you run `npm run dev`, Rayburst will automatically:
|
|
41
|
+
1. Run initial code analysis
|
|
42
|
+
2. Generate `.rayburst/analysis.json`
|
|
43
|
+
3. Watch for file changes
|
|
44
|
+
4. Update analysis in real-time
|
|
52
45
|
|
|
53
|
-
|
|
54
|
-
rayburst list
|
|
55
|
-
```
|
|
46
|
+
### Configuration Options
|
|
56
47
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
- Number of branches
|
|
48
|
+
```typescript
|
|
49
|
+
rayburstPlugin({
|
|
50
|
+
// Disable the plugin (e.g., for testing)
|
|
51
|
+
enabled: true,
|
|
62
52
|
|
|
63
|
-
|
|
53
|
+
// Debounce delay for file changes (ms)
|
|
54
|
+
debounceMs: 1500,
|
|
64
55
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
# Analyze current directory
|
|
69
|
-
rayburst analyze
|
|
70
|
-
|
|
71
|
-
# Analyze specific project by path
|
|
72
|
-
rayburst analyze /path/to/project
|
|
73
|
-
|
|
74
|
-
# Analyze specific project by ID
|
|
75
|
-
rayburst analyze abc-123
|
|
56
|
+
// Custom output path
|
|
57
|
+
outputPath: '.rayburst/analysis.json',
|
|
58
|
+
})
|
|
76
59
|
```
|
|
77
60
|
|
|
78
|
-
|
|
79
|
-
- `[path]` - Project path or ID (default: current directory)
|
|
80
|
-
|
|
81
|
-
**What it analyzes:**
|
|
82
|
-
- Function and class relationships
|
|
83
|
-
- Import/export dependencies
|
|
84
|
-
- Git branches
|
|
85
|
-
- File structure
|
|
86
|
-
- Code architecture
|
|
87
|
-
|
|
88
|
-
### `rayburst start`
|
|
89
|
-
|
|
90
|
-
Start the interactive dashboard server.
|
|
91
|
-
|
|
92
|
-
```bash
|
|
93
|
-
# Start on default port (3105)
|
|
94
|
-
rayburst start
|
|
61
|
+
## Output
|
|
95
62
|
|
|
96
|
-
|
|
97
|
-
rayburst start --port 4000
|
|
63
|
+
The plugin generates a `.rayburst/` directory in your project root:
|
|
98
64
|
|
|
99
|
-
# Start in production mode
|
|
100
|
-
rayburst start --env production
|
|
101
65
|
```
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
Unregister a project.
|
|
110
|
-
|
|
111
|
-
```bash
|
|
112
|
-
# Unregister by project ID
|
|
113
|
-
rayburst unregister abc-123
|
|
66
|
+
my-project/
|
|
67
|
+
├── .rayburst/
|
|
68
|
+
│ └── analysis.json # Analysis data (nodes, edges, dependencies)
|
|
69
|
+
├── .gitignore # Auto-updated to ignore .rayburst/
|
|
70
|
+
├── src/
|
|
71
|
+
├── vite.config.ts
|
|
72
|
+
└── package.json
|
|
114
73
|
```
|
|
115
74
|
|
|
116
|
-
|
|
75
|
+
The `.rayburst/` directory is automatically added to your `.gitignore`.
|
|
117
76
|
|
|
118
|
-
|
|
119
|
-
- Visual representation of code dependencies
|
|
120
|
-
- Function and class relationships
|
|
121
|
-
- Import/export connections
|
|
122
|
-
- Interactive node exploration
|
|
77
|
+
## Analysis Data
|
|
123
78
|
|
|
124
|
-
|
|
125
|
-
- Multi-branch support
|
|
126
|
-
- Filter by uncommitted changes
|
|
127
|
-
- Branch comparison
|
|
128
|
-
- Track changes over time
|
|
79
|
+
The generated `analysis.json` contains:
|
|
129
80
|
|
|
130
|
-
|
|
131
|
-
-
|
|
132
|
-
-
|
|
133
|
-
-
|
|
134
|
-
- Auto-layout options
|
|
81
|
+
- **Nodes**: Components, functions, state declarations
|
|
82
|
+
- **Edges**: Dependencies between nodes
|
|
83
|
+
- **Branches**: Git branch information
|
|
84
|
+
- **Files**: Modification timestamps
|
|
135
85
|
|
|
136
|
-
|
|
137
|
-
- File watching (coming soon)
|
|
138
|
-
- Incremental analysis (coming soon)
|
|
139
|
-
- Live graph updates (coming soon)
|
|
86
|
+
This data can be visualized using the [Rayburst web application](https://rayburst.app).
|
|
140
87
|
|
|
141
|
-
##
|
|
88
|
+
## Example Output
|
|
142
89
|
|
|
143
|
-
|
|
90
|
+
```typescript
|
|
91
|
+
// src/App.tsx
|
|
92
|
+
import { Button } from './components/Button'
|
|
144
93
|
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
cd /path/to/project2
|
|
150
|
-
rayburst register
|
|
94
|
+
export function App() {
|
|
95
|
+
return <Button onClick={() => alert('Hello')} />
|
|
96
|
+
}
|
|
151
97
|
```
|
|
152
98
|
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
```
|
|
99
|
+
Rayburst detects:
|
|
100
|
+
- `App` component (node)
|
|
101
|
+
- `Button` component usage (edge: App → Button)
|
|
102
|
+
- JSX relationships
|
|
103
|
+
- File structure
|
|
159
104
|
|
|
160
|
-
|
|
105
|
+
## Console Output
|
|
161
106
|
|
|
162
107
|
```bash
|
|
163
|
-
|
|
164
|
-
```
|
|
165
|
-
|
|
166
|
-
Navigate to `http://localhost:3105` and:
|
|
167
|
-
- Browse registered projects
|
|
168
|
-
- Select branches to view
|
|
169
|
-
- Explore dependency graphs
|
|
170
|
-
- Compare branches
|
|
171
|
-
- Filter by changed files
|
|
108
|
+
$ npm run dev
|
|
172
109
|
|
|
173
|
-
|
|
110
|
+
[Rayburst] Starting code analysis...
|
|
111
|
+
[Rayburst] Initial analysis complete: 42 nodes, 68 edges
|
|
174
112
|
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
### Workspace
|
|
182
|
-
- Interactive dependency graphs
|
|
183
|
-
- Node details sidebar
|
|
184
|
-
- Command palette (⌘K)
|
|
185
|
-
- Multi-tab support
|
|
186
|
-
|
|
187
|
-
### Filtering
|
|
188
|
-
- **All Files**: Show complete dependency graph
|
|
189
|
-
- **Changes Only**: Filter to show only uncommitted changes
|
|
190
|
-
- Custom visibility controls
|
|
191
|
-
- Search functionality
|
|
113
|
+
# When you edit a file:
|
|
114
|
+
[Rayburst] File changed: src/App.tsx
|
|
115
|
+
[Rayburst] Analysis updated:
|
|
116
|
+
Added: 1 nodes, 2 edges
|
|
117
|
+
Modified: 1 nodes
|
|
118
|
+
```
|
|
192
119
|
|
|
193
|
-
##
|
|
120
|
+
## How It Works
|
|
194
121
|
|
|
195
|
-
|
|
122
|
+
Rayburst uses a Vite plugin that:
|
|
196
123
|
|
|
197
|
-
|
|
124
|
+
1. **Hooks into Vite's lifecycle**: Runs when dev server starts
|
|
125
|
+
2. **Uses ts-morph**: Analyzes TypeScript/JavaScript AST
|
|
126
|
+
3. **Watches files**: Leverages Vite's built-in file watcher
|
|
127
|
+
4. **Incremental updates**: Only re-analyzes changed files
|
|
128
|
+
5. **Generates graphs**: Produces node/edge data structures
|
|
198
129
|
|
|
199
|
-
|
|
200
|
-
- **Dashboard (Remote)**: Loaded from rayburst.app
|
|
201
|
-
- **Shared**: React, React-DOM
|
|
130
|
+
## Requirements
|
|
202
131
|
|
|
203
|
-
|
|
132
|
+
- **Vite**: 4.x, 5.x, 6.x, or 7.x
|
|
133
|
+
- **TypeScript**: Project must have `tsconfig.json`
|
|
134
|
+
- **package.json**: Required for project metadata
|
|
204
135
|
|
|
205
|
-
|
|
206
|
-
- **Analysis Data**: `~/.rayburst/analysis/<project-id>.json`
|
|
136
|
+
## Browser Compatibility
|
|
207
137
|
|
|
208
|
-
|
|
138
|
+
The analysis data can be viewed in the Rayburst web app, which requires:
|
|
139
|
+
- Chrome 86+ or Edge 86+ (for File System Access API)
|
|
209
140
|
|
|
210
|
-
|
|
211
|
-
|------------|-----------|----------|
|
|
212
|
-
| development | http://localhost:3000 | Local development |
|
|
213
|
-
| staging | https://dev.rayburst.app | Staging/testing |
|
|
214
|
-
| production | https://www.rayburst.app | Production (default) |
|
|
141
|
+
## Advanced Usage
|
|
215
142
|
|
|
216
|
-
|
|
143
|
+
### Programmatic API
|
|
217
144
|
|
|
218
|
-
|
|
145
|
+
You can also use Rayburst programmatically:
|
|
219
146
|
|
|
220
|
-
```
|
|
221
|
-
|
|
222
|
-
rayburst register ~/projects/frontend --name "Frontend"
|
|
223
|
-
rayburst register ~/projects/backend --name "Backend"
|
|
224
|
-
rayburst register ~/projects/shared --name "Shared Lib"
|
|
147
|
+
```typescript
|
|
148
|
+
import { analyzeProject, writeLocalAnalysis } from '@rayburst/cli'
|
|
225
149
|
|
|
226
|
-
|
|
227
|
-
|
|
150
|
+
// Analyze a project
|
|
151
|
+
const analysis = await analyzeProject('/path/to/project')
|
|
228
152
|
|
|
229
|
-
|
|
230
|
-
|
|
153
|
+
// Write results
|
|
154
|
+
await writeLocalAnalysis('/path/to/project', analysis)
|
|
231
155
|
```
|
|
232
156
|
|
|
233
|
-
###
|
|
157
|
+
### Custom Integration
|
|
234
158
|
|
|
235
|
-
```
|
|
236
|
-
|
|
237
|
-
|
|
159
|
+
```typescript
|
|
160
|
+
import {
|
|
161
|
+
analyzeProject,
|
|
162
|
+
ensureRayburstDir,
|
|
163
|
+
writeLocalAnalysis
|
|
164
|
+
} from '@rayburst/cli'
|
|
238
165
|
|
|
239
|
-
|
|
240
|
-
|
|
166
|
+
async function customAnalysis() {
|
|
167
|
+
const projectPath = process.cwd()
|
|
241
168
|
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
```
|
|
169
|
+
// Ensure .rayburst directory exists
|
|
170
|
+
await ensureRayburstDir(projectPath)
|
|
245
171
|
|
|
246
|
-
|
|
172
|
+
// Run analysis
|
|
173
|
+
const result = await analyzeProject(projectPath)
|
|
247
174
|
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
175
|
+
// Save results
|
|
176
|
+
await writeLocalAnalysis(projectPath, result)
|
|
177
|
+
|
|
178
|
+
console.log(`Analyzed ${result.planData.nodes.length} nodes`)
|
|
179
|
+
}
|
|
251
180
|
```
|
|
252
181
|
|
|
253
182
|
## Troubleshooting
|
|
254
183
|
|
|
255
|
-
###
|
|
184
|
+
### Plugin Not Running
|
|
256
185
|
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
186
|
+
Make sure:
|
|
187
|
+
1. Plugin is added to `vite.config.ts`
|
|
188
|
+
2. You're running in dev mode (`npm run dev`, not `npm run build`)
|
|
189
|
+
3. Project has `tsconfig.json`
|
|
260
190
|
|
|
261
|
-
|
|
262
|
-
kill <PID>
|
|
263
|
-
```
|
|
191
|
+
### No Analysis Generated
|
|
264
192
|
|
|
265
|
-
|
|
193
|
+
Check:
|
|
194
|
+
1. `.rayburst/` directory exists
|
|
195
|
+
2. Console for error messages
|
|
196
|
+
3. Project has TypeScript/JavaScript files
|
|
266
197
|
|
|
267
|
-
|
|
268
|
-
- Check for TypeScript/JavaScript files
|
|
269
|
-
- Verify git repository (for branch support)
|
|
270
|
-
- Check file permissions
|
|
198
|
+
### Analysis Fails
|
|
271
199
|
|
|
272
|
-
|
|
200
|
+
Common causes:
|
|
201
|
+
- Invalid `tsconfig.json`
|
|
202
|
+
- TypeScript compilation errors
|
|
203
|
+
- Missing `package.json`
|
|
273
204
|
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
205
|
+
Enable verbose logging:
|
|
206
|
+
```typescript
|
|
207
|
+
rayburstPlugin({
|
|
208
|
+
enabled: process.env.DEBUG === 'true'
|
|
209
|
+
})
|
|
210
|
+
```
|
|
277
211
|
|
|
278
|
-
|
|
212
|
+
## CI/CD
|
|
279
213
|
|
|
280
|
-
|
|
281
|
-
# Check registry location
|
|
282
|
-
rayburst list
|
|
214
|
+
The plugin is automatically disabled in CI environments (when `CI=true`). To force enable:
|
|
283
215
|
|
|
284
|
-
|
|
285
|
-
|
|
216
|
+
```typescript
|
|
217
|
+
rayburstPlugin({
|
|
218
|
+
enabled: true // Always enabled
|
|
219
|
+
})
|
|
286
220
|
```
|
|
287
221
|
|
|
288
|
-
##
|
|
222
|
+
## Migration from Old Versions
|
|
289
223
|
|
|
290
|
-
|
|
224
|
+
If you were using `rayburst watch` command:
|
|
291
225
|
|
|
226
|
+
**Before:**
|
|
292
227
|
```bash
|
|
293
|
-
#
|
|
294
|
-
|
|
295
|
-
cd rayburst-cli
|
|
296
|
-
|
|
297
|
-
# Install dependencies
|
|
298
|
-
npm install
|
|
299
|
-
|
|
300
|
-
# Build
|
|
301
|
-
npm run build
|
|
228
|
+
# Terminal 1
|
|
229
|
+
npm run dev
|
|
302
230
|
|
|
303
|
-
#
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
# Test commands
|
|
307
|
-
rayburst --help
|
|
231
|
+
# Terminal 2
|
|
232
|
+
rayburst watch
|
|
308
233
|
```
|
|
309
234
|
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
├── src/
|
|
317
|
-
│ ├── registry.js # Project registry
|
|
318
|
-
│ ├── git-utils.js # Git operations
|
|
319
|
-
│ ├── file-watcher.js # File watching
|
|
320
|
-
│ └── main.tsx # Dashboard loader
|
|
321
|
-
├── scripts/
|
|
322
|
-
│ └── analyze-project.js # Analysis engine
|
|
323
|
-
├── server.js # Express server
|
|
324
|
-
├── vite.config.ts # Build config
|
|
325
|
-
└── package.json
|
|
235
|
+
**After:**
|
|
236
|
+
```typescript
|
|
237
|
+
// vite.config.ts
|
|
238
|
+
export default defineConfig({
|
|
239
|
+
plugins: [rayburstPlugin(), react()],
|
|
240
|
+
})
|
|
326
241
|
```
|
|
327
242
|
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
- **Module Federation** - Dynamic remote loading
|
|
333
|
-
- **Express** - Production server
|
|
334
|
-
- **Commander** - CLI framework
|
|
335
|
-
- **Chalk** - Terminal styling
|
|
336
|
-
- **ts-morph** - TypeScript analysis
|
|
337
|
-
- **chokidar** - File watching
|
|
243
|
+
```bash
|
|
244
|
+
# Just one terminal
|
|
245
|
+
npm run dev # Rayburst runs automatically!
|
|
246
|
+
```
|
|
338
247
|
|
|
339
248
|
## Contributing
|
|
340
249
|
|
|
341
|
-
Contributions
|
|
250
|
+
Contributions welcome! Please read our contributing guidelines.
|
|
342
251
|
|
|
343
252
|
## License
|
|
344
253
|
|
|
@@ -349,4 +258,3 @@ MIT
|
|
|
349
258
|
- [Documentation](https://rayburst.app/docs)
|
|
350
259
|
- [GitHub Repository](https://github.com/your-org/rayburst)
|
|
351
260
|
- [Issue Tracker](https://github.com/your-org/rayburst/issues)
|
|
352
|
-
- [Changelog](https://github.com/your-org/rayburst/releases)
|
|
@@ -0,0 +1,9 @@
|
|
|
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>;
|