candle-annotator/openspec/changes/enhance-annotation-features-and-deployment/specs/line-deletion/spec.md
Marko Djordjevic a236d2c065 feat: create comprehensive specs for all four capabilities
- line-deletion: keyboard shortcuts and bulk delete with confirmation
- label-management: full CRUD UI in sidebar with search/filter
- docker-deployment: multi-stage build, compose, health checks
- hacker-theme: matrix-style colors, neon glows, monospace fonts
2026-02-12 14:44:45 +01:00

3.7 KiB

ADDED Requirements

Requirement: Delete selected line with keyboard

The system SHALL allow users to delete the currently selected line annotation using keyboard shortcuts (Delete key or Backspace key).

Scenario: Delete selected line with Delete key

  • WHEN a line is selected (selectedLineId is set) and user presses Delete key
  • THEN system sends DELETE request to /api/annotations/{id}, removes line from display, clears selection state, and triggers annotation refresh

Scenario: Delete selected line with Backspace key

  • WHEN a line is selected and user presses Backspace key
  • THEN system sends DELETE request to /api/annotations/{id}, removes line from display, clears selection state, and triggers annotation refresh

Scenario: No line selected when pressing delete

  • WHEN no line is selected (selectedLineId is null) and user presses Delete or Backspace key
  • THEN system takes no action and does not make any API calls

Scenario: Delete key during line drawing

  • WHEN user is actively drawing a line (drawingLine state is not null) and presses Delete key
  • THEN system cancels the line drawing operation but does NOT delete any existing lines

Requirement: Delete all lines with confirmation

The system SHALL provide a UI button in the Toolbox to delete all line annotations at once with user confirmation.

Scenario: User clicks Delete All Lines button

  • WHEN user clicks "Delete All Lines" button in Toolbox
  • THEN system displays a confirmation dialog with message "Delete all line annotations? This cannot be undone." and Cancel/Confirm buttons

Scenario: User confirms delete all lines

  • WHEN confirmation dialog is open and user clicks Confirm button
  • THEN system sends DELETE request to /api/annotations?type=line, removes all lines from display, clears selection state, triggers annotation refresh, and closes dialog

Scenario: User cancels delete all lines

  • WHEN confirmation dialog is open and user clicks Cancel button
  • THEN system closes dialog without making any API calls or removing any lines

Scenario: No lines exist when clicking delete all

  • WHEN user clicks "Delete All Lines" button and no line annotations exist in database
  • THEN system still shows confirmation dialog (user confirms/cancels normally)

Requirement: API support for bulk line deletion

The API SHALL support deleting multiple annotations by type via query parameters.

Scenario: Delete all lines via API

  • WHEN DELETE request sent to /api/annotations?type=line
  • THEN system deletes all annotations where label_type equals 'line' and returns { success: true, deleted: <count> }

Scenario: Delete all annotations via API

  • WHEN DELETE request sent to /api/annotations?all=true
  • THEN system deletes all annotations regardless of type and returns { success: true, deleted: <count> }

Scenario: Invalid type parameter

  • WHEN DELETE request sent to /api/annotations?type=invalid_type
  • THEN system returns 400 error with message "Invalid annotation type"

Requirement: Delete button in Toolbox

The Toolbox SHALL display a "Delete All Lines" button when line annotations exist.

Scenario: Lines exist in database

  • WHEN one or more line annotations exist in the database
  • THEN Toolbox displays "Delete All Lines" button in destructive styling (red theme)

Scenario: No lines exist

  • WHEN no line annotations exist in database
  • THEN Toolbox displays "Delete All Lines" button in disabled state with reduced opacity

Scenario: Button position in Toolbox

  • WHEN Toolbox renders
  • THEN "Delete All Lines" button appears below the color picker section and above the "Delete" tool button