simplemdg-cli
v1.0.6
Published
Unified CLI wrapper for SimpleMDG BTP operations
Downloads
537
Maintainers
Readme
SimpleMDG CLI
The Problem
The SimpleMDG team uses a variety of powerful tools (cf-sync, cf-explorer, cf-tail, etc.) to interact with SAP BTP Cloud Foundry environments. However, installing, updating, and remembering the commands for 10+ different packages creates a steep learning curve for new developers. Furthermore, each package requires the developer to authenticate or provide configuration repeatedly.
The Solution
simplemdg-cli (alias: mdg) is a "Smart Proxy" Meta-CLI. It acts as the single unified entry point for all SAP BTP developer operations.
- Single Install:
npm i -g simplemdg-cligives you everything. - Centralized Config: It reads
~/.simplemdgrconce and injects SSO/Auth context into all sub-tools automatically. - Lazy Loading (Zero Overhead): Thanks to the Proxy Engine, sub-CLIs are never loaded into memory until you actually invoke their specific command. Boot time is near-instantaneous (
~0.01s).
Quick Start
# Install globally
npm i -g simplemdg-cli
# Verify installation
mdg --helpAvailable Commands
| Command | Wrapped Package | Description |
|----------------|-----------------|-------------|
| mdg login | (Native) | Interactively log in and save credentials securely. |
| mdg doctor | (Native) | Check if system meets all CLI requirements. |
| mdg init | (Native) | Initialize a local .simplemdgrc for project-specific overrides. |
| mdg config | (Native) | Manage SimpleMDG global configuration (e.g., mdg config set SAP_EMAIL xyz). |
| mdg sync | @saptools/cf-sync | Sync files and CF topology. |
| mdg files | @saptools/cf-files | Download default-env.json and pull container files. |
| mdg explorer | @saptools/cf-explorer | Interactive read-only SSH file explorer. |
| mdg tail | @saptools/cf-tail | Stream and aggregate logs from multiple CF apps. |
| mdg export | @saptools/cf-export | Export CAP/CF artifacts (package.json, .cdsrc). |
| mdg events | @saptools/cf-events | Inspect CF audit events and detect active SSH sessions. |
| mdg trace | @saptools/cf-live-trace | Live HTTP request/response trace for CF Node.js apps. |
Note: Any arguments, flags, or subcommands you pass to the commands above are transparently proxied to the underlying tools. For example, mdg files ls ap10/my-org/space/app works exactly like saptools-cf-files ls ap10/my-org/space/app.
Configuration
SimpleMDG CLI supports both Global and Local configuration files (.simplemdgrc). Local configs override global configs.
Global Configuration
Run mdg login to interactively set your global configuration, or create a ~/.simplemdgrc JSON file in your home directory:
{
"SAP_EMAIL": "[email protected]",
"SAP_PASSWORD": "your-secure-password"
}Local Configuration (Project-Specific)
Run mdg init inside your project folder to generate a local ./.simplemdgrc. This is perfect for setting environment-specific overrides (like changing spaces/orgs for a specific repo) without affecting your global settings.
Important: Always add .simplemdgrc to your project's .gitignore!
Architecture
simplemdg-cli uses a Smart Proxy Pattern:
- When you run
mdg <command> <args>, the CLI identifies the underlying@saptools/*package. - It parses your centralized
~/.simplemdgrcconfiguration. - It spawns a child process invoking the target package's
bindirectly, inheritingstdioandprocess.env. - Return codes and signals are seamlessly bubbled up to the user.
Contributing
# Install dependencies
pnpm install
# Run strict checks (ESLint, TypeScript, Vitest, CSpell)
pnpm run check
# Build
pnpm run build👨💻 Author
dongtran ✨
📄 License
MIT
Made with ❤️ to make your work life easier!
