split: bootstrap community repository
This commit is contained in:
@@ -37,3 +37,14 @@ Usage:
|
||||
```bash
|
||||
./scripts/staging-note-block.sh rmcp.itexp.me abc1234 "codex + operator" partial
|
||||
```
|
||||
|
||||
## export-community.sh
|
||||
|
||||
Helper that replaces the working tree of the extracted `crank-community`
|
||||
repository with the tracked Community baseline from this monorepo.
|
||||
|
||||
Usage:
|
||||
|
||||
```bash
|
||||
./scripts/export-community.sh /path/to/crank-community-working-tree
|
||||
```
|
||||
|
||||
Executable
+35
@@ -0,0 +1,35 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
usage() {
|
||||
cat <<'EOF'
|
||||
Usage:
|
||||
./scripts/export-community.sh /path/to/crank-community-working-tree
|
||||
|
||||
The target directory must already be a git working tree for crank-community.
|
||||
EOF
|
||||
}
|
||||
|
||||
if [[ "${1:-}" == "-h" || "${1:-}" == "--help" ]]; then
|
||||
usage
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [[ $# -ne 1 ]]; then
|
||||
usage >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
repo_root="$(git rev-parse --show-toplevel)"
|
||||
target_dir="$(cd "$1" && pwd)"
|
||||
|
||||
if [[ ! -d "$target_dir/.git" ]]; then
|
||||
echo "target is not a git working tree: $target_dir" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
find "$target_dir" -mindepth 1 -maxdepth 1 ! -name .git -exec rm -rf {} +
|
||||
|
||||
git -C "$repo_root" ls-files -z -- . ':(exclude)templates/repositories/**' \
|
||||
| rsync -a --delete --from0 --files-from=- "$repo_root/" "$target_dir/"
|
||||
Reference in New Issue
Block a user