This tile was archived by the owner on Feb 4, 2026
Reason: Superseded by tessl-labs/intent-integrity-kit
tessl install tessl-labs/spec-kit@0.6.4Specification-driven development workflow skills for AI coding assistants
#!/usr/bin/env bash
# Initialize a spec-kit project with git
# Usage: init-project.sh [--json] [--commit-constitution]
set -e
JSON_MODE=false
COMMIT_CONSTITUTION=false
while [[ $# -gt 0 ]]; do
case "$1" in
--json)
JSON_MODE=true
shift
;;
--commit-constitution)
COMMIT_CONSTITUTION=true
shift
;;
--help|-h)
echo "Usage: $0 [--json] [--commit-constitution]"
echo ""
echo "Initialize a spec-kit project with git repository."
echo ""
echo "Options:"
echo " --json Output in JSON format"
echo " --commit-constitution Commit the constitution file after git init"
echo " --help, -h Show this help message"
exit 0
;;
*)
echo "Unknown option: $1" >&2
exit 1
;;
esac
done
# Use current working directory as project root
PROJECT_ROOT="$(pwd)"
# Check if .specify exists (validates this is a spec-kit project)
if [ ! -d "$PROJECT_ROOT/.specify" ]; then
if $JSON_MODE; then
printf '{"success":false,"error":"Not a spec-kit project: .specify directory not found","git_initialized":false}\n'
else
echo "Error: Not a spec-kit project. Directory .specify not found." >&2
fi
exit 1
fi
# Check if already a git repo
if [ -d "$PROJECT_ROOT/.git" ]; then
GIT_INITIALIZED=false
GIT_STATUS="already_initialized"
else
# Initialize git
git init "$PROJECT_ROOT" >/dev/null 2>&1
GIT_INITIALIZED=true
GIT_STATUS="initialized"
fi
# Commit constitution if requested and it exists
CONSTITUTION_COMMITTED=false
if [ "$COMMIT_CONSTITUTION" = true ] && [ -f "$PROJECT_ROOT/.specify/memory/constitution.md" ]; then
cd "$PROJECT_ROOT"
git add .specify/memory/constitution.md
# Also add README if it exists
if [ -f "$PROJECT_ROOT/README.md" ]; then
git add README.md
fi
# Check if there's anything to commit
if ! git diff --cached --quiet 2>/dev/null; then
git commit -m "Initialize spec-kit project with constitution" >/dev/null 2>&1
CONSTITUTION_COMMITTED=true
fi
fi
if $JSON_MODE; then
printf '{"success":true,"git_initialized":%s,"git_status":"%s","constitution_committed":%s,"project_root":"%s"}\n' \
"$GIT_INITIALIZED" "$GIT_STATUS" "$CONSTITUTION_COMMITTED" "$PROJECT_ROOT"
else
if [ "$GIT_INITIALIZED" = true ]; then
echo "[specify] Git repository initialized at $PROJECT_ROOT"
else
echo "[specify] Git repository already exists at $PROJECT_ROOT"
fi
if [ "$CONSTITUTION_COMMITTED" = true ]; then
echo "[specify] Constitution committed to git"
fi
fi