Loading source
Pulling the file list, source metadata, and syntax-aware rendering for this listing.
Source from repo
Structured planning workflow that uses files to track tasks, decisions, and project progress.
Files
Skill
Size
Entrypoint
Format
Open file
Syntax-highlighted preview of this file as included in the skill package.
scripts/set-active-plan.sh
1#!/bin/sh2# planning-with-files: set or display the active plan pointer.3#4# Usage:5# set-active-plan.sh <plan_id> — pin .planning/.active_plan to plan_id6# set-active-plan.sh — print the current active plan (if any)7#8# The active plan is stored in .planning/.active_plan and is read by9# resolve-plan-dir.sh when no $PLAN_ID env var is set.1011set -e1213PLAN_ROOT="${PWD}/.planning"14ACTIVE_FILE="${PLAN_ROOT}/.active_plan"1516# No args → show current active plan17if [ "${1:-}" = "" ]; then18if [ -f "${ACTIVE_FILE}" ]; then19plan_id="$(tr -d '\r\n' < "${ACTIVE_FILE}")"20if [ -n "${plan_id}" ] && [ -d "${PLAN_ROOT}/${plan_id}" ]; then21echo "Active plan: ${plan_id}"22echo "Path: ${PLAN_ROOT}/${plan_id}"23elif [ -n "${plan_id}" ]; then24echo "Active plan pointer: ${plan_id} (directory not found — stale pointer)"25else26echo "No active plan set."27fi28else29echo "No active plan set."30fi31exit 032fi3334PLAN_ID="$1"35PLAN_DIR="${PLAN_ROOT}/${PLAN_ID}"3637if [ ! -d "${PLAN_DIR}" ]; then38echo "Error: plan directory not found: ${PLAN_DIR}" >&239echo "Run: init-session.sh \"${PLAN_ID}\" to create it, or check .planning/ for available plans." >&240exit 141fi4243mkdir -p "${PLAN_ROOT}"44printf "%s\n" "${PLAN_ID}" > "${ACTIVE_FILE}"4546echo "Active plan set to: ${PLAN_ID}"47echo "Path: ${PLAN_DIR}"48echo ""49echo "To pin this terminal session only:"50echo " export PLAN_ID=${PLAN_ID}"51