cc-libs/just/install.just

44 lines
1.3 KiB
Plaintext

# Install local development tooling.
install: install-git-hooks check-install npm-install generate-env
# Remove build caches (tsc / eslint) for the mcp-bridge tool.
clean:
npm run clean --prefix tools/mcp-bridge
# Remove generated local environment files (e.g. .env with tokens).
clean-env:
rm -f .env
# Recreate local generated files and development tooling.
reinstall: clean install
# Install Git hooks for this repository.
install-git-hooks:
@mkdir -p .git/hooks
@printf '%s\n' '#!/bin/sh' '' 'just check test' > .git/hooks/pre-commit
@chmod +x .git/hooks/pre-commit
@printf '%s\n' 'Installed .git/hooks/pre-commit'
@printf '%s\n' '#!/bin/sh' '' 'just ci' > .git/hooks/pre-push
@chmod +x .git/hooks/pre-push
@printf '%s\n' 'Installed .git/hooks/pre-push'
# Generate local secrets on first install.
generate-env:
#!/usr/bin/env bash
set -euo pipefail
if [ -f .env ]; then
exit 0
fi
password="$(openssl rand -hex 32)"
while IFS= read -r line || [ -n "$line" ]; do
case "$line" in
OPENCODE_SERVER_PASSWORD=*)
printf '%s\n' "OPENCODE_SERVER_PASSWORD=$password"
;;
*)
printf '%s\n' "$line"
;;
esac
done < .env.test > .env
printf '%s\n' 'Generated .env'