#!/usr/bin/env bash
# setup-claude-workspace.sh
#
# Creates a tidy, numbered folder structure for a new Claude project,
# with a short README in each folder, a starter CLAUDE.md, and a basic
# .gitignore. It only ever creates things; it never deletes or overwrites
# anything that already exists. Read it before you run it.
#
# Usage:
#   cd /path/to/your/project
#   bash setup-claude-workspace.sh
#
# Edit the FOLDERS list below to fit your own work before you run it.

set -euo pipefail

# --- Edit these folder names to suit your work -------------------------
FOLDERS=(
  "00 brand"
  "01 projects"
  "02 products"
  "03 web"
  "04 email"
  "05 applications"
  "06 correspondence"
  "07 print"
  "08 social"
  "09 strategy"
  "10 finance"
)
# -----------------------------------------------------------------------

new_folders=0
for folder in "${FOLDERS[@]}"; do
  if [ ! -d "$folder" ]; then
    mkdir -p "$folder"
    new_folders=$((new_folders + 1))
  fi
  readme="$folder/README.md"
  if [ ! -f "$readme" ]; then
    printf '# %s\n\nWhat belongs in this folder: [describe it in a line].\n' "$folder" > "$readme"
  fi
done

# Starter CLAUDE.md, only if one does not already exist.
if [ ! -f "CLAUDE.md" ]; then
  cat > "CLAUDE.md" <<'EOF'
# CLAUDE.md , project memory

## Who I am and what this project is
[One or two lines: your name or business, and what this project is for.]

## How I want you to work
[Direct, options only when there is a real choice, British English,
no hype. Anything about pace, length or format.]

## Hard rules and never-do
[The things that must always hold, and the things to never do. Be blunt.]

## Where my important files live
[Point to the source-of-truth files rather than pasting them here.]

## Current focus
[What we are working on right now. Update this as it changes.]
EOF
fi

# Basic .gitignore, only if one does not already exist.
if [ ! -f ".gitignore" ]; then
  cat > ".gitignore" <<'EOF'
.DS_Store
node_modules/
.env
*.log
EOF
fi

echo "Done."
echo "Folders ready: ${#FOLDERS[@]} (new this run: ${new_folders})."
echo "Next: open CLAUDE.md, fill in the blanks, then run 'claude' here."
