Skip to content

Add lifecycle management commands for standardized development workflows #59

@ppolydoras

Description

@ppolydoras

Overview

This issue proposes adding lifecycle management commands to MXCP to standardize common development workflows like setup, testing, and deployment.

Problem Statement

Currently in MXCP projects:

  • Setup scripts, test runners, deployment scripts are scattered across directories
  • No standardized way to run common development tasks
  • Scripts are often project-specific and not reusable
  • Cross-platform compatibility issues (bash scripts don't work on Windows)
  • Developers need to remember multiple commands and their locations

Proposed Solution

Add a new mxcp dev command group with subcommands for common lifecycle tasks:

Commands

  • mxcp dev setup - Initialize project dependencies and environment
  • mxcp dev test [--level light|full|unit] - Run tests at different levels
  • mxcp dev deploy --target <target> - Deploy to configured targets
  • mxcp dev run <command> - Execute custom lifecycle commands
  • mxcp dev list - List all available lifecycle commands

Configuration

Projects define lifecycle commands in mxcp-site.yml:

lifecycle:
  setup:
    description: "Initialize project"
    commands:
      - command: "pip install -r requirements.txt"
        name: "Install dependencies"
      - command: "dbt deps"
        name: "Install dbt packages"
        condition: "if_not_exists:dbt_packages"
  
  test:
    light:
      description: "Quick tests"
      commands:
        - "mxcp test"
    full:
      description: "All tests"
      commands:
        - "mxcp test"
        - "dbt test"
        - "pytest"
  
  deploy:
    targets:
      production:
        description: "Deploy to AWS"
        commands:
          - "./deploy.sh"
        environment:
          required: ["AWS_REGION"]
  
  custom:
    clean:
      description: "Clean files"
      commands:
        - "rm -rf target/"

Benefits

  1. Consistency: All team members use the same commands
  2. Cross-platform: Works on Windows, macOS, and Linux
  3. Self-documenting: Commands are defined with descriptions
  4. Discoverable: List all available commands with mxcp dev list
  5. Safe: Preview commands with --dry-run before executing

Implementation

  • Add new src/mxcp/cli/dev.py module
  • Update schema to support lifecycle configuration
  • Create comprehensive tests
  • Add documentation

This aligns with MXCP's existing patterns (similar to mxcp dbt wrapper) and enhances the developer experience.

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions