mirror of
https://github.com/leonvanzyl/autocoder.git
synced 2026-01-30 06:12:06 +00:00
feat: add configurable CLI command and UI improvements
Add support for alternative CLI commands via CLI_COMMAND environment variable, allowing users to use CLIs other than 'claude' (e.g., 'glm'). This change affects all server services and the main CLI launcher. Key changes: - Configurable CLI command via CLI_COMMAND env var (defaults to 'claude') - Configurable Playwright headless mode via PLAYWRIGHT_HEADLESS env var - Pin claude-agent-sdk version to <0.2.0 for stability - Use tail -500 for progress notes to avoid context overflow - Add project delete functionality with confirmation dialog - Replace single-line input with resizable textarea in spec chat - Add coder agent configuration for code implementation tasks - Ignore issues/ directory in git Files modified: - client.py: CLI command and Playwright headless configuration - server/main.py, server/services/*: CLI command configuration - start.py: CLI command configuration and error messages - .env.example: Document new environment variables - .gitignore: Ignore issues/ directory - requirements.txt: Pin SDK version - .claude/templates/*: Use tail -500 for progress notes - ui/src/components/ProjectSelector.tsx: Add delete button - ui/src/components/SpecCreationChat.tsx: Auto-resizing textarea - ui/src/components/ConfirmDialog.tsx: New reusable dialog - .claude/agents/coder.md: New coder agent configuration Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
37
start.py
37
start.py
@@ -13,7 +13,24 @@ import subprocess
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
from dotenv import load_dotenv
|
||||
|
||||
from auth import is_auth_error, print_auth_error_help
|
||||
|
||||
# Load environment variables from .env file if present
|
||||
load_dotenv()
|
||||
|
||||
|
||||
def get_cli_command() -> str:
|
||||
"""
|
||||
Get the CLI command to use for the agent.
|
||||
|
||||
Reads from CLI_COMMAND environment variable, defaults to 'claude'.
|
||||
This allows users to use alternative CLIs like 'glm'.
|
||||
"""
|
||||
return os.getenv("CLI_COMMAND", "claude")
|
||||
|
||||
|
||||
from prompts import (
|
||||
get_project_prompts_dir,
|
||||
has_project_prompts,
|
||||
@@ -217,11 +234,12 @@ def run_spec_creation(project_dir: Path) -> bool:
|
||||
print("Exit Claude Code (Ctrl+C or /exit) when finished.\n")
|
||||
|
||||
try:
|
||||
# Launch Claude Code with /create-spec command
|
||||
# Launch CLI with /create-spec command
|
||||
# Project path included in command string so it populates $ARGUMENTS
|
||||
# Capture stderr to detect auth errors while letting stdout flow to terminal
|
||||
cli_command = get_cli_command()
|
||||
result = subprocess.run(
|
||||
["claude", f"/create-spec {project_dir}"],
|
||||
[cli_command, f"/create-spec {project_dir}"],
|
||||
check=False, # Don't raise on non-zero exit
|
||||
cwd=str(Path(__file__).parent), # Run from project root
|
||||
stderr=subprocess.PIPE,
|
||||
@@ -249,13 +267,17 @@ def run_spec_creation(project_dir: Path) -> bool:
|
||||
print(f"Please ensure app_spec.txt exists in: {get_project_prompts_dir(project_dir)}")
|
||||
# If failed with non-zero exit and no spec, might be auth issue
|
||||
if result.returncode != 0:
|
||||
print("\nIf you're having authentication issues, try running: claude login")
|
||||
print(f"\nIf you're having authentication issues, try running: {cli_command} login")
|
||||
return False
|
||||
|
||||
except FileNotFoundError:
|
||||
print("\nError: 'claude' command not found.")
|
||||
print("Make sure Claude Code CLI is installed:")
|
||||
print(" npm install -g @anthropic-ai/claude-code")
|
||||
cli_command = get_cli_command()
|
||||
print(f"\nError: '{cli_command}' command not found.")
|
||||
if cli_command == "claude":
|
||||
print("Make sure Claude Code CLI is installed:")
|
||||
print(" npm install -g @anthropic-ai/claude-code")
|
||||
else:
|
||||
print(f"Make sure the '{cli_command}' CLI is installed and in your PATH.")
|
||||
return False
|
||||
except KeyboardInterrupt:
|
||||
print("\n\nSpec creation cancelled.")
|
||||
@@ -407,7 +429,8 @@ def run_agent(project_name: str, project_dir: Path) -> None:
|
||||
print(f"\nAgent error:\n{stderr_output.strip()}")
|
||||
# Still hint about auth if exit was unexpected
|
||||
if "error" in stderr_output.lower() or "exception" in stderr_output.lower():
|
||||
print("\nIf this is an authentication issue, try running: claude login")
|
||||
cli_command = get_cli_command()
|
||||
print(f"\nIf this is an authentication issue, try running: {cli_command} login")
|
||||
|
||||
except KeyboardInterrupt:
|
||||
print("\n\nAgent interrupted. Run again to resume.")
|
||||
|
||||
Reference in New Issue
Block a user