-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
[Feature request]: Enhanced Variable Substitution and Input Processing #1144
Comments
@mattjoyce thanks for your proposal, I like it. Please proceed with the impl. and send a PR. |
@eugeis , how complete is restapi? My approach will be to insatiate plugins/template/template.go to handle all substitutions, and then, fsdb/patterns.go will just handle the pattern retrival |
|
Most of the goals are included in PR #1155 For the first plugins, I have kept them pretty basic, and all work with existing libs, actually native go I think. |
Thank you, I merged it. |
What do you need?
Feature Request: Enhanced Variable Substitution and Input Processing in Fabric
Overview
Propose improvements to Fabric's variable handling and input processing to enhance automation capabilities while maintaining backward compatibility through configuration.
Proposed Changes
1. Standardized Variable Notation
Move from direct substitution to double brace notation with simplified CLI usage.
{{role}}
{{max_word_count}}
Why Double Braces?
Industry Standard Template Syntax:
Advantages over alternatives:
#variable
: Can conflict with Markdown headers, hashtags$variable
: Could be confused with shell variables, environment variables%variable%
: Less common in modern systemsBetter Pattern Readability:
Future-proofing:
Double brace syntax enables powerful plugin architecture integration
Nested variable resolution: inner variables resolved before plugin processing
Example plugin capabilities:
a. System Information:
b. Date and Time Operations:
c. Text Processing (with variable nesting):
d. Data Operations:
e. Database Queries (with variable interpolation):
These examples demonstrate how the double brace syntax enables:
Enhanced Error Detection:
#variable
syntax makes it impossible to reliably detect missing variables{{variable}}
, Fabric can:Implementation details:
-v=role:expert
(no # prefix needed).env
setting:LEGACY_VARIABLE_SUBSTITUTION=true/false
2. Special Input Variable
{{input}}
as a special variable for content placement{{input}}
exists in pattern: place input at that location3. Input Front Matter Support
Benefits
{{varname}}
)Use Cases
Backward Compatibility
{{input}}
not specified (if missing will be appended to pattern at runtime)LEGACY_VARIABLE_SUBSTITUTION=true
Implementation Notes
GetApplyVariables
functionTechnical Considerations
Front Matter Processing:
Variable Substitution:
{{input}}
variableError Handling:
Contribution Offer
I am willing to take on the development and testing of this enhancement, including:
Next Steps
Please share your thoughts and suggestions on this enhancement, particularly:
This enhancement aims to make Fabric more powerful for automation while maintaining its simplicity for interactive use.
The text was updated successfully, but these errors were encountered: