Files
life-project-example/scripts/create-project.sh
T
electron 8ae0eb239a feat: public example of life-project gates system
Public demo of Factory 4 Life project management:

- Gate definitions S0 (spec), S1 (build), S2
  (integration), S3 (production ready)
- Hardware project template with PlatformIO,
  KiCad CI, and Makefile for fab packages
- JSON schema for .kill-life.yaml manifest
- CLI scripts: create-project, validate-gates,
  dashboard with color-coded status output
- Example project: led-controller (S0+S1 passed,
  S2 in progress)
2026-04-07 15:39:30 +02:00

96 lines
2.3 KiB
Bash
Executable File

#!/usr/bin/env bash
set -euo pipefail
# Create a new Factory 4 Life project from template
# Usage: ./scripts/create-project.sh <project-name> <github-org> [--client <name>]
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
REPO_ROOT="$(dirname "$SCRIPT_DIR")"
TEMPLATE_DIR="${REPO_ROOT}/templates/hardware-project"
usage() {
cat <<'EOF'
Usage: create-project.sh <project-name> <github-org> [options]
Options:
--client <name> Client name for the project
--public Create as public repo (default: private)
--no-clone Don't clone locally after creation
-h, --help Show this help
Example:
./scripts/create-project.sh my-led-project electron-rare --client acme
EOF
}
PROJECT=""
ORG=""
CLIENT=""
VISIBILITY="--private"
CLONE=true
while [[ $# -gt 0 ]]; do
case "$1" in
--client) CLIENT="$2"; shift 2 ;;
--public) VISIBILITY="--public"; shift ;;
--no-clone) CLONE=false; shift ;;
-h|--help) usage; exit 0 ;;
*)
if [[ -z "$PROJECT" ]]; then PROJECT="$1"
elif [[ -z "$ORG" ]]; then ORG="$1"
else usage >&2; exit 2
fi
shift ;;
esac
done
[[ -n "$PROJECT" ]] || { echo "Error: project name required" >&2; usage >&2; exit 1; }
[[ -n "$ORG" ]] || { echo "Error: github org required" >&2; usage >&2; exit 1; }
echo "Creating project: ${ORG}/${PROJECT}"
# Create GitHub repo
gh repo create "${ORG}/${PROJECT}" ${VISIBILITY} \
--description "Factory 4 Life project — ${PROJECT}" \
--clone
cd "${PROJECT}"
# Copy template
cp -r "${TEMPLATE_DIR}/"* .
cp -r "${TEMPLATE_DIR}/".[!.]* . 2>/dev/null || true
# Generate .kill-life.yaml
cat > .kill-life.yaml <<YAML
kill_life:
version: 1
project: "${PROJECT}"
client: "${CLIENT:-tbd}"
gates:
s0: { status: in_progress }
s1: { status: pending }
s2: { status: pending }
s3: { status: pending }
agents:
- forge
- firmware-agent
- qa-agent
mcp_servers:
- kicad
hardware:
pcb_dir: hardware/pcb
bom_dir: hardware/bom
firmware:
framework: platformio
src_dir: firmware/src
YAML
# Initial commit
git add -A
git commit -m "feat: init ${PROJECT} from life-project template"
git push -u origin main
echo ""
echo "Project created: https://github.com/${ORG}/${PROJECT}"
echo "Next: edit .kill-life.yaml and start working on S0 specs"