File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -8,8 +8,12 @@ PACKAGE_JSON="${SCRIPT_DIR}/../../package.json"
88TEMPLATES_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.
1113if [[ -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" ) "
1317else
1418 VERSION=" unknown"
1519fi
@@ -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
You can’t perform that action at this time.
0 commit comments