-
Notifications
You must be signed in to change notification settings - Fork 43
Refactor cache memory prompt to markdown template with placeholder interpolation #11705
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…tution Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
|
@copilot the interpolation is done in a later step. Remove sed calls and make sure the variables are passed in tbe interpolation step |
- Updated template to use __GH_AW_CACHE_DIR__ and __GH_AW_CACHE_DESCRIPTION__ placeholders - Removed Substitutions field from PromptSection - Changed buildCacheMemoryPromptSection to use EnvVars instead of Substitutions - Added logic to include static env vars in the substitution step expression mappings - Removed all sed-based substitution code from unified_prompt_step.go - Updated tests to check for env vars and substitution step instead of sed commands - Cache values are now passed to substitute_placeholders.cjs for interpolation Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Done in commit 49e7fbb. Removed sed calls and updated to pass cache variables (GH_AW_CACHE_DIR, GH_AW_CACHE_DESCRIPTION) through the substitute_placeholders.cjs interpolation step. The template file is now simply cat'd at runtime, and values are interpolated in the later "Substitute placeholders" step. |
|
@copilot substitution should only happen in the substitution step |
…eation step
- Modified generateUnifiedPromptStep to exclude static env vars from prompt creation step
- Static values (not wrapped in ${{ }}) now only added to substitution step
- Updated test to verify cache env vars are not in prompt creation step
- Recompiled all workflow files
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Fixed in commit cb90f11. Cache env vars now only appear in the "Substitute placeholders" step, not the "Create prompt" step. Static values are excluded from the prompt creation step's environment and only passed to the substitution step for interpolation. |
|
@copilot add tests for multiple caches |
…scenarios - Added 7 unit tests covering single cache, multiple caches, and edge cases - Tests verify template file usage for single default cache - Tests verify inline content generation for multiple caches - Tests verify environment variable handling - Tests verify description text formatting - All 40 cache-related tests passing Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Added in commit 031354e. Created 7 unit tests for buildCacheMemoryPromptSection covering:
All 40 cache-related tests passing. |
|
@copilot merge main, format, lint go |
- Merged origin/main branch - Fixed testifylint issue: use assert.Empty instead of assert.Equal(t, "") - Formatting: removed trailing whitespace - All linters passing Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Refactor cache memory prompt text to markdown template file
Summary:
Refactored cache memory prompt from inline generation to a markdown template file with placeholder interpolation via the substitute_placeholders.cjs script.
Changes:
actions/setup/md/cache_memory_prompt.mdtemplate with__GH_AW_CACHE_DIR__and__GH_AW_CACHE_DESCRIPTION__placeholdersbuildCacheMemoryPromptSectionto useEnvVarsfor static valuesunified_prompt_step.goto pass static env vars ONLY to substitution step (not prompt creation step)Implementation:
Prompt Creation Step: Simply cats the template file without cache env vars
Substitution Step: Contains cache env vars and performs interpolation
Testing:
Original prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.