Manage constructs and stacks.
dotgithub construct <subcommand> [options]The construct command provides comprehensive management of DotGitHub constructs and stacks. Constructs are the core mechanism for generating workflows, while stacks group constructs together for organized workflow generation.
construct list- List configured constructsconstruct add- Add a construct configurationconstruct remove- Remove a construct configurationconstruct create- Create a construct from .github filesconstruct describe- Describe construct information and configuration schema
construct stack list- List configured stacksconstruct stack add- Add a stack configurationconstruct stack remove- Remove a stack configuration
List all configured constructs.
dotgithub construct listShows all constructs with their status (enabled/disabled) and configuration.
Add a new construct to your configuration.
dotgithub construct add --name <name> --package <package> [options]Options:
--name <name>- Construct name (required)--package <package>- Construct package (npm package or local path) (required)--enabled- Enable the construct (default: true)--config <json>- Construct configuration as JSON string
Examples:
# Add a local construct
dotgithub construct add --name "my-construct" --package "./constructs/my-construct"
# Add an npm package
dotgithub construct add --name "ci-construct" --package "@myorg/ci-construct"
# Add with configuration
dotgithub construct add --name "deploy" --package "./deploy-construct" --config '{"environment": "production"}'Remove a construct from your configuration.
dotgithub construct remove --name <name>Options:
--name <name>- Construct name to remove (required)
Create a construct from existing .github files.
dotgithub construct create --name <name> --source <path|repo|url> [options]Options:
--name <name>- Construct name (required)--source <path|repo|url>- Source of .github files (required)--description <desc>- Construct description--overwrite- Overwrite existing construct file--auto-add-actions- Automatically add TypeScript actions found in workflows--token <token>- GitHub token for auto-adding actions
Examples:
# Create from local directory
dotgithub construct create --name "my-workflows" --source "./.github"
# Create from GitHub repository
dotgithub construct create --name "example-construct" --source "octocat/example-repo@main"
# Create with auto-action detection
dotgithub construct create --name "ci-construct" --source "./.github" --auto-add-actionsDescribe construct information and configuration schema.
dotgithub construct describe [options]Options:
--name <name>- Specific construct name to describe--format <format>- Output format (text|markdown|json) (default: text)--search <keyword>- Search constructs by keyword--category <category>- Filter constructs by category--all- Describe all loaded constructs
Examples:
# Describe specific construct
dotgithub construct describe --name "my-construct"
# Search constructs
dotgithub construct describe --search "ci"
# Filter by category
dotgithub construct describe --category "deployment"
# Describe all constructs
dotgithub construct describe --all
# JSON output
dotgithub construct describe --name "my-construct" --format jsonList all configured stacks.
dotgithub construct stack listShows all stacks with their associated constructs and configuration.
Add a new stack configuration.
dotgithub construct stack add --name <name> --constructs <constructs> [options]Options:
--name <name>- Stack name (required)--constructs <constructs>- Comma-separated list of construct names (required)--config <json>- Stack configuration as JSON string
Examples:
# Add a CI stack
dotgithub construct stack add --name "ci" --constructs "checkout,setup-node,test"
# Add with configuration
dotgithub construct stack add --name "deploy" --constructs "build,deploy" --config '{"environment": "production"}'Remove a stack from your configuration.
dotgithub construct stack remove --name <name>Options:
--name <name>- Stack name to remove (required)
Constructs are TypeScript classes that implement the GitHubConstruct interface:
import { GitHubConstruct, GitHubStack } from '@dotgithub/core';
export class MyConstruct implements GitHubConstruct {
readonly name = 'my-construct';
readonly version = '1.0.0';
readonly description = 'My custom construct';
validate(stack: GitHubStack): void {
// Validate stack configuration
}
describe(): ConstructDescription {
// Return construct metadata
}
async synthesize(stack: GitHubStack): Promise<void> {
// Generate workflows
}
}
export default new MyConstruct();Constructs can accept configuration through the config property in dotgithub.json:
{
"constructs": [
{
"name": "my-construct",
"package": "./constructs/my-construct",
"config": {
"environment": "production",
"timeout": 30
},
"enabled": true
}
]
}Stacks group constructs together for organized workflow generation:
{
"stacks": [
{
"name": "ci",
"constructs": ["checkout", "setup-node", "test"],
"config": {
"node-version": "18"
}
}
]
}- Construct naming - Use descriptive, kebab-case names
- Configuration validation - Always validate construct configuration
- Error handling - Provide clear error messages
- Documentation - Include comprehensive construct descriptions
- Testing - Test constructs thoroughly before use
- Versioning - Use semantic versioning for constructs
- dotgithub synth - Synthesize workflows using constructs
- Construct Development Guide - Creating custom constructs
- Configuration Guide - Understanding dotgithub.json
- dotgithub init - Initialize a new project