Skip to content

Commit 5346099

Browse files
sakitACopilot
andcommitted
fix: address active PR review comments
- plan.md: clarify JSON parsing instructions (extract first { line) - common.sh: validate max_depth is a positive integer - common.ps1: add ValidateRange(1, MaxValue) on -MaxDepth - setup-plan.ps1: add ValidateRange(0, MaxValue) on -ScanDepth Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 5b2d0b2 commit 5346099

File tree

4 files changed

+7
-1
lines changed

4 files changed

+7
-1
lines changed

scripts/bash/common.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -290,6 +290,10 @@ check_dir() { [[ -d "$1" && -n $(ls -A "$1" 2>/dev/null) ]] && echo " ✓ $2" |
290290
find_nested_git_repos() {
291291
local repo_root="${1:-$(get_repo_root)}"
292292
local max_depth="${2:-2}"
293+
if ! [[ "$max_depth" =~ ^[0-9]+$ ]] || [ "$max_depth" -eq 0 ]; then
294+
echo "find_nested_git_repos: max_depth must be a positive integer" >&2
295+
return 1
296+
fi
293297

294298
# Collect explicit paths from 3rd argument onward
295299
local -a explicit_paths=()

scripts/powershell/common.ps1

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,7 @@ function Test-DirHasFiles {
237237
function Find-NestedGitRepos {
238238
param(
239239
[string]$RepoRoot = (Get-RepoRoot),
240+
[ValidateRange(1, [int]::MaxValue)]
240241
[int]$MaxDepth = 2,
241242
[string[]]$ExplicitPaths = @()
242243
)

scripts/powershell/setup-plan.ps1

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
[CmdletBinding()]
55
param(
66
[switch]$Json,
7+
[ValidateRange(0, [int]::MaxValue)]
78
[int]$ScanDepth = 0,
89
[switch]$Help
910
)

templates/commands/plan.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ You **MUST** consider the user input before proceeding (if not empty).
6060
6161
## Outline
6262
63-
1. **Setup**: Run `{SCRIPT}` from repo root and parse JSON for FEATURE_SPEC, IMPL_PLAN, SPECS_DIR, BRANCH, and NESTED_REPOS. For single quotes in args like "I'm Groot", use escape syntax: e.g 'I'\''m Groot' (or double-quote if possible: "I'm Groot").
63+
1. **Setup**: Run `{SCRIPT}` from repo root and capture its stdout. The script may print informational lines (e.g., "Copied plan template…") before the JSON payload, so extract the first line starting with `{` and parse that JSON object to obtain FEATURE_SPEC, IMPL_PLAN, SPECS_DIR, BRANCH, and NESTED_REPOS. For single quotes in args like "I'm Groot", use escape syntax: e.g 'I'\''m Groot' (or double-quote if possible: "I'm Groot").
6464
6565
2. **Load context**: Read FEATURE_SPEC and `/memory/constitution.md`. Load IMPL_PLAN template (already copied).
6666

0 commit comments

Comments
 (0)