Swap.CLI 0.0.2

The owner has unlisted this package. This could mean that the package is deprecated, has security vulnerabilities or shouldn't be used anymore.
dotnet tool install --global Swap.CLI --version 0.0.2
                    
This package contains a .NET tool you can call from the shell/command line.
dotnet new tool-manifest
                    
if you are setting up this repo
dotnet tool install --local Swap.CLI --version 0.0.2
                    
This package contains a .NET tool you can call from the shell/command line.
#tool dotnet:?package=Swap.CLI&version=0.0.2
                    
nuke :add-package Swap.CLI --version 0.0.2
                    

Swap CLI

GitHub License .NET Version NuGet GitHub Stars

Generate production-ready ASP.NET Core + HTMX applications with beautiful DaisyUI components.

Swap CLI is a code generator that creates complete, modern web applications using ASP.NET Core MVC, HTMX for interactivity, DaisyUI for UI components, and Entity Framework Core for data access. Generate full CRUD operations with pagination, search, sorting, filtering, and modal-based editing in seconds.

🌟 Why Swap?

  • ⚡ Production-Ready Code - Generate complete CRUD with modals, pagination, sorting, filtering, and search
  • 🎯 HTMX Simplicity - Modern, interactive web apps without JavaScript frameworks
  • � DaisyUI + Tailwind - Beautiful, accessible components out of the box
  • 🗄️ Entity Framework Core - Full database integration with migrations support
  • 💻 Developer Experience - CLI-driven workflow, no manual boilerplate
  • 📦 Proven Patterns - Every pattern extracted from real production applications

🚀 Quick Start

Prerequisites

Before installing Swap CLI, ensure you have:

  • .NET 9.0 SDK or later - Download
  • Node.js (LTS) - Includes npm for Tailwind CSS compilation
    • Windows: winget install OpenJS.NodeJS.LTS or download from nodejs.org
    • macOS: brew install node
    • Linux: Use your package manager
  • libman CLI - Manages client libraries (HTMX, DaisyUI)
    dotnet tool install -g Microsoft.Web.LibraryManager.Cli
    

Verify installations:

dotnet --version   # Should be 9.0 or higher
npm --version      # Any recent version
libman --version   # Any version

Installation

# Install the Swap CLI tool
dotnet tool install --global Swap.CLI --prerelease

# Verify installation
swap --version

Create Your First Project

# Create a new ASP.NET Core + HTMX application
swap new MyApp
cd MyApp

# Apply migrations and run
dotnet ef database update
dotnet run

Visit http://localhost:5000 - Your HTMX-powered application is running! 🎉

Note: The CLI automatically runs npm install, libman restore, and npm run build:css during project creation.

Generate Your First CRUD

# Generate a complete CRUD controller with all features
swap generate controller Product --fields "Name:string Price:decimal InStock:bool:f"

# Short alias
swap g c Product --fields "Name:string Price:decimal InStock:bool:f"

# Update database
dotnet ef migrations add AddProduct
dotnet ef database update

Visit http://localhost:5000/Product - Full CRUD with pagination, search, sorting, and filtering! 🚀

No manual file creation. No boilerplate. Just CLI commands and business logic.

🎯 What You Get

Complete Feature Set

Every generated controller includes:

  • CRUD Operations - Create, Read, Update, Delete via HTMX modals
  • Pagination - Configurable page sizes (10, 25, 50, 100)
  • Real-Time Search - 500ms debounced search across fields
  • Column Sorting - Ascending/descending toggle per field
  • Boolean Filtering - Dropdown filters (All/Yes/No) for bool fields
  • Bulk Operations - Select multiple items and bulk delete
  • Toast Notifications - Success/error messages with DaisyUI alerts
  • Modal Editing - No page reloads, smooth UX
  • Validation - Client and server-side with clear error messages
  • Responsive Design - Works perfectly on mobile and desktop

Generated Stack

  • Backend: ASP.NET Core 9.0 MVC
  • Frontend: HTMX + DaisyUI + Tailwind CSS
  • Database: Entity Framework Core (SQLite, SQL Server, PostgreSQL)
  • UI Library: DaisyUI 4.x components
  • Styling: Tailwind CSS 3.x utilities

📋 CLI Commands

swap new <name>

Create a new ASP.NET Core + HTMX application with DaisyUI components.

swap new MyApp

Generates:

  • Complete ASP.NET Core MVC project structure
  • Entity Framework Core with SQLite (configurable)
  • DaisyUI + Tailwind CSS configuration
  • Sample TodoItem model and CRUD
  • Database migrations
  • Ready to run immediately

swap generate controller <name> --fields <fields>

Generate a complete CRUD controller with all features.

# Generate Product controller with fields
swap g c Product --fields "Name:string Price:decimal InStock:bool:f"

# With nullable fields
swap g c Customer --fields "Name:string Email:string Notes:string?"

# Control sorting and filtering per field
swap g c Order --fields "OrderNumber:string:ns Total:decimal Date:DateTime Status:bool:f"

Field Flags:

  • :sortable or :s - Enable sorting (default for all fields)
  • :nosort or :ns - Disable sorting
  • :filterable or :f - Enable filtering (bool fields only)

Generates:

  • Controller with full CRUD operations
  • Model class with validation
  • View model for list operations
  • Views (Index, _List, _CreateModal, _EditModal, _DetailsModal)
  • Automatic DbContext updates

swap generate model <name> --fields <fields>

Generate just a model class (no controller or views).

swap g m Category --fields "Name:string Description:string?"

swap generate resource <name> --fields <fields>

Generate model + controller together (alias for backward compatibility).

swap g r BlogPost --fields "Title:string Content:string PublishedDate:DateTime"

📚 Documentation

🛠️ Development

Prerequisites

  • .NET 9.0 SDK or later
  • Your favorite IDE (Visual Studio 2022, VS Code, Rider)

Building the CLI from Source

# Clone the repository
git clone https://github.com/jdtoon/swap.git
cd swap

# Build the CLI tool
cd tools/Swap.CLI
dotnet build

# Run tests
cd ../Swap.CLI.Tests
dotnet test

# Install locally for testing
cd ../Swap.CLI
dotnet pack
dotnet tool install --global --add-source ./nupkg Swap.CLI

Project Structure

swap/
├── tools/
│   ├── Swap.CLI/              # CLI tool source code
│   │   ├── Commands/          # Command implementations
│   │   ├── Infrastructure/    # Template engine, helpers
│   │   └── Program.cs         # CLI entry point
│   └── Swap.CLI.Tests/        # 136 passing tests
│       ├── Commands/          # Command tests
│       └── Infrastructure/    # Template engine tests
├── templates/                 # Code generation templates
│   ├── monolith/             # New project template
│   └── generate/             # CRUD generation templates
│       ├── controller/       # Controller, views, view model
│       └── model/            # Model class
├── docs/                     # Documentation
│   ├── THE-PRODUCT.md        # Product vision
│   └── PATTERNS-LIBRARY.md   # HTMX patterns
├── wiki/                     # Docusaurus documentation site
└── README.md                 # This file

🤝 Contributing

Contributions are welcome! Whether it's bug reports, feature requests, or code contributions.

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Make your changes and add tests
  4. Ensure all tests pass (dotnet test)
  5. Commit your changes (git commit -m 'feat: Add amazing feature')
  6. Push to the branch (git push origin feature/amazing-feature)
  7. Open a Pull Request

See CONTRIBUTING.md for detailed guidelines.

📄 License

Swap CLI is MIT licensed. Use it freely in your projects, commercial or otherwise.

� Project Status

Current Version: 0.1.0-dev (Active Development)

✅ Phase 2C Complete (Current)

  • New Project Generation - swap new command with full ASP.NET Core setup
  • Controller Generation - swap g c with all CRUD operations
  • Model Generation - swap g m for entity classes
  • Pagination - Configurable page sizes (10, 25, 50, 100)
  • Search - Real-time search with 500ms debounce
  • Sorting - Column sorting with field-level control
  • Filtering - Boolean filters with dropdown UI
  • Modal Editing - Create, Edit, Details modals via HTMX
  • Bulk Delete - Select multiple items and delete
  • Toast Notifications - DaisyUI alerts for success/error
  • DaisyUI Components - Modern, accessible UI library
  • Tailwind CSS - Utility-first styling
  • 136 Passing Tests - Comprehensive test coverage
  • Documentation - Complete wiki with examples

🔄 Phase 2D: Seeders (Next)

  • Database Seeding - Generate seed data for testing
  • Faker Integration - Realistic fake data generation
  • Seeder Commands - swap g seeder CLI command

🎯 Phase 3: Polish & Release

  • NuGet Package - Publish to NuGet.org
  • VS Code Extension - Integrated CLI experience
  • Video Tutorials - Getting started screencasts
  • Production Release (v1.0.0) - Q1 2026

See the complete roadmap for details.

💬 Community

For questions or feedback, open an issue!


Built with ❤️ for the .NET community

Swap CLI - Generate production-ready ASP.NET + HTMX applications in seconds.

Product Compatible and additional computed target framework versions.
.NET net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

This package has no dependencies.

Version Downloads Last Updated