Standardize config initialization across all CLI command groups
Some checks failed
CLI Tests / test-cli (push) Failing after 17s
Cross-Node Transaction Testing / transaction-test (push) Successful in 9s
Deploy to Testnet / deploy-testnet (push) Successful in 1m18s
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 17s
Some checks failed
CLI Tests / test-cli (push) Failing after 17s
Cross-Node Transaction Testing / transaction-test (push) Successful in 9s
Deploy to Testnet / deploy-testnet (push) Successful in 1m18s
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 17s
- Add config initialization to all command group decorators - Import get_config and CLIConfig from aitbc_cli.config in all command modules - Set default output_format to 'table' in context object - Add console import to utils imports where needed - Remove unused imports (json, time, asyncio, base64, mimetypes, pathlib) - Reorder imports to group utils imports together - Update marketplace_advanced group name from 'advanced' to 'marketplace
This commit is contained in:
@@ -1,16 +1,24 @@
|
||||
"""Admin commands for AITBC CLI"""
|
||||
|
||||
import click
|
||||
from utils import output, error, success, console
|
||||
import httpx
|
||||
import json
|
||||
from typing import Optional, List, Dict, Any
|
||||
from utils import output, error, success
|
||||
from aitbc_cli.config import get_config, CLIConfig
|
||||
|
||||
|
||||
@click.group()
|
||||
@click.pass_context
|
||||
def admin(ctx):
|
||||
"""System administration commands"""
|
||||
# Initialize context object with config
|
||||
if ctx.obj is None:
|
||||
ctx.obj = {}
|
||||
if 'config' not in ctx.obj:
|
||||
ctx.obj['config'] = get_config()
|
||||
if 'output_format' not in ctx.obj:
|
||||
ctx.obj['output_format'] = 'table'
|
||||
|
||||
# Set role for admin commands
|
||||
ctx.ensure_object(dict)
|
||||
ctx.parent.detected_role = 'admin'
|
||||
|
||||
@@ -2,6 +2,11 @@
|
||||
|
||||
import click
|
||||
import httpx
|
||||
from utils import output, error
|
||||
import os
|
||||
from typing import Optional, List
|
||||
from aitbc_cli.config import get_config, CLIConfig
|
||||
|
||||
|
||||
def _get_node_endpoint(ctx):
|
||||
"""Get the blockchain node RPC endpoint from context or config."""
|
||||
@@ -22,6 +27,14 @@ import os
|
||||
@click.pass_context
|
||||
def blockchain(ctx, chain_id: Optional[str]):
|
||||
"""Query blockchain information and status"""
|
||||
# Initialize context object with config
|
||||
if ctx.obj is None:
|
||||
ctx.obj = {}
|
||||
if 'config' not in ctx.obj:
|
||||
ctx.obj['config'] = get_config()
|
||||
if 'output_format' not in ctx.obj:
|
||||
ctx.obj['output_format'] = 'table'
|
||||
|
||||
# Set role for blockchain commands
|
||||
ctx.ensure_object(dict)
|
||||
ctx.parent.detected_role = 'blockchain'
|
||||
|
||||
@@ -1,17 +1,24 @@
|
||||
"""Client commands for AITBC CLI"""
|
||||
|
||||
import click
|
||||
from utils import output, error, success, console
|
||||
import httpx
|
||||
import json
|
||||
import time
|
||||
from typing import Optional
|
||||
from utils import output, error, success
|
||||
from aitbc_cli.config import get_config, CLIConfig
|
||||
|
||||
|
||||
@click.group()
|
||||
@click.pass_context
|
||||
def client(ctx):
|
||||
"""Submit and manage jobs"""
|
||||
# Initialize context object with config
|
||||
if ctx.obj is None:
|
||||
ctx.obj = {}
|
||||
if 'config' not in ctx.obj:
|
||||
ctx.obj['config'] = get_config()
|
||||
if 'output_format' not in ctx.obj:
|
||||
ctx.obj['output_format'] = 'table'
|
||||
|
||||
# Set role for client commands
|
||||
ctx.ensure_object(dict)
|
||||
ctx.parent.detected_role = 'client'
|
||||
|
||||
@@ -13,9 +13,14 @@ from utils import output, error, success
|
||||
|
||||
|
||||
@click.group()
|
||||
def config():
|
||||
@click.pass_context
|
||||
def config(ctx):
|
||||
"""Manage CLI configuration"""
|
||||
pass
|
||||
# Initialize context object with config
|
||||
if ctx.obj is None:
|
||||
ctx.obj = {}
|
||||
ctx.obj['config'] = get_config()
|
||||
ctx.obj['output_format'] = ctx.obj.get('output_format', 'table')
|
||||
|
||||
|
||||
@config.command()
|
||||
|
||||
@@ -6,12 +6,18 @@ import json
|
||||
from typing import Optional
|
||||
from .config import get_config
|
||||
from utils import success, error, output
|
||||
from aitbc_cli.config import get_config, CLIConfig
|
||||
|
||||
|
||||
@click.group()
|
||||
def cross_chain():
|
||||
@click.pass_context
|
||||
def cross_chain(ctx):
|
||||
"""Cross-chain trading operations"""
|
||||
pass
|
||||
# Initialize context object with config
|
||||
if ctx.obj is None:
|
||||
ctx.obj = {}
|
||||
ctx.obj['config'] = get_config()
|
||||
ctx.obj['output_format'] = ctx.obj.get('output_format', 'table')
|
||||
|
||||
|
||||
@cross_chain.command()
|
||||
|
||||
@@ -1,19 +1,26 @@
|
||||
"""Exchange integration commands for AITBC CLI"""
|
||||
|
||||
import click
|
||||
from utils import output, error, success, console
|
||||
import httpx
|
||||
from typing import Optional
|
||||
from aitbc_cli.config import get_config, CLIConfig
|
||||
import json
|
||||
import os
|
||||
from pathlib import Path
|
||||
from typing import Optional, Dict, Any, List
|
||||
from datetime import datetime, UTC
|
||||
from utils import output, error, success, warning
|
||||
from config import get_config
|
||||
|
||||
|
||||
@click.group()
|
||||
def exchange():
|
||||
@click.pass_context
|
||||
def exchange(ctx):
|
||||
"""Exchange integration and trading management commands"""
|
||||
# Initialize context object with config
|
||||
if ctx.obj is None:
|
||||
ctx.obj = {}
|
||||
ctx.obj['config'] = get_config()
|
||||
ctx.obj['output_format'] = ctx.obj.get('output_format', 'table')
|
||||
pass
|
||||
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@ import subprocess
|
||||
import json
|
||||
from typing import Optional, List
|
||||
from utils import output, error
|
||||
from aitbc_cli.config import get_config, CLIConfig
|
||||
|
||||
|
||||
def _get_explorer_endpoint(ctx):
|
||||
@@ -42,6 +43,14 @@ def _curl_request(url: str, params: dict = None):
|
||||
@click.pass_context
|
||||
def explorer(ctx):
|
||||
"""Blockchain explorer operations and queries"""
|
||||
# Initialize context object with config
|
||||
if ctx.obj is None:
|
||||
ctx.obj = {}
|
||||
if 'config' not in ctx.obj:
|
||||
ctx.obj['config'] = get_config()
|
||||
if 'output_format' not in ctx.obj:
|
||||
ctx.obj['output_format'] = 'table'
|
||||
|
||||
ctx.ensure_object(dict)
|
||||
ctx.parent.detected_role = 'explorer'
|
||||
|
||||
|
||||
@@ -1,19 +1,27 @@
|
||||
"""hermes integration commands for AITBC CLI"""
|
||||
|
||||
import click
|
||||
from utils import output, error, success, console
|
||||
import httpx
|
||||
from typing import Optional
|
||||
from aitbc_cli.config import get_config, CLIConfig
|
||||
import json
|
||||
import time
|
||||
import os
|
||||
import datetime
|
||||
import subprocess
|
||||
from typing import Optional, Dict, Any, List
|
||||
from utils import output, error, success, warning
|
||||
|
||||
|
||||
@click.group()
|
||||
def hermes():
|
||||
@click.pass_context
|
||||
def hermes(ctx):
|
||||
"""hermes integration with edge computing deployment"""
|
||||
# Initialize context object with config
|
||||
if ctx.obj is None:
|
||||
ctx.obj = {}
|
||||
ctx.obj['config'] = get_config()
|
||||
ctx.obj['output_format'] = ctx.obj.get('output_format', 'table')
|
||||
pass
|
||||
|
||||
|
||||
|
||||
@@ -8,11 +8,18 @@ from pathlib import Path
|
||||
from typing import Optional, Dict, Any, List
|
||||
from datetime import datetime, UTC, timedelta
|
||||
from utils import output, error, success, warning
|
||||
from aitbc_cli.config import get_config, CLIConfig
|
||||
|
||||
|
||||
@click.group()
|
||||
def market_maker():
|
||||
@click.pass_context
|
||||
def market_maker(ctx):
|
||||
"""Market making bot management commands"""
|
||||
# Initialize context object with config
|
||||
if ctx.obj is None:
|
||||
ctx.obj = {}
|
||||
ctx.obj['config'] = get_config()
|
||||
ctx.obj['output_format'] = ctx.obj.get('output_format', 'table')
|
||||
pass
|
||||
|
||||
|
||||
|
||||
@@ -1,18 +1,21 @@
|
||||
"""Marketplace commands for AITBC CLI"""
|
||||
|
||||
import click
|
||||
from utils import output, error, success, console
|
||||
import httpx
|
||||
import json
|
||||
import asyncio
|
||||
from typing import Optional, List, Dict, Any
|
||||
from utils import output, error, success
|
||||
import os
|
||||
from typing import Optional
|
||||
from aitbc_cli.config import get_config, CLIConfig
|
||||
|
||||
|
||||
@click.group()
|
||||
def marketplace():
|
||||
"""GPU marketplace operations"""
|
||||
pass
|
||||
@click.pass_context
|
||||
def marketplace(ctx):
|
||||
"""Marketplace listings and offers"""
|
||||
# Initialize context object with config
|
||||
if ctx.obj is None:
|
||||
ctx.obj = {}
|
||||
ctx.obj['config'] = get_config()
|
||||
ctx.obj['output_format'] = ctx.obj.get('output_format', 'table')
|
||||
|
||||
|
||||
@marketplace.group()
|
||||
|
||||
@@ -1,19 +1,20 @@
|
||||
"""Advanced marketplace commands for AITBC CLI - Enhanced marketplace operations"""
|
||||
|
||||
import click
|
||||
from utils import output, error, success, console
|
||||
import httpx
|
||||
import json
|
||||
import base64
|
||||
from typing import Optional, Dict, Any, List
|
||||
from pathlib import Path
|
||||
from utils import output, error, success, warning
|
||||
|
||||
from typing import Optional
|
||||
from aitbc_cli.config import get_config, CLIConfig
|
||||
|
||||
@click.group()
|
||||
def advanced():
|
||||
"""Advanced marketplace operations and analytics"""
|
||||
pass
|
||||
|
||||
@click.pass_context
|
||||
def marketplace_advanced(ctx):
|
||||
"""Advanced marketplace operations"""
|
||||
# Initialize context object with config
|
||||
if ctx.obj is None:
|
||||
ctx.obj = {}
|
||||
ctx.obj['config'] = get_config()
|
||||
ctx.obj['output_format'] = ctx.obj.get('output_format', 'table')
|
||||
|
||||
@click.group()
|
||||
def models():
|
||||
|
||||
@@ -7,9 +7,21 @@ import time
|
||||
import concurrent.futures
|
||||
from typing import Optional, Dict, Any, List
|
||||
from utils import output, error, success
|
||||
from aitbc_cli.config import get_config, CLIConfig
|
||||
|
||||
|
||||
@click.group(invoke_without_command=True)
|
||||
@click.group()
|
||||
@click.pass_context
|
||||
def miner(ctx):
|
||||
"""Mining operations and rewards"""
|
||||
# Initialize context object with config
|
||||
if ctx.obj is None:
|
||||
ctx.obj = {}
|
||||
ctx.obj['config'] = get_config()
|
||||
ctx.obj['output_format'] = ctx.obj.get('output_format', 'table')
|
||||
|
||||
|
||||
@miner.group(invoke_without_command=True)
|
||||
@click.pass_context
|
||||
def miner(ctx):
|
||||
"""Register as miner and process jobs"""
|
||||
|
||||
@@ -6,12 +6,18 @@ import time
|
||||
from pathlib import Path
|
||||
from typing import Optional
|
||||
from datetime import datetime, timedelta
|
||||
from aitbc_cli.config import get_config, CLIConfig
|
||||
|
||||
|
||||
@click.group()
|
||||
def monitor():
|
||||
@click.pass_context
|
||||
def monitor(ctx):
|
||||
"""Monitoring, metrics, and alerting commands"""
|
||||
pass
|
||||
# Initialize context object with config
|
||||
if ctx.obj is None:
|
||||
ctx.obj = {}
|
||||
ctx.obj['config'] = get_config()
|
||||
ctx.obj['output_format'] = ctx.obj.get('output_format', 'table')
|
||||
|
||||
|
||||
@monitor.command()
|
||||
|
||||
@@ -1,19 +1,21 @@
|
||||
"""Multi-modal processing commands for AITBC CLI"""
|
||||
|
||||
import click
|
||||
from utils import output, error, success, console
|
||||
import httpx
|
||||
import json
|
||||
import base64
|
||||
import mimetypes
|
||||
from typing import Optional, Dict, Any, List
|
||||
from pathlib import Path
|
||||
from utils import output, error, success, warning
|
||||
from typing import Optional
|
||||
from aitbc_cli.config import get_config, CLIConfig
|
||||
|
||||
|
||||
@click.group()
|
||||
def multimodal():
|
||||
"""Multi-modal agent processing and cross-modal operations"""
|
||||
pass
|
||||
@click.pass_context
|
||||
def multimodal(ctx):
|
||||
"""Multimodal AI operations"""
|
||||
# Initialize context object with config
|
||||
if ctx.obj is None:
|
||||
ctx.obj = {}
|
||||
ctx.obj['config'] = get_config()
|
||||
ctx.obj['output_format'] = ctx.obj.get('output_format', 'table')
|
||||
|
||||
|
||||
@multimodal.command()
|
||||
|
||||
@@ -1,17 +1,21 @@
|
||||
"""Autonomous optimization commands for AITBC CLI"""
|
||||
|
||||
import click
|
||||
from utils import output, error, success, console
|
||||
import httpx
|
||||
import json
|
||||
import time
|
||||
from typing import Optional, Dict, Any, List
|
||||
from utils import output, error, success, warning
|
||||
from typing import Optional
|
||||
from aitbc_cli.config import get_config, CLIConfig
|
||||
|
||||
|
||||
@click.group()
|
||||
def optimize():
|
||||
@click.pass_context
|
||||
def optimize(ctx):
|
||||
"""Autonomous optimization and predictive operations"""
|
||||
pass
|
||||
# Initialize context object with config
|
||||
if ctx.obj is None:
|
||||
ctx.obj = {}
|
||||
ctx.obj['config'] = get_config()
|
||||
ctx.obj['output_format'] = ctx.obj.get('output_format', 'table')
|
||||
|
||||
|
||||
@click.group()
|
||||
|
||||
@@ -117,6 +117,15 @@ def get_balance(ctx, wallet_name: Optional[str] = None):
|
||||
@click.pass_context
|
||||
def wallet(ctx, wallet_name: Optional[str], wallet_path: Optional[str], use_daemon: bool):
|
||||
"""Manage your AITBC wallets and transactions"""
|
||||
# Initialize context object with config
|
||||
if ctx.obj is None:
|
||||
ctx.obj = {}
|
||||
if 'config' not in ctx.obj:
|
||||
from aitbc_cli.config import get_config
|
||||
ctx.obj['config'] = get_config()
|
||||
if 'output_format' not in ctx.obj:
|
||||
ctx.obj['output_format'] = 'table'
|
||||
|
||||
# Ensure wallet object exists
|
||||
ctx.ensure_object(dict)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user