refactor: organize scripts/, remove stale root dirs, clean up structure

scripts/ reorganization:
- Sort 14 loose root scripts into subfolders:
  blockchain/ (genesis, proposer, mock chain, testnet BTC)
  dev/ (CLI wrapper, dev services, OpenAPI gen, systemd setup, domain proxy)
  ops/ (coordinator proxy, remote tunnel)
  gpu/ (miner workflow)
- Merge scripts/testing/ into scripts/test/ (eliminate duplicate folder)
- Create scripts/examples/ for usage demos and simulations

Root-level cleanup:
- Move home/ (12 simulation scripts) → scripts/examples/
- Move dev-utils/ (2 files) → scripts/dev/
- Move protocols/receipts/sample → tests/fixtures/
- Delete stale src/ (duplicate of apps/blockchain-node/src/)
- Remove empty home/, dev-utils/, protocols/ directories

Documentation updates:
- Update docs/6_architecture/8_codebase-structure.md tree and table
- Update root README.md tree to reflect new structure
This commit is contained in:
oib
2026-02-13 23:26:53 +01:00
parent 76078221cb
commit 3b4cc69179
47 changed files with 20 additions and 417 deletions

View File

@@ -10,17 +10,21 @@ aitbc/
├── assets/ # Shared frontend assets (CSS, JS, fonts)
├── cli/ # Command-line interface tools
├── contracts/ # Solidity smart contracts (standalone)
├── dev-utils/ # Developer utilities and path configs
├── docs/ # Markdown documentation
├── examples/ # Usage examples and demos
├── docs/ # Markdown documentation (10 numbered sections)
├── extensions/ # Browser extensions (Firefox wallet)
├── home/ # Local workflow scripts (client/miner simulation)
├── infra/ # Infrastructure configs (nginx, k8s, terraform, helm)
├── packages/ # Shared libraries and SDKs
├── plugins/ # Plugin integrations (Ollama)
├── protocols/ # Protocol specs and sample data
├── scripts/ # Operational and deployment scripts
├── src/ # Shared Python source (cross-site sync, RPC)
├── scripts/ # All scripts, organized by purpose
│ ├── blockchain/ # Genesis, proposer, mock chain, testnet
├── ci/ # CI/CD pipeline scripts
│ ├── deploy/ # Container and service deployment (gitignored)
│ ├── dev/ # Dev tools, local services, OpenAPI gen
│ ├── examples/ # Usage examples and simulation scripts
│ ├── gpu/ # GPU miner setup and management (gitignored)
│ ├── ops/ # Coordinator proxy, remote tunnel
│ ├── service/ # Service management (gitignored)
│ └── test/ # Integration and verification scripts
├── systemd/ # Systemd service unit files
├── tests/ # Pytest test suites (unit, integration, e2e, security, load)
├── website/ # Public-facing website and HTML documentation
@@ -257,12 +261,8 @@ website/
|-----------|---------|
| `cli/` | AITBC CLI package (12 command groups, 90+ subcommands, 141 unit + 24 integration tests, CI/CD, man page, plugins) |
| `plugins/ollama/` | Ollama LLM integration (client plugin, miner plugin, service layer) |
| `home/` | Local simulation scripts for client/miner workflows |
| `extensions/` | Firefox wallet extension source code |
| `contracts/` | Standalone Solidity contracts (ZKReceiptVerifier) |
| `protocols/` | Protocol sample data (signed receipts) |
| `src/` | Shared Python modules (cross-site sync, RPC router) |
| `systemd/` | Systemd unit files for all AITBC services |
| `dev-utils/` | Developer utilities (Python path config) |
| `docs/` | Markdown documentation (guides, reports, reference, tutorials, operator docs) |
| `docs/` | Markdown documentation (10 numbered sections, guides, reference, architecture) |
| `assets/` | Shared frontend assets (Tailwind CSS, FontAwesome, Lucide icons, Axios) |

View File

@@ -1,109 +0,0 @@
#!/usr/bin/env python3
"""
Example client using the remote AITBC coordinator
"""
import httpx
import json
from datetime import datetime
# Configuration - using the SSH tunnel to remote server
COORDINATOR_URL = "http://localhost:8001"
CLIENT_API_KEY = "${CLIENT_API_KEY}"
def create_job():
"""Create a job on the remote coordinator"""
job_data = {
"payload": {
"type": "inference",
"task": "text-generation",
"model": "llama-2-7b",
"parameters": {
"prompt": "Hello, AITBC!",
"max_tokens": 100
}
},
"ttl_seconds": 900
}
with httpx.Client() as client:
response = client.post(
f"{COORDINATOR_URL}/v1/jobs",
headers={
"Content-Type": "application/json",
"X-Api-Key": CLIENT_API_KEY
},
json=job_data
)
if response.status_code == 201:
job = response.json()
print(f"✅ Job created successfully!")
print(f" Job ID: {job['job_id']}")
print(f" State: {job['state']}")
print(f" Expires at: {job['expires_at']}")
return job['job_id']
else:
print(f"❌ Failed to create job: {response.status_code}")
print(f" Response: {response.text}")
return None
def check_job_status(job_id):
"""Check the status of a job"""
with httpx.Client() as client:
response = client.get(
f"{COORDINATOR_URL}/v1/jobs/{job_id}",
headers={"X-Api-Key": CLIENT_API_KEY}
)
if response.status_code == 200:
job = response.json()
print(f"\n📊 Job Status:")
print(f" Job ID: {job['job_id']}")
print(f" State: {job['state']}")
print(f" Assigned Miner: {job.get('assigned_miner_id', 'None')}")
print(f" Created: {job['requested_at']}")
return job
else:
print(f"❌ Failed to get job status: {response.status_code}")
return None
def list_blocks():
"""List blocks from the explorer"""
with httpx.Client() as client:
response = client.get(f"{COORDINATOR_URL}/v1/explorer/blocks")
if response.status_code == 200:
blocks = response.json()
print(f"\n📦 Recent Blocks ({len(blocks['items'])} total):")
for block in blocks['items'][:5]: # Show last 5 blocks
print(f" Height: {block['height']}")
print(f" Hash: {block['hash']}")
print(f" Time: {block['timestamp']}")
print(f" Transactions: {block['txCount']}")
print(f" Proposer: {block['proposer']}")
print()
else:
print(f"❌ Failed to list blocks: {response.status_code}")
def main():
print("🚀 AITBC Remote Client Example")
print(f" Connecting to: {COORDINATOR_URL}")
print()
# List current blocks
list_blocks()
# Create a new job
job_id = create_job()
if job_id:
# Check job status
check_job_status(job_id)
# List blocks again to see the new job
print("\n🔄 Updated block list:")
list_blocks()
if __name__ == "__main__":
main()