fix(system): S61-S62 — API cleanup, drone path routing, naming checker, .backup→.recovery rename (#142)
- API: 18-item P0/P1/P2 cleanup (debug prints→logger, help gate fix, URL injection fix, key masking, unused imports) - Drone: passport walk-up replaces hardcoded src/aipass/<branch> pattern, 13 naming bypasses removed - Seedgo: naming checker fixed (__dunder__ skip + column-0 scope detection) — eliminates 71 false positives system-wide - Spawn: .backup→.recovery rename (pre-change snapshots no longer conflict with backup branch namespace) - .gitignore: .recovery/ added - HERALD.md: Updated through S62 (backup audit, .recovery rename, night shift launch) - README.md: Stats updated (141 PRs, 2900+ tests) Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.6
parent
ae459853f0
commit
6772cacce2
@@ -20,10 +20,9 @@ from pathlib import Path
|
||||
|
||||
from typing import List
|
||||
from aipass.prax.apps.modules.logger import system_logger as logger
|
||||
from aipass.cli.apps.modules import console, header, success, error, warning, section
|
||||
from aipass.cli.apps.modules import console, header, success, error
|
||||
from aipass.api.apps.handlers.json import json_handler
|
||||
from aipass.api.apps.handlers.auth import keys, env
|
||||
from aipass.api.apps.handlers.config import provider
|
||||
|
||||
|
||||
def print_introspection():
|
||||
@@ -110,7 +109,8 @@ def get_key(args: List[str]):
|
||||
|
||||
if api_key:
|
||||
success(f"API key retrieved for {provider_name}")
|
||||
console.print(f" Key (first 20 chars): {api_key[:20]}...")
|
||||
masked = api_key[:6] + "****" + api_key[-4:] if len(api_key) > 10 else "****"
|
||||
console.print(f" Key: {masked}")
|
||||
else:
|
||||
error(f"Failed to retrieve API key for {provider_name}")
|
||||
|
||||
|
||||
@@ -124,11 +124,6 @@ def handle_command(command: str, args: List[str]) -> bool:
|
||||
Returns:
|
||||
True if command was handled, False to pass through.
|
||||
"""
|
||||
# Help gate
|
||||
if args and args[0] in ("--help", "-h", "help"):
|
||||
print_help()
|
||||
return True
|
||||
|
||||
# NO-ARGS GATE (seedgo standard)
|
||||
if not args:
|
||||
if command == "google":
|
||||
@@ -140,6 +135,12 @@ def handle_command(command: str, args: List[str]) -> bool:
|
||||
if args[0] != "google":
|
||||
return False
|
||||
|
||||
# Help gate — only fires after confirming this is a google command
|
||||
remaining = args[1:] if len(args) > 1 else []
|
||||
if remaining and remaining[0] in ("--help", "-h", "help"):
|
||||
print_help()
|
||||
return True
|
||||
|
||||
if command == "validate":
|
||||
_cmd_validate()
|
||||
return True
|
||||
|
||||
@@ -17,11 +17,10 @@ Orchestrates LLM API client operations:
|
||||
"""
|
||||
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
from typing import List
|
||||
from aipass.prax.apps.modules.logger import system_logger as logger
|
||||
from aipass.cli.apps.modules import console, header, success, error, warning, section
|
||||
from aipass.cli.apps.modules import console, header, success, error
|
||||
from aipass.api.apps.handlers.json import json_handler
|
||||
from aipass.api.apps.handlers.auth import keys
|
||||
from aipass.api.apps.handlers.openrouter import client, models
|
||||
@@ -188,7 +187,42 @@ def make_call(args: List[str]):
|
||||
header("OpenRouter API Call")
|
||||
console.print()
|
||||
|
||||
warning("API call workflow - TODO")
|
||||
if not args:
|
||||
error("Prompt required", suggestion="drone @api call \"your prompt\" --model MODEL")
|
||||
return
|
||||
|
||||
# Parse args: first non-flag arg is prompt, --model MODEL is optional
|
||||
prompt = None
|
||||
model = None
|
||||
i = 0
|
||||
while i < len(args):
|
||||
if args[i] == "--model" and i + 1 < len(args):
|
||||
model = args[i + 1]
|
||||
i += 2
|
||||
elif prompt is None:
|
||||
prompt = args[i]
|
||||
i += 1
|
||||
else:
|
||||
i += 1
|
||||
|
||||
if not prompt:
|
||||
error("Prompt required", suggestion="drone @api call \"your prompt\" --model MODEL")
|
||||
return
|
||||
|
||||
if not model:
|
||||
error("Model required", suggestion="drone @api call \"your prompt\" --model anthropic/claude-3.5-sonnet")
|
||||
return
|
||||
|
||||
console.print(f"[dim]Calling {model}...[/dim]")
|
||||
|
||||
response = client.get_response(prompt, caller="cli", model=model)
|
||||
|
||||
if response:
|
||||
success(f"Response received ({len(response['content'])} chars)")
|
||||
console.print()
|
||||
console.print(response["content"])
|
||||
else:
|
||||
error("API call failed")
|
||||
|
||||
|
||||
def list_models(args: List[str] | None = None):
|
||||
|
||||
@@ -21,7 +21,7 @@ from pathlib import Path
|
||||
|
||||
from typing import List
|
||||
from aipass.prax.apps.modules.logger import system_logger as logger
|
||||
from aipass.cli.apps.modules import console, header, success, error, warning, section
|
||||
from aipass.cli.apps.modules import console, header, success, error, warning
|
||||
from aipass.api.apps.handlers.json import json_handler
|
||||
from aipass.api.apps.handlers.usage import tracking, aggregation, cleanup
|
||||
|
||||
@@ -174,7 +174,22 @@ def track_usage(args: List[str]):
|
||||
header("Track API Usage")
|
||||
console.print()
|
||||
|
||||
warning("Usage tracking workflow - TODO")
|
||||
if not args:
|
||||
error("Generation ID required", suggestion="drone @api track <generation_id> [caller]")
|
||||
return
|
||||
|
||||
generation_id = args[0]
|
||||
caller = args[1] if len(args) > 1 else "manual"
|
||||
|
||||
console.print(f"[dim]Tracking generation {generation_id}...[/dim]")
|
||||
|
||||
result = tracking.track_usage(generation_id, caller)
|
||||
|
||||
if result.get("success"):
|
||||
metrics = result.get("metrics", {})
|
||||
success(f"Tracked: {metrics.get('tokens_prompt', 0)} prompt + {metrics.get('tokens_completion', 0)} completion tokens, ${metrics.get('total_cost', 0):.6f}")
|
||||
else:
|
||||
error(f"Tracking failed: {result.get('error', 'unknown')}")
|
||||
|
||||
|
||||
def show_stats():
|
||||
|
||||
Reference in New Issue
Block a user