-
Notifications
You must be signed in to change notification settings - Fork 473
Expand file tree
/
Copy pathbootstrap.sh
More file actions
executable file
·77 lines (66 loc) · 2.19 KB
/
bootstrap.sh
File metadata and controls
executable file
·77 lines (66 loc) · 2.19 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
#!/usr/bin/env bash
# bootstrap.sh — copy a memory-wiki template to a target dir and fill basics.
#
# Usage:
# ./bootstrap.sh ~/memory-wiki # solo-founder (default)
# ./bootstrap.sh ~/memory-wiki --engineer # engineer variant
#
# After running, edit the files by hand. This script only fills the obvious
# blanks (name, handle, main project). Everything else is your job.
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
if [[ $# -lt 1 ]]; then
echo "usage: $0 <target-dir> [--engineer]" >&2
exit 1
fi
TARGET="$1"
VARIANT="solo-founder-wiki"
if [[ "${2:-}" == "--engineer" ]]; then
VARIANT="engineer-wiki"
fi
SRC="$SCRIPT_DIR/templates/$VARIANT"
if [[ ! -d "$SRC" ]]; then
echo "error: template not found at $SRC" >&2
exit 1
fi
if [[ -e "$TARGET" ]]; then
echo "error: $TARGET already exists. Refusing to overwrite." >&2
exit 1
fi
echo "Copying $VARIANT template to $TARGET ..."
mkdir -p "$TARGET"
cp -R "$SRC"/* "$TARGET"/
echo ""
echo "A few quick questions. Press Enter to skip any."
read -r -p " Your name: " NAME
read -r -p " Your handle: " HANDLE
read -r -p " Main project name: " MAIN_PROJECT
# Portable sed -i (works on macOS and Linux)
sed_inplace() {
if sed --version >/dev/null 2>&1; then
sed -i "$@"
else
sed -i '' "$@"
fi
}
for f in "$TARGET"/*.md; do
[[ -n "${NAME:-}" ]] && sed_inplace "s|{{NAME}}|${NAME}|g" "$f"
[[ -n "${HANDLE:-}" ]] && sed_inplace "s|{{HANDLE}}|${HANDLE}|g" "$f"
[[ -n "${MAIN_PROJECT:-}" ]] && sed_inplace "s|{{MAIN_PROJECT}}|${MAIN_PROJECT}|g" "$f"
done
echo ""
echo "Done. Wiki created at $TARGET"
echo ""
echo "Next steps:"
echo " 1. Open $TARGET and edit anything that's still a placeholder."
echo " 2. Reference it from your OpenClaw agent's SOUL.md:"
echo ""
echo " ## Memory Wiki"
echo " At session start, read $TARGET/PROFILE.md, STACK.md,"
echo " PROJECTS.md, DECISIONS.md, PEOPLE.md, WORKING.md in that order."
echo " Only WORKING.md is writable."
echo ""
echo " 3. Optionally copy it into your agent dir:"
echo " cp -r $TARGET ~/.openclaw/agents/<agent-name>/memory-wiki"
echo ""
echo " 4. Review weekly. Rebuild quarterly."