RepoSense API:真正有效的仓库智能
发布: (2025年12月15日 GMT+8 16:00)
5 min read
原文: Dev.to
Source: Dev.to
概述
RepoSense 是一个 由开发者为开发者 构建的仓库智能 API。它在本地(无需注册或上传)分析项目中的实际代码库,并生成准确、专业的文档和营销文案。目标是让你花更多时间编写代码,少花时间撰写 README、着陆页以及其他宣传材料。
提供的数据服务
- 🔍 智能仓库分析 – 了解代码的结构和用途。
- 👥 智能受众检测 – 确定项目的目标用户。
- 📝 专业文档生成 – 创建精致的 README 和文档。
- 🚀 内容优化引擎 – 打磨着陆页文案和其他营销文本。
- 💡 实时项目情报 – 获取技术栈、项目类型、清晰度评分等洞察。
API 文档
基础 URL
https://x8ki-letl-twmt.n7.xano.io/api:YIi8boXJ
可用接口
| 接口 | 方法 | 用途 |
|---|---|---|
/init_analysis_session | POST | 初始化新的分析会话 |
/analyze_files | POST | 使用 AI 分析项目文件 |
/get_project_insights | GET | 获取分析结果 |
/generate_readme | POST | 生成专业的 README |
/gemini_generate | POST | 生成优化内容(Gemini) |
速率限制
- 通用:每分钟 50 次请求,每天 1 000 次请求(分析接口)。
- Gemini AI:每分钟 15 次请求,每天 1 500 次请求(免费层)。
- 不需要身份验证——该 API 对开发者工具公开。
使用指南
Windows(PowerShell)
# 1. Initialize Session
$initResponse = Invoke-RestMethod -Uri "https://x8ki-letl-twmt.n7.xano.io/api:YIi8boXJ/init_analysis_session" `
-Method POST -ContentType "application/json" `
-Body '{"project_path": ".", "project_name": "My Project"}'
$sessionToken = $initResponse.session_token
Write-Host "Session Token: $sessionToken"
# 2. Analyze Files (example with package.json)
$packageContent = Get-Content "package.json" -Raw -ErrorAction SilentlyContinue
if ($packageContent) {
$body = @{
session_token = $sessionToken
files = @(
@{
path = "package.json"
content = $packageContent
}
)
} | ConvertTo-Json -Depth 3
Invoke-RestMethod -Uri "https://x8ki-letl-twmt.n7.xano.io/api:YIi8boXJ/analyze_files" `
-Method POST -ContentType "application/json" -Body $body
}
# 3. Get Project Insights
$insights = Invoke-RestMethod -Uri "https://x8ki-letl-twmt.n7.xano.io/api:YIi8boXJ/get_project_insights?session_token=$sessionToken" `
-Method GET
$insights | ConvertTo-Json -Depth 3
# 4. Generate README
$readme = Invoke-RestMethod -Uri "https://x8ki-letl-twmt.n7.xano.io/api:YIi8boXJ/generate_readme" `
-Method POST -ContentType "application/json" `
-Body (@{session_token = $sessionToken; template_style = "professional"} | ConvertTo-Json)
Write-Host $readme.readme_content
# 5. Generate Optimized Content (Gemini)
$optimized = Invoke-RestMethod -Uri "https://x8ki-letl-twmt.n7.xano.io/api:YIi8boXJ/gemini_generate" `
-Method POST -ContentType "application/json" `
-Body (@{
content_type = "landing"
project_context = "My awesome project"
current_content = "Welcome to my project"
} | ConvertTo-Json)
Write-Host $optimized
Linux/macOS(Bash)
# 1. Initialize Session
SESSION_RESPONSE=$(curl -s -X POST "https://x8ki-letl-twmt.n7.xano.io/api:YIi8boXJ/init_analysis_session" \
-H "Content-Type: application/json" \
-d '{"project_path": ".", "project_name": "My Project"}')
SESSION_TOKEN=$(echo $SESSION_RESPONSE | grep -o '"session_token":"[^"]*' | cut -d'"' -f4)
echo "Session Token: $SESSION_TOKEN"
# 2. Analyze Files (example with package.json)
if [ -f "package.json" ]; then
PACKAGE_CONTENT=$(cat package.json | tr -d '\n' | sed 's/"/\\"/g')
curl -s -X POST "https://x8ki-letl-twmt.n7.xano.io/api:YIi8boXJ/analyze_files" \
-H "Content-Type: application/json" \
-d "{
\"session_token\": \"$SESSION_TOKEN\",
\"files\": [{
\"path\": \"package.json\",
\"content\": \"$PACKAGE_CONTENT\"
}]
}"
fi
# 3. Get Project Insights
curl -s -X GET "https://x8ki-letl-twmt.n7.xano.io/api:YIi8boXJ/get_project_insights?session_token=$SESSION_TOKEN" | jq '.'
# 4. Generate README
curl -s -X POST "https://x8ki-letl-twmt.n7.xano.io/api:YIi8boXJ/generate_readme" \
-H "Content-Type: application/json" \
-d "{\"session_token\": \"$SESSION_TOKEN\", \"template_style\": \"professional\"}" | jq -r '.readme_content'
# 5. Generate Optimized Content (Gemini)
curl -s -X POST "https://x8ki-letl-twmt.n7.xano.io/api:YIi8boXJ/gemini_generate" \
-H "Content-Type: application/json" \
-d '{"content_type": "landing", "project_context": "My awesome project", "current_content": "Welcome to my project"}'
完整工作流脚本
Windows PowerShell(完整脚本)
# RepoSense API Complete Workflow
Write-Host "🚀 Starting RepoSense API Analysis..." -ForegroundColor Green
# 1. Initialize Session
$projectName = Split-Path -Leaf (Get-Location)
$initResponse = Invoke-RestMethod -Uri "https://x8ki-letl-twmt.n7.xano.io/api:YIi8boXJ/init_analysis_session" `
-Method POST -ContentType "application/json" `
-Body (@{project_path = "."; project_name = $projectName} | ConvertTo-Json)
$sessionToken = $initResponse.session_token
Write-Host "✅ Session created: $sessionToken" -ForegroundColor Yellow
# 2. Analyze Files
$files = @()
if (Test-Path "package.json") {
$files += @{path = "package.json"; content = Get-Content "package.json" -Raw}
}
if (Test-Path "README.md") {
$files += @{path = "README.md"; content = Get-Content "README.md" -Raw}
}
if ($files.Count -gt 0) {
Write-Host "📁 Analyzing $($files.Count) files..." -ForegroundColor Blue
Invoke-RestMethod -Uri "https://x8ki-letl-twmt.n7.xano.io/api:YIi8boXJ/analyze_files" `
-Method POST -ContentType "application/json" `
-Body (@{session_token = $sessionToken; files = $files} | ConvertTo-Json -Depth 3)
}
# 3. Get Insights
Write-Host "💡 Getting project insights..." -ForegroundColor Blue
$insights = Invoke-RestMethod -Uri "https://x8ki-letl-twmt.n7.xano.io/api:YIi8boXJ/get_project_insights?session_token=$sessionToken" `
-Method GET
Write-Host "Project Type: $($insights.project_type)" -ForegroundColor Cyan
Write-Host "Tech Stack: $($insights.tech_stack -join ', ')" -ForegroundColor Cyan
Write-Host "Clarity Score: $($insights.clarity_score)/100" -ForegroundColor Cyan
# 4. Generate README
Write-Host "📝 Generating README..." -ForegroundColor Blue
$readme = Invoke-RestMethod -Uri "https://x8ki-letl-twmt.n7.xano.io/api:YIi8boXJ/generate_readme" `
-Method POST -ContentType "application/json" `
-Body (@{session_token = $sessionToken; template_style = "professional"} | ConvertTo-Json)
$readme.readme_content | Out-File -FilePath "README_generated.md" -Encoding UTF8
Write-Host "✅ README saved to README_generated.md" -ForegroundColor Green
Write-Host "🎉 Analysis complete!" -ForegroundColor Green