veritas-kanban/scripts/seed.sh
Brad Groux a2aa5053c6 feat: add seed data and first-run auto-seeding for clean public repo
- Remove tracked personal attachment screenshots from git
- Add tasks/attachments/ and tasks/archive-attachments/ to .gitignore
- Create 4 example tasks showcasing features (auth, bug, research, automation)
- Add seedIfEmpty() to TaskService for automatic first-run seeding
- Add pnpm seed script for manual seeding
- Update README quickstart with seed docs
- Fix version badge mismatch (1.1.0 → 1.0.0)
2026-01-29 15:45:38 -06:00

41 lines
1.3 KiB
Bash
Executable file
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/usr/bin/env bash
# seed.sh — Populate the board with example tasks for first-time users.
# Usage: pnpm seed (or: bash scripts/seed.sh)
#
# Copies example tasks into tasks/active/ so new users see a populated board.
# Safe to re-run — skips if active tasks already exist.
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
PROJECT_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
ACTIVE_DIR="$PROJECT_ROOT/tasks/active"
EXAMPLES_DIR="$PROJECT_ROOT/tasks/examples"
# Ensure directories exist
mkdir -p "$ACTIVE_DIR"
# Count existing active tasks (excluding .gitkeep)
EXISTING=$(find "$ACTIVE_DIR" -name "*.md" -type f 2>/dev/null | wc -l | tr -d ' ')
if [ "$EXISTING" -gt 0 ]; then
echo " Board already has $EXISTING active task(s). Skipping seed."
echo " To force: rm tasks/active/*.md && pnpm seed"
exit 0
fi
if [ ! -d "$EXAMPLES_DIR" ] || [ -z "$(ls "$EXAMPLES_DIR"/*.md 2>/dev/null)" ]; then
echo "⚠️ No example tasks found in tasks/examples/. Nothing to seed."
exit 1
fi
# Copy examples into active
COPIED=0
for f in "$EXAMPLES_DIR"/*.md; do
cp "$f" "$ACTIVE_DIR/"
COPIED=$((COPIED + 1))
done
echo "✅ Seeded $COPIED example task(s) into tasks/active/"
echo " Start the server with: pnpm dev"
echo " Clear them anytime: rm tasks/active/task_example_*.md"