/ legacy / python / lib / test_queue_commands.py
test_queue_commands.py
 1  #!/usr/bin/env python3
 2  """
 3  Test script for the new queue, tasks, and do commands.
 4  """
 5  
 6  import subprocess
 7  import sys
 8  
 9  def run_command(cmd):
10      """Run a command and show output."""
11      print(f"\n🔧 Running: {cmd}")
12      print("=" * 50)
13      try:
14          result = subprocess.run(cmd, shell=True, capture_output=True, text=True)
15          if result.stdout:
16              print(result.stdout)
17          if result.stderr:
18              print(f"Error: {result.stderr}")
19          return result.returncode
20      except Exception as e:
21          print(f"Error running command: {e}")
22          return 1
23  
24  def main():
25      """Test the new queue commands."""
26      print("🧪 Testing Kamaji Queue Commands")
27      print("=" * 50)
28      
29      # Test queue command
30      print("\n1. Adding tasks to queue...")
31      run_command('python -m kamaji.cli queue "Fix bug in login system, Add unit tests for API, Update documentation"')
32      
33      # Test tasks command
34      print("\n2. Showing task list...")
35      run_command('python -m kamaji.cli tasks')
36      
37      print("\n3. The 'do' command would show interactive selection:")
38      print("   kamaji do")
39      print("   - Shows numbered list of tasks")
40      print("   - User selects a task number")
41      print("   - Executes the task using work command")
42      print("   - Marks task as completed on success")
43      
44      print("\n✅ Queue commands are ready!")
45      print("\nUsage:")
46      print("  kamaji queue \"task1, task2, task3\"  # Add tasks")
47      print("  kamaji tasks                         # Show list")
48      print("  kamaji do                            # Select & execute")
49  
50  if __name__ == "__main__":
51      main()