Skip to content

Uc002 Update Repo

# specs/domain/features/UC002-update_repo.feature
#
# SINGLE SOURCE OF TRUTH for use case behaviour.
# This file is:
#   (1) referenced by specs/domain/use_cases/UC002-update_repo.md  (documentation)
#   (2) executed by the acceptance test suite               (living documentation)
#
# Rules:
#   - Scenario IDs (e.g. UC002-S01) must match the use case document.
#   - Step definitions live in: internal/acceptance/
#   - Keep scenarios focused: one behaviour per scenario.
#   - Use exact terms from specs/domain/glossary.md.

Feature: Updating an Existing Repository
    As a software engineer
    I want to update an existing Git repository with the latest generator-owned files
    So that it adheres to the latest standard structure and guidelines.

    # ---------------------------------------------------------------------------
    # Happy path
    # ---------------------------------------------------------------------------

    Scenario: UC002-S01 Successful update of existing C++/CLI tool repository (GitLab)
        Given current directory is an already initialized Git repository with a clean working tree for:
            | Parameter     | Value  |
            | Language      | cpp    |
            | Artifact Type | tool   |
            | CI Type       | gitlab |
        When the user runs "repo update"
        Then the following files are re-generated:
            | .claude/settings.json                          |
            | .claude/skills/adr/SKILL.md                    |
            | .claude/skills/adr/adr-template.md             |
            | .claude/skills/arch-check/SKILL.md             |
            | .claude/skills/review/SKILL.md                 |
            | .claude/skills/security-review/SKILL.md        |
            | .claude/skills/test-coverage/SKILL.md          |
            | .claude/skills/commit/SKILL.md                 |
            | .claude/skills/update-versions/SKILL.md        |
            | .claude/commands/new-domain-object.md          |
            | .claude/commands/new-command.md                |
            | .claude/rules/bash_coding.md                   |
            | .claude/rules/ci_cd.md                         |
            | .claude/rules/cli_tool.md                      |
            | .claude/rules/containerization.md              |
            | .claude/rules/cpp_coding.md                    |
            | .claude/rules/data_modeling.md                 |
            | .claude/rules/error_handling.md                |
            | .claude/rules/general_coding.md                |
            | .claude/rules/git.md                           |
            | .claude/rules/library_design.md                |
            | .claude/rules/oo_design_and_programming.md     |
            | .claude/rules/performance.md                   |
            | .claude/rules/refactoring.md                   |
            | .claude/rules/security.md                      |
            | .claude/rules/spec_consistency.md              |
            | .claude/rules/testing.md                       |
            | .claude/rules/tool_chain.md                    |
            | .claude/rules/user_experience.md               |
            | specs/guidelines/bash_coding.md                |
            | specs/guidelines/ci_cd.md                      |
            | specs/guidelines/cli_tool.md                   |
            | specs/guidelines/containerization.md           |
            | specs/guidelines/cpp_coding.md                 |
            | specs/guidelines/user_experience.md            |
            | specs/guidelines/data_modeling.md              |
            | specs/guidelines/error_handling.md             |
            | specs/guidelines/general_coding.md             |
            | specs/guidelines/git.md                        |
            | specs/guidelines/library_design.md             |
            | specs/guidelines/oo_design_and_programming.md  |
            | specs/guidelines/performance.md               |
            | specs/guidelines/refactoring.md                |
            | specs/guidelines/security.md                   |
            | specs/guidelines/testing.md                    |
            | specs/guidelines/tool_chain.md                 |
            | .gitlab-ci.yml                                 |
            | Makefile                                       |
        And the following developer-owned files are not modified:
            | Makefile.local |
            | README.md      |
        And the command exits with code 0
        And no output is written to stdout

    # ---------------------------------------------------------------------------
    # Dry-run
    # ---------------------------------------------------------------------------

    Scenario: UC002-S04 Dry-run lists files that would change without writing them
        Given current directory is an already initialized Git repository with a clean working tree for:
            | Parameter     | Value  |
            | Language      | go     |
            | Artifact Type | service |
            | CI Type       | gitlab |
        And at least one generator-owned file has been manually modified
        When the user runs "repo update --dry-run"
        Then the changed file paths are printed to stdout
        And no files are written to disk
        And the command exits with code 0

    # ---------------------------------------------------------------------------
    # Error: missing .repo.yaml
    # ---------------------------------------------------------------------------

    Scenario: UC002-S02 Error when .repo.yaml is missing
        Given current directory is a Git repository without a .repo.yaml file
        When the user runs "repo update"
        Then the command exits with a non-zero exit code
        And an error message is written to stderr containing ".repo.yaml"
        And no files are written to disk

    # ---------------------------------------------------------------------------
    # Error: dirty working tree
    # ---------------------------------------------------------------------------

    Scenario: UC002-S03 Error when working tree has uncommitted changes
        Given current directory is an already initialized Git repository for:
            | Parameter     | Value  |
            | Language      | java   |
            | Artifact Type | service |
            | CI Type       | gitlab |
        And the working tree has uncommitted changes
        When the user runs "repo update"
        Then the command exits with a non-zero exit code
        And an error message is written to stderr containing "uncommitted changes"
        And no files are written to disk