Markdown Converter
Agent skill for markdown-converter
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
Sign in to like and favorite skills
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
Genifest is a Kubernetes manifest generation tool that creates deployment manifests from templates for GitOps workflows. It's a Go CLI application built with Cobra that processes configuration files to generate Kubernetes resources.
IMPORTANT NOTE: The project is currently in the process of rewrite.
The project maintains comprehensive documentation in the
docs/ directory, built with Material for MkDocs:
docs/getting-started/)installation.md) - Installation methods and requirementsquickstart.md) - Basic tutorial to get users running quicklyconfiguration.md) - Overview of configuration conceptsdocs/user-guide/)concepts.md) - Fundamental concepts and terminologycli-reference.md) - Complete command-line interface documentationconfiguration.md) - Detailed configuration file structurevalue-generation.md) - How ValueFrom expressions worktag-filtering.md) - Tag-based change filtering systemdocs/examples/)guestbook.md) - Step-by-step tutorial using the guestbook examplepatterns.md) - Typical usage patterns and best practicesgitops.md) - Integration with GitOps practicesdocs/reference/)schema.md) - Complete YAML configuration schemakeyselectors.md) - YAML path selection syntaxvaluefrom.md) - All supported value generation typesfunctions.md) - Function definition and usagetroubleshooting.md) - Common issues and solutionsdocs/development/)contributing.md) - How to contribute to the projectarchitecture.md) - Technical architecture overviewtesting.md) - Testing strategies and practicesreleases.md) - How releases are created and managedchangelog.md) - Version history and changesindex.md) - Documentation site landing pageThe codebase follows a typical Go CLI structure:
main.go - Entry point that calls cmd.Execute()internal/cmd/ - Cobra command definitions (root.go, generate.go)internal/config/ - Configuration parsing and managementThe configuration system uses a metadata-driven loading approach:
Config - Main configuration structure containing metadata, files, changes, and functionsMetaConfig - Metadata including cloudHome and unified paths configurationPathConfig - Unified path configuration with capabilities (scripts/files) and configurable depthPathContext - Represents paths with context about where they were definedChangeOrder - Defines modifications to be applied to managed filesFunctionDefinition - Defines reusable functions for value generationValueFrom - Union type for different value sources (functions, templates, scripts, etc.)genifest.yaml - Loads the top-level configuration firstpaths configuration to discover additional directoriesgenifest.yaml containing all .yaml/.yml filesUsing Make (Recommended):
# Show all available targets make help # Development workflow make build # Build the application make test # Run all tests make lint # Run linters make check # Run all checks (fmt, vet, lint, test) # Example testing make run-example # Run guestbook example make validate-example # Validate guestbook example make config-example # Show merged config make tags-example # Show available tags # Release make release # Build release binaries for all platforms make install # Install to GOPATH/bin
Manual Commands:
# Build the application go build -o genifest # Install from source go install github.com/zostay/genifest/cmd/genifest@latest # Run tests go test ./... # Lint (using golangci-lint) golangci-lint run --timeout=5m # Run the CLI tool from project root ./genifest run # Apply all changes ./genifest run --include-tags production # Apply only production changes ./genifest run --exclude-tags staging # Apply all except staging changes ./genifest tags # List available tags ./genifest validate # Validate configuration ./genifest config # Display merged configuration ./genifest version # Show version information
The genifest CLI uses a subcommand-based architecture with optional directory arguments:
# Core commands (can be run from any directory) genifest run [directory] # Apply changes genifest tags [directory] # List available tags genifest validate [directory] # Validate configuration genifest config [directory] # Display merged configuration genifest version # Show version information # Tag filtering options for 'run' command: -i, --include-tags strings include only changes with these tags (supports glob patterns) -x, --exclude-tags strings exclude changes with these tags (supports glob patterns) # Examples: genifest run # Apply all changes in current directory genifest run path/to/project # Apply changes in specified directory genifest run --include-tags production # Apply only production-tagged changes
Tag filtering logic:
prod*, test-*, etc.Enhanced Output:
file -> document[index] -> key: old → newmetadata: cloudHome: "." # Optional: override cloudHome for this scope paths: - path: "scripts" # Directory path scripts: true # Enable script execution access depth: 0 # Single level only (0-based) - path: "k8s" # Directory path files: true # Enable file inclusion access depth: 1 # One level deep (0-based) - path: "files" # Directory path files: true # Enable file inclusion access depth: 0 # Single level only (0-based) files: include: - "deployment.yaml" # Files managed by genifest - "service.yaml" changes: - tag: "production" # Optional tag for conditional application fileSelector: "*.yaml" keySelector: ".spec.replicas" valueFrom: default: value: "3" functions: - name: "get-replicas" # Reusable function definition params: - name: "environment" required: true valueFrom: template: string: "replicas-${environment}" variables: - name: "environment" valueFrom: argRef: name: "environment"
genifest.yaml or creates synthetic configpaths configuration to discover additional directoriesgenifest.yaml get synthetic configs with all YAML filesinternal/changes/)The system implements a sophisticated value evaluation architecture:
gopkg.in/yaml.v3 for parsing and modifying YAML documents.spec.replicas, array access [0], and nested pathsinternal/cmd/)The command-line interface implements a subcommand-based architecture:
file -> document[index] -> key: old → new for all modificationsSimplified yq Integration: Instead of full
github.com/mikefarah/yq/v4 integration, implemented basic key selector parsing for common patterns. This avoided API complexity while supporting essential use cases.
Immutable Contexts: EvalContext operations return new instances rather than modifying existing ones, enabling safe concurrent use and preventing unexpected state changes.
Document Reference Strategy: Chose to implement document references by re-evaluating ValueFrom expressions in document context rather than pre-computing values, allowing dynamic document-aware value generation.
Tag Processing: Implemented tag filtering at the change application level rather than configuration loading level, providing more flexible runtime control.
---.spec.template.spec.containers[0].image require careful parsinggenifest.yaml before processingWhen working with documentation:
docs/)mkdocs.yml--8<-- "includes/mkdocs.md" snippet inclusion for common contentmake docs-serve before committing