Skip to content

Commit 9171b15

Browse files
authored
Merge pull request #2 from brickhouse-tech/fix/pure-bash-no-python
fix: remove python3 dependency, fix version on global install
2 parents 778628c + bd3f3a4 commit 9171b15

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

src/sh/sync-agents.sh

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,12 @@ PACKAGE_JSON="${SCRIPT_DIR}/../../package.json"
88
TEMPLATES_DIR="${SCRIPT_DIR}/../md"
99

1010
# Pull version from package.json
11+
# Try relative path first (works in repo / npm local install),
12+
# then resolve via node for global installs where the symlink target differs.
1113
if [[ -f "$PACKAGE_JSON" ]]; then
1214
VERSION="$(sed -n 's/.*"version": *"\([^"]*\)".*/\1/p' "$PACKAGE_JSON" | head -1)"
15+
elif command -v node >/dev/null 2>&1; then
16+
VERSION="$(node -p "require('@brickhouse-tech/sync-agents/package.json').version" 2>/dev/null || echo "unknown")"
1317
else
1418
VERSION="unknown"
1519
fi
@@ -246,8 +250,10 @@ cmd_sync() {
246250
# Sync subdirectories: rules, skills, workflows
247251
for subdir in rules skills workflows; do
248252
if [[ -d "$agents_abs/$subdir" ]]; then
249-
local source_rel
250-
source_rel="$(python3 -c "import os.path; print(os.path.relpath('$agents_abs/$subdir', '$(dirname "$target_dir/$subdir")'))" 2>/dev/null || echo "../$AGENTS_DIR/$subdir")"
253+
# Both .agents/ and .<target>/ live at PROJECT_ROOT, so the relative
254+
# path from .<target>/<subdir> back to .agents/<subdir> is always one
255+
# level up: ../.agents/<subdir>
256+
local source_rel="../$AGENTS_DIR/$subdir"
251257
create_symlink "$source_rel" "$target_dir/$subdir" "$DRY_RUN"
252258
fi
253259
done

0 commit comments

Comments
 (0)