Commit Graph

11 Commits

Author SHA1 Message Date
c5bdd44e55 fix(recipe): update regex to match Grok's current output style
Adjust the regex in handleApplyStep to flexibly match both old and new Grok formats for code blocks. Also, remove blank import for bufio as it's now used.
2026-03-06 22:21:58 +00:00
b2b8c1a482 refactor(recipe/runner): improve regex flexibility and simplify patch creation
- Update discoverFiles comment to be more concise.
- Enhance blockRe regex to optionally match leading "// " for filenames, supporting varied Grok output formats.
- Revise handleApplyStep comment to reflect regex changes.
- Simplify createUnifiedPatch by removing unnecessary error checks on fmt.Fprintf and defer closure.
2026-03-06 22:15:33 +00:00
40d40f7669 refactor(recipe): clean up runner implementation
- Adjust bufio import to blank (likely for side effects or pending use)
- Refine comments for clarity and remove unnecessary ones
- Split regex string to avoid backtick collisions in literals
- Add error handling to patch writing in createUnifiedPatch
- Minor formatting and defer close adjustments
2026-03-06 22:07:22 +00:00
7b415f8e26 feat(recipe): add file discovery and special step handling in runner
- Introduce discoverFiles function to scan Go files in 'internal' for error handling patterns.
- Add special case for "discover" or "find" steps to perform filesystem scans.
- Refine LLM prompting to enforce strict output format and shorten system prompt.
- Update apply/patch handling and unified patch creation with simplifications.
- Import bufio for potential future use and adjust regex for code block extraction.
2026-03-06 21:57:35 +00:00
824bbcb85f refactor(recipe): simplify code block extraction regex
Update the regex in runner.go to use string concatenation for better readability.
Add test output files as fixtures for test verification.
2026-03-06 21:40:03 +00:00
b9de35f48b refactor(recipe): simplify apply step to dry-run only and add extraction tests
- Restrict filesystem interactions to apply/patch steps exclusively.
- Remove real apply logic with user confirmation; default to creating a patch file in dry-run mode.
- Update prompts, comments, and regex for better clarity and precision.
- Add unit tests for the extractCodeBlocks function to ensure reliable parsing.
2026-03-06 21:36:31 +00:00
0ba427aaf6 feat(recipe): add apply/patch step handling with code block extraction and application
- Introduce special case in Runner.Run() for steps containing "apply" or "patch" in title.
- Add handleApplyStep to parse code blocks from previous results, support dry-run patch creation, or real application with user confirmation and backups.
- Implement extractCodeBlocks using regex to identify labelled Go code blocks.
- Add createUnifiedPatch for generating unified diff patches in dry-run mode.
- Remove final summary prompt and streamline recipe completion.
- Adjust system prompt for clarity.
2026-03-06 21:01:01 +00:00
d1ebd2af79 refactor(recipe): improve loading and execution logic
- Enhance recipe parsing in loader.go: extract overview, use split-based step extraction to avoid duplicates, refine final summary handling, and clean up comments/templates.
- Refine runner.go prompts: add Grok system message, simplify user prompts for conciseness, adjust result joining with separators, and remove unnecessary text.
2026-03-06 20:46:30 +00:00
5c67f78c27 feat(recipe): implement LLM-powered recipe execution
Add support for executing recipe steps via Grok API streaming, including parameter defaults from YAML, model selection via flags/config, previous step context, and a final summary prompt. Update runner to handle client and model, and refine loader to apply user params with fallbacks.
2026-03-06 20:32:04 +00:00
2cc728eed4 refactor(recipe): clean up comments, error handling, and output formatting
- Simplify import comments and error handling in cmd/recipe.go
- Streamline regex comment in internal/recipe/loader.go
- Enhance console output and add LLM placeholder in internal/recipe/runner.go
2026-03-06 19:00:16 +00:00
aa38e92fb5 feat(recipe): add recipe system for Result[T] refactoring
Implement recipe loading, parsing, and running infrastructure.
Add initial result-refactor recipe for converting Go error handling to monadic Result[T] style.
Includes markdown recipe definition, YAML frontmatter parsing, step extraction, and basic runner.
2026-03-06 18:35:58 +00:00