@@ -569,6 +569,189 @@ pipekit cache-key composite linux amd64 "$(pipekit transform hash --file go.sum)
569569
570570---
571571
572+ # ## `config` - Environment Configuration
573+
574+ Resolve environment-specific configuration from structured maps. Replaces the ~ 80 lines of bash typically needed for environment mapping in CI workflows.
575+
576+ < details>
577+ < summary><strong> resolve< /strong> - Resolve config with alias support< /summary>
578+
579+ ` ` ` sh
580+ # Given a config file with dev/staging/production keys:
581+ pipekit config resolve envs.json --env prod --to-github
582+ # Normalizes "prod" → "production", exports all values to $GITHUB_ENV
583+
584+ # From stdin
585+ echo ' {"dev": {"project_id": "my-dev"}, "production": {"project_id": "my-prod"}}' \
586+ | pipekit config resolve --env develop --uppercase-keys
587+ # "develop" → "dev", outputs: export PROJECT_ID="my-dev"
588+
589+ # YAML config
590+ pipekit config resolve envs.yaml --env staging --format yaml --to-github-output
591+
592+ # With custom aliases
593+ pipekit config resolve envs.json --env preview \
594+ --aliases ' {"preview": "staging", "canary": "production"}'
595+
596+ # Output as compact JSON
597+ pipekit config resolve envs.json --env prod --json
598+ # {"project_id":"my-prod","region":"eu-west1"}
599+ ` ` `
600+
601+ ** Built-in aliases:** ` dev` /` develop` /` development` /` test` /` testing` → ` dev` , ` stage` /` staging` → ` staging` , ` prod` /` production` → ` production`
602+
603+ ** Flags:**
604+
605+ | Flag | Description |
606+ | ------| -------------|
607+ | ` --env, -e` | Environment name (required) |
608+ | ` --format, -f` | Config format: ` json` , ` yaml` (default: json) |
609+ | ` --aliases` | Custom aliases as JSON |
610+ | ` --json` | Output as compact JSON instead of key-value pairs |
611+ | ` --uppercase-keys, -u` | Convert keys to UPPER_SNAKE_CASE |
612+ | ` --prefix, -p` | Add prefix to all keys |
613+ | ` --to-github` | Write to ` $GITHUB_ENV ` |
614+ | ` --to-github-output` | Write to ` $GITHUB_OUTPUT ` |
615+
616+ < /details>
617+
618+ < details>
619+ < summary><strong> branch-env< /strong> - Map branches to environments< /summary>
620+
621+ ` ` ` sh
622+ # Map current branch to an environment
623+ pipekit config branch-env main --mapping ' {"main":"production","develop":"dev","release/*":"staging"}'
624+ # production
625+
626+ # Works with refs/heads/ prefix (auto-stripped)
627+ pipekit config branch-env refs/heads/release/v1.2.0 \
628+ --mapping ' {"main":"production","release/*":"staging"}'
629+ # staging
630+
631+ # Auto-detect from $GITHUB_REF
632+ pipekit config branch-env --mapping ' {"main":"production","develop":"dev"}' --to-github
633+ # Writes TARGET_ENV=production to $GITHUB_ENV
634+
635+ # Custom output key
636+ pipekit config branch-env develop --mapping ' {"develop":"dev"}' \
637+ --output-key DEPLOY_ENV --to-github-output
638+ ` ` `
639+
640+ ** Flags:**
641+
642+ | Flag | Description |
643+ | ------| -------------|
644+ | ` --mapping, -m` | Branch-to-env JSON mapping (required) |
645+ | ` --output-key` | Output variable name (default: ` TARGET_ENV` ) |
646+ | ` --to-github` | Write to ` $GITHUB_ENV ` |
647+ | ` --to-github-output` | Write to ` $GITHUB_OUTPUT ` |
648+
649+ < /details>
650+
651+ ---
652+
653+ # ## `parse` - Structured Data Extraction
654+
655+ Extract code blocks and structured data from markdown text. Useful for parsing GitHub issue bodies, PR comments, and other markdown sources in CI workflows.
656+
657+ < details>
658+ < summary><strong> extract-block< /strong> - Extract fenced code blocks< /summary>
659+
660+ ` ` ` sh
661+ # Extract all code blocks as JSON
662+ echo " $ISSUE_BODY " | pipekit parse extract-block
663+ # [{"language":"yaml","content":"foo: bar","index":0},{"language":"json","content":"{...}","index":1}]
664+
665+ # Filter by language
666+ echo " $COMMENT " | pipekit parse extract-block --language yaml
667+ # Only yaml blocks
668+
669+ # Get raw content of a specific block
670+ echo " $COMMENT " | pipekit parse extract-block --language python --index 0 --content-only
671+ # print("hello")
672+
673+ # Write first block to GITHUB_OUTPUT
674+ echo " $ISSUE_BODY " | pipekit parse extract-block --language yaml --to-github-output
675+ ` ` `
676+
677+ Supports both ` ` ` ` ` ` ` and ` ~~~` fences, with any language tag (yaml, json, python, bash, etc.).
678+
679+ ** Flags:**
680+
681+ | Flag | Description |
682+ | ------| -------------|
683+ | ` --language, -l` | Filter by language tag (case-insensitive) |
684+ | ` --index, -i` | Return only the Nth block (0-based) |
685+ | ` --content-only` | Output raw content without JSON wrapping |
686+ | ` --to-github-output` | Write content to ` $GITHUB_OUTPUT ` |
687+ | ` --output-key` | Variable name for ` --to-github-output` (default: ` PARSED_BLOCK` ) |
688+
689+ < /details>
690+
691+ < details>
692+ < summary><strong> extract-yaml< /strong> - Extract and parse YAML blocks< /summary>
693+
694+ ` ` ` sh
695+ # Parse YAML blocks from an issue body
696+ echo " $ISSUE_BODY " | pipekit parse extract-yaml
697+ # [{"env":"production","replicas":3}]
698+
699+ # Export parsed values as env vars
700+ echo " $ISSUE_BODY " | pipekit parse extract-yaml --to-github -u
701+ # Writes UPPER_SNAKE_CASE keys to $GITHUB_ENV
702+
703+ # Get a specific YAML block
704+ echo " $COMMENT " | pipekit parse extract-yaml --index 0
705+
706+ # Write to GITHUB_OUTPUT as JSON
707+ echo " $ISSUE_BODY " | pipekit parse extract-yaml --to-github-output
708+ ` ` `
709+
710+ Matches blocks tagged as ` yaml` , ` yml` , or untagged blocks that parse as valid YAML. Invalid YAML blocks are silently skipped.
711+
712+ ** Flags:**
713+
714+ | Flag | Description |
715+ | ------| -------------|
716+ | ` --index, -i` | Return only the Nth YAML block (0-based) |
717+ | ` --to-env` | Export top-level keys as shell export statements |
718+ | ` --to-github` | Write top-level keys to ` $GITHUB_ENV ` |
719+ | ` --to-github-output` | Write parsed JSON to ` $GITHUB_OUTPUT ` |
720+ | ` --uppercase-keys, -u` | Convert keys to UPPER_SNAKE_CASE |
721+ | ` --output-key` | Variable name for ` --to-github-output` (default: ` PARSED_YAML` ) |
722+
723+ < /details>
724+
725+ ---
726+
727+ # ## `transform slug` - URL-safe Slug Generation
728+
729+ Generate URL-safe slugs from branch names or arbitrary strings. Useful for preview deployment names, Cloudflare Worker names, and unique resource identifiers.
730+
731+ < details>
732+ < summary><strong> Examples< /strong></summary>
733+
734+ ` ` ` sh
735+ # Branch name to slug
736+ echo " feature/my-cool-feature" | pipekit transform slug
737+ # feature-my-cool-feature
738+
739+ # Strips refs/heads/ automatically
740+ echo " refs/heads/release/v1.2.3" | pipekit transform slug
741+ # release-v123
742+
743+ # With max length (default: 63, matching k8s label limits)
744+ echo " feature/very-long-branch-name-that-exceeds-limits" | pipekit transform slug --max-length 20
745+
746+ # With prefix
747+ echo " $GITHUB_HEAD_REF " | pipekit transform slug --prefix " preview-"
748+ # preview-feature-my-thing
749+ ` ` `
750+
751+ < /details>
752+
753+ ---
754+
572755# # Exit Codes
573756
574757| Code | Meaning |
0 commit comments