How jaykv/cliffy works
Main Components
a) Core Processing Components:
• Manifest Parser (parser.py)
• CLI Builder (builder.py)
• Command Manager (commander.py)
• Manifest Merger (merger.py)
• Code Transformer (transformer.py)
b) Commander Implementations:
• Click Commander
• Typer Commander
c) External Dependencies:
• Typer (Main CLI framework)
• Rich (Optional for formatting)
• PyBash (For subprocess calls)
• Shiv (For building zipapps)
┌─ Input Layer ─────────────────┐
• YAML Manifests │
• CLI Definitions │
• Command Configurations │
• ┬───────────────┘
• ↓
┌─ Core Processing Layer ───────┐
• ┌─ Parser ─┐ ┌─ Merger ─┐ │
• YAML to │←→ │ Combine │ │
• Objects │ │Manifests │ │
• ┬─────┘ └────────┬─┘ │
• ↓ ↓ │
• ┌─ Builder ──────────────┐ │
• Generate CLI Structure │ │
• ┬───────────┘ │
• ↓ │
• ┌─ Commander ─────────────┐ │
• ┌─────────┐ ┌────────┐ │ │
• Typer │ │ Click │ │ │
• Commander│ │Commander│ │ │
• ┘ └────────┘ │ │
• ┬─┘ │
• ┬───────────────┘
• ↓
┌─ Output Layer ────────────────┐
• ┌─ Generated CLI ───────────┐│
• Python Scripts ││
• Portable Zipapps ││
• ┬─┘│
• ┘
Important Elements to Highlight
a) Development Flow:
• Hot-reload capability (reloader.py)
• Testing components (tester.py)
• Build process flow
b) Integration Points:
• How PyBash integrates for shell commands
• Jinja2 template processing
• Package management integration
Implementation Details
• The manifest-driven architecture
• The plugin-style commander system
• The transformation pipeline from YAML to executable CLI
• The build system for creating portable applications
Key Relationships
• How the manifest loader (loader.py) interacts with the parser
• How the transformer processes different command types
• Relationship between commanders and the generated CLI
• How the builder integrates with external packaging tools
• Nested components and layers
• Export to common formats (SVG, PNG)
• Easy updates for future modifications
Remember to maintain a balance between detail and clarity, focusing on the core architectural components while providing enough detail to understand the system's operation.