Some checks failed
CLI Tests / test-cli (push) Has started running
Cross-Node Transaction Testing / transaction-test (push) Successful in 2s
Deploy to Testnet / deploy-testnet (push) Successful in 1m9s
Documentation Validation / validate-docs (push) Failing after 9s
Documentation Validation / validate-policies-strict (push) Successful in 4s
Multi-Node Stress Testing / stress-test (push) Successful in 3s
Node Failover Simulation / failover-test (push) Successful in 2s
Security Scanning / security-scan (push) Successful in 29s
- Update all command module docstrings to consistent format ending with "for AITBC CLI" - Remove unused imports (json, httpx, pydantic) from multiple command modules - Reorder imports to group utils imports together - Change sys.path in click_cli.py from /opt/aitbc to /opt/aitbc/cli - Fix relative imports in cross_chain.py and ipfs.py to use .config
61 lines
1.5 KiB
Python
61 lines
1.5 KiB
Python
"""Island computing commands for AITBC CLI"""
|
|
|
|
import click
|
|
from utils import output, error, success, warning
|
|
|
|
|
|
@click.group()
|
|
def island():
|
|
"""Island computing commands"""
|
|
pass
|
|
|
|
|
|
@island.command()
|
|
@click.option("--name", required=True, help="Island name")
|
|
@click.option("--capacity", type=int, help="Computing capacity")
|
|
def create(name: str, capacity: int):
|
|
"""Create island"""
|
|
import uuid
|
|
output({
|
|
"island_id": f"island_{uuid.uuid4().hex[:16]}",
|
|
"name": name,
|
|
"capacity": capacity or 100,
|
|
"status": "active"
|
|
})
|
|
|
|
|
|
@island.command()
|
|
@click.option("--island-id", required=True, help="Island ID")
|
|
def join(island_id: str):
|
|
"""Join island"""
|
|
output({
|
|
"island_id": island_id,
|
|
"status": "joined"
|
|
})
|
|
|
|
|
|
@island.command()
|
|
@click.option("--island-id", required=True, help="Island ID")
|
|
def leave(island_id: str):
|
|
"""Leave island"""
|
|
output({
|
|
"island_id": island_id,
|
|
"status": "left"
|
|
})
|
|
|
|
|
|
@island.command()
|
|
@click.option("--source-island", required=True, help="Source island ID")
|
|
@click.option("--target-island", required=True, help="Target island ID")
|
|
@click.option("--bandwidth", type=int, help="Bridge bandwidth")
|
|
def bridge(source_island: str, target_island: str, bandwidth: int):
|
|
"""Create bridge between islands"""
|
|
import uuid
|
|
output({
|
|
"bridge_id": f"bridge_{uuid.uuid4().hex[:16]}",
|
|
"source_island": source_island,
|
|
"target_island": target_island,
|
|
"bandwidth": bandwidth or 1000,
|
|
"status": "active"
|
|
})
|