-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsync.sh
More file actions
executable file
·82 lines (72 loc) · 2.24 KB
/
sync.sh
File metadata and controls
executable file
·82 lines (72 loc) · 2.24 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
80
81
82
#!/usr/bin/env bash
# sync.sh — Copy skills from this ecosystem repo to individual repos.
# Run manually before tagging a release.
#
# Usage:
# ./sync.sh [--dry-run]
#
# Assumes individual repos are checked out as siblings:
# ../ai-agent-tdd-skill/
# ../ai-agent-spec-skill/
set -euo pipefail
DRY_RUN=false
[[ "${1:-}" == "--dry-run" ]] && DRY_RUN=true
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
# Support both naming conventions for local checkouts
if [[ -d "${SCRIPT_DIR}/../ai-agent-tdd-skill" ]]; then
TDD_REPO="${SCRIPT_DIR}/../ai-agent-tdd-skill"
elif [[ -d "${SCRIPT_DIR}/../tdd-skill" ]]; then
TDD_REPO="${SCRIPT_DIR}/../tdd-skill"
else
TDD_REPO="${SCRIPT_DIR}/../ai-agent-tdd-skill"
fi
if [[ -d "${SCRIPT_DIR}/../ai-agent-spec-skill" ]]; then
SPEC_REPO="${SCRIPT_DIR}/../ai-agent-spec-skill"
elif [[ -d "${SCRIPT_DIR}/../spec-skill" ]]; then
SPEC_REPO="${SCRIPT_DIR}/../spec-skill"
else
SPEC_REPO="${SCRIPT_DIR}/../ai-agent-spec-skill"
fi
sync_file() {
local src="$1" dst="$2"
if [[ "$DRY_RUN" == true ]]; then
echo "[dry-run] $src -> $dst"
else
cp "$src" "$dst"
echo " copied: $src -> $dst"
fi
}
sync_dir() {
local src="$1" dst="$2"
if [[ "$DRY_RUN" == true ]]; then
echo "[dry-run] $src/ -> $dst/"
else
cp -r "$src"/* "$dst"/
echo " copied: $src/ -> $dst/"
fi
}
echo "=== Syncing TDD skill ==="
if [[ -d "$TDD_REPO" ]]; then
sync_file "$SCRIPT_DIR/skills/tdd/SKILL.md" "$TDD_REPO/SKILL.md"
sync_file "$SCRIPT_DIR/skills/tdd/PROJECT.md" "$TDD_REPO/PROJECT.md"
sync_dir "$SCRIPT_DIR/skills/tdd/references" "$TDD_REPO/references"
echo " Done. Review changes: cd $TDD_REPO && git diff"
else
echo " SKIP: $TDD_REPO not found"
fi
echo ""
echo "=== Syncing Spec skill ==="
if [[ -d "$SPEC_REPO" ]]; then
sync_file "$SCRIPT_DIR/skills/spec/SKILL.md" "$SPEC_REPO/SKILL.md"
sync_file "$SCRIPT_DIR/skills/spec/PROJECT.md" "$SPEC_REPO/PROJECT.md"
sync_dir "$SCRIPT_DIR/skills/spec/references" "$SPEC_REPO/references"
echo " Done. Review changes: cd $SPEC_REPO && git diff"
else
echo " SKIP: $SPEC_REPO not found"
fi
echo ""
if [[ "$DRY_RUN" == true ]]; then
echo "Dry run complete. No files were copied."
else
echo "Sync complete. Review diffs in each repo before committing."
fi