Skip to content

Conversation

@mirzaaghazadeh
Copy link

@mirzaaghazadeh mirzaaghazadeh commented Nov 8, 2025

image

🎯 Problem

Strix has a beautiful CLI interface and powerful features, but running it requires remembering and typing complex command-line arguments. Users need to know:

  • The exact --target flag syntax
  • How to specify multiple targets
  • When to use --instruction flags
  • The correct format for different target types (URLs, local paths, repositories)
  • How to set up API keys and model configuration via environment variables

This creates a barrier to entry, especially for new users who just want to quickly start a security scan without memorizing command syntax or managing environment variables manually.

✨ Solution

This PR adds two major improvements:

  1. Interactive Menu System - Appears when running strix without arguments
  2. Built-in Configuration Management - Save and manage API keys and settings through a beautiful UI

Interactive Menu

  • BIOS-style navigation - Arrow keys to navigate, Enter to select
  • All usage scenarios visible - 7 common use cases with descriptions
  • Context-aware prompts - Input fields match the menu styling and provide helpful examples
  • Consistent UI - Same dark theme and green accents throughout the flow

Configuration Management

  • Persistent settings - Save API keys and model configuration to ~/.strix/.env
  • Beautiful configuration screen - Edit settings with arrow key navigation
  • Auto-load on startup - Configuration automatically applied when Strix starts
  • Immediate application - Changes take effect right away

🚀 Features

Interactive Menu

  • Shows all 7 usage scenarios at once with [ ] / [x] checkbox indicators
  • Description and example shown at bottom for each option
  • Arrow keys (↑/↓) to navigate, Enter to select, Q/Esc to quit
  • All input prompts use the same styling as the menu

Configuration Management Screen

  • 8th menu option - "Configuration" to access settings
  • View current settings - See all configured values
  • Edit with arrow keys - Navigate between fields with ↑/↓
  • Password fields - API keys are masked for security
  • Save with Ctrl+S - Save changes immediately
  • Auto-apply - Settings are used immediately after saving

