Files
othmanadi__planning-with-files/scripts/set-active-plan.sh
T
OthmanAdi 9bf31fc41e release: v2.36.0 (parallel plan isolation + Codex session isolation + Hermes docs)
Closes #146, #147, #148.

Parallel plan isolation (#148, @shawnli1874): init-session.sh slug mode
creates .planning/YYYY-MM-DD-<slug>/ for each task. set-active-plan.sh/.ps1
switch the active plan pointer. resolve-plan-dir.sh/.ps1 provide the
resolution chain ($PLAN_ID env, .active_plan file, newest plan dir, legacy
fallback). All four Codex hooks route through the resolver. resolve_latest_dir
now requires task_plan.md to be present, preventing system dirs like sessions/
from being selected as plan dirs. short_uuid() probes each Python candidate
before trusting command -v, fixing silent failure on Windows Store aliases.

Codex session isolation (#146, @githubYiheng): sessions attach to a plan by
creating .planning/sessions/<session_id>.attached. user-prompt-submit.sh,
pre_tool_use.py, stop.py, and post_tool_use.py all gate on session attachment
before injecting context or blocking. Legacy mode preserved when
.planning/sessions/ does not exist.

Hermes integration notes (#147, @09ashishkapoor): docs/hermes.md gains an
Integration Notes section covering current support level, what is not full
parity with hook-native platforms, recommended integration pattern, and a
tradeoffs table.

34 new tests across five files. Version bumped to 2.36.0 across 14 SKILL.md
variants, plugin.json, marketplace.json, and CITATION.cff.
2026-05-01 18:37:25 +02:00

51 lines
1.5 KiB
Bash
Executable File

#!/bin/sh
# planning-with-files: set or display the active plan pointer.
#
# Usage:
# set-active-plan.sh <plan_id> — pin .planning/.active_plan to plan_id
# set-active-plan.sh — print the current active plan (if any)
#
# The active plan is stored in .planning/.active_plan and is read by
# resolve-plan-dir.sh when no $PLAN_ID env var is set.
set -e
PLAN_ROOT="${PWD}/.planning"
ACTIVE_FILE="${PLAN_ROOT}/.active_plan"
# No args → show current active plan
if [ "${1:-}" = "" ]; then
if [ -f "${ACTIVE_FILE}" ]; then
plan_id="$(tr -d '\r\n' < "${ACTIVE_FILE}")"
if [ -n "${plan_id}" ] && [ -d "${PLAN_ROOT}/${plan_id}" ]; then
echo "Active plan: ${plan_id}"
echo "Path: ${PLAN_ROOT}/${plan_id}"
elif [ -n "${plan_id}" ]; then
echo "Active plan pointer: ${plan_id} (directory not found — stale pointer)"
else
echo "No active plan set."
fi
else
echo "No active plan set."
fi
exit 0
fi
PLAN_ID="$1"
PLAN_DIR="${PLAN_ROOT}/${PLAN_ID}"
if [ ! -d "${PLAN_DIR}" ]; then
echo "Error: plan directory not found: ${PLAN_DIR}" >&2
echo "Run: init-session.sh \"${PLAN_ID}\" to create it, or check .planning/ for available plans." >&2
exit 1
fi
mkdir -p "${PLAN_ROOT}"
printf "%s\n" "${PLAN_ID}" > "${ACTIVE_FILE}"
echo "Active plan set to: ${PLAN_ID}"
echo "Path: ${PLAN_DIR}"
echo ""
echo "To pin this terminal session only:"
echo " export PLAN_ID=${PLAN_ID}"