Commit Graph

39 Commits

Author SHA1 Message Date
7cb9eb3eb7 refactor(recipe): switch refactor step to strict JSON output
- Update result-refactor.md to output JSON array of file changes instead of code blocks
- Modify runner.go to parse JSON directly, removing regex-based extraction
- Add project_languages and extensions to recipe metadata
- Improve error handling and output consistency in steps
2026-03-06 22:40:29 +00:00
d4f3e3adbc refactor(recipe): update regex for robust Grok output matching
- Blank import bufio to avoid unused warnings.
- Refine regex to handle double-quoted format and fix backtick issues.
- Update comments for clarity on regex changes.
2026-03-06 22:25:39 +00:00
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
852142730a refactor(recipe): enhance parsing for multi-line step content
Replace regex-based sub-section extraction with label-indexed parsing to
handle multi-line content, blank lines, and ensure reliability without
duplicates. Add clarifying comments for templates and summary extraction.
2026-03-06 21:48: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
6bd72aad25 refactor(recipe): improve subRe regexp and add explanatory comments
Simplify the subRe regular expression by using a non-capturing group for the section labels instead of alternation, and switch the lookahead to a non-capturing group for consistency. Add comments to document the purpose of stepRe and subRe for better maintainability.
2026-03-06 18:39:56 +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
f0322a84bd chore(lint): enhance golangci configuration and add security annotations
Some checks failed
CI / Test (push) Successful in 33s
CI / Lint (push) Failing after 17s
CI / Build (push) Successful in 21s
- Expand .golangci.yml with more linters (bodyclose, errcheck, etc.), settings for govet, revive, gocritic, gosec
- Add // nolint:gosec comments for intentional file operations and subprocesses
- Change file write permissions from 0644 to 0600 for better security
- Refactor loops, error handling, and test parallelism with t.Parallel()
- Minor fixes: ignore unused args, use errors.Is, adjust mkdir permissions to 0750
2026-03-04 20:00:32 +00:00
ce5367c3a7 feat(cmd): add changelog command for AI-generated release notes
Some checks failed
CI / Test (push) Failing after 27s
CI / Lint (push) Has been skipped
CI / Build (push) Has been skipped
- Implement `grokkit changelog` command with flags for version, since, stdout, and commit reminder
- Add git helpers for latest/previous tags and formatted log since ref
- Include tests for message building and full changelog construction
2026-03-03 21:59:09 +00:00
ebb0cbcf3a test(cmd): add unit tests for completion, root execution, config, errors, and logger
Some checks failed
CI / Test (push) Failing after 26s
CI / Lint (push) Has been skipped
CI / Build (push) Has been skipped
- Add tests for shell completion generation in completion_test.go
- Add tests for root command execution and flags in root_test.go
- Expand config tests for temperature, timeout, and log level getters
- Add APIError unwrap test in errors_test.go
- Add WithContext tests in logger_test.go
- Stage test output artifact in .output.txt
2026-03-02 22:12:54 +00:00
918ccc01c8 refactor(tests): improve error handling and defer usage
All checks were successful
CI / Test (push) Successful in 31s
CI / Lint (push) Successful in 25s
CI / Build (push) Successful in 22s
Release / Create Release (push) Successful in 36s
- Add error checking for os.Setenv and io operations in test files
- Use anonymous functions in defer to ignore errors from os.Remove, os.Setenv, etc.
- Minor formatting and consistency fixes in tests and client code
2026-03-02 21:33:11 +00:00
99ef10b16b refactor(cmd): extract run funcs and add injectable deps for testability
Some checks failed
CI / Test (push) Successful in 34s
CI / Lint (push) Failing after 19s
CI / Build (push) Successful in 20s
- Introduce newGrokClient and gitRun vars to allow mocking in tests.
- Refactor commit, commitmsg, history, prdescribe, and review cmds into separate run funcs.
- Update docs, lint, and review to use newGrokClient.
- Add comprehensive unit tests in run_test.go covering happy paths, errors, and edge cases.
- Expand grok client tests with SSE server mocks for Stream* methods.
2026-03-02 20:47:16 +00:00
f763976a27 docs(client): add documentation comments to Client struct and methods
Some checks failed
CI / Test (push) Failing after 24s
CI / Lint (push) Has been skipped
CI / Build (push) Has been skipped
Release / Create Release (push) Successful in 36s
Add detailed GoDoc-style comments for the Client struct, NewClient function,
and various streaming methods to improve code readability and documentation.
Also include a comment for CleanCodeResponse and minor formatting adjustments.
2026-03-02 20:20:18 +00:00
68df041a09 test(version): add tests for version information
All checks were successful
CI / Test (push) Successful in 32s
CI / Lint (push) Successful in 25s
CI / Build (push) Successful in 20s
Add unit tests to verify that Version is set and note that Commit and BuildDate may be empty in development builds.

Update .gitignore to ignore the .junie/ directory.
2026-03-02 18:41:27 +00:00
b8482b6fb0 feat(release): add automated release workflow and install script
Some checks failed
CI / Test (push) Successful in 26s
CI / Lint (push) Successful in 20s
CI / Build (push) Successful in 14s
Release / Create Release (push) Failing after 10s
- Embed version info in binaries via ldflags
- Create multi-platform builds, archives, and checksums
- Add Gitea release creation and asset upload in CI
- Introduce GoReleaser config for standardized builds
- Add version command and install script for easy deployment
- Update README with pre-built installation instructions
2026-03-01 23:25:31 +00:00
9f1309ba1a feat(lint): add lint command with AI-powered fixes
Introduce new `grokkit lint` command for automatic language detection,
linting, and AI-suggested fixes. Supports 9 languages including Go, Python,
JavaScript, TypeScript, Rust, Ruby, Java, C/C++, and Shell.

