clawdinators/scripts/init-memory.sh
joshp123 52f5168cd2 Add shellcheck + shfmt linting for scripts
Add CI workflow to run shellcheck + shfmt, plus a scripts/lint-shell.sh helper.

Also apply shfmt formatting and fix initial shellcheck warnings.
2026-02-15 15:51:40 -08:00

24 lines
628 B
Bash
Executable File

#!/usr/bin/env bash
set -euo pipefail
root="${1:-/memory}"
owner="${2:-clawdinator}"
group="${3:-clawdinator}"
mkdir -p "$root/daily" "$root/discord"
index="$root/index.md"
if [ ! -f "$index" ]; then
cat > "$index" << 'EOM'
# Shared Memory Index
- Daily notes live in /memory/daily/YYYY-MM-DD.md
- Durable facts belong in /memory/project.md and /memory/architecture.md
- Discord lurk snapshots live in /memory/discord/YYYY-MM-DD.md
EOM
fi
# Ensure shared memory is writable by the service user across instances.
chown "$owner:$group" "$root" "$root/daily" "$root/discord"
chmod 2770 "$root" "$root/daily" "$root/discord"