@archznn/xavva 3.1.2 → 3.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 +221 -12
- package/package.json +3 -2
- package/src/commands/AuditCommand.ts +12 -10
- package/src/commands/BuildCommand.ts +9 -7
- package/src/commands/ChangelogCommand.ts +5 -5
- package/src/commands/CleanCommand.ts +242 -0
- package/src/commands/CompletionCommand.ts +7 -7
- package/src/commands/DbCommand.ts +43 -14
- package/src/commands/DeployCommand.ts +252 -229
- package/src/commands/DepsCommand.ts +174 -174
- package/src/commands/DockerCommand.ts +35 -4
- package/src/commands/DoctorCommand.ts +252 -239
- package/src/commands/EncodingCommand.ts +26 -19
- package/src/commands/HealthCommand.ts +7 -7
- package/src/commands/HelpCommand.ts +34 -14
- package/src/commands/HistoryCommand.ts +5 -5
- package/src/commands/HttpCommand.ts +27 -1
- package/src/commands/IdeCommand.ts +313 -0
- package/src/commands/InitCommand.ts +26 -25
- package/src/commands/LogsCommand.ts +8 -6
- package/src/commands/ProfilesCommand.ts +6 -6
- package/src/commands/RedoCommand.ts +2 -2
- package/src/commands/RunCommand.ts +64 -24
- package/src/commands/StartCommand.ts +9 -7
- package/src/commands/TestCommand.ts +25 -1
- package/src/commands/TomcatCommand.ts +232 -88
- package/src/config/versions.ts +111 -9
- package/src/di/container.ts +239 -105
- package/src/errors/ErrorHandler.ts +23 -19
- package/src/errors/errorMessages.ts +235 -0
- package/src/index.ts +20 -6
- package/src/logging/FileLogger.ts +235 -0
- package/src/logging/Logger.ts +545 -0
- package/src/logging/OperationLogger.ts +296 -0
- package/src/logging/ProgressLogger.ts +187 -0
- package/src/logging/TableLogger.ts +246 -0
- package/src/logging/colors.ts +167 -0
- package/src/logging/constants.ts +176 -0
- package/src/logging/formatters.ts +337 -0
- package/src/logging/index.ts +93 -0
- package/src/logging/types.ts +64 -0
- package/src/plugins/PluginManager.ts +325 -0
- package/src/plugins/types.ts +82 -0
- package/src/services/AuditService.ts +5 -3
- package/src/services/BuildService.ts +15 -17
- package/src/services/DashboardService.ts +14 -3
- package/src/services/DbService.ts +35 -34
- package/src/services/DependencyAnalyzerService.ts +18 -18
- package/src/services/DependencyCacheService.ts +303 -0
- package/src/services/DeployWatcher.ts +127 -23
- package/src/services/DockerService.ts +3 -3
- package/src/services/EmbeddedTomcatService.ts +13 -12
- package/src/services/FileWatcher.ts +15 -7
- package/src/services/HttpService.ts +5 -5
- package/src/services/LogAnalyzer.ts +26 -22
- package/src/services/PerformanceProfiler.ts +267 -0
- package/src/services/ProjectService.ts +3 -0
- package/src/services/TestService.ts +3 -3
- package/src/services/TomcatService.ts +46 -25
- package/src/services/tomcat/TomcatBackupManager.ts +330 -0
- package/src/services/tomcat/TomcatChecksumVerifier.ts +211 -0
- package/src/services/tomcat/TomcatCompatibilityChecker.ts +298 -0
- package/src/services/tomcat/TomcatDownloadCache.ts +250 -0
- package/src/services/tomcat/TomcatDownloadService.ts +335 -0
- package/src/services/tomcat/TomcatInstallerService.ts +474 -0
- package/src/services/tomcat/TomcatMirrorManager.ts +181 -0
- package/src/services/tomcat/index.ts +36 -0
- package/src/services/tomcat/types.ts +120 -0
- package/src/types/args.ts +68 -1
- package/src/types/configSchema.ts +174 -0
- package/src/utils/ChangelogGenerator.ts +11 -11
- package/src/utils/LoggerLevel.ts +44 -20
- package/src/utils/ProgressBar.ts +87 -46
- package/src/utils/argsParser.ts +260 -0
- package/src/utils/config.ts +340 -189
- package/src/utils/constants.ts +87 -9
- package/src/utils/dryRun.ts +192 -0
- package/src/utils/processManager.ts +23 -7
- package/src/utils/security.ts +293 -0
- package/src/utils/ui.ts +299 -428
package/README.md
CHANGED
|
@@ -2,15 +2,16 @@
|
|
|
2
2
|
|
|
3
3
|
> Ultra-fast development toolkit for Java Enterprise (Tomcat) on Windows, Linux & macOS
|
|
4
4
|
|
|
5
|
-
[](https://github.com/leorsousa05/Xavva)
|
|
6
6
|
[](LICENSE)
|
|
7
7
|
|
|
8
|
-
Xavva is a high-performance CLI built with **Bun** that transforms the Java/Tomcat development experience. It brings modern development workflows (like Node.js/Vite) to the Java Enterprise ecosystem with hot-reload, smart logging, and
|
|
8
|
+
Xavva is a high-performance CLI built with **Bun** that transforms the Java/Tomcat development experience. It brings modern development workflows (like Node.js/Vite) to the Java Enterprise ecosystem with hot-reload, smart logging, automated deployment, and a powerful plugin system.
|
|
9
9
|
|
|
10
10
|
---
|
|
11
11
|
|
|
12
12
|
## ✨ Features
|
|
13
13
|
|
|
14
|
+
### Core
|
|
14
15
|
- ⚡ **Hot Reload** — Incremental compilation and class injection without server restart
|
|
15
16
|
- 📊 **Interactive Dashboard** — Real-time TUI with system metrics and shortcuts
|
|
16
17
|
- 🧠 **Smart Log Analyzer** — Stack trace folding and root cause highlighting
|
|
@@ -18,19 +19,29 @@ Xavva is a high-performance CLI built with **Bun** that transforms the Java/Tomc
|
|
|
18
19
|
- 📦 **Dependency Analysis** — Detect conflicts and outdated dependencies
|
|
19
20
|
- 🎯 **Maven & Gradle** — Native support for both build tools
|
|
20
21
|
- 🔧 **Auto-Healing** — Automatic diagnosis and repair of common issues
|
|
21
|
-
- 🐱 **Embedded Tomcat** — Auto-install
|
|
22
|
+
- 🐱 **Embedded Tomcat** — Auto-install with mirror selection, checksum verification, download resume, and backup/rollback
|
|
22
23
|
- 📦 **WAR Generation** — Build as .war file or exploded directory
|
|
24
|
+
|
|
25
|
+
### Developer Experience
|
|
23
26
|
- 🔤 **Encoding Converter** — Convert file encodings (UTF-8, Windows-1252, ISO-8859-1) and fix mojibake
|
|
24
27
|
- 🧙 **Interactive Wizard** — `xavva init` for easy project setup
|
|
25
28
|
- 🔔 **Desktop Notifications** — Get notified when builds/deploys complete
|
|
26
29
|
- 📜 **Command History** — Track and replay commands with `xavva history` and `xavva redo`
|
|
27
30
|
- 🏥 **Health Check** — Verify environment (Java, ports, memory, disk) with `xavva health`
|
|
31
|
+
- 🔧 **Auto-Fix** — Automatically fix common issues with `xavva doctor --fix`
|
|
32
|
+
- 🧹 **Clean Command** — Clean cache, build, and logs with `xavva clean`
|
|
28
33
|
- 🔮 **Shell Completions** — Auto-complete for bash, zsh, and fish
|
|
34
|
+
|
|
35
|
+
### Advanced
|
|
29
36
|
- 🧪 **Test Runner** — Run JUnit/TestNG tests with watch mode and coverage
|
|
30
37
|
- 🗄️ **Database Migrations** — Flyway/Liquibase integration
|
|
31
38
|
- 🌐 **HTTP Client** — Test APIs without leaving the terminal
|
|
32
39
|
- 🐳 **Docker Integration** — Generate configs, build and run containers
|
|
33
40
|
- 🌍 **Multi-Environment** — Dev, test, staging configurations
|
|
41
|
+
- 🔌 **Plugin System** — Extend functionality with custom plugins
|
|
42
|
+
- 💻 **IDE Integration** — Generate configs for VS Code, IntelliJ, Eclipse
|
|
43
|
+
- 📊 **Performance Profiler** — Detailed timing with `--profile`
|
|
44
|
+
- 🛡️ **Security** — Input sanitization, path validation, checksum verification
|
|
34
45
|
|
|
35
46
|
---
|
|
36
47
|
|
|
@@ -61,6 +72,9 @@ xavva deploy
|
|
|
61
72
|
# Build and deploy as .war file
|
|
62
73
|
xavva deploy --war
|
|
63
74
|
|
|
75
|
+
# Clean everything (cache, build, logs)
|
|
76
|
+
xavva clean
|
|
77
|
+
|
|
64
78
|
# Analyze dependencies for issues
|
|
65
79
|
xavva deps
|
|
66
80
|
|
|
@@ -70,6 +84,9 @@ xavva deps --update-safe
|
|
|
70
84
|
# Check for security vulnerabilities
|
|
71
85
|
xavva audit
|
|
72
86
|
|
|
87
|
+
# Diagnose and auto-fix environment issues
|
|
88
|
+
xavva doctor --fix
|
|
89
|
+
|
|
73
90
|
# Convert file encoding (UTF-8 → Windows-1252)
|
|
74
91
|
xavva encoding convert --to cp1252 --backup src/main/java/
|
|
75
92
|
|
|
@@ -104,10 +121,21 @@ xavva docker init
|
|
|
104
121
|
xavva docker build
|
|
105
122
|
xavva docker up
|
|
106
123
|
|
|
124
|
+
# Generate IDE configuration
|
|
125
|
+
xavva ide --ide vscode
|
|
126
|
+
xavva ide --ide idea
|
|
127
|
+
xavva ide --ide eclipse
|
|
128
|
+
|
|
107
129
|
# Multi-environment
|
|
108
130
|
xavva deploy --env staging
|
|
109
131
|
xavva dev --env dev
|
|
110
132
|
|
|
133
|
+
# Profile performance
|
|
134
|
+
xavva build --profile
|
|
135
|
+
|
|
136
|
+
# Dry-run (simulate without executing)
|
|
137
|
+
xavva deploy --dry-run
|
|
138
|
+
|
|
111
139
|
# Enable shell completions (bash example)
|
|
112
140
|
eval "$(xavva completion bash)"
|
|
113
141
|
```
|
|
@@ -124,6 +152,7 @@ eval "$(xavva completion bash)"
|
|
|
124
152
|
| `xavva deploy` | Build and deploy application to Tomcat |
|
|
125
153
|
| `xavva build` | Compile project only |
|
|
126
154
|
| `xavva start` | Start Tomcat server only |
|
|
155
|
+
| `xavva clean` | Clean cache, build directories, and logs |
|
|
127
156
|
|
|
128
157
|
### Code Execution
|
|
129
158
|
|
|
@@ -191,6 +220,14 @@ eval "$(xavva completion bash)"
|
|
|
191
220
|
| `xavva docker run` | Run development container |
|
|
192
221
|
| `xavva docker status` | Show container status |
|
|
193
222
|
|
|
223
|
+
### IDE Integration
|
|
224
|
+
|
|
225
|
+
| Command | Description |
|
|
226
|
+
|---------|-------------|
|
|
227
|
+
| `xavva ide --ide vscode` | Generate VS Code configuration (.vscode/) |
|
|
228
|
+
| `xavva ide --ide idea` | Generate IntelliJ IDEA configuration (.idea/) |
|
|
229
|
+
| `xavva ide --ide eclipse` | Generate Eclipse configuration (.project) |
|
|
230
|
+
|
|
194
231
|
### Multi-Environment
|
|
195
232
|
|
|
196
233
|
| Command | Description |
|
|
@@ -210,9 +247,34 @@ Configure environments in `xavva.json`:
|
|
|
210
247
|
|
|
211
248
|
---
|
|
212
249
|
|
|
250
|
+
## 🧹 Clean Command
|
|
251
|
+
|
|
252
|
+
The `xavva clean` command helps you clean up your project:
|
|
253
|
+
|
|
254
|
+
```bash
|
|
255
|
+
# Clean everything (cache, build, logs, tomcat work)
|
|
256
|
+
xavva clean
|
|
257
|
+
|
|
258
|
+
# Clean only cache
|
|
259
|
+
xavva clean --cache
|
|
260
|
+
|
|
261
|
+
# Clean only build directories (target/ build/)
|
|
262
|
+
xavva clean --build
|
|
263
|
+
|
|
264
|
+
# Clean only logs
|
|
265
|
+
xavva clean --logs
|
|
266
|
+
|
|
267
|
+
# Clean only Tomcat work directory
|
|
268
|
+
xavva clean --tomcat
|
|
269
|
+
```
|
|
270
|
+
|
|
271
|
+
---
|
|
272
|
+
|
|
213
273
|
## 🐱 Embedded Tomcat
|
|
214
274
|
|
|
215
|
-
Xavva can automatically download and manage a Tomcat installation for you:
|
|
275
|
+
Xavva can automatically download and manage a Tomcat installation for you with advanced features like automatic mirror selection, checksum verification, download resuming, and backup/rollback:
|
|
276
|
+
|
|
277
|
+
### Basic Usage
|
|
216
278
|
|
|
217
279
|
```bash
|
|
218
280
|
# First time usage - auto-install Tomcat
|
|
@@ -240,6 +302,83 @@ xavva tomcat uninstall 9.0.115
|
|
|
240
302
|
xavva dev --tomcat-version 9.0.115
|
|
241
303
|
```
|
|
242
304
|
|
|
305
|
+
### Advanced Installation Features
|
|
306
|
+
|
|
307
|
+
```bash
|
|
308
|
+
# Install with automatic mirror selection (fastest mirror)
|
|
309
|
+
xavva tomcat install 10.1.52 --mirror auto
|
|
310
|
+
|
|
311
|
+
# Install with specific mirror
|
|
312
|
+
xavva tomcat install 10.1.52 --mirror "Apache (UK)"
|
|
313
|
+
|
|
314
|
+
# Install multiple versions in parallel
|
|
315
|
+
xavva tomcat install 9.0.115 10.1.52 11.0.6 --parallel
|
|
316
|
+
|
|
317
|
+
# Install without cache (force re-download)
|
|
318
|
+
xavva tomcat install 10.1.52 --no-cache
|
|
319
|
+
|
|
320
|
+
# Install without checksum verification
|
|
321
|
+
xavva tomcat install 10.1.52 --no-checksum
|
|
322
|
+
|
|
323
|
+
# Silent mode for CI/CD
|
|
324
|
+
xavva tomcat install 10.1.52 --silent
|
|
325
|
+
|
|
326
|
+
# Force reinstallation
|
|
327
|
+
xavva tomcat install 10.1.52 --force
|
|
328
|
+
|
|
329
|
+
# Configure timeout and retries
|
|
330
|
+
xavva tomcat install 10.1.52 --timeout 600 --retries 5
|
|
331
|
+
```
|
|
332
|
+
|
|
333
|
+
### Mirror Management
|
|
334
|
+
|
|
335
|
+
```bash
|
|
336
|
+
# List all available mirrors
|
|
337
|
+
xavva tomcat mirrors list
|
|
338
|
+
|
|
339
|
+
# Test mirror speeds
|
|
340
|
+
xavva tomcat mirrors test
|
|
341
|
+
```
|
|
342
|
+
|
|
343
|
+
### Backup and Restore
|
|
344
|
+
|
|
345
|
+
```bash
|
|
346
|
+
# List available backups
|
|
347
|
+
xavva tomcat backup list
|
|
348
|
+
|
|
349
|
+
# List backups for specific version
|
|
350
|
+
xavva tomcat backup list 10.1.52
|
|
351
|
+
|
|
352
|
+
# Restore from backup
|
|
353
|
+
xavva tomcat backup restore 10.1.52
|
|
354
|
+
```
|
|
355
|
+
|
|
356
|
+
### Download Cache
|
|
357
|
+
|
|
358
|
+
```bash
|
|
359
|
+
# View cache statistics
|
|
360
|
+
xavva tomcat cache stats
|
|
361
|
+
|
|
362
|
+
# Clear download cache
|
|
363
|
+
xavva tomcat cache clear
|
|
364
|
+
```
|
|
365
|
+
|
|
366
|
+
### Installation Features
|
|
367
|
+
|
|
368
|
+
| Feature | Description |
|
|
369
|
+
|---------|-------------|
|
|
370
|
+
| **Mirror Selection** | Automatic selection of fastest mirror (US, BR, UK, CN, etc.) |
|
|
371
|
+
| **Checksum Verification** | SHA512 verification for download integrity |
|
|
372
|
+
| **Download Resume** | Resume interrupted downloads from where they stopped |
|
|
373
|
+
| **Retry with Backoff** | Automatic retry with exponential backoff (1s, 2s, 4s) |
|
|
374
|
+
| **Progress Display** | Real-time progress with MB/s, ETA, and percentage |
|
|
375
|
+
| **Download Cache** | Persistent cache shared between projects |
|
|
376
|
+
| **Backup on Update** | Automatic backup before updating existing installation |
|
|
377
|
+
| **Rollback** | Automatic rollback if installation fails |
|
|
378
|
+
| **Compatibility Check** | Validates Tomcat version against project requirements |
|
|
379
|
+
| **Parallel Install** | Install multiple versions simultaneously |
|
|
380
|
+
| **Silent Mode** | CI/CD friendly mode with no interactive output |
|
|
381
|
+
|
|
243
382
|
---
|
|
244
383
|
|
|
245
384
|
## 🔤 File Encoding
|
|
@@ -359,11 +498,19 @@ Create `xavva.json` in your project root:
|
|
|
359
498
|
"appName": "my-application",
|
|
360
499
|
"buildTool": "maven",
|
|
361
500
|
"profile": "dev",
|
|
362
|
-
"tui": false
|
|
501
|
+
"tui": false,
|
|
502
|
+
"encoding": "utf-8",
|
|
503
|
+
"plugins": [
|
|
504
|
+
"@xavva/plugin-sass"
|
|
505
|
+
]
|
|
363
506
|
},
|
|
364
507
|
"tomcat": {
|
|
365
508
|
"path": "/home/user/apache-tomcat",
|
|
366
509
|
"port": 8080
|
|
510
|
+
},
|
|
511
|
+
"environments": {
|
|
512
|
+
"dev": { "port": 8080, "profile": "dev" },
|
|
513
|
+
"staging": { "port": 8081, "profile": "staging" }
|
|
367
514
|
}
|
|
368
515
|
}
|
|
369
516
|
```
|
|
@@ -390,6 +537,8 @@ Create `xavva.json` in your project root:
|
|
|
390
537
|
| `-y, --yes` | Auto-install Tomcat (no prompt) |
|
|
391
538
|
| `-V, --verbose` | Detailed output |
|
|
392
539
|
| `-i, --interactive` | Interactive mode (for config) |
|
|
540
|
+
| `--profile` | Show performance profile |
|
|
541
|
+
| `--dry-run` | Simulate without executing |
|
|
393
542
|
|
|
394
543
|
---
|
|
395
544
|
|
|
@@ -411,7 +560,7 @@ The wizard will guide you through:
|
|
|
411
560
|
|
|
412
561
|
---
|
|
413
562
|
|
|
414
|
-
## 🏥 Health Check
|
|
563
|
+
## 🏥 Health Check & Doctor
|
|
415
564
|
|
|
416
565
|
Verify your development environment:
|
|
417
566
|
|
|
@@ -419,14 +568,22 @@ Verify your development environment:
|
|
|
419
568
|
# Check all components
|
|
420
569
|
xavva health
|
|
421
570
|
|
|
422
|
-
#
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
# -
|
|
426
|
-
|
|
427
|
-
# - Memory and disk space
|
|
571
|
+
# Diagnose and show issues
|
|
572
|
+
xavva doctor
|
|
573
|
+
|
|
574
|
+
# Auto-fix common issues
|
|
575
|
+
xavva doctor --fix
|
|
428
576
|
```
|
|
429
577
|
|
|
578
|
+
Checks include:
|
|
579
|
+
- Java version (JDK 11+ recommended)
|
|
580
|
+
- Maven/Gradle availability
|
|
581
|
+
- Tomcat configuration
|
|
582
|
+
- Port availability
|
|
583
|
+
- Memory and disk space
|
|
584
|
+
- JAR file integrity
|
|
585
|
+
- File encoding (BOM detection)
|
|
586
|
+
|
|
430
587
|
---
|
|
431
588
|
|
|
432
589
|
## 📜 Command History
|
|
@@ -487,6 +644,54 @@ Xavva works on all major platforms:
|
|
|
487
644
|
|
|
488
645
|
---
|
|
489
646
|
|
|
647
|
+
## 🔌 Plugin System
|
|
648
|
+
|
|
649
|
+
Extend Xavva with custom plugins:
|
|
650
|
+
|
|
651
|
+
```bash
|
|
652
|
+
# Install a plugin
|
|
653
|
+
xavva plugin install @xavva/plugin-sass
|
|
654
|
+
|
|
655
|
+
# List installed plugins
|
|
656
|
+
xavva plugin list
|
|
657
|
+
```
|
|
658
|
+
|
|
659
|
+
Create a plugin (example: `my-plugin.ts`):
|
|
660
|
+
|
|
661
|
+
```typescript
|
|
662
|
+
import type { XavvaPlugin } from "@archznn/xavva/plugins";
|
|
663
|
+
|
|
664
|
+
export default {
|
|
665
|
+
name: "my-plugin",
|
|
666
|
+
version: "1.0.0",
|
|
667
|
+
description: "My custom plugin",
|
|
668
|
+
|
|
669
|
+
hooks: {
|
|
670
|
+
beforeBuild: async (context) => {
|
|
671
|
+
console.log("Building...", context.config.project.appName);
|
|
672
|
+
},
|
|
673
|
+
afterBuild: async (context, success) => {
|
|
674
|
+
console.log("Build finished:", success ? "success" : "failed");
|
|
675
|
+
}
|
|
676
|
+
}
|
|
677
|
+
} as XavvaPlugin;
|
|
678
|
+
```
|
|
679
|
+
|
|
680
|
+
Configure in `xavva.json`:
|
|
681
|
+
|
|
682
|
+
```json
|
|
683
|
+
{
|
|
684
|
+
"project": {
|
|
685
|
+
"plugins": [
|
|
686
|
+
"@xavva/plugin-sass",
|
|
687
|
+
"./scripts/my-plugin.ts"
|
|
688
|
+
]
|
|
689
|
+
}
|
|
690
|
+
}
|
|
691
|
+
```
|
|
692
|
+
|
|
693
|
+
---
|
|
694
|
+
|
|
490
695
|
## 🏗️ Architecture
|
|
491
696
|
|
|
492
697
|
Xavva uses a modular service-oriented architecture:
|
|
@@ -494,9 +699,13 @@ Xavva uses a modular service-oriented architecture:
|
|
|
494
699
|
- **DashboardService** — TUI management and interactivity
|
|
495
700
|
- **LogAnalyzer** — Intelligent log processing
|
|
496
701
|
- **DependencyAnalyzerService** — Dependency conflict detection
|
|
702
|
+
- **DependencyCacheService** — Cache parsed dependencies
|
|
497
703
|
- **ProjectService** — Project structure discovery
|
|
498
704
|
- **BuildService** — Maven/Gradle integration
|
|
499
705
|
- **TomcatService** — Server lifecycle management
|
|
706
|
+
- **PluginManager** — Plugin loading and hook execution
|
|
707
|
+
- **PerformanceProfiler** — Performance measurement
|
|
708
|
+
- **ErrorHandler** — Contextual error messages
|
|
500
709
|
|
|
501
710
|
---
|
|
502
711
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@archznn/xavva",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.2.0",
|
|
4
4
|
"description": "Ultra-fast CLI tool for Java/Tomcat development with Hot-Reload and Zero Config. Supports Windows, Linux and macOS.",
|
|
5
5
|
"module": "src/index.ts",
|
|
6
6
|
"type": "module",
|
|
@@ -43,6 +43,7 @@
|
|
|
43
43
|
"dependencies": {
|
|
44
44
|
"@inquirer/prompts": "^8.3.2",
|
|
45
45
|
"glob": "^13.0.6",
|
|
46
|
-
"node-notifier": "^10.0.1"
|
|
46
|
+
"node-notifier": "^10.0.1",
|
|
47
|
+
"zod": "^4.3.6"
|
|
47
48
|
}
|
|
48
49
|
}
|
|
@@ -3,13 +3,15 @@ import fs from "fs";
|
|
|
3
3
|
import type { Command } from "./Command";
|
|
4
4
|
import type { AppConfig, CLIArguments } from "../types/config";
|
|
5
5
|
import { AuditService, type JarAuditResult } from "../services/AuditService";
|
|
6
|
-
import { Logger } from "../
|
|
6
|
+
import { Logger } from "../logging";
|
|
7
7
|
|
|
8
8
|
export class AuditCommand implements Command {
|
|
9
|
+
private logger = Logger.getInstance();
|
|
10
|
+
|
|
9
11
|
constructor(private auditService: AuditService) {}
|
|
10
12
|
|
|
11
13
|
async execute(config: AppConfig, args?: CLIArguments): Promise<void> {
|
|
12
|
-
|
|
14
|
+
this.logger.section("Vulnerability & JAR Audit");
|
|
13
15
|
|
|
14
16
|
let appName = args?.name || config.project.appName;
|
|
15
17
|
|
|
@@ -26,7 +28,7 @@ export class AuditCommand implements Command {
|
|
|
26
28
|
if (folders.length === 1) {
|
|
27
29
|
appName = folders[0].name;
|
|
28
30
|
} else if (folders.length > 1) {
|
|
29
|
-
|
|
31
|
+
this.logger.error("Vários apps encontrados no Tomcat:");
|
|
30
32
|
folders.forEach(f => console.log(` ${"\x1b[90m"}➜${"\x1b[0m"} ${f.name}`));
|
|
31
33
|
console.log(`\n Use ${"\x1b[33m"}xavva audit -n <nome>${"\x1b[0m"} para especificar.`);
|
|
32
34
|
return;
|
|
@@ -35,8 +37,8 @@ export class AuditCommand implements Command {
|
|
|
35
37
|
}
|
|
36
38
|
|
|
37
39
|
if (!appName) {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
+
this.logger.error("Não foi possível identificar o app automaticamente.");
|
|
41
|
+
this.logger.warn("Certifique-se de que o projeto foi buildado ou use -n <nome>.");
|
|
40
42
|
return;
|
|
41
43
|
}
|
|
42
44
|
|
|
@@ -45,11 +47,11 @@ export class AuditCommand implements Command {
|
|
|
45
47
|
const vulnerable = results.filter(r => r.vulnerabilities.length > 0);
|
|
46
48
|
|
|
47
49
|
if (vulnerable.length === 0) {
|
|
48
|
-
|
|
50
|
+
this.logger.success(`Nenhuma vulnerabilidade conhecida encontrada em ${results.length} JARs.`);
|
|
49
51
|
return;
|
|
50
52
|
}
|
|
51
53
|
|
|
52
|
-
|
|
54
|
+
this.logger.warn(`Encontradas vulnerabilidades em ${vulnerable.length} de ${results.length} dependências.`);
|
|
53
55
|
console.log("");
|
|
54
56
|
|
|
55
57
|
for (const res of vulnerable) {
|
|
@@ -57,12 +59,12 @@ export class AuditCommand implements Command {
|
|
|
57
59
|
}
|
|
58
60
|
|
|
59
61
|
const totalVulns = vulnerable.reduce((acc, r) => acc + r.vulnerabilities.length, 0);
|
|
60
|
-
|
|
61
|
-
|
|
62
|
+
this.logger.config("Total de Falhas", totalVulns);
|
|
63
|
+
this.logger.config("Relatório gerado via", "OSV.dev (Open Source Vulnerability Database)");
|
|
62
64
|
|
|
63
65
|
} catch (e) {
|
|
64
66
|
const message = e instanceof Error ? e.message : String(e);
|
|
65
|
-
|
|
67
|
+
this.logger.error(message);
|
|
66
68
|
}
|
|
67
69
|
}
|
|
68
70
|
|
|
@@ -1,24 +1,26 @@
|
|
|
1
1
|
import type { Command } from "./Command";
|
|
2
2
|
import type { AppConfig } from "../types/config";
|
|
3
3
|
import { BuildService } from "../services/BuildService";
|
|
4
|
-
import { Logger } from "../
|
|
4
|
+
import { Logger } from "../logging";
|
|
5
5
|
import { ProcessManager } from "../utils/processManager";
|
|
6
6
|
|
|
7
7
|
export class BuildCommand implements Command {
|
|
8
|
+
private logger = Logger.getInstance();
|
|
9
|
+
|
|
8
10
|
constructor(private buildService: BuildService) {}
|
|
9
11
|
|
|
10
12
|
async execute(config: AppConfig): Promise<void> {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
if (config.project.profile)
|
|
13
|
+
this.logger.section("Build Only");
|
|
14
|
+
this.logger.config("Tool", config.project.buildTool.toUpperCase());
|
|
15
|
+
if (config.project.profile) this.logger.config("Profile", config.project.profile);
|
|
14
16
|
|
|
15
17
|
try {
|
|
16
18
|
await this.buildService.runBuild();
|
|
17
|
-
|
|
19
|
+
this.logger.success("Build completed successfully!");
|
|
18
20
|
} catch (error) {
|
|
19
21
|
const message = error instanceof Error ? error.message : String(error);
|
|
20
|
-
|
|
22
|
+
this.logger.error(message);
|
|
21
23
|
await ProcessManager.getInstance().shutdown(1);
|
|
22
24
|
}
|
|
23
25
|
}
|
|
24
|
-
}
|
|
26
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Command } from "./Command";
|
|
2
2
|
import type { AppConfig, CLIArguments } from "../types/config";
|
|
3
3
|
import { ChangelogGenerator } from "../utils/ChangelogGenerator";
|
|
4
|
-
import { Logger } from "../utils/ui";
|
|
4
|
+
import { Logger, C } from "../utils/ui";
|
|
5
5
|
import { existsSync } from "fs";
|
|
6
6
|
|
|
7
7
|
export class ChangelogCommand implements Command {
|
|
@@ -117,12 +117,12 @@ export class ChangelogCommand implements Command {
|
|
|
117
117
|
Logger.info("Usage: xavva changelog <action> [options]");
|
|
118
118
|
Logger.newline();
|
|
119
119
|
Logger.log("Actions:");
|
|
120
|
-
Logger.log(` ${
|
|
121
|
-
Logger.log(` ${
|
|
122
|
-
Logger.log(` ${
|
|
120
|
+
Logger.log(` ${C.primary}generate${C.reset} Generate CHANGELOG.md (default)`);
|
|
121
|
+
Logger.log(` ${C.primary}check${C.reset} Validate conventional commits`);
|
|
122
|
+
Logger.log(` ${C.primary}preview${C.reset} Preview changelog without saving`);
|
|
123
123
|
Logger.newline();
|
|
124
124
|
Logger.log("Options:");
|
|
125
|
-
Logger.log(` ${
|
|
125
|
+
Logger.log(` ${C.primary}-o, --output${C.reset} Output file (default: CHANGELOG.md)`);
|
|
126
126
|
Logger.done();
|
|
127
127
|
}
|
|
128
128
|
}
|