Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Oct 31, 2025

Replaces Go's text/template package with os.Expand() for simpler, shell-style variable expansion in prompt files.

Changes

Code (main.go)

  • Removed text/template import and template parsing/execution logic
  • Implemented variable substitution using os.Expand() with a mapping function
  • Missing parameters now expand to empty strings (vs. <no value>)

Syntax

  • Before: {{ .variableName }}
  • After: ${variableName} or $variableName

Tests (integration_test.go)

  • Added TestTemplateExpansionWithOsExpand for both brace and non-brace syntax
  • Added TestTemplateExpansionWithMissingParams for empty string behavior

Documentation (README.md)

  • Updated all examples and documentation to use shell-style expansion syntax

Example

# Task: ${taskName}

Implement ${feature} in ${language}.
Environment: $env
coding-context -p taskName="AddAuth" -p feature="OAuth" -p language="Go" -p env="prod" my-task
Original prompt

Change to use os.Expand() instead of text/template.


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI and others added 3 commits October 31, 2025 20:21
Co-authored-by: alexec <1142830+alexec@users.noreply.github.com>
Co-authored-by: alexec <1142830+alexec@users.noreply.github.com>
Co-authored-by: alexec <1142830+alexec@users.noreply.github.com>
Copilot AI changed the title [WIP] Change implementation from text/template to os.Expand Replace text/template with os.Expand() for variable substitution Oct 31, 2025
Copilot AI requested a review from alexec October 31, 2025 20:29
@alexec alexec marked this pull request as ready for review October 31, 2025 20:29
@alexec alexec merged commit 9409173 into main Oct 31, 2025
2 checks passed
@alexec alexec deleted the copilot/change-to-use-os-expand branch October 31, 2025 20:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants