*** Settings ***
Documentation    E2E acceptance test for M1  - minimal plan execution flow.
...
...    Exercises the complete M1 (v3.0.0) milestone success criteria
...    with **zero mocking**: real CLI invocations, real LLM API keys,
...    and real subprocess execution against a temporary git repository.
...
...    Flow: action create → resource add → project create → plan use
...    → plan execute (strategize) → plan execute (execute) → plan diff
...    → plan apply.
...
...    Tagged ``tdd_expected_fail`` because ``_get_plan_executor()``
...    does not pass ``sandbox_root`` to ``PlanExecutor``, so
...    ``LLMExecuteActor._write_to_sandbox()`` is never called and
...    LLM-generated files (HELLO.md) are silently discarded.
...    See `#1313 <https://git.cleverthis.com/cleveragents/cleveragents-core/issues/1313>`_.
Resource    common_e2e.resource
Suite Setup    E2E Suite Setup
Suite Teardown    E2E Suite Teardown

*** Test Cases ***
M1 Full Plan Lifecycle
  [Documentation]    Exercise the complete M1 plan lifecycle with real LLM.
  ...
  ...    Creates an action from YAML, registers a git-checkout
  ...    resource, creates a project, and runs the full plan
  ...    lifecycle through apply with post-apply commit verification.
  [Tags]    E2E tdd_expected_fail tdd_issue tdd_issue_1313
  Skip If No LLM Keys
  # ── 1. Create a temporary git repo for isolation ──────────────
  ${repo_path}=    Create Temp Git Repo    m1-acceptance-repo






















*** Keywords ***
Extract Plan Id
  [Documentation]    Extract a ULID-style plan ID from command output.
  ...
  ...    Searches for a 26-character alphanumeric ULID pattern
  ...    in the output text. Returns the first match or EMPTY.
  [Arguments]    ${text}
  # ULID pattern: 26 uppercase alphanumeric characters (Crockford Base32)
  ${matches}=    Get Regexp Matches    ${text}    [0-9A-HJ-NP-Z]{26}    flags=IGNORECASE
  ${count}=    Get Length    ${matches}
  ${plan_id}=    Set Variable If    ${count} > 0    ${matches}[0]    ${EMPTY}
  RETURN    ${plan_id}
