feat: add clean mode for testing Bird CLI flow

- Add LAST30DAYS_CONFIG_DIR env var to override config location
- Set LAST30DAYS_CONFIG_DIR="" in test skill for clean mode
- Test skill now ignores existing API keys to show Bird install prompt

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Matt Van Horn
2026-02-03 11:48:40 -08:00
parent d122210e1e
commit fe9ebb9944
2 changed files with 21 additions and 6 deletions
+5 -2
View File
@@ -12,10 +12,13 @@ allowed-tools: Bash, Read, Write, AskUserQuestion, WebSearch
This is the TEST version of /last30days with Bird CLI integration for free X/Twitter search. This is the TEST version of /last30days with Bird CLI integration for free X/Twitter search.
**CLEAN MODE:** This test skill ignores your existing ~/.config/last30days/.env so you can experience the Bird CLI installation flow from scratch.
**What's new:** **What's new:**
- Bird CLI support for free X/Twitter search (no API key needed) - Bird CLI support for free X/Twitter search (no API key needed)
- Uses browser cookies for authentication - Uses browser cookies for authentication
- Falls back to xAI if Bird not available - Interactive prompt to install Bird if not found
- Falls back to WebSearch if Bird not available (xAI keys ignored in test mode)
Research ANY topic across Reddit, X, and the web. Surface what people are actually discussing, recommending, and debating right now. Research ANY topic across Reddit, X, and the web. Surface what people are actually discussing, recommending, and debating right now.
@@ -106,7 +109,7 @@ chmod 600 ~/.config/last30days/.env
**Step 1: Run the research script** **Step 1: Run the research script**
```bash ```bash
python3 ~/.claude/skills/last30daystest/scripts/last30days.py "$ARGUMENTS" --emit=compact 2>&1 LAST30DAYS_CONFIG_DIR="" python3 ~/.claude/skills/last30daystest/scripts/last30days.py "$ARGUMENTS" --emit=compact 2>&1
``` ```
The script will automatically: The script will automatically:
+16 -4
View File
@@ -4,8 +4,20 @@ import os
from pathlib import Path from pathlib import Path
from typing import Optional, Dict, Any from typing import Optional, Dict, Any
CONFIG_DIR = Path.home() / ".config" / "last30days" # Allow override via environment variable for testing
CONFIG_FILE = CONFIG_DIR / ".env" # Set LAST30DAYS_CONFIG_DIR="" for clean/no-config mode
# Set LAST30DAYS_CONFIG_DIR="/path/to/dir" for custom config location
_config_override = os.environ.get('LAST30DAYS_CONFIG_DIR')
if _config_override == "":
# Empty string = no config file (clean mode)
CONFIG_DIR = None
CONFIG_FILE = None
elif _config_override:
CONFIG_DIR = Path(_config_override)
CONFIG_FILE = CONFIG_DIR / ".env"
else:
CONFIG_DIR = Path.home() / ".config" / "last30days"
CONFIG_FILE = CONFIG_DIR / ".env"
def load_env_file(path: Path) -> Dict[str, str]: def load_env_file(path: Path) -> Dict[str, str]:
@@ -33,8 +45,8 @@ def load_env_file(path: Path) -> Dict[str, str]:
def get_config() -> Dict[str, Any]: def get_config() -> Dict[str, Any]:
"""Load configuration from ~/.config/last30days/.env and environment.""" """Load configuration from ~/.config/last30days/.env and environment."""
# Load from config file first # Load from config file first (if configured)
file_env = load_env_file(CONFIG_FILE) file_env = load_env_file(CONFIG_FILE) if CONFIG_FILE else {}
# Environment variables override file # Environment variables override file
config = { config = {