fix/markdown_awareness_for_edit #7
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "fix/markdown_awareness_for_edit"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Refactor and Enhance
analyzeandeditCommands for Better Usability and Markdown SupportSummary
This PR introduces several improvements to the
analyzeandeditcommands in Grokkit. The changes include code cleanups, bug fixes, enhanced logging and error handling, and new support for editing Markdown files in theeditcommand. These updates aim to make the tool more robust, user-friendly, and versatile while maintaining its core functionality of AI-assisted code analysis and editing.Key Changes
cmd/analyze.go:
".grokkit/analysis.md"when not specified, ensuring consistent project-local storage.fmt.Fprintffor safer string formatting inbuildProjectContext.strings.Builder, this adds robustness).config.GetModelcall to correctly pass command name and flag.discoverSourceFilesto properly handle hidden directories while allowing descent into relevant source dirs.StreamSilentfor long reports, preventing live output clutter..grokkitdirectory before writing output files to avoid failures in new projects.--yesinvocations.cmd/edit.go:
.mdfiles and used a tailored system prompt for technical writing tasks.CleanCodeResponse(which is code-specific).removeLastModifiedCommentsto be case-insensitive and check trimmed lines, improving accuracy in removing unwanted comments.// nolint:goseccomment as the file read is intentional and user-controlled.Motivation
editexpand the tool's utility beyond code to documentation. The preview/confirmation inanalyzeprevents accidental overwrites, and ensuring.grokkitexists fixes potential errors in fresh repositories.config.GetModelusage, incomplete directory skipping, and potential formatting errors in context building.Testing Notes
go test ./...to ensure no regressions in affected packages (internal/git,internal/grok,internal/linter,internal/prompts). All tests passed..grokkit/analysis.md.--yesflag: Skipped confirmation successfully.-for stdout)..go): Edited with instructions; confirmed comments removed, diffs shown, and file updated only after confirmation.README.md): Applied edits; verified tailored prompt used, no code cleaning applied, and output trimmed correctly.