# Regression tests for bug #589 — project create must commit to the database.
Feature: Project create persists to database
  As a developer using the agents CLI
  I want projects created with "agents project create" to persist in the database
  So that "agents project list" shows previously created projects

  Background:
    Given a fresh project-persist database is initialised

  @tdd_issue @tdd_issue_589 @tdd_issue_4178
  Scenario: Created project appears in project list
    When I create a project named "local/my-app" via the persist CLI
    And I list projects via the persist CLI
    Then the persist project list should contain "local/my-app"

  @tdd_issue @tdd_issue_589 @tdd_issue_4178
  Scenario: Multiple created projects all appear in list
    When I create a project named "local/alpha" via the persist CLI
    And I create a project named "local/beta" via the persist CLI
    And I list projects via the persist CLI
    Then the persist project list should contain "local/alpha"
    And the persist project list should contain "local/beta"

  @tdd_issue @tdd_issue_589 @tdd_issue_4178
  Scenario: Bare project name uses default namespace and persists
    When I create a project named "my-app" via the persist CLI
    And I list projects via the persist CLI
    Then the persist project list should contain "local/my-app"

  @tdd_issue @tdd_issue_589 @tdd_issue_4178
  Scenario: Creating a duplicate project produces an error
    When I create a project named "local/dup-proj" via the persist CLI
    And I attempt to create a duplicate project named "local/dup-proj" via the persist CLI
    Then the persist duplicate creation should fail with "already exists"
