Skip to content

[Feature] Variable-aware Dynamic Prompt Templates #4

@hahwul

Description

@hahwul

Currently, templates in cjules (~/.config/cjules/templates/) are static text. It would be incredibly powerful to support dynamic prompt rendering with variables and local context, such as current git diffs or file contents.

Example Usage:
A template refactor.md:

Please refactor the following code:

[Code]
{{.File "src/parser.cr"}}

[Notes]
{{.Var "note"}}

Command:

cjules new --template refactor --var note="Improve error handling"

Proposed variables/helpers to support:

  • {{.File "relative/path"}} : Inserts the content of the specified file.
  • {{.GitDiff}} : Inserts the current git diff of the repository.
  • {{.Var "name"}} : Inserts a user-defined variable passed via --var name=value.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions