You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
variant_line=$(printf '%s\n'"$file_content"| grep -E "<!--[[:space:]]*VARIANT:${script_variant}[[:space:]]"| head -1 | sed -E "s/.*VARIANT:${script_variant}[[:space:]]+//; s/-->.*//")
72
58
if [[ -z$variant_line ]];then
73
59
echo"Warning: no variant line found for $script_variant in $template">&2
74
60
variant_line="(Missing variant command for $script_variant)"
75
61
fi
76
-
# Replace the token VARIANT-INJECT with the selected variant line
77
-
injected=$(printf '%s\n'"$raw_body"| sed "s/VARIANT-INJECT/${variant_line//\//\/}/")
78
-
# Remove all single-line variant comments
79
-
injected=$(printf '%s\n'"$injected"| sed '/<!--[[:space:]]*VARIANT:sh/d'| sed '/<!--[[:space:]]*VARIANT:ps/d')
80
-
# Guard: if after stripping variant lines and injection the body became empty, restore original (minus variant comments) to avoid empty prompt files
81
-
if [[ -z${injected///} ]];then
82
-
echo"Warning: resulting injected body empty for $template; writing unmodified body">&2
83
-
injected=$raw_body
84
-
fi
85
-
# Apply arg substitution and path rewrite
86
-
body=$(printf '%s\n'"$injected"| sed "s/{ARGS}/$arg_format/g"| sed "s/__AGENT__/$agent/g"| rewrite_paths)
62
+
# Replace VARIANT-INJECT and remove variant comments
63
+
body=$(printf '%s\n'"$file_content"| sed "s|VARIANT-INJECT|${variant_line}|"| sed '/<!--[[:space:]]*VARIANT:sh/d'| sed '/<!--[[:space:]]*VARIANT:ps/d')
64
+
# Apply substitutions
65
+
body=$(printf '%s\n'"$body"| sed "s/{ARGS}/$arg_format/g"| sed "s/__AGENT__/$agent/g"| rewrite_paths)
variant_line=$(printf '%s\n'"$plan_norm"| grep -E "<!--[[:space:]]*VARIANT:$script"| head -1 | sed -E "s/.*VARIANT:$script[[:space:]]+//; s/-->.*//; s/^[[:space:]]+//; s/[[:space:]]+$//")
108
88
if [[ -n$variant_line ]];then
109
89
tmp_file=$(mktemp)
110
-
sed "s/VARIANT-INJECT/${variant_line//\//\/}/""$plan_tpl"| sed "/__AGENT__/s//${agent}/g"| sed '/<!--[[:space:]]*VARIANT:sh/d'| sed '/<!--[[:space:]]*VARIANT:ps/d'>"$tmp_file"&& mv "$tmp_file""$plan_tpl"
90
+
sed "s|VARIANT-INJECT|${variant_line}|""$plan_tpl"|tr -d '\r'|sed "s|__AGENT__|${agent}|g"| sed '/<!--[[:space:]]*VARIANT:sh/d'| sed '/<!--[[:space:]]*VARIANT:ps/d'>"$tmp_file"&& mv "$tmp_file""$plan_tpl"
111
91
else
112
-
echo"Warning: no plan-template variant for $script">&2
92
+
echo"Warning: no plan-template variant for $script (pattern not matched)">&2
Copy file name to clipboardExpand all lines: templates/commands/plan.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,8 +1,8 @@
1
1
---
2
2
description: Execute the implementation planning workflow using the plan template to generate design artifacts.
3
3
---
4
-
<!-- VARIANT:sh 1. Run `scripts/bash/setup-plan.sh --json` from the repo root and parse JSON for FEATURE_SPEC, IMPL_PLAN, SPECS_DIR, BRANCH. All future file paths must be absolute. -->
5
-
<!-- VARIANT:ps 1. Run `scripts/powershell/setup-plan.ps1 -Json` from the repo root and parse JSON for FEATURE_SPEC, IMPL_PLAN, SPECS_DIR, BRANCH. All future file paths must be absolute. -->
4
+
<!-- VARIANT:sh Run `scripts/bash/setup-plan.sh --json` from the repo root and parse JSON for FEATURE_SPEC, IMPL_PLAN, SPECS_DIR, BRANCH. All future file paths must be absolute. -->
5
+
<!-- VARIANT:ps Run `scripts/powershell/setup-plan.ps1 -Json` from the repo root and parse JSON for FEATURE_SPEC, IMPL_PLAN, SPECS_DIR, BRANCH. All future file paths must be absolute. -->
6
6
7
7
Given the implementation details provided as an argument, do this:
Copy file name to clipboardExpand all lines: templates/commands/specify.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,8 +1,8 @@
1
1
---
2
2
description: Create or update the feature specification from a natural language feature description.
3
3
---
4
-
<!-- VARIANT:sh 1. Run the script `scripts/bash/create-new-feature.sh --json "{ARGS}"` from repo root and parse its JSON output for BRANCH_NAME and SPEC_FILE. All file paths must be absolute. -->
5
-
<!-- VARIANT:ps 1. Run the script `scripts/powershell/create-new-feature.ps1 -Json "{ARGS}"` from repo root and parse its JSON output for BRANCH_NAME and SPEC_FILE. All file paths must be absolute. -->
4
+
<!-- VARIANT:sh Run the script `scripts/bash/create-new-feature.sh --json "{ARGS}"` from repo root and parse its JSON output for BRANCH_NAME and SPEC_FILE. All file paths must be absolute. -->
5
+
<!-- VARIANT:ps Run the script `scripts/powershell/create-new-feature.ps1 -Json "{ARGS}"` from repo root and parse its JSON output for BRANCH_NAME and SPEC_FILE. All file paths must be absolute. -->
6
6
7
7
Given the feature description provided as an argument, do this:
Copy file name to clipboardExpand all lines: templates/commands/tasks.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,8 +1,8 @@
1
1
---
2
2
description: Generate an actionable, dependency-ordered tasks.md for the feature based on available design artifacts.
3
3
---
4
-
<!-- VARIANT:sh 1. Run `scripts/bash/check-task-prerequisites.sh --json` from repo root and parse FEATURE_DIR and AVAILABLE_DOCS list. All paths must be absolute. -->
5
-
<!-- VARIANT:ps 1. Run `scripts/powershell/check-task-prerequisites.ps1 -Json` from repo root and parse FEATURE_DIR and AVAILABLE_DOCS list. All paths must be absolute. -->
4
+
<!-- VARIANT:sh Run `scripts/bash/check-task-prerequisites.sh --json` from repo root and parse FEATURE_DIR and AVAILABLE_DOCS list. All paths must be absolute. -->
5
+
<!-- VARIANT:ps Run `scripts/powershell/check-task-prerequisites.ps1 -Json` from repo root and parse FEATURE_DIR and AVAILABLE_DOCS list. All paths must be absolute. -->
6
6
7
7
Given the context provided as an argument, do this:
0 commit comments