@archznn/xavva 3.1.1 → 3.1.3
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 +1 -1
- package/package.json +1 -1
- package/src/commands/DbCommand.ts +27 -0
- package/src/commands/DockerCommand.ts +31 -0
- package/src/commands/EncodingCommand.ts +7 -0
- package/src/commands/HelpCommand.ts +56 -194
- package/src/commands/HttpCommand.ts +26 -0
- package/src/commands/TestCommand.ts +24 -0
- package/src/commands/TomcatCommand.ts +25 -0
- package/src/index.ts +9 -3
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
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
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 automated deployment.
|
package/package.json
CHANGED
|
@@ -10,8 +10,35 @@ import { Logger } from "../utils/ui";
|
|
|
10
10
|
import { ProcessManager } from "../utils/processManager";
|
|
11
11
|
|
|
12
12
|
export class DbCommand implements Command {
|
|
13
|
+
private showHelp(): void {
|
|
14
|
+
Logger.section("Database Command");
|
|
15
|
+
Logger.log(`${Logger.C.bold}Usage:${Logger.C.reset} xavva db <action> [options]`);
|
|
16
|
+
Logger.newline();
|
|
17
|
+
Logger.log(`${Logger.C.bold}Actions:${Logger.C.reset}`);
|
|
18
|
+
Logger.log(` ${Logger.C.primary}status${Logger.C.reset} Show migration status`);
|
|
19
|
+
Logger.log(` ${Logger.C.primary}migrate${Logger.C.reset} Run pending migrations`);
|
|
20
|
+
Logger.log(` ${Logger.C.primary}reset${Logger.C.reset} Reset database (⚠️ destructive)`);
|
|
21
|
+
Logger.log(` ${Logger.C.primary}seed${Logger.C.reset} Populate with test data`);
|
|
22
|
+
Logger.newline();
|
|
23
|
+
Logger.log(`${Logger.C.bold}Options:${Logger.C.reset}`);
|
|
24
|
+
Logger.log(` --force Confirm destructive operations`);
|
|
25
|
+
Logger.log(` --env <name> Use environment config`);
|
|
26
|
+
Logger.newline();
|
|
27
|
+
Logger.log(`${Logger.C.bold}Examples:${Logger.C.reset}`);
|
|
28
|
+
Logger.log(` xavva db status`);
|
|
29
|
+
Logger.log(` xavva db migrate`);
|
|
30
|
+
Logger.log(` xavva db reset --force`);
|
|
31
|
+
}
|
|
32
|
+
|
|
13
33
|
async execute(config: AppConfig, args?: CLIArguments, positionals?: string[]): Promise<void> {
|
|
14
34
|
const processManager = ProcessManager.getInstance();
|
|
35
|
+
|
|
36
|
+
// Mostra help se solicitado
|
|
37
|
+
if (args?.help) {
|
|
38
|
+
this.showHelp();
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
|
|
15
42
|
const action = positionals?.[1] || "status";
|
|
16
43
|
|
|
17
44
|
const service = new DbService(config.project.buildTool);
|
|
@@ -10,8 +10,39 @@ import { Logger } from "../utils/ui";
|
|
|
10
10
|
import { ProcessManager } from "../utils/processManager";
|
|
11
11
|
|
|
12
12
|
export class DockerCommand implements Command {
|
|
13
|
+
private showHelp(): void {
|
|
14
|
+
Logger.section("Docker Command");
|
|
15
|
+
Logger.log(`${Logger.C.bold}Usage:${Logger.C.reset} xavva docker <action> [options]`);
|
|
16
|
+
Logger.newline();
|
|
17
|
+
Logger.log(`${Logger.C.bold}Actions:${Logger.C.reset}`);
|
|
18
|
+
Logger.log(` ${Logger.C.primary}init${Logger.C.reset} Generate Dockerfile & docker-compose.yml`);
|
|
19
|
+
Logger.log(` ${Logger.C.primary}build${Logger.C.reset} Build Docker image`);
|
|
20
|
+
Logger.log(` ${Logger.C.primary}run${Logger.C.reset} Run development container`);
|
|
21
|
+
Logger.log(` ${Logger.C.primary}up${Logger.C.reset} Start with docker-compose`);
|
|
22
|
+
Logger.log(` ${Logger.C.primary}down${Logger.C.reset} Stop containers`);
|
|
23
|
+
Logger.log(` ${Logger.C.primary}status${Logger.C.reset} Show container status`);
|
|
24
|
+
Logger.newline();
|
|
25
|
+
Logger.log(`${Logger.C.bold}Options:${Logger.C.reset}`);
|
|
26
|
+
Logger.log(` --name <n> Image name`);
|
|
27
|
+
Logger.log(` --tag <t> Image tag`);
|
|
28
|
+
Logger.log(` --port <p> Port mapping`);
|
|
29
|
+
Logger.log(` -d, --detached Run in background`);
|
|
30
|
+
Logger.newline();
|
|
31
|
+
Logger.log(`${Logger.C.bold}Examples:${Logger.C.reset}`);
|
|
32
|
+
Logger.log(` xavva docker init`);
|
|
33
|
+
Logger.log(` xavva docker build --tag myapp:1.0`);
|
|
34
|
+
Logger.log(` xavva docker up -d`);
|
|
35
|
+
}
|
|
36
|
+
|
|
13
37
|
async execute(config: AppConfig, args?: CLIArguments, positionals?: string[]): Promise<void> {
|
|
14
38
|
const processManager = ProcessManager.getInstance();
|
|
39
|
+
|
|
40
|
+
// Mostra help se solicitado
|
|
41
|
+
if (args?.help) {
|
|
42
|
+
this.showHelp();
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
|
|
15
46
|
const action = positionals?.[1] || "status";
|
|
16
47
|
|
|
17
48
|
const service = new DockerService();
|
|
@@ -16,6 +16,13 @@ export class EncodingCommand implements Command {
|
|
|
16
16
|
async execute(config: AppConfig, args?: CLIArguments, positionals?: string[]): Promise<void> {
|
|
17
17
|
const processManager = ProcessManager.getInstance();
|
|
18
18
|
|
|
19
|
+
// Mostra help se solicitado
|
|
20
|
+
if (args?.help) {
|
|
21
|
+
this.showHelp();
|
|
22
|
+
await processManager.shutdown(0);
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
|
|
19
26
|
// Parse subcomando
|
|
20
27
|
const subcommand = positionals?.[1] || "help";
|
|
21
28
|
const fileArg = positionals?.[2]; // Arquivo específico (opcional)
|
|
@@ -4,202 +4,63 @@ import pkg from "../../package.json";
|
|
|
4
4
|
|
|
5
5
|
export class HelpCommand implements Command {
|
|
6
6
|
async execute(_config: AppConfig, _args?: CLIArguments): Promise<void> {
|
|
7
|
-
const
|
|
7
|
+
const v = pkg.version;
|
|
8
|
+
const c = this.c;
|
|
8
9
|
|
|
9
10
|
console.log(`
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
${this.c("cyan", "-q, --quiet")} Minimal output
|
|
64
|
-
${this.c("cyan", "-V, --verbose")} Detailed output
|
|
65
|
-
${this.c("cyan", "--debug-level")} <lvl> Debug level: error|warn|info|verbose|trace|silly
|
|
66
|
-
${this.c("cyan", "-h, --help")} Show this help
|
|
67
|
-
${this.c("cyan", "-v, --version")} Show version
|
|
68
|
-
|
|
69
|
-
${this.c("yellow", "BUILD OPTIONS")} ${this.c("dim", "(for deploy, dev, build)")}
|
|
70
|
-
${this.c("cyan", "-W, --war")} Generate .war file instead of exploded directory
|
|
71
|
-
${this.c("cyan", "--cache")} Use build cache (skip if no changes)
|
|
72
|
-
|
|
73
|
-
${this.c("yellow", "TOMCAT OPTIONS")} ${this.c("dim", "(for embedded Tomcat)")}
|
|
74
|
-
${this.c("cyan", "--tomcat-version")} <v> Tomcat version to install (default: 10.1.52)
|
|
75
|
-
${this.c("cyan", "-y, --yes")} Auto-install without confirmation
|
|
76
|
-
|
|
77
|
-
${this.c("yellow", "DEPS OPTIONS")} ${this.c("dim", "(for xavva deps)")}
|
|
78
|
-
${this.c("cyan", "--update-safe")} Update only non-breaking dependencies
|
|
79
|
-
${this.c("cyan", "--fix")} Show fix suggestions for conflicts
|
|
80
|
-
${this.c("cyan", "--strict")} Fail on critical conflicts (for CI/CD)
|
|
81
|
-
${this.c("cyan", "-o, --output")} <file> Export report as JSON
|
|
82
|
-
|
|
83
|
-
${this.c("yellow", "ENCODING OPTIONS")} ${this.c("dim", "(for xavva encoding)")}
|
|
84
|
-
${this.c("cyan", "--from")} <encoding> Source encoding (auto-detect if not specified)
|
|
85
|
-
${this.c("cyan", "--to")} <encoding> Target encoding (default: from xavva.json or UTF-8)
|
|
86
|
-
${this.c("cyan", "--backup")} Create backup before conversion
|
|
87
|
-
${this.c("cyan", "--dry-run")} Simulate without modifying files
|
|
88
|
-
${this.c("cyan", "--src")} <path> Source directory (default: src/)
|
|
89
|
-
|
|
90
|
-
${this.c("yellow", "EXAMPLES")}
|
|
91
|
-
${this.c("dim", "# Development with hot reload and dashboard")}
|
|
92
|
-
xavva dev --tui --watch
|
|
93
|
-
|
|
94
|
-
${this.c("dim", "# Deploy to specific Tomcat installation")}
|
|
95
|
-
xavva deploy -p /opt/tomcat --port 8081
|
|
96
|
-
|
|
97
|
-
${this.c("dim", "# Build and deploy as .war file")}
|
|
98
|
-
xavva deploy --war
|
|
99
|
-
|
|
100
|
-
${this.c("dim", "# Run a class with debugging")}
|
|
101
|
-
xavva debug com.example.MyClass
|
|
102
|
-
|
|
103
|
-
${this.c("dim", "# Use embedded Tomcat (auto-install)")}
|
|
104
|
-
xavva dev --yes
|
|
105
|
-
xavva dev --tomcat-version 9.0.115
|
|
106
|
-
|
|
107
|
-
${this.c("dim", "# Analyze and update dependencies")}
|
|
108
|
-
xavva deps --verbose
|
|
109
|
-
xavva deps --update-safe
|
|
110
|
-
|
|
111
|
-
${this.c("dim", "# Security audit with auto-fix")}
|
|
112
|
-
xavva audit --fix
|
|
113
|
-
|
|
114
|
-
${this.c("dim", "# Manage embedded Tomcat")}
|
|
115
|
-
xavva tomcat list # List available versions
|
|
116
|
-
xavva tomcat installed # List installed versions
|
|
117
|
-
xavva tomcat install 9.0.115 # Install specific version
|
|
118
|
-
xavva tomcat use 9.0.115 # Switch to version for this project
|
|
119
|
-
xavva tomcat status
|
|
120
|
-
xavva tomcat uninstall 9.0.115
|
|
121
|
-
|
|
122
|
-
${this.c("dim", "# Convert file encoding")}
|
|
123
|
-
xavva encoding detect src/main/java/MinhaClasse.java
|
|
124
|
-
xavva encoding convert --from utf-8 --to cp1252 src/main/java/
|
|
125
|
-
xavva encoding convert --to cp1252 --backup src/main/java/MinhaClasse.java
|
|
126
|
-
xavva encoding fix src/main/java/MinhaClasse.java # Fix mojibake
|
|
127
|
-
xavva encoding list # List all file encodings
|
|
128
|
-
|
|
129
|
-
${this.c("dim", "# Initialize new project")}
|
|
130
|
-
xavva init # Interactive wizard
|
|
131
|
-
|
|
132
|
-
${this.c("dim", "# Manage configuration")}
|
|
133
|
-
xavva config # View current config
|
|
134
|
-
xavva config --interactive # Edit config interactively
|
|
135
|
-
|
|
136
|
-
${this.c("dim", "# Command history")}
|
|
137
|
-
xavva history # Show recent commands
|
|
138
|
-
xavva history --clear # Clear history
|
|
139
|
-
xavva redo # Repeat last command
|
|
140
|
-
|
|
141
|
-
${this.c("dim", "# Health check")}
|
|
142
|
-
xavva health # Check environment health
|
|
143
|
-
|
|
144
|
-
${this.c("dim", "# Shell completions")}
|
|
145
|
-
xavva completion bash # Generate bash completions
|
|
146
|
-
xavva completion zsh # Generate zsh completions
|
|
147
|
-
eval "$(xavva completion bash)" # Enable in current shell
|
|
148
|
-
|
|
149
|
-
${this.c("dim", "# Changelog")}
|
|
150
|
-
xavva changelog generate # Generate CHANGELOG.md
|
|
151
|
-
xavva changelog check # Validate conventional commits
|
|
152
|
-
xavva changelog preview # Preview without saving
|
|
153
|
-
|
|
154
|
-
${this.c("dim", "# Debug levels")}
|
|
155
|
-
xavva deploy --debug-level verbose # Verbose logging
|
|
156
|
-
xavva deploy --debug-level trace # Trace all operations
|
|
157
|
-
xavva deploy --debug-level silly # Everything including config
|
|
158
|
-
|
|
159
|
-
${this.c("dim", "# Multi-environment")}
|
|
160
|
-
xavva deploy --env staging # Deploy to staging environment
|
|
161
|
-
xavva dev --env dev # Use dev environment config
|
|
162
|
-
|
|
163
|
-
${this.c("dim", "# Test runner")}
|
|
164
|
-
xavva test # Run all tests
|
|
165
|
-
xavva test --watch # Watch mode
|
|
166
|
-
xavva test --coverage # Generate coverage report
|
|
167
|
-
xavva test UserServiceTest # Run specific test class
|
|
168
|
-
|
|
169
|
-
${this.c("dim", "# Database migrations")}
|
|
170
|
-
xavva db status # Show migration status
|
|
171
|
-
xavva db migrate # Run pending migrations
|
|
172
|
-
xavva db reset --force # Reset database (drops all!)
|
|
173
|
-
xavva db seed # Populate with test data
|
|
174
|
-
|
|
175
|
-
${this.c("dim", "# HTTP Client")}
|
|
176
|
-
xavva http GET /api/users # Test endpoint
|
|
177
|
-
xavva http POST /api/users --body '{"name":"John"}'
|
|
178
|
-
xavva http GET /api/users --param page=1 --param size=10
|
|
179
|
-
|
|
180
|
-
${this.c("dim", "# Docker")}
|
|
181
|
-
xavva docker init # Generate Dockerfile & compose
|
|
182
|
-
xavva docker build # Build image
|
|
183
|
-
xavva docker up # Start with docker-compose
|
|
184
|
-
xavva docker run # Run dev container
|
|
185
|
-
|
|
186
|
-
${this.c("yellow", "CONFIGURATION")}
|
|
187
|
-
Settings are loaded from ${this.c("cyan", "xavva.json")} in the project root:
|
|
188
|
-
|
|
189
|
-
${this.c("dim", `{
|
|
190
|
-
"project": {
|
|
191
|
-
"appName": "my-app",
|
|
192
|
-
"buildTool": "maven",
|
|
193
|
-
"tui": true
|
|
194
|
-
},
|
|
195
|
-
"tomcat": {
|
|
196
|
-
"path": "C:/apache-tomcat",
|
|
197
|
-
"port": 8080
|
|
198
|
-
}
|
|
199
|
-
}`)}
|
|
200
|
-
|
|
201
|
-
${this.c("gray", "────────────────────────────────────────────────────────────")}
|
|
202
|
-
${this.c("gray", "Docs: github.com/leorsousa05/Xavva | License: MIT")}
|
|
11
|
+
${c("cyan", "◆")} ${c("bold", "XAVVA")} ${c("dim", `v${v}`)} ${c("gray", "— Java/Tomcat Dev CLI")}
|
|
12
|
+
|
|
13
|
+
${c("yellow", "USAGE")}
|
|
14
|
+
xavva <command> [options]
|
|
15
|
+
|
|
16
|
+
${c("yellow", "CORE COMMANDS")}
|
|
17
|
+
${c("green", "dev")} Start dev mode (build + deploy + watch + hot reload)
|
|
18
|
+
${c("green", "deploy")} Build and deploy to Tomcat
|
|
19
|
+
${c("green", "build")} Compile project
|
|
20
|
+
${c("green", "start")} Start Tomcat server
|
|
21
|
+
${c("green", "run")} Run a Java class
|
|
22
|
+
${c("green", "logs")} Stream Tomcat logs
|
|
23
|
+
|
|
24
|
+
${c("yellow", "ANALYSIS")}
|
|
25
|
+
${c("cyan", "deps")} Analyze dependencies (conflicts, updates)
|
|
26
|
+
${c("cyan", "audit")} Security vulnerability scan
|
|
27
|
+
${c("cyan", "doctor")} Diagnose environment issues
|
|
28
|
+
${c("cyan", "health")} Check environment health
|
|
29
|
+
${c("cyan", "profiles")} List Maven/Gradle profiles
|
|
30
|
+
|
|
31
|
+
${c("yellow", "UTILITIES")}
|
|
32
|
+
${c("magenta", "init")} Initialize project (wizard)
|
|
33
|
+
${c("magenta", "config")} View/edit configuration
|
|
34
|
+
${c("magenta", "encoding")} Convert file encodings
|
|
35
|
+
${c("magenta", "tomcat")} Manage embedded Tomcat
|
|
36
|
+
${c("magenta", "history")} Command history
|
|
37
|
+
${c("magenta", "redo")} Repeat last command
|
|
38
|
+
${c("magenta", "completion")} Shell completions
|
|
39
|
+
|
|
40
|
+
${c("yellow", "NEW v3.1")}
|
|
41
|
+
${c("brightMagenta", "test")} Run JUnit/TestNG tests (--watch, --coverage)
|
|
42
|
+
${c("brightMagenta", "db")} Database migrations (Flyway/Liquibase)
|
|
43
|
+
${c("brightMagenta", "http")} HTTP client for API testing
|
|
44
|
+
${c("brightMagenta", "docker")} Docker integration
|
|
45
|
+
|
|
46
|
+
${c("yellow", "GLOBAL OPTIONS")}
|
|
47
|
+
-p, --path <path> Tomcat path --port <n> Port (8080)
|
|
48
|
+
-t, --tool <tool> maven|gradle -P, --profile <p> Build profile
|
|
49
|
+
-n, --name <name> App name -e, --encoding <enc> UTF-8|cp1252
|
|
50
|
+
-w, --watch Watch mode --tui Dashboard
|
|
51
|
+
-d, --debug JPDA debugger -c, --clean Clean build
|
|
52
|
+
-W, --war Build .war --env <name> Environment
|
|
53
|
+
-h, --help Show help -v, --version Version
|
|
54
|
+
|
|
55
|
+
${c("yellow", "EXAMPLES")}
|
|
56
|
+
xavva dev --tui --watch # Dev mode with dashboard
|
|
57
|
+
xavva deploy --war --port 8081 # Build WAR for port 8081
|
|
58
|
+
xavva test --watch # Test watch mode
|
|
59
|
+
xavva deps --update-safe # Update dependencies
|
|
60
|
+
xavva docker init && xavva docker up # Docker setup
|
|
61
|
+
|
|
62
|
+
${c("gray", "Run 'xavva <command> --help' for detailed options")}
|
|
63
|
+
${c("gray", "Docs: github.com/leorsousa05/Xavva")}
|
|
203
64
|
`);
|
|
204
65
|
}
|
|
205
66
|
|
|
@@ -214,6 +75,7 @@ export class HelpCommand implements Command {
|
|
|
214
75
|
yellow: "\x1b[33m",
|
|
215
76
|
blue: "\x1b[34m",
|
|
216
77
|
cyan: "\x1b[36m",
|
|
78
|
+
brightMagenta: "\x1b[95m",
|
|
217
79
|
};
|
|
218
80
|
return `${colors[color] || ""}${text}\x1b[0m`;
|
|
219
81
|
}
|
|
@@ -14,8 +14,34 @@ import fs from "fs";
|
|
|
14
14
|
import path from "path";
|
|
15
15
|
|
|
16
16
|
export class HttpCommand implements Command {
|
|
17
|
+
private showHelp(): void {
|
|
18
|
+
Logger.section("HTTP Client");
|
|
19
|
+
Logger.log(`${Logger.C.bold}Usage:${Logger.C.reset} xavva http <method> <path> [options]`);
|
|
20
|
+
Logger.log(`${Logger.C.bold} or:${Logger.C.reset} xavva http --interactive`);
|
|
21
|
+
Logger.newline();
|
|
22
|
+
Logger.log(`${Logger.C.bold}Methods:${Logger.C.reset} GET, POST, PUT, DELETE, PATCH`);
|
|
23
|
+
Logger.newline();
|
|
24
|
+
Logger.log(`${Logger.C.bold}Options:${Logger.C.reset}`);
|
|
25
|
+
Logger.log(` --body <data> Request body (JSON)`);
|
|
26
|
+
Logger.log(` --param <k=v> Query parameter (can use multiple)`);
|
|
27
|
+
Logger.log(` --header <h> Custom header`);
|
|
28
|
+
Logger.log(` --base-url <url> Override base URL`);
|
|
29
|
+
Logger.log(` -i, --interactive Interactive mode`);
|
|
30
|
+
Logger.newline();
|
|
31
|
+
Logger.log(`${Logger.C.bold}Examples:${Logger.C.reset}`);
|
|
32
|
+
Logger.log(` xavva http GET /api/users`);
|
|
33
|
+
Logger.log(` xavva http POST /api/users --body '{"name":"John"}'`);
|
|
34
|
+
Logger.log(` xavva http GET /api/users --param page=1 --param size=10`);
|
|
35
|
+
}
|
|
36
|
+
|
|
17
37
|
async execute(config: AppConfig, args?: CLIArguments, positionals?: string[]): Promise<void> {
|
|
18
38
|
const processManager = ProcessManager.getInstance();
|
|
39
|
+
|
|
40
|
+
// Mostra help se solicitado
|
|
41
|
+
if (args?.help) {
|
|
42
|
+
this.showHelp();
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
19
45
|
|
|
20
46
|
// Modo interativo
|
|
21
47
|
if (args?.interactive || positionals?.length === 1) {
|
|
@@ -12,8 +12,32 @@ import { ProcessManager } from "../utils/processManager";
|
|
|
12
12
|
export class TestCommand implements Command {
|
|
13
13
|
private service: TestService | null = null;
|
|
14
14
|
|
|
15
|
+
private showHelp(): void {
|
|
16
|
+
Logger.section("Test Runner");
|
|
17
|
+
Logger.log(`${Logger.C.bold}Usage:${Logger.C.reset} xavva test [options] [filter]`);
|
|
18
|
+
Logger.newline();
|
|
19
|
+
Logger.log(`${Logger.C.bold}Options:${Logger.C.reset}`);
|
|
20
|
+
Logger.log(` -w, --watch Watch mode (run on file change)`);
|
|
21
|
+
Logger.log(` --coverage Generate JaCoCo coverage report`);
|
|
22
|
+
Logger.log(` --fail-fast Stop on first failure`);
|
|
23
|
+
Logger.log(` --parallel Run tests in parallel`);
|
|
24
|
+
Logger.log(` -V, --verbose Verbose output`);
|
|
25
|
+
Logger.newline();
|
|
26
|
+
Logger.log(`${Logger.C.bold}Examples:${Logger.C.reset}`);
|
|
27
|
+
Logger.log(` xavva test # Run all tests`);
|
|
28
|
+
Logger.log(` xavva test --watch # Watch mode`);
|
|
29
|
+
Logger.log(` xavva test --coverage # With coverage`);
|
|
30
|
+
Logger.log(` xavva test UserServiceTest # Run specific test`);
|
|
31
|
+
}
|
|
32
|
+
|
|
15
33
|
async execute(config: AppConfig, args?: CLIArguments, positionals?: string[]): Promise<void> {
|
|
16
34
|
const processManager = ProcessManager.getInstance();
|
|
35
|
+
|
|
36
|
+
// Mostra help se solicitado
|
|
37
|
+
if (args?.help) {
|
|
38
|
+
this.showHelp();
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
17
41
|
|
|
18
42
|
// Extrai filtros de teste dos positionals (após o comando "test")
|
|
19
43
|
const filter = positionals?.slice(1).join(" ") || undefined;
|
|
@@ -6,7 +6,32 @@ import path from "path";
|
|
|
6
6
|
import fs from "fs";
|
|
7
7
|
|
|
8
8
|
export class TomcatCommand implements Command {
|
|
9
|
+
private showHelp(): void {
|
|
10
|
+
Logger.section("Tomcat Command");
|
|
11
|
+
Logger.log(`${Logger.C.bold}Usage:${Logger.C.reset} xavva tomcat <action> [options]`);
|
|
12
|
+
Logger.newline();
|
|
13
|
+
Logger.log(`${Logger.C.bold}Actions:${Logger.C.reset}`);
|
|
14
|
+
Logger.log(` ${Logger.C.primary}list${Logger.C.reset} List available Tomcat versions`);
|
|
15
|
+
Logger.log(` ${Logger.C.primary}installed${Logger.C.reset} List installed versions`);
|
|
16
|
+
Logger.log(` ${Logger.C.primary}install${Logger.C.reset} Install a version`);
|
|
17
|
+
Logger.log(` ${Logger.C.primary}use${Logger.C.reset} Set version for this project`);
|
|
18
|
+
Logger.log(` ${Logger.C.primary}uninstall${Logger.C.reset} Remove a version`);
|
|
19
|
+
Logger.log(` ${Logger.C.primary}status${Logger.C.reset} Show current configuration`);
|
|
20
|
+
Logger.newline();
|
|
21
|
+
Logger.log(`${Logger.C.bold}Examples:${Logger.C.reset}`);
|
|
22
|
+
Logger.log(` xavva tomcat list`);
|
|
23
|
+
Logger.log(` xavva tomcat install 9.0.115`);
|
|
24
|
+
Logger.log(` xavva tomcat use 10.1.52`);
|
|
25
|
+
Logger.log(` xavva tomcat status`);
|
|
26
|
+
}
|
|
27
|
+
|
|
9
28
|
async execute(config: AppConfig, args?: CLIArguments, positionals?: string[]): Promise<void> {
|
|
29
|
+
// Mostra help se solicitado
|
|
30
|
+
if (args?.help) {
|
|
31
|
+
this.showHelp();
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
|
|
10
35
|
// A ação vem como positional após "tomcat" (ex: xavva tomcat list)
|
|
11
36
|
const tomcatIndex = positionals?.indexOf("tomcat") ?? -1;
|
|
12
37
|
const action = positionals && tomcatIndex >= 0 && positionals[tomcatIndex + 1]
|
package/src/index.ts
CHANGED
|
@@ -49,9 +49,15 @@ async function main() {
|
|
|
49
49
|
|
|
50
50
|
// Handler de help
|
|
51
51
|
if (values.help) {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
52
|
+
// Se for help de comando específico, deixa o comando tratar
|
|
53
|
+
if (commandName !== "help" && commandName !== "deploy") {
|
|
54
|
+
// O comando específico vai tratar o --help
|
|
55
|
+
} else {
|
|
56
|
+
// Help geral
|
|
57
|
+
const { HelpCommand } = await import("./commands/HelpCommand");
|
|
58
|
+
new HelpCommand().execute(config, values as CLIArguments);
|
|
59
|
+
await processManager.shutdown(0);
|
|
60
|
+
}
|
|
55
61
|
}
|
|
56
62
|
|
|
57
63
|
// Inicializa Container de DI
|