Skip to content
Navigation Menu
Sign in
Appearance settings
Platform
AI CODE CREATION
GitHub Copilot
Write better code with AI
GitHub Copilot app
Direct agents from issue to merge
MCP Registry
Integrate external tools
DEVELOPER WORKFLOWS
Actions
Automate any workflow
Codespaces
Instant dev environments
Issues
Plan and track work
Code Review
Manage code changes
Code Quality
Enforce quality at merge
APPLICATION SECURITY
GitHub Advanced Security
Find and fix vulnerabilities
Code security
Secure your code as you build
Secret protection
Stop leaks before they start
EXPLORE
Why GitHub
Documentation
Blog
Changelog
Marketplace
View all features
Solutions
BY COMPANY SIZE
Enterprises
Small and medium teams
Startups
Nonprofits
BY USE CASE
App Modernization
DevSecOps
DevOps
CI/CD
View all use cases
BY INDUSTRY
Healthcare
Financial services
Manufacturing
Government
View all industries
View all solutions
Resources
EXPLORE BY TOPIC
AI
Software Development
DevOps
Security
View all topics
EXPLORE BY TYPE
Customer stories
Events & webinars
Ebooks & reports
Business insights
GitHub Skills
SUPPORT & SERVICES
Documentation
Customer support
Community forum
Trust center
Partners
View all resources
Open Source
COMMUNITY
GitHub Sponsors
Fund open source developers
PROGRAMS
Security Lab
Maintainer Community
GitHub Stars
Archive Program
REPOSITORIES
Topics
Trending
Collections
Enterprise
ENTERPRISE SOLUTIONS
Enterprise platform
AI-powered developer platform
AVAILABLE ADD-ONS
GitHub Advanced Security
Enterprise-grade security features
Copilot for Business
Enterprise-grade AI features
Premium Support
Enterprise-grade 24/7 support
Pricing
Search
/
Sign in
Sign up
Appearance settings
You signed in with another tab or window.
Reload
to refresh your session.
You signed out in another tab or window.
Reload
to refresh your session.
You switched accounts on another tab or window.
Reload
to refresh your session.
Dismiss alert
{{ message }}
Zzz210s
pi-codegraph
Repository navigation
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
More
items
Files
Expand file tree
master
Breadcrumbs
pi-codegraph
/
setup.sh
Copy path
Blame
More file actions
Blame
More file actions
Latest commit
History
History
History
31 lines (24 loc) · 1.45 KB
master
Breadcrumbs
pi-codegraph
/
setup.sh
Copy path
Top
File metadata and controls
Code
Blame
31 lines (24 loc) · 1.45 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/usr/bin/env bash
# pi-codegraph 一键部署:把扩展安装到 ~/.pi/agent/extensions/codegraph/ 并装依赖。
# 幂等:可重复运行。真源为本仓库;config-ai 的 setup.sh 也会在部署后调用本脚本。
# 用法:bash setup.sh [--test](--test 先跑单测,失败则中止部署)
set -euo pipefail
REPO_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
AGENT_DIR="${PI_AGENT_DIR:-$HOME/.pi/agent}"
log(){ printf '\033[1;34m[codegraph]\033[0m %s\n' "$*"; }
warn(){ printf '\033[1;33m[codegraph:warn]\033[0m %s\n' "$*" >&2; }
die(){ printf '\033[1;31m[codegraph:err]\033[0m %s\n' "$*" >&2; exit 1; }
command -v node >/dev/null || die "未找到 node(需 >= 24,原生 TS 类型剥离 + 测试)"
command -v npm >/dev/null || die "未找到 npm"
if [ "${1:-}" = "--test" ]; then
log "安装依赖并运行单测..."
(cd "$REPO_DIR/extensions/codegraph" && npm ci --silent 2>/dev/null || npm install --silent) || die "依赖安装失败"
(cd "$REPO_DIR/extensions/codegraph" && npm test --silent) || die "单测失败,中止部署"
fi
DEST="$AGENT_DIR/extensions/codegraph"
log "部署 codegraph -> $DEST"
rm -rf "$DEST"
cp -r "$REPO_DIR/extensions/codegraph" "$DEST"
log "安装原生依赖(tree-sitter / better-sqlite3)..."
(cd "$DEST" && npm install --omit=dev --silent) || die "依赖安装失败(检查 .npmrc legacy-peer-deps 与构建工具链)"
log "完成。新会话或 /reload 后生效;/reindex <仓库根> 建索引,/code doctor 体检。"
You can’t perform that action at this time.