thread-master/.grok/skills/spec-driven/scripts/init-run.sh

52 lines
1.0 KiB
Bash
Executable File
Raw Permalink Blame History

This file contains ambiguous Unicode characters

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
# Usage: init-run.sh <slug> "<one-line goal>"
set -euo pipefail
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../../../.." && pwd)"
SLUG="${1:-}"
GOAL="${2:-}"
if [[ -z "$SLUG" ]]; then
echo "usage: $0 <slug> \"<one-line goal>\"" >&2
exit 1
fi
DIR="$ROOT/docs/product/$SLUG"
mkdir -p "$DIR/tasks"
if [[ ! -f "$DIR/README.md" ]]; then
cat >"$DIR/README.md" <<EOF
# Product run: $SLUG
| Field | Value |
|-------|--------|
| Goal | ${GOAL:-TBD} |
| Phase | requirements |
| Status | draft |
| Updated | $(date -u +%Y-%m-%d) |
## Phase legend
\`requirements\` → \`spec\` → \`plan\` → \`tasks\` → \`ready-to-implement\`
## How to continue
\`\`\`text
/spec-driven $SLUG
/spec-driven $SLUG --status
\`\`\`
EOF
fi
if [[ ! -f "$DIR/tasks/INDEX.md" ]]; then
cat >"$DIR/tasks/INDEX.md" <<'EOF'
# Tasks INDEX
| ID | Title | Milestone | Status | Est. lines |
|----|-------|-----------|--------|------------|
| — | (尚未拆 taskplan 批准後填入) | | | |
EOF
fi
echo "Initialized $DIR"