chore: remove configuration files and enhance blockchain explorer with advanced search, analytics, and export features
- Delete .aitbc.yaml.example CLI configuration template - Delete .lycheeignore link checker exclusion rules - Delete .nvmrc Node.js version specification - Add advanced search panel with filters for address, amount range, transaction type, time range, and validator - Add analytics dashboard with transaction volume, active addresses, and block time metrics - Add Chart.js integration
This commit is contained in:
86
scripts/check-file-organization.sh
Normal file
86
scripts/check-file-organization.sh
Normal file
@@ -0,0 +1,86 @@
|
||||
#!/bin/bash
|
||||
# scripts/check-file-organization.sh
|
||||
|
||||
echo "🔍 Checking project file organization..."
|
||||
|
||||
# Colors for output
|
||||
RED='\033[0;31m'
|
||||
GREEN='\033[0;32m'
|
||||
YELLOW='\033[1;33m'
|
||||
BLUE='\033[0;34m'
|
||||
NC='\033[0m' # No Color
|
||||
|
||||
# Count issues
|
||||
ISSUES=0
|
||||
|
||||
# Function to report issue
|
||||
report_issue() {
|
||||
local file="$1"
|
||||
local issue="$2"
|
||||
local suggestion="$3"
|
||||
|
||||
echo -e "${RED}❌ ISSUE: $file${NC}"
|
||||
echo -e " ${YELLOW}Problem: $issue${NC}"
|
||||
echo -e " ${BLUE}Suggestion: $suggestion${NC}"
|
||||
echo ""
|
||||
((ISSUES++))
|
||||
}
|
||||
|
||||
# Check root directory for misplaced files
|
||||
echo "📁 Checking root directory..."
|
||||
cd "$(dirname "$0")/.."
|
||||
|
||||
# Test files
|
||||
for file in test_*.py test_*.sh run_mc_test.sh; do
|
||||
if [[ -f "$file" ]]; then
|
||||
report_issue "$file" "Test file at root level" "Move to dev/tests/"
|
||||
fi
|
||||
done
|
||||
|
||||
# Development scripts
|
||||
for file in patch_*.py fix_*.py simple_test.py; do
|
||||
if [[ -f "$file" ]]; then
|
||||
report_issue "$file" "Development script at root level" "Move to dev/scripts/"
|
||||
fi
|
||||
done
|
||||
|
||||
# Multi-chain files
|
||||
for file in MULTI_*.md; do
|
||||
if [[ -f "$file" ]]; then
|
||||
report_issue "$file" "Multi-chain file at root level" "Move to dev/multi-chain/"
|
||||
fi
|
||||
done
|
||||
|
||||
# Environment files
|
||||
for dir in node_modules .venv cli_env logs .pytest_cache .ruff_cache .vscode; do
|
||||
if [[ -d "$dir" ]]; then
|
||||
report_issue "$dir" "Environment directory at root level" "Move to dev/env/ or dev/cache/"
|
||||
fi
|
||||
done
|
||||
|
||||
# Configuration files
|
||||
for file in .aitbc.yaml .aitbc.yaml.example .env.production .nvmrc .lycheeignore; do
|
||||
if [[ -f "$file" ]]; then
|
||||
report_issue "$file" "Configuration file at root level" "Move to config/"
|
||||
fi
|
||||
done
|
||||
|
||||
# Check if essential files are missing
|
||||
echo "📋 Checking essential files..."
|
||||
ESSENTIAL_FILES=(".editorconfig" ".env.example" ".gitignore" "LICENSE" "README.md" "pyproject.toml" "poetry.lock" "pytest.ini" "run_all_tests.sh")
|
||||
|
||||
for file in "${ESSENTIAL_FILES[@]}"; do
|
||||
if [[ ! -f "$file" ]]; then
|
||||
echo -e "${YELLOW}⚠️ WARNING: Essential file '$file' is missing${NC}"
|
||||
fi
|
||||
done
|
||||
|
||||
# Summary
|
||||
if [[ $ISSUES -eq 0 ]]; then
|
||||
echo -e "${GREEN}✅ File organization is perfect! No issues found.${NC}"
|
||||
exit 0
|
||||
else
|
||||
echo -e "${RED}❌ Found $ISSUES organization issue(s)${NC}"
|
||||
echo -e "${BLUE}💡 Run './scripts/move-to-right-folder.sh --auto' to fix automatically${NC}"
|
||||
exit 1
|
||||
fi
|
||||
108
scripts/git-pre-commit-hook.sh
Normal file
108
scripts/git-pre-commit-hook.sh
Normal file
@@ -0,0 +1,108 @@
|
||||
#!/bin/bash
|
||||
# scripts/git-pre-commit-hook.sh
|
||||
|
||||
echo "🔍 Checking file locations before commit..."
|
||||
|
||||
# Change to project root
|
||||
cd "$(dirname "$0")/.."
|
||||
|
||||
# Files that should not be at root
|
||||
ROOT_FORBIDDEN_PATTERNS=(
|
||||
"test_*.py"
|
||||
"test_*.sh"
|
||||
"patch_*.py"
|
||||
"fix_*.py"
|
||||
"simple_test.py"
|
||||
"run_mc_test.sh"
|
||||
"MULTI_*.md"
|
||||
)
|
||||
|
||||
# Directories that should not be at root
|
||||
ROOT_FORBIDDEN_DIRS=(
|
||||
"node_modules"
|
||||
".pytest_cache"
|
||||
".ruff_cache"
|
||||
".venv"
|
||||
"cli_env"
|
||||
"logs"
|
||||
".vscode"
|
||||
)
|
||||
|
||||
# Check for forbidden files at root
|
||||
for pattern in "${ROOT_FORBIDDEN_PATTERNS[@]}"; do
|
||||
if ls $pattern 1> /dev/null 2>&1; then
|
||||
echo "❌ ERROR: Found files matching '$pattern' at root level"
|
||||
echo "📁 Suggested location:"
|
||||
|
||||
case $pattern in
|
||||
"test_*.py"|"test_*.sh"|"run_mc_test.sh")
|
||||
echo " → dev/tests/"
|
||||
;;
|
||||
"patch_*.py"|"fix_*.py"|"simple_test.py")
|
||||
echo " → dev/scripts/"
|
||||
;;
|
||||
"MULTI_*.md")
|
||||
echo " → dev/multi-chain/"
|
||||
;;
|
||||
esac
|
||||
|
||||
echo "💡 Run: ./scripts/move-to-right-folder.sh --auto"
|
||||
echo "💡 Or manually: mv $pattern <suggested-directory>/"
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
|
||||
# Check for forbidden directories at root
|
||||
for dir in "${ROOT_FORBIDDEN_DIRS[@]}"; do
|
||||
if [[ -d "$dir" ]]; then
|
||||
echo "❌ ERROR: Found directory '$dir' at root level"
|
||||
echo "📁 Suggested location:"
|
||||
|
||||
case $dir in
|
||||
"node_modules"|".venv"|"cli_env")
|
||||
echo " → dev/env/"
|
||||
;;
|
||||
".pytest_cache"|".ruff_cache"|"logs"|".vscode")
|
||||
echo " → dev/cache/"
|
||||
;;
|
||||
esac
|
||||
|
||||
echo "💡 Run: ./scripts/move-to-right-folder.sh --auto"
|
||||
echo "💡 Or manually: mv $dir <suggested-directory>/"
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
|
||||
# Check new files being committed
|
||||
NEW_FILES=$(git diff --cached --name-only --diff-filter=A)
|
||||
|
||||
for file in $NEW_FILES; do
|
||||
dirname=$(dirname "$file")
|
||||
|
||||
# Check if file is at root and shouldn't be
|
||||
if [[ "$dirname" == "." ]]; then
|
||||
filename=$(basename "$file")
|
||||
|
||||
case "$filename" in
|
||||
test_*.py|test_*.sh)
|
||||
echo "⚠️ WARNING: Test file '$filename' should be in dev/tests/"
|
||||
echo "💡 Consider: git reset HEAD $filename && mv $filename dev/tests/ && git add dev/tests/$filename"
|
||||
;;
|
||||
patch_*.py|fix_*.py)
|
||||
echo "⚠️ WARNING: Patch file '$filename' should be in dev/scripts/"
|
||||
echo "💡 Consider: git reset HEAD $filename && mv $filename dev/scripts/ && git add dev/scripts/$filename"
|
||||
;;
|
||||
MULTI_*.md)
|
||||
echo "⚠️ WARNING: Multi-chain file '$filename' should be in dev/multi-chain/"
|
||||
echo "💡 Consider: git reset HEAD $filename && mv $filename dev/multi-chain/ && git add dev/multi-chain/$filename"
|
||||
;;
|
||||
.aitbc.yaml|.aitbc.yaml.example|.env.production|.nvmrc|.lycheeignore)
|
||||
echo "⚠️ WARNING: Configuration file '$filename' should be in config/"
|
||||
echo "💡 Consider: git reset HEAD $filename && mv $filename config/ && git add config/$filename"
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
done
|
||||
|
||||
echo "✅ File location check passed"
|
||||
exit 0
|
||||
103
scripts/move-to-right-folder.sh
Normal file
103
scripts/move-to-right-folder.sh
Normal file
@@ -0,0 +1,103 @@
|
||||
#!/bin/bash
|
||||
# scripts/move-to-right-folder.sh
|
||||
|
||||
echo "🔄 Moving files to correct folders..."
|
||||
|
||||
# Colors
|
||||
GREEN='\033[0;32m'
|
||||
BLUE='\033[0;34m'
|
||||
YELLOW='\033[1;33m'
|
||||
NC='\033[0m'
|
||||
|
||||
# Auto mode
|
||||
AUTO_MODE=false
|
||||
if [[ "$1" == "--auto" ]]; then
|
||||
AUTO_MODE=true
|
||||
fi
|
||||
|
||||
# Change to project root
|
||||
cd "$(dirname "$0")/.."
|
||||
|
||||
# Function to move file with confirmation
|
||||
move_file() {
|
||||
local file="$1"
|
||||
local target_dir="$2"
|
||||
|
||||
if [[ -f "$file" ]]; then
|
||||
echo -e "${BLUE}📁 Moving '$file' to '$target_dir/'${NC}"
|
||||
|
||||
if [[ "$AUTO_MODE" == "true" ]]; then
|
||||
mkdir -p "$target_dir"
|
||||
mv "$file" "$target_dir/"
|
||||
echo -e "${GREEN}✅ Moved automatically${NC}"
|
||||
else
|
||||
read -p "Move this file? (y/N): " -n 1 -r
|
||||
echo
|
||||
if [[ $REPLY =~ ^[Yy]$ ]]; then
|
||||
mkdir -p "$target_dir"
|
||||
mv "$file" "$target_dir/"
|
||||
echo -e "${GREEN}✅ Moved${NC}"
|
||||
else
|
||||
echo -e "${YELLOW}⏭️ Skipped${NC}"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
# Function to move directory with confirmation
|
||||
move_dir() {
|
||||
local dir="$1"
|
||||
local target_dir="$2"
|
||||
|
||||
if [[ -d "$dir" ]]; then
|
||||
echo -e "${BLUE}📁 Moving directory '$dir' to '$target_dir/'${NC}"
|
||||
|
||||
if [[ "$AUTO_MODE" == "true" ]]; then
|
||||
mkdir -p "$target_dir"
|
||||
mv "$dir" "$target_dir/"
|
||||
echo -e "${GREEN}✅ Moved automatically${NC}"
|
||||
else
|
||||
read -p "Move this directory? (y/N): " -n 1 -r
|
||||
echo
|
||||
if [[ $REPLY =~ ^[Yy]$ ]]; then
|
||||
mkdir -p "$target_dir"
|
||||
mv "$dir" "$target_dir/"
|
||||
echo -e "${GREEN}✅ Moved${NC}"
|
||||
else
|
||||
echo -e "${YELLOW}⏭️ Skipped${NC}"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
# Move test files
|
||||
for file in test_*.py test_*.sh run_mc_test.sh; do
|
||||
move_file "$file" "dev/tests"
|
||||
done
|
||||
|
||||
# Move development scripts
|
||||
for file in patch_*.py fix_*.py simple_test.py; do
|
||||
move_file "$file" "dev/scripts"
|
||||
done
|
||||
|
||||
# Move multi-chain files
|
||||
for file in MULTI_*.md; do
|
||||
move_file "$file" "dev/multi-chain"
|
||||
done
|
||||
|
||||
# Move environment directories
|
||||
for dir in node_modules .venv cli_env; do
|
||||
move_dir "$dir" "dev/env"
|
||||
done
|
||||
|
||||
# Move cache directories
|
||||
for dir in .pytest_cache .ruff_cache logs .vscode; do
|
||||
move_dir "$dir" "dev/cache"
|
||||
done
|
||||
|
||||
# Move configuration files
|
||||
for file in .aitbc.yaml .aitbc.yaml.example .env.production .nvmrc .lycheeignore; do
|
||||
move_file "$file" "config"
|
||||
done
|
||||
|
||||
echo -e "${GREEN}🎉 File organization complete!${NC}"
|
||||
Reference in New Issue
Block a user