feat: expand CLI with blockchain, marketplace, analytics, and security subcommands
- Added blockchain subcommands: `init` for genesis initialization, `genesis` for block creation - Added marketplace subcommands: `buy`, `sell`, `orders` for trading operations - Expanded analytics subcommands: `blocks`, `report`, `metrics`, `export` with format options - Added agent subcommands: `message`, `messages` for agent communication - Added workflow subcommands: `schedule`, `monitor` for workflow management - Added resource
This commit is contained in:
@@ -48,7 +48,7 @@ basic_wallet_operations() {
|
||||
|
||||
print_status "Creating training wallet..."
|
||||
if ! check_wallet "$WALLET_NAME"; then
|
||||
if cli_cmd "create --name $WALLET_NAME --password $WALLET_PASSWORD"; then
|
||||
if cli_cmd "wallet create $WALLET_NAME $WALLET_PASSWORD"; then
|
||||
print_success "Wallet $WALLET_NAME created successfully"
|
||||
else
|
||||
print_warning "Wallet creation may have failed or wallet already exists"
|
||||
@@ -58,10 +58,10 @@ basic_wallet_operations() {
|
||||
fi
|
||||
|
||||
print_status "Listing all wallets..."
|
||||
cli_cmd_output "list" || print_warning "Wallet list command not available"
|
||||
cli_cmd_output "wallet list" || print_warning "Wallet list command not available"
|
||||
|
||||
print_status "Checking wallet balance..."
|
||||
cli_cmd "balance --name $WALLET_NAME" || print_warning "Balance check failed"
|
||||
cli_cmd "wallet balance $WALLET_NAME" || print_warning "Balance check failed"
|
||||
|
||||
update_progress "Basic Wallet Operations"
|
||||
}
|
||||
@@ -73,11 +73,11 @@ basic_transaction_operations() {
|
||||
|
||||
# Get wallet address for self-transfer test
|
||||
local wallet_address
|
||||
wallet_address=$(cli_cmd_output "balance --name $WALLET_NAME" | grep "Address:" | awk '{print $2}')
|
||||
wallet_address=$(cli_cmd_output "wallet balance $WALLET_NAME" | grep "Address:" | awk '{print $2}')
|
||||
|
||||
if [[ -n "$wallet_address" ]]; then
|
||||
print_status "Sending test transaction (self-transfer)..."
|
||||
if cli_cmd "send --from $WALLET_NAME --to $wallet_address --amount 0 --password $WALLET_PASSWORD"; then
|
||||
if cli_cmd "wallet send $WALLET_NAME $wallet_address 0 $WALLET_PASSWORD"; then
|
||||
print_success "Test transaction sent successfully"
|
||||
else
|
||||
print_warning "Transaction may have failed (insufficient balance or other issue)"
|
||||
@@ -87,7 +87,7 @@ basic_transaction_operations() {
|
||||
fi
|
||||
|
||||
print_status "Checking transaction history..."
|
||||
cli_cmd "transactions --name $WALLET_NAME --limit 5" || print_warning "Transaction history command failed"
|
||||
cli_cmd "wallet transactions $WALLET_NAME --limit 5" || print_warning "Transaction history command failed"
|
||||
|
||||
update_progress "Basic Transaction Operations"
|
||||
}
|
||||
@@ -113,13 +113,13 @@ node_specific_operations() {
|
||||
log_info "Testing node-specific operations"
|
||||
|
||||
print_status "Testing Genesis Node operations..."
|
||||
cli_cmd_node "$GENESIS_NODE" "balance --name $WALLET_NAME" || print_warning "Genesis node operations failed"
|
||||
cli_cmd_node "$GENESIS_NODE" "wallet balance $WALLET_NAME" || print_warning "Genesis node operations failed"
|
||||
|
||||
print_status "Testing Follower Node operations..."
|
||||
cli_cmd_node "$FOLLOWER_NODE" "balance --name $WALLET_NAME" || print_warning "Follower node operations failed"
|
||||
cli_cmd_node "$FOLLOWER_NODE" "wallet balance $WALLET_NAME" || print_warning "Follower node operations failed"
|
||||
|
||||
print_status "Comparing nodes..."
|
||||
compare_nodes "balance --name $WALLET_NAME" "wallet balance"
|
||||
compare_nodes "wallet balance $WALLET_NAME" "wallet balance"
|
||||
|
||||
update_progress "Node-Specific Operations"
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ advanced_wallet_management() {
|
||||
print_status "2.1 Advanced Wallet Management"
|
||||
|
||||
print_status "Creating backup wallet..."
|
||||
if $CLI_PATH create --name "$BACKUP_WALLET" --password "$WALLET_PASSWORD" 2>/dev/null; then
|
||||
if $CLI_PATH wallet create "$BACKUP_WALLET" "$WALLET_PASSWORD" 2>/dev/null; then
|
||||
print_success "Backup wallet $BACKUP_WALLET created"
|
||||
log "Backup wallet $BACKUP_WALLET created"
|
||||
else
|
||||
@@ -178,7 +178,7 @@ performance_validation() {
|
||||
|
||||
# Test command response times
|
||||
START_TIME=$(date +%s.%N)
|
||||
$CLI_PATH balance --name "$WALLET_NAME" > /dev/null
|
||||
$CLI_PATH wallet balance "$WALLET_NAME" > /dev/null
|
||||
END_TIME=$(date +%s.%N)
|
||||
RESPONSE_TIME=$(echo "$END_TIME - $START_TIME" | bc -l 2>/dev/null || echo "0.5")
|
||||
|
||||
@@ -187,7 +187,7 @@ performance_validation() {
|
||||
|
||||
# Test transaction speed
|
||||
START_TIME=$(date +%s.%N)
|
||||
$CLI_PATH transactions --name "$WALLET_NAME" --limit 1 > /dev/null
|
||||
$CLI_PATH wallet transactions "$WALLET_NAME" --limit 1 > /dev/null
|
||||
END_TIME=$(date +%s.%N)
|
||||
TX_TIME=$(echo "$END_TIME - $START_TIME" | bc -l 2>/dev/null || echo "0.3")
|
||||
|
||||
|
||||
@@ -56,7 +56,7 @@ check_prerequisites() {
|
||||
fi
|
||||
|
||||
# Check if training wallet exists
|
||||
if ! $CLI_PATH list | grep -q "$WALLET_NAME"; then
|
||||
if ! $CLI_PATH wallet list | grep -q "$WALLET_NAME"; then
|
||||
print_error "Training wallet $WALLET_NAME not found. Run Stage 1 first."
|
||||
exit 1
|
||||
fi
|
||||
@@ -77,8 +77,8 @@ check_prerequisites() {
|
||||
ai_job_submission() {
|
||||
print_status "3.1 AI Job Submission"
|
||||
|
||||
print_status "Submitting inference job..."
|
||||
JOB_ID=$($CLI_PATH ai --job --submit --type inference --prompt "$TEST_PROMPT" --payment $TEST_PAYMENT 2>/dev/null | grep -o 'job_[0-9]*' || echo "")
|
||||
print_status "Submitting AI job..."
|
||||
JOB_ID=$($CLI_PATH ai submit --wallet "$WALLET_NAME" --type inference --prompt "$TEST_PROMPT" --payment $TEST_PAYMENT 2>/dev/null | grep -o 'job_[a-zA-Z0-9_]*' | head -1 || echo "")
|
||||
|
||||
if [ -n "$JOB_ID" ]; then
|
||||
print_success "AI job submitted with ID: $JOB_ID"
|
||||
@@ -89,22 +89,22 @@ ai_job_submission() {
|
||||
fi
|
||||
|
||||
print_status "Checking job status..."
|
||||
$CLI_PATH ai --job --status --id "$JOB_ID" 2>/dev/null || print_warning "Job status command not available"
|
||||
$CLI_PATH ai status --job-id "$JOB_ID" 2>/dev/null || print_warning "Job status command not available"
|
||||
log "Job status checked for $JOB_ID"
|
||||
|
||||
print_status "Monitoring job processing..."
|
||||
for i in {1..5}; do
|
||||
print_status "Check $i/5 - Job status..."
|
||||
$CLI_PATH ai --job --status --id "$JOB_ID" 2>/dev/null || print_warning "Job status check failed"
|
||||
$CLI_PATH ai status --job-id "$JOB_ID" 2>/dev/null || print_warning "Job status check failed"
|
||||
sleep 2
|
||||
done
|
||||
|
||||
print_status "Getting job results..."
|
||||
$CLI_PATH ai --job --result --id "$JOB_ID" 2>/dev/null || print_warning "Job result command not available"
|
||||
$CLI_PATH ai results --job-id "$JOB_ID" 2>/dev/null || print_warning "Job result command not available"
|
||||
log "Job results retrieved for $JOB_ID"
|
||||
|
||||
print_status "Listing all jobs..."
|
||||
$CLI_PATH ai --job --list --status all 2>/dev/null || print_warning "Job list command not available"
|
||||
$CLI_PATH ai list --status all 2>/dev/null || print_warning "Job list command not available"
|
||||
log "All jobs listed"
|
||||
|
||||
print_success "3.1 AI Job Submission completed"
|
||||
|
||||
@@ -55,7 +55,7 @@ check_prerequisites() {
|
||||
fi
|
||||
|
||||
# Check if training wallet exists
|
||||
if ! $CLI_PATH list | grep -q "$WALLET_NAME"; then
|
||||
if ! $CLI_PATH wallet list | grep -q "$WALLET_NAME"; then
|
||||
print_error "Training wallet $WALLET_NAME not found. Run Stage 1 first."
|
||||
exit 1
|
||||
fi
|
||||
@@ -72,7 +72,7 @@ marketplace_operations() {
|
||||
print_status "4.1 Marketplace Operations"
|
||||
|
||||
print_status "Listing marketplace items..."
|
||||
$CLI_PATH marketplace --list 2>/dev/null || print_warning "Marketplace list command not available"
|
||||
$CLI_PATH market list 2>/dev/null || print_warning "Marketplace list command not available"
|
||||
log "Marketplace items listed"
|
||||
|
||||
print_status "Checking marketplace status..."
|
||||
@@ -224,7 +224,7 @@ economic_performance_testing() {
|
||||
|
||||
# Test marketplace operations speed
|
||||
START_TIME=$(date +%s.%N)
|
||||
$CLI_PATH marketplace --list > /dev/null 2>&1
|
||||
$CLI_PATH market list > /dev/null 2>&1
|
||||
END_TIME=$(date +%s.%N)
|
||||
MARKETPLACE_TIME=$(echo "$END_TIME - $START_TIME" | bc -l 2>/dev/null || echo "1.5")
|
||||
|
||||
|
||||
@@ -55,7 +55,7 @@ check_prerequisites() {
|
||||
fi
|
||||
|
||||
# Check if training wallet exists
|
||||
if ! $CLI_PATH list | grep -q "$WALLET_NAME"; then
|
||||
if ! $CLI_PATH wallet list | grep -q "$WALLET_NAME"; then
|
||||
print_error "Training wallet $WALLET_NAME not found. Run Stage 1 first."
|
||||
exit 1
|
||||
fi
|
||||
@@ -76,7 +76,7 @@ advanced_automation() {
|
||||
log "AI job pipeline workflow creation attempted"
|
||||
|
||||
print_status "Setting up automated job submission schedule..."
|
||||
$CLI_PATH automate --schedule --cron "0 */6 * * *" --command "$CLI_PATH ai --job --submit --type inference" 2>/dev/null || print_warning "Schedule command not available"
|
||||
$CLI_PATH automate --schedule --cron "0 */6 * * *" --command "$CLI_PATH ai submit --prompt inference" 2>/dev/null || print_warning "Schedule command not available"
|
||||
log "Automated job submission schedule attempted"
|
||||
|
||||
print_status "Creating marketplace monitoring bot..."
|
||||
@@ -207,13 +207,13 @@ def automated_job_submission():
|
||||
logger.info("Starting automated job submission...")
|
||||
|
||||
# Submit inference job
|
||||
success, output, error = run_command("/opt/aitbc/aitbc-cli ai --job --submit --type inference --prompt 'Automated analysis'")
|
||||
success, output, error = run_command("/opt/aitbc/aitbc-cli ai submit --prompt 'Automated analysis'")
|
||||
|
||||
if success:
|
||||
logger.info(f"Job submitted successfully: {output}")
|
||||
# Monitor job completion
|
||||
time.sleep(5)
|
||||
success, output, error = run_command("/opt/aitbc/aitbc-cli ai --job --list --status completed")
|
||||
success, output, error = run_command("/opt/aitbc/aitbc-cli ai list --status completed")
|
||||
logger.info(f"Job monitoring result: {output}")
|
||||
else:
|
||||
logger.error(f"Job submission failed: {error}")
|
||||
@@ -282,10 +282,10 @@ expert_performance_analysis() {
|
||||
START_TIME=$(date +%s.%N)
|
||||
|
||||
# Test multiple operations concurrently
|
||||
$CLI_PATH balance --name "$WALLET_NAME" > /dev/null 2>&1 &
|
||||
$CLI_PATH blockchain --info > /dev/null 2>&1 &
|
||||
$CLI_PATH marketplace --list > /dev/null 2>&1 &
|
||||
$CLI_PATH ai --service --status --name coordinator > /dev/null 2>&1 &
|
||||
$CLI_PATH wallet balance "$WALLET_NAME" > /dev/null 2>&1 &
|
||||
$CLI_PATH blockchain info > /dev/null 2>&1 &
|
||||
$CLI_PATH market list > /dev/null 2>&1 &
|
||||
$CLI_PATH ai status --name coordinator > /dev/null 2>&1 &
|
||||
|
||||
wait # Wait for all background jobs
|
||||
|
||||
@@ -296,7 +296,7 @@ expert_performance_analysis() {
|
||||
log "Performance analysis: Concurrent operations ${CONCURRENT_TIME}s"
|
||||
|
||||
# Test individual operation performance
|
||||
OPERATIONS=("balance --name $WALLET_NAME" "blockchain --info" "marketplace --list" "ai --service --status")
|
||||
OPERATIONS=("wallet balance $WALLET_NAME" "blockchain info" "market list" "ai status")
|
||||
|
||||
for op in "${OPERATIONS[@]}"; do
|
||||
START_TIME=$(date +%s.%N)
|
||||
@@ -330,7 +330,7 @@ final_certification_exam() {
|
||||
fi
|
||||
|
||||
# Test 2: Wallet operations
|
||||
if $CLI_PATH balance --name "$WALLET_NAME" > /dev/null 2>&1; then
|
||||
if $CLI_PATH wallet balance "$WALLET_NAME" > /dev/null 2>&1; then
|
||||
((TESTS_PASSED++))
|
||||
log "Certification test 2 (Wallet balance): PASSED"
|
||||
else
|
||||
@@ -338,7 +338,7 @@ final_certification_exam() {
|
||||
fi
|
||||
|
||||
# Test 3: Blockchain operations
|
||||
if $CLI_PATH blockchain --info > /dev/null 2>&1; then
|
||||
if $CLI_PATH blockchain info > /dev/null 2>&1; then
|
||||
((TESTS_PASSED++))
|
||||
log "Certification test 3 (Blockchain info): PASSED"
|
||||
else
|
||||
@@ -346,15 +346,15 @@ final_certification_exam() {
|
||||
fi
|
||||
|
||||
# Test 4: AI operations
|
||||
if $CLI_PATH ai --service --status --name coordinator > /dev/null 2>&1; then
|
||||
if $CLI_PATH ai status > /dev/null 2>&1; then
|
||||
((TESTS_PASSED++))
|
||||
log "Certification test 4 (AI service status): PASSED"
|
||||
log "Certification test 4 (AI status): PASSED"
|
||||
else
|
||||
log "Certification test 4 (AI service status): FAILED"
|
||||
log "Certification test 4 (AI status): FAILED"
|
||||
fi
|
||||
|
||||
# Test 5: Marketplace operations
|
||||
if $CLI_PATH marketplace --list > /dev/null 2>&1; then
|
||||
if $CLI_PATH market list > /dev/null 2>&1; then
|
||||
((TESTS_PASSED++))
|
||||
log "Certification test 5 (Marketplace list): PASSED"
|
||||
else
|
||||
|
||||
@@ -155,7 +155,7 @@ check_cli() {
|
||||
check_wallet() {
|
||||
local wallet_name=${1:-$WALLET_NAME}
|
||||
|
||||
if $CLI_PATH list 2>/dev/null | grep -q "$wallet_name"; then
|
||||
if $CLI_PATH wallet list 2>/dev/null | grep -q "$wallet_name"; then
|
||||
return 0
|
||||
else
|
||||
return 1
|
||||
|
||||
Reference in New Issue
Block a user