/gaia-ci-edit
user-facingWhat it does
/gaia-ci-edit edits the CI/CD promotion chain -- add, remove, edit, or reorder environments. Each environment has an id, name, branch, CI provider, merge strategy, and CI checks. Changes cascade to workflow files and test-environment mappings.
When to use it
- You need to add a new environment to the promotion chain (e.g., a QA stage).
- You want to reorder environments or change which branch an environment targets.
- You need to remove an environment that is no longer used.
Prerequisites
- A promotion chain must already exist. Run
/gaia-config-cifirst.
How to invoke
/gaia-ci-edit
/gaia-ci-edit --add
/gaia-ci-edit --remove staging
/gaia-ci-edit --edit prod
/gaia-ci-edit --order
What it does step by step
- Load current chain Reads the promotion chain from the configuration. Displays a formatted table of all environments.
- Present operation menu Shows options: add, remove, edit, reorder, view, exit.
- Apply operation Collects input for the chosen operation. The environment id is immutable. Removing the last environment is blocked.
- Validate and list cascade targets Validates the modified chain and lists all files that will be affected (workflow files, test-environment tiers, ci-setup.md).
- Confirm and write Shows the cascade targets and asks for confirmation. On confirm, writes the chain and cascades updates to affected files.
- Summary Displays what changed, which files were updated, and any warnings.
Inputs
| Input | Source | Description | Example |
|---|---|---|---|
--add | Argument (optional) | Insert a new environment into the chain. | /gaia-ci-edit --add |
--remove | Argument (optional) | Delete an existing environment (with safety scan). | /gaia-ci-edit --remove staging |
--edit | Argument (optional) | Modify fields of an existing environment. | /gaia-ci-edit --edit prod |
--order | Argument (optional) | Reorder the promotion chain. | /gaia-ci-edit --order |
env-id | Positional argument (optional) | The environment id to operate on. | /gaia-ci-edit --remove staging |
Outputs
| Output | Location | Description |
|---|---|---|
| Updated promotion chain | CI configuration | The modified promotion chain. |
| Cascaded files | Workflow files, test-environment.yaml | Updated trigger branches and tier mappings. |
Example session
> /gaia-ci-edit
Current promotion chain:
| Pos | ID | Branch | Environment | Merge Strategy |
|-----|---------|---------|-------------|----------------|
| 0 | staging | staging | Staging | squash |
| 1 | prod | main | Production | merge |
Operations: [a] add [r] remove [e] edit [o] order [v] view [x] exit
> a
New environment ID: qa
Name: QA
Branch: qa
CI Provider: github_actions
Merge Strategy: squash
Insert at position: 0
Cascade targets:
Workflows: .github/workflows/gaia-pre-merge.yml (branch: qa)
test-environment.yaml tiers: (none affected)
ci-setup.md (will be regenerated)
Apply this edit and cascade to the listed targets? [y/n]
> y
Environment added. Position 0 changed (PR target for feature branches).
What to run next
/gaia-config-validate-- validate the configuration after edits.
Troubleshooting
Cannot remove the last environment
The promotion chain must have at least one environment. Add a replacement first.
Field id is immutable
To rename an environment, remove the old one and add a new one.
Cascade failure
A downstream file could not be updated. The error reports the failing file and reason. The promotion chain itself was written successfully.