@rayburst/cli 0.1.0 → 0.1.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.
- package/README.md +236 -157
- package/bin/rayburst.js +156 -1
- package/index.html +3 -11
- package/package.json +8 -26
- package/scripts/analyze-project.js +475 -0
- package/server.js +78 -1
- package/src/file-watcher.js +174 -0
- package/src/git-utils.js +105 -0
- package/src/incremental-analyzer.js +295 -0
- package/src/main.tsx +138 -0
- package/src/registry.js +262 -0
- package/vite-plugin-api.js +123 -0
- package/vite.config.ts +72 -0
- package/dist/assets/_commonjsHelpers-B85MJLTf.js +0 -5
- package/dist/assets/hostInit-CYZeRSfr.js +0 -9
- package/dist/assets/index-9R1akZrm.js +0 -578
- package/dist/assets/index-BW-RulSg.js +0 -258
- package/dist/assets/index-Cap7gsMp.js +0 -16597
- 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-BkHjZ4dx.js +0 -122
- package/dist/assets/virtualExposes-DwA08f_D.js +0 -5
- package/dist/index.html +0 -64
package/README.md
CHANGED
|
@@ -1,258 +1,329 @@
|
|
|
1
1
|
# Rayburst CLI
|
|
2
2
|
|
|
3
|
-
A
|
|
4
|
-
|
|
5
|
-
## Overview
|
|
6
|
-
|
|
7
|
-
The Rayburst CLI is an npm-installable package that serves as a Module Federation host. It dynamically loads the Rayburst application from:
|
|
8
|
-
|
|
9
|
-
- **Development**: `http://localhost:3000` (local development)
|
|
10
|
-
- **Staging**: `https://dev.rayburst.app` (staging environment)
|
|
11
|
-
- **Production**: `https://www.rayburst.app` (production environment)
|
|
12
|
-
|
|
13
|
-
The CLI runs on **port 3105** by default.
|
|
3
|
+
A powerful CLI tool for analyzing and visualizing TypeScript/JavaScript project dependencies and architecture.
|
|
14
4
|
|
|
15
5
|
## Installation
|
|
16
6
|
|
|
17
|
-
|
|
7
|
+
Install globally via npm:
|
|
18
8
|
|
|
19
|
-
1. Install dependencies:
|
|
20
9
|
```bash
|
|
21
|
-
|
|
22
|
-
npm install
|
|
10
|
+
npm install -g @rayburst/cli
|
|
23
11
|
```
|
|
24
12
|
|
|
25
|
-
|
|
26
|
-
```bash
|
|
27
|
-
npm run build
|
|
28
|
-
```
|
|
13
|
+
## Quick Start
|
|
29
14
|
|
|
30
|
-
3. Link the CLI globally for testing:
|
|
31
15
|
```bash
|
|
32
|
-
|
|
33
|
-
|
|
16
|
+
# Register your project
|
|
17
|
+
rayburst register /path/to/your/project
|
|
34
18
|
|
|
35
|
-
|
|
19
|
+
# Analyze the project
|
|
20
|
+
rayburst analyze
|
|
36
21
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
npm publish
|
|
22
|
+
# Start the dashboard
|
|
23
|
+
rayburst start
|
|
40
24
|
```
|
|
41
25
|
|
|
42
|
-
|
|
26
|
+
Open your browser to `http://localhost:3105` to view the interactive dashboard.
|
|
27
|
+
|
|
28
|
+
## Commands
|
|
29
|
+
|
|
30
|
+
### `rayburst register [path]`
|
|
31
|
+
|
|
32
|
+
Register a project for analysis.
|
|
33
|
+
|
|
43
34
|
```bash
|
|
44
|
-
|
|
35
|
+
# Register current directory
|
|
36
|
+
rayburst register
|
|
37
|
+
|
|
38
|
+
# Register specific path
|
|
39
|
+
rayburst register /path/to/project
|
|
40
|
+
|
|
41
|
+
# Register with custom name
|
|
42
|
+
rayburst register --name "My Project"
|
|
45
43
|
```
|
|
46
44
|
|
|
47
|
-
|
|
45
|
+
**Options:**
|
|
46
|
+
- `[path]` - Path to project directory (default: current directory)
|
|
47
|
+
- `-n, --name <name>` - Custom project name
|
|
48
48
|
|
|
49
|
-
###
|
|
49
|
+
### `rayburst list`
|
|
50
|
+
|
|
51
|
+
List all registered projects.
|
|
50
52
|
|
|
51
53
|
```bash
|
|
52
|
-
rayburst
|
|
54
|
+
rayburst list
|
|
53
55
|
```
|
|
54
56
|
|
|
55
|
-
|
|
57
|
+
Shows:
|
|
58
|
+
- Project name
|
|
59
|
+
- Path
|
|
60
|
+
- Last analyzed timestamp
|
|
61
|
+
- Number of branches
|
|
62
|
+
|
|
63
|
+
### `rayburst analyze [path]`
|
|
56
64
|
|
|
57
|
-
|
|
65
|
+
Analyze a registered project and generate dependency graphs.
|
|
58
66
|
|
|
59
67
|
```bash
|
|
60
|
-
|
|
68
|
+
# Analyze current directory
|
|
69
|
+
rayburst analyze
|
|
61
70
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
71
|
+
# Analyze specific project by path
|
|
72
|
+
rayburst analyze /path/to/project
|
|
73
|
+
|
|
74
|
+
# Analyze specific project by ID
|
|
75
|
+
rayburst analyze abc-123
|
|
66
76
|
```
|
|
67
77
|
|
|
68
|
-
|
|
78
|
+
**Options:**
|
|
79
|
+
- `[path]` - Project path or ID (default: current directory)
|
|
69
80
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
81
|
+
**What it analyzes:**
|
|
82
|
+
- Function and class relationships
|
|
83
|
+
- Import/export dependencies
|
|
84
|
+
- Git branches
|
|
85
|
+
- File structure
|
|
86
|
+
- Code architecture
|
|
74
87
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
```
|
|
88
|
+
### `rayburst start`
|
|
89
|
+
|
|
90
|
+
Start the interactive dashboard server.
|
|
79
91
|
|
|
80
|
-
Start in production mode:
|
|
81
92
|
```bash
|
|
82
|
-
|
|
93
|
+
# Start on default port (3105)
|
|
94
|
+
rayburst start
|
|
95
|
+
|
|
96
|
+
# Start on custom port
|
|
97
|
+
rayburst start --port 4000
|
|
98
|
+
|
|
99
|
+
# Start in production mode
|
|
100
|
+
rayburst start --env production
|
|
83
101
|
```
|
|
84
102
|
|
|
85
|
-
|
|
103
|
+
**Options:**
|
|
104
|
+
- `-p, --port <port>` - Server port (default: 3105)
|
|
105
|
+
- `-e, --env <environment>` - Environment: development|staging|production (default: production)
|
|
86
106
|
|
|
87
|
-
###
|
|
107
|
+
### `rayburst unregister <id>`
|
|
88
108
|
|
|
89
|
-
|
|
109
|
+
Unregister a project.
|
|
90
110
|
|
|
91
111
|
```bash
|
|
92
|
-
#
|
|
93
|
-
|
|
112
|
+
# Unregister by project ID
|
|
113
|
+
rayburst unregister abc-123
|
|
94
114
|
```
|
|
95
115
|
|
|
96
|
-
|
|
97
|
-
- `dist/assets/remoteEntry.js` - Module federation remote entry
|
|
98
|
-
- All other bundled assets
|
|
116
|
+
## Features
|
|
99
117
|
|
|
100
|
-
###
|
|
118
|
+
### 📊 Interactive Dependency Graphs
|
|
119
|
+
- Visual representation of code dependencies
|
|
120
|
+
- Function and class relationships
|
|
121
|
+
- Import/export connections
|
|
122
|
+
- Interactive node exploration
|
|
101
123
|
|
|
102
|
-
|
|
124
|
+
### 🔍 Git Integration
|
|
125
|
+
- Multi-branch support
|
|
126
|
+
- Filter by uncommitted changes
|
|
127
|
+
- Branch comparison
|
|
128
|
+
- Track changes over time
|
|
103
129
|
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
130
|
+
### 🎨 Rich Visualization
|
|
131
|
+
- React Flow-based graphs
|
|
132
|
+
- Collapsible node groups
|
|
133
|
+
- Search and filter
|
|
134
|
+
- Auto-layout options
|
|
135
|
+
|
|
136
|
+
### 🔄 Real-time Updates
|
|
137
|
+
- File watching (coming soon)
|
|
138
|
+
- Incremental analysis (coming soon)
|
|
139
|
+
- Live graph updates (coming soon)
|
|
107
140
|
|
|
108
|
-
|
|
141
|
+
## Usage Workflow
|
|
109
142
|
|
|
110
|
-
###
|
|
143
|
+
### 1. Register Your Projects
|
|
111
144
|
|
|
112
145
|
```bash
|
|
113
|
-
cd
|
|
114
|
-
|
|
146
|
+
cd /path/to/project1
|
|
147
|
+
rayburst register
|
|
148
|
+
|
|
149
|
+
cd /path/to/project2
|
|
150
|
+
rayburst register
|
|
115
151
|
```
|
|
116
152
|
|
|
117
|
-
###
|
|
153
|
+
### 2. Analyze Projects
|
|
118
154
|
|
|
119
155
|
```bash
|
|
120
|
-
rayburst
|
|
156
|
+
rayburst analyze project1
|
|
157
|
+
rayburst analyze project2
|
|
121
158
|
```
|
|
122
159
|
|
|
123
|
-
|
|
160
|
+
### 3. Explore in Dashboard
|
|
124
161
|
|
|
125
162
|
```bash
|
|
126
|
-
|
|
127
|
-
npm run dev
|
|
163
|
+
rayburst start
|
|
128
164
|
```
|
|
129
165
|
|
|
130
|
-
|
|
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
|
|
172
|
+
|
|
173
|
+
## Dashboard Features
|
|
174
|
+
|
|
175
|
+
### Project Management
|
|
176
|
+
- View all registered projects
|
|
177
|
+
- See analysis status
|
|
178
|
+
- Browse branches
|
|
179
|
+
- Open multiple tabs
|
|
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
|
|
131
192
|
|
|
132
193
|
## Architecture
|
|
133
194
|
|
|
134
|
-
### Module Federation
|
|
195
|
+
### Module Federation
|
|
135
196
|
|
|
136
|
-
|
|
137
|
-
- Name: `rayburstApp`
|
|
138
|
-
- Port: 3000
|
|
139
|
-
- Exposes: `./App` → `./src/main.tsx`
|
|
140
|
-
- Shared: `react`, `react-dom`
|
|
197
|
+
The CLI uses Module Federation to load the dashboard UI dynamically:
|
|
141
198
|
|
|
142
|
-
**CLI (Host)
|
|
143
|
-
-
|
|
144
|
-
-
|
|
145
|
-
- Remotes: `rayburstApp` from environment-specific URL
|
|
146
|
-
- Shared: `react`, `react-dom`
|
|
199
|
+
- **CLI (Host)**: Port 3105
|
|
200
|
+
- **Dashboard (Remote)**: Loaded from rayburst.app
|
|
201
|
+
- **Shared**: React, React-DOM
|
|
147
202
|
|
|
148
|
-
###
|
|
203
|
+
### Data Storage
|
|
149
204
|
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
├── bin/
|
|
153
|
-
│ └── rayburst.js # CLI entry point
|
|
154
|
-
├── src/
|
|
155
|
-
│ └── main.tsx # React shell that loads remote
|
|
156
|
-
├── dist/ # Built files (generated)
|
|
157
|
-
├── index.html # HTML shell with loading state
|
|
158
|
-
├── server.js # Express server
|
|
159
|
-
├── vite.config.ts # Vite + Module Federation config
|
|
160
|
-
├── package.json
|
|
161
|
-
└── README.md
|
|
162
|
-
```
|
|
205
|
+
- **Registry**: `~/.rayburst/projects.json`
|
|
206
|
+
- **Analysis Data**: `~/.rayburst/analysis/<project-id>.json`
|
|
163
207
|
|
|
164
208
|
## Environment Configuration
|
|
165
209
|
|
|
166
|
-
The CLI automatically determines which remote URL to use based on the environment:
|
|
167
|
-
|
|
168
210
|
| Environment | Remote URL | Use Case |
|
|
169
211
|
|------------|-----------|----------|
|
|
170
212
|
| development | http://localhost:3000 | Local development |
|
|
171
213
|
| staging | https://dev.rayburst.app | Staging/testing |
|
|
172
|
-
| production | https://www.rayburst.app | Production |
|
|
214
|
+
| production | https://www.rayburst.app | Production (default) |
|
|
173
215
|
|
|
174
|
-
##
|
|
175
|
-
|
|
176
|
-
### Port 3000 Already in Use
|
|
216
|
+
## Examples
|
|
177
217
|
|
|
178
|
-
|
|
218
|
+
### Analyze Multiple Projects
|
|
179
219
|
|
|
180
220
|
```bash
|
|
181
|
-
|
|
182
|
-
|
|
221
|
+
# Register projects
|
|
222
|
+
rayburst register ~/projects/frontend --name "Frontend"
|
|
223
|
+
rayburst register ~/projects/backend --name "Backend"
|
|
224
|
+
rayburst register ~/projects/shared --name "Shared Lib"
|
|
225
|
+
|
|
226
|
+
# Analyze all
|
|
227
|
+
rayburst list | xargs -I {} rayburst analyze {}
|
|
228
|
+
|
|
229
|
+
# Start dashboard
|
|
230
|
+
rayburst start
|
|
183
231
|
```
|
|
184
232
|
|
|
185
|
-
###
|
|
233
|
+
### Daily Workflow
|
|
234
|
+
|
|
235
|
+
```bash
|
|
236
|
+
# Morning: Start dashboard
|
|
237
|
+
rayburst start
|
|
238
|
+
|
|
239
|
+
# After changes: Re-analyze
|
|
240
|
+
rayburst analyze
|
|
241
|
+
|
|
242
|
+
# View only your changes
|
|
243
|
+
# (Use "Changes Only" toggle in dashboard)
|
|
244
|
+
```
|
|
186
245
|
|
|
187
|
-
|
|
246
|
+
### Custom Port Setup
|
|
188
247
|
|
|
189
248
|
```bash
|
|
190
|
-
|
|
191
|
-
|
|
249
|
+
# If port 3105 is in use
|
|
250
|
+
rayburst start --port 8080
|
|
192
251
|
```
|
|
193
252
|
|
|
194
|
-
|
|
253
|
+
## Troubleshooting
|
|
195
254
|
|
|
196
|
-
|
|
255
|
+
### Port Already in Use
|
|
197
256
|
|
|
198
257
|
```bash
|
|
199
|
-
#
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
# 2. Start the preview server (serves built files)
|
|
203
|
-
npm run start
|
|
258
|
+
# Find process using port
|
|
259
|
+
lsof -i :3105
|
|
204
260
|
|
|
205
|
-
#
|
|
206
|
-
|
|
261
|
+
# Kill process
|
|
262
|
+
kill <PID>
|
|
207
263
|
```
|
|
208
264
|
|
|
209
|
-
|
|
265
|
+
### Analysis Fails
|
|
210
266
|
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
267
|
+
- Ensure project has a `package.json`
|
|
268
|
+
- Check for TypeScript/JavaScript files
|
|
269
|
+
- Verify git repository (for branch support)
|
|
270
|
+
- Check file permissions
|
|
214
271
|
|
|
215
|
-
|
|
272
|
+
### Dashboard Not Loading
|
|
216
273
|
|
|
217
|
-
|
|
274
|
+
- Verify internet connection (loads remote from rayburst.app)
|
|
275
|
+
- Check firewall settings
|
|
276
|
+
- Try `--env development` for local testing
|
|
218
277
|
|
|
219
|
-
|
|
220
|
-
2. Check browser console for detailed error messages
|
|
221
|
-
3. Verify the remote URL is accessible from the host
|
|
222
|
-
4. Check CORS headers if loading from different domains
|
|
278
|
+
### No Projects Listed
|
|
223
279
|
|
|
224
|
-
## Testing Different Environments
|
|
225
|
-
|
|
226
|
-
### Local Testing
|
|
227
280
|
```bash
|
|
228
|
-
#
|
|
229
|
-
|
|
281
|
+
# Check registry location
|
|
282
|
+
rayburst list
|
|
230
283
|
|
|
231
|
-
#
|
|
232
|
-
rayburst
|
|
284
|
+
# Re-register project
|
|
285
|
+
rayburst register /path/to/project
|
|
233
286
|
```
|
|
234
287
|
|
|
235
|
-
|
|
288
|
+
## Development
|
|
289
|
+
|
|
290
|
+
### Local Setup
|
|
236
291
|
|
|
237
|
-
### Staging Testing
|
|
238
292
|
```bash
|
|
239
|
-
|
|
240
|
-
|
|
293
|
+
# Clone repository
|
|
294
|
+
git clone https://github.com/your-org/rayburst-cli.git
|
|
295
|
+
cd rayburst-cli
|
|
241
296
|
|
|
242
|
-
|
|
297
|
+
# Install dependencies
|
|
298
|
+
npm install
|
|
243
299
|
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
300
|
+
# Build
|
|
301
|
+
npm run build
|
|
302
|
+
|
|
303
|
+
# Link for local testing
|
|
304
|
+
npm link
|
|
248
305
|
|
|
249
|
-
|
|
306
|
+
# Test commands
|
|
307
|
+
rayburst --help
|
|
308
|
+
```
|
|
250
309
|
|
|
251
|
-
|
|
310
|
+
### Project Structure
|
|
252
311
|
|
|
253
|
-
|
|
254
|
-
-
|
|
255
|
-
|
|
312
|
+
```
|
|
313
|
+
rayburst-cli/
|
|
314
|
+
├── bin/
|
|
315
|
+
│ └── rayburst.js # CLI entry point
|
|
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
|
|
326
|
+
```
|
|
256
327
|
|
|
257
328
|
## Tech Stack
|
|
258
329
|
|
|
@@ -262,12 +333,20 @@ Visit: `http://localhost:3105` (loads from www.rayburst.app)
|
|
|
262
333
|
- **Express** - Production server
|
|
263
334
|
- **Commander** - CLI framework
|
|
264
335
|
- **Chalk** - Terminal styling
|
|
336
|
+
- **ts-morph** - TypeScript analysis
|
|
337
|
+
- **chokidar** - File watching
|
|
338
|
+
|
|
339
|
+
## Contributing
|
|
340
|
+
|
|
341
|
+
Contributions are welcome! Please read our contributing guidelines and submit pull requests.
|
|
342
|
+
|
|
343
|
+
## License
|
|
344
|
+
|
|
345
|
+
MIT
|
|
265
346
|
|
|
266
|
-
##
|
|
347
|
+
## Links
|
|
267
348
|
|
|
268
|
-
- [
|
|
269
|
-
- [ ]
|
|
270
|
-
- [ ]
|
|
271
|
-
- [
|
|
272
|
-
- [ ] Docker support
|
|
273
|
-
- [ ] CI/CD integration examples
|
|
349
|
+
- [Documentation](https://rayburst.app/docs)
|
|
350
|
+
- [GitHub Repository](https://github.com/your-org/rayburst)
|
|
351
|
+
- [Issue Tracker](https://github.com/your-org/rayburst/issues)
|
|
352
|
+
- [Changelog](https://github.com/your-org/rayburst/releases)
|
package/bin/rayburst.js
CHANGED
|
@@ -4,7 +4,16 @@ import { Command } from 'commander';
|
|
|
4
4
|
import chalk from 'chalk';
|
|
5
5
|
import { spawn } from 'child_process';
|
|
6
6
|
import { fileURLToPath } from 'url';
|
|
7
|
-
import { dirname, join } from 'path';
|
|
7
|
+
import { dirname, join, resolve } from 'path';
|
|
8
|
+
import {
|
|
9
|
+
registerProject,
|
|
10
|
+
unregisterProject,
|
|
11
|
+
listProjects,
|
|
12
|
+
getRegistryPaths,
|
|
13
|
+
writeAnalysisData,
|
|
14
|
+
updateProjectAnalysis,
|
|
15
|
+
} from '../src/registry.js';
|
|
16
|
+
import { analyzeProject } from '../scripts/analyze-project.js';
|
|
8
17
|
|
|
9
18
|
const __filename = fileURLToPath(import.meta.url);
|
|
10
19
|
const __dirname = dirname(__filename);
|
|
@@ -58,4 +67,150 @@ program
|
|
|
58
67
|
});
|
|
59
68
|
});
|
|
60
69
|
|
|
70
|
+
program
|
|
71
|
+
.command('register')
|
|
72
|
+
.description('Register the current directory as a Rayburst project')
|
|
73
|
+
.argument('[path]', 'Path to register (defaults to current directory)', '.')
|
|
74
|
+
.option('--no-analyze', 'Skip automatic code analysis')
|
|
75
|
+
.action((projectPath, options) => {
|
|
76
|
+
try {
|
|
77
|
+
console.log(chalk.blue('📦 Registering project...'));
|
|
78
|
+
const project = registerProject(projectPath);
|
|
79
|
+
console.log(chalk.green('✓ Project registered successfully!'));
|
|
80
|
+
console.log(chalk.gray(` Name: ${project.name}`));
|
|
81
|
+
console.log(chalk.gray(` Path: ${project.path}`));
|
|
82
|
+
console.log(chalk.gray(` ID: ${project.id}`));
|
|
83
|
+
console.log();
|
|
84
|
+
|
|
85
|
+
// Run analysis by default
|
|
86
|
+
if (options.analyze !== false) {
|
|
87
|
+
console.log(chalk.blue('🔍 Analyzing project...'));
|
|
88
|
+
try {
|
|
89
|
+
const analysisData = analyzeProject(project.path);
|
|
90
|
+
writeAnalysisData(project.id, analysisData);
|
|
91
|
+
updateProjectAnalysis(project.id);
|
|
92
|
+
console.log(chalk.green('✓ Analysis complete!'));
|
|
93
|
+
console.log(chalk.gray(` Nodes: ${analysisData.planData[Object.keys(analysisData.planData)[0]]?.nodes?.length || 0}`));
|
|
94
|
+
console.log(chalk.gray(` Edges: ${analysisData.planData[Object.keys(analysisData.planData)[0]]?.edges?.length || 0}`));
|
|
95
|
+
} catch (error) {
|
|
96
|
+
console.warn(chalk.yellow('⚠ Analysis failed:'), error.message);
|
|
97
|
+
console.warn(chalk.dim(' Project registered but without analysis data'));
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
console.log();
|
|
102
|
+
console.log(chalk.dim('💡 Run'), chalk.cyan('rayburst list'), chalk.dim('to see all registered projects'));
|
|
103
|
+
console.log(chalk.dim('💡 Run'), chalk.cyan('rayburst start'), chalk.dim('to open the Rayburst dashboard'));
|
|
104
|
+
} catch (error) {
|
|
105
|
+
console.error(chalk.red('✗ Registration failed:'), error.message);
|
|
106
|
+
process.exit(1);
|
|
107
|
+
}
|
|
108
|
+
});
|
|
109
|
+
|
|
110
|
+
program
|
|
111
|
+
.command('unregister')
|
|
112
|
+
.description('Unregister a Rayburst project')
|
|
113
|
+
.argument('[path]', 'Path or project ID to unregister (defaults to current directory)', '.')
|
|
114
|
+
.action((projectPath) => {
|
|
115
|
+
try {
|
|
116
|
+
console.log(chalk.blue('📦 Unregistering project...'));
|
|
117
|
+
const project = unregisterProject(projectPath);
|
|
118
|
+
console.log(chalk.green('✓ Project unregistered successfully!'));
|
|
119
|
+
console.log(chalk.gray(` Name: ${project.name}`));
|
|
120
|
+
console.log(chalk.gray(` Path: ${project.path}`));
|
|
121
|
+
} catch (error) {
|
|
122
|
+
console.error(chalk.red('✗ Unregistration failed:'), error.message);
|
|
123
|
+
process.exit(1);
|
|
124
|
+
}
|
|
125
|
+
});
|
|
126
|
+
|
|
127
|
+
program
|
|
128
|
+
.command('list')
|
|
129
|
+
.description('List all registered Rayburst projects')
|
|
130
|
+
.action(() => {
|
|
131
|
+
try {
|
|
132
|
+
const projects = listProjects();
|
|
133
|
+
|
|
134
|
+
if (projects.length === 0) {
|
|
135
|
+
console.log(chalk.yellow('No projects registered yet.'));
|
|
136
|
+
console.log();
|
|
137
|
+
console.log(chalk.dim('💡 Run'), chalk.cyan('rayburst register'), chalk.dim('in a project directory to register it'));
|
|
138
|
+
return;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
console.log(chalk.blue(`📦 Registered Projects (${projects.length}):\n`));
|
|
142
|
+
|
|
143
|
+
projects.forEach((project, index) => {
|
|
144
|
+
console.log(chalk.bold(`${index + 1}. ${project.name}`));
|
|
145
|
+
console.log(chalk.gray(` Path: ${project.path}`));
|
|
146
|
+
console.log(chalk.gray(` ID: ${project.id}`));
|
|
147
|
+
console.log(chalk.gray(` Version: ${project.packageJson?.version || 'N/A'}`));
|
|
148
|
+
console.log(chalk.gray(` Registered: ${new Date(project.registeredAt).toLocaleString()}`));
|
|
149
|
+
if (project.lastAnalyzed) {
|
|
150
|
+
console.log(chalk.gray(` Last Analyzed: ${new Date(project.lastAnalyzed).toLocaleString()}`));
|
|
151
|
+
}
|
|
152
|
+
console.log();
|
|
153
|
+
});
|
|
154
|
+
|
|
155
|
+
const paths = getRegistryPaths();
|
|
156
|
+
console.log(chalk.dim(`Registry location: ${paths.projectsFile}`));
|
|
157
|
+
} catch (error) {
|
|
158
|
+
console.error(chalk.red('✗ Failed to list projects:'), error.message);
|
|
159
|
+
process.exit(1);
|
|
160
|
+
}
|
|
161
|
+
});
|
|
162
|
+
|
|
163
|
+
program
|
|
164
|
+
.command('analyze')
|
|
165
|
+
.description('Analyze a registered Rayburst project')
|
|
166
|
+
.argument('[path]', 'Path or project ID to analyze (defaults to current directory)', '.')
|
|
167
|
+
.action((projectPath) => {
|
|
168
|
+
try {
|
|
169
|
+
// Find the project by path or ID
|
|
170
|
+
const projects = listProjects();
|
|
171
|
+
const absolutePath = resolve(projectPath);
|
|
172
|
+
|
|
173
|
+
let project = projects.find(p => p.path === absolutePath);
|
|
174
|
+
if (!project) {
|
|
175
|
+
// Try to find by ID
|
|
176
|
+
project = projects.find(p => p.id === projectPath);
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
if (!project) {
|
|
180
|
+
console.error(chalk.red('✗ Project not found. Make sure it\'s registered first.'));
|
|
181
|
+
console.log();
|
|
182
|
+
console.log(chalk.dim('💡 Run'), chalk.cyan('rayburst list'), chalk.dim('to see registered projects'));
|
|
183
|
+
console.log(chalk.dim('💡 Run'), chalk.cyan('rayburst register'), chalk.dim('to register a new project'));
|
|
184
|
+
process.exit(1);
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
console.log(chalk.blue('🔍 Analyzing project...'));
|
|
188
|
+
console.log(chalk.gray(` Name: ${project.name}`));
|
|
189
|
+
console.log(chalk.gray(` Path: ${project.path}`));
|
|
190
|
+
console.log();
|
|
191
|
+
|
|
192
|
+
const analysisData = analyzeProject(project.path);
|
|
193
|
+
writeAnalysisData(project.id, analysisData);
|
|
194
|
+
updateProjectAnalysis(project.id);
|
|
195
|
+
|
|
196
|
+
console.log(chalk.green('✓ Analysis complete!'));
|
|
197
|
+
|
|
198
|
+
// Show stats for each branch
|
|
199
|
+
const branchIds = Object.keys(analysisData.planData);
|
|
200
|
+
console.log(chalk.gray(` Branches analyzed: ${branchIds.length}`));
|
|
201
|
+
|
|
202
|
+
branchIds.forEach(branchId => {
|
|
203
|
+
const planData = analysisData.planData[branchId];
|
|
204
|
+
const branch = analysisData.branches.find(b => b.id === branchId);
|
|
205
|
+
console.log(chalk.gray(` - ${branch?.name || branchId}: ${planData.nodes.length} nodes, ${planData.edges.length} edges`));
|
|
206
|
+
});
|
|
207
|
+
|
|
208
|
+
console.log();
|
|
209
|
+
console.log(chalk.dim('💡 Run'), chalk.cyan('rayburst start'), chalk.dim('to view the analysis in the dashboard'));
|
|
210
|
+
} catch (error) {
|
|
211
|
+
console.error(chalk.red('✗ Analysis failed:'), error.message);
|
|
212
|
+
process.exit(1);
|
|
213
|
+
}
|
|
214
|
+
});
|
|
215
|
+
|
|
61
216
|
program.parse();
|