planning-with-files 3.10.2 → 3.11.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,51 +1,51 @@
1
- # planning-with-files: set or display the active plan pointer (PowerShell).
2
- #
3
- # Usage:
4
- # .\set-active-plan.ps1 <plan_id> - pin .planning\.active_plan to plan_id
5
- # .\set-active-plan.ps1 - print the current active plan (if any)
6
-
7
- param(
8
- [string]$PlanId = ""
9
- )
10
-
11
- $PlanRoot = Join-Path (Get-Location) ".planning"
12
- $ActiveFile = Join-Path $PlanRoot ".active_plan"
13
-
14
- if ($PlanId -eq "") {
15
- if (Test-Path $ActiveFile) {
16
- $current = (Get-Content $ActiveFile -Raw -Encoding UTF8).Trim()
17
- $planDir = Join-Path $PlanRoot $current
18
- if ($current -ne "" -and (Test-Path $planDir)) {
19
- Write-Output "Active plan: $current"
20
- Write-Output "Path: $planDir"
21
- } elseif ($current -ne "") {
22
- Write-Output "Active plan pointer: $current (directory not found - stale pointer)"
23
- } else {
24
- Write-Output "No active plan set."
25
- }
26
- } else {
27
- Write-Output "No active plan set."
28
- }
29
- exit 0
30
- }
31
-
32
- $PlanDir = Join-Path $PlanRoot $PlanId
33
-
34
- if (-not (Test-Path $PlanDir)) {
35
- Write-Error "Error: plan directory not found: $PlanDir"
36
- Write-Error "Run: init-session.sh `"$PlanId`" to create it, or check .planning\ for available plans."
37
- exit 1
38
- }
39
-
40
- if (-not (Test-Path $PlanRoot)) {
41
- New-Item -ItemType Directory -Path $PlanRoot -Force | Out-Null
42
- }
43
-
44
- $utf8NoBom = New-Object System.Text.UTF8Encoding($false)
45
- [System.IO.File]::WriteAllText($ActiveFile, $PlanId, $utf8NoBom)
46
-
47
- Write-Output "Active plan set to: $PlanId"
48
- Write-Output "Path: $PlanDir"
49
- Write-Output ""
50
- Write-Output "To pin this terminal session only:"
51
- Write-Output "`$env:PLAN_ID = '$PlanId'"
1
+ # planning-with-files: set or display the active plan pointer (PowerShell).
2
+ #
3
+ # Usage:
4
+ # .\set-active-plan.ps1 <plan_id> - pin .planning\.active_plan to plan_id
5
+ # .\set-active-plan.ps1 - print the current active plan (if any)
6
+
7
+ param(
8
+ [string]$PlanId = ""
9
+ )
10
+
11
+ $PlanRoot = Join-Path (Get-Location) ".planning"
12
+ $ActiveFile = Join-Path $PlanRoot ".active_plan"
13
+
14
+ if ($PlanId -eq "") {
15
+ if (Test-Path $ActiveFile) {
16
+ $current = (Get-Content $ActiveFile -Raw -Encoding UTF8).Trim()
17
+ $planDir = Join-Path $PlanRoot $current
18
+ if ($current -ne "" -and (Test-Path $planDir)) {
19
+ Write-Output "Active plan: $current"
20
+ Write-Output "Path: $planDir"
21
+ } elseif ($current -ne "") {
22
+ Write-Output "Active plan pointer: $current (directory not found - stale pointer)"
23
+ } else {
24
+ Write-Output "No active plan set."
25
+ }
26
+ } else {
27
+ Write-Output "No active plan set."
28
+ }
29
+ exit 0
30
+ }
31
+
32
+ $PlanDir = Join-Path $PlanRoot $PlanId
33
+
34
+ if (-not (Test-Path $PlanDir)) {
35
+ Write-Error "Error: plan directory not found: $PlanDir"
36
+ Write-Error "Run: init-session.sh `"$PlanId`" to create it, or check .planning\ for available plans."
37
+ exit 1
38
+ }
39
+
40
+ if (-not (Test-Path $PlanRoot)) {
41
+ New-Item -ItemType Directory -Path $PlanRoot -Force | Out-Null
42
+ }
43
+
44
+ $utf8NoBom = New-Object System.Text.UTF8Encoding($false)
45
+ [System.IO.File]::WriteAllText($ActiveFile, $PlanId, $utf8NoBom)
46
+
47
+ Write-Output "Active plan set to: $PlanId"
48
+ Write-Output "Path: $PlanDir"
49
+ Write-Output ""
50
+ Write-Output "To pin this terminal session only:"
51
+ Write-Output "`$env:PLAN_ID = '$PlanId'"
@@ -1,50 +1,50 @@
1
- #!/bin/sh
2
- # 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_id
6
- # 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 by
9
- # resolve-plan-dir.sh when no $PLAN_ID env var is set.
10
-
11
- set -e
12
-
13
- PLAN_ROOT="${PWD}/.planning"
14
- ACTIVE_FILE="${PLAN_ROOT}/.active_plan"
15
-
16
- # No args → show current active plan
17
- if [ "${1:-}" = "" ]; then
18
- if [ -f "${ACTIVE_FILE}" ]; then
19
- plan_id="$(tr -d '\r\n' < "${ACTIVE_FILE}")"
20
- if [ -n "${plan_id}" ] && [ -d "${PLAN_ROOT}/${plan_id}" ]; then
21
- echo "Active plan: ${plan_id}"
22
- echo "Path: ${PLAN_ROOT}/${plan_id}"
23
- elif [ -n "${plan_id}" ]; then
24
- echo "Active plan pointer: ${plan_id} (directory not found — stale pointer)"
25
- else
26
- echo "No active plan set."
27
- fi
28
- else
29
- echo "No active plan set."
30
- fi
31
- exit 0
32
- fi
33
-
34
- PLAN_ID="$1"
35
- PLAN_DIR="${PLAN_ROOT}/${PLAN_ID}"
36
-
37
- if [ ! -d "${PLAN_DIR}" ]; then
38
- echo "Error: plan directory not found: ${PLAN_DIR}" >&2
39
- echo "Run: init-session.sh \"${PLAN_ID}\" to create it, or check .planning/ for available plans." >&2
40
- exit 1
41
- fi
42
-
43
- mkdir -p "${PLAN_ROOT}"
44
- printf "%s\n" "${PLAN_ID}" > "${ACTIVE_FILE}"
45
-
46
- echo "Active plan set to: ${PLAN_ID}"
47
- echo "Path: ${PLAN_DIR}"
48
- echo ""
49
- echo "To pin this terminal session only:"
50
- echo " export PLAN_ID=${PLAN_ID}"
1
+ #!/bin/sh
2
+ # 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_id
6
+ # 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 by
9
+ # resolve-plan-dir.sh when no $PLAN_ID env var is set.
10
+
11
+ set -e
12
+
13
+ PLAN_ROOT="${PWD}/.planning"
14
+ ACTIVE_FILE="${PLAN_ROOT}/.active_plan"
15
+
16
+ # No args → show current active plan
17
+ if [ "${1:-}" = "" ]; then
18
+ if [ -f "${ACTIVE_FILE}" ]; then
19
+ plan_id="$(tr -d '\r\n' < "${ACTIVE_FILE}")"
20
+ if [ -n "${plan_id}" ] && [ -d "${PLAN_ROOT}/${plan_id}" ]; then
21
+ echo "Active plan: ${plan_id}"
22
+ echo "Path: ${PLAN_ROOT}/${plan_id}"
23
+ elif [ -n "${plan_id}" ]; then
24
+ echo "Active plan pointer: ${plan_id} (directory not found — stale pointer)"
25
+ else
26
+ echo "No active plan set."
27
+ fi
28
+ else
29
+ echo "No active plan set."
30
+ fi
31
+ exit 0
32
+ fi
33
+
34
+ PLAN_ID="$1"
35
+ PLAN_DIR="${PLAN_ROOT}/${PLAN_ID}"
36
+
37
+ if [ ! -d "${PLAN_DIR}" ]; then
38
+ echo "Error: plan directory not found: ${PLAN_DIR}" >&2
39
+ echo "Run: init-session.sh \"${PLAN_ID}\" to create it, or check .planning/ for available plans." >&2
40
+ exit 1
41
+ fi
42
+
43
+ mkdir -p "${PLAN_ROOT}"
44
+ printf "%s\n" "${PLAN_ID}" > "${ACTIVE_FILE}"
45
+
46
+ echo "Active plan set to: ${PLAN_ID}"
47
+ echo "Path: ${PLAN_DIR}"
48
+ echo ""
49
+ echo "To pin this terminal session only:"
50
+ echo " export PLAN_ID=${PLAN_ID}"