How wudilyy666/jisuansiwei works
Project type and purpose
• This is a full-stack web application (“GitHub项目可视化分析工具”) that lets users paste a GitHub repo URL and view interactive visualizations of its structure, dependencies, and code quality, aided by AI analysis.
File structure
• Top level:
• .env, .gitignore, LICENSE, README.md, requirements.txt
• src/backend/app.py
• src/frontend/{index.html, styles.css, app.js, d3-visualizations.js}
README for architectural insights
• Backend: Flask + PyGithub (GitHub API calls) + NetworkX (graph analysis) + 通义千问 AI service.
• No persistent database—analysis is performed on-the-fly.
• Environment variables (.env) hold GITHUB_TOKEN and DASHSCOPE_API_KEY.
Main components and interactions
a. User’s Browser (Client)
• Loads index.html and supporting JS/CSS from Flask’s static routes.
• Renders UI, captures GitHub URL input, and triggers analysis.
b. Frontend Logic
• app.js handles user events, calls backend REST endpoints.
c. Backend API Server (Flask)
• Endpoint “/analyze” accepts repo URL.
• Uses PyGithub to fetch repo metadata and file tree.
• Constructs dependency graphs with NetworkX.
• Sends data to 通义千问 API for AI-driven insights.
• Aggregates results into JSON and returns it to the frontend.
d. External Services
• GitHub API (external REST service)
• 通义千问 AI API (external ML service)
Architectural patterns and design principles
• RESTful API layer in Flask separating data and presentation.
• Modular backend: separate concerns (GitHub fetch, graph analysis, AI analysis).
• On-the-fly processing—no persistence layer.