Files
sbproandClaude Sonnet 5 27b0e2acaa feat(josh-sync): add rename command for safe target renames
Adds `josh-sync rename <target>` (PE-12): safely rename a sync target's
name, subfolder, and/or subrepo_url in one resumable operation, editing
.josh-sync.yml and migrating its state-branch files atomically instead of
orphaning them. Bumps josh-sync to v2.3.0.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TNXgcFWVgSh3wkQS55cCX6
2026-07-16 10:10:40 +01:00

43 lines
1.4 KiB
Makefile

.PHONY: lint test build clean
# Lint all shell scripts with shellcheck
lint:
@echo "Running shellcheck..."
shellcheck -x lib/*.sh bin/josh-sync
@echo "All checks passed."
# Run bats-core unit tests
test:
@echo "Running tests..."
bats tests/unit/
@echo "All tests passed."
# Bundle into a single self-contained script
build: dist/josh-sync
dist/josh-sync: bin/josh-sync lib/*.sh VERSION
@mkdir -p dist
@echo "Bundling josh-sync..."
@echo '#!/usr/bin/env bash' > dist/josh-sync
@echo "# josh-sync $$(cat VERSION) — bundled distribution" >> dist/josh-sync
@echo '# Generated by: make build' >> dist/josh-sync
@echo '' >> dist/josh-sync
@# Inline all library modules (strip shebangs and source directives)
@for f in lib/core.sh lib/config.sh lib/auth.sh lib/state.sh lib/sync.sh lib/adopt.sh lib/onboard.sh lib/rename.sh; do \
echo "# --- $$f ---" >> dist/josh-sync; \
grep -v '^#!/' "$$f" | grep -v '^# shellcheck source=' >> dist/josh-sync; \
echo '' >> dist/josh-sync; \
done
@# Append CLI (strip shebangs, source directives, and source commands)
@echo '# --- bin/josh-sync ---' >> dist/josh-sync
@grep -v '^#!/' bin/josh-sync \
| grep -v '^# shellcheck source=' \
| grep -v '^source "\$${JOSH_LIB_DIR}/' \
| sed '/^JOSH_LIB_DIR=/,/^source/d' \
>> dist/josh-sync
@chmod +x dist/josh-sync
@echo "Built: dist/josh-sync ($$(wc -l < dist/josh-sync) lines)"
clean:
rm -rf dist/