M7 follow-up: block GUI silent overwrite, connect registry publish --dry-run to preflight endpoint
This commit is contained in:
@@ -414,13 +414,44 @@ def _cmd_registry_publish(args):
|
||||
return 1
|
||||
|
||||
if args.dry_run:
|
||||
print("Dry run - validating only")
|
||||
print("Dry run — validating locally and via registry preflight")
|
||||
print()
|
||||
print(f"Would publish:")
|
||||
|
||||
# Local validation
|
||||
print(f" Name: {name}")
|
||||
print(f" Version: {version}")
|
||||
print(f" Config: {len(config_yaml)} bytes")
|
||||
print(f" README: {len(readme)} bytes")
|
||||
print()
|
||||
|
||||
# Attempt registry preflight if token is configured
|
||||
config = load_config()
|
||||
if config.registry.token:
|
||||
try:
|
||||
client = get_client()
|
||||
result = client.publish_tool(
|
||||
config_yaml, readme=readme, defaults=defaults,
|
||||
dry_run=True,
|
||||
)
|
||||
errors = result.get("errors") or []
|
||||
warnings = result.get("warnings") or []
|
||||
if errors:
|
||||
print(f"Preflight errors ({len(errors)}):")
|
||||
for err in errors:
|
||||
print(f" ERROR: {err}")
|
||||
if warnings:
|
||||
print(f"Preflight warnings ({len(warnings)}):")
|
||||
for warn in warnings:
|
||||
print(f" WARN: {warn}")
|
||||
if not errors and not warnings:
|
||||
print("Registry preflight passed.")
|
||||
return 0 if not errors else 1
|
||||
except Exception as e:
|
||||
print(f"Registry preflight unavailable: {e}")
|
||||
print("Proceeding with local validation only.")
|
||||
else:
|
||||
print("No registry token configured — local validation only.")
|
||||
print("Configure a token to get registry-side preflight checks.")
|
||||
return 0
|
||||
|
||||
# Check for token
|
||||
|
||||
Reference in New Issue
Block a user