How badie005/bdev-cli works
Project Type and Purpose
• B.DEV CLI is a Python-based command-line interface (“personal development assistant”) with a plugin architecture.
• It provides over 150 commands via 12 plugins, plus a REPL mode, custom scripts, snippets, templates, and security/configuration management.
High-Level Architectural Components
a. CLI Launcher
• Entry scripts: bdev.py, cli/__main__.py, cli/main.py
• Windows wrappers: .ps1 and .bat scripts for install, uninstall, direct mode, profile loading
b. Core Engine
• Configuration (cli/core/config.py)
• REPL and direct modes (cli/core/repl.py, bdev_direct.py)
• Security sandbox and MFA (cli/core/security.py)
• Command dispatch & plugin loader
c. Plugin Subsystem
• Plugin registry & context (cli/plugins/__init__.py, context.py)
• Individual plugins (docker, npm, database, git_tools, system, project, doctor, scripts, snippets, templates, todo, shell)
• Each plugin implements a set of subcommands using a common CLI API
d. Utilities
• UI helper (cli/utils/ui.py)
• Theming (cli/utils/theme.py)
• Error handling (cli/utils/errors.py)
e. Persistence & Storage
• Local file system for templates, snippets, scripts
• Configuration files / profiles loaded via add-to-profile.ps1
• Command history (likely stored under user home or project context)
f. External Integrations
• Docker daemon (via Docker SDK or CLI)
• NPM registry / node CLI
• Git executable
• Relational databases (via CLI clients or drivers)
• System shell (bash/pwsh)
Interactions and Data Flows
• User Input (terminal) → Launcher → Core Engine
• Core Engine → Plugin Manager → Selected Plugin
• Plugins communicate with external systems and may read/write:
• File system (templates, scripts, snippets)
• Network services (Docker, NPM, DB servers)
• Core Engine collects plugin responses and renders output via UI utils
Architectural Patterns and Principles
• Plugin-based architecture: decouples command implementations
• Command pattern: each CLI command is an object/module
• Separation of concerns:
• Core for plumbing (config, REPL, security)
• Plugins for domain logic
• Utils for cross-cutting concerns (UI, theme, errors)
• Extensibility: new plugins drop into cli/plugins folder
• Shell wrappers provide cross-platform entrypoints without modifying code
Technologies and Frameworks
• Python 3.10+
• Packaging: setup.py, pyproject.toml, requirements.txt
• Shell scripting: PowerShell (.ps1), Windows batch (.bat)
• Potential use of Click or argparse (inferred for command parsing)