@brickhouse-tech/sync-agents 0.1.2 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/sh/sync-agents.sh +8 -2
package/package.json
CHANGED
package/src/sh/sync-agents.sh
CHANGED
|
@@ -8,8 +8,12 @@ PACKAGE_JSON="${SCRIPT_DIR}/../../package.json"
|
|
|
8
8
|
TEMPLATES_DIR="${SCRIPT_DIR}/../md"
|
|
9
9
|
|
|
10
10
|
# 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.
|
|
11
13
|
if [[ -f "$PACKAGE_JSON" ]]; then
|
|
12
14
|
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")"
|
|
13
17
|
else
|
|
14
18
|
VERSION="unknown"
|
|
15
19
|
fi
|
|
@@ -246,8 +250,10 @@ cmd_sync() {
|
|
|
246
250
|
# Sync subdirectories: rules, skills, workflows
|
|
247
251
|
for subdir in rules skills workflows; do
|
|
248
252
|
if [[ -d "$agents_abs/$subdir" ]]; then
|
|
249
|
-
|
|
250
|
-
|
|
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"
|
|
251
257
|
create_symlink "$source_rel" "$target_dir/$subdir" "$DRY_RUN"
|
|
252
258
|
fi
|
|
253
259
|
done
|