feat(configmanager): add CLI feature parity with UI

Expand ConfigManager.Cli with pipeline, config, backup, and connection commands
to match the feature set of ConfigManager.Ui, plus README documentation.
This commit is contained in:
Joseph Doherty
2026-01-28 10:40:25 -05:00
parent 1fc7792cd1
commit bad0102af1
10 changed files with 3158 additions and 0 deletions
@@ -0,0 +1,273 @@
# JdeScoping ConfigManager CLI
Command-line tool for managing JDE Scoping Tool configuration files, ETL pipelines, connection strings, secrets, and backups.
## Installation
Build the tool from the solution:
```bash
dotnet build NEW/src/Utils/JdeScoping.ConfigManager.Cli/JdeScoping.ConfigManager.Cli.csproj
```
The executable is located at:
- **Windows:** `bin/Debug/net10.0/jdescoping-config.exe`
- **macOS/Linux:** `bin/Debug/net10.0/jdescoping-config`
## Global Options
These options apply to all commands:
| Option | Alias | Description |
|--------|-------|-------------|
| `--config-path` | `-c` | Path to configuration folder (overrides auto-discovery) |
| `--verbose` | `-v` | Enable verbose output |
| `--quiet` | `-q` | Suppress non-error output |
## Configuration Discovery
If `--config-path` is not specified, the tool searches for configuration in this order:
1. `JDESCOPING_CONFIG_PATH` environment variable
2. Same directory as the executable
3. `../JdeScoping.Host/` relative to executable
4. User config directory (`~/.jdescoping` on Unix, `%LOCALAPPDATA%\JdeScoping` on Windows)
## Commands Reference
### Validation Commands
Validate configuration files for errors and warnings.
```bash
# Validate appsettings.json
jdescoping-config validate appsettings
# Validate all pipeline files
jdescoping-config validate pipelines
# Validate all configuration files
jdescoping-config validate all
# Run runtime infrastructure validators
jdescoping-config validate runtime
```
### Connection Testing Commands
Test database connections defined in configuration.
```bash
# Test SQL Server connection
jdescoping-config test-connection sql
# Test a specific named connection
jdescoping-config test-connection sql --name SqlServerCache
# Test Oracle connection
jdescoping-config test-connection oracle
# Test all configured connections
jdescoping-config test-connection all
```
### Secret Management Commands
Manage encrypted secrets in SecureStore.
```bash
# Initialize a new SecureStore
jdescoping-config secret init
# List all secret keys
jdescoping-config secret list
# Get a secret value
jdescoping-config secret get <key>
# Set or update a secret
jdescoping-config secret set <key> <value>
# Remove a secret
jdescoping-config secret remove <key>
```
### Pipeline Management Commands
Manage ETL pipeline configurations.
```bash
# List all pipelines with status
jdescoping-config pipeline list
# Example output:
# === Pipelines (3) ===
# Name Enabled Mass Daily Hourly
# -------------------- -------- -------- -------- --------
# WorkOrder_Curr Yes 1w 1d 1h
# LotUsage_Curr Yes 1w 1d -
# Item No 1w - -
# Show detailed pipeline configuration
jdescoping-config pipeline show <name>
# Create a new pipeline with defaults
jdescoping-config pipeline create <name>
jdescoping-config pipeline create <name> --enabled false
jdescoping-config pipeline create <name> --manual-only
# Delete a pipeline
jdescoping-config pipeline delete <name>
jdescoping-config pipeline delete <name> --force # Skip confirmation
# Enable/disable a pipeline
jdescoping-config pipeline enable <name>
jdescoping-config pipeline disable <name>
```
### Configuration Viewing Commands
View configuration settings (read-only).
```bash
# Show specific sections
jdescoping-config config show datasync
jdescoping-config config show dataaccess
jdescoping-config config show auth
jdescoping-config config show ldap
jdescoping-config config show search
jdescoping-config config show excelexport
jdescoping-config config show securestore
# Show connection names (no secrets)
jdescoping-config config show connections
# Show all configuration sections
jdescoping-config config show all
# Output as JSON
jdescoping-config config show datasync --json
jdescoping-config config show all --json
```
### Backup Management Commands
Manage configuration file backups.
```bash
# Create a backup of appsettings.json
jdescoping-config backup create
# List available backups
jdescoping-config backup list
# Example output:
# === Backups (3) ===
# Timestamp Size Path
# -------------------- ------------ --------------------------------
# 2026-01-15_120000 1.2 KB appsettings.2026-01-15_120000.bak
# 2026-01-14_090000 1.1 KB appsettings.2026-01-14_090000.bak
# Restore a specific backup
jdescoping-config backup restore <timestamp>
jdescoping-config backup restore 2026-01-15_120000
# Remove old backups (keep most recent N)
jdescoping-config backup cleanup
jdescoping-config backup cleanup --keep 5
```
### Connection String Management Commands
Manage database connection strings.
```bash
# List all connections
jdescoping-config connection list
# Example output:
# === Connections (3) ===
# Name Provider Server/Host
# ------------------------- --------------- ------------------------------
# SqlServerCache SqlServer localhost
# JdeOracle Oracle jde-prod-server
# CmsSybase Generic (raw)
# Show connection details (password masked)
jdescoping-config connection show <name>
jdescoping-config connection show SqlServerCache
# Add a new SQL Server connection
jdescoping-config connection add MyConnection \
--provider SqlServer \
--server localhost \
--database MyDatabase \
--user sa \
--password secret123 \
--port 1434
# Add a new Oracle connection
jdescoping-config connection add JdeOracle \
--provider Oracle \
--server oracle-host \
--service-name JDEPRD \
--port 1521 \
--user jdeuser
# Add a Generic connection (raw connection string)
jdescoping-config connection add CustomDb \
--provider Generic \
--raw "Driver={...};Server=...;Database=..."
# Remove a connection
jdescoping-config connection remove <name>
```
## Exit Codes
| Code | Description |
|------|-------------|
| 0 | Success |
| 1 | Error (validation failure, missing file, operation error) |
## Examples
### Validate and test before deployment
```bash
# Validate all configuration
jdescoping-config validate all
# Test all database connections
jdescoping-config test-connection all
# Create a backup before making changes
jdescoping-config backup create
```
### Quick status check
```bash
# View pipelines
jdescoping-config pipeline list --quiet
# View connections
jdescoping-config connection list --quiet
```
### Scripted configuration
```bash
# Disable a pipeline for maintenance
jdescoping-config pipeline disable WorkOrder_Curr
# Re-enable after maintenance
jdescoping-config pipeline enable WorkOrder_Curr
```
### Export configuration as JSON
```bash
# Export all config to JSON for review
jdescoping-config config show all --json > config-snapshot.json
```