Skip to content
Navigation Menu
Sign in
Products
Platform
GitHub
Repository hosting, code review, and collaboration
Copilot
AI coding agent for tasks, projects, and automated work
Build & Ship
Actions
CI/CD and automation
Code Quality
Quality analysis, fixes, and enforcement
Codespaces
Cloud development environments
Secure
Code Security
Vulnerability detection and remediation
Secret Protection
Secret scanning and leak prevention
All Features
Developers
Learn
Documentation
Training
Certifications
Build
Build with Copilot
Customize Copilot
Integrations
Explore
Trending repos
GitHub Sponsors
Developer articles
Changelog
Changelog
Your source for the latest features, improvements, and fixes across GitHub products, all in one place.
Businesses
By Stage
Enterprises
Team
Startups
Nonprofits
By Industry
Healthcare
Financial services
Manufacturing
Government
See all industries
Evaluate GitHub
Why GitHub
Customer Stories
Business insights
Trust Center
Add-ons
GitHub Advanced Security
Enterprise-grade code security
Copilot for business
Enterprise-grade AI features
Premium Support
Enterprise-grade 24/7 support
Resources
Learn & Connect
Documentation
Resource center
Blog
Events & webinars
Community Forum
Customer Stories
Integrations
Support
Customer support
Training
GitHub Status
Company
About
Partners
Changelog
GitHub Universe
GitHub Universe
The event for developers, by developers — talks, workshops, and what’s next for GitHub.
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.