Skip to content

Implement core command infrastructure and build command logic#2

Merged
jeffreyaven merged 3 commits intomainfrom
claude/rust-stackql-deploy-port-xyr7K
Feb 12, 2026
Merged

Implement core command infrastructure and build command logic#2
jeffreyaven merged 3 commits intomainfrom
claude/rust-stackql-deploy-port-xyr7K

Conversation

@jeffreyaven
Copy link
Contributor

Summary

This PR implements the core infrastructure for stackql-deploy commands, including a new CommandRunner base class that encapsulates shared resource processing logic, along with comprehensive implementations of configuration, templating, utilities, and environment handling modules. The build command is refactored to use this new infrastructure.

Key Changes

Core Infrastructure

  • New src/commands/base.rs: Introduces CommandRunner struct that serves as the Rust equivalent of Python's StackQLBase class. Handles:

    • Client and template engine initialization
    • Manifest loading and provider pulling
    • Global context rendering
    • Resource processing with full context resolution
    • Query execution and result handling
    • Export variable management
  • New src/core/config.rs: Configuration module for:

    • Rendering global variables from manifest and environment
    • Building full template context for resources
    • SQL-compatible value conversion
    • Resource type resolution
  • New src/core/utils.rs: Low-level utility functions including:

    • StackQL query execution with retry logic
    • Error handling and exit procedures
    • Provider pulling and management
    • External script execution
    • Export variable handling
    • Query result processing
  • New src/core/templating.rs: Query template handling:

    • Loading and parsing .iql files
    • Query option parsing (retries, delays, etc.)
    • Template rendering with context
  • New src/core/env.rs: Environment variable management:

    • Loading from .env files
    • CLI override support

Command Updates

  • src/commands/build.rs: Refactored to use CommandRunner infrastructure with full resource deployment logic
  • src/commands/teardown.rs: Updated with new command structure
  • src/commands/test.rs: Updated with new command structure
  • src/commands/mod.rs: Added base module export

Template Engine Enhancements

  • src/template/engine.rs: Extended with additional rendering capabilities
  • src/template/context.rs: Enhanced context management

Documentation

  • Comprehensive website documentation added via Docusaurus including:
    • Getting started guide
    • Manifest file specification
    • Resource query files documentation
    • Template filters reference
    • CLI command references (build, teardown, test, init, etc.)
    • Template library examples (AWS VPC/EC2, Azure VNet/VM, Kubernetes the Hard Way)
    • GitHub Actions integration guide

Build & Configuration

  • Updated Cargo.toml with additional dependencies
  • Updated CI workflow from "Build" to "CI"
  • Added website configuration and theme customization

Implementation Details

  • The CommandRunner follows a builder pattern for initialization, loading all necessary components (manifest, environment, providers) in sequence
  • Retry logic with exponential backoff is implemented for resilient query execution
  • Template rendering supports Jinja-like syntax with variable substitution
  • Export handling allows resources to pass values to subsequent resources in the deployment chain
  • Error handling uses structured logging with graceful exit procedures

https://claude.ai/code/session_01ShAyjRLWBYC3tPsusCxggv

Implements the complete deployment orchestration engine matching the
Python stackql-deploy project:

- Core modules (src/core/): config rendering (globals, properties,
  merge operations), .env file loading, SQL query templating with
  anchor parsing, and StackQL execution utilities with retry logic
- Template engine: Replaced simple variable substitution with
  Tera-based Jinja2-compatible engine including custom filters
  (from_json, base64_encode, merge_lists, merge_objects,
  generate_patch_document, sql_list, sql_escape)
- Build command: Full deployment workflow with smart state checking
  (3 flows: traditional, optimized exports proxy, basic exists),
  create/update/createorupdate support, post-deploy verification
- Teardown command: Reverse-order resource deletion with pre-delete
  existence checks, post-delete confirmation with configurable retries
- Test command: Resource validation via statecheck queries or exports
  proxy optimization, with stack-level exports output
- Base command runner: Shared resource processing (conditional
  evaluation, script execution, provider pulling, export handling,
  stack-level JSON output)
- Manifest extensions: Added sql, run, skip_validation, auth fields
  and support for dict-style export remapping
- Updated print_unicode_box to support BorderColor parameter

https://claude.ai/code/session_01ShAyjRLWBYC3tPsusCxggv
Migrated the documentation site from the Python stackql-deploy project
with all references updated for the Rust-based binary distribution model:

- Installation via Homebrew tap, Chocolatey, MSI, Linux bundle, Mac pkg
- New /install page covering all platform-specific installation methods
- Removed Python-specific flags (--download-dir, --custom-registry)
- Updated CLI reference docs (info, upgrade, shell, build, teardown, test)
- Updated GitHub Actions docs for binary-based workflow
- Replaced all PyPI/pystackql/pip references with binary equivalents
- Updated repo links to stackql-labs/stackql-deploy-rs
- Added template-filters to sidebar navigation

https://claude.ai/code/session_01ShAyjRLWBYC3tPsusCxggv
- Restructured build.yml into 4 parallel/sequential jobs: fmt, clippy,
  test (run in parallel), then build (runs after all pass)
- Fixed all clippy warnings (dead_code, unwrap-after-is_some,
  collapsible-if, map_or simplification, lifetime elision, etc.)
- Applied rustfmt formatting across all source files

https://claude.ai/code/session_01ShAyjRLWBYC3tPsusCxggv
@jeffreyaven jeffreyaven merged commit acccb11 into main Feb 12, 2026
5 of 7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants