@brickhouse-tech/sync-agents 0.1.0 → 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.
Files changed (2) hide show
  1. package/package.json +10 -7
  2. package/src/sh/sync-agents.sh +58 -50
package/package.json CHANGED
@@ -1,11 +1,14 @@
1
1
  {
2
2
  "name": "@brickhouse-tech/sync-agents",
3
- "version": "0.1.0",
4
- "description": "AWS CFT Utilities to fill the gaps for Cloud Formation",
3
+ "version": "0.1.3",
4
+ "description": "Simple scripts to DRY up common agent interactions across multiple LLM providers.",
5
5
  "keywords": [
6
- "cft",
7
- "aws",
8
- "cloudformation"
6
+ "agents",
7
+ "claude",
8
+ "sync",
9
+ "codex",
10
+ "gpt",
11
+ "windsurf"
9
12
  ],
10
13
  "homepage": "https://github.com/brickhouse-tech/sync-agents#readme",
11
14
  "bugs": {
@@ -23,14 +26,14 @@
23
26
  "src/**/*"
24
27
  ],
25
28
  "scripts": {
29
+ "lint": "shellcheck src/sh/*.sh",
26
30
  "test": "npx bats test/"
27
31
  },
28
- "dependencies": {
29
- },
30
32
  "devDependencies": {
31
33
  "@commitlint/cli": "^20",
32
34
  "@commitlint/config-conventional": "^20",
33
35
  "commitlint": "20",
36
+ "shellcheck": "^4.1.0",
34
37
  "sort-package-json": "3.6"
35
38
  }
36
39
  }
@@ -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
- 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"
251
257
  create_symlink "$source_rel" "$target_dir/$subdir" "$DRY_RUN"
252
258
  fi
253
259
  done
@@ -374,53 +380,55 @@ This file indexes all rules, skills, and workflows defined in `.agents/`.
374
380
 
375
381
  HEADER
376
382
 
377
- # Rules
378
- echo "## Rules" >> "$outfile"
379
- echo "" >> "$outfile"
380
- if compgen -G "$agents_dir/rules/*.md" > /dev/null 2>&1; then
381
- for f in "$agents_dir/rules/"*.md; do
382
- local name
383
- name="$(basename "$f" .md)"
384
- echo "- [$name](.agents/rules/$name.md)" >> "$outfile"
385
- done
386
- else
387
- echo "_No rules defined yet. Add one with \`sync-agents add rule <name>\`._" >> "$outfile"
388
- fi
389
- echo "" >> "$outfile"
390
-
391
- # Skills
392
- echo "## Skills" >> "$outfile"
393
- echo "" >> "$outfile"
394
- if compgen -G "$agents_dir/skills/*.md" > /dev/null 2>&1; then
395
- for f in "$agents_dir/skills/"*.md; do
396
- local name
397
- name="$(basename "$f" .md)"
398
- echo "- [$name](.agents/skills/$name.md)" >> "$outfile"
399
- done
400
- else
401
- echo "_No skills defined yet. Add one with \`sync-agents add skill <name>\`._" >> "$outfile"
402
- fi
403
- echo "" >> "$outfile"
404
-
405
- # Workflows
406
- echo "## Workflows" >> "$outfile"
407
- echo "" >> "$outfile"
408
- if compgen -G "$agents_dir/workflows/*.md" > /dev/null 2>&1; then
409
- for f in "$agents_dir/workflows/"*.md; do
410
- local name
411
- name="$(basename "$f" .md)"
412
- echo "- [$name](.agents/workflows/$name.md)" >> "$outfile"
413
- done
414
- else
415
- echo "_No workflows defined yet. Add one with \`sync-agents add workflow <name>\`._" >> "$outfile"
416
- fi
417
- echo "" >> "$outfile"
418
-
419
- # State reference
420
- echo "## State" >> "$outfile"
421
- echo "" >> "$outfile"
422
- echo "- [STATE.md](.agents/STATE.md)" >> "$outfile"
423
- echo "" >> "$outfile"
383
+ {
384
+ # Rules
385
+ echo "## Rules"
386
+ echo ""
387
+ if compgen -G "$agents_dir/rules/*.md" > /dev/null 2>&1; then
388
+ for f in "$agents_dir/rules/"*.md; do
389
+ local name
390
+ name="$(basename "$f" .md)"
391
+ echo "- [$name](.agents/rules/$name.md)"
392
+ done
393
+ else
394
+ echo "_No rules defined yet. Add one with \`sync-agents add rule <name>\`._"
395
+ fi
396
+ echo ""
397
+
398
+ # Skills
399
+ echo "## Skills"
400
+ echo ""
401
+ if compgen -G "$agents_dir/skills/*.md" > /dev/null 2>&1; then
402
+ for f in "$agents_dir/skills/"*.md; do
403
+ local name
404
+ name="$(basename "$f" .md)"
405
+ echo "- [$name](.agents/skills/$name.md)"
406
+ done
407
+ else
408
+ echo "_No skills defined yet. Add one with \`sync-agents add skill <name>\`._"
409
+ fi
410
+ echo ""
411
+
412
+ # Workflows
413
+ echo "## Workflows"
414
+ echo ""
415
+ if compgen -G "$agents_dir/workflows/*.md" > /dev/null 2>&1; then
416
+ for f in "$agents_dir/workflows/"*.md; do
417
+ local name
418
+ name="$(basename "$f" .md)"
419
+ echo "- [$name](.agents/workflows/$name.md)"
420
+ done
421
+ else
422
+ echo "_No workflows defined yet. Add one with \`sync-agents add workflow <name>\`._"
423
+ fi
424
+ echo ""
425
+
426
+ # State reference
427
+ echo "## State"
428
+ echo ""
429
+ echo "- [STATE.md](.agents/STATE.md)"
430
+ echo ""
431
+ } >> "$outfile"
424
432
  }
425
433
 
426
434
  # --------------------------------------------------------------------------
@@ -435,7 +443,7 @@ print_tree() {
435
443
  # Collect entries
436
444
  while IFS= read -r entry; do
437
445
  entries+=("$entry")
438
- done < <(ls -1A "$dir" 2>/dev/null | sort)
446
+ done < <(find "$dir" -maxdepth 1 -mindepth 1 -exec basename {} \; 2>/dev/null | sort)
439
447
 
440
448
  local count=${#entries[@]}
441
449
  if [[ $count -eq 0 ]]; then