Update effect upload to show IPFS CID
- Display CID instead of content hash after upload - Update example recipe syntax to use :cid Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1017,10 +1017,10 @@ def upload_recipe(filepath):
|
|||||||
@cli.command("upload-effect")
|
@cli.command("upload-effect")
|
||||||
@click.argument("filepath", type=click.Path(exists=True))
|
@click.argument("filepath", type=click.Path(exists=True))
|
||||||
def upload_effect(filepath):
|
def upload_effect(filepath):
|
||||||
"""Upload an effect file. Requires login.
|
"""Upload an effect file to IPFS. Requires login.
|
||||||
|
|
||||||
Effects are Python files with PEP 723 dependencies and @-tag metadata.
|
Effects are Python files with PEP 723 dependencies and @-tag metadata.
|
||||||
Returns the content hash for use in recipes.
|
Returns the IPFS CID for use in recipes.
|
||||||
"""
|
"""
|
||||||
token_data = load_token()
|
token_data = load_token()
|
||||||
if not token_data.get("access_token"):
|
if not token_data.get("access_token"):
|
||||||
@@ -1048,7 +1048,7 @@ def upload_effect(filepath):
|
|||||||
result = resp.json()
|
result = resp.json()
|
||||||
|
|
||||||
click.echo(f"Uploaded effect: {result['name']} v{result.get('version', '1.0.0')}")
|
click.echo(f"Uploaded effect: {result['name']} v{result.get('version', '1.0.0')}")
|
||||||
click.echo(f"Content hash: {result['content_hash']}")
|
click.echo(f"CID: {result['cid']}")
|
||||||
click.echo(f"Temporal: {result.get('temporal', False)}")
|
click.echo(f"Temporal: {result.get('temporal', False)}")
|
||||||
if result.get('params'):
|
if result.get('params'):
|
||||||
click.echo(f"Parameters: {', '.join(p['name'] for p in result['params'])}")
|
click.echo(f"Parameters: {', '.join(p['name'] for p in result['params'])}")
|
||||||
@@ -1056,7 +1056,7 @@ def upload_effect(filepath):
|
|||||||
click.echo(f"Dependencies: {', '.join(result['dependencies'])}")
|
click.echo(f"Dependencies: {', '.join(result['dependencies'])}")
|
||||||
click.echo()
|
click.echo()
|
||||||
click.echo("Use in recipes:")
|
click.echo("Use in recipes:")
|
||||||
click.echo(f' (effect {result["name"]} :hash "{result["content_hash"]}")')
|
click.echo(f' (effect {result["name"]} :cid "{result["cid"]}")')
|
||||||
except requests.RequestException as e:
|
except requests.RequestException as e:
|
||||||
click.echo(f"Upload failed: {e}", err=True)
|
click.echo(f"Upload failed: {e}", err=True)
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|||||||
Reference in New Issue
Block a user