Skip to content

feat: add interactive CLI editing for extension scenario metadata #53

Description

@Guillaumecoi

Description

The interactive CLI scenario editor is missing editing capabilities for extension scenario metadata. While basic fields (title, description, status) can be edited through the CLI, critical extension metadata is displayed but cannot be modified interactively:

  • Primary actor
  • Parent scenario (which scenario it extends)
  • Extension point (at which step it branches)
  • Return point (for alternatives)
  • Scenario type (alternative ↔ exception)

Current workaround: Manually edit the TOML file, which works but bypasses the interactive CLI experience.

Issue 1: Basic Field Editing is Good, But Missing Extension Fields

Current Behavior

The basic field editing works well with a menu-driven approach:

  Current values:
    Title: Email Already Registered
    Kind: Extension scenario
    Type: exception_flow
    Description: 
    Status: ⚡ IMPLEMENTED
    Primary Actor: guest-guest-user
    Steps: 3
    Extends: UC-AUTH-001-S01 at step 4
    Returns: doesn't return to main
    Preconditions: 1
    Postconditions: 0

? What would you like to edit?  
  Edit title
  Edit description
  Edit status
  Manage steps
  Manage conditions
  Done editing

Problem

Missing options to edit extension metadata:

  • Cannot change primary actor (stuck with guest-guest-user)
  • Cannot change which scenario it extends (UC-AUTH-001-S01)
  • Cannot change extension point (step 4)
  • Cannot change return point
  • Cannot change scenario type (exception_flowalternative_flow)

The current values are shown but cannot be edited.

Use Case Example

I have an exception scenario "Email Already Registered" but in the interactive CLI I:

  • Can't change the primary actor from guest-guest-user to customer
  • Can't change extension point from step 4 to step 5
  • Can't change which scenario it extends (from UC-AUTH-001-S01 to UC-AUTH-001-S02)
  • Can't convert it to an alternative scenario if design changes

Current workaround: Manually edit the TOML file (functional but not part of the interactive CLI experience).

Expected Behavior

Add new menu options for extension metadata:

  Current values:
    Title: Email Already Registered
    Type: exception_flow
    Primary Actor: guest-guest-user
    Extends: UC-AUTH-001-S01 at step 4
    Returns: doesn't return to main

? What would you like to edit?  
  Edit title
  Edit description
  Edit status
  Edit primary actor          ← NEW
  Edit scenario type          ← NEW
  Edit parent scenario        ← NEW
  Edit extension point        ← NEW
  Edit return point           ← NEW (alternatives only)
  Manage steps
  Manage conditions
  Done editing

Each new option would:

  • Edit primary actor: Select from available actors
  • Edit scenario type: Toggle between alternative_flow and exception_flow (with warning about semantic differences)
  • Edit parent scenario: Select from available main/alternative scenarios (validated)
  • Edit extension point: Enter step number (validated against parent scenario)
  • Edit return point: Enter step number or "doesn't return" (alternatives only)

Proposed Solution

Add extension field editing options to the existing menu for non-main scenarios:

  1. Add "Edit primary actor" menu option
  2. Add "Edit scenario type" menu option (alternative ↔ exception with warning)
  3. Add "Edit parent scenario" menu option (with validation)
  4. Add "Edit extension point" menu option (with step number validation)
  5. Add "Edit return point" menu option (alternatives only, with validation)

Technical Context:

  • Affected file: src/cli/interactive/workflows/scenario.rs
  • Function: edit_scenario() - add new menu items and handlers
  • Extension metadata in Scenario struct already supports these fields
  • Validation needed: step numbers exist in parent scenario, parent scenario is valid type

Acceptance Criteria

  • "Edit primary actor" option shows for all scenarios (main and extension)
  • "Edit scenario type" option shows for alternative/exception scenarios
  • "Edit parent scenario" option shows for alternative/exception scenarios
  • "Edit extension point" option shows for alternative/exception scenarios
  • "Edit return point" option shows for alternative scenarios only
  • Primary actor can be changed (select from available actors)
  • Scenario type can be toggled (alternative ↔ exception) with warning
  • Parent scenario can be changed with validation (exists, correct type)
  • Extension point can be changed with validation (step exists in parent)
  • Return point can be changed with validation (step exists in parent)
  • Main scenarios don't show extension-related edit options
  • Changes are persisted correctly to TOML file
  • Current values display updates after each edit

Priority

Medium - This is a UX enhancement for the interactive CLI. The functionality exists (users can manually edit TOML files), but the interactive editor should provide a complete editing experience without requiring manual file editing.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions