Skip to content

Conversation

@martin-helmich
Copy link
Member

Summary

Adds support for deploying stacks directly from GitHub template repositories using the new --from-template flag.

This enables users to quickly deploy pre-configured application stacks without manually managing docker-compose files locally. Template names like mittwald/n8n automatically resolve to the corresponding mittwald/stack-template-n8n repository.

What This Enables

Quick Stack Deployment
Deploy popular applications instantly from curated templates:

mw stack deploy --from-template=mittwald/n8n --stack-id=s-abc123

Template Repository Naming
Template names follow a simple convention:

  • Input: mittwald/n8n
  • Resolves to: github.com/mittwald/stack-template-n8n

Environment Configuration
Templates can include default environment variables via .env files, which can be overridden:

# Use template defaults
mw stack deploy --from-template=mittwald/n8n

# Override with local environment
mw stack deploy --from-template=mittwald/n8n --env-file=./production.env

Environment Variable Priority (from lowest to highest):

  1. Template .env file (if present)
  2. System environment variables
  3. Local --env-file flag

Behavior

  • Fetches docker-compose.yml and optional .env from the template repository's main branch
  • Mutually exclusive with --compose-file flag (prevents accidental mixing of local and remote sources)
  • Clear error messages for common issues (template not found, rate limits, network errors)
  • No local caching - always fetches fresh template content

Use Cases

  • Quick prototyping: Spin up applications without setup overhead
  • Standardized deployments: Teams can share vetted stack configurations via templates
  • Easy onboarding: New users can deploy complex stacks with a single command
  • Version consistency: Templates ensure everyone uses the same configuration

🤖 Generated with Claude Code

Add support for deploying stacks from GitHub template repositories.
Template names like "mittwald/n8n" are automatically converted to
"mittwald/stack-template-n8n" repositories. Fetches both
docker-compose.yml and .env files from the main branch.

Features:
- New --from-template flag (mutually exclusive with --compose-file)
- Custom error types for better error handling (TemplateFileNotFoundError,
  GitHubRateLimitError, TemplateNetworkError)
- Environment variable precedence: template .env < process.env < --env-file
- Comprehensive unit tests with axios mocking

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <[email protected]>
…e stack ID

Add support for filling missing environment variables from templates
using __PROMPT__ and __GENERATE__ placeholders, retrieve existing stack
state before deploying, and auto-resolve stack ID from project context.

Co-Authored-By: Claude Opus 4.5 <[email protected]>
@martin-helmich martin-helmich marked this pull request as ready for review January 29, 2026 13:12
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds support for deploying container stacks directly from GitHub template repositories using a new --from-template flag. Users can now quickly deploy pre-configured applications without managing local docker-compose files.

Changes:

  • Introduces template loading functionality with GitHub repository fetching and environment variable handling
  • Adds a custom retrieve function to automatically detect single stacks in a project context
  • Updates the deploy command to support both local file and template-based deployments

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/lib/resources/stack/template-loader.ts Core template loading logic with GitHub API integration and error handling
src/lib/resources/stack/template-loader.test.ts Comprehensive test suite for template loading functionality
src/lib/resources/stack/flags.ts Adds automatic stack ID retrieval for single-stack projects
src/lib/resources/stack/env.ts Extends environment handling with prompt and generate placeholders
src/lib/context/FlagSetBuilder.ts Adds retrieveFunction option to flag set builder
src/commands/stack/deploy.tsx Integrates template loading into deploy command with new flag
docs/stack.md Documents the new --from-template flag and its behavior

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@martin-helmich martin-helmich merged commit acf2c70 into master Jan 29, 2026
11 checks passed
@martin-helmich martin-helmich deleted the feat/stack-templates branch January 29, 2026 14:27
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