# These tests target bug #524 and are expected to fail until the fix is applied.
# bootstrap_builtin_types() is never called during initialization, so the
# git-checkout built-in resource type is missing from the registry at runtime.
Feature: Built-in git-checkout type bootstrap on initialization
  As a CleverAgents user
  I want the built-in git-checkout resource type to be available after initialization
  So that I can run "agents resource add git-checkout" without "Resource type not found"

  # ── Bug reproduction: init path does NOT call bootstrap ────
  # This scenario is the TDD failing test.  It creates a registry WITHOUT
  # calling bootstrap_builtin_types() and asserts git-checkout exists.
  # It will fail until the fix integrates bootstrap into the init path.
  #
  # NOTE FOR FIX AUTHOR: If the chosen fix is to call bootstrap inside
  # init_command() / initialize_project() rather than in
  # ResourceRegistryService.__init__(), you will need to update the Given
  # step to exercise the init path instead of constructing a bare service.

  @tdd_issue @tdd_issue_524 @tdd_issue_4178

  Scenario: git-checkout type is missing when bootstrap is not called during init
    Given a bootstrap-git fresh in-memory resource registry without bootstrap
    When I query the bootstrap-git resource type registry for "git-checkout"
    Then the bootstrap-git resource type "git-checkout" should exist

  # ── Regression: bootstrap function itself works correctly ──

  @tdd_issue @tdd_issue_524 @tdd_issue_4178
  Scenario: After initialization the git-checkout type exists in the resource type registry
    Given a bootstrap-git fresh in-memory resource registry with bootstrap
    When I query the bootstrap-git resource type registry for "git-checkout"
    Then the bootstrap-git resource type "git-checkout" should exist
    And the bootstrap-git resource type "git-checkout" should have kind "physical"
    And the bootstrap-git resource type "git-checkout" should have sandbox_strategy "git_worktree"
    And the bootstrap-git resource type "git-checkout" should be user_addable
    And the bootstrap-git registered types should include "git-checkout"

  # ── CLI resource add succeeds ──────────────────────────────

  @tdd_issue @tdd_issue_524 @tdd_issue_4178
  Scenario: agents resource add git-checkout succeeds without Resource type not found error
    Given a bootstrap-git fresh in-memory resource registry with bootstrap
    When I run bootstrap-git resource add for type "git-checkout" named "local/test" with path "/tmp/repo" and branch "main"
    Then the bootstrap-git resource add command should succeed
    And the bootstrap-git resource add output should not contain "Resource type not found"
