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
Add expand_params frontmatter field to disable parameter expansion (#148)
* Initial plan
* Add expand_params frontmatter field to control parameter expansion
- Added expand_params field to TaskFrontMatter, CommandFrontMatter, and RuleFrontMatter
- Updated context.go to check expand_params before expanding parameters
- Added shouldExpandParams helper function (defaults to true when not specified)
- Added comprehensive tests for all scenarios (tasks, commands, rules with various combinations)
- All tests passing, code linted successfully
Co-authored-by: alexec <1142830+alexec@users.noreply.github.com>
* Add documentation and examples for expand_params feature
- Added expand_params documentation to file-formats.md for tasks, commands, and rules
- Created example files demonstrating expand_params: false usage
- Added Command Files section to documentation
- All examples show how to disable parameter expansion when needed
Co-authored-by: alexec <1142830+alexec@users.noreply.github.com>
* Address code review feedback
- Added UnmarshalJSON method to CommandFrontMatter for consistency with TaskFrontMatter and RuleFrontMatter
- Updated findCommand function comment to reflect conditional parameter expansion behavior
- All tests passing, code linted successfully
Co-authored-by: alexec <1142830+alexec@users.noreply.github.com>
* Improve code comments for clarity
- Updated shouldExpandParams comment to use lowercase 'expandParams' for consistency
- Clarified findCommand comment to explicitly state default expansion behavior
- All tests passing, code linted successfully
Co-authored-by: alexec <1142830+alexec@users.noreply.github.com>
* Add historical context to comments
- Added comment explaining CommandFrontMatter evolution from empty placeholder
- Enhanced findCommand comment to explain command frontmatter support
- All tests passing, code linted successfully
Co-authored-by: alexec <1142830+alexec@users.noreply.github.com>
* Clarify parameter substitution comment for better accuracy
- Enhanced findCommand comment to explicitly state default behavior
- Clarified that substitution happens by default (nil or true)
- Emphasized that substitution is skipped only when explicitly false
- All tests passing, code linted successfully
Co-authored-by: alexec <1142830+alexec@users.noreply.github.com>
---------
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: alexec <1142830+alexec@users.noreply.github.com>
Copy file name to clipboardExpand all lines: docs/reference/file-formats.md
+158Lines changed: 158 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -313,6 +313,52 @@ selectors:
313
313
314
314
This would only include the rules from `security-standards.md` and `go-best-practices.md`.
315
315
316
+
#### `expand_params` (optional)
317
+
318
+
**Type:** Boolean
319
+
**Purpose:** Controls whether parameter expansion should occur in the task content. Defaults to `true` if not specified.
320
+
321
+
When set to `false`, parameter placeholders like `${variable}` are preserved as-is in the output, rather than being replaced with values from `-p` flags.
322
+
323
+
**Example (with parameter expansion disabled):**
324
+
```yaml
325
+
---
326
+
task_name: preserve-template
327
+
expand_params: false
328
+
---
329
+
330
+
Issue: ${issue_number}
331
+
Title: ${issue_title}
332
+
```
333
+
334
+
**Usage:**
335
+
```bash
336
+
# Even with -p flags, parameters won't be expanded
Use `${parameter_name}` syntax for dynamic values.
@@ -348,6 +394,92 @@ Task files must be in one of these directories:
348
394
349
395
Tasks are matched by filename (without `.md` extension). The `task_name` field in frontmatter is optional and used only for metadata. For example, a file named `fix-bug.md` is matched by the command `/fix-bug`, regardless of whether it has `task_name` in its frontmatter.
350
396
397
+
## Command Files
398
+
399
+
Command files are reusable content blocks that can be referenced from task files using slash command syntax (e.g., `/command-name`). They are Markdown files with optional YAML frontmatter.
400
+
401
+
### Format
402
+
403
+
```markdown
404
+
---
405
+
<optional-frontmatter-fields>
406
+
---
407
+
408
+
# Command content in Markdown
409
+
410
+
This content will be substituted when the command is referenced.
411
+
```
412
+
413
+
### Frontmatter Fields (optional)
414
+
415
+
#### `expand_params` (optional)
416
+
417
+
**Type:** Boolean
418
+
**Purpose:** Controls whether parameter expansion should occur in the command content. Defaults to `true` if not specified.
419
+
420
+
When set to `false`, parameter placeholders like `${variable}` are preserved as-is in the output.
0 commit comments