This repository was archived by the owner on May 29, 2026. It is now read-only.
Add support for setting default script metadata via GENAISCRIPT_DEFAULT_SCRIPT_META environment variable#1928
Merged
Conversation
…ta parsing Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Ability to set default script parameters from .env
Add support for setting default script parameters via GENAISCRIPT_DEFAULT_META environment variable
Sep 16, 2025
Member
|
@copilot rename GENAISCRIPT_DEFAULT_META to GENAISCRIPT_DEFAULT_SCRIPT_META |
pelikhan
reviewed
Sep 16, 2025
| // Parse and merge default metadata from environment variables (last to take priority) | ||
| const envDefaults = parseDefaultMetaFromEnv(process.env); | ||
| if (envDefaults) { | ||
| // Merge environment defaults last so they take highest priority |
| } | ||
|
|
||
| dbg(`parsed GENAISCRIPT_DEFAULT_META: %O`, parsed); | ||
| return parsed as Partial<PromptArgs>; |
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Author
Copilot
AI
changed the title
Add support for setting default script parameters via GENAISCRIPT_DEFAULT_META environment variable
Add support for setting default script parameters via GENAISCRIPT_DEFAULT_SCRIPT_META environment variable
Sep 16, 2025
…r to valid PromptArgs Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot
AI
changed the title
Add support for setting default script parameters via GENAISCRIPT_DEFAULT_SCRIPT_META environment variable
Add support for setting default script metadata via GENAISCRIPT_DEFAULT_SCRIPT_META environment variable
Sep 16, 2025
Copilot stopped work on behalf of
pelikhan due to an error
September 16, 2025 16:09
pelikhan
approved these changes
Sep 16, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR implements the ability to set default script metadata globally using the
GENAISCRIPT_DEFAULT_SCRIPT_METAenvironment variable, addressing the feature request to configure default metadata values for all scripts from a centralized location.Problem
Users needed a way to set default metadata values across all their GenAIScript scripts without having to modify each individual script file. This is particularly useful for:
Solution
Added a new environment variable
GENAISCRIPT_DEFAULT_SCRIPT_METAthat accepts JSON5-formatted script metadata. The implementation includes:Core Changes
parseDefaultMetaFromEnv()inenv.tsthat safely parses the environment variable as JSON5 and filters to valid PromptArgs fieldsparsePromptScript()intemplate.tsto merge only the metadata field from environment defaultsid,jsSource,defTools, andresolvedSystemUsage Example
Error Handling
DEBUG=genaiscript:config:envis setComprehensive Testing
Added extensive test coverage including:
The implementation follows existing code patterns and maintains backward compatibility while providing a safe way to set default metadata across all scripts without affecting other script properties.
Additional instructions:
Fixes #1924
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.