Skip to content

feat: add interactive --ask conflict resolution to update #45

Description

@dapi

Problem

memory-bank-cli update safely preserves user-owned files when they collide with incoming managed template content. In some cases the user wants to deliberately discard that local version and return ownership to the template source, but there is no per-file interactive path to do so.

Proposed behavior

Add memory-bank-cli update --ask. For every update decision involving a user-owned collision, prompt the user before mutation:

  • Keep local file: preserve the current file and its user-owned lock entry.
  • Overwrite from source: replace the local file (including executable mode) with the incoming source payload and record it as source-managed in memory-bank/.lock.

Prompts should identify the repository-relative path and show enough context to make the choice safely (for example, the planned decision and an available diff).

Safety and CLI contract

  • Without --ask, preserve the existing non-interactive safe behavior.
  • Collect all answers before applying any mutation, then apply the final plan atomically.
  • Reject --ask when stdin is not an interactive terminal; never block CI or piped execution.
  • Define and test the interaction with --dry-run (recommended: show prompts and resolved plan but make no changes).
  • An explicit overwrite must be the only way update converts a collision from user-owned to source-managed.

Acceptance criteria

  • memory-bank-cli update --ask prompts once for each relevant user-owned collision.
  • Choosing keep preserves file content/mode and ownership.
  • Choosing overwrite replaces file content/mode from source and updates lock ownership/digests to managed source state.
  • Invalid input is reprompted or fails safely without partial changes.
  • Non-TTY invocation fails with a clear actionable error.
  • Tests cover multiple choices, atomicity, --dry-run, and non-interactive execution.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions