Feature: Resource and LSP CLI missing flags (issue #904)
  As a CleverAgents user
  I want the CLI to support all specification-defined flags
  So that I can fully manage resources and LSP servers per the spec

  # ---- resource add --update ----

  Scenario: Add a resource with --update re-registers it
    Given a fresh resource flags test registry
    And resource flags built-in types are bootstrapped
    And I add a resource flags resource "git-checkout" named "local/upd-test" with path "/tmp/u1"
    When I run resource flags add "git-checkout" "local/upd-test" with path "/tmp/u2" and update
    Then the resource flags output should contain "Added resource"
    And the resource flags output should contain "local/upd-test"

  Scenario: Add with --update when resource does not yet exist
    Given a fresh resource flags test registry
    And resource flags built-in types are bootstrapped
    When I run resource flags add "git-checkout" "local/new-upd" with path "/tmp/nu" and update
    Then the resource flags output should contain "Added resource"

  # ---- resource add --mount (container types) ----

  Scenario: Mount flag rejected for non-container type
    Given a fresh resource flags test registry
    And resource flags built-in types are bootstrapped
    When I run resource flags add "git-checkout" "local/bad-mount" with path "/tmp/bm" and mount "local/repo:/workspace"
    Then the resource flags command should fail
    And the resource flags output should contain "container types"

  # ---- resource add --clone-into ----

  Scenario: Clone-into flag rejected for non-container type
    Given a fresh resource flags test registry
    And resource flags built-in types are bootstrapped
    When I run resource flags add "git-checkout" "local/bad-clone" with path "/tmp/bc" and clone-into "https://example.com/repo.git:/workspace"
    Then the resource flags command should fail
    And the resource flags output should contain "container resource types"

  Scenario: Clone-into flag with invalid format
    Given a fresh resource flags test registry
    And resource flags built-in types are bootstrapped
    When I run resource flags add "container-instance" "local/bad-fmt" with clone-into "no-colon-here"
    Then the resource flags command should fail
    And the resource flags output should contain "REPO_URL"

  # ---- resource list --all ----

  Scenario: Resource list default excludes auto-discovered resources
    Given a fresh resource flags test registry
    And resource flags built-in types are bootstrapped
    And a user-added resource flags resource "git-checkout" named "local/user-res" with path "/tmp/ur"
    And an auto-discovered resource flags resource named "local/auto-res"
    When I run resource flags list
    Then the resource flags output should contain "local/user-res"
    And the resource flags output should not contain "local/auto-res"

  Scenario: Resource list --all includes auto-discovered resources
    Given a fresh resource flags test registry
    And resource flags built-in types are bootstrapped
    And a user-added resource flags resource "git-checkout" named "local/user-res2" with path "/tmp/ur2"
    And an auto-discovered resource flags resource named "local/auto-res2"
    When I run resource flags list with --all
    Then the resource flags output should contain "local/user-res2"
    And the resource flags output should contain "local/auto-res2"

  # ---- resource tree --depth default ----

  Scenario: Tree depth defaults to 3
    Given a fresh resource flags test registry
    And resource flags built-in types are bootstrapped
    And a resource flags resource "git-checkout" named "local/depth-root" with path "/tmp/dr"
    When I run resource flags tree for "local/depth-root" with default depth
    Then the resource flags tree depth used should be 3

  # ---- resource type list [REGEX] ----

  Scenario: Resource type list with regex filter
    Given a fresh resource flags test registry
    And resource flags built-in types are bootstrapped
    When I run resource flags type list with regex "git"
    Then the resource flags output should contain "git-checkout"
    And the resource flags output should not contain "fs-directory"

  Scenario: Resource type list without regex shows all
    Given a fresh resource flags test registry
    And resource flags built-in types are bootstrapped
    When I run resource flags type list without regex
    Then the resource flags output should contain "git-checkout"
    And the resource flags output should contain "fs-directory"

  # ---- lsp list [REGEX] ----

  Scenario: LSP list with regex filter
    Given a clean LSP flags test environment
    And a registered LSP flags server "local/pyright-test" for language "python"
    And a registered LSP flags server "local/clangd-test" for language "cpp"
    When I run lsp flags list with regex "pyright"
    Then the lsp flags output should contain "local/pyright-test"
    And the lsp flags output should not contain "local/clangd-test"

  Scenario: LSP list without regex shows all
    Given a clean LSP flags test environment
    And a registered LSP flags server "local/pyright-test2" for language "python"
    And a registered LSP flags server "local/clangd-test2" for language "cpp"
    When I run lsp flags list without regex
    Then the lsp flags output should contain "local/pyright-test2"
    And the lsp flags output should contain "local/clangd-test2"
