Extend update command error handling and update documentation

- Extend safe_cli_wrapper() to suppress spurious Click errors for both
  install and update commands; add success indicators for update output
- Add test_update_command_error_suppression to verify error suppression
- Expand CLAUDE.md to document all 17 agents with categories
- Add Keep a Contributing-File format header to CONTRIBUTING.md
- Fix TodoFileGuide URL reference in TODO.md
- Add RELEASE_NOTES_v1.0.1.md

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-27 09:02:04 +01:00
parent 167222d45b
commit 3858141ce6
6 changed files with 281 additions and 41 deletions

View File

@@ -28,6 +28,8 @@ def safe_cli_wrapper():
This appears to be a Click library display/buffering issue where error handling
interferes with normal execution flow.
AFFECTED COMMANDS: install, update
ISSUE DETAILS:
- Affects: Click library (tested with Click 8.x series)
- Symptom: Misleading error messages during successful command execution
@@ -54,18 +56,19 @@ def safe_cli_wrapper():
stderr_capture = io.StringIO()
stdout_capture = io.StringIO()
# Check if this is an install command before processing
install_command = len(sys.argv) >= 2 and sys.argv[1] == "install"
# Check if this is an install or update command before processing
affected_commands = len(sys.argv) >= 2 and sys.argv[1] in ["install", "update"]
try:
with contextlib.redirect_stderr(stderr_capture), contextlib.redirect_stdout(stdout_capture):
cli(standalone_mode=False)
except click.UsageError as e:
if install_command and "Got unexpected extra argument" in str(e):
# This is the spurious error for install command
if affected_commands and "Got unexpected extra argument" in str(e):
# This is the spurious error for install/update commands
# Check if we got some stdout output indicating success
captured_stdout = stdout_capture.getvalue()
if "Installing agents to:" in captured_stdout:
success_indicators = ["Installing agents to:", "Updating all installed agents:"]
if any(indicator in captured_stdout for indicator in success_indicators):
# The command was actually executing, show the real output
print(captured_stdout, end='')
sys.exit(0)
@@ -87,10 +90,11 @@ def safe_cli_wrapper():
print(captured_stdout, end='')
else:
# Error exit - show both stdout and stderr unless it's the spurious error
if install_command and "Got unexpected extra argument" in captured_stderr:
# Show only stdout for install commands with spurious errors
if affected_commands and "Got unexpected extra argument" in captured_stderr:
# Show only stdout for install/update commands with spurious errors
print(captured_stdout, end='')
if "Installing agents to:" in captured_stdout:
success_indicators = ["Installing agents to:", "Updating all installed agents:"]
if any(indicator in captured_stdout for indicator in success_indicators):
sys.exit(0) # Override error exit if we see success indicators
else:
# Show everything for other commands
@@ -104,7 +108,7 @@ def safe_cli_wrapper():
# If we get here, show captured output
print(stdout_capture.getvalue(), end='')
stderr_content = stderr_capture.getvalue()
if stderr_content and not (install_command and "Got unexpected extra argument" in stderr_content):
if stderr_content and not (affected_commands and "Got unexpected extra argument" in stderr_content):
print(stderr_content, end='', file=sys.stderr)
@click.group()
@@ -220,7 +224,13 @@ def install(agents: List[str], target: str, no_backup: bool, no_docs: bool):
@click.option("--target", "-t", default=".", help="Target directory (default: current)")
@click.argument("agents", nargs=-1)
def update(target: str, agents: List[str]):
"""Update installed agents."""
"""
Update installed agents.
NOTE: This command is affected by a Click library issue that causes spurious
"Got unexpected extra argument" messages. This is handled by safe_cli_wrapper().
See safe_cli_wrapper() docstring for details and removal timeline.
"""
registry = _get_registry()
installer = AgentInstaller(registry)