Supported Configuration

  • STRIX_LLM - Model name (e.g., openai/gpt-5, anthropic/claude-3-5-sonnet)
  • LLM_API_KEY - API key for the LLM provider
  • PERPLEXITY_API_KEY - Optional API key for web search capabilities
  • LLM_API_BASE - Optional base URL for local models (e.g., http://localhost:11434)

Supported Usage Scenarios

  1. Local codebase analysis
  2. Repository security review
  3. Web application assessment
  4. Multi-target white-box testing
  5. Test multiple environments
  6. Focused testing with instructions
  7. Testing with credentials
  8. Configuration (new!)

📸 Usage

Before (Command-line only)

# Set environment variables manually
export STRIX_LLM="openai/gpt-5"
export LLM_API_KEY="sk-..."
export PERPLEXITY_API_KEY="pplx-..."

# Then run with complex commands
strix --target ./app-directory
strix --target https://github.com/org/repo
strix -t https://dev.your-app.com -t https://staging.your-app.com -t https://prod.your-app.com
strix --target api.your-app.com --instruction "Prioritize authentication and authorization testing"

After (Interactive menu + configuration)

# First time setup
strix
# → Select "Configuration" (option 8)
# → Enter your API keys and model
# → Press Ctrl+S to save

# Run scans
strix
# → Select usage scenario with arrow keys
# → Enter target with helpful prompts
# → All using your saved configuration!

🎨 UI/UX Improvements

  • Consistent styling - Menu, prompts, and configuration all use the same dark theme (#1a1a1a background, #22c55e green accents)
  • Visual feedback - Selected items highlighted, checkboxes update in real-time
  • Helpful guidance - Examples and descriptions shown for each option and field
  • Keyboard-first - Full keyboard navigation, no mouse required
  • Familiar pattern - BIOS/installer-style menu that users recognize
  • Secure input - Password fields for API keys

🔧 Technical Details

Configuration Storage

  • Settings saved to ~/.strix/.env using standard .env format
  • Automatically loaded on startup via ConfigManager.apply_to_environment()
  • Direct integration with litellm - settings applied immediately
  • Environment variables take precedence (for CI/CD and advanced users)

Implementation

  • Uses textual framework (already in dependencies) for interactive UI
  • Uses python-dotenv for .env file management
  • Maintains backward compatibility - all existing CLI flags still work
  • Menu only appears when no --target is provided
  • Async/await pattern for clean code structure
  • Type-safe with proper type hints

Configuration Flow

  1. On startup: Load ~/.strix/.env → Apply to environment → Update litellm settings
  2. On save: Save to ~/.strix/.env → Apply to environment → Update litellm settings immediately
  3. All LLM operations use configured settings automatically

📝 Example Flow

First Time Setup

  1. User runs strix
  2. Menu appears showing all usage scenarios + Configuration
  3. User selects "Configuration" (option 8)
  4. Configuration screen shows (empty fields for first time)
  5. User enters:
    • Model: openai/gpt-5
    • LLM API Key: sk-...
    • Perplexity API Key: pplx-... (optional)
  6. User presses Ctrl+S to save
  7. Settings saved to ~/.strix/.env
  8. Returns to main menu

Running a Scan

  1. User runs strix
  2. Menu appears (configuration already loaded)
  3. User navigates with arrow keys, sees description at bottom
  4. User selects option (e.g., "Local codebase analysis")
  5. Input prompt appears: "Enter local directory path" with example
  6. User enters path and submits
  7. Strix proceeds with the scan using configured API keys and model

🎯 Benefits

  • Lower barrier to entry - New users can start scanning without learning CLI syntax
  • Better discoverability - Users see all available options and use cases
  • Reduced errors - Context-aware prompts prevent common mistakes
  • Professional UX - Consistent, polished interface throughout
  • Persistent configuration - No need to set environment variables every time
  • Secure storage - API keys stored locally in user's home directory
  • Still powerful - Advanced users can still use CLI flags and environment variables directly

🔄 Backward Compatibility

This change is fully backward compatible. Users who prefer the command-line interface can continue using it exactly as before:

# All of these still work!
export STRIX_LLM="openai/gpt-5"
export LLM_API_KEY="sk-..."
strix --target ./app-directory

# Or use CLI flags
strix -t https://example.com

The menu only appears when no --target argument is provided. Environment variables take precedence over saved configuration, making it perfect for CI/CD and automation.

📁 Files Changed

  • strix/interface/main.py - Added interactive menu, configuration screen, and config loading
  • strix/interface/config_manager.py - New module for configuration management
  • Configuration stored in ~/.strix/.env (created automatically)

Why this matters: While Strix has excellent functionality and a great CLI, requiring users to remember complex command-line arguments and manage environment variables manually creates friction. This interactive menu and built-in configuration management make Strix more accessible while maintaining all the power and flexibility of the original CLI interface. Users can now get started in seconds instead of minutes, and their settings persist across sessions.

@mirzaaghazadeh mirzaaghazadeh changed the title Add Interactive Menu for Easier CLI Usage Add Interactive Menu and Saved Configuration Nov 8, 2025
@m4ki3lf0
Copy link
Contributor

m4ki3lf0 commented Nov 8, 2025

Love the idea ! @0xallam

However few points of attention before merging

Code Fails Quality Checks :

$ make check-all
🎨 Formatting code with ruff...
poetry run ruff format .
2 files reformatted, 72 files left unchanged
✅ Code formatting complete!
🔍 Linting code with ruff...
poetry run ruff check . --fix
[SNIPPED]
Found 37 errors (1 fixed, 36 remaining).
No fixes available (22 hidden fixes can be enabled with the `--unsafe-fixes` option).
make: *** [Makefile:42: lint] Error 1
  • Cancelling the interactive menu crashes the CLI: When a user hits q/Esc in the new textual menu, InteractiveMenuApp exits with None, and main() immediately assigns that to args. The code never checks for this case, so the next access (if not args.run_name) raises AttributeError. Instead, either exit cleanly inside the menu, or have main() detect None and return before continuing.
  • Config file always overrides exported environment variables: ConfigManager.apply_to_environment() blindly writes its stored values into os.environ. Because main() calls this before parsing arguments, a user can no longer override STRIX_LLM, LLM_API_KEY, etc..., via env VAR=value strix ...; the stale values from ~/.strix/.env always win.

Suggestion for maintability :

  • Move the large CSS strings and key bindings for InteractiveMenuApp, InputPromptApp, and ConfigurationApp into a dedicated module, e.g., strix/interface/ui_constants.py (e.g., MENU_CSS, INPUT_CSS, CONFIG_CSS, and BINDINGS_*).
  • Introduce a separate module (mirroring existing cli.py/tui.py patterns) to house the new interactive flows.
  • strix/interface/menu.py for InteractiveMenuApp, InputPromptApp, ConfigurationApp, plus the orchestration functions show_interactive_menu_async, show_configuration_async, and helpers like prompt_input_async.

  • Keep main.py focused on high-level startup: load config, parse args, possibly call into menu.py for interactive mode, then run CLI/TUI.

@mirzaaghazadeh
Copy link
Author

However few points of attention before merging

Fixed and commited.

@m4ki3lf0
Copy link
Contributor

m4ki3lf0 commented Nov 9, 2025

Make check-all doesn't pass checks.

  • Running poetry run strix -n drops you into the TUI, which breaks automated/non-TTY workflows; before this PR argparse rejected the command. Please gate the interactive menu behind not args.non_interactive and emit a clear error (or exit) when someone requests non-interactive mode without supplying targets.

if @0xallam accepts this behaviour it is good to go

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants