Feature: Context Commands Unit Tests As a developer I want unit tests for context command functionality So that context.py achieves high code coverage @phase1 Scenario: Context add command full execution path Given a mock context service is configured When the context add command is executed with valid paths Then files should be added successfully with output @phase1 Scenario: Context add with non-existent path error Given a mock context service is configured When the context add command is executed with non-existent path Then path does not exist error should be shown @phase1 Scenario: Context add with FileSystemError exception Given a mock context service that raises FileSystemError When the context add command is executed and fails Then FileSystemError should be displayed and command aborted @phase1 Scenario: Context add with CleverAgentsError exception Given a mock context service that raises CleverAgentsError When the context add command is executed and fails Then CleverAgentsError should be displayed and command aborted @phase1 Scenario: Context add aborts when no active project Given a mock context service is configured When the context add command is executed without an active project Then a no active project error should be shown @phase1 Scenario: Context add reports already tracked files Given a mock context service with already tracked files When the context add command processes already tracked paths Then already tracked file details should be reported @phase1 Scenario: Context load alias command Given a mock context service is configured When the context load alias is executed Then it should delegate to context add function @phase1 Scenario: Context remove command execution Given a mock context service with remove capability When the context remove command is executed Then files should be removed with confirmation message @phase1 Scenario: Context remove with no files removed Given a mock context service returning zero removals When the context remove command is executed Then no files removed message should be shown @phase1 Scenario: Context remove aborts when no active project Given a mock context service with remove capability When the context remove command is executed without an active project Then a no active project error should be shown @phase1 Scenario: Context remove reports missing files for relative paths Given a mock context service returning zero removals When the context remove command is executed for relative paths Then missing context files should trigger an abort @phase1 Scenario: Context remove errors when some files missing Given a mock context service with partial removals When the context remove command is executed Then missing context files should trigger an abort @phase1 Scenario: Context remove handles CleverAgentsError exceptions Given a mock context service that raises CleverAgentsError When the context remove command is executed with service failure Then CleverAgentsError should be displayed and command aborted @phase1 Scenario: Context list with files present Given a mock context service with files When the context list command is executed Then a formatted table of files should be displayed @phase1 Scenario: Context list with empty context Given a mock context service with no files When the context list command is executed Then empty context message should be shown with help @phase1 Scenario: Context list aborts when no active project Given a mock context service with files When the context list command is executed without an active project Then a no active project error should be shown @phase1 Scenario: Context list formats numeric sizes Given a mock context service with numeric file sizes When the context list command is executed Then numeric sizes should be rendered as bytes @phase1 Scenario: Context list handles CleverAgentsError exceptions Given a mock context service that raises CleverAgentsError When the context list command is executed with service failure Then CleverAgentsError should be displayed and command aborted @phase1 Scenario: Context show specific file Given a mock context service with file content When the context show command is executed with path Then file content should be displayed in panel @phase1 Scenario: Context show file not found Given a mock context service returning no content When the context show command is executed with path Then file not found message should be displayed @phase1 Scenario: Context show all summary Given a mock context service with multiple files When the context show command is executed without path Then context summary with stats should be displayed @phase1 Scenario: Context show aborts when no active project Given a mock context service with file content When the context show command is executed without an active project Then a no active project error should be shown @phase1 Scenario: Context show without path on empty context Given a mock context service with no files When the context show command is executed without path Then the show command should report an empty context @phase1 Scenario: Context show single file renders content Given a mock context service with single file content When the context show command is executed without path Then file content should be displayed in panel @phase1 Scenario: Context show single file without stored content Given a mock context service with single file lacking content When the context show command is executed without path Then the show command should report missing content @phase1 Scenario: Context show handles CleverAgentsError exceptions Given a mock context service that raises CleverAgentsError When the context show command is executed with service failure Then CleverAgentsError should be displayed and command aborted @phase1 Scenario: Context clear with confirmation Given a mock context service with clearable files When the context clear command is executed with yes flag Then context should be cleared with success message @phase1 Scenario: Context clear cancelled by user Given a mock context service with clearable files When the context clear command is executed and user cancels Then cancelled message should appear and context unchanged @phase1 Scenario: Context clear on already empty Given a mock context service with no files When the context clear command is executed Then already empty message should be shown @phase1 Scenario: Context clear aborts when no active project Given a mock context service with clearable files When the context clear command is executed without an active project Then a no active project error should be shown @phase1 Scenario: Context clear handles CleverAgentsError exceptions Given a mock context service that raises CleverAgentsError When the context clear command is executed with service failure Then CleverAgentsError should be displayed and command aborted @phase1 Scenario: Context default callback behavior Given a mock context service with files When context command is invoked without subcommand Then the list function should be called by default @phase1 Scenario: Normalize dictionary context entries for display Given a dictionary-style context entry with missing metadata When the normalization helper processes the context entry Then the normalized context tuple should include placeholder defaults @phase1 Scenario: Normalize Context model entries for display Given a domain Context model entry with metadata When the normalization helper processes the context entry Then the normalized context tuple should match the model attributes @phase1 Scenario: Programmatic add command skips nonexistent files Given a mock context service is configured When the programmatic add command runs with a missing file path Then no files are sent to the context service @phase1 Scenario: Programmatic add command requires an active project Given a mock context service is configured When the programmatic add command runs without an active project Then a CleverAgentsError is raised for programmatic add @phase1 Scenario: Programmatic list command returns context entries Given a mock context service with files When the programmatic list command is executed Then the programmatic list command should return those files @phase1 Scenario: Programmatic list command requires an active project Given a mock context service is configured When the programmatic list command runs without an active project Then a CleverAgentsError is raised for programmatic list @phase1 Scenario: Programmatic show command requires an active project Given a mock context service is configured When the programmatic show command runs without an active project Then a CleverAgentsError is raised for programmatic show @phase1 Scenario: Programmatic show command returns None for empty context Given a mock context service with no files When the programmatic show command runs without a path Then the programmatic show command should return no content summary @phase1 Scenario: Programmatic show command summarizes multiple files Given a mock context service with multiple files When the programmatic show command runs without a path Then the programmatic show command should return a summary string @phase1 Scenario: Programmatic show command retrieves specific file content Given a mock context service with file content When the programmatic show command runs for a specific path Then the programmatic show command should return that content @phase1 Scenario: Programmatic remove command requires an active project Given a mock context service is configured When the programmatic remove command runs without an active project Then a CleverAgentsError is raised for programmatic remove @phase1 Scenario: Programmatic remove command raises when files missing Given a mock context service returning zero removals When the programmatic remove command runs for files Then a CleverAgentsError is raised for programmatic remove @phase1 Scenario: Programmatic remove command succeeds when files are removed Given a mock context service with remove capability When the programmatic remove command runs with removable files Then the programmatic remove command should complete successfully @phase1 Scenario: Programmatic clear command requires an active project Given a mock context service is configured When the programmatic clear command runs without an active project Then a CleverAgentsError is raised for programmatic clear @phase1 Scenario: Programmatic clear command calls clear on service Given a mock context service with clearable files When the programmatic clear command runs with an active project Then the context service clear function should be called