- Add cmd/lint.go for command implementation
- Create internal/linter package with detection and execution logic
- Update README.md with usage examples and workflows
- Enhance docs/ARCHITECTURE.md and docs/TROUBLESHOOTING.md
- Add comprehensive tests for linter functionality
2026-03-01 13:21:44 +00:00
13519438a2 test: add unit tests for chat history, edit helper, and code cleaning
- Introduce tests for chat history file handling, loading/saving, and error cases in cmd/chat_test.go
- Add tests for removeLastModifiedComments in cmd/edit_helper_test.go
- Add comprehensive tests for CleanCodeResponse in internal/grok/cleancode_test.go
- Update Makefile to centralize build artifacts in build/ directory for coverage reports and binary
- Adjust .gitignore to ignore chat_history.json and remove obsolete coverage file entries
2026-03-01 12:44:20 +00:00
8b6449c947 feat(logging): implement structured logging with slog
- Refactor logger package to use Go's slog for JSON-structured logs
- Add configurable log levels (debug, info, warn, error) via config and flags
- Integrate logging across commands, git operations, and API client with metrics like timing and sizes
- Update README with logging documentation and usage examples
- Add global --debug and --verbose flags
- Enhance tests for logger initialization, levels, and structured output
2026-03-01 12:35:21 +00:00
e355142c05 feat: add CI/CD workflows, persistent chat, shell completions, and testing
- Add Gitea CI workflow for testing, linting, and building
- Add release workflow for multi-platform builds and GitHub releases
- Implement persistent chat history with JSON storage
- Add shell completion generation for bash, zsh, fish, powershell
- Introduce custom error types and logging system
- Add interfaces for git and AI client for better testability
- Enhance config with temperature and timeout settings
- Add comprehensive unit tests for config, errors, git, grok, and logger
- Update README with installation, features, and development instructions
- Make model flag persistent across commands
- Add context timeouts to API requests
2026-03-01 12:17:22 +00:00
9bd3e1d00e refactor: add error handling and refactor git utilities
- Enhance error checking in all commands using git.Run
- Refactor git helper to return errors properly
- Fix README.md filename typo
- Update .gitignore with additional ignores
- Add fallback for config home dir
- Improve request handling in grok client
2026-03-01 12:08:49 +00:00
9927b1fb6a chore(build): add Makefile and tests for commands and utilities
- Introduced Makefile with targets for testing (all, coverage, agent-specific), building, installing, cleaning, and help
- Added unit and integration tests for agent command, edit command, and CleanCodeResponse function
- Refactored CleanCodeResponse to use regex for robust markdown fence removal in agent and client modules
- Ensured tests cover code cleaning, plan generation placeholders, and file editing functionality
2026-03-01 00:24:48 +00:00
f540f5fc24 refactor(cmd): remove unnecessary last modified comments and timestamps
- Eliminate header comments with timestamps and ownership from all source files
- Update agent and edit commands to clean such comments and simplify response handling
- Add helper to remove last modified lines in edit command
- Minor formatting and import cleanups across codebase
2026-02-28 22:59:16 +00:00
98eb5505a5 chore(headers): add last modified timestamps to source files
Implemented automatic addition of "// Last modified: [timestamp]" headers across command and internal files for better tracking. Updated prompts in agent and edit commands to enforce header format. Added logic to prepend header if missing in generated content. Fixed minor issues like missing newlines at end of files.
2026-02-28 22:47:30 +00:00
ed614ae0db refactor(agent): refine prompts and code cleaning logic
- Remove unnecessary comments in agent.go for cleaner code
- Update system prompt to enforce exact header comment format
- Adjust progress logging format
- Fix CleanCodeResponse to properly strip markdown fences
- Update StreamSilent comment to include agent usage
2026-02-28 22:40:31 +00:00
8e0d06d8a1 feat(cmd): add agent command for multi-file AI editing
Introduce new `agent` command that scans .go files in the project, generates an AI-driven plan for changes based on user instruction, and applies edits with previews and backups. Includes integration with Grok client for planning and content generation.

Update existing files with timestamp comments as part of the agent's editing demonstration. Add agentCmd to root command.
2026-02-28 22:29:16 +00:00
363733c2e6 feat(chat): add interactive TUI with Bubble Tea and streaming
- Replace basic CLI chat with Bubble Tea-based TUI featuring viewport, textarea, colored history, and streaming replies.
- Add StreamSilent method to client for TUI integration without live printing.
- Introduce model flag for chat command.
- Update dependencies to include charmbracelet libraries.
2026-02-28 21:53:35 +00:00
5112f13fdd refactor(edit): improve response handling and add diff preview
- Strengthen system prompt to enforce pure content output
- Introduce CleanCodeResponse to strip markdown fences from Grok responses
- Display proposed file changes as a unified diff for better preview
- Clean up .gitignore and add ignores for logs/tmp files
- Delete built binary grokkit file
2026-02-28 20:31:02 +00:00
f0858e08c1 refactor(cli): simplify commands and remove TUI dependencies
- Switch chat command from Bubble Tea TUI to basic CLI with bufio.
- Hardcode Grok model in commands, remove Viper config.
- Stream responses directly in client, remove channel-based streaming.
- Add safe previews/backups in edit, simplify prompts across tools.
- Update git helper and trim unused deps in go.mod.
2026-02-28 20:17:12 +00:00
917bab2adc pretty up the client interface 2026-02-28 19:56:23 +00:00
4498f6fdf9 initial client and helper skeletons 2026-02-28 18:41:20 +00:00
59b47fd533 stub out project 2026-02-28 18:03:12 +00:00