forked from japer-technology/github-claw
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.sh
More file actions
executable file
·79 lines (62 loc) · 3.34 KB
/
setup.sh
File metadata and controls
executable file
·79 lines (62 loc) · 3.34 KB
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#!/usr/bin/env bash
# ─────────────────────────────────────────────────────────────────────────────
# setup.sh — One-command installer for GitHub Minimum Intelligence
#
# Downloads the latest release of .github-minimum-intelligence into the
# current repository and runs the installer to set up workflows and templates.
#
# Usage (from the root of any git repo):
#
# curl -fsSL https://raw.githubusercontent.com/japer-technology/github-minimum-intelligence/main/setup.sh | bash
#
# Or download and run manually:
#
# wget https://raw.githubusercontent.com/japer-technology/github-minimum-intelligence/main/setup.sh
# bash setup.sh
# ─────────────────────────────────────────────────────────────────────────────
set -euo pipefail
REPO="japer-technology/github-minimum-intelligence"
BRANCH="main"
TARGET_DIR=".github-minimum-intelligence"
# ─── Preflight checks ─────────────────────────────────────────────────────────
if ! command -v git &>/dev/null; then
echo "❌ git is required but not installed." >&2
exit 1
fi
if ! git rev-parse --is-inside-work-tree &>/dev/null; then
echo "❌ Not inside a git repository. Run this from the root of your repo." >&2
exit 1
fi
if ! command -v bun &>/dev/null; then
echo "❌ Bun is required but not installed." >&2
echo " Install it: curl -fsSL https://bun.sh/install | bash" >&2
exit 1
fi
if [ -d "$TARGET_DIR" ]; then
echo "⚠️ $TARGET_DIR already exists. Remove it first if you want a fresh install." >&2
exit 1
fi
# ─── Download ──────────────────────────────────────────────────────────────────
echo ""
echo "GitHub Minimum Intelligence Setup"
echo ""
echo " Downloading from $REPO..."
TMPDIR=$(mktemp -d)
trap 'rm -rf "$TMPDIR"' EXIT
curl -fsSL "https://github.com/${REPO}/archive/refs/heads/${BRANCH}.zip" -o "$TMPDIR/repo.zip"
unzip -q "$TMPDIR/repo.zip" -d "$TMPDIR"
# The zip extracts to a directory named <repo>-<branch>/
EXTRACTED=$(ls -d "$TMPDIR"/github-minimum-intelligence-*)
# Copy the .github-minimum-intelligence directory
cp -R "$EXTRACTED/$TARGET_DIR" "$TARGET_DIR"
# Remove the state folder — it contains runtime state from the master repo
# and should not be carried over into a fresh installation.
rm -rf "$TARGET_DIR/state"
# Reset repo-specific files to their default templates so new installations
# do not inherit the source repo's agent identity or model configuration.
cp "$TARGET_DIR/install/MINIMUM-INTELLIGENCE-AGENTS.md" "$TARGET_DIR/AGENTS.md"
cp "$TARGET_DIR/install/settings.json" "$TARGET_DIR/.pi/settings.json"
echo " Copied $TARGET_DIR/"
# ─── Install ───────────────────────────────────────────────────────────────────
echo ""
bun "$TARGET_DIR/install/MINIMUM-INTELLIGENCE-INSTALLER.ts"