Init Repo General
# specs/features/init_repo_general.feature
#
# Cross-cutting behaviour for `repo init` that applies to every language/type/CI combination.
# Per-combination happy-path coverage (generated file lists) lives in UC001–UC00x feature files.
#
# This file is executed by the acceptance test suite (living documentation).
#
# Rules:
# - Step definitions live in: internal/acceptance/
# - Keep scenarios focused: one behaviour per scenario.
# - Use exact terms from specs/glossary.md.
Feature: General Repository Initialization Behaviour
As a software engineer
I want the generator to manage .repo.yaml automatically during `repo init`
So that I can run `repo update` later without repeating the original parameters.
# ---------------------------------------------------------------------------
# Happy path: CLI arguments → .repo.yaml written
# ---------------------------------------------------------------------------
Scenario: GEN-S01 Initializing with CLI arguments writes .repo.yaml
Given current directory is an empty Git repository
When the user initializes this repository with the following settings:
| Parameter | Value |
| Project Name | My Go Tool |
| Project Description | A sample Go tool. |
| Artifact Name | my-go-tool |
| Language | go |
| Artifact Type | tool |
| CI Type | gitlab |
| Module Path | gitlab.com/org/tool |
Then the repository contains a file .repo.yaml
And .repo.yaml contains:
| Field | Value |
| language | go |
| type | tool |
| ci | gitlab |
| name | My Go Tool |
# ---------------------------------------------------------------------------
# Happy path: pre-existing .repo.yaml → used as input, file stays unchanged
# ---------------------------------------------------------------------------
Scenario: GEN-S02 Initializing with a pre-existing .repo.yaml uses it as input
Given current directory is an empty Git repository containing a .repo.yaml with:
| Field | Value |
| language | go |
| type | tool |
| ci | gitlab |
| name | My Go Tool |
| description | A sample Go tool. |
| artifact | my-go-tool |
| module | gitlab.com/org/tool |
When the user runs "repo init" without CLI arguments
Then at least these files are written to the repository:
| Makefile |
| .gitignore |
| README.md |
And the file .repo.yaml has not been modified
# ---------------------------------------------------------------------------
# Error: CLI arguments supplied but .repo.yaml already present
# ---------------------------------------------------------------------------
Scenario: GEN-S03 Init with CLI arguments fails when .repo.yaml already exists
Given current directory is an empty Git repository containing a .repo.yaml with:
| Field | Value |
| language | go |
| type | tool |
| ci | gitlab |
| name | My Go Tool |
| description | A sample Go tool. |
| artifact | my-go-tool |
| module | gitlab.com/org/tool |
When the user initializes this repository with the following settings:
| Parameter | Value |
| Project Name | My Go Tool |
| Project Description | A sample Go tool. |
| Artifact Name | my-go-tool |
| Language | go |
| Artifact Type | tool |
| CI Type | gitlab |
| Module Path | gitlab.com/org/tool |
Then the init command exits with a non-zero exit code
And the init command reports an error containing ".repo.yaml"
And no generated files are written to disk
# ---------------------------------------------------------------------------
# Error: neither CLI arguments nor .repo.yaml present
# ---------------------------------------------------------------------------
Scenario: GEN-S04 Init without CLI arguments and without .repo.yaml fails
Given current directory is an empty Git repository
When the user runs "repo init" without CLI arguments
Then the init command exits with a non-zero exit code
And the init command reports an error containing "project name"