114 lines
2.2 KiB
Markdown
114 lines
2.2 KiB
Markdown
|
|
# 🔄 Grokkit Workflows
|
||
|
|
|
||
|
|
Learn how to integrate Grokkit into your development cycle effectively.
|
||
|
|
|
||
|
|
## Git Workflow Integration
|
||
|
|
|
||
|
|
The standard way to use Grokkit for your daily git tasks:
|
||
|
|
|
||
|
|
```bash
|
||
|
|
# 1. Make changes
|
||
|
|
vim src/api.go
|
||
|
|
|
||
|
|
# 2. Review with AI
|
||
|
|
git add src/api.go
|
||
|
|
grokkit review
|
||
|
|
|
||
|
|
# 3. Fix issues, then commit
|
||
|
|
git add src/api.go
|
||
|
|
grokkit commit
|
||
|
|
|
||
|
|
# 4. Generate PR description
|
||
|
|
grokkit pr-describe
|
||
|
|
```
|
||
|
|
|
||
|
|
## Code Refactoring Workflow
|
||
|
|
|
||
|
|
Use Grokkit to plan and execute larger code changes:
|
||
|
|
|
||
|
|
```bash
|
||
|
|
# 1. Chat to plan approach
|
||
|
|
grokkit chat
|
||
|
|
> "How should I refactor this authentication code to use middleware?"
|
||
|
|
|
||
|
|
# 2. Apply changes with edit
|
||
|
|
grokkit edit auth.go "implement middleware pattern as discussed"
|
||
|
|
|
||
|
|
# 3. Review changes
|
||
|
|
grokkit review
|
||
|
|
|
||
|
|
# 4. Commit
|
||
|
|
grokkit commit
|
||
|
|
```
|
||
|
|
|
||
|
|
## Debugging Workflow
|
||
|
|
|
||
|
|
Quickly identify and fix bugs using a combination of chat and editing:
|
||
|
|
|
||
|
|
```bash
|
||
|
|
# 1. Describe issue in chat
|
||
|
|
grokkit chat --debug
|
||
|
|
> "I'm getting a nil pointer error in handler.go:42"
|
||
|
|
|
||
|
|
# 2. Apply suggested fixes
|
||
|
|
grokkit edit handler.go "add nil checks before dereferencing user object"
|
||
|
|
|
||
|
|
# 3. Verify and commit
|
||
|
|
grokkit review
|
||
|
|
grokkit commit
|
||
|
|
```
|
||
|
|
|
||
|
|
## Batch File Editing
|
||
|
|
|
||
|
|
Automate repetitive edits across many files:
|
||
|
|
|
||
|
|
```bash
|
||
|
|
# Edit multiple files with consistent changes
|
||
|
|
for file in src/*.go; do
|
||
|
|
grokkit edit "$file" "add context parameter to all exported functions"
|
||
|
|
done
|
||
|
|
|
||
|
|
# Review all changes together
|
||
|
|
grokkit review
|
||
|
|
```
|
||
|
|
|
||
|
|
## Code Quality Workflow
|
||
|
|
|
||
|
|
Maintain high standards with AI-assisted linting and documentation:
|
||
|
|
|
||
|
|
```bash
|
||
|
|
# 1. Check a file for linting issues
|
||
|
|
grokkit lint app.py --dry-run
|
||
|
|
|
||
|
|
# 2. Apply AI-suggested fixes with preview
|
||
|
|
grokkit lint app.py
|
||
|
|
|
||
|
|
# 3. Auto-fix multiple files
|
||
|
|
for file in src/*.js; do
|
||
|
|
grokkit lint "$file" --auto-fix
|
||
|
|
done
|
||
|
|
|
||
|
|
# 4. Review and commit
|
||
|
|
grokkit review
|
||
|
|
grokkit commit
|
||
|
|
```
|
||
|
|
|
||
|
|
## Documentation Generation Workflow
|
||
|
|
|
||
|
|
Generate comprehensive documentation for your project in seconds:
|
||
|
|
|
||
|
|
```bash
|
||
|
|
# 1. Preview docs for a single file
|
||
|
|
grokkit docs internal/api/handler.go
|
||
|
|
|
||
|
|
# 2. Batch-document a package
|
||
|
|
grokkit docs cmd/*.go --auto-apply
|
||
|
|
|
||
|
|
# 3. Document across languages in one pass
|
||
|
|
grokkit docs lib/utils.py src/helpers.ts --auto-apply
|
||
|
|
|
||
|
|
# 4. Review and commit
|
||
|
|
grokkit review
|
||
|
|
grokkit commit
|
||
|
|
```